/* ==========================================================================
   Ritiro — design system
   Dark (charcoal) by default, light (ivory) via [data-theme="light"].
   Logical properties everywhere so RTL and LTR both work.
   ========================================================================== */

:root {
  --red: #FF3A00;
  --orange: #FF9A00;
  --gold: #FFD28A;
  --gold-deep: #F5B23E;
  --ivory: #F3EBDD;
  --charcoal: #0D0B0D;

  --bg: #0D0B0D;
  --bg-2: #121012;
  --surface: #171416;
  --surface-2: #1E1A1D;
  --surface-3: #26211F;
  --border: #2A2427;
  --border-2: #3A3236;
  --text: #F7F3EE;
  --muted: #ABA49D;
  --subtle: #857D78;
  --accent: var(--red);
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(255, 58, 0, 0.14);
  --ring: rgba(255, 154, 0, 0.45);

  --ok: #3CCB8B;
  --ok-soft: rgba(60, 203, 139, 0.14);
  --warn: #FF9A00;
  --warn-soft: rgba(255, 154, 0, 0.14);
  --danger: #FF5C5C;
  --danger-soft: rgba(255, 92, 92, 0.14);
  --info: #7DB3FF;
  --info-soft: rgba(125, 179, 255, 0.14);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 10px 30px -12px rgba(0,0,0,0.6);
  --shadow-pop: 0 24px 60px -20px rgba(0,0,0,0.7);
  --sidebar-w: 272px;
  --font: 'Readex Pro', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #F7F2EA;
  --bg-2: #FFFDF9;
  --surface: #FFFFFF;
  --surface-2: #FBF7F1;
  --surface-3: #F3EBDD;
  --border: #ECE2D3;
  --border-2: #DDD0BD;
  --text: #171214;
  --muted: #5F5650;
  --subtle: #857B73;
  --accent-soft: rgba(255, 58, 0, 0.10);
  --ok: #128A55;
  --ok-soft: rgba(18, 138, 85, 0.10);
  --warn: #B86200;
  --warn-soft: rgba(255, 154, 0, 0.14);
  --danger: #D42F2F;
  --danger-soft: rgba(212, 47, 47, 0.10);
  --info: #2563C9;
  --info-soft: rgba(37, 99, 201, 0.10);
  --shadow: 0 1px 2px rgba(60, 40, 20, 0.04), 0 8px 24px -12px rgba(60, 40, 20, 0.16);
  --shadow-pop: 0 24px 60px -20px rgba(60, 40, 20, 0.35);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--orange); color: #000; }
.ic { flex-shrink: 0; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.subtle { color: var(--subtle); }
.hidden { display: none !important; }

:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; border-radius: 6px; }

