/* DocTime design system — mobile-first, dark mode, clean cards, accessible typography */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #eef1f8;
  --text: #10192b;
  --text-2: #55617a;
  --muted: #8a94a8;
  --border: #e2e7f0;
  --primary: #1d5fd6;
  --primary-soft: #e7efff;
  --primary-contrast: #ffffff;
  --success: #147d4a;
  --success-soft: #e2f5ea;
  --warn: #9a6200;
  --warn-soft: #fdf1d8;
  --danger: #b3261e;
  --danger-soft: #fde8e6;
  --info: #0b6a8f;
  --info-soft: #dff2fa;
  --shadow: 0 1px 2px rgba(16, 25, 43, .06), 0 8px 24px rgba(16, 25, 43, .06);
  --radius: 14px;
  --radius-sm: 9px;
  --nav-h: 60px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Bengali", sans-serif;
}
[data-theme="dark"] {
  --bg: #0c1220;
  --surface: #141c2e;
  --surface-2: #1b2438;
  --text: #eaeefb;
  --text-2: #a9b3c9;
  --muted: #77819a;
  --border: #24304a;
  --primary: #6ea3ff;
  --primary-soft: #1c2c4e;
  --primary-contrast: #0c1220;
  --success: #5fd39a;
  --success-soft: #123227;
  --warn: #f0c064;
  --warn-soft: #3a2c12;
  --danger: #ff8b83;
  --danger-soft: #3d1a1a;
  --info: #6fd0f2;
  --info-soft: #10303e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--nav-h) + 16px);
}
@media (min-width: 900px) { body { padding-bottom: 24px; } }

h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
p { margin: 0 0 .8em; color: var(--text-2); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
small { color: var(--muted); }

.container { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.page { padding-top: 16px; }
.hidden { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; gap: 12px; height: 56px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 750; font-size: 1.05rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--primary); color: #fff; font-size: 15px; font-weight: 800;
}
.spacer { flex: 1; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 9px 15px; font-size: .92rem; font-weight: 600; cursor: pointer;
  background: var(--surface-2); color: var(--text); transition: filter .15s, transform .05s;
  min-height: 40px; text-decoration: none;
}
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-contrast); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-sm { padding: 6px 11px; font-size: .84rem; min-height: 32px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px;
}
.card-title { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-title h2, .card-title h3 { margin: 0; }
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* stat tiles */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 15px; }
.stat .label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 1.45rem; font-weight: 750; margin-top: 2px; }
.stat .sub { font-size: .8rem; color: var(--text-2); }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: .74rem; font-weight: 700;
  background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.badge-green { background: var(--success-soft); color: var(--success); }
.badge-blue { background: var(--primary-soft); color: var(--primary); }
.badge-amber { background: var(--warn-soft); color: var(--warn); }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-cyan { background: var(--info-soft); color: var(--info); }

