/* HB Cafe – shared design system (playbook §6). Light + dark tokens, RTL-safe (logical properties). */
:root {
  --green: #00804E; --green-dark: #00603A; --lime: #ACCC5D; --pale: #EDF4DC; --cream: #FFF6D9;
  --ink: #16321F; --olive: #3F6B2F; --muted: #5E6B58;
  --good: #3f7d12; --warn: #b26a00; --bad: #c62828; --info: #1b5e9e;
  --bg: #F4F7EE; --surface: #FFFFFF; --surface-2: #F8FAF4; --line: #DCE6CF; --line-strong: #C9D8B5;
  --nav-bg: #00603A; --nav-ink: #EDF4DC; --nav-active-bg: #ACCC5D; --nav-active-ink: #16321F;
  --focus: 0 0 0 3px rgba(172, 204, 93, .65);
  --shadow: 0 1px 3px rgba(22, 50, 31, .12); --shadow-lg: 0 8px 28px rgba(22, 50, 31, .22);
  --radius: 14px; --font: "Inter", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #E7F0DF; --olive: #B9D49A; --muted: #A3B39A; --bg: #0F1A13; --surface: #17251C; --surface-2: #1C2D22;
    --line: #2A3F31; --line-strong: #375340; --pale: #20362A; --cream: #3A3015; --nav-bg: #0B2417;
    --good: #8CCB5E; --warn: #F0B04A; --bad: #FF8A80; --info: #8AB8F0; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #E7F0DF; --olive: #B9D49A; --muted: #A3B39A; --bg: #0F1A13; --surface: #17251C; --surface-2: #1C2D22;
  --line: #2A3F31; --line-strong: #375340; --pale: #20362A; --cream: #3A3015; --nav-bg: #0B2417;
  --good: #8CCB5E; --warn: #F0B04A; --bad: #FF8A80; --info: #8AB8F0; color-scheme: dark;
}
[dir="rtl"] { --font: "Cairo", "Segoe UI", system-ui, sans-serif; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45; }
a { color: var(--green); } [data-theme="dark"] a, :root:not([data-theme="light"]) a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
svg.i { width: 18px; height: 18px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── layout ── */
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; }
.nav { flex: 1 1 230px; max-width: 100%; background: var(--nav-bg); color: var(--nav-ink); padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav .brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 16px; font-weight: 800; font-size: 17px; color: #fff; }
.nav .brand img { width: 34px; height: 34px; border-radius: 10px; }
.nav .group { font-size: 11px; font-weight: 700; color: var(--lime); padding: 12px 10px 4px; letter-spacing: .06em; text-transform: uppercase; }
.nav a { display: flex; align-items: center; gap: 10px; color: var(--nav-ink); text-decoration: none; padding: 9px 10px; border-radius: 9px; min-height: 40px; }
.nav a:hover { background: rgba(255, 255, 255, .08); }
.nav a.active { background: var(--nav-active-bg); color: var(--nav-active-ink); font-weight: 700; }
.nav a .count { margin-inline-start: auto; background: var(--cream); color: #8a5a00; border-radius: 999px; padding: 0 8px; font-weight: 700; font-size: 12px; }
.nav .spacer { flex: 1; }
.nav .foot { font-size: 12px; color: var(--lime); padding: 12px 10px 0; display: flex; flex-direction: column; gap: 8px; }
.nav .foot .row { display: flex; gap: 6px; flex-wrap: wrap; }
.nav .foot button { background: transparent; border: 1px solid rgba(172, 204, 93, .6); color: var(--nav-ink); border-radius: 8px; min-height: 34px; padding: 0 10px; cursor: pointer; }
.main { flex: 999 1 560px; min-width: 0; padding: 22px 26px 60px; display: flex; flex-direction: column; gap: 14px; }
.menu-btn { display: none; }
@media (max-width: 860px) {
  .shell { align-content: flex-start; }
  .nav { flex-basis: 100%; padding: 10px 12px; }
  .nav.collapsed > :not(.brand) { display: none; }
  .nav .brand { padding-bottom: 0; }
  .menu-btn { display: inline-flex; margin-inline-start: auto; }
  .main { padding: 16px 14px 60px; }
}

/* ── page header & toolbar ── */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.page-head .titles { flex: 1 1 260px; display: flex; flex-direction: column; gap: 2px; }
.crumb { font-size: 12px; color: var(--muted); }
h1 { margin: 0; font-size: 24px; color: var(--green-dark); font-weight: 800; }
:root:not([data-theme="light"]) h1 { color: inherit; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) h1 { color: var(--green-dark); } }
:root[data-theme="light"] h1 { color: var(--green-dark); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; padding: 0 10px; min-height: 40px; flex: 1 1 220px; }
.search input { border: 0; background: transparent; outline: none; flex: 1; min-width: 0; min-height: 38px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); min-height: 38px; padding: 0 14px; cursor: pointer; }
.seg button.on { background: var(--green); color: #fff; font-weight: 700; }

/* ── buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-weight: 600; text-decoration: none; color: inherit; white-space: nowrap; }
.btn:hover { border-color: var(--green); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-dark); }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.danger.solid { background: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 40px; padding: 0; }

/* ── cards, tables ── */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.table-wrap { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th { background: var(--green); color: #fff; text-align: start; padding: 10px 12px; font-weight: 700; white-space: nowrap; }
th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: var(--surface-2); }
tbody tr.sel td { background: var(--pale); }
td.check, th.check { width: 36px; cursor: default; }
td .ar, .ar { font-family: "Cairo", system-ui, sans-serif; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.empty .btn { margin-top: 12px; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--green); }

/* ── badges, chips ── */
.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 700; border: 1px solid currentColor; white-space: nowrap; }
.badge.good { color: var(--good); } .badge.warn { color: var(--warn); } .badge.bad { color: var(--bad); } .badge.muted { color: var(--muted); } .badge.info { color: var(--info); }
.chip { display: inline-block; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 7px; padding: 0 7px; margin: 1px; font-size: 12px; }
.missing { color: var(--warn); font-weight: 700; }

/* ── bulk bar ── */
.bulk { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--ink); color: var(--surface); border-radius: 12px; padding: 8px 12px; }
.bulk strong { flex: 1; }
.bulk .btn { background: transparent; color: inherit; border-color: var(--lime); }
.bulk .btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }

