/* =========================================================
   ID CARD STUDIO — Design System
   Palette: Navy #12213B, Teal #0F8B8D, Gold #D4A24C,
            Canvas #F5F7FA, Ink #1F2937, Line #E3E7EE
   Type: Sora (display) / Inter (body) / JetBrains Mono (data)
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700;800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600&display=swap');

:root{
  --navy: #12213B;
  --navy-2: #1A2E52;
  --teal: #0F8B8D;
  --teal-dark: #0B6668;
  --gold: #D4A24C;
  --canvas: #F5F7FA;
  --card: #FFFFFF;
  --ink: #1F2937;
  --ink-soft: #5B6474;
  --line: #E3E7EE;
  --danger: #D64545;
  --danger-soft: #FCEBEB;
  --success: #1E9E6B;
  --success-soft: #E7F7F1;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(18,33,59,.06), 0 1px 1px rgba(18,33,59,.04);
  --shadow-md: 0 8px 24px rgba(18,33,59,.10);
  --shadow-lg: 0 20px 48px rgba(18,33,59,.18);
  --sidebar-w: 264px;
}

*,*::before,*::after{box-sizing:border-box;}
html{-webkit-text-size-adjust:100%;}
body{
  margin:0;
  font-family:'Inter',system-ui,sans-serif;
  background:var(--canvas);
  color:var(--ink);
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,h4,.font-display{ font-family:'Sora',sans-serif; letter-spacing:-0.01em; }
.mono{ font-family:'JetBrains Mono',monospace; letter-spacing:0; }
a{color:inherit;}
button{font-family:inherit;}
img{max-width:100%; display:block;}
:focus-visible{ outline:2px solid var(--teal); outline-offset:2px; }

@media (prefers-reduced-motion: reduce){
  *{ animation-duration:0.001ms !important; transition-duration:0.001ms !important; }
}

/* ---------- Layout shells ---------- */
.app-shell{ display:flex; min-height:100vh; }

