@font-face {
  font-family: 'Ubuntu';
  src: url('./fonts/Ubuntu-Regular.ttf') format('truetype');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Ubuntu';
  src: url('./fonts/Ubuntu-Medium.ttf') format('truetype');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Ubuntu';
  src: url('./fonts/Ubuntu-Bold.ttf') format('truetype');
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --ink: #0B0F19;
  --ink-soft: #1E1B4B;
  --indigo: #4F46E5;
  --indigo-light: #6366F1;
  --indigo-dark: #4338CA;
  --amber: #F59E0B;
  --amber-dark: #F97316;
  --emerald: #10B981;
  --red: #EF4444;
  --bg: #F5F6FB;
  --card: #FFFFFF;
  --border: #E4E6F0;
  --text: #1F2333;
  --muted: #6B7280;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 15, 40, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 15, 40, 0.18);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Ubuntu', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ══════════════════════ BUTTONS / FORM PRIMITIVES ══════════════════════ */
.btn {
  border: none; border-radius: 10px; padding: 11px 18px; font-weight: 600;
  font-size: 14px; transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(0.98); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn-primary {
  background: linear-gradient(135deg, var(--indigo-light), var(--indigo-dark));
  color: #fff; box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35);
}
.btn-primary:hover { box-shadow: 0 10px 26px rgba(79, 70, 229, 0.45); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; box-shadow: none; }
.btn-secondary { background: var(--ink); color: #fff; }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: #F0F1FA; }
.btn-light { background: rgba(255,255,255,0.18); color: #fff; border: 1px solid rgba(255,255,255,0.35); }
.btn-link {
  background: none; border: none; color: var(--indigo); font-weight: 600; font-size: 13.5px;
  padding: 6px 2px; text-align: left;
}
.btn-link:hover { text-decoration: underline; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text); }
.field input, .field select, .field textarea {
  border: 1.5px solid var(--border); border-radius: 10px; padding: 11px 12px;
  font-size: 14.5px; background: #fff; color: var(--text); outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--indigo-light); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.field-with-action { position: relative; display: flex; }
.field-with-action input { flex: 1; padding-right: 60px; }
.field-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--indigo); font-size: 12.5px; font-weight: 700;
  padding: 6px 8px;
}

/* ══════════════════════ TOASTS + ALERT BANNER ══════════════════════ */
.toast-host {
  position: fixed; top: 16px; right: 16px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px; max-width: 340px;
}
.toast {
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px;
  box-shadow: var(--shadow-lg); font-size: 13.5px; line-height: 1.4;
  animation: toast-in .2s ease;
  border-left: 4px solid var(--indigo-light);
}
.toast.success { border-left-color: var(--emerald); }
.toast.error { border-left-color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px);} to { opacity: 1; transform: translateY(0);} }

.alert-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10000;
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(90deg, var(--amber), var(--amber-dark));
  color: #1E1B4B; padding: 12px 18px; box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  animation: banner-in .25s ease;
}
@keyframes banner-in { from { transform: translateY(-100%);} to { transform: translateY(0);} }
.alert-banner-icon { font-size: 22px; }
.alert-banner-body { flex: 1; display: flex; flex-direction: column; }
.alert-banner-body strong { font-size: 14.5px; }
.alert-banner-body span { font-size: 13px; opacity: .85; }
.alert-banner-close {
  background: none; border: none; font-size: 22px; color: #1E1B4B; line-height: 1; padding: 0 4px;
}

