/* ==========================================================================
   S&K SUPERMARCHE - PREMIUM CORPORATE STYLESHEET
   Treasury Digital Signature Station & Monitoring Portal
   ========================================================================== */

:root {
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-glow: rgba(29, 78, 216, 0.35);
  --navy-dark: #090e17;
  --navy-bar: #0f172a;
  --navy-surface: #1e293b;
  --gold: #d97706;
  --gold-glow: rgba(217, 119, 6, 0.25);
  --success: #059669;
  --success-glow: rgba(5, 150, 105, 0.25);
  --danger: #dc2626;
  --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  --paper-bg: #ffffff;
  --text-dark: #0f172a;
  --text-muted: #64748b;
  --border-light: #cbd5e1;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px -4px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 40px -8px rgba(15, 23, 42, 0.12), 0 4px 12px -2px rgba(15, 23, 42, 0.06);
  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", Helvetica, Arial, sans-serif;
  background: var(--bg-gradient);
  color: var(--text-dark);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.sign-body, .monitor-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   TOPBAR
   ========================================================================== */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 24px;
  background: var(--navy-bar);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-logo {
  height: 42px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
  transition: transform 0.3s ease;
}
.topbar-logo:hover {
  transform: scale(1.04);
}

.topbar-titles {
  display: flex;
  flex-direction: column;
}

.topbar-brand {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.topbar-sub {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.topbar-right {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* ==========================================================================
   STATUS BADGES & CHIPS
   ========================================================================== */

.status {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 12.5px;
  white-space: nowrap;
  letter-spacing: 0.2px;
  transition: var(--transition);
}

.status.waiting {
  background: rgba(148, 163, 184, 0.18);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.status.ready {
  background: rgba(14, 165, 233, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.4);
  box-shadow: 0 0 12px rgba(14, 165, 233, 0.25);
}

.status.signing {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
  animation: pulseAmber 2s infinite;
}

.status.saving {
  background: rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.4);
}

.status.signed {
  background: rgba(16, 185, 129, 0.22);
  color: #4ade80;
  border: 1px solid rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
}

.status.error {
  background: rgba(239, 68, 68, 0.25);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.12);
  letter-spacing: 0.3px;
}

.station-chip {
  background: rgba(29, 78, 216, 0.25);
  border-color: rgba(96, 165, 250, 0.4);
  color: #93c5fd;
}

.dot.live {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px #22c55e;
  animation: pulseGreen 2s infinite;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  padding: 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.btn-icon:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  transform: scale(1.05);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn.primary {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border-color: #1d4ed8;
  color: #ffffff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn.secondary {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
}
.btn.secondary:hover:not(:disabled) {
  background: #e2e8f0;
  color: #0f172a;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ==========================================================================
   WAITING SCREEN (RADAR ANIMATION)
   ========================================================================== */

.waiting-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
  animation: fadeIn 0.6s ease;
}

.radar-wrap {
  position: relative;
  width: 130px;
  height: 130px;
  margin: 0 auto 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.radar-circle {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid var(--primary);
  opacity: 0;
  animation: radarWave 2.8s infinite cubic-bezier(0.2, 0.8, 0.4, 1);
}

.radar-circle.delay {
  animation-delay: 1.4s;
}

.radar-center {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px var(--primary-glow);
  z-index: 2;
  animation: pulseScale 3s infinite ease-in-out;
}

.waiting-title {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 10px;
}

.waiting-sub {
  font-size: 15px;
  color: #475569;
  max-width: 540px;
  line-height: 1.6;
  margin: 0 auto 24px;
}

.badge-action {
  background: #dbeafe;
  color: #1e40af;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-weight: 700;
}

.waiting-foot {
  font-size: 12.5px;
  color: #94a3b8;
  letter-spacing: 0.3px;
}

/* ==========================================================================
   REPORT VOUCHER PAPER
   ========================================================================== */

.page {
  max-width: 920px;
  margin: 24px auto;
  padding: 0 16px;
  width: 100%;
}

.paper-container {
  display: flex;
  justify-content: center;
}

.paper {
  background: var(--paper-bg);
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 36px 42px 30px;
  font-size: 13.5px;
  width: 100%;
  max-width: 860px;
  position: relative;
  overflow: hidden;
  animation: slideUpFade 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.paper::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, #1d4ed8 0%, #f59e0b 50%, #1d4ed8 100%);
}

.paper-corp-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 2px solid #0f172a;
}

.corp-logo-box {
  width: 90px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.corp-logo-img {
  max-height: 54px;
  max-width: 90px;
  object-fit: contain;
}

.corp-info {
  flex: 1;
}

.corp-name {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: 0.5px;
}

.corp-details {
  font-size: 11.5px;
  color: #475569;
  font-weight: 500;
  margin-top: 2px;
}

.corp-dept {
  font-size: 10.5px;
  font-weight: 700;
  color: #1d4ed8;
  letter-spacing: 0.8px;
  margin-top: 3px;
  text-transform: uppercase;
}

.paper-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 14px;
}

.title-main {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.doc-badge {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-weight: 700;
  font-size: 13px;
}

.paper-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px 18px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.fin-meta {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.paper-party {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 12px;
}

.party-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.field {
  padding: 2px 0;
}

.field-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.field-value {
  font-size: 13.5px;
  font-weight: 600;
  color: #0f172a;
}

/* ==========================================================================
   LINES TABLE
   ========================================================================== */

.lines {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.lines th {
  text-align: left;
  background: #f1f5f9;
  border-bottom: 1px solid #cbd5e1;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #475569;
  letter-spacing: 0.3px;
}

.lines td {
  padding: 7px 10px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 12.5px;
  color: #1e293b;
}

.lines th.num, .lines td.num {
  text-align: right;
}

.lines tr:nth-child(even) td {
  background: #fafafa;
}

.lines tr.totals td {
  font-weight: 800;
  border-top: 2px solid #0f172a;
  background: #f8fafc;
  color: #0f172a;
}

.empty-lines {
  text-align: center;
  color: #64748b;
  padding: 16px !important;
  font-style: italic;
}

/* ==========================================================================
   SIGNATURE BLOCK
   ========================================================================== */

.paper-footer {
  margin-top: 22px;
}

.paper-certif {
  font-size: 11.5px;
  color: #64748b;
  font-style: italic;
  line-height: 1.5;
  margin-bottom: 12px;
  border-left: 3px solid #cbd5e1;
  padding-left: 10px;
}

.sign-row {
  display: flex;
  justify-content: flex-end;
}

.sign-box {
  width: 360px;
  border: 2px dashed #1d4ed8;
  border-radius: var(--radius-md);
  text-align: center;
  padding: 10px 10px 6px;
  background: #f8faff;
  box-shadow: inset 0 2px 8px rgba(29, 78, 216, 0.04);
}

.sign-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  padding: 0 4px;
}

.sign-tag {
  font-size: 10.5px;
  font-weight: 700;
  color: #1d4ed8;
  letter-spacing: 0.5px;
}

.sign-pen-icon {
  font-size: 14px;
}

.sig-canvas {
  width: 100%;
  height: 150px;
  display: block;
  touch-action: none;
  background: #ffffff;
  border: 1px solid #dbeafe;
  border-radius: var(--radius-sm);
  cursor: crosshair;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.04);
}

.sign-line {
  color: #64748b;
  font-size: 11px;
  padding-top: 6px;
}

/* Actions */
.actions {
  margin-top: 18px;
  display: flex;
  gap: 14px;
  justify-content: center;
}

.save-btn {
  padding: 12px 28px;
  font-size: 15px;
}

/* ==========================================================================
   SUCCESS MODAL
   ========================================================================== */

.success-wrap {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn 0.25s ease;
}

.success-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  border: 1px solid #e2e8f0;
  animation: popIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.success-icon-wrap {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: #dcfce7;
  color: #15803d;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 0 24px rgba(34, 197, 94, 0.3);
}

.success-card h3 {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 8px;
}

.success-sub {
  font-size: 14.5px;
  color: #475569;
  margin: 0 0 16px;
}

.success-pdf-chip {
  font-size: 12.5px;
  color: #1e40af;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  display: inline-block;
  margin-bottom: 18px;
  font-weight: 600;
}

.success-timer {
  font-size: 12.5px;
  color: #94a3b8;
}

/* ==========================================================================
   LOGIN SCREEN
   ========================================================================== */

.login-body {
  background: radial-gradient(circle at 50% 20%, #1e3a8a 0%, #0f172a 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-lg);
  padding: 42px 38px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.5);
  text-align: center;
  animation: slideUpFade 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-brand {
  margin-bottom: 18px;
}

.login-logo {
  height: 64px;
  width: auto;
  object-fit: contain;
  margin-bottom: 12px;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.15));
}

.brand-pill {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
}

.login-card h1 {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 6px;
  letter-spacing: -0.3px;
}

.login-sub {
  font-size: 13.5px;
  color: #64748b;
  margin: 0 0 24px;
  line-height: 1.5;
}

.form-group {
  text-align: left;
  margin-bottom: 16px;
}

.login-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 6px;
}

.opt-tag {
  font-weight: 400;
  color: #94a3b8;
  font-size: 11px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  color: #94a3b8;
  pointer-events: none;
}

.login-input {
  width: 100%;
  padding: 12px 14px 12px 38px;
  font-size: 14.5px;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-md);
  background: #ffffff;
  color: #0f172a;
  transition: var(--transition);
}

.login-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.12);
}