/* ── App shell ─────────────────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset-block: 0; inset-inline-start: 0;
  width: var(--sidebar-w);
  background: var(--bg-2);
  border-inline-end: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 40;
  transition: transform .25s ease;
}
.sidebar-head { padding: 22px 22px 14px; display: flex; align-items: center; justify-content: space-between; }
.sidebar-head .brand img { height: 30px; width: auto; }
.brand-tag {
  font-size: 11px; font-weight: 500; letter-spacing: .04em;
  color: var(--orange); background: var(--warn-soft);
  padding: 2px 8px; border-radius: 99px;
}
.sidebar-ctx {
  margin: 6px 14px 10px; padding: 12px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-ctx .logo-box { width: 40px; height: 40px; border-radius: 12px; overflow: hidden; background: var(--surface-3); display: grid; place-items: center; font-weight: 700; color: var(--orange); }
.sidebar-ctx .logo-box img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-ctx .t { font-weight: 600; font-size: 14px; line-height: 1.3; }
.sidebar-ctx .s { font-size: 12px; color: var(--muted); }
.nav { padding: 6px 12px; flex: 1; overflow-y: auto; }
.nav-label { font-size: 11.5px; color: var(--subtle); padding: 14px 12px 6px; letter-spacing: .03em; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin-block: 2px;
  border-radius: 12px; color: var(--muted); font-size: 14.5px;
  transition: background .15s, color .15s;
  position: relative;
}
.nav a:hover { background: var(--surface); color: var(--text); }
.nav a.is-active { background: var(--surface-2); color: var(--text); font-weight: 500; }
.nav a.is-active::before {
  content: ""; position: absolute; inset-inline-start: -12px; top: 10px; bottom: 10px;
  width: 4px; border-radius: 0 4px 4px 0; background: var(--red);
}
[dir="rtl"] .nav a.is-active::before { border-radius: 4px 0 0 4px; }
.nav a.is-active .ic { color: var(--orange); }
.nav .count { margin-inline-start: auto; font-size: 12px; min-width: 22px; text-align: center; padding: 0 7px; border-radius: 99px; background: var(--red); color: #fff; }
.sidebar-foot { padding: 14px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--red), var(--orange));
  color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 14px; flex-shrink: 0;
}
.user-chip .n { font-size: 14px; font-weight: 500; line-height: 1.3; }
.user-chip .r { font-size: 12px; color: var(--muted); }
.user-chip form { margin-inline-start: auto; }

.main { flex: 1; margin-inline-start: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 32px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  min-height: 68px;
}
.topbar .page-title { font-size: 18px; font-weight: 600; }
.topbar .crumbs { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.topbar .spacer { flex: 1; }
.icon-btn.menu-btn { display: none; }
.content { padding: 28px 32px 64px; width: 100%; max-width: 1360px; margin-inline: auto; }

.impersonation-bar {
  background: linear-gradient(90deg, var(--red), var(--orange));
  color: #fff; font-size: 14px; padding: 8px 32px;
  display: flex; align-items: center; gap: 12px; justify-content: center; flex-wrap: wrap;
}
.impersonation-bar button { background: rgba(0,0,0,.25); border: 0; color: #fff; padding: 4px 12px; border-radius: 99px; cursor: pointer; }

.trial-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 22px; border-radius: var(--radius);
  background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--orange) 35%, transparent);
  color: var(--text); font-size: 14px;
}
.trial-bar.is-danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.trial-bar .ic { color: var(--orange); }
.trial-bar a { margin-inline-start: auto; font-weight: 500; color: var(--orange); }

.overlay { display: none; }

/* ── Page header ───────────────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.01em; }
.page-head p { color: var(--muted); margin-top: 4px; font-size: 14.5px; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.greeting { font-size: 28px; }
.greeting .wave { display: inline-block; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  --b-bg: var(--surface-2); --b-fg: var(--text); --b-bd: var(--border);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 12px;
  background: var(--b-bg); color: var(--b-fg); border: 1px solid var(--b-bd);
  font-size: 14.5px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: transform .08s, background .15s, border-color .15s, box-shadow .15s, opacity .15s;
  text-decoration: none; user-select: none;
}
.btn:hover { border-color: var(--border-2); background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-loading { opacity: .55; pointer-events: none; }
.btn-primary { --b-bg: var(--red); --b-fg: #fff; --b-bd: var(--red); box-shadow: 0 8px 22px -10px rgba(255,58,0,.75); }
.btn-primary:hover { background: #FF4D17; border-color: #FF4D17; }
.btn-gold { --b-bg: var(--gold); --b-fg: #1B1308; --b-bd: var(--gold); }
.btn-gold:hover { background: #FFDCA0; border-color: #FFDCA0; }
.btn-ok { --b-bg: var(--ok); --b-fg: #04150D; --b-bd: var(--ok); }
.btn-ok:hover { filter: brightness(1.06); background: var(--ok); }
.btn-ghost { --b-bg: transparent; --b-bd: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }
.btn-danger { --b-bg: var(--danger-soft); --b-fg: var(--danger); --b-bd: transparent; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-soft { --b-bg: var(--accent-soft); --b-fg: var(--red); --b-bd: transparent; }
[data-theme="dark"] .btn-soft, :root:not([data-theme]) .btn-soft { --b-fg: #FF7A4D; }
.btn-soft:hover { background: color-mix(in srgb, var(--red) 22%, transparent); border-color: transparent; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; gap: 6px; }
.btn-lg { height: 52px; padding: 0 24px; font-size: 16px; border-radius: 14px; }
.btn-xl { height: 64px; padding: 0 28px; font-size: 18px; border-radius: 18px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 42px; height: 42px; display: inline-grid; place-items: center;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 10px; }
.pill-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 14px; cursor: pointer;
}
.pill-btn:hover { background: var(--surface-2); }

/* ── Cards & grid ──────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.card-pad { padding: 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px 0; flex-wrap: wrap; }
.card-head h2, .card-head h3 { font-size: 16.5px; font-weight: 600; }
.card-head p { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 20px 24px 24px; }
.card-foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.grid { display: grid; gap: 20px; }
.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, 1.7fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 32px; }
.mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }

/* ── Stat tiles ────────────────────────────────────────────────────────── */
.stat {
  position: relative; overflow: hidden;
  padding: 20px 22px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.stat .top { display: flex; align-items: center; justify-content: space-between; }
.stat .label { font-size: 13.5px; color: var(--muted); }
.stat .value { font-size: 32px; font-weight: 600; margin-top: 10px; letter-spacing: -0.02em; line-height: 1.1; }
.stat .value small { font-size: 15px; color: var(--muted); font-weight: 400; margin-inline-start: 4px; }
.stat .hint { font-size: 12.5px; color: var(--subtle); margin-top: 6px; }
.stat .chip {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--orange);
}
.stat.is-hero {
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(255,154,0,.22), transparent 55%),
    linear-gradient(160deg, #24150D, #170F0C);
  border-color: rgba(255,154,0,.25);
  color: #FFF6EC;
}
.stat.is-hero .label, .stat.is-hero .hint { color: rgba(255,240,225,.72); }
.stat.is-hero .chip { background: rgba(255,154,0,.18); color: var(--gold); }
[data-theme="light"] .stat.is-hero { background: radial-gradient(120% 120% at 100% 0%, rgba(255,154,0,.30), transparent 55%), linear-gradient(160deg, #2A1810, #1A100C); }

/* ── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px; border-radius: 99px;
  font-size: 12.5px; font-weight: 500; white-space: nowrap;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge-brand { background: var(--accent-soft); color: #FF6B3D; border-color: transparent; }
[data-theme="light"] .badge-brand { color: #D93200; }
.badge-gold { background: rgba(255,210,138,.16); color: var(--gold); border-color: transparent; }
[data-theme="light"] .badge-gold { color: #9A6100; background: rgba(245,178,62,.18); }

/* ── Tables ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: start; font-weight: 500; font-size: 12.5px; color: var(--subtle);
  padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .cell-main { display: flex; align-items: center; gap: 12px; }
.table .cell-main .t { font-weight: 500; }
.table .cell-main .s { font-size: 12.5px; color: var(--muted); }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.merchant-logo {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  background: var(--surface-3); display: grid; place-items: center;
  font-weight: 600; color: var(--orange); overflow: hidden; font-size: 15px;
}
.merchant-logo img { width: 100%; height: 100%; object-fit: cover; }
.merchant-logo.lg { width: 64px; height: 64px; border-radius: 18px; font-size: 24px; }

/* ── Forms ─────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 7px; }
.field label, .label { font-size: 13.5px; font-weight: 500; color: var(--text); }
.field .help { font-size: 12.5px; color: var(--subtle); }
.field .err { font-size: 12.5px; color: var(--danger); }
.input, .select, .textarea {
  width: 100%; height: 46px; padding: 0 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; color: var(--text); font-size: 15px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.textarea { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--subtle); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 4px var(--warn-soft); background: var(--surface); }
.input.is-invalid { border-color: var(--danger); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 14px center; padding-inline-end: 40px; }
[dir="ltr"] .select { background-position: right 14px center; }
.input-group { position: relative; }
.input-group .ic { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-start: 14px; color: var(--subtle); pointer-events: none; }
.input-group .input { padding-inline-start: 44px; }
.input-group .toggle-pass { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--subtle); cursor: pointer; padding: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-grid .span-2 { grid-column: span 2; }
.color-input { display: flex; gap: 10px; align-items: center; }
.color-input input[type=color] { width: 46px; height: 46px; border: 1px solid var(--border); border-radius: 12px; padding: 4px; background: var(--surface-2); cursor: pointer; }

.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 46px; height: 26px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--border-2); position: relative; transition: background .2s; flex-shrink: 0; }
.switch .track::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + .track { background: var(--red); border-color: var(--red); }
.switch input:checked + .track::after { transform: translateX(20px); }
[dir="rtl"] .switch input:checked + .track::after { transform: translateX(-20px); }
.switch input:focus-visible + .track { outline: 2px solid var(--orange); outline-offset: 2px; }

.radio-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.radio-card { position: relative; }
.radio-card input { position: absolute; opacity: 0; }
.radio-card span {
  display: flex; flex-direction: column; gap: 2px; padding: 14px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s;
}
.radio-card span b { font-weight: 600; font-size: 15px; }
.radio-card span small { color: var(--muted); font-size: 12.5px; }
.radio-card input:checked + span { border-color: var(--orange); background: var(--warn-soft); }
.radio-card input:focus-visible + span { outline: 2px solid var(--orange); outline-offset: 2px; }

/* ── Search / filter bar ───────────────────────────────────────────────── */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.toolbar .input-group { flex: 1; min-width: 220px; }
.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); flex-wrap: wrap; }
.tabs a, .tabs button { padding: 7px 14px; border-radius: 9px; font-size: 13.5px; color: var(--muted); background: none; border: 0; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs .is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 500; }
.tabs .n { font-size: 11.5px; color: var(--subtle); }