.sidebar{
  width:var(--sidebar-w);
  background:linear-gradient(190deg, var(--navy) 0%, var(--navy-2) 100%);
  color:#fff;
  flex-shrink:0;
  padding:22px 16px;
  position:fixed; top:0; left:0; bottom:0;
  display:flex; flex-direction:column;
  transition:transform .25s ease;
  z-index:60;
}
.sidebar-brand{
  display:flex; align-items:center; gap:10px;
  padding:6px 8px 22px;
  border-bottom:1px solid rgba(255,255,255,.1);
  margin-bottom:18px;
}
.brand-mark{
  width:38px; height:38px; border-radius:10px;
  background:linear-gradient(135deg, var(--gold), #f0c274);
  display:flex; align-items:center; justify-content:center;
  font-weight:800; color:var(--navy); font-family:'Sora',sans-serif; font-size:16px;
  flex-shrink:0;
}
.brand-name{ font-family:'Sora',sans-serif; font-weight:700; font-size:16px; line-height:1.2; }
.brand-sub{ font-size:11px; color:rgba(255,255,255,.55); font-weight:500; }

.nav-group-label{
  font-size:10.5px; text-transform:uppercase; letter-spacing:.08em;
  color:rgba(255,255,255,.4); font-weight:600; margin:16px 10px 8px;
}
.nav-link{
  display:flex; align-items:center; gap:11px;
  padding:10px 12px; border-radius:10px; color:rgba(255,255,255,.75);
  font-size:14.5px; font-weight:500; text-decoration:none; margin-bottom:2px;
  transition:background .15s ease, color .15s ease;
}
.nav-link svg{ width:18px; height:18px; flex-shrink:0; opacity:.9; }
.nav-link:hover{ background:rgba(255,255,255,.07); color:#fff; }
.nav-link.active{ background:rgba(255,255,255,.12); color:#fff; box-shadow:inset 3px 0 0 var(--gold); }

.sidebar-footer{ margin-top:auto; padding-top:14px; border-top:1px solid rgba(255,255,255,.1); }
.logout-btn{
  display:flex; align-items:center; gap:10px; width:100%;
  background:none; border:1px solid rgba(255,255,255,.15); color:rgba(255,255,255,.8);
  padding:10px 12px; border-radius:10px; font-size:14px; cursor:pointer;
}
.logout-btn:hover{ background:rgba(255,255,255,.08); color:#fff; }

.main-col{ margin-left:var(--sidebar-w); flex:1; min-width:0; display:flex; flex-direction:column; min-height:100vh; }

.topbar{
  height:66px; background:var(--card); border-bottom:1px solid var(--line);
  display:flex; align-items:center; justify-content:space-between;
  padding:0 24px; position:sticky; top:0; z-index:40;
}
.topbar-left{ display:flex; align-items:center; gap:14px; }
.hamburger{ display:none; background:none; border:none; cursor:pointer; padding:6px; }
.hamburger svg{ width:22px; height:22px; }
.page-title{ font-size:19px; font-weight:700; }
.page-subtitle{ font-size:12.5px; color:var(--ink-soft); margin-top:1px;}
.topbar-right{ display:flex; align-items:center; gap:14px; }
.avatar-chip{ display:flex; align-items:center; gap:9px; padding:5px 6px 5px 5px; }
.avatar-circle{
  width:34px; height:34px; border-radius:50%; background:var(--teal); color:#fff;
  display:flex; align-items:center; justify-content:center; font-weight:700; font-size:13px;
  font-family:'Sora',sans-serif;
}
.avatar-name{ font-size:13.5px; font-weight:600; line-height:1.2; }
.avatar-role{ font-size:11px; color:var(--ink-soft); }

.page-body{ padding:24px; flex:1; }

.sidebar-overlay{
  display:none; position:fixed; inset:0; background:rgba(18,33,59,.45); z-index:55;
}

@media (max-width: 960px){
  .sidebar{ transform:translateX(-100%); }
  .sidebar.open{ transform:translateX(0); }
  .main-col{ margin-left:0; }
  .hamburger{ display:inline-flex; }
  .sidebar-overlay.open{ display:block; }
}

/* ---------- Buttons ---------- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:10px 18px; border-radius:10px; font-size:14px; font-weight:600;
  border:1px solid transparent; cursor:pointer; transition:transform .1s ease, box-shadow .15s ease, background .15s ease;
  white-space:nowrap;
}
.btn svg{ width:16px; height:16px; }
.btn:active{ transform:scale(.98); }
.btn-primary{ background:var(--teal); color:#fff; }
.btn-primary:hover{ background:var(--teal-dark); }
.btn-gold{ background:var(--gold); color:var(--navy); }
.btn-gold:hover{ filter:brightness(.95); }
.btn-outline{ background:#fff; color:var(--ink); border-color:var(--line); }
.btn-outline:hover{ border-color:var(--teal); color:var(--teal-dark); }
.btn-danger-soft{ background:var(--danger-soft); color:var(--danger); }
.btn-danger-soft:hover{ background:#f6d6d6; }
.btn-ghost{ background:transparent; color:var(--ink-soft); }
.btn-ghost:hover{ background:var(--canvas); }
.btn-icon{ padding:8px; border-radius:9px; }
.btn:disabled{ opacity:.55; cursor:not-allowed; }
.btn-block{ width:100%; }
.btn-sm{ padding:7px 12px; font-size:13px; }

/* ---------- Cards / stats ---------- */
.card{ background:var(--card); border:1px solid var(--line); border-radius:var(--radius); }
.stat-grid{ display:grid; grid-template-columns:repeat(4, 1fr); gap:16px; margin-bottom:22px; }
@media (max-width:1100px){ .stat-grid{ grid-template-columns:repeat(2,1fr); } }
@media (max-width:560px){ .stat-grid{ grid-template-columns:1fr; } }
.stat-card{
  background:var(--card); border:1px solid var(--line); border-radius:var(--radius);
  padding:18px 20px; box-shadow:var(--shadow-sm); position:relative; overflow:hidden;
}
.stat-card::after{
  content:""; position:absolute; right:-30px; top:-30px; width:90px; height:90px; border-radius:50%;
  background:var(--stat-color, var(--teal)); opacity:.08;
}
.stat-icon{
  width:38px; height:38px; border-radius:10px; display:flex; align-items:center; justify-content:center;
  background:color-mix(in srgb, var(--stat-color, var(--teal)) 14%, white); color:var(--stat-color, var(--teal));
  margin-bottom:14px;
}
.stat-icon svg{ width:19px; height:19px; }
.stat-value{ font-family:'Sora',sans-serif; font-size:28px; font-weight:800; line-height:1; margin-bottom:4px;}
.stat-label{ font-size:13px; color:var(--ink-soft); font-weight:500; }
.stat-trend{ font-size:12px; margin-top:8px; font-weight:600; }
.trend-up{ color:var(--success); }
.trend-flat{ color:var(--ink-soft); }

.section-card{ background:var(--card); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow-sm); }
.section-card-head{ padding:18px 20px; border-bottom:1px solid var(--line); display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap;}
.section-card-title{ font-family:'Sora',sans-serif; font-weight:700; font-size:16px; }
.section-card-body{ padding:20px; }

/* ---------- Login page ---------- */
.login-wrap{ min-height:100vh; display:flex; background:var(--canvas); }
.login-visual{
  flex:1.1; background:radial-gradient(circle at 20% 20%, #1c3763, var(--navy) 60%);
  position:relative; display:flex; align-items:center; justify-content:center;
  padding:48px; overflow:hidden;
}
.login-visual::before{
  content:""; position:absolute; inset:0;
  background-image:radial-gradient(rgba(255,255,255,.06) 1px, transparent 1px);
  background-size:22px 22px;
}
.login-visual-inner{ position:relative; z-index:2; max-width:420px; color:#fff; }
.login-visual-eyebrow{
  display:inline-flex; align-items:center; gap:8px; font-size:12px; font-weight:600;
  letter-spacing:.06em; text-transform:uppercase; color:var(--gold); margin-bottom:18px;
}
.login-visual h1{ font-size:32px; line-height:1.2; margin:0 0 14px; }
.login-visual p{ color:rgba(255,255,255,.65); font-size:14.5px; line-height:1.6; margin-bottom:34px; }

/* ================= LOGIN PAGE — MOBILE RESPONSIVE ================= */
@media (max-width: 767px){
  .login-wrap{
    flex-direction: column;
    min-height: 100vh;
  }

  /* Decorative side panel hata do — phone par space bachega, aur
     data bhi kam use hoga (background image/animation load nahi hogi) */
  .login-visual{
    display: none;
  }

  .login-panel{
    padding: 32px 20px;
    align-items: flex-start;
    padding-top: 48px;
  }

  .login-box{
    max-width: none;
    width: 100%;
  }

  .login-box-head h2{
    font-size: 21px;
  }

  /* 16px+ zaroori hai — isse kam par iOS Safari input focus par
     auto-zoom kar deta hai */
  .field-input{
    font-size: 16px;
  }

  .form-row-between{
    flex-wrap: wrap;
    gap: 8px;
  }
}

@media (max-width: 380px){
  .login-panel{
    padding: 24px 16px;
  }
  .login-box-head h2{
    font-size: 19px;
  }
}
/* signature element: tilted ID card mockup */
.id-card-mock{
  width:300px; background:#fff; border-radius:16px; padding:18px;
  box-shadow:0 30px 60px rgba(0,0,0,.35);
  transform:rotate(-6deg) translateY(0);
  animation:cardFloat 5s ease-in-out infinite;
  position:relative;
}
@keyframes cardFloat{
  0%,100%{ transform:rotate(-6deg) translateY(0); }
  50%{ transform:rotate(-4deg) translateY(-10px); }
}
.id-card-mock::before{
  content:""; position:absolute; inset:0; border-radius:16px; padding:2px;
  background:linear-gradient(135deg, var(--gold), var(--teal));
  -webkit-mask:linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite:xor; mask-composite:exclude; pointer-events:none;
}
.id-card-mock-head{ display:flex; justify-content:space-between; align-items:center; margin-bottom:14px; }
.id-card-mock-logo{ font-family:'Sora',sans-serif; font-weight:800; font-size:13px; color:var(--navy); }
.id-card-mock-badge{ font-size:9px; background:var(--teal); color:#fff; padding:3px 7px; border-radius:5px; font-weight:700; letter-spacing:.03em; }
.id-card-mock-body{ display:flex; gap:14px; }
.id-card-mock-photo{
  width:64px; height:78px; border-radius:8px;
  background:linear-gradient(160deg,#dfe6f0,#c7d1e0);
  display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.id-card-mock-photo svg{ width:30px; height:30px; color:#8a97ad; }
.id-card-mock-lines{ flex:1; padding-top:2px; }
.id-card-mock-name{ height:10px; width:85%; background:var(--navy); border-radius:4px; margin-bottom:8px; }
.id-card-mock-line{ height:7px; background:#dfe4ec; border-radius:4px; margin-bottom:6px; }
.id-card-mock-line.w60{ width:60%; }
.id-card-mock-line.w75{ width:75%; }
.id-card-mock-line.w45{ width:45%; }
.id-card-mock-strip{ margin-top:14px; height:8px; border-radius:4px; background:repeating-linear-gradient(90deg, var(--navy) 0 6px, transparent 6px 10px); opacity:.6;}

.login-panel{
  flex:1; display:flex; align-items:center; justify-content:center; padding:32px;
}
.login-box{ width:100%; max-width:400px; }
.login-box-head{ margin-bottom:28px; }
.login-box-head h2{ font-size:24px; margin:0 0 6px; }
.login-box-head p{ color:var(--ink-soft); font-size:14px; margin:0; }

.field-group{ margin-bottom:18px; }
.field-label{ display:block; font-size:13px; font-weight:600; margin-bottom:7px; color:var(--ink); }
.field-input-wrap{ position:relative; }
.field-input{
  width:100%; padding:12px 14px; border-radius:10px; border:1.5px solid var(--line);
  font-size:14.5px; font-family:inherit; background:#fff; color:var(--ink);
  transition:border-color .15s ease, box-shadow .15s ease;
}
.field-input:focus{ border-color:var(--teal); box-shadow:0 0 0 3px rgba(15,139,141,.14); outline:none; }
.field-input.with-icon{ padding-left:40px; }
.field-icon{ position:absolute; left:13px; top:50%; transform:translateY(-50%); width:17px; height:17px; color:var(--ink-soft); }
.field-toggle{ position:absolute; right:12px; top:50%; transform:translateY(-50%); background:none; border:none; cursor:pointer; color:var(--ink-soft); padding:4px; }
.field-error{ color:var(--danger); font-size:12.5px; margin-top:6px; display:none; }
.field-group.has-error .field-input{ border-color:var(--danger); }
.field-group.has-error .field-error{ display:block; }

.form-row-between{ display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; font-size:13.5px; }
.checkbox-row{ display:flex; align-items:center; gap:8px; }
.checkbox-row input{ width:16px; height:16px; accent-color:var(--teal); }
.link-teal{ color:var(--teal-dark); font-weight:600; text-decoration:none; }
.link-teal:hover{ text-decoration:underline; }
.login-alert{
  display:none; align-items:center; gap:9px; background:var(--danger-soft); color:var(--danger);
  padding:11px 13px; border-radius:9px; font-size:13.5px; margin-bottom:18px;
}
.login-alert.show{ display:flex; }
.login-alert svg{ width:17px; height:17px; flex-shrink:0; }

/* ---------- Tabs (years) ---------- */
.year-tabs{ display:flex; gap:8px; overflow-x:auto; padding-bottom:2px; -ms-overflow-style:none; scrollbar-width:none; }
.year-tabs::-webkit-scrollbar{ display:none; }
.year-tab{
  flex-shrink:0; padding:9px 18px; border-radius:9px; border:1.5px solid var(--line); background:#fff;
  font-size:13.5px; font-weight:600; color:var(--ink-soft); cursor:pointer; font-family:'Sora',sans-serif;
  transition:all .15s ease; white-space:nowrap;
}
.year-tab:hover{ border-color:var(--teal); color:var(--teal-dark); }
.year-tab.active{ background:var(--navy); border-color:var(--navy); color:#fff; }
.year-tab .count{ opacity:.65; font-weight:500; margin-left:4px; }

/* ---------- Toolbar ---------- */
.toolbar{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin:18px 0; }
.search-box{ position:relative; flex:1; min-width:220px; max-width:340px; }
.search-box input{
  width:100%; padding:10px 14px 10px 38px; border-radius:10px; border:1.5px solid var(--line);
  font-size:14px; font-family:inherit;
}
.search-box input:focus{ border-color:var(--teal); outline:none; }
.search-box svg{ position:absolute; left:12px; top:50%; transform:translateY(-50%); width:17px; height:17px; color:var(--ink-soft); }
.toolbar-spacer{ flex:1; }
.filter-select{ padding:10px 14px; border-radius:10px; border:1.5px solid var(--line); font-size:13.5px; background:#fff; font-family:inherit; }

/* ---------- Table ---------- */
.table-wrap{ overflow-x:auto; }
table.data-table{ width:100%; border-collapse:collapse; font-size:13.5px; min-width:920px; }
.data-table thead th{
  text-align:left; padding:12px 14px; background:var(--canvas); color:var(--ink-soft);
  font-weight:600; font-size:12px; text-transform:uppercase; letter-spacing:.03em;
  border-bottom:1px solid var(--line); white-space:nowrap; position:sticky; top:0;
}
.data-table tbody td{ padding:11px 14px; border-bottom:1px solid var(--line); vertical-align:middle; }
.data-table tbody tr:hover{ background:#FAFBFD; }
.row-photo{ width:38px; height:38px; border-radius:8px; object-fit:cover; background:var(--canvas); }
.badge{ display:inline-flex; align-items:center; padding:3px 10px; border-radius:20px; font-size:11.5px; font-weight:700; }
.badge-teal{ background:rgba(15,139,141,.12); color:var(--teal-dark); }
.badge-gold{ background:rgba(212,162,76,.16); color:#8a6a25; }
.badge-danger{ background:var(--danger-soft); color:var(--danger); }
.row-actions{ display:flex; gap:6px; }
.icon-btn{
  width:32px; height:32px; border-radius:8px; border:1px solid var(--line); background:#fff;
  display:inline-flex; align-items:center; justify-content:center; cursor:pointer; color:var(--ink-soft);
  transition:all .15s ease;
}
.icon-btn svg{ width:15px; height:15px; }
.icon-btn:hover{ border-color:var(--teal); color:var(--teal-dark); background:rgba(15,139,141,.06); }
.icon-btn.danger:hover{ border-color:var(--danger); color:var(--danger); background:var(--danger-soft); }
.empty-state{ text-align:center; padding:60px 20px; color:var(--ink-soft); }
.empty-state svg{ width:52px; height:52px; margin-bottom:14px; opacity:.5; }

/* ---------- Pagination ---------- */
.pagination-bar{ display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-top:1px solid var(--line); flex-wrap:wrap; gap:12px; }
.pagination-info{ font-size:13px; color:var(--ink-soft); }
.pagination-controls{ display:flex; align-items:center; gap:6px; }
.page-btn{
  min-width:34px; height:34px; padding:0 8px; border-radius:8px; border:1px solid var(--line); background:#fff;
  cursor:pointer; font-size:13.5px; font-weight:600; color:var(--ink-soft);
}
.page-btn:hover:not(:disabled){ border-color:var(--teal); color:var(--teal-dark); }
.page-btn.active{ background:var(--teal); border-color:var(--teal); color:#fff; }
.page-btn:disabled{ opacity:.4; cursor:not-allowed; }

/* ---------- Modal ---------- */
.modal-overlay{
  position:fixed; inset:0; background:rgba(18,33,59,.5); display:none; align-items:center; justify-content:center;
  z-index:200; padding:20px; backdrop-filter:blur(2px);
}
.modal-overlay.open{ display:flex; }
.modal-box{
  background:#fff; border-radius:16px; width:100%; max-width:640px; max-height:92vh; overflow-y:auto;
  box-shadow:var(--shadow-lg); animation:modalIn .18s ease;
}
@keyframes modalIn{ from{ opacity:0; transform:translateY(10px) scale(.98);} to{ opacity:1; transform:translateY(0) scale(1);} }
.modal-head{ display:flex; align-items:center; justify-content:space-between; padding:20px 22px; border-bottom:1px solid var(--line); position:sticky; top:0; background:#fff; z-index:2;}
.modal-title{ font-size:17px; font-weight:700; font-family:'Sora',sans-serif; }
.modal-close{ background:none; border:none; cursor:pointer; color:var(--ink-soft); padding:6px; border-radius:8px; }
.modal-close:hover{ background:var(--canvas); }
.modal-body{ padding:22px; }
.modal-foot{ padding:16px 22px; border-top:1px solid var(--line); display:flex; justify-content:flex-end; gap:10px; position:sticky; bottom:0; background:#fff; }

.form-grid{ display:grid; grid-template-columns:1fr 1fr; gap:16px 18px; }
@media (max-width:560px){ .form-grid{ grid-template-columns:1fr; } }
.form-grid .full{ grid-column:1 / -1; }

/* photo uploader */
.photo-upload-row{ display:flex; align-items:center; gap:16px; margin-bottom:20px; flex-wrap:wrap; }
.photo-preview{
  width:88px; height:104px; border-radius:12px; background:var(--canvas); border:1.5px dashed var(--line);
  display:flex; align-items:center; justify-content:center; overflow:hidden; flex-shrink:0;
}
.photo-preview img{ width:100%; height:100%; object-fit:cover; }
.photo-preview svg{ width:32px; height:32px; color:var(--ink-soft); }
.photo-actions{ display:flex; flex-direction:column; gap:8px; }
.photo-actions-row{ display:flex; gap:8px; flex-wrap:wrap; }

/* crop modal */
.crop-modal .modal-box{ max-width:480px; }
.crop-stage{ background:#111; border-radius:10px; overflow:hidden; max-height:60vh; display:flex; align-items:center; justify-content:center; }
.crop-stage img{ display:block; max-width:100%; }
.crop-controls{ display:flex; align-items:center; gap:12px; margin-top:14px; }
.crop-controls input[type=range]{ flex:1; accent-color:var(--teal); }

/* camera modal */
.camera-stage{ position:relative; background:#000; border-radius:10px; overflow:hidden; }
.camera-stage video, .camera-stage canvas{ width:100%; display:block; }
.camera-oval-guide{
  position:absolute; inset:8%; border:2px dashed rgba(255,255,255,.6); border-radius:50%; pointer-events:none;
}

/* excel upload dropzone */
.dropzone{
  border:2px dashed var(--line); border-radius:12px; padding:32px 20px; text-align:center; cursor:pointer;
  transition:all .15s ease;
}
.dropzone.dragover{ border-color:var(--teal); background:rgba(15,139,141,.05); }
.dropzone svg{ width:36px; height:36px; color:var(--teal); margin-bottom:10px; }
.dropzone-title{ font-weight:600; font-size:14.5px; margin-bottom:4px; }
.dropzone-sub{ font-size:12.5px; color:var(--ink-soft); }

.upload-file-row{ display:flex; align-items:center; gap:10px; padding:10px 12px; background:var(--canvas); border-radius:9px; margin-top:12px; font-size:13.5px; }
.upload-file-row svg{ width:18px; height:18px; color:var(--teal); flex-shrink:0; }
.progress-track{ height:7px; background:var(--line); border-radius:20px; overflow:hidden; margin-top:12px; }
.progress-fill{ height:100%; background:var(--teal); width:0%; transition:width .2s ease; border-radius:20px; }

/* toast */
.toast-wrap{ position:fixed; top:20px; right:20px; z-index:400; display:flex; flex-direction:column; gap:10px; }
.toast{
  display:flex; align-items:center; gap:10px; background:#fff; border:1px solid var(--line); border-left:4px solid var(--teal);
  padding:13px 16px; border-radius:10px; box-shadow:var(--shadow-md); font-size:13.5px; font-weight:500; min-width:260px;
  animation:toastIn .2s ease;
}
.toast.success{ border-left-color:var(--success); }
.toast.error{ border-left-color:var(--danger); }
.toast svg{ width:18px; height:18px; flex-shrink:0; }
@keyframes toastIn{ from{ opacity:0; transform:translateX(20px);} to{ opacity:1; transform:translateX(0);} }

/* loader */
.spinner{ width:18px; height:18px; border:2.5px solid rgba(255,255,255,.4); border-top-color:#fff; border-radius:50%; animation:spin .7s linear infinite; }
.spinner.dark{ border-color:rgba(18,33,59,.2); border-top-color:var(--navy); }
@keyframes spin{ to{ transform:rotate(360deg); } }

.text-muted{ color:var(--ink-soft); }
.mt-0{margin-top:0;}
.hidden{ display:none !important; }

/* =========================================================
   ID CARD COMPONENT — rendered dynamically from theme + data
   Standard CR80 ratio card, ~340x214 base size
   ========================================================= */
.idcard-stage-wrap{ display:flex; align-items:center; justify-content:center; padding:10px 0; }
.idcard{
  width:340px; height:214px; border-radius:16px; position:relative; overflow:hidden;
  box-shadow:0 18px 40px rgba(18,33,59,.22); flex-shrink:0;
  font-family:'Inter',sans-serif; color:var(--card-text, #fff);
  background-color:var(--card-primary, #12213B);
  background-image:var(--card-bg-image, none);
  background-size:cover; background-position:center;
  -webkit-print-color-adjust:exact; print-color-adjust:exact; color-adjust:exact;
}
.idcard::before{ /* subtle default overlay so text stays legible over custom backgrounds */
  content:""; position:absolute; inset:0; background:var(--card-overlay, transparent); pointer-events:none;
}
.idcard-inner{ position:relative; z-index:2; width:100%; height:100%; }

.idcard-photo{
  overflow:hidden; background:rgba(255,255,255,.85);
  display:flex; align-items:center; justify-content:center; flex-shrink:0;
  -webkit-print-color-adjust:exact; print-color-adjust:exact; color-adjust:exact;
}
.idcard-photo.shape-square{ border-radius:4px; }
.idcard-photo.shape-rounded{ border-radius:14px; }
.idcard-photo.shape-circle{ border-radius:50%; }
.idcard-photo img{ width:100%; height:100%; object-fit:cover; }
.idcard-photo svg{ width:34%; height:34%; color:#8a97ad; }

.idcard-name{ font-family:'Sora',sans-serif; font-weight:800; line-height:1.15; }
.idcard-field{ font-size:10.5px; opacity:.92; line-height:1.5; }
.idcard-field b{ font-weight:700; }
.idcard-logo-row{ display:flex; align-items:center; gap:6px; }
.idcard-logo-dot{ width:20px; height:20px; border-radius:6px; background:var(--card-accent,#D4A24C); flex-shrink:0; display:flex; align-items:center; justify-content:center; font-family:'Sora',sans-serif; font-weight:800; font-size:9px; color:var(--card-primary,#12213B); }
.idcard-company{ font-family:'Sora',sans-serif; font-weight:700; font-size:11px; letter-spacing:.02em; }
.idcard-strip{ background:var(--card-accent,#D4A24C); }
.idcard-regno-chip{
  display:inline-block; background:rgba(255,255,255,.16); padding:2px 8px; border-radius:5px;
  font-family:'JetBrains Mono',monospace; font-size:10px; font-weight:600; letter-spacing:.02em;
}

/* --- layout: classic (photo left, header strip) --- */
.idcard--classic .idcard-header{ height:34px; background:var(--card-accent,#D4A24C); display:flex; align-items:center; padding:0 14px; }
.idcard--classic .idcard-body{ display:flex; gap:12px; padding:14px; }
.idcard--classic .idcard-photo{ width:70px; height:86px; }
.idcard--classic .idcard-name{ font-size:14.5px; margin-bottom:6px; }

/* --- layout: modern (centered photo, gradient) --- */
.idcard--modern .idcard-inner{ display:flex; flex-direction:column; align-items:center; text-align:center; padding:16px 14px 12px; }
.idcard--modern .idcard-photo{ width:64px; height:64px; margin-bottom:8px; }
.idcard--modern .idcard-name{ font-size:14px; margin-bottom:2px; }
.idcard--modern .idcard-fields{ margin-top:8px; display:grid; grid-template-columns:1fr 1fr; gap:2px 14px; width:100%; text-align:left; }

/* --- orientation: portrait (swapped dimensions, layouts re-flow to stack vertically) --- */
.idcard.idcard--portrait{ width:214px; height:340px; }
.idcard.idcard--portrait.idcard--classic .idcard-body{ flex-direction:column; align-items:center; text-align:center; padding-top:57px; }
.idcard.idcard--portrait.idcard--classic .idcard-photo{ width:96px; height:118px; margin-bottom:10px; }
.idcard.idcard--portrait.idcard--classic .idcard-regno-chip{ margin-top:8px; }
.idcard.idcard--portrait.idcard--compact .idcard-main{ flex-direction:column; align-items:center; text-align:center; padding-top:18px; }
.idcard.idcard--portrait.idcard--compact .idcard-photo{ width:92px; height:112px; margin-bottom:0px;margin-top:18px;  }
.idcard.idcard--portrait.idcard--compact .idcard-side{ width:100%; height:8px; position:absolute; top:0; left:0; }
.idcard.idcard--portrait.idcard--modern .idcard-photo{ width:80px; height:80px; }

.idcard-back.idcard-back--portrait{ width:214px; height:340px; }

/* --- photo frame shape — works across all layouts & orientations --- */
.idcard .idcard-photo.shape-circle{ border-radius:50% !important; }
.idcard--classic .idcard-photo.shape-circle,
.idcard--compact .idcard-photo.shape-circle{ width:78px; height:78px; }
.idcard.idcard--portrait.idcard--classic .idcard-photo.shape-circle,
.idcard.idcard--portrait.idcard--compact .idcard-photo.shape-circle{ width:104px; height:104px; }

/* --- orientation: landscape (default, no override needed) --- */
.idcard--compact .idcard-inner{ display:flex; height:100%; }
.idcard--compact .idcard-side{ width:10px; background:var(--card-accent,#D4A24C); flex-shrink:0; }
.idcard--compact .idcard-main{ flex:1; padding:14px; display:flex; gap:12px; }
.idcard--compact .idcard-photo{ width:60px; height:74px; }
.idcard--compact .idcard-name{ font-size:13.5px; margin-bottom:5px; }

.idcard-back{
  width:340px; height:214px; border-radius:16px; background:#fff; border:1px solid var(--line);
  padding:16px; color:var(--ink); flex-shrink:0; box-shadow:var(--shadow-sm);
}
.idcard-back .idcard-back-title{ font-weight:700; font-size:12px; margin-bottom:8px; }
.idcard-back .idcard-barcode{ height:32px; background:repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 5px); margin-top:14px; opacity:.75; }

.idcard-scale-toggle{ display:flex; justify-content:center; gap:10px; margin-top:16px; }

/* ---------------- PRINT: card looks exactly like on-screen, nothing else prints ---------------- */

@media print{
  .idcard, .idcard *, .idcard-back, .idcard-back *{
    -webkit-print-color-adjust:exact !important; print-color-adjust:exact !important; color-adjust:exact !important;
  }
  body *{ visibility:hidden; }
  .print-area, .print-area *{ visibility:visible; }

  /* The card lives inside a modal that's normally position:fixed with a vh-based
     max-height + overflow:auto — that collapses to nothing on the print page,
     which is why the printout came out blank. Reset every ancestor to normal flow. */
  .modal-overlay{
    position:static !important; inset:auto !important; background:none !important;
    padding:0 !important; display:block !important; backdrop-filter:none !important;
  }
  .modal-box{
    position:static !important; max-height:none !important; height:auto !important;
    overflow:visible !important; box-shadow:none !important; width:auto !important;
    max-width:none !important; margin:0 !important; border-radius:0 !important;
  }
  .modal-head, .modal-foot{ display:none !important; }
  .modal-body{ padding:0 !important; overflow:visible !important; max-height:none !important; }

  .print-area{
    position:static !important; width:100%; max-width:none !important; height:auto !important;
    display:flex; flex-wrap:wrap; gap:24px; justify-content:center; align-items:flex-start; padding:24px;
  }
  .idcard, .idcard-back{ box-shadow:none !important; }
}

/* =========================================================
   THEMES GALLERY
   ========================================================= */
.themes-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(260px,1fr)); gap:18px; }
.theme-card{
  background:#fff; border:1.5px solid var(--line); border-radius:var(--radius); overflow:hidden;
  transition:border-color .15s ease, box-shadow .15s ease; position:relative;
}
.theme-card:hover{ box-shadow:var(--shadow-md); }
.theme-card.is-active{ border-color:var(--teal); box-shadow:0 0 0 3px rgba(15,139,141,.14); }
.theme-card-preview{ padding:0; display:flex; align-items:center; justify-content:center; background:var(--canvas); height:150px; overflow:hidden; }
.theme-card-preview .idcard{ transform:scale(.56); flex-shrink:0; }
.theme-card-preview.is-portrait{ height:180px; }
.theme-card-preview.is-portrait .idcard{ transform:scale(.42); }
.theme-card-body{ padding:14px 16px; border-top:1px solid var(--line); }
.theme-card-name{ font-weight:700; font-size:14px; margin-bottom:2px; }
.theme-card-type{ font-size:11.5px; color:var(--ink-soft); margin-bottom:12px; }
.active-pill{
  position:absolute; top:10px; right:10px; background:var(--success); color:#fff; font-size:10.5px; font-weight:700;
  padding:3px 9px; border-radius:20px; display:flex; align-items:center; gap:4px; z-index:3;
}
.active-pill svg{ width:11px; height:11px; }
.theme-card-actions{ display:flex; gap:8px; }

.upload-theme-card{
  border:2px dashed var(--line); border-radius:var(--radius); display:flex; flex-direction:column; align-items:center;
  justify-content:center; padding:40px 16px; cursor:pointer; color:var(--ink-soft); text-align:center; min-height:210px;
  transition:all .15s ease;
}
.upload-theme-card:hover{ border-color:var(--teal); color:var(--teal-dark); background:rgba(15,139,141,.04); }
.upload-theme-card svg{ width:34px; height:34px; margin-bottom:10px; }

.color-swatch-row{ display:flex; gap:10px; align-items:center; }
.color-swatch-input{ width:44px; height:36px; border-radius:8px; border:1.5px solid var(--line); padding:2px; cursor:pointer; background:#fff; }
.layout-pick-row{ display:flex; gap:10px; }
.layout-pick{
  flex:1; border:1.5px solid var(--line); border-radius:10px; padding:10px; text-align:center; cursor:pointer; font-size:12.5px; font-weight:600;
  color:var(--ink-soft);
}
.layout-pick.active{ border-color:var(--teal); color:var(--teal-dark); background:rgba(15,139,141,.06); }
.layout-pick-icon{ width:44px; height:28px; margin:0 auto 6px; border-radius:5px; background:var(--canvas); border:1px solid var(--line); }

/* =========================================================
   PROFILE PAGE — premium layout
   ========================================================= */
.profile-cover{
  height:150px; border-radius:16px 16px 0 0; position:relative; overflow:hidden;
  background:linear-gradient(120deg, var(--navy) 0%, var(--navy-2) 55%, var(--teal-dark) 100%);
}
.profile-cover::before{
  content:""; position:absolute; inset:0;
  background-image:radial-gradient(rgba(255,255,255,.08) 1px, transparent 1px);
  background-size:20px 20px;
}
.profile-cover::after{
  content:""; position:absolute; right:-40px; bottom:-60px; width:220px; height:220px; border-radius:50%;
  background:var(--gold); opacity:.14;
}
.profile-card{ background:var(--card); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow-sm); overflow:visible; margin-bottom:22px; }
.profile-header-row{
  display:flex; align-items:flex-end; gap:20px; padding:0 26px 22px; margin-top:-52px; position:relative; z-index:2; flex-wrap:wrap;
}
.profile-avatar-wrap{ position:relative; flex-shrink:0; }
.profile-avatar{
  width:104px; height:104px; border-radius:50%; border:4px solid #fff; background:var(--canvas);
  overflow:hidden; box-shadow:var(--shadow-md); display:flex; align-items:center; justify-content:center;
}
.profile-avatar img{ width:100%; height:100%; object-fit:cover; }
.profile-avatar svg{ width:44px; height:44px; color:var(--ink-soft); }
.profile-avatar-edit{
  position:absolute; right:0; bottom:2px; width:32px; height:32px; border-radius:50%;
  background:var(--teal); color:#fff; border:3px solid #fff; display:flex; align-items:center; justify-content:center;
  cursor:pointer; box-shadow:var(--shadow-sm); transition:background .15s ease;
}
.profile-avatar-edit:hover{ background:var(--teal-dark); }
.profile-avatar-edit svg{ width:14px; height:14px; }
.profile-heading{ padding-top:10px; flex:1; min-width:220px; }
.profile-heading-name{ font-family:'Sora',sans-serif; font-weight:800; font-size:21px; line-height:1.2; display:flex; align-items:center; gap:8px; }
.profile-badge-verified{
  display:inline-flex; align-items:center; gap:4px; background:rgba(15,139,141,.12); color:var(--teal-dark);
  font-size:11px; font-weight:700; padding:3px 9px; border-radius:20px;
}
.profile-badge-verified svg{ width:11px; height:11px; }
.profile-heading-sub{ font-size:13px; color:var(--ink-soft); margin-top:3px; display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.profile-heading-sub svg{ width:13px; height:13px; }

.profile-grid{ display:grid; grid-template-columns:1.4fr 1fr; gap:20px; align-items:start; }
@media (max-width:900px){ .profile-grid{ grid-template-columns:1fr; } }

.profile-section-title{ display:flex; align-items:center; gap:9px; font-family:'Sora',sans-serif; font-weight:700; font-size:15px; margin-bottom:2px; }
.profile-section-title svg{ width:17px; height:17px; color:var(--teal); }
.profile-section-sub{ font-size:12.5px; color:var(--ink-soft); margin-bottom:18px; }

.summary-row{ display:flex; align-items:center; gap:12px; padding:12px 0; border-bottom:1px solid var(--line); }
.summary-row:last-child{ border-bottom:none; }
.summary-icon{ width:36px; height:36px; border-radius:9px; background:rgba(15,139,141,.1); color:var(--teal-dark); display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.summary-icon svg{ width:17px; height:17px; }
.summary-label{ font-size:11.5px; color:var(--ink-soft); }
.summary-value{ font-size:13.5px; font-weight:600; }

/* =========================================================
   SUPER ADMIN PANEL
   ========================================================= */
.role-pill{
  display:inline-flex; align-items:center; gap:5px; background:rgba(212,162,76,.16); color:#8a6a25;
  font-size:10.5px; font-weight:700; padding:3px 10px; border-radius:20px; letter-spacing:.02em;
}
.role-pill svg{ width:11px; height:11px; }

.school-name-cell{ display:flex; align-items:center; gap:10px; }
.school-avatar{
  width:36px; height:36px; border-radius:9px; background:var(--navy); color:#fff; flex-shrink:0;
  display:flex; align-items:center; justify-content:center; font-family:'Sora',sans-serif; font-weight:700; font-size:13px; overflow:hidden;
}
.school-avatar img{ width:100%; height:100%; object-fit:cover; }
.status-dot{ width:8px; height:8px; border-radius:50%; display:inline-block; margin-right:6px; }
.status-dot.active{ background:var(--success); }
.status-dot.inactive{ background:var(--danger); }

/* credentials reveal card — shown once after creating / resetting a school account */
.credentials-card{
  background:linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%); border-radius:14px; padding:22px;
  color:#fff; position:relative; overflow:hidden;
}
.credentials-card::after{
  content:""; position:absolute; right:-30px; top:-30px; width:130px; height:130px; border-radius:50%; background:var(--gold); opacity:.15;
}
.credentials-row{
  display:flex; align-items:center; justify-content:space-between; background:rgba(255,255,255,.08);
  border-radius:10px; padding:12px 14px; margin-top:12px; position:relative; z-index:2;
}
.credentials-row-label{ font-size:11px; color:rgba(255,255,255,.6); text-transform:uppercase; letter-spacing:.05em; margin-bottom:2px; }
.credentials-row-value{ font-family:'JetBrains Mono',monospace; font-size:15px; font-weight:600; letter-spacing:.02em; }
.copy-btn{
  background:rgba(255,255,255,.14); border:none; color:#fff; width:32px; height:32px; border-radius:8px;
  display:flex; align-items:center; justify-content:center; cursor:pointer; flex-shrink:0;
}
.copy-btn:hover{ background:rgba(255,255,255,.24); }
.copy-btn svg{ width:15px; height:15px; }