/* ---------- forms ---------- */
.field { margin-bottom: 13px; }
.field label { display: block; font-size: .84rem; font-weight: 650; margin-bottom: 5px; color: var(--text-2); }
.input, select, textarea {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: .95rem; font-family: inherit; min-height: 42px;
}
.input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
.hint { font-size: .78rem; color: var(--muted); margin-top: 4px; }
.form-row { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .form-row { grid-template-columns: 1fr 1fr; } }
.check { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.check input { width: 18px; height: 18px; }

/* ---------- lists & tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.list-item .grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- token / queue ---------- */
.token-chip {
  min-width: 58px; height: 58px; border-radius: 14px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); font-size: 1.35rem; font-weight: 800;
}
.token-chip.big { min-width: 96px; height: 96px; font-size: 2.3rem; border-radius: 20px; }
.token-chip.serving { background: var(--success); color: #fff; }
.serving-banner {
  border-radius: var(--radius); padding: 18px; text-align: center;
  background: linear-gradient(135deg, var(--success-soft), var(--surface)); border: 1px solid var(--border);
}
.serving-banner .big-token { font-size: 3rem; font-weight: 850; color: var(--success); line-height: 1.1; }
.queue-card { display: flex; align-items: center; gap: 13px; }
.queue-pos { font-size: .8rem; color: var(--muted); }
.est { font-size: .82rem; color: var(--info); font-weight: 600; }

/* ---------- nav ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: var(--nav-h); display: flex; background: var(--surface);
  border-top: 1px solid var(--border); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
}
.bottom-nav button {
  flex: 1; border: none; background: none; color: var(--muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: .68rem; font-weight: 650; border-radius: 10px; padding: 4px 2px;
}
.bottom-nav button .ico { font-size: 1.15rem; line-height: 1; }
.bottom-nav button.active { color: var(--primary); background: var(--primary-soft); }
@media (min-width: 900px) {
  .bottom-nav { position: static; height: auto; margin: 0 0 14px; border: 1px solid var(--border); border-radius: var(--radius); }
  .bottom-nav button { flex-direction: row; gap: 7px; font-size: .84rem; padding: 9px 12px; }
}
.side-nav { display: none; }
@media (min-width: 900px) {
  .app-shell { display: grid; grid-template-columns: 218px 1fr; gap: 18px; align-items: start; }
  .side-nav { display: block; position: sticky; top: 72px; }
  .side-nav button {
    display: flex; width: 100%; text-align: left; gap: 10px; align-items: center;
    padding: 10px 12px; border: none; background: none; color: var(--text-2);
    border-radius: var(--radius-sm); cursor: pointer; font-size: .9rem; font-weight: 600; margin-bottom: 3px;
  }
  .side-nav button.active { background: var(--primary-soft); color: var(--primary); }
  .bottom-nav.mobile-only { display: none; }
}

/* ---------- misc ---------- */
.avatar {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); font-weight: 750; flex: none;
  background-size: cover; background-position: center;
}
.avatar.lg { width: 64px; height: 64px; font-size: 1.35rem; }
.divider { height: 1px; background: var(--border); margin: 13px 0; }
.pill-row { display: flex; gap: 7px; flex-wrap: wrap; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

.toast-wrap { position: fixed; bottom: calc(var(--nav-h) + 12px); left: 12px; right: 12px; z-index: 100; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  background: var(--text); color: var(--bg); padding: 11px 15px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow); font-size: .9rem; font-weight: 600; animation: slideUp .18s ease;
}
.toast.err { background: var(--danger); color: #fff; }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(6, 10, 20, .5); z-index: 90;
  display: grid; place-items: end center; padding: 12px;
}
@media (min-width: 640px) { .modal-backdrop { place-items: center; } }
.modal {
  background: var(--surface); border-radius: 18px 18px 14px 14px; padding: 18px;
  width: 100%; max-width: 460px; max-height: 86vh; overflow: auto; box-shadow: var(--shadow);
}
@media (min-width: 640px) { .modal { border-radius: var(--radius); } }
.modal h3 { margin-bottom: 12px; }

.skeleton { border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton.line { height: 14px; margin: 8px 0; }
.skeleton.card-s { height: 84px; margin-bottom: 10px; }

.empty { text-align: center; padding: 26px 14px; color: var(--muted); }
.empty .big-ico { font-size: 2rem; margin-bottom: 6px; }

/* public pages */
.public-hero { text-align: center; padding: 22px 14px 8px; }
.public-hero .org-logo { width: 76px; height: 76px; border-radius: 20px; margin: 0 auto 10px; background-size: cover; background-position: center; }
.queue-refresh { display: flex; align-items: center; gap: 7px; font-size: .8rem; color: var(--muted); justify-content: center; padding: 8px 0 2px; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.auth-wrap { max-width: 420px; margin: 6vh auto 0; }
.pin-input { letter-spacing: .5em; text-align: center; font-size: 1.35rem; font-weight: 700; }

footer.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 18px 0 8px; }