/* ── Lists ─────────────────────────────────────────────────────────────── */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-top: 1px solid var(--border); }
.list-item:first-child { border-top: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .t { font-weight: 500; font-size: 14.5px; }
.list-item .s { font-size: 12.5px; color: var(--muted); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 20px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; text-align: end; }

.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 10px; padding: 48px 24px; color: var(--muted);
}
.empty .ic-wrap { width: 64px; height: 64px; border-radius: 20px; background: var(--surface-2); display: grid; place-items: center; color: var(--orange); margin-bottom: 6px; }
.empty h3 { color: var(--text); font-size: 17px; }
.empty p { max-width: 380px; font-size: 14px; }

/* ── Progress ──────────────────────────────────────────────────────────── */
.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--red), var(--orange)); }
[dir="rtl"] .progress > span { background: linear-gradient(270deg, var(--red), var(--orange)); }

/* ── Bars chart (CSS only) ─────────────────────────────────────────────── */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 190px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bars .bar .fill { width: 100%; max-width: 38px; border-radius: 10px 10px 4px 4px; background: var(--surface-3); position: relative; min-height: 4px; transition: height .6s cubic-bezier(.2,.8,.2,1); }
.bars .bar.is-today .fill { background: linear-gradient(180deg, var(--orange), var(--red)); }
.bars .bar .fill:hover::after { content: attr(data-v); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); font-size: 12px; background: var(--text); color: var(--bg); padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.bars .bar .d { font-size: 12px; color: var(--subtle); }

