/* Zehra's Atelier OS — black & gold theme derived from the Zehra's Abaya Collection logo.
   Every emerald accent from the Stitch designs is mapped onto the gold scale below. */
:root {
  --gold-50: #fbf7ec;
  --gold-100: #f6ecd0;
  --gold-200: #ecd79d;
  --gold-300: #dfbe6c;
  --gold-400: #d1a94e;
  --gold: #c39a3e;
  --gold-600: #a67f2b;
  --gold-700: #84641f;
  --gold-800: #5f4816;
  --gold-grad: linear-gradient(135deg, #f0d68a 0%, #d2a84c 38%, #b78a33 70%, #8f6a22 100%);
  --gold-grad-soft: linear-gradient(135deg, #fbf3dc 0%, #f3e3b5 100%);

  --ink: #0f0e0c;
  --ink-2: #1a1814;
  --ink-3: #26221c;
  --ink-4: #3a342b;

  --canvas: #f8f6f2;
  --card: #ffffff;
  --line: #e8e3d9;
  --line-2: #f0ece4;
  --text: #1f1b16;
  --muted: #6f675c;
  --muted-2: #9a9184;

  --ok-bg: #fbf3dc; --ok: #7a5a12;
  --warn-bg: #fff3e6; --warn: #c2570c;
  --bad-bg: #fef2f2; --bad: #b91c1c;
  --info-bg: #eef1fb; --info: #3949ab;
  --violet-bg: #f4effe; --violet: #6d3fc0;

  --r: 12px;
  --r-sm: 8px;
  --sh-1: 0 1px 3px rgba(131, 100, 31, .05), 0 4px 12px rgba(31, 27, 22, .03);
  --sh-2: 0 4px 6px -1px rgba(131, 100, 31, .07), 0 10px 24px -3px rgba(31, 27, 22, .06);
  --sh-3: 0 10px 15px -3px rgba(131, 100, 31, .08), 0 20px 30px -4px rgba(31, 27, 22, .08);
  --sh-4: 0 25px 50px -12px rgba(15, 14, 12, .35);

  --f-display: 'Epilogue', 'Segoe UI', system-ui, sans-serif;
  --f-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --f-brand: 'Cinzel', 'Times New Roman', serif;
  --sidebar-w: 256px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--f-body);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'tnum' 1, 'cv11' 1;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--gold-700); text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--f-display); margin: 0; font-weight: 600; letter-spacing: -.01em; }