/* ══════════════════════ AUTH SCREEN ══════════════════════ */
.auth-shell { min-height: 100vh; display: flex; }
.auth-brand {
  flex: 1.1; background: radial-gradient(circle at 20% 20%, #312E81, #0B0F19 65%);
  color: #fff; display: flex; align-items: center; padding: 48px; position: relative; overflow: hidden;
}
.auth-brand::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 85% 80%, rgba(245,158,11,0.18), transparent 45%);
}
.auth-brand-inner { position: relative; max-width: 480px; margin: 0 auto; }
.brand-mark { display: flex; align-items: center; gap: 12px; margin-bottom: 36px; }
.brand-mark img { border-radius: 12px; }
.brand-mark span { font-size: 20px; font-weight: 700; letter-spacing: .3px; }
.auth-brand h1 { font-size: 32px; line-height: 1.25; margin: 0 0 14px; font-weight: 700; }
.brand-sub { color: #C7D2FE; font-size: 15.5px; line-height: 1.6; margin: 0 0 32px; }
.brand-features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 20px; }
.brand-features li { display: flex; gap: 14px; align-items: flex-start; }
.feat-ico {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 10px;
  background: rgba(255,255,255,0.08); display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.brand-features strong { display: block; font-size: 14.5px; margin-bottom: 2px; }
.brand-features small { color: #A5B4FC; font-size: 12.8px; }
.brand-footer { margin-top: 44px; color: #6366F1; font-size: 12.5px; letter-spacing: .3px; }

.auth-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px; background: var(--bg); }
.auth-card {
  width: 100%; max-width: 400px; background: var(--card); border-radius: 20px;
  padding: 40px 34px; box-shadow: var(--shadow-lg);
}
.auth-form h2 { margin: 0 0 6px; font-size: 22px; }
.auth-hint { color: var(--muted); font-size: 13.5px; margin: 0 0 24px; }
.auth-error {
  background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; border-radius: 10px;
  padding: 10px 12px; font-size: 13px; margin-top: 14px;
}
.auth-success {
  background: #ECFDF5; color: #047857; border: 1px solid #A7F3D0; border-radius: 10px;
  padding: 10px 12px; font-size: 13px; margin-top: 14px;
}
.auth-row-actions { display: flex; justify-content: space-between; margin-top: 4px; }

.otp-row { display: flex; gap: 8px; margin-bottom: 20px; }
.otp-box {
  width: 100%; aspect-ratio: 1; text-align: center; font-size: 22px; font-weight: 700;
  border: 1.5px solid var(--border); border-radius: 10px; outline: none;
}
.otp-box:focus { border-color: var(--indigo-light); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }

@media (max-width: 880px) {
  .auth-shell { flex-direction: column; }
  .auth-brand { padding: 36px 24px; }
  .auth-brand h1 { font-size: 26px; }
  .brand-features { display: none; }
}

/* ══════════════════════ APP SHELL ══════════════════════ */
.app-shell { display: flex; min-height: 100vh; }
.app-nav {
  width: 232px; flex-shrink: 0; background: var(--ink); color: #fff;
  display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh;
}
.app-nav-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 24px; font-weight: 700; font-size: 16px; }
.app-nav-links { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 10px; text-align: left; background: none; border: none;
  color: #C7D2FE; padding: 11px 12px; border-radius: 10px; font-size: 14px; font-weight: 500; position: relative;
}
.nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-link.active { background: linear-gradient(135deg, var(--indigo-light), var(--indigo-dark)); color: #fff; }
.nav-ico { width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto; background: var(--amber); color: #1E1B4B; font-size: 11px; font-weight: 700;
  border-radius: 999px; padding: 1px 7px;
}
.app-nav-footer { display: flex; flex-direction: column; gap: 12px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.1); }
.sound-toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #C7D2FE; }
.app-nav-footer .btn-link { color: #FCA5A5; }

.app-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
  display: flex; align-items: center; gap: 16px; padding: 16px 28px; background: #fff;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50;
}
.mobile-nav-toggle { display: none; background: none; border: none; font-size: 20px; }
.app-topbar-title { flex: 1; }
.app-topbar-title h1 { margin: 0; font-size: 19px; }
.business-name { font-size: 12.5px; color: var(--muted); }
.app-topbar-actions { display: flex; align-items: center; gap: 16px; }
.conn-pill {
  display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600;
  color: var(--emerald); background: #ECFDF5; padding: 6px 12px; border-radius: 999px;
}
.conn-pill.offline { color: #B45309; background: #FFFBEB; }
.conn-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse-dot 1.6s infinite; }
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip span:first-child {
  width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--indigo-light), var(--indigo-dark));
  color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.user-chip strong { display: block; font-size: 13.5px; }
.user-chip small { color: var(--muted); font-size: 11.5px; text-transform: capitalize; }

.app-main { padding: 24px 28px 60px; }
.view-note { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

/* Stat grid */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  border-top: 3px solid var(--indigo-light);
}
.stat-card .stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.stat-card .stat-value { font-size: 26px; font-weight: 700; margin-top: 6px; }
.stat-card.amber { border-top-color: var(--amber); }
.stat-card.emerald { border-top-color: var(--emerald); }
.stat-card.red { border-top-color: var(--red); }

