/* ==========================================================================
   MediCare HMS — modern clinical design system
   Zero external assets. All icons are unicode/CSS; all styling is local.
   ========================================================================== */

:root {
  /* Brand */
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-deep: #115e59;
  --primary-light: #ccfbf1;
  --primary-tint: #f0fdfa;
  --accent: #2563eb;
  --accent-tint: #eff6ff;

  /* Status */
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0284c7;

  /* Surfaces */
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #e6ebf2;
  --border-strong: #d5deea;
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #64748b;

  /* Shape & depth */
  --radius-sm: 7px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow: 0 4px 14px rgba(15, 23, 42, .07);
  --shadow-lg: 0 18px 45px rgba(15, 23, 42, .16);
  --shadow-xl: 0 26px 70px rgba(2, 12, 27, .22);
  --ring: 0 0 0 3px rgba(13, 148, 136, .16);
  --ease: cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 92% -8%, rgba(13, 148, 136, .09), transparent 62%),
    radial-gradient(900px 480px at -6% 105%, rgba(37, 99, 235, .06), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; transition: color .15s; }
a:hover { color: var(--primary-dark); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { letter-spacing: -.02em; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
::selection { background: var(--primary-light); color: var(--primary-deep); }

* { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; background-clip: content-box; }

#app { min-height: 100vh; position: relative; }

/* ------------------------------- Sign in -------------------------------- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  background: var(--surface-soft);
}
.auth-shell::before {
  content: '✚';
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 170px;
  line-height: 1;
  color: rgba(255, 255, 255, .13);
  text-shadow: 0 18px 50px rgba(0, 0, 0, .18);
  background:
    radial-gradient(circle at 26% 24%, rgba(45, 212, 191, .38), transparent 42%),
    radial-gradient(circle at 82% 82%, rgba(37, 99, 235, .24), transparent 46%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .025) 0 2px, transparent 2px 24px),
    linear-gradient(150deg, #082f29 0%, #0f766e 58%, #0b4f48 100%);
}
.auth-card {
  grid-column: 2;
  align-self: center;
  justify-self: center;
  width: min(440px, 100%);
  margin: 32px;
  padding: 42px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
}
.auth-card h1 {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 750;
  color: var(--text);
}
.auth-card h1::before {
  content: '✚';
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(135deg, #14b8a6, var(--primary-dark));
  color: #fff;
  font-size: 18px;
  box-shadow: 0 5px 14px rgba(15, 118, 110, .28);
}
.auth-card p { margin: 0 0 26px; color: var(--muted); font-size: 13.5px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .field input { padding: 11px 13px; }
.auth-card .btn.primary { padding: 12px; font-size: 14px; }

/* --------------------------- App shell / nav ---------------------------- */
.app-shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 22px 16px;
  color: #cbd7e4;
  background: linear-gradient(180deg, #0b1220 0%, #0d1d31 55%, #0b2230 100%);
  border-right: 1px solid rgba(255, 255, 255, .06);
}
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 8px 3px;
  color: #fff;
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -.02em;
}
.sidebar .brand::before {
  content: '✚';
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 33px;
  height: 33px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2dd4bf, var(--primary-dark));
  color: #fff;
  font-size: 17px;
  box-shadow: 0 5px 14px rgba(0, 0, 0, .28);
}
.sidebar .brand-sub { margin: 0 8px 20px; font-size: 11.5px; color: #7e96b1; }
.sidebar .section {
  margin: 18px 10px 7px;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: #617994;
}
.sidebar nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 3px;
  padding: 9px 12px;
  border-radius: 10px;
  color: #c3d0dd;
  font-size: 13.5px;
  transition: background .18s var(--ease), color .18s, transform .18s var(--ease);
}
.sidebar nav a span { width: 21px; text-align: center; font-size: 16px; opacity: .92; }
.sidebar nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; transform: translateX(2px); text-decoration: none; }
.sidebar nav a.active {
  background: linear-gradient(90deg, rgba(20, 184, 166, .30), rgba(20, 184, 166, .08));
  color: #fff;
  font-weight: 650;
  box-shadow: inset 3px 0 0 #2dd4bf;
}
.sidebar nav a.active span { opacity: 1; }
.sidebar .userbox {
  margin-top: 24px;
  padding: 13px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .09);
}
.sidebar .userbox .name {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  font-weight: 650;
  font-size: 13px;
}
.sidebar .userbox .name::before {
  content: '';
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5eead4, var(--primary));
  border: 2px solid rgba(255, 255, 255, .25);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}