::selection { background: var(--gold-200); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d9d1c2; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #c7bba6; background-clip: padding-box; border: 2px solid transparent; }

.ms { font-family: 'Material Symbols Outlined'; font-weight: normal; font-style: normal; font-size: 20px; line-height: 1; display: inline-block; white-space: nowrap; direction: ltr; -webkit-font-smoothing: antialiased; font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; vertical-align: middle; }
.ms.fill { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
.ms.sm { font-size: 16px; } .ms.lg { font-size: 26px; } .ms.xl { font-size: 36px; }

/* ---------- Brand ---------- */
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  background: #000 url('../assets/logo.png') center 30% / 175% no-repeat;
  border: 1px solid rgba(210, 168, 76, .45);
  box-shadow: 0 0 0 3px rgba(210, 168, 76, .08);
}
.brand-name { font-family: var(--f-brand); font-weight: 600; letter-spacing: .12em; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sub { font-size: 10px; letter-spacing: .28em; text-transform: uppercase; color: var(--gold-300); }
.gold-text { background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Shell ---------- */
#app { height: 100%; }
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; transition: grid-template-columns .2s ease; }
.shell.collapsed { grid-template-columns: 76px 1fr; }
.sidebar {
  background: var(--ink) url('../assets/arabesque.png') center / cover;
  background-blend-mode: luminosity;
  position: relative; display: flex; flex-direction: column; min-height: 0; color: #e9e1d0;
}
.sidebar::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(15,14,12,.94), rgba(15,14,12,.985)); pointer-events: none; }
.sidebar > * { position: relative; }
.sb-brand { display: flex; gap: 12px; align-items: center; padding: 22px 20px 18px; }
.sb-brand .brand-name { font-size: 19px; line-height: 1.1; }
.sb-pos { margin: 6px 16px 14px; }
.sb-nav { flex: 1; overflow-y: auto; padding: 4px 12px; display: flex; flex-direction: column; gap: 2px; }
.sb-nav::-webkit-scrollbar-thumb { background: #3a342b; }
.sb-section { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: #8b8170; padding: 14px 12px 6px; }
.sb-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer;
  color: #cfc5b2; border: 1px solid transparent; position: relative; user-select: none; font-weight: 500;
}
.sb-item:hover { background: rgba(210, 168, 76, .08); color: #f3e7c8; }
.sb-item.active { background: linear-gradient(90deg, rgba(210,168,76,.22), rgba(210,168,76,.06)); color: var(--gold-200); border-color: rgba(210,168,76,.3); }
.sb-item.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold-grad); }
.sb-item .ms { color: var(--gold-400); }
.sb-item .badge { margin-left: auto; }
.sb-foot { padding: 12px 16px 16px; border-top: 1px solid rgba(210,168,76,.14); display: flex; flex-direction: column; gap: 8px; }
.sb-status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #b3a891; background: rgba(255,255,255,.04); border: 1px solid rgba(210,168,76,.14); padding: 8px 10px; border-radius: 10px; }
.sb-collapse { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #8b8170; cursor: pointer; padding: 4px 8px; background: none; border: 0; }
.sb-collapse:hover { color: var(--gold-300); }
.shell.collapsed .sb-label, .shell.collapsed .sb-brand > div, .shell.collapsed .sb-section, .shell.collapsed .sb-item .badge, .shell.collapsed .sb-status span:not(.dot), .shell.collapsed .sb-collapse span:last-child, .shell.collapsed .sb-pos .btn-label, .shell.collapsed .sb-pos kbd { display: none; }
.shell.collapsed .sb-item { justify-content: center; }
.shell.collapsed .sb-brand { justify-content: center; padding-inline: 0; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  height: 68px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: rgba(255,255,255,.86); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.top-search { flex: 1; max-width: 420px; position: relative; }
.top-search input { width: 100%; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--canvas); padding: 0 56px 0 40px; outline: none; }
.top-search input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(195,154,62,.15); background: #fff; }
.top-search > .ms { position: absolute; left: 12px; top: 10px; color: var(--muted); }
.top-search kbd { position: absolute; right: 10px; top: 10px; }
.search-pop { position: absolute; top: 46px; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh-3); z-index: 40; max-height: 420px; overflow: auto; padding: 6px; }
.search-pop .sr { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.search-pop .sr:hover, .search-pop .sr.hl { background: var(--gold-50); }
.search-pop .sr-group { font-size: 10px; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; padding: 8px 10px 4px; }
.top-spacer { flex: 1; }
.chip-shift { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px; background: var(--gold-50); border: 1px solid var(--gold-100); font-size: 12px; color: var(--gold-800); font-weight: 500; white-space: nowrap; }
.branch-pick { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px 0 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; }
.branch-pick select { border: 0; outline: none; background: transparent; font-weight: 600; max-width: 220px; cursor: pointer; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; border: 1px solid var(--line); background: #fff; cursor: pointer; position: relative; color: var(--text); }
.icon-btn:hover { border-color: var(--gold-300); background: var(--gold-50); }
.icon-btn .dot { position: absolute; top: 7px; right: 8px; }
.user-chip { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 6px 4px 4px; border-radius: 12px; position: relative; }
.user-chip:hover { background: var(--canvas); }
.user-chip .u-name { font-weight: 600; font-size: 13px; line-height: 1.2; }
.user-chip .u-role { font-size: 11px; color: var(--gold-700); }

.content { flex: 1; overflow: auto; padding: 28px 32px 48px; }
.content.flush { padding: 0; overflow: hidden; }

/* ---------- Page header ---------- */
.crumbs { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.crumbs b { color: var(--gold-700); font-weight: 600; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.page-head h1 { font-size: 30px; line-height: 1.15; letter-spacing: -.02em; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 640px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 16px;
  border-radius: var(--r); border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 600;
  white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s, transform .05s; color: var(--text);
}
.btn:hover { border-color: var(--gold-400); background: var(--canvas); }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--ink); color: var(--gold-200); border-color: var(--ink); }
.btn.primary .ms { color: var(--gold-300); }
.btn.primary:hover { background: var(--ink-3); color: var(--gold-100); }
.btn.gold { background: var(--gold-grad); color: #1a1408; border-color: #b78a33; box-shadow: 0 2px 8px rgba(183,138,51,.3); }
.btn.gold:hover { filter: brightness(1.05); }
.btn.danger { background: var(--bad-bg); color: var(--bad); border-color: #fca5a5; }
.btn.danger:hover { background: #fee2e2; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--gold-50); }
.btn.sm { height: 32px; padding: 0 10px; font-size: 12px; border-radius: 9px; gap: 6px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: 11px; border-radius: 7px; gap: 4px; }
.btn.lg { height: 52px; padding: 0 22px; font-size: 15px; }
.btn.block { width: 100%; }
.btn.icon { width: 42px; padding: 0; }
.btn.sm.icon { width: 32px; }
kbd { font-family: var(--f-body); font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 6px; background: rgba(0,0,0,.06); border: 1px solid rgba(0,0,0,.08); color: var(--muted); }
.btn.primary kbd, .sidebar kbd { background: rgba(210,168,76,.15); border-color: rgba(210,168,76,.3); color: var(--gold-200); }

/* ---------- Form ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .lbl { font-size: 12px; font-weight: 600; color: var(--text); }
.field .hint { font-size: 11px; color: var(--muted); }
.input, .select, .textarea {
  height: 42px; border-radius: var(--r); border: 1px solid var(--line); background: #fff; padding: 0 12px; outline: none; width: 100%;
}
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(195,154,62,.15); }
.input.sm, .select.sm { height: 34px; border-radius: 9px; font-size: 13px; }
.select { appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236f675c' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 12px center no-repeat; padding-right: 32px; }
.input-icon { position: relative; }
.input-icon > .ms { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 40px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
input[type=checkbox], input[type=radio] { accent-color: var(--gold-600); width: 16px; height: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form-section { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-700); padding-bottom: 8px; border-bottom: 1px solid var(--line); margin: 6px 0 2px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.stepper button { width: 30px; height: 32px; border: 0; background: transparent; cursor: pointer; font-size: 16px; color: var(--muted); }
.stepper button:hover { background: var(--gold-50); color: var(--gold-700); }
.stepper input { width: 44px; height: 32px; border: 0; text-align: center; outline: none; font-weight: 600; }

/* ---------- Cards & tiles ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-1); }
.card.pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line-2); }
.card-head h3 { font-size: 17px; display: flex; align-items: center; gap: 10px; }
.card-head .sub { color: var(--muted); font-size: 12px; }
.card-body { padding: 18px 22px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; margin-bottom: 24px; }
.stat { position: relative; overflow: hidden; padding: 20px 22px; }
.stat::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent, var(--gold-grad)); }
.stat .s-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.stat .s-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.stat .s-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--gold-50); color: var(--gold-700); flex: none; }
.stat .s-val { font-family: var(--f-display); font-size: 30px; font-weight: 600; letter-spacing: -.02em; margin: 10px 0 2px; line-height: 1.1; }
.stat .s-val small { font-size: 14px; color: var(--muted); font-family: var(--f-body); font-weight: 500; letter-spacing: 0; }
.stat .s-foot { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-2); font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.stat.warn { --accent: #f59e0b; } .stat.bad { --accent: #ef4444; } .stat.info { --accent: #4f63d2; } .stat.violet { --accent: #8b5cf6; } .stat.ink { --accent: var(--ink); }
.stat.dark { background: var(--ink) url('../assets/arabesque.png') center/cover; background-blend-mode: luminosity; color: #f3e7c8; border-color: #000; }
.stat.dark::after { content: ''; position: absolute; inset: 0; background: rgba(15,14,12,.9); }
.stat.dark > * { position: relative; z-index: 1; }
.stat.dark .s-label { color: var(--gold-300); }
.stat.dark .s-ico { background: rgba(210,168,76,.15); color: var(--gold-300); }
.stat.dark .s-foot { border-color: rgba(210,168,76,.2); color: #b3a891; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; background: #f3f1ec; color: #4b443a; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.violet { background: var(--violet-bg); color: var(--violet); }
.badge.dark { background: var(--ink); color: var(--gold-200); }
.badge.gold { background: var(--gold-grad); color: #1a1408; }
.badge.plain { text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 11px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); display: inline-block; flex: none; }
.dot.ok { background: var(--gold); box-shadow: 0 0 0 3px rgba(195,154,62,.2); }
.dot.warn { background: #f59e0b; } .dot.bad { background: #ef4444; } .dot.info { background: #4f63d2; } .dot.off { background: #b9b0a2; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 7px; background: #f3f1ec; color: #4b443a; font-size: 11px; font-weight: 600; white-space: nowrap; }
.swatch { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0,0,0,.12); display: inline-block; flex: none; }

/* ---------- Tabs & filter pills ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab { padding: 12px 16px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; gap: 8px; align-items: center; white-space: nowrap; background: none; border-top: 0; border-left: 0; border-right: 0; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--ink); border-bottom-color: var(--gold); }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; font-size: 13px; white-space: nowrap; }
.pill .n { font-size: 11px; background: var(--canvas); padding: 1px 7px; border-radius: 999px; color: var(--muted); }
.pill:hover { border-color: var(--gold-300); }
.pill.active { background: var(--ink); color: var(--gold-200); border-color: var(--ink); }
.pill.active .n { background: rgba(210,168,76,.2); color: var(--gold-200); }
.seg { display: inline-flex; background: var(--canvas); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; height: 34px; padding: 0 12px; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--muted); font-size: 13px; }
.seg button.active { background: #fff; color: var(--ink); box-shadow: var(--sh-1); }

/* ---------- Tables ---------- */
.table-wrap { overflow: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th { position: sticky; top: 0; z-index: 1; background: #faf8f4; text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr:hover td { background: #fcfaf5; }
.tbl tr.click { cursor: pointer; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.num { font-weight: 500; }
.tbl tfoot td { font-weight: 700; background: #faf8f4; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .ms { font-size: 40px; color: var(--gold-300); display: block; margin: 0 auto 10px; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person .p-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .p-sub { font-size: 12px; color: var(--muted); }
.avatar { width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--gold-grad-soft); color: var(--gold-800); border: 1px solid var(--gold-200); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 64px; height: 64px; font-size: 20px; }
.avatar.xl { width: 96px; height: 96px; font-size: 30px; }
.thumb { width: 44px; height: 52px; border-radius: 8px; flex: none; overflow: hidden; display: grid; place-items: center; background: var(--gold-grad-soft); color: var(--gold-700); border: 1px solid rgba(31,27,22,.08); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.mono { font-family: 'Consolas', 'Cascadia Mono', monospace; font-size: 12px; letter-spacing: .02em; }
.muted { color: var(--muted); } .small { font-size: 12px; } .tiny { font-size: 11px; }
.strong { font-weight: 700; } .right { text-align: right; } .center { text-align: center; }
.c-gold { color: var(--gold-700); } .c-bad { color: var(--bad); } .c-warn { color: var(--warn); } .c-info { color: var(--info); }

/* ---------- Layout helpers ---------- */
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; } .row.top { align-items: flex-start; } .row.end { justify-content: flex-end; }
.col { display: flex; flex-direction: column; gap: 12px; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.grow { flex: 1; min-width: 0; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.layout-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr); gap: 20px; align-items: start; }
.layout-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; align-items: start; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line-2); }
.filters .input-icon { flex: 1; min-width: 240px; }
.filters .select { width: auto; min-width: 160px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.kv span:first-child { color: var(--muted); }
.progress { height: 7px; border-radius: 99px; background: #efe9dd; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: var(--gold-grad); }
.progress.warn > i { background: #f59e0b; } .progress.bad > i { background: #ef4444; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.list-item:last-child { border-bottom: 0; }

/* ---------- Overlays ---------- */
.veil { position: fixed; inset: 0; background: rgba(15,14,12,.45); backdrop-filter: blur(4px); z-index: 100; display: flex; animation: fade .15s ease; }
.drawer { margin-left: auto; width: min(620px, 94vw); height: 100%; background: #fff; display: flex; flex-direction: column; box-shadow: var(--sh-4); animation: slideIn .2s ease; }
.drawer.wide { width: min(860px, 96vw); }
.drawer-head { padding: 22px 26px; background: #faf8f4; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.drawer-head h2 { font-size: 21px; display: flex; gap: 10px; align-items: center; }
.drawer-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.drawer-body { flex: 1; overflow: auto; padding: 22px 26px; display: flex; flex-direction: column; gap: 16px; }
.drawer-foot { padding: 16px 26px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: #fff; }
.modal { margin: auto; width: min(520px, 94vw); max-height: 92vh; background: #fff; border-radius: 16px; display: flex; flex-direction: column; box-shadow: var(--sh-4); animation: pop .16s ease; overflow: hidden; }
.modal.wide { width: min(920px, 96vw); }
.modal .drawer-head { background: #fff; }
.x-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.x-btn:hover { background: var(--canvas); }
@keyframes fade { from { opacity: 0; } }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }

.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { min-width: 280px; max-width: 420px; background: var(--ink); color: #f3e7c8; border: 1px solid rgba(210,168,76,.35); border-radius: 12px; padding: 12px 14px; display: flex; gap: 10px; align-items: center; box-shadow: var(--sh-4); animation: slideIn .2s ease; }
.toast .ms { color: var(--gold-300); }
.toast.bad .ms { color: #f87171; }

.menu { position: absolute; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh-3); padding: 6px; z-index: 60; min-width: 200px; }
.menu button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 9px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--gold-50); }
.menu hr { border: 0; border-top: 1px solid var(--line-2); margin: 4px 0; }

/* ---------- Login ---------- */
.login { display: grid; grid-template-columns: 1fr 1fr; height: 100vh; }
.login-hero { position: relative; overflow: hidden; background: #000; color: #f3e7c8; display: flex; flex-direction: column; justify-content: space-between; padding: 44px; }
.login-hero::before { content: ''; position: absolute; inset: 0; background: url('../assets/arabesque.png') center/cover; opacity: .18; filter: sepia(1) saturate(.6); }
.login-hero::after { content: ''; position: absolute; inset: 26px; border: 1px solid rgba(210,168,76,.35); border-radius: 18px; pointer-events: none; }
.login-hero > * { position: relative; z-index: 1; }
.login-logo { width: min(420px, 80%); aspect-ratio: 1; margin: 0 auto; background: url('../assets/logo.png') center/cover; border-radius: 20px; box-shadow: 0 30px 80px rgba(210,168,76,.12); -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 58%, transparent 72%); }
.login-hero blockquote { margin: 0; font-family: var(--f-display); font-size: 30px; line-height: 1.2; font-weight: 600; }
.login-hero blockquote em { font-style: italic; font-weight: 400; }
.login-form { display: flex; flex-direction: column; justify-content: center; padding: 48px max(48px, 8vw); background: #fff; overflow: auto; }
.login-form h1 { font-size: 32px; margin: 10px 0 6px; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pinpad button { height: 58px; border-radius: 14px; border: 1px solid var(--line); background: #fff; font-size: 20px; font-weight: 600; cursor: pointer; }
.pinpad button:hover { background: var(--gold-50); border-color: var(--gold-300); }
.pin-dots { display: flex; gap: 14px; justify-content: center; margin: 14px 0 20px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--gold-400); }
.pin-dots i.on { background: var(--gold-grad); border-color: var(--gold-600); }

/* ---------- POS ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 400px; height: 100%; }
.pos-left { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 16px 20px; gap: 12px; }
.pos-keys { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); }
.pos-keys span { display: inline-flex; gap: 6px; align-items: center; }
.scanbar { display: flex; align-items: center; gap: 12px; border: 2px solid var(--ink); border-radius: 14px; background: #fff; padding: 6px 6px 6px 16px; position: relative; }
.scanbar input { flex: 1; border: 0; outline: none; font-size: 20px; height: 48px; letter-spacing: .02em; }
.scanbar:focus-within { box-shadow: 0 0 0 4px rgba(195,154,62,.2); border-color: var(--gold-600); }
.scan-flash { background: var(--gold-50); border: 1px solid var(--gold-200); border-radius: 10px; padding: 9px 14px; display: flex; gap: 10px; align-items: center; font-size: 13px; white-space: nowrap; overflow: hidden; }
.scan-flash .grow { overflow: hidden; text-overflow: ellipsis; }
.pos-cart .table-wrap { min-height: 180px; }
.pos-qcat { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
.pos-qcat::-webkit-scrollbar { height: 4px; }
.pos-cart { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pos-cart .table-wrap { flex: 1; }
.speed { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; padding: 12px 16px 16px; border-top: 1px solid var(--line); max-height: 180px; overflow: auto; }
.speed-tile { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; cursor: pointer; background: #fff; text-align: left; }
.speed-tile:hover { border-color: var(--gold-400); background: var(--gold-50); }
.pos-right { background: #fff; border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.pos-right .scroll { flex: 1; overflow: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.grand { background: var(--ink) url('../assets/arabesque.png') center/cover; background-blend-mode: luminosity; border-radius: 14px; padding: 16px 18px; color: #f3e7c8; position: relative; overflow: hidden; }
.grand::before { content: ''; position: absolute; inset: 0; background: rgba(15,14,12,.88); }
.grand > * { position: relative; }
.grand .g-label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-300); font-weight: 600; }
.grand .g-val { font-family: var(--f-display); font-size: 36px; font-weight: 600; letter-spacing: -.02em; }
.tender { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tender button { border: 1px solid var(--line); background: #fff; border-radius: 12px; height: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; font-size: 12px; font-weight: 600; }
.tender button.active { background: var(--ink); color: var(--gold-200); border-color: var(--ink); }
.tender button.active .ms { color: var(--gold-300); }
.quick-cash { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.quick-cash button { height: 38px; border-radius: 9px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; font-size: 12px; }
.quick-cash button:hover { border-color: var(--gold-400); }
.pos-foot { padding: 12px 18px 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.pos-foot .mini { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.cust-card { border: 1px solid var(--gold-200); background: var(--gold-50); border-radius: 12px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; }
.sum-line { display: flex; justify-content: space-between; font-size: 14px; }
.sum-line.disc { color: var(--bad); }

/* ---------- Kiosk ---------- */
.kiosk { position: fixed; inset: 0; z-index: 90; background: #0b0a08 url('../assets/arabesque.png') center/cover; background-blend-mode: luminosity; color: #f3e7c8; display: flex; flex-direction: column; }
.kiosk::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at top, rgba(30,26,18,.86), rgba(8,7,6,.97) 70%); }
.kiosk > * { position: relative; }
.k-top { display: flex; align-items: center; justify-content: space-between; padding: 22px 36px; border-bottom: 1px solid rgba(210,168,76,.16); }
.k-clock { font-family: var(--f-display); font-size: 30px; font-weight: 600; letter-spacing: -.01em; }
.k-body { flex: 1; overflow: auto; padding: 32px 36px; display: flex; flex-direction: column; align-items: center; }
.k-card { background: rgba(255,255,255,.04); border: 1px solid rgba(210,168,76,.2); border-radius: 18px; padding: 22px; }
.k-staff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; width: 100%; max-width: 1200px; }
.k-staff { background: rgba(255,255,255,.04); border: 1px solid rgba(210,168,76,.18); border-radius: 16px; padding: 18px 12px; text-align: center; cursor: pointer; color: inherit; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.k-staff:hover { border-color: var(--gold-400); background: rgba(210,168,76,.08); }
.k-staff .avatar { width: 72px; height: 72px; font-size: 22px; }
.kiosk .input { background: rgba(255,255,255,.06); border-color: rgba(210,168,76,.25); color: #f3e7c8; }
.kiosk .pinpad button { background: rgba(255,255,255,.05); border-color: rgba(210,168,76,.22); color: #f3e7c8; }
.kiosk .pinpad button:hover { background: rgba(210,168,76,.12); }
.kiosk .btn:not(.gold):not(.primary) { background: rgba(255,255,255,.05); border-color: rgba(210,168,76,.25); color: #f3e7c8; }
.kiosk .muted { color: #a99d87; }
.punch { width: 240px; height: 240px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; text-align: center; color: #1a1408; background: var(--gold-grad); box-shadow: 0 0 0 18px rgba(210,168,76,.08), 0 0 0 36px rgba(210,168,76,.04), 0 20px 60px rgba(210,168,76,.25); position: relative; transition: transform .12s; }
.punch:hover { transform: scale(1.02); }
.punch::after { content: ''; position: absolute; inset: 12px; border-radius: 50%; border: 1px solid rgba(26,20,8,.35); }
.punch.out { background: linear-gradient(135deg, #2b2620, #0f0e0c); color: var(--gold-200); border: 1px solid var(--gold-600); }
.punch.out::after { border-color: rgba(210,168,76,.4); }
.punch .p-big { font-family: var(--f-display); font-size: 28px; font-weight: 700; letter-spacing: .04em; }
.cam-box { position: relative; width: 520px; max-width: 100%; aspect-ratio: 4/3; border-radius: 20px; overflow: hidden; background: #000; border: 1px solid rgba(210,168,76,.3); }
.cam-box video, .cam-box img { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.cam-box img { transform: none; }
.cam-oval { position: absolute; left: 50%; top: 50%; width: 46%; height: 72%; transform: translate(-50%, -50%); border: 2px dashed rgba(240,214,138,.8); border-radius: 50%; pointer-events: none; }
.cam-oval::after { content: ''; position: absolute; left: -10%; right: -10%; height: 2px; top: 50%; background: linear-gradient(90deg, transparent, var(--gold-200), transparent); animation: scan 2.4s ease-in-out infinite; }
@keyframes scan { 0%, 100% { top: 15%; } 50% { top: 85%; } }
.k-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.k-tabs button { height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid rgba(210,168,76,.25); background: transparent; color: #d8ccb3; cursor: pointer; font-weight: 600; }
.k-tabs button.active { background: var(--gold-grad); color: #1a1408; border-color: transparent; }
.success-ring { width: 120px; height: 120px; border-radius: 50%; background: var(--gold-grad); display: grid; place-items: center; color: #1a1408; box-shadow: 0 0 0 14px rgba(210,168,76,.1); animation: pop .3s ease; }

/* ---------- Attendance grid ---------- */
.reg { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.reg th, .reg td { padding: 0; border-bottom: 1px solid var(--line-2); text-align: center; }
.reg th { position: sticky; top: 0; background: #faf8f4; z-index: 2; font-size: 10px; color: var(--muted); padding: 8px 0; min-width: 30px; }
.reg th.we { color: var(--gold-700); }
.reg td.name, .reg th.name { position: sticky; left: 0; background: #fff; z-index: 3; text-align: left; padding: 8px 12px; min-width: 210px; border-right: 1px solid var(--line); }
.reg th.name { background: #faf8f4; z-index: 4; }
.reg .cell { width: 26px; height: 26px; margin: 4px auto; border-radius: 7px; display: grid; place-items: center; font-weight: 700; font-size: 10px; cursor: default; }
.cell.P { background: var(--ok-bg); color: var(--ok); }
.cell.L { background: var(--warn-bg); color: var(--warn); }
.cell.A { background: var(--bad-bg); color: var(--bad); }
.cell.LV { background: var(--info-bg); color: var(--info); }
.cell.H { background: var(--violet-bg); color: var(--violet); }
.cell.W { background: #f3f1ec; color: var(--muted-2); }
.cell.F { color: #d9d2c4; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); align-items: center; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend .cell { width: 20px; height: 20px; margin: 0; font-size: 9px; border-radius: 5px; display: grid; place-items: center; font-weight: 700; }

/* ---------- Charts ---------- */
.chart { width: 100%; display: block; }
.chart text { font-family: var(--f-body); font-size: 10px; fill: var(--muted); }
.hbar { display: grid; grid-template-columns: 120px 1fr 90px; gap: 10px; align-items: center; padding: 6px 0; font-size: 13px; }

/* ---------- Labels / print ---------- */
.label-sheet { display: grid; grid-template-columns: repeat(auto-fill, 50mm); gap: 4mm; }
.label { width: 50mm; height: 30mm; border: 1px dashed #cfc7b8; border-radius: 4px; padding: 2mm 3mm; display: flex; flex-direction: column; align-items: center; justify-content: space-between; background: #fff; overflow: hidden; color: #000; }
.label .l-brand { font-family: var(--f-brand); font-size: 7pt; letter-spacing: .14em; font-weight: 700; }
.label .l-name { font-size: 6.5pt; font-weight: 600; text-align: center; line-height: 1.1; max-height: 2.2em; overflow: hidden; }
.label .l-meta { font-size: 6pt; display: flex; justify-content: space-between; width: 100%; }
.label svg { width: 100%; height: 9mm; }
.label .l-price { font-size: 9pt; font-weight: 800; }

.receipt { background: #fff; color: #000; font-family: 'Consolas', 'Cascadia Mono', monospace; font-size: 12px; }
.receipt.thermal { width: 76mm; padding: 4mm; margin: 0 auto; }
.receipt.a4 { width: 190mm; padding: 10mm; font-family: var(--f-body); margin: 0 auto; }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt td, .receipt th { padding: 2px 0; vertical-align: top; }
.receipt.a4 td, .receipt.a4 th { padding: 6px 4px; border-bottom: 1px solid #e5e5e5; text-align: left; }
.receipt .rc { text-align: center; }
.receipt .rr { text-align: right; }
.receipt hr { border: 0; border-top: 1px dashed #000; margin: 6px 0; }
.receipt.a4 hr { border-top: 1px solid #ddd; }
.receipt .r-logo { width: 34mm; height: 34mm; margin: 0 auto; background: url('../assets/logo.png') center/cover; border-radius: 4px; filter: grayscale(1) contrast(1.3); }
.receipt.a4 .r-logo { width: 28mm; height: 28mm; margin: 0; filter: none; }
.preview-pane { background: #e9e5dd; padding: 20px; overflow: auto; border-radius: 12px; max-height: 64vh; }
.preview-pane .receipt { box-shadow: 0 4px 18px rgba(0,0,0,.12); }

#print-area { display: none; }
@media print {
  body.printing #app, body.printing .veil, body.printing .toasts, body.printing .kiosk { display: none !important; }
  body.printing #print-area { display: block; }
  body.printing { background: #fff; }
  .label { border: 0; }
}

@media (max-width: 1360px) {
  .layout-3 { grid-template-columns: 1fr 1fr !important; }
  .layout-3 > :nth-child(2) { grid-column: span 2; order: -1; }
}
@media (max-width: 1100px) {
  .layout-3 { grid-template-columns: 1fr !important; }
  .layout-3 > :nth-child(2) { grid-column: auto; }
}
@media (max-width: 1280px) {
  .layout-2 { grid-template-columns: 1fr; }
  .pos { grid-template-columns: minmax(0, 1fr) 360px; }
  .chip-shift { display: none; }
}

/* Flex columns that scroll must not squash their children. */
.pos-right .scroll > *, .drawer-body > *, .k-body > * { flex-shrink: 0; }
.scanbar input { min-width: 0; }
@media (max-width: 1280px) {
  .scanbar .btn.lg { height: 42px; padding: 0 12px; font-size: 13px; }
  .grand .g-val { font-size: 30px; }
}
.receipt.thermal td.rr { white-space: nowrap; padding-left: 6px; }
.receipt.thermal { font-size: 11.5px; }
.kiosk select option, .kiosk .select option { color: #1f1b16; background: #fff; }
.tbl td.mono { white-space: nowrap; }
.c-ok { color: var(--ok); }