.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 20px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.panel-head h2 { margin: 0; font-size: 16px; }
.panel-head small { color: var(--muted); font-size: 12.5px; }

.activity-feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-height: 360px; overflow-y: auto; }
.activity-feed li { display: flex; gap: 10px; font-size: 13.5px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.activity-feed li:last-child { border-bottom: none; }
.activity-time { color: var(--muted); font-size: 11.5px; white-space: nowrap; }

/* Toolbar / table */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.search-input { flex: 1; min-width: 220px; border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.select { border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; background: #fff; }

.order-table-wrap { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.order-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 820px; }
.order-table th {
  text-align: left; padding: 12px 14px; background: #FAFAFF; color: var(--muted); font-weight: 600;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .3px; border-bottom: 1px solid var(--border);
}
.order-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.order-table tr:last-child td { border-bottom: none; }
.order-table tr.row-link { cursor: pointer; }
.order-table tr.row-link:hover { background: #FAFAFF; }
.order-table tr.row-new { animation: row-flash 1.6s ease; }
@keyframes row-flash { 0% { background: #FEF3C7; } 100% { background: transparent; } }
.ref-cell strong { display: block; }
.ref-cell small { color: var(--muted); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.badge-pending, .badge-confirmed { background: #EEF2FF; color: var(--indigo-dark); }
.badge-in_queue { background: #FEF3C7; color: #92400E; }
.badge-printing { background: #DBEAFE; color: #1D4ED8; }
.badge-ready { background: #D1FAE5; color: #047857; }
.badge-out_for_delivery { background: #E0E7FF; color: #4338CA; }
.badge-completed { background: #DCFCE7; color: #15803D; }
.badge-cancelled { background: #FEE2E2; color: #B91C1C; }
.pay-badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; }
.pay-paid { background: #DCFCE7; color: #15803D; }
.pay-unpaid { background: #FEF3C7; color: #92400E; }
.pay-failed, .pay-refunded { background: #FEE2E2; color: #B91C1C; }

.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.pagination button {
  border: 1px solid var(--border); background: #fff; border-radius: 8px; padding: 6px 12px; font-size: 13px;
}
.pagination button.active { background: var(--indigo); color: #fff; border-color: var(--indigo); }
.pagination button:disabled { opacity: .4; }
.queue-mode-switch{display:inline-flex;gap:4px;margin-bottom:14px;padding:4px;border:1px solid var(--border);border-radius:10px;background:#fff}.queue-mode-switch button{border:0;border-radius:7px;background:transparent;padding:8px 14px;font-size:12px;font-weight:800;color:var(--muted)}.queue-mode-switch button.active{background:#111827;color:#fff}.queue-map-shell{border:1px solid var(--border);border-radius:16px;background:#fff;overflow:hidden}.queue-map-head{display:flex;justify-content:space-between;align-items:end;gap:20px;padding:18px 20px;border-bottom:1px solid var(--border)}.queue-map-head span{font-size:10px;letter-spacing:.13em;font-weight:900;color:#f97316}.queue-map-head h2{margin:4px 0 0;font-size:21px}.queue-map-head small{max-width:310px;color:var(--muted)}.orders-map{height:min(66vh,620px);min-height:430px;background:#eee}.map-empty{padding:50px;text-align:center;color:var(--muted)}.map-pin{display:grid;place-items:center;width:34px;height:34px;border:3px solid #fff;border-radius:50% 50% 50% 10%;background:#f97316;color:#111;box-shadow:0 5px 18px rgba(0,0,0,.28);transform:rotate(-45deg)}.map-pin>span{transform:rotate(45deg);font-size:15px;font-weight:900}.map-pin.vendor{background:#111827;color:#fff}.map-popup strong{display:block;font-size:14px}.map-popup small{display:block;margin:4px 0;color:#6b7280}.map-popup button{border:0;border-radius:6px;background:#f97316;padding:7px 10px;font-weight:800}.vendor-connection{stroke:#f97316;stroke-width:3;stroke-dasharray:7 7}
@media(max-width:640px){.queue-map-head{display:block}.queue-map-head small{display:block;margin-top:8px}.orders-map{height:60vh;min-height:380px}}

/* Settings forms */
.settings-form .grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.grid-5 { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; }
.form-actions { display: flex; align-items: center; gap: 14px; position: sticky; bottom: 0; background: var(--bg); padding: 14px 0; }
.save-status { font-size: 13px; color: var(--emerald); font-weight: 600; }
.price-pair { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: #fff; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.price-pair > strong { grid-column: 1 / -1; font-size: 12px; }
.price-pair label { display: grid; gap: 5px; }
.price-pair label span { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.price-pair input { min-width: 0; width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 9px; font: inherit; }
.price-pair label:last-child input { background: #fff7ed; border-color: #fed7aa; }
#pricingPassportGrid, #pricingDocumentGrid, #pricingPaperGrid, #pricingBindingGrid, #pricingPhotoGrid, #pricingMerchandiseGrid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.finance-row { color: #9a3412; background: #fff7ed; margin-inline: -6px; padding-inline: 6px; }

.catalog-list { display: flex; flex-direction: column; gap: 14px; }
.catalog-item { border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.catalog-item .full { grid-column: 1 / -1; }
.catalog-item .id-tag { font-size: 11px; color: var(--muted); font-family: monospace; grid-column: 1 / -1; }

.stations-list { display: flex; flex-direction: column; gap: 14px; }
.station-item { border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; position: relative; }
.station-item .full { grid-column: 1 / -1; }
.station-remove {
  position: absolute; top: 10px; right: 10px; background: #FEE2E2; color: #B91C1C; border: none;
  border-radius: 8px; width: 26px; height: 26px; font-weight: 700;
}

.staff-list { display: flex; flex-direction: column; gap: 10px; }
.staff-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.staff-row:last-child { border-bottom: none; }
.staff-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: #EEF2FF; color: var(--indigo-dark);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.staff-role { margin-left: auto; font-size: 11.5px; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.team-editor { border-top: 3px solid #f97316; }
.team-editor .grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.staff-identity { min-width: 0; flex: 1; }
.staff-actions { display: flex; gap: 7px; }
.owner-lock { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: #9a3412; background: #ffedd5; border-radius: 999px; padding: 6px 9px; }
.btn-danger { color: #b91c1c; background: #fff; border: 1px solid #fecaca; }
@media (max-width: 640px) { .staff-row { align-items: flex-start; flex-wrap: wrap; } .staff-role { margin-left: 48px; } .staff-actions { margin-left: auto; } }

/* ══════════════════════ DRAWER ══════════════════════ */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(11,15,25,0.45); z-index: 900; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(460px, 100vw); background: #fff;
  z-index: 901; box-shadow: -20px 0 50px rgba(0,0,0,0.2); display: flex; flex-direction: column;
  animation: drawer-in .2s ease;
}
@keyframes drawer-in { from { transform: translateX(100%);} to { transform: translateX(0);} }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { margin: 0; font-size: 17px; }
.drawer-close { background: none; border: none; font-size: 24px; color: var(--muted); }
.drawer-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.drawer-section { margin-bottom: 22px; }
.drawer-section h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); margin: 0 0 10px; }
.drawer-row { display: flex; justify-content: space-between; font-size: 13.5px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.drawer-row:last-child { border-bottom: none; }
.drawer-row strong { text-align: right; }
.status-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.status-actions button {
  border: 1.5px solid var(--border); background: #fff; border-radius: 999px; padding: 8px 14px; font-size: 12.5px; font-weight: 600;
}
.status-actions button.current { background: var(--ink); color: #fff; border-color: var(--ink); }
.item-card { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; font-size: 13px; }
.item-card .item-title { font-weight: 700; }
.item-card .item-meta { color: var(--muted); font-size: 12px; }
.event-item { font-size: 12.5px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.event-item:last-child { border-bottom: none; }
.event-item .event-time { color: var(--muted); font-size: 11px; }

@media (max-width: 980px) {
  .app-nav { position: fixed; left: -240px; z-index: 800; transition: left .2s ease; }
  .app-nav.open { left: 0; }
  .mobile-nav-toggle { display: block; }
  .app-main { padding: 18px; }
}