/* ── Modals ────────────────────────────────────────────────────────────── */
dialog.modal {
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  background: var(--surface); color: var(--text); padding: 0;
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  box-shadow: var(--shadow-pop);
}
dialog.modal.lg { width: min(760px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(5, 3, 4, .6); backdrop-filter: blur(4px); }
dialog.modal[open] { animation: pop .18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px 0; gap: 12px; }
.modal-head h3 { font-size: 18px; }
.modal-head p { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.modal-body { padding: 20px 24px; overflow-y: auto; }
.modal-foot { padding: 16px 24px 22px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ── Toasts ────────────────────────────────────────────────────────────── */
.toasts { position: fixed; z-index: 100; bottom: 24px; inset-inline-start: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
[dir="rtl"] .toasts { transform: translateX(50%); }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: 14px; font-size: 14.5px;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-pop);
  animation: toast-in .25s ease-out;
}
.toast.is-error { background: var(--danger); color: #fff; }
.toast.is-success .ic { color: var(--ok); }
[data-theme="light"] .toast.is-success .ic { color: #4BE3A0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }

/* ── Alerts ────────────────────────────────────────────────────────────── */
.alert { display: flex; gap: 12px; padding: 14px 16px; border-radius: 14px; font-size: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.alert-info { background: var(--info-soft); border-color: transparent; }
.alert-info .ic { color: var(--info); }
.alert-warn { background: var(--warn-soft); border-color: transparent; }
.alert-warn .ic { color: var(--warn); }
.alert-danger { background: var(--danger-soft); border-color: transparent; color: var(--text); }
.alert-danger .ic { color: var(--danger); }

/* ── Dropdown ──────────────────────────────────────────────────────────── */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 50;
  min-width: 220px; padding: 6px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-pop);
  display: none;
}
.dropdown.is-open .dropdown-menu { display: block; animation: pop .14s ease-out; }
.dropdown-menu button, .dropdown-menu a { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; font-size: 14px; background: none; border: 0; cursor: pointer; text-align: start; color: var(--text); }
.dropdown-menu button:hover, .dropdown-menu a:hover { background: var(--surface-2); }
.dropdown-menu .is-current { color: var(--orange); }

/* ── Auth pages ────────────────────────────────────────────────────────── */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
}
.auth-form { display: flex; flex-direction: column; padding: 32px 48px; }
.auth-form .top { display: flex; justify-content: space-between; align-items: center; }
.auth-form .top img { height: 32px; }
.auth-form .inner { width: 100%; max-width: 420px; margin: auto; padding-block: 32px; }
.auth-form h1 { font-size: 30px; letter-spacing: -0.01em; }
.auth-form .lead { color: var(--muted); margin-top: 8px; margin-bottom: 28px; }
.auth-form .foot { font-size: 13px; color: var(--subtle); text-align: center; }
.auth-art {
  position: relative; overflow: hidden; margin: 16px; border-radius: 32px;
  background: var(--red);
  display: flex; flex-direction: column; justify-content: flex-end; padding: 48px;
  color: #FFF6EC; isolation: isolate;
}
.auth-art .waves { position: absolute; inset-inline-end: -14%; top: -12%; width: 88%; color: rgba(255,255,255,.95); z-index: -1; }
.auth-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 35%, rgba(150,28,0,.55) 100%); z-index: -1; }
.auth-art h2 { font-size: 34px; line-height: 1.25; max-width: 460px; }
.auth-art p { color: rgba(255,255,255,.86); margin-top: 12px; max-width: 440px; font-size: 15.5px; }
.auth-art .feats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.auth-art .feats span { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 99px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.22); font-size: 13.5px; }
.auth-art .feats .ic { color: #fff; }
.auth-art.is-admin { background: #17110F; }
.auth-art.is-admin .waves { color: var(--red); }
.auth-art.is-admin::after { background: linear-gradient(180deg, transparent 30%, rgba(13,11,13,.92) 78%); }

/* ── Orders board ──────────────────────────────────────────────────────── */
.board-top { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.board-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.board-stats .s { padding: 8px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); font-size: 13.5px; color: var(--muted); }
.board-stats .s b { color: var(--text); font-weight: 600; margin-inline-start: 4px; }
.board { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.lane { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-xl); min-height: 420px; display: flex; flex-direction: column; }
.lane-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.lane-head h3 { font-size: 15.5px; }
.lane-head .n { margin-inline-start: auto; font-size: 13px; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 99px; display: grid; place-items: center; background: var(--surface-2); font-weight: 600; }
.lane-dot { width: 10px; height: 10px; border-radius: 50%; }
.lane-dot.prep { background: var(--orange); box-shadow: 0 0 0 4px var(--warn-soft); }
.lane-dot.ready { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.lane-body { padding: 14px; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); align-content: start; }
.lane-empty { grid-column: 1 / -1; text-align: center; color: var(--subtle); padding: 48px 12px; font-size: 14px; }
.ocard {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: 14px; display: flex; flex-direction: column; gap: 12px; position: relative;
  animation: card-in .3s ease-out;
}
@keyframes card-in { from { opacity: 0; transform: scale(.96); } }
.ocard .head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.ocard .no { font-size: 30px; font-weight: 700; letter-spacing: .02em; line-height: 1; }
.ocard .no small { font-size: 14px; color: var(--subtle); font-weight: 500; margin-inline-end: 2px; }
.ocard .meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12.5px; color: var(--muted); }
.ocard .meta span { display: inline-flex; align-items: center; gap: 4px; }
.ocard .label-txt { font-size: 13.5px; color: var(--text); }
.ocard .timer { font-size: 13px; color: var(--muted); display: inline-flex; gap: 4px; align-items: center; }
.ocard .timer.is-late { color: var(--danger); }
.ocard .acts { display: flex; gap: 8px; }
.ocard .acts .btn { flex: 1; }
.ocard.is-ready { border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: linear-gradient(180deg, var(--ok-soft), var(--surface) 60%); }
.ocard .scan-ok { color: var(--ok); }
.ocard .scan-wait { color: var(--subtle); }

.qr-box { background: #fff; border-radius: 22px; padding: 18px; display: grid; place-items: center; width: fit-content; margin: 0 auto; }
.qr-box svg, .qr-box img { width: 248px; height: 248px; display: block; }
.order-ticket { text-align: center; }
.order-ticket .big-no { font-size: 64px; font-weight: 700; line-height: 1; letter-spacing: .02em; }
.order-ticket .cap { color: var(--muted); font-size: 14px; margin-top: 6px; }

.recent { margin-top: 24px; }
.done-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.done-chip b { color: var(--text); }

/* ── Loyalty ───────────────────────────────────────────────────────────── */
.stamp-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.stamp-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stamp {
  aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  border: 2px dashed color-mix(in srgb, currentColor 30%, transparent);
  color: inherit; opacity: .9;
}
.stamp.is-on { border: 0; background: var(--stamp-color, var(--orange)); color: var(--stamp-ink, #fff); opacity: 1; animation: stamp-in .4s cubic-bezier(.2,1.4,.4,1); }
.stamp.is-gift { border-style: solid; }
@keyframes stamp-in { from { transform: scale(.4) rotate(-20deg); opacity: 0; } }
.loyalty-card {
  --lc: var(--red);
  border-radius: 26px; padding: 24px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(150deg, color-mix(in srgb, var(--lc) 92%, #000), color-mix(in srgb, var(--lc) 55%, #000));
  box-shadow: 0 24px 50px -24px color-mix(in srgb, var(--lc) 70%, #000);
  isolation: isolate;
}
.loyalty-card::before { content: ""; position: absolute; width: 320px; height: 320px; border-radius: 50%; border: 44px solid rgba(255,255,255,.07); top: -150px; inset-inline-end: -120px; z-index: -1; }
.loyalty-card .lc-top { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.loyalty-card .lc-logo { width: 46px; height: 46px; border-radius: 14px; background: rgba(255,255,255,.16); display: grid; place-items: center; overflow: hidden; font-weight: 700; }
.loyalty-card .lc-logo img { width: 100%; height: 100%; object-fit: cover; }
.loyalty-card .lc-name { font-weight: 600; font-size: 17px; line-height: 1.2; }
.loyalty-card .lc-sub { font-size: 12.5px; opacity: .75; }
.loyalty-card .stamp { --stamp-color: #fff; --stamp-ink: var(--lc); border-color: rgba(255,255,255,.35); }
.loyalty-card .lc-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; font-size: 13.5px; }

.scanner { position: relative; border-radius: 20px; overflow: hidden; background: #000; aspect-ratio: 1; max-width: 360px; margin: 0 auto; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner .frame { position: absolute; inset: 18%; border: 3px solid var(--orange); border-radius: 22px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }

/* ── Plans ─────────────────────────────────────────────────────────────── */
.plan-card { position: relative; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.plan-card.is-featured { border-color: color-mix(in srgb, var(--orange) 55%, transparent); background: linear-gradient(180deg, var(--warn-soft), var(--surface) 45%); }
.plan-card .price { font-size: 36px; font-weight: 600; letter-spacing: -0.02em; }
.plan-card .price small { font-size: 14px; color: var(--muted); font-weight: 400; }
.plan-card ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.plan-card li { display: flex; gap: 10px; align-items: center; }
.plan-card li .ic { color: var(--ok); }
.plan-card li.off { color: var(--subtle); }
.plan-card li.off .ic { color: var(--subtle); }

/* ── Subscription ring ─────────────────────────────────────────────────── */
.sub-hero { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; }
.ring { --p: 50; width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--orange) calc(var(--p) * 1%), var(--surface-3) 0); flex-shrink: 0; }
.ring > div { width: 104px; height: 104px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; text-align: center; }
.ring b { font-size: 30px; line-height: 1; display: block; }
.ring span { font-size: 12px; color: var(--muted); }

/* ── Install ───────────────────────────────────────────────────────────── */
.install-wrap { max-width: 720px; margin: 48px auto; padding: 0 20px; }

/* ── Errors ────────────────────────────────────────────────────────────── */
.error-page { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; }
.error-page .code { font-size: 96px; font-weight: 700; background: linear-gradient(135deg, var(--red), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 980px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-pop); }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .overlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 35; }
  .main { margin-inline-start: 0; }
  .icon-btn.menu-btn { display: inline-grid; }
  .topbar { padding: 12px 16px; }
  .content { padding: 20px 16px 48px; }
  .impersonation-bar { padding: 8px 16px; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { display: none; }
  .auth-form { padding: 24px; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .board { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .grid-2, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .grid-4.keep-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .page-head h1 { font-size: 22px; }
  .stat .value { font-size: 26px; }
  .topbar .hide-sm { display: none; }
  .table .hide-sm { display: none; }
  .lane-body { grid-template-columns: minmax(0, 1fr); }
}

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main { margin: 0; }
}

/* Theme-aware logo */
.logo-on-light { display: none !important; }
[data-theme="light"] .logo-on-dark { display: none !important; }
[data-theme="light"] .logo-on-light { display: block !important; }