.sidebar .userbox .role { margin-top: 7px; color: #8ea5bd; font-size: 11.5px; text-transform: capitalize; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 30px;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar h2 { margin: 0; font-size: 19px; font-weight: 750; color: var(--text); }
.topbar .actions { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.content { width: 100%; max-width: 1560px; margin: 0 auto; padding: 26px 30px 56px; }

/* --------------------------- Cards & statistics ------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.card h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 750;
}
.card h3::before {
  content: '';
  flex: none;
  width: 4px;
  height: 15px;
  border-radius: 4px;
  background: linear-gradient(180deg, #2dd4bf, var(--primary-dark));
}
.card h3[style] { margin-bottom: 8px; }
.card p { color: var(--text-soft); }

.stat-grid, .kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat, .kpi {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s;
}
.stat:hover, .kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.stat::before, .kpi::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, #2dd4bf, var(--primary-dark));
}
.stat .label, .kpi span {
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat .value, .kpi strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -.035em;
  line-height: 1.15;
  color: var(--primary-dark);
  font-variant-numeric: tabular-nums;
}
.kpi strong { font-size: 23px; }
.stat .sub, .kpi small { display: block; margin-top: 5px; font-size: 11.5px; color: var(--muted); }

/* -------------------------------- Tables -------------------------------- */
.table-wrap { width: 100%; overflow: auto; border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid #eef2f7; vertical-align: top; }
th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: .075em;
  text-transform: uppercase;
  white-space: nowrap;
}
td { color: var(--text-soft); white-space: normal; overflow-wrap: anywhere; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--primary-tint); }
tbody tr { transition: background .15s; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.scheduled, .badge.partial, .badge.sent, .badge.admitted, .badge.in_progress, .badge.info { background: var(--accent-tint); color: #1d4ed8; border-color: #dbeafe; }
.badge.checked_in, .badge.pending, .badge.warning, .badge.moderate { background: #fffbeb; color: #b45309; border-color: #fef3c7; }
.badge.completed, .badge.dispensed, .badge.paid, .badge.active, .badge.discharged,
.badge.normal, .badge.success, .badge.approved, .badge.verified, .badge.resolved { background: #ecfdf5; color: #047857; border-color: #d1fae5; }
.badge.cancelled, .badge.no_show, .badge.overdue, .badge.inactive, .badge.danger,
.badge.critical, .badge.high, .badge.rejected { background: #fef2f2; color: #b91c1c; border-color: #fee2e2; }
.badge.draft, .badge.low, .badge.closed { background: #f1f5f9; color: #526277; border-color: #e2e8f0; }

/* --------------------------------- Forms -------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 12px; font-weight: 650; color: #475569; }
.field input, .field select, .field textarea, .toolbar input, .toolbar select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 13.5px;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.field input:hover, .field select:hover, .field textarea:hover,
.toolbar input:hover, .toolbar select:hover { border-color: #b9c7d8; }
.field input:focus, .field select:focus, .field textarea:focus,
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.field select, .toolbar select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.field textarea { min-height: 76px; resize: vertical; line-height: 1.55; }
.field input::placeholder, .field textarea::placeholder { color: #94a3b8; }
.field.full, .form-grid > .full { grid-column: 1 / -1; }

/* -------------------------------- Buttons ------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .18s, border-color .18s, color .18s;
}
.btn:hover { background: var(--surface-soft); border-color: #b9c7d8; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(15, 23, 42, .08); color: var(--text); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.btn.primary {
  background: linear-gradient(135deg, #14b8a6, var(--primary-dark));
  border-color: var(--primary-dark);
  color: #fff;
  box-shadow: 0 3px 10px rgba(15, 118, 110, .25);
}
.btn.primary:hover { background: linear-gradient(135deg, var(--primary), var(--primary-deep)); color: #fff; box-shadow: 0 6px 16px rgba(15, 118, 110, .32); }
.btn.danger { background: linear-gradient(135deg, #f43f5e, var(--danger)); border-color: var(--danger); color: #fff; box-shadow: 0 3px 10px rgba(220, 38, 38, .2); }
.btn.danger:hover { background: linear-gradient(135deg, #e11d48, #b91c1c); color: #fff; }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-soft); border-color: transparent; box-shadow: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.license-chip { color: var(--primary-dark) !important; border-color: #99e6d8 !important; background: var(--primary-tint) !important; }
.license-chip.ok { color: #047857 !important; border-color: #a7f3d0 !important; background: #ecfdf5 !important; }

/* --------------------------------- Modal -------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 20, 35, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn .18s ease;
}
.modal {
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow: auto;
  padding: 26px 28px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  animation: modalIn .22s var(--ease);
}
.modal h3 { margin: 0 0 18px; padding-bottom: 13px; border-bottom: 1px solid var(--border); font-size: 18px; font-weight: 750; }
.modal .footer { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }

/* ---------------------------- Guided tour UI ---------------------------- */
.tour-overlay { position: fixed; inset: 0; z-index: 999; pointer-events: none; }
.tour-spotlight {
  position: absolute;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(8, 20, 35, .62), inset 0 0 0 1px rgba(255, 255, 255, .45);
  pointer-events: none;
  transition: all .4s cubic-bezier(.4, 0, .2, 1);
  border: 3px solid #2dd4bf;
  background: rgba(20, 184, 166, .10);
}
.tour-spotlight::after { content: ''; position: absolute; inset: -6px; border-radius: 16px; border: 2px solid #2dd4bf; opacity: .3; animation: tourPulse 2s ease-in-out infinite; }
.tour-spotlight.page-highlight { border: 3px solid #60a5fa; background: rgba(37, 99, 235, .06); box-shadow: 0 0 0 9999px rgba(8, 20, 35, .45); }
.tour-spotlight.page-highlight::after { border-color: #60a5fa; animation: pageBlink 1.5s ease-in-out infinite; }
@keyframes pageBlink { 0%, 100% { opacity: .2; transform: scale(1); } 50% { opacity: .7; transform: scale(1.01); } }
@keyframes tourPulse { 0%, 100% { transform: scale(1); opacity: .3; } 50% { transform: scale(1.05); opacity: .6; } }

.tour-cursor { position: fixed; width: 24px; height: 24px; z-index: 1002; pointer-events: none; transition: left .6s cubic-bezier(.4, 0, .2, 1), top .6s cubic-bezier(.4, 0, .2, 1); filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .3)); }
.tour-cursor svg { width: 24px; height: 24px; }
.tour-cursor.clicking { animation: cursorClick .4s ease; }
@keyframes cursorClick { 0% { transform: scale(1); } 50% { transform: scale(.8); } 100% { transform: scale(1); } }
.tour-ripple { position: absolute; width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--primary); pointer-events: none; z-index: 1000; animation: rippleOut .6s ease-out forwards; }
@keyframes rippleOut { 0% { transform: scale(.5); opacity: 1; } 100% { transform: scale(2.5); opacity: 0; } }

.tour-tooltip {
  position: absolute;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 390px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  pointer-events: auto;
  animation: tooltipIn .3s var(--ease);
}
.tour-tooltip::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, #14b8a6, var(--accent)); }
@keyframes tooltipIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.tour-tooltip .tour-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-right: 4px; }
.tour-tooltip h4 { margin: 0 0 8px; color: var(--primary-dark); font-size: 15px; font-weight: 750; }
.tour-tooltip p { margin: 0 0 8px; font-size: 13px; line-height: 1.65; color: var(--text-soft); white-space: pre-line; }
.tour-tooltip .tour-note { margin-top: 8px; padding: 9px 11px; background: var(--primary-tint); border: 1px solid #c7f3e8; border-radius: var(--radius-sm); font-size: 12px; color: var(--primary-deep); }
.tour-tooltip .tour-progress { flex: 0 0 auto; height: 5px; margin: 12px 0; overflow: hidden; border-radius: 999px; background: var(--border); }
.tour-tooltip .tour-progress div { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #2dd4bf, var(--primary)); transition: width .3s; }
.tour-tooltip .tour-footer { display: flex; flex: 0 0 auto; gap: 7px; justify-content: flex-end; margin-top: 10px; }
.tour-tooltip .tour-footer .btn { padding: 7px 13px; font-size: 12.5px; }
.tour-tooltip .tour-step-num { margin-bottom: 5px; font-size: 11px; font-weight: 650; color: var(--muted); }
.tour-tooltip .tour-keyhint { opacity: .7; white-space: nowrap; }
.tour-tooltip .tour-action { display: inline-block; margin-bottom: 9px; padding: 6px 10px; border-radius: var(--radius-sm); background: var(--primary-tint); color: var(--primary-dark); font-size: 12px; font-weight: 700; }

/* --------------------------------- Toast -------------------------------- */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  padding: 12px 18px;
  border-radius: 11px;
  background: #0f172a;
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastIn .25s var(--ease);
}
.toast.success { background: linear-gradient(135deg, #059669, #047857); }
.toast.error { background: linear-gradient(135deg, #e11d48, #b91c1c); }
.toast.warn { background: linear-gradient(135deg, #f59e0b, #b45309); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* --------------------------------- Misc --------------------------------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 15px; }
.toolbar h2 { margin: 0; font-size: 18px; font-weight: 750; }
.toolbar input, .toolbar select { width: auto; min-width: 180px; }
.muted { color: var(--muted); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); font-weight: 650; }
.kv dd { margin: 0; color: var(--text-soft); }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  background: #edf1f6;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.tabs button { background: transparent; border: 0; padding: 8px 14px; border-radius: 9px; color: var(--muted); font-size: 12.5px; font-weight: 650; transition: background .18s, color .18s, box-shadow .18s; }
.tabs button:hover { background: rgba(255, 255, 255, .65); color: var(--primary-dark); }
.tabs button.active { background: #fff; color: var(--primary-dark); box-shadow: 0 1px 4px rgba(15, 23, 42, .12); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.p78-controls { margin-bottom: 12px; }
.p78-pager { justify-content: flex-end; margin-top: 12px; }

/* ------------------------ About / developer page ------------------------ */
.standalone-page { min-height: 100vh; padding: 28px 20px 60px; }
.about-back { display: inline-block; margin: 0 0 18px; font-weight: 650; }
.about-page { max-width: 1200px; margin: 0 auto; color: var(--text); }
.about-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 32px;
  background:
    radial-gradient(circle at 85% 15%, rgba(45, 212, 191, .24), transparent 45%),
    linear-gradient(135deg, #07130f 0%, #0f3b33 55%, #0f766e 100%);
  color: #f8fafc;
  border-radius: var(--radius-xl);
  padding: 46px 48px 40px;
  box-shadow: var(--shadow-lg);
}
.about-hero::after { content: ''; position: absolute; width: 320px; height: 320px; right: -120px; top: -140px; border-radius: 50%; background: radial-gradient(circle, rgba(45, 212, 191, .28), transparent 68%); pointer-events: none; }
.about-hero-copy { position: relative; z-index: 1; }
.about-kicker { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 16px; color: #5eead4; font-size: 11px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.about-kicker span { font-size: 16px; }
.about-hero h2 { margin: 0; font-size: clamp(32px, 5vw, 54px); line-height: 1.05; letter-spacing: -.03em; }
.about-tagline { margin: 12px 0 0; color: #99f6e4; font-size: 16px; font-weight: 600; }
.about-lede { max-width: 640px; margin: 16px 0 0; color: #cbd5e1; font-size: 15px; line-height: 1.7; }
.about-hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.about-hero-actions .btn { border: 0; background: #5eead4; color: #062e27; font-weight: 750; }
.about-hero-actions .btn:hover { background: #99f6e4; color: #062e27; }
.about-hero-actions .btn + .btn { border: 1px solid rgba(255, 255, 255, .35); background: transparent; color: #f8fafc; }
.about-hero-actions .btn + .btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.about-stat-row { display: flex; flex-wrap: wrap; gap: 28px; margin-top: 34px; padding-top: 22px; border-top: 1px solid rgba(255, 255, 255, .14); }
.about-stat { display: flex; flex-direction: column; gap: 4px; }
.about-stat strong { color: #5eead4; font-size: 20px; }
.about-stat span { color: #94a3b8; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.about-hero-art { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; }
.about-hero-art img { width: 100%; max-height: 260px; object-fit: cover; border: 1px solid rgba(255, 255, 255, .16); border-radius: 14px; box-shadow: 0 18px 40px rgba(0, 0, 0, .35); }
.about-hero-badge { position: absolute; bottom: -14px; left: -22px; display: flex; flex-direction: column; padding: 10px 16px; border-radius: 12px; background: #f8fafc; color: #0f3b33; box-shadow: var(--shadow-lg); }
.about-hero-badge strong { font-size: 20px; letter-spacing: -.02em; }
.about-hero-badge span { color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.about-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 22px; }
.about-panel { padding: 28px 30px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.about-panel-accent { border-top: 4px solid var(--primary); }
.about-panel-kicker { display: block; margin-bottom: 10px; color: var(--primary); font-size: 10px; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.about-panel h3 { margin: 0 0 4px; font-size: 22px; }
.about-panel p { margin: 10px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.7; }
.about-role { color: var(--primary-dark) !important; font-weight: 650; }
.about-values { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.about-values span { padding: 6px 12px; border-radius: 20px; background: var(--primary-light); color: var(--primary-deep); font-size: 11.5px; font-weight: 650; }
.about-values i { margin-right: 6px; color: var(--primary); font-style: normal; font-weight: 800; }
.about-link-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.about-link-card { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); transition: border-color .15s, transform .15s, box-shadow .15s; }
.about-link-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.about-link-icon { width: 32px; font-size: 20px; text-align: center; }
.about-link-copy { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.about-link-copy small { color: var(--muted); font-size: 10px; letter-spacing: .05em; text-transform: uppercase; }
.about-link-copy strong { overflow: hidden; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.about-link-arrow { color: var(--primary); font-weight: 750; }
.about-source-note { margin-top: 18px !important; font-size: 11px !important; }
.about-source-note a { font-weight: 650; }
.about-section-block { margin-top: 30px; }
.about-section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.about-section-head span { display: inline-flex; width: 30px; height: 30px; align-items: center; justify-content: center; border-radius: 8px; background: var(--primary-dark); color: #fff; font-size: 12px; font-weight: 800; }
.about-section-head h3 { margin: 0; font-size: 20px; }
.about-pill-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.about-pill { padding: 9px 14px; border-radius: 8px; background: #0f3b33; color: #ccfbf1; font-size: 12.5px; font-weight: 650; }
.about-pill.muted-pill { border: 1px solid var(--border); background: var(--surface); color: var(--muted); }
.about-project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.about-project { display: flex; flex-direction: column; gap: 8px; padding: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); transition: border-color .15s, transform .15s, box-shadow .15s; }
.about-project:hover { border-color: var(--primary); transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.about-project-type { color: var(--primary); font-size: 10px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.about-project h4 { margin: 0; font-size: 16px; }
.about-project p { flex: 1; margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.about-project-open { margin-top: 4px; color: var(--primary); font-size: 12px; font-weight: 750; }
.about-faq-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.about-faq { padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.about-faq summary { cursor: pointer; font-size: 13.5px; font-weight: 650; }
.about-faq p { margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.65; }

/* ------------------------------ Responsive ------------------------------ */
@media (max-width: 1100px) {
  .topbar { padding: 14px 22px; }
  .content { padding: 22px 22px 48px; }
}

@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; overflow: visible; padding: 14px; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar .brand { margin: 0 4px 2px; }
  .sidebar .brand-sub { margin: 0 4px 12px; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 6px; }
  .sidebar .section { width: 100%; margin: 10px 4px 2px; }
  .sidebar nav a { margin: 0; padding: 7px 10px; font-size: 12.5px; }
  .sidebar nav a:hover { transform: none; }
  .sidebar .userbox { margin-top: 14px; }
  .topbar { padding: 12px 16px; }
  .topbar h2 { font-size: 17px; }
  .content { padding: 16px 14px 40px; }
  .grid-2 { grid-template-columns: 1fr; }
  .auth-shell { display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(135deg, #0f766e, #134e4a); }
  .auth-shell::before { display: none; }
  .auth-card { margin: 0; padding: 34px 28px; }
  .about-hero { grid-template-columns: 1fr; padding: 32px 24px; }
  .about-hero-art { display: none; }
  .about-two-col, .about-link-grid, .about-faq-grid { grid-template-columns: 1fr; }
  .about-hero-badge { left: 0; }
}

@media (max-width: 600px) {
  .stat-grid, .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat, .kpi { padding: 13px 14px; }
  .stat .value, .kpi strong { font-size: 21px; }
  .card { padding: 16px; }
  .modal { padding: 20px; }
  .tour-tooltip { width: calc(100vw - 24px); }
  .topbar .actions span { display: none; }
  .kv { grid-template-columns: 120px 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