/* ── drawer (edit form) ── */
.drawer-back { position: fixed; inset: 0; background: rgba(10, 20, 12, .35); z-index: 40; }
.drawer { position: fixed; inset-block: 0; inset-inline-end: 0; width: min(460px, 100%); background: var(--surface); z-index: 41; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; border-inline-start: 4px solid var(--lime); }
.drawer header { display: flex; align-items: center; gap: 8px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer header h2 { margin: 0; font-size: 18px; flex: 1; }
.drawer .body { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.drawer footer { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; }
.drawer footer .grow { flex: 1; }

/* ── form fields ── */
.field { display: flex; flex-direction: column; gap: 4px; }
.field > label, .field > .label { font-weight: 600; }
.field .hint { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12px; color: var(--bad); font-weight: 600; }
.field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea, .input {
  min-height: 40px; border-radius: 10px; border: 1px solid var(--line-strong); padding: 6px 10px; background: var(--surface); width: 100%; }
.field textarea { min-height: 80px; resize: vertical; }
.field.req > label::after { content: " *"; color: var(--bad); }
.field.req input, .field.req select { border-width: 2px; border-color: var(--green); }
.field.invalid input, .field.invalid select, .field.invalid textarea, .field.invalid .hours { border-color: var(--bad) !important; box-shadow: 0 0 0 3px rgba(198, 40, 40, .15); }
.field.highlight { animation: hl 1.6s ease 2; border-radius: 10px; }
@keyframes hl { 50% { box-shadow: 0 0 0 4px var(--lime); } }
.switch { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.switch input { width: 20px; height: 20px; }
.grid2 { display: flex; flex-wrap: wrap; gap: 10px; } .grid2 > * { flex: 1 1 160px; }
.checks-list { display: flex; flex-wrap: wrap; gap: 6px 14px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.checks-list label { display: flex; align-items: center; gap: 6px; min-height: 32px; }
.hours { border: 1px solid var(--line-strong); border-radius: 10px; padding: 6px 10px; display: flex; flex-direction: column; gap: 4px; }
.hours .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 36px; }
.hours .row .day { width: 110px; display: flex; gap: 6px; align-items: center; }
.hours input[type="time"] { min-height: 34px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 6px; background: var(--surface); }
.icon-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-pick button { width: 46px; height: 46px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--green-dark); }
.icon-pick button.on { border: 2px solid var(--green); background: var(--pale); }
.icon-pick svg.i { width: 26px; height: 26px; stroke-width: 1.7; }
.meta-line { font-size: 12px; color: var(--muted); }

/* ── notices, toasts, dialog ── */
.notice { display: flex; gap: 10px; align-items: flex-start; border-radius: 12px; padding: 10px 14px; border: 1px solid; }
.notice.warn { background: var(--cream); border-color: #E8D9A8; color: inherit; }
.notice.bad { background: rgba(198, 40, 40, .08); border-color: var(--bad); }
.notice.good { background: var(--pale); border-color: var(--good); }
.toasts { position: fixed; inset-block-end: 16px; inset-inline-start: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(520px, calc(100% - 24px)); }
[dir="rtl"] .toasts { transform: translateX(50%); }
.toast { background: var(--ink); color: var(--surface); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: center; }
.toast.bad { background: var(--bad); color: #fff; } .toast.good { background: var(--green); color: #fff; }
dialog { border: 0; border-radius: 16px; padding: 0; width: min(440px, calc(100% - 24px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(10, 20, 12, .45); }
dialog .d-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
dialog .d-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.code-box { background: var(--ink); color: var(--surface); border-radius: 14px; padding: 18px; text-align: center; }
.code-box .code { font-size: 44px; font-weight: 800; letter-spacing: 8px; font-variant-numeric: tabular-nums; direction: ltr; }
.loading { padding: 30px; text-align: center; color: var(--muted); }
.status-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.status-grid .card { flex: 1 1 260px; display: flex; flex-direction: column; gap: 8px; }
.check-item { display: flex; flex-direction: column; gap: 6px; }
.check-item .refs { display: flex; flex-wrap: wrap; gap: 6px; }
.check-item .refs a { cursor: pointer; text-decoration: underline; }
pre.json { white-space: pre-wrap; word-break: break-word; background: var(--surface-2); border-radius: 8px; padding: 8px; font-size: 12px; margin: 0; max-height: 220px; overflow: auto; }
.signin { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.signin .card { max-width: 420px; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }

/* ── drag-and-drop order (0.7.3) ── */
.ro-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 6px 0; }
.reorder { display: flex; flex-direction: column; gap: 6px; }
.ro-head { font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 8px; }
.ro-group { display: flex; flex-direction: column; gap: 6px; }
.ro-item { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px; box-shadow: var(--shadow); min-height: 48px; }
.ro-item.dragging { border: 2px solid var(--green); background: var(--pale); box-shadow: var(--shadow-lg); opacity: .95; }
.ro-item svg.i { color: var(--green); }
.ro-name { font-weight: 700; flex: 1; min-width: 0; }
.ro-ar { color: var(--muted); }
.ro-grip { width: 40px; height: 40px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-2); cursor: grab; display: inline-flex; align-items: center; justify-content: center; touch-action: none; color: var(--muted); }
.ro-grip:active { cursor: grabbing; }
.ro-grip svg.i { fill: currentColor; stroke: none; width: 22px; height: 22px; }
.ro-grip { color: var(--olive); }

/* ── CSV import (0.9.0) ── */
dialog.wide { width: min(900px, calc(100% - 24px)); max-height: calc(100vh - 40px); }
dialog.wide > div { display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
dialog.wide .d-body { overflow: auto; }
.imp-steps { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 6px; }
.linkish { background: none; border: 0; padding: 0; color: var(--green); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.imp-cols summary { cursor: pointer; font-weight: 700; }
.imp-cols > div { margin-top: 6px; }
.imp-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px 16px; border: 2px dashed var(--line-strong); border-radius: 14px; cursor: pointer; text-align: center; background: var(--surface-2); }
.imp-drop svg.i { width: 34px; height: 34px; color: var(--green); }
.imp-drop.over, .imp-drop:hover, .imp-drop:focus-visible { border-color: var(--green); background: var(--pale); outline: none; }
.imp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.imp-stat { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; }
.imp-stat strong { font-size: 24px; }
.imp-stat span { font-size: 13px; color: var(--muted); }
.imp-stat.good strong { color: var(--green); } .imp-stat.bad strong { color: #B42318; } .imp-stat.info strong { color: #1D5FA8; }
.imp-table { max-height: 46vh; overflow: auto; box-shadow: none; }
.imp-table tr.err td { background: rgba(180, 35, 24, .06); }
.imp-bar { height: 12px; border-radius: 6px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line); }
.imp-bar > div { height: 100%; width: 0; background: var(--green); transition: width .3s; }
.d-foot .grow { flex: 1; }