.login-btn {
  width: 100%;
  margin-top: 8px;
  padding: 13px 0;
  font-size: 15.5px;
  font-weight: 700;
}

.login-error {
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}

.login-info {
  color: #166534;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}

.login-footer {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
}

.login-footer small {
  font-size: 10px;
  color: #94a3b8;
  font-weight: 400;
}

/* Kiosk Footer */
.kiosk-footer {
  text-align: center;
  padding: 12px;
  font-size: 10.5px;
  letter-spacing: 0.8px;
  color: #94a3b8;
  font-weight: 600;
}

/* ==========================================================================
   ANIMATIONS & KEYFRAMES
   ========================================================================== */

@keyframes radarWave {
  0% { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(1.6); opacity: 0; }
}

@keyframes pulseGreen {
  0%, 100% { box-shadow: 0 0 6px #22c55e; }
  50% { box-shadow: 0 0 16px #22c55e, 0 0 24px rgba(34, 197, 94, 0.4); }
}

@keyframes pulseAmber {
  0%, 100% { box-shadow: 0 0 6px #f59e0b; }
  50% { box-shadow: 0 0 16px #f59e0b, 0 0 24px rgba(245, 158, 11, 0.4); }
}

@keyframes pulseScale {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUpFade {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   RESPONSIVE DESIGN (TABLETS / PHONES)
   ========================================================================== */

@media (max-width: 768px) {
  .paper { padding: 22px 18px; }
  .paper-party { grid-template-columns: 1fr; }
  .sign-row { justify-content: center; }
  .sign-box { width: 100%; }
  .topbar { padding: 10px 14px; }
  .topbar-sub { display: none; }
}