@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700&display=swap');

:root {
  --primary: #2a79c0;
  --primary-600: #1f66a8;
  --primary-dark: #153976;
  --sky: #0095da;
  --gradient: linear-gradient(135deg, #0095da 0%, #005cab 100%);
  --gradient-side: linear-gradient(180deg, #153976 0%, #1d5aa3 100%);
  --accent: #dda307;
  --accent-600: #c48f00;
  --accent-50: #fdf6e3;
  --primary-50: #eaf3fb;
  --text: #1f2a3d;
  --text-muted: #747474;
  --border: #e3e8ee;
  --bg: #eff3f3;
  --card: #fff;
  --success: #16a34a;
  --success-50: #e9f8ef;
  --warning: #d97706;
  --warning-50: #fff5e6;
  --danger: #dc2626;
  --danger-50: #fdecec;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(21, 57, 118, 0.06), 0 4px 16px rgba(21, 57, 118, 0.06);
  --shadow-lg: 0 12px 40px rgba(21, 57, 118, 0.18);
  --sidebar-w: 248px;
  font-family: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); font-size: 14px; line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
h1, h2, h3, h4 { margin: 0; color: var(--primary-dark); font-weight: 700; line-height: 1.3; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }
.icon { flex-shrink: 0; vertical-align: middle; }
.muted { color: var(--text-muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--gradient-side); color: #fff; position: fixed; inset: 0 auto 0 0;
  display: flex; flex-direction: column; z-index: 40; transition: transform 0.25s ease, width 0.25s ease;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: radial-gradient(circle at 35% 30%, #ffe28a, var(--accent) 60%, #a87900);
  box-shadow: inset 0 -2px 6px rgba(0, 0, 0, 0.2); color: #fff;
}
.brand-text strong { display: block; font-size: 15px; letter-spacing: 0.3px; }
.brand-text span { font-size: 11px; opacity: 0.75; letter-spacing: 0.6px; text-transform: uppercase; }
.nav { padding: 8px 12px; flex: 1; overflow-y: auto; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; opacity: 0.55; padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; color: rgba(255, 255, 255, 0.82);
  border-radius: 10px; font-weight: 500; margin-bottom: 2px; transition: background 0.15s;
}
.nav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav a.active { background: rgba(255, 255, 255, 0.14); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav a .badge-count { margin-left: auto; }
.sidebar-foot { padding: 14px 16px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.scan-cta {
  display: flex; align-items: center; justify-content: center; gap: 8px; background: var(--accent); color: #fff;
  border-radius: 30px; padding: 11px; font-weight: 600;
}
.scan-cta:hover { background: var(--accent-600); color: #fff; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px; background: #fff; border-bottom: 1px solid var(--border); display: flex; align-items: center;
  gap: 12px; padding: 0 24px; position: sticky; top: 0; z-index: 30;
}
.topbar .page-title { font-weight: 600; color: var(--primary-dark); font-size: 16px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { padding: 24px; max-width: 1400px; width: 100%; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; color: var(--primary-dark);
  display: inline-grid; place-items: center; cursor: pointer; position: relative;
}
.icon-btn:hover { background: var(--primary-50); }
.icon-btn .dot {
  position: absolute; top: 6px; right: 6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--danger);
  color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff;
}
.menu-toggle { display: none; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 30px; cursor: pointer; border: 0; background: none; font: inherit; }
.user-chip:hover { background: var(--primary-50); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--gradient); color: #fff; font-weight: 600; font-size: 13px;
  display: grid; place-items: center; flex-shrink: 0;
}
.user-chip .who { text-align: left; line-height: 1.2; }
.user-chip .who strong { display: block; font-size: 13px; color: var(--text); }
.user-chip .who span { font-size: 11.5px; color: var(--text-muted); }
.backdrop { display: none; }

@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); }
  .app.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .app.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 30, 60, 0.4); z-index: 35; }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-grid; }
  .content { padding: 16px; }
  .topbar { padding: 0 12px; }
  .user-chip .who { display: none; }
}

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--text-muted); margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid rgba(21, 57, 118, 0.04); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-body { padding: 20px; }
.card + .card, .card + .grid, .grid + .card, .grid + .grid { margin-top: 20px; }
.grid { display: grid; gap: 20px; }
.grid > * { margin-top: 0 !important; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-main { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .grid-4 { grid-template-columns: 1fr 1fr; gap: 12px; } }

.stat { padding: 18px 20px; display: flex; gap: 14px; align-items: center; }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.stat-icon.blue { background: var(--primary-50); color: var(--primary); }
.stat-icon.gold { background: var(--accent-50); color: var(--accent-600); }
.stat-icon.green { background: var(--success-50); color: var(--success); }
.stat-icon.sky { background: #e5f6fd; color: var(--sky); }
.stat-label { color: var(--text-muted); font-size: 12.5px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--primary-dark); line-height: 1.2; }
.stat-value small { font-size: 13px; color: var(--text-muted); font-weight: 500; }
@media (max-width: 480px) { .stat { padding: 14px; gap: 10px; } .stat-icon { width: 38px; height: 38px; } .stat-value { font-size: 20px; } }

.hero {
  background: var(--gradient); color: #fff; border-radius: var(--radius); padding: 24px 28px; position: relative; overflow: hidden;
  box-shadow: var(--shadow);
}
.hero::after {
  content: ''; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18), transparent 70%);
}
.hero h1 { color: #fff; }
.hero p { opacity: 0.85; margin-top: 6px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 30px;
  border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s; text-decoration: none;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(221, 163, 7, 0.3); }
.btn-primary:hover:not(:disabled) { background: var(--accent-600); color: #fff; }
.btn-blue { background: var(--primary); color: #fff; }
.btn-blue:hover:not(:disabled) { background: var(--primary-600); color: #fff; }
.btn-outline { background: #fff; color: var(--primary); border-color: #c7dbef; }
.btn-outline:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-50); }
.btn-ghost { background: transparent; color: var(--primary-dark); }
.btn-ghost:hover:not(:disabled) { background: var(--primary-50); }
.btn-danger { background: #fff; color: var(--danger); border-color: #f3c4c4; }
.btn-danger:hover:not(:disabled) { background: var(--danger-50); }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; gap: 6px; }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: 9px; }
.btn-block { width: 100%; }
.btn-lg { height: 48px; font-size: 15px; padding: 0 26px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 12.5px; color: var(--primary-dark); }
.field label .req { color: var(--danger); }
.field .hint { font-size: 12px; color: var(--text-muted); }
.input, select.input, textarea.input {
  height: 40px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 12px; font: inherit; color: var(--text);
  background: #fff; width: 100%; transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(42, 121, 192, 0.15); }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.input-icon .input { padding-left: 38px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
@media (max-width: 640px) { .form-row, .form-row-3 { grid-template-columns: 1fr; } }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .input-icon { flex: 1; min-width: 200px; max-width: 360px; }
.toolbar select.input { width: auto; min-width: 130px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px;
  padding: 12px 16px; background: #f8fafc; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafcfe; }
.cell-main { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 12.5px; color: var(--text-muted); }
.table .row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.table td.right, .table th.right { text-align: right; }
.table tr.clickable { cursor: pointer; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--border); gap: 12px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 12px; font-size: 12px; font-weight: 600;
  white-space: nowrap; background: #eef1f5; color: #4b5563;
}
.badge.blue { background: var(--primary-50); color: var(--primary); }
.badge.green { background: var(--success-50); color: var(--success); }
.badge.gold { background: var(--accent-50); color: var(--accent-600); }
.badge.orange { background: var(--warning-50); color: var(--warning); }
.badge.red { background: var(--danger-50); color: var(--danger); }
.badge.dark { background: var(--primary-dark); color: #fff; }
.badge-count { background: var(--accent); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 11px; font-weight: 700; line-height: 18px; }

/* ---------- Progress ---------- */
.progress { height: 8px; background: #e8edf3; border-radius: 4px; overflow: hidden; display: flex; }
.progress > span { height: 100%; }
.progress .p-blue { background: var(--primary); }
.progress .p-gold { background: var(--accent); }
.progress .p-green { background: var(--success); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); margin-top: 8px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }

/* ---------- Funnel ---------- */
.funnel { display: flex; flex-direction: column; gap: 12px; }
.funnel-row { display: grid; grid-template-columns: 120px 1fr 56px; align-items: center; gap: 12px; }
.funnel-row .bar { height: 30px; background: #eef3f8; border-radius: 8px; overflow: hidden; }
.funnel-row .bar span { display: block; height: 100%; border-radius: 8px; background: var(--gradient); transition: width 0.5s; }
.funnel-row .bar.gold span { background: linear-gradient(90deg, #f0c040, var(--accent)); }
.funnel-row .bar.green span { background: linear-gradient(90deg, #4ade80, var(--success)); }
.funnel-row strong { text-align: right; color: var(--primary-dark); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 12px; overflow-x: auto; }
.tabs button {
  border: 0; background: none; font: inherit; font-weight: 600; color: var(--text-muted); padding: 14px 14px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; gap: 8px; align-items: center; white-space: nowrap;
}
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 30, 60, 0.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px;
  animation: fade 0.15s ease;
}
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: pop 0.18s ease;
}
.modal { min-width: 0; }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

/* ---------- Toast ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 12px; padding: 12px 16px; min-width: 260px; max-width: 380px;
  box-shadow: var(--shadow-lg); border-left: 4px solid var(--primary); animation: pop 0.2s ease; font-weight: 500;
}
.toast.success { border-color: var(--success); } .toast.success .icon { color: var(--success); }
.toast.error { border-color: var(--danger); } .toast.error .icon { color: var(--danger); }
@media (max-width: 480px) { .toasts { left: 12px; right: 12px; } .toast { max-width: none; } }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 220px;
  padding: 6px; z-index: 50; border: 1px solid var(--border);
}
.dropdown-menu a, .dropdown-menu button {
  display: flex; gap: 10px; align-items: center; width: 100%; padding: 9px 12px; border-radius: 8px; color: var(--text); border: 0;
  background: none; font: inherit; cursor: pointer; text-align: left;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--primary-50); }
.notif-menu { width: 360px; max-width: calc(100vw - 24px); padding: 0; }
.notif-menu .head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.notif-list { max-height: 400px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text); }
.notif-item:hover { background: #f8fafc; }
.notif-item.unread { background: #f4f9fe; }
.notif-item .when { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* ---------- Misc ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty .icon { color: #b9c6d6; margin-bottom: 10px; }
.empty h3 { color: var(--text); margin-bottom: 4px; }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 10px 16px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; font-weight: 500; }
.info-line { display: flex; gap: 10px; align-items: flex-start; color: var(--text); margin-bottom: 10px; }
.info-line .icon { color: var(--primary); margin-top: 2px; }
.chip-select { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; background: #fff; user-select: none; transition: all 0.15s;
}
.chip:hover { border-color: var(--primary); }
.chip.selected { border-color: var(--primary); background: var(--primary-50); color: var(--primary-dark); font-weight: 600; }
.chip input { display: none; }
.steps { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 30px; background: #fff; color: var(--text-muted); font-weight: 600; box-shadow: var(--shadow); }
.step .num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #eef1f5; font-size: 12.5px; }
.step.active { color: var(--primary-dark); }
.step.active .num { background: var(--accent); color: #fff; }
.step.done .num { background: var(--success); color: #fff; }
.copy-box { display: flex; gap: 8px; align-items: center; background: #f6f9fc; border: 1px dashed #c7dbef; border-radius: 10px; padding: 8px 8px 8px 14px; }
.copy-box code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--primary-dark); }
.msg-bubble { background: #e5f2ff; border-radius: 4px 14px 14px 14px; padding: 10px 14px; white-space: pre-wrap; font-size: 13px; }
.skeleton { background: linear-gradient(90deg, #eef2f6 25%, #f6f8fb 50%, #eef2f6 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Mobile-friendly guest cards (staff calling list) */
.guest-cards { display: none; }
@media (max-width: 760px) {
  .toolbar .input-icon { max-width: none; flex: 1 1 180px; }
  .toolbar select.input { max-width: none; width: 100%; flex: 1 1 100%; }
  .hide-mobile { display: none !important; }
  .guest-cards { display: flex; flex-direction: column; }
  .guest-table { display: none; }
}
.guest-card { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.guest-card .top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.guest-card .btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Mobile ---------- */
.bottom-nav { display: none; }
.only-mobile { display: none !important; }
.chip-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.chip-scroll::-webkit-scrollbar { display: none; }
.chip-scroll .chip { flex-shrink: 0; }
.chip-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chip-grid .chip { justify-content: center; min-height: 48px; }
.chip.selected.c-green { border-color: var(--success); background: var(--success-50); color: var(--success); }
.chip.selected.c-red { border-color: var(--danger); background: var(--danger-50); color: var(--danger); }
.chip.selected.c-orange { border-color: var(--warning); background: var(--warning-50); color: var(--warning); }
.chip.selected.c-gold { border-color: var(--accent); background: var(--accent-50); color: var(--accent-600); }
.msg-bubble { overflow-wrap: anywhere; }
.guest-card .badges:empty { display: none; }
.guest-card .badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.guest-card .btns .btn { flex: 1; }
.sticky-filters { position: sticky; top: 64px; z-index: 20; background: #fff; border-radius: var(--radius) var(--radius) 0 0; }

@media (max-width: 960px) {
  .only-mobile { display: inline-flex !important; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: #fff; border-top: 1px solid var(--border); padding: 6px 4px calc(env(safe-area-inset-bottom) + 6px);
    box-shadow: 0 -4px 20px rgba(21, 57, 118, 0.08);
  }
  .bottom-nav a, .bottom-nav button {
    display: flex; flex-direction: column; align-items: center; gap: 3px; font: inherit; font-size: 11px; font-weight: 600;
    color: var(--text-muted); background: none; border: 0; padding: 4px 0; min-height: 48px; justify-content: center; cursor: pointer;
  }
  .bottom-nav .active { color: var(--primary); }
  .bottom-nav .scan-fab { color: var(--primary-dark); }
  .bottom-nav .scan-fab span.fab {
    width: 54px; height: 54px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center;
    margin-top: -26px; box-shadow: 0 6px 16px rgba(221, 163, 7, 0.45); border: 4px solid #fff;
  }
  .content { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .sidebar-foot { display: none; }
  .topbar .dropdown-menu { position: fixed; left: 8px; right: 8px; top: 60px; width: auto; max-width: none; }
}

@media (max-width: 760px) {
  /* iOS Safari zooms into inputs smaller than 16px. */
  .input, select.input, textarea.input { font-size: 16px; height: 44px; }
  .btn { height: 44px; }
  .btn-sm { height: 40px; padding: 0 12px; }
  .btn-icon { width: 40px; height: 40px; }
  .page-head { margin-bottom: 14px; }
  .page-head h1 { font-size: 19px; }
  .page-head .sub { display: none; }
  .card-head { padding: 12px 14px; }
  .card-body { padding: 16px; }
  .sticky-filters { top: 64px; }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }
}

@media (max-width: 640px) {
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { max-width: none; border-radius: 20px 20px 0 0; max-height: 92vh; animation: sheet-up 0.22s ease; }
  .modal-head { padding: 14px 18px; position: relative; }
  .modal-head::before { content: ''; position: absolute; top: 6px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: #d5dce5; }
  .modal-body { padding: 16px 18px; }
  .modal-foot { padding: 12px 18px calc(env(safe-area-inset-bottom) + 12px); }
  .modal-foot .btn { flex: 1; }
}
@keyframes sheet-up { from { transform: translateY(100%); } }
