/* =========================================================
   TimeClick — design system
   ========================================================= */
:root {
  color-scheme: light;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --ink: #1e2633;
  --ink-2: #3b4658;
  --muted: #677386;
  --faint: #7b8798;
  --line: #e3e8ef;
  --line-2: #edf1f5;
  --field: #ffffff;
  --field-line: #d3dae4;
  --hover: #f5f8fb;

  --brand: #3a66d4;
  --brand-600: #2f55b8;
  --brand-700: #264699;
  --brand-50: #eef3fc;
  --brand-100: #dbe5f8;
  --gold: #98a2b3;

  --ok: #1f8a4c;     --ok-bg: #eaf6ef;
  --warn: #a8620b;   --warn-bg: #fdf5e6;
  --bad: #c9403a;    --bad-bg: #fcefee;
  --info: #2a6f9e;   --info-bg: #ecf5fb;
  --grey-bg: #eff2f6;

  --side-bg: #18202d;
  --side-bg-2: #141b26;
  --side-ink: #c5cdd9;
  --side-muted: #718097;

  --r-sm: 8px;
  --r: 10px;
  --r-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(20, 30, 45, .05);
  --shadow: 0 1px 2px rgba(20, 30, 45, .04), 0 4px 16px rgba(20, 30, 45, .06);
  --shadow-lg: 0 12px 32px rgba(20, 30, 45, .16);
  --side-w: 256px;
  --top-h: 60px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14.5px/1.6 'Tajawal', system-ui, -apple-system, 'Segoe UI', sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-600); }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 15.5px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 700; }
p { margin: 0; }
code { background: var(--grey-bg); padding: 1px 6px; border-radius: 5px; font-size: 13px; }
.ic { width: 18px; height: 18px; flex: none; vertical-align: middle; }
[hidden] { display: none !important; }

/* ---------- utilities ---------- */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; direction: ltr; unicode-bidi: isolate; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.wrap-any { word-break: break-all; }
.center { text-align: center; }
.grow { flex: 1; }
.nowrap { white-space: nowrap; }
.bad-t { color: var(--bad); font-weight: 700; }
.warn-t { color: var(--warn); font-weight: 700; }
.ok-t { color: var(--ok); font-weight: 700; }
.row { display: flex; gap: 12px; align-items: flex-end; }
.row > label, .row > .field { flex: 1; min-width: 0; }
.row.between { justify-content: space-between; align-items: center; }
.row.center-y { align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row form { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.print-only { display: none; }

/* =========================================================
   Layout: sidebar + top bar + content
   ========================================================= */
.side { position: fixed; top: 0; bottom: 0; right: 0; width: var(--side-w); background: linear-gradient(180deg, var(--side-bg), var(--side-bg-2)); color: var(--side-ink); display: flex; flex-direction: column; z-index: 30; }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,.06); }
.side-brand b { display: block; color: #fff; font-size: 16px; line-height: 1.25; }
.side-brand small { color: var(--side-muted); font-size: 12px; }
.logo-mark { width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 19px; flex: none; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.side-nav { flex: 1; overflow-y: auto; padding: 10px 12px 20px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.side-label { font-size: 11.5px; color: var(--gold); font-weight: 700; margin: 18px 12px 6px; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--side-ink); font-size: 14px; margin-bottom: 2px; transition: background .12s, color .12s; }
.side-nav a .ic { color: var(--side-muted); transition: color .12s; }
.side-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-nav a:hover .ic { color: #fff; }
.side-nav a.on { background: #fff; color: var(--brand-700); font-weight: 700; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.side-nav a.on .ic { color: var(--brand); }

.topbar { position: sticky; top: 0; z-index: 20; height: var(--top-h); display: flex; align-items: center; gap: 12px; padding: 0 28px; background: rgba(255,255,255,.94); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--line); }
body.has-side .topbar, body.has-side main { margin-right: var(--side-w); }
.topbar .crumb { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; }
.topbar .crumb b { color: var(--ink); font-weight: 700; }
.topbar .crumb .ic { width: 14px; height: 14px; }
.topbar .today { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; }
.topbar .today .ic { width: 15px; height: 15px; }
.top-user { margin-right: auto; display: flex; align-items: center; gap: 6px; }
.top-user form { margin: 0; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 12px; border-radius: 999px; color: var(--ink); }
.user-chip:hover { background: var(--surface-2); color: var(--ink); }
.user-chip b { display: block; font-size: 13.5px; line-height: 1.2; }
.user-chip small { display: block; font-size: 12px; color: var(--muted); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; font-weight: 700; flex: none; font-size: 15px; box-shadow: inset 0 0 0 1px var(--brand-100); }
.avatar.sm { width: 32px; height: 32px; font-size: 13px; }
.menu-btn { display: none !important; }

main { padding: 26px 28px 64px; }
body:not(.has-side) main { padding: 0; }
.side-backdrop { display: none; }
@media (max-width: 1024px) {
  .side { transform: translateX(100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  body.side-open .side { transform: none; }
  body.side-open .side-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 25; }
  body.has-side .topbar, body.has-side main { margin-right: 0; }
  .topbar { padding: 0 12px; }
  .menu-btn { display: inline-grid !important; }
  .topbar .crumb, .topbar .today { display: none; }
  .user-chip .who { display: none; }
  main { padding: 18px 14px 48px; }
}

/* =========================================================
   Page header
   ========================================================= */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; font-size: 13.5px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--brand-50); color: var(--brand); border-radius: 999px; padding: 3px 12px; font-size: 13px; font-weight: 500; vertical-align: middle; }

/* =========================================================
   Cards & grids
   ========================================================= */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.card.flush { padding: 0; overflow: hidden; }
.card.narrow { max-width: 560px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card.flush > .card-head { padding: 15px 20px; margin: 0; border-bottom: 1px solid var(--line); }
.card-head h2 { display: flex; align-items: center; gap: 9px; }
.card-head h2 .ic { color: var(--brand); }
.card-head .sub { color: var(--muted); font-size: 13px; font-weight: 400; margin-top: 2px; }
.card-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card-foot { border-top: 1px solid var(--line); padding: 12px 20px; background: var(--surface-2); display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }
.grid2 > *, .grid3 > * { margin-bottom: 0; }
.layout-side { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 18px; align-items: start; }
.layout-side > * { margin-bottom: 0; }
.sticky-side { position: sticky; top: calc(var(--top-h) + 16px); }
@media (max-width: 1280px) { .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .layout-side { grid-template-columns: 1fr; } .sticky-side { position: static; } }
@media (max-width: 820px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.gap { height: 18px; }

/* =========================================================
   Stats
   ========================================================= */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; color: var(--ink); display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow-sm); transition: border-color .12s, box-shadow .12s, transform .12s; }
a.stat:hover { border-color: var(--brand-100); box-shadow: var(--shadow); transform: translateY(-1px); color: var(--ink); }
.stat-ico { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: var(--grey-bg); color: var(--ink-2); flex: none; }
.stat-ico .ic { width: 22px; height: 22px; }
.stat b { display: block; font-size: 26px; line-height: 1.15; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.ok .stat-ico { background: var(--ok-bg); color: var(--ok); }
.stat.warn .stat-ico { background: var(--warn-bg); color: var(--warn); }
.stat.bad .stat-ico { background: var(--bad-bg); color: var(--bad); }
.stat.info .stat-ico { background: var(--info-bg); color: var(--info); }
.stat.brand .stat-ico { background: var(--brand-50); color: var(--brand); }
.meter { height: 6px; background: var(--grey-bg); border-radius: 99px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }

/* =========================================================
   Tables
   ========================================================= */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th { text-align: right; font-weight: 700; color: var(--muted); font-size: 12.5px; background: var(--surface-2); border-bottom: 1px solid var(--line); padding: 10px 14px; white-space: nowrap; }
.tbl td { border-bottom: 1px solid var(--line-2); padding: 11px 14px; vertical-align: middle; }
.tbl tr:last-child > td { border-bottom: 0; }
.tbl tbody tr:hover > td { background: #f8fafc; }
.tbl.compact td, .tbl.compact th { padding: 8px 12px; }
.tbl td.actions, .tbl th.actions { text-align: left; width: 1%; white-space: nowrap; }
.tbl .dim td { opacity: .5; }
.tbl .strike td:first-child { text-decoration: line-through; }
.card:not(.flush) .tbl { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.name-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.name-cell b { font-weight: 700; color: var(--ink); }
a.name-cell:hover b { color: var(--brand); }
.name-cell small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .ic { width: 40px; height: 40px; color: var(--faint); margin-bottom: 8px; }
.empty b { display: block; color: var(--ink-2); margin-bottom: 2px; font-size: 15px; }

/* =========================================================
   Badges / chips
   ========================================================= */
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 1px 10px; font-size: 12px; font-weight: 500; background: var(--grey-bg); color: var(--ink-2); white-space: nowrap; line-height: 1.8; vertical-align: middle; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.badge.plain::before { display: none; }
.badge.ok, .badge.present { background: var(--ok-bg); color: var(--ok); }
.badge.warn, .badge.late, .badge.incomplete { background: var(--warn-bg); color: var(--warn); }
.badge.bad, .badge.absent { background: var(--bad-bg); color: var(--bad); }
.badge.info, .badge.in_progress, .badge.leave, .badge.off_work { background: var(--info-bg); color: var(--info); }
.badge.not_yet, .badge.weekend, .badge.holiday, .badge.future { background: var(--grey-bg); color: var(--muted); }
.chip { display: inline-block; border-radius: 7px; padding: 2px 10px; font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 500; }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.grey { background: var(--grey-bg); color: var(--ink-2); }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.led { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #cbd5e1; vertical-align: middle; flex: none; }
.led.on { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.18); }

/* =========================================================
   Alerts
   ========================================================= */
.flash { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: var(--r); margin-bottom: 16px; border: 1px solid transparent; font-size: 14px; }
.flash > .ic { margin-top: 2px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: #bbf7d0; }
.flash.err { background: var(--bad-bg); color: var(--bad); border-color: #f4cdc9; }
.flash.warn { background: var(--warn-bg); color: var(--warn); border-color: #f2dcb4; }
.flash.info { background: var(--info-bg); color: var(--info); border-color: #cfdef2; }
.flash a, .flash .link { color: inherit; text-decoration: underline; font-weight: 700; }
.flash.small { font-size: 13px; padding: 10px 12px; }

/* =========================================================
   Forms
   ========================================================= */
input, select, button, textarea { font: inherit; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  height: 40px; border: 1px solid #cbd5e1; border-radius: 10px; padding: 0 12px; background-color: #fff; color: var(--ink); min-width: 0; width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; padding: 10px 12px; }
select { padding-left: 32px; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236d7b74' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 10px center; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.14); }
input:disabled, select:disabled { background-color: var(--surface-2); color: var(--muted); }
input[type=checkbox], input[type=radio] { width: 17px; height: 17px; accent-color: var(--brand); vertical-align: middle; margin: 0; flex: none; }
input[type=search] { padding-right: 38px !important; 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='%2398a49e' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.stack label:not(.inline):not(.dev-item), .field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
label.inline { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); font-weight: 400; cursor: pointer; }
.hint { font-size: 12.5px; color: var(--muted); font-weight: 400; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } .row { flex-direction: column; align-items: stretch; } }

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters .field { min-width: 150px; flex: 1; }
.filters .field.grow2 { flex: 2; }
.filters .btns { display: flex; gap: 8px; }
.filters label.inline { height: 40px; }
.filter-title { display: flex; align-items: center; gap: 8px; color: var(--brand); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 16px; }
.chip-btn { border: 1px solid var(--line); border-radius: 999px; padding: 6px 15px; color: var(--ink-2); font-size: 13px; background: #fff; transition: all .12s; }
.chip-btn:hover { border-color: var(--brand); color: var(--brand); }
.chip-btn.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.filter-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.seg { display: inline-flex; background: var(--grey-bg); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 5px 16px; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 13px; }
.seg button.on { background: #fff; color: var(--ink); font-weight: 700; box-shadow: var(--shadow-sm); }

/* =========================================================
   Buttons
   ========================================================= */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid #cbd5e1; background: #fff; color: var(--ink); font-weight: 500; font-size: 14px; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, color .12s, box-shadow .12s; }
.btn .ic { width: 17px; height: 17px; }
.btn:hover { border-color: var(--field-line); background: var(--surface-2); color: var(--ink); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,.2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(37,99,235,.3); }
.btn.primary:hover { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn.soft { background: var(--brand-50); border-color: var(--brand-50); color: var(--brand); }
.btn.soft:hover { background: var(--brand-100); border-color: var(--brand-100); color: var(--brand-700); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--grey-bg); }
.btn.danger { color: var(--bad); border-color: #efc9c5; background: #fff; }
.btn.danger:hover { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 45%, transparent); color: var(--bad); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; gap: 6px; }
.btn.sm .ic { width: 15px; height: 15px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.act { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; transition: all .12s; position: relative; padding: 0; }
.act .ic { width: 16px; height: 16px; }
.act:hover { border-color: var(--brand-100); background: var(--brand-50); color: var(--brand); }
.act.danger:hover { border-color: #efc9c5; background: var(--bad-bg); color: var(--bad); }
.act[data-tip]:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%); background: #0f172a; color: #fff; font-size: 12px; font-weight: 500; padding: 4px 9px; border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 5; }
.acts { display: inline-flex; gap: 6px; align-items: center; }
.acts form { margin: 0; display: inline; }
.icon-btn { background: none; border: 1px solid transparent; border-radius: 9px; width: 38px; height: 38px; cursor: pointer; color: var(--muted); display: inline-grid; place-items: center; transition: all .12s; padding: 0; }
.icon-btn:hover { background: var(--grey-bg); color: var(--ink); }
.icon-btn.logout:hover { background: var(--bad-bg); color: var(--bad); }
.link { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; font-weight: 500; display: inline-flex; align-items: center; gap: 5px; font-size: inherit; }
.link:hover { color: var(--brand-600); text-decoration: underline; }
.link.danger { color: var(--bad); }
.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-group form { margin: 0; }
.save-bar { position: sticky; bottom: 0; z-index: 10; display: flex; gap: 10px; padding: 14px 0; margin-top: 4px; background: linear-gradient(to top, var(--bg) 70%, rgba(245,247,250,0)); }
.save-bar .btn { min-width: 170px; }

.dd { position: relative; display: inline-block; }
.dd > summary { list-style: none; }
.dd > summary::-webkit-details-marker { display: none; }
.dd-menu { position: absolute; left: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: var(--shadow-lg); z-index: 15; min-width: 230px; display: flex; flex-direction: column; gap: 2px; }
.dd-menu form { margin: 0; }
.dd-item, .dd-menu label { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border-radius: 8px; border: 0; background: none; color: var(--ink); font-size: 13.5px; cursor: pointer; text-align: right; white-space: nowrap; font-weight: 400; }
.dd-item:hover, .dd-menu label:hover { background: var(--surface-2); color: var(--ink); }
.dd-item .ic { color: var(--muted); width: 16px; height: 16px; }
.dd-item.danger, .dd-item.danger .ic { color: var(--bad); }
.dd-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* =========================================================
   Key-value, lists
   ========================================================= */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13.5px; }
.kv span { color: var(--muted); }
.kv b { font-weight: 500; color: var(--ink); }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; }
.kv-cell { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 12px; min-width: 0; }
.kv-cell span { display: block; color: var(--muted); font-size: 12px; }
.kv-cell b { display: block; font-size: 14.5px; font-weight: 700; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 20px; border-bottom: 1px solid var(--line-2); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { min-width: 0; }
.list-item b { font-weight: 500; }
.list-item small { display: block; color: var(--muted); font-size: 12px; }
.time-tag { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 1px 8px; font-size: 13px; direction: ltr; display: inline-block; }

/* =========================================================
   Components
   ========================================================= */
.dev-top { display: flex; align-items: center; gap: 12px; }
.dev-ico { width: 44px; height: 44px; border-radius: 12px; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; flex: none; }
.dev-ico.off { background: var(--grey-bg); color: var(--muted); }
.dev-ico.pending { background: var(--warn-bg); color: var(--warn); }
.dev-ico .ic { width: 22px; height: 22px; }
.dev-list { display: flex; flex-direction: column; gap: 8px; }
.dev-item { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; cursor: pointer; transition: all .12s; }
.dev-item:hover { border-color: var(--brand-100); }
.dev-item:has(input:checked) { background: var(--brand-50); border-color: var(--brand-100); }
.dev-item > span:not(.badge) { flex: 1; min-width: 0; }
.dev-item b { display: block; font-weight: 500; }
.dev-item small { color: var(--muted); font-size: 12px; }
fieldset.plain:disabled .dev-item { cursor: default; opacity: .75; }
.dev-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.dev-actions form { margin: 0; }

.bulk { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 20px; background: var(--brand-50); border-bottom: 1px solid var(--brand-100); }
.bulk select { width: auto; min-width: 190px; height: 36px; }

.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.perm-group { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.perm-group .perm-head { border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 2px; color: var(--brand); }
.perm-group label { font-size: 13.5px; }
.perm-group label.na { opacity: .45; }
.scope-box { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.scope-list { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.scope-box.all .scope-list { opacity: .4; pointer-events: none; }
.user-card.inactive { opacity: .7; }

.toolbar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.toolbar input[type=search] { width: 300px; max-width: 100%; }
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.detailed .sum-row { cursor: pointer; }
.detailed .chev .ic { width: 16px; height: 16px; color: var(--muted); transition: transform .15s; }
.detailed tbody.open .chev .ic { transform: rotate(-90deg); color: var(--brand); }
.detailed tbody.open .sum-row > td { background: var(--brand-50); }
.detailed .det-row { display: none; }
.detailed tbody.open .det-row, body.print-details .detailed .det-row { display: table-row; }
.detailed .det-row > td { background: var(--surface-2); padding: 8px 16px 16px; }
.tbl.inner { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; font-size: 13px; }
.round-btn { width: 32px; height: 32px; border: 1.5px solid var(--brand-100); border-radius: 50%; display: inline-grid; place-items: center; color: var(--brand); background: #fff; }
.round-btn .ic { width: 15px; height: 15px; }
.round-btn:hover { background: var(--brand-50); border-color: var(--brand); }

.days { display: flex; flex-wrap: wrap; gap: 6px; }
.day-pill { position: relative; cursor: pointer; }
.day-pill input { position: absolute; opacity: 0; pointer-events: none; }
.day-pill span { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 4px 13px; font-size: 13px; background: #fff; transition: all .12s; color: var(--ink-2); }
.day-pill input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.day-pill input:focus-visible + span { box-shadow: 0 0 0 3px rgba(37,99,235,.2); }
.day-pill input:disabled + span { opacity: .6; }

.shift-time { display: inline-flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; direction: ltr; }

.help summary { cursor: pointer; font-weight: 700; display: flex; align-items: center; gap: 8px; list-style: none; }
.help summary::-webkit-details-marker { display: none; }
.help summary .ic { color: var(--brand); }
.help ol { margin: 12px 0 6px; padding-inline-start: 22px; display: flex; flex-direction: column; gap: 4px; }
details > summary { cursor: pointer; }


/* =========================================================
   Print
   ========================================================= */
@media print {
  .no-print, .side, .topbar, .save-bar { display: none !important; }
  .print-only { display: block; }
  body { background: #fff; font-size: 11px; }
  body.has-side main { margin: 0; padding: 0; }
  .card { border: 0; padding: 0; box-shadow: none; }
  .card:not(.flush) .tbl { border: 0; }
  .tbl th { background: none; }
  .tbl td, .tbl th { padding: 3px 5px; }
  .chip, .badge { padding: 0; background: none !important; }
  .badge::before { display: none; }
  a { color: inherit; }
  .detailed .det-row > td { background: none; }
}
.act:disabled { opacity: .4; cursor: not-allowed; }
.act:disabled:hover { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px; gap: 10px; }
  .stat-ico { width: 38px; height: 38px; border-radius: 11px; }
  .stat-ico .ic { width: 19px; height: 19px; }
  .stat b { font-size: 21px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .card { padding: 16px; }
}

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 700; }
.tabs a .ic { width: 16px; height: 16px; }
.tbl tr[data-s] { cursor: default; }
#addForm tr[data-s] { cursor: pointer; }
.badge .ic { width: 13px; height: 13px; }

/* ---------- modal ---------- */
dialog.modal { border: 0; padding: 0; border-radius: 18px; width: min(560px, calc(100vw - 24px)); box-shadow: var(--shadow-lg); color: var(--ink); }
dialog.modal::backdrop { background: rgba(15, 23, 42, .5); backdrop-filter: blur(2px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { display: flex; align-items: center; gap: 9px; }
.modal-head h2 .ic { color: var(--brand); }
.modal-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - 200px); overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-start; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); }

/* row index column */
.tbl th.idx, .tbl td.idx { width: 44px; text-align: center; color: var(--faint); font-variant-numeric: tabular-nums; font-size: 12.5px; padding-left: 4px; padding-right: 4px; }

/* branch cards */
.branch-card { display: flex; flex-direction: column; gap: 14px; }
.branch-card .counts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.branch-card .counts a, .branch-card .counts div { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; color: var(--ink); }
.branch-card .counts a:hover { border-color: var(--brand-100); }
.branch-card .counts b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.branch-card .counts span { font-size: 12px; color: var(--muted); }

/* weekday mini-dots in tables */
.wk { display: inline-flex; gap: 3px; }
.wk i { font-style: normal; font-size: 11px; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; background: var(--grey-bg); color: var(--faint); }
.wk i.off { background: var(--brand); color: #fff; }

/* branch filter pills with counts */
.count-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.count-pills a { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding-block: 6px; padding-inline: 14px 8px; color: var(--ink-2); font-size: 13.5px; }
.count-pills a b { background: var(--grey-bg); border-radius: 999px; padding: 0 9px; font-size: 12.5px; min-width: 26px; text-align: center; }
.count-pills a:hover { border-color: var(--brand); color: var(--brand); }
.count-pills a.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.count-pills a.on b { background: rgba(255,255,255,.2); color: #fff; }

/* ---------- language switch + LTR (English) ---------- */
.lang-btn { display: inline-grid; place-items: center; min-width: 38px; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; font-weight: 700; font-size: 13px; color: var(--ink-2); background: #fff; }
.lang-btn:hover { border-color: var(--brand); color: var(--brand); }
[dir=ltr] body { font-family: 'Inter', 'Tajawal', system-ui, -apple-system, 'Segoe UI', sans-serif; }
[dir=ltr] .side { right: auto; left: 0; }
[dir=ltr] body.has-side .topbar, [dir=ltr] body.has-side main { margin-right: 0; margin-left: var(--side-w); }
[dir=ltr] .top-user { margin-right: 0; margin-left: auto; }
[dir=ltr] .user-chip { padding: 4px 12px 4px 6px; }
[dir=ltr] .tbl th { text-align: left; }
[dir=ltr] .tbl td.actions, [dir=ltr] .tbl th.actions { text-align: right; }
[dir=ltr] select { padding-left: 12px; padding-right: 32px; background-position: right 10px center; }
[dir=ltr] input[type=search] { padding-right: 12px !important; padding-left: 38px !important; background-position: left 12px center; }
[dir=ltr] .dd-menu { left: auto; right: 0; }
[dir=ltr] .dd-item, [dir=ltr] .dd-menu label { text-align: left; }
[dir=ltr] .kv b[dir=ltr] { text-align: left !important; }
[dir=ltr] .ic-dir { transform: scaleX(-1); }
[dir=ltr] .detailed tbody.open .chev .ic { transform: rotate(90deg); }
@media (max-width: 1024px) {
  [dir=ltr] .side { transform: translateX(-100%); }
  [dir=ltr] body.side-open .side { transform: none; }
  [dir=ltr] body.has-side .topbar, [dir=ltr] body.has-side main { margin-left: 0; }
}

/* product mark & copyright */
.logo-mark { font-family: 'Inter', system-ui, sans-serif; letter-spacing: -.5px; }
.side-foot { padding: 12px 20px 16px; font-size: 11.5px; color: var(--side-muted); border-top: 1px solid rgba(255,255,255,.07); text-align: center; }
.auth-form { grid-template-rows: 1fr auto; }
.auth-copy { text-align: center; font-size: 12px; color: var(--faint); margin-top: 18px; }

/* numbers that sit on their own line (employee no. under a name, serials, dates) follow the page direction */
[dir=rtl] small.num, [dir=rtl] div.num, [dir=rtl] p.num, [dir=rtl] b.num, [dir=rtl] .name-cell small { text-align: right; }
[dir=ltr] small.num, [dir=ltr] div.num, [dir=ltr] p.num, [dir=ltr] .name-cell small { text-align: left; }
.name-cell small.num { display: block; unicode-bidi: plaintext; }

/* ---------- pager ---------- */
.pg-hide { display: none !important; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-2); font-size: 13px; color: var(--muted); }
.pager-size { display: flex; align-items: center; gap: 8px; }
.pager-size select { width: auto; height: 32px; padding-top: 0; padding-bottom: 0; font-size: 13px; }
.pager-info { font-variant-numeric: tabular-nums; direction: ltr; }
.pager-nav { display: flex; align-items: center; gap: 4px; }
.pager-nav .act { width: 32px; height: 32px; }
.pager-nav .act:disabled { opacity: .35; cursor: default; }
.pager-num { min-width: 32px; height: 32px; border: 1px solid transparent; background: none; border-radius: 8px; cursor: pointer; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pager-num:hover { background: var(--grey-bg); }
.pager-num.on { background: var(--brand); color: #fff; font-weight: 700; }
.pager-gap { padding: 0 4px; }
@media print { .pg-hide { display: table-row !important; } tbody.pg-hide { display: table-row-group !important; } }

/* numeric cells line up under their (start-aligned) headers */
[dir=rtl] .tbl td.num { text-align: right; }
[dir=ltr] .tbl td.num { text-align: left; }
.tbl td .time-tag { min-width: 52px; text-align: center; }

/* language switch (next to the user chip) */
.lang-switch { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink-2); font-size: 13px; font-weight: 500; }
.lang-switch .ic { width: 16px; height: 16px; color: var(--brand); }
.lang-switch:hover { border-color: var(--brand); color: var(--brand); }
@media (max-width: 1024px) { .lang-switch span { display: none; } .lang-switch { padding: 0 10px; } }

/* =========================================================
   Auth pages v2
   ========================================================= */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-brand { padding: 44px 56px; background: linear-gradient(155deg, #1d4ed8 0%, #1e3a8a 55%, #172554 100%); }
.auth-brand::after { background-image: radial-gradient(rgba(255,255,255,.05) 1px, transparent 1px); background-size: 24px 24px; }
.auth-brand .logo-row b { font-size: 19px; letter-spacing: -.2px; font-family: 'Inter', 'Tajawal', sans-serif; }
.auth-hero { max-width: 480px; }
.auth-kicker { display: inline-block; font-size: 12.5px; font-weight: 700; color: var(--gold); letter-spacing: .3px; margin-bottom: 14px; }
.auth-brand h2 { font-size: 34px; line-height: 1.3; font-weight: 700; margin: 0; }
.auth-brand p { color: #bfdbfe; margin-top: 14px; font-size: 15.5px; line-height: 1.8; }
.auth-feats { list-style: none; margin: 34px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.auth-feats li { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid rgba(255,255,255,.09); border-radius: 14px; background: rgba(255,255,255,.035); }
.auth-feats li > span { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: rgba(255,255,255,.08); color: var(--gold); flex: none; }
.auth-feats li > span .ic { width: 20px; height: 20px; }
.auth-feats b { display: block; color: #fff; font-size: 14.5px; }
.auth-feats small { display: block; color: #93c5fd; font-size: 13px; margin-top: 2px; }
.auth-brand-foot { font-size: 12.5px; color: #64748b; }
.auth-form { display: flex; flex-direction: column; padding: 28px 40px; background: var(--surface); }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; }
.auth-top .auth-mobile-logo { display: none; }
[dir=rtl] .auth-top .lang-switch { margin-right: auto; }
[dir=ltr] .auth-top .lang-switch { margin-left: auto; }
.auth-box { flex: 1; width: 100%; max-width: 380px; margin: 0 auto; display: flex; flex-direction: column; justify-content: center; padding: 32px 0; background: none; border: 0; box-shadow: none; border-radius: 0; }
.auth-box h1 { font-size: 26px; font-weight: 700; }
.auth-box .sub { color: var(--muted); margin: 8px 0 28px; font-size: 14.5px; }
.auth-fields { gap: 18px; }
.auth-fields label { font-size: 13.5px; }
.input-ico { position: relative; display: block; }
.input-ico > .ic { position: absolute; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--faint); pointer-events: none; }
[dir=rtl] .input-ico > .ic { right: 14px; }
[dir=ltr] .input-ico > .ic { left: 14px; }
.input-ico input { height: 48px !important; border-radius: 12px !important; font-size: 15px; }
[dir=rtl] .input-ico input { padding-right: 44px !important; padding-left: 44px !important; }
[dir=ltr] .input-ico input { padding-left: 44px !important; padding-right: 44px !important; }
.input-ico input:focus + .pass-eye, .input-ico:focus-within > .ic { color: var(--brand); }
.pass-eye { position: absolute; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; background: none; border-radius: 8px; color: var(--faint); cursor: pointer; display: grid; place-items: center; }
[dir=rtl] .pass-eye { left: 7px; }
[dir=ltr] .pass-eye { right: 7px; }
.pass-eye:hover, .pass-eye.on { color: var(--brand); background: var(--brand-50); }
.pass-eye .ic { width: 18px; height: 18px; }
.auth-fields .btn.lg { height: 50px; border-radius: 12px; font-size: 15.5px; font-weight: 700; margin-top: 6px; }
.auth-help { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; text-align: center; }
.auth-copy { text-align: center; font-size: 12.5px; color: var(--faint); margin: 0; }
.auth-form .flash { margin-bottom: 18px; }
@media (min-width: 901px) { .auth-copy { display: none; } }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-form { padding: 20px; min-height: 100vh; }
  .auth-top .auth-mobile-logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-family: 'Inter', sans-serif; margin: 0; }
  .auth-top .auth-mobile-logo .logo-mark { width: 36px; height: 36px; font-size: 17px; }
}

/* compact summary strip (list & report pages) */
.stats.compact { display: flex; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow-x: auto; margin-bottom: 18px; }
.stats.compact .stat { flex: 1; min-width: 150px; border: 0; border-radius: 0; box-shadow: none; background: none; padding: 14px 22px; display: block; transform: none !important; }
.stats.compact .stat + .stat { border-inline-start: 1px solid var(--line); }
.stats.compact .stat-ico { display: none; }
.stats.compact .stat b { font-size: 22px; font-weight: 700; }
.stats.compact .stat span { font-size: 12.5px; }
.stats.compact .stat.ok b { color: var(--ok); }
.stats.compact .stat.warn b { color: var(--warn); }
.stats.compact .stat.bad b { color: var(--bad); }
.stats.compact .stat.info b { color: var(--info); }
.stats.compact a.stat:hover { background: var(--surface-2); }
@media (max-width: 640px) { .stats.compact .stat { min-width: 120px; padding: 12px 14px; } }
.auth-form { place-items: normal; align-items: stretch; }
.auth-fields .row.between { flex-direction: row !important; align-items: center; }

/* ---------- profile / settings sections ---------- */
.profile-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
.profile-card { text-align: center; padding: 28px 22px; position: sticky; top: calc(var(--top-h) + 16px); }
.avatar.xl { width: 84px; height: 84px; font-size: 34px; margin: 0 auto 14px; }
.profile-card h2 { font-size: 18px; }
.profile-meta { text-align: start; margin: 22px 0 0; padding-top: 18px; border-top: 1px solid var(--line); display: grid; gap: 4px 0; }
.profile-meta dt { font-size: 12px; color: var(--muted); margin-top: 8px; }
.profile-meta dd { margin: 0; font-size: 13.5px; word-break: break-word; }
.profile-logins { text-align: start; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.profile-sections { display: flex; flex-direction: column; gap: 18px; }
.settings-section { padding: 0; margin: 0; overflow: hidden; }
.ss-head { padding: 18px 22px 0; }
.ss-head h2 { font-size: 15.5px; }
.ss-head p { color: var(--muted); font-size: 13px; margin-top: 3px; }
.ss-body { padding: 16px 22px 20px; display: flex; flex-direction: column; gap: 14px; }
.ss-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px; background: var(--surface-2); border-top: 1px solid var(--line); }
[dir=rtl] .ss-foot { justify-content: flex-start; }
.lang-seg a { padding: 7px 20px; border-radius: 8px; color: var(--muted); font-size: 13.5px; }
.lang-seg a.on { background: #fff; color: var(--ink); font-weight: 700; box-shadow: var(--shadow-sm); }
@media (max-width: 1024px) { .profile-layout { grid-template-columns: 1fr; } .profile-card { position: static; } }

/* international palette tweaks */
.side-label { color: #64748b; text-transform: none; letter-spacing: .2px; }
.side-nav a.on { background: rgba(255,255,255,.08); color: #fff; box-shadow: inset 3px 0 0 var(--brand); }
[dir=rtl] .side-nav a.on { box-shadow: inset -3px 0 0 #3b82f6; }
[dir=ltr] .side-nav a.on { box-shadow: inset 3px 0 0 #3b82f6; }
.side-nav a.on .ic { color: #93c5fd; }
.logo-mark { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.auth-kicker { color: #93c5fd; }
.auth-feats li > span { background: rgba(59,130,246,.18); color: #bfdbfe; }
.auth-feats .ic { color: #bfdbfe; }
.auth-brand { background: linear-gradient(155deg, #1e3a8a 0%, #172554 55%, #0f172a 100%); }
.auth-brand::before { content: none; }
.auth-brand-foot { color: #94a3b8; }
.auth-feats small { color: #a5b4cc; }
.auth-brand p { color: #c7d2e3; }

/* top bar user menu */
.top-user { gap: 12px; }
.user-menu > summary { cursor: pointer; padding: 4px 10px 4px 4px; border: 1px solid transparent; }
[dir=rtl] .user-menu > summary { padding: 4px 4px 4px 10px; }
.user-menu > summary:hover, .user-menu[open] > summary { background: var(--surface-2); border-color: var(--line); }
.user-menu .caret { width: 15px; height: 15px; color: var(--faint); transition: transform .15s; }
.user-menu[open] .caret { transform: rotate(180deg); }
.user-menu .dd-menu { min-width: 230px; top: calc(100% + 8px); }
[dir=rtl] .user-menu .dd-menu { left: 0; right: auto; }
[dir=ltr] .user-menu .dd-menu { right: 0; left: auto; }
.um-head { padding: 8px 10px 6px; }
.um-head b { display: block; font-size: 14px; }
.um-head small { display: block; color: var(--muted); font-size: 12px; text-align: start; }
.topbar .today { border: 0; background: none; padding: 0; }
@media (max-width: 1024px) { .user-menu .who, .user-menu .caret { display: none; } }


/* =========================================================
   Dark theme
   ========================================================= */
[data-theme=dark] {
  --bg: #11161e;
  --surface: #181e28;
  --surface-2: #1c2330;
  --ink: #e2e7ee;
  --ink-2: #c2cad6;
  --muted: #8d98a9;
  --faint: #636f81;
  --line: #273041;
  --line-2: #212a38;
  --field: #141a23;
  --field-line: #323c4e;
  --hover: #1f2735;

  --brand: #6b93ea;
  --brand-600: #86a8f0;
  --brand-700: #a3bdf4;
  --brand-50: rgba(107, 147, 234, .13);
  --brand-100: rgba(107, 147, 234, .26);

  --ok: #5fc98b;     --ok-bg: rgba(95, 201, 139, .12);
  --warn: #e4b35a;   --warn-bg: rgba(228, 179, 90, .12);
  --bad: #ef7f79;    --bad-bg: rgba(239, 127, 121, .12);
  --info: #6cb6e3;   --info-bg: rgba(108, 182, 227, .12);
  --grey-bg: #232b39;

  --side-bg: #0d1219;
  --side-bg-2: #0d1219;
  --side-ink: #b9c3d1;
  --side-muted: #6b788c;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
}
/* components that used fixed light colours */
input:not([type=checkbox]):not([type=radio]), select, textarea { background-color: var(--field); border-color: var(--field-line); color: var(--ink); }
input:disabled, select:disabled { background-color: var(--surface-2); }
.btn, .act, .chip-btn, .lang-switch, .day-pill span, .round-btn, .dd-menu, dialog.modal, .auth-form, .tbl.inner, .seg button.on, .lang-seg a.on, .pass-eye:hover { background-color: var(--surface); }
.btn { border-color: var(--field-line); color: var(--ink); }
.btn:hover, .act:hover { background-color: var(--hover); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
[data-theme=dark] .btn.primary { color: #0d1219; }
[data-theme=dark] .btn.primary:hover { background: var(--brand-600); border-color: var(--brand-600); color: #0d1219; }
.btn.soft { background: var(--brand-50); border-color: transparent; color: var(--brand); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { background: var(--surface); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.btn.danger:hover { background: var(--bad-bg); }
.act { border-color: var(--line); color: var(--ink-2); }
.act.danger:hover { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.tbl tbody tr:hover > td { background: var(--hover); }
.topbar { background: color-mix(in srgb, var(--surface) 94%, transparent); }
.flash.ok { border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.flash.err { border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.flash.warn { border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.flash.info { border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.day-pill input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
[data-theme=dark] .day-pill input:checked + span, [data-theme=dark] .chip-btn.on, [data-theme=dark] .pager-num.on, [data-theme=dark] .count-pills a.on { color: #0d1219; }
.chip-btn.on { background: var(--brand); border-color: var(--brand); }
.save-bar { background: linear-gradient(to top, var(--bg) 70%, transparent); }
.avatar { background: var(--brand-50); color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand-100); }
.stats.compact a.stat:hover { background: var(--hover); }
.dev-item:has(input:checked) { background: var(--brand-50); border-color: var(--brand-100); }
.detailed tbody.open .sum-row > td { background: var(--brand-50); }
[data-theme=dark] .wk i.off { color: #0d1219; }
[data-theme=dark] .led { background: #3a4456; }
[data-theme=dark] .auth-form { background: var(--surface); }
[data-theme=dark] .auth-brand { background: linear-gradient(155deg, #1b2a4a 0%, #131c2e 55%, #0d1219 100%); }
[data-theme=dark] select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238d98a9' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
[data-theme=dark] .count-pills a { background: var(--surface); }
[data-theme=dark] .count-pills a b { background: var(--grey-bg); }
[data-theme=dark] .pager { background: var(--surface-2); }
[data-theme=dark] .kv-cell, [data-theme=dark] .perm-group, [data-theme=dark] .scope-box { background: var(--surface-2); }
[data-theme=dark] .time-tag { background: var(--surface-2); }
[data-theme=dark] img, [data-theme=dark] .logo-mark { filter: none; }
[data-theme=dark] .act[data-tip]:hover::after { background: #e2e7ee; color: #11161e; }

/* theme toggle button */
.theme-btn { width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); display: inline-grid; place-items: center; cursor: pointer; padding: 0; }
.theme-btn:hover { border-color: var(--brand); color: var(--brand); }
.theme-btn .ic { width: 17px; height: 17px; }
.theme-btn .i-sun { display: none; }
[data-theme=dark] .theme-btn .i-sun { display: block; }
[data-theme=dark] .theme-btn .i-moon { display: none; }
.auth-top .theme-btn { margin-inline-start: 8px; }

[dir=rtl] .profile-meta dd.num { text-align: right; }
.auth-top > .row { margin-inline-start: auto; }
.auth-top > .row .lang-switch { margin: 0 !important; }
[data-theme=dark] .count-pills a.on { background: var(--brand); border-color: var(--brand); color: #0d1219; }
[data-theme=dark] .count-pills a.on b { background: rgba(13,18,25,.18); color: #0d1219; }

/* logo image */
img.logo-mark { background: none; box-shadow: none; padding: 0; display: block; object-fit: contain; border-radius: 11px; }
.side-brand img.logo-mark { width: 38px; height: 38px; }
.auth-brand img.logo-mark { width: 48px; height: 48px; border-radius: 12px; }
.auth-top img.logo-mark { width: 34px; height: 34px; border-radius: 9px; }

/* segmented radio (in / out) */
.seg-opt { position: relative; cursor: pointer; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt span { display: inline-block; padding: 6px 18px; border-radius: 8px; color: var(--muted); font-size: 13.5px; }
.seg-opt input:checked + span { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: var(--shadow-sm); }
.seg-opt input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand-100); }
.auth-top > .row { flex-direction: row !important; }
input[readonly] { background-color: var(--surface-2) !important; color: var(--ink-2); }

/* ---------- dashboard ---------- */
.rate-card { padding: 18px 20px; }
.rate-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.rate-num { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rate-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--grey-bg); }
.rate-bar i { display: block; height: 100%; }
.seg-ok { background: var(--ok); } .seg-late { background: var(--warn); } .seg-miss { background: var(--bad); }
.rate-legend { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.rate-legend span { display: inline-flex; align-items: center; gap: 7px; }
.rate-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.rate-legend b { color: var(--ink); font-variant-numeric: tabular-nums; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr); gap: 18px; align-items: start; margin-bottom: 18px; }
.dash-side { display: flex; flex-direction: column; gap: 18px; }
.list-scroll { max-height: 420px; overflow-y: auto; scrollbar-width: thin; }
.list-scroll.short { max-height: 300px; }
a.list-item { color: inherit; }
a.list-item:hover { background: var(--hover); }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; padding: 16px 20px; }
.person { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 10px; color: var(--ink); min-width: 0; }
.person:hover { border-color: var(--brand-100); background: var(--hover); color: var(--ink); }
.person b { display: block; font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person small { display: block; color: var(--muted); font-size: 11.5px; }
.person .grow { min-width: 0; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } }

/* ---------- collapsible sidebar ---------- */
.side-collapse { margin-inline-start: auto; width: 30px; height: 30px; flex: none; display: grid; place-items: center; border: 0; background: none; color: var(--side-muted); border-radius: 8px; cursor: pointer; }
.side-collapse:hover { background: rgba(255,255,255,.08); color: #fff; }
.side-collapse .ic { width: 17px; height: 17px; }
@media (max-width: 1024px) { .side-collapse { display: none; } }
@media (min-width: 1025px) {
  html.side-mini { --side-w: 78px; }
  html.side-mini .side-brand { flex-direction: column; gap: 10px; padding: 16px 0 14px; }
  html.side-mini .side-brand .brand-txt { display: none; }
  html.side-mini .side-collapse { margin: 0; }
  html.side-mini .side-collapse .ic { transform: scaleX(-1); }
  html.side-mini .side-nav { padding: 10px 14px 20px; }
  html.side-mini .side-nav a { justify-content: center; padding: 11px 0; gap: 0; position: relative; }
  html.side-mini .side-nav a span { display: none; }
  html.side-mini .side-label { font-size: 0; margin: 14px 6px 8px; border-top: 1px solid rgba(255,255,255,.09); }
  html.side-mini .side-foot { display: none; }
}

/* ---------- plain, centred sign-in ---------- */
.auth { display: grid; place-items: center; min-height: 100vh; grid-template-columns: 1fr; padding: 28px 18px; background: var(--bg); }
.auth-brand { display: none !important; }
.auth-shell { width: 100%; max-width: 420px; }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; padding: 0; }
.auth-logo { display: inline-flex; align-items: center; gap: 10px; font-family: 'Inter', 'Tajawal', sans-serif; font-weight: 700; font-size: 18px; color: var(--ink); }
.auth-logo .logo-mark { width: 34px; height: 34px; border-radius: 9px; }
.auth-box { display: block; flex: none; width: 100%; max-width: none; margin: 0; padding: 30px 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.auth-box h1 { font-size: 22px; }
.auth-box .sub { margin: 6px 0 22px; font-size: 14px; }
.auth-fields { gap: 16px; }
.auth-help { margin-top: 22px; padding-top: 18px; }
.auth-copy { display: block !important; text-align: center; font-size: 12.5px; color: var(--faint); margin: 16px 0 0; }
@media (max-width: 480px) { .auth { padding: 20px 14px; } .auth-box { padding: 24px 20px; } }

.side-tip { position: fixed; transform: translateY(-50%); background: #0f172a; color: #fff; font-size: 12.5px; font-weight: 500; padding: 5px 11px; border-radius: 7px; white-space: nowrap; pointer-events: none; z-index: 60; box-shadow: var(--shadow-lg); }
[data-theme=dark] .side-tip { background: #e2e7ee; color: #11161e; }

/* =========================================================
   dark mode — refined palette (overrides the block above)
   ========================================================= */
[data-theme=dark] {
  --bg: #0f141c;
  --surface: #171e29;
  --surface-2: #1d2531;
  --ink: #e6eaf1;
  --ink-2: #c7cfdb;
  --muted: #95a1b2;
  --faint: #6b7889;
  --line: #2a3446;
  --line-2: #222b39;
  --field: #131a24;
  --field-line: #374256;
  --hover: #202938;
  --grey-bg: #232c3b;

  --brand: #7ba1f0;
  --brand-600: #93b3f5;
  --brand-700: #b2c9f8;
  --brand-50: rgba(123, 161, 240, .14);
  --brand-100: rgba(123, 161, 240, .28);

  --ok: #55d08d;     --ok-bg: rgba(85, 208, 141, .14);
  --warn: #efbb63;   --warn-bg: rgba(239, 187, 99, .14);
  --bad: #f58b84;    --bad-bg: rgba(245, 139, 132, .14);
  --info: #74bfe9;   --info-bg: rgba(116, 191, 233, .14);

  --side-bg: #0b1017;
  --side-bg-2: #0b1017;
  --side-ink: #c3ccda;
  --side-muted: #7a8799;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow: 0 2px 4px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .32);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .6);
}
/* separate the chrome from the content */
[data-theme=dark] .side { border-inline-end: 1px solid #1b2331; }
[data-theme=dark] .topbar { background: rgba(15, 20, 28, .88); border-bottom-color: #1f2836; }
[data-theme=dark] .card, [data-theme=dark] .stat { box-shadow: none; }
[data-theme=dark] .stat:hover, [data-theme=dark] .person:hover { border-color: #3a4761; }
/* row hover was a fixed light colour */
[data-theme=dark] .tbl tbody tr:hover > td { background: var(--hover); }
[data-theme=dark] .tbl th { background: #1a222e; }
/* focus rings follow the dark brand colour */
[data-theme=dark] input:focus, [data-theme=dark] select:focus, [data-theme=dark] textarea:focus { box-shadow: 0 0 0 3px rgba(123, 161, 240, .22); }
[data-theme=dark] .btn:focus-visible, [data-theme=dark] .day-pill input:focus-visible + span { box-shadow: 0 0 0 3px rgba(123, 161, 240, .3); }
[data-theme=dark] dialog.modal::backdrop { background: rgba(3, 6, 11, .66); }
[data-theme=dark] ::selection { background: rgba(123, 161, 240, .3); }
/* readable scrollbars */
[data-theme=dark] * { scrollbar-color: #39445a transparent; }
[data-theme=dark] ::-webkit-scrollbar { width: 10px; height: 10px; }
[data-theme=dark] ::-webkit-scrollbar-thumb { background: #39445a; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
[data-theme=dark] ::-webkit-scrollbar-thumb:hover { background: #4a5670; background-clip: content-box; }
[data-theme=dark] ::-webkit-scrollbar-track { background: transparent; }
/* sign-in card sits on the deep background */
[data-theme=dark] .auth { background: var(--bg); }
[data-theme=dark] .auth-box { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow); }
/* solid controls read better than pastel fills on a dark page */
[data-theme=dark] .btn.primary { background: #3f6ad8; border-color: #3f6ad8; color: #fff; }
[data-theme=dark] .btn.primary:hover { background: #4b78e6; border-color: #4b78e6; color: #fff; }
[data-theme=dark] .day-pill input:checked + span, [data-theme=dark] .chip-btn.on, [data-theme=dark] .pager-num.on,
[data-theme=dark] .count-pills a.on, [data-theme=dark] .wk i.off { background: #3f6ad8; border-color: #3f6ad8; color: #fff; }
[data-theme=dark] .count-pills a.on b { background: rgba(255, 255, 255, .18); color: #fff; }
[data-theme=dark] .seg-opt input:checked + span, [data-theme=dark] .seg button.on { color: var(--brand-700); }


/* ---------- subscription ---------- */
.plan-hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .9fr); gap: 0; border-radius: var(--r-lg); overflow: hidden; margin-bottom: 18px; background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 45%, #172554 100%); color: #fff; box-shadow: var(--shadow); position: relative; }
.plan-hero::before { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.08) 1px, transparent 1px); background-size: 22px 22px; pointer-events: none; }
.plan-main { position: relative; padding: 30px 32px; }
.plan-flag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: #fff; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.2); border-radius: 999px; padding: 4px 12px; }
.plan-flag .ic { width: 14px; height: 14px; }
.plan-title { margin-top: 16px; font-size: 30px; font-weight: 700; font-family: 'Inter', 'Tajawal', sans-serif; letter-spacing: -.5px; color: #fff; }
.plan-lead { color: #c7d7fb; font-size: 14px; margin-top: 4px; }
.plan-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; margin-top: 20px; }
.plan-price .cur { font-size: 24px; font-weight: 700; }
.plan-price b { font-size: 46px; font-weight: 700; line-height: 1; letter-spacing: -1px; }
.plan-price .curr { font-size: 13px; color: #b9cdf8; margin-inline-start: 2px; }
.plan-price s { color: #93b0e8; font-size: 16px; margin-inline-start: 12px; }
.plan-price em { font-style: normal; font-size: 12.5px; font-weight: 700; color: #0b1017; background: #fbbf24; border-radius: 999px; padding: 3px 11px; align-self: center; }
.plan-save { display: flex; align-items: center; gap: 7px; margin-top: 14px; font-size: 13.5px; color: #c7d7fb; }
.plan-save .ic { width: 16px; height: 16px; color: #6ee7b7; }
.plan-meta { position: relative; list-style: none; margin: 0; padding: 30px 32px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 16px; align-content: center; background: rgba(0,0,0,.18); border-inline-start: 1px solid rgba(255,255,255,.1); }
.plan-meta span { display: block; color: #a9c1ef; font-size: 12.5px; margin-bottom: 3px; }
.plan-meta b { font-size: 15px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 7px; }
.plan-meta b.brandname { font-family: 'Inter', sans-serif; letter-spacing: -.2px; }
.plan-meta b.on i { width: 8px; height: 8px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 3px rgba(52,211,153,.25); }
.feat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 14px; }
.feat { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface-2); }
.feat-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); flex: none; }
.feat-ico .ic { width: 19px; height: 19px; }
.feat b { display: block; font-size: 14px; }
.feat small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; line-height: 1.6; }
.plan-terms { display: flex; align-items: center; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-2); color: var(--muted); font-size: 12.5px; }
.plan-terms .ic { width: 16px; height: 16px; color: var(--faint); flex: none; }
@media (max-width: 860px) { .plan-hero { grid-template-columns: 1fr; } .plan-meta { border-inline-start: 0; border-top: 1px solid rgba(255,255,255,.1); padding: 22px 32px; } .plan-main { padding: 26px 24px; } }
[data-theme=dark] .plan-hero { background: linear-gradient(135deg, #1b3a86 0%, #17307a 45%, #101a38 100%); }
[data-theme=dark] .feat { background: var(--surface-2); border-color: var(--line); }

.code-input { font-family: 'Inter', ui-monospace, monospace; letter-spacing: .6px; font-size: 13.5px; }
.lic-row { display: flex; flex-wrap: wrap; gap: 26px 40px; }
.lic-row span { display: block; color: var(--muted); font-size: 12.5px; margin-bottom: 4px; }
.lic-row b { font-size: 15px; }
.code-txt { font-family: 'Inter', ui-monospace, monospace; letter-spacing: 1px; }
.act-who { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.act-who b { color: var(--ink-2); }
.linkish { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; padding: 0; font: inherit; font-size: 13px; color: var(--brand); cursor: pointer; }
.linkish:hover { color: var(--brand-600); text-decoration: underline; }
.linkish .ic { width: 15px; height: 15px; }

/* ---------- roles: collapsible cards + permission groups ---------- */
.role-card { margin-bottom: 14px; }
.role-sum { display: flex; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer; list-style: none; }
.role-sum::-webkit-details-marker { display: none; }
.role-sum:hover { background: var(--hover); }
.role-card[open] > .role-sum { border-bottom: 1px solid var(--line); }
.role-sum .grow { min-width: 0; }
.role-sum b { display: block; font-size: 15px; }
.role-sum small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.role-tags .badge .ic { width: 13px; height: 13px; }
.sum-caret { display: grid; color: var(--muted); transition: transform .16s ease; }
[dir=ltr] .sum-caret .ic { transform: scaleX(-1); }
.role-card[open] .sum-caret { transform: rotate(-90deg); }
[dir=ltr] .role-card[open] .sum-caret { transform: rotate(90deg); }
.role-card.is-new .dev-ico.off { background: var(--brand-50); color: var(--brand); }
.role-body { padding: 18px 20px 0; }
.role-fields { margin-bottom: 18px; max-width: 760px; }
.role-foot { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.role-foot .hint { display: flex; align-items: center; gap: 6px; margin: 0; }
[dir=rtl] .role-foot .btn.danger { margin-right: auto; }
[dir=ltr] .role-foot .btn.danger { margin-left: auto; }

.perm-grid { grid-template-columns: repeat(auto-fill, minmax(265px, 1fr)); gap: 14px; }
.perm-group { padding: 0; gap: 0; overflow: hidden; background: var(--surface); border-radius: var(--r-lg); }
.perm-group .perm-head { display: flex; align-items: center; gap: 9px; margin: 0; padding: 10px 13px; background: var(--surface-2); border-bottom: 1px solid var(--line); cursor: pointer; font-size: 13.5px; color: var(--ink); }
.perm-head b { flex: 1; font-size: 13.5px; }
.perm-count { font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--grey-bg); border-radius: 999px; padding: 1px 8px; font-variant-numeric: tabular-nums; }
.perm-group.some .perm-count { background: var(--brand-50); color: var(--brand); }
.perm-group.all .perm-count { background: var(--ok-bg); color: var(--ok); }
.perm-item { display: flex; align-items: flex-start; gap: 9px; padding: 9px 13px; font-size: 13.5px; line-height: 1.5; cursor: pointer; border-bottom: 1px solid var(--line-2); }
.perm-item:last-child { border-bottom: 0; }
.perm-item:hover { background: var(--hover); }
.perm-item.na { opacity: .45; cursor: not-allowed; }
.perm-item input { margin-top: 2px; }

/* roles — v2 polish */
.role-card { transition: box-shadow .15s, border-color .15s; }
.role-card[open] { box-shadow: var(--shadow); border-color: var(--brand-100); }
.role-card.is-sys > .role-sum .dev-ico { background: var(--ok-bg); color: var(--ok); }
.role-cover { display: flex; align-items: center; gap: 9px; min-width: 150px; }
.cover-bar { flex: 1; height: 6px; border-radius: 99px; background: var(--grey-bg); overflow: hidden; }
.cover-bar i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.role-card.is-sys .cover-bar i { background: var(--ok); }
.role-cover .num { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 860px) { .role-cover { display: none; } }

.perm-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface-2); }
.perm-total { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.perm-total .ic { width: 16px; height: 16px; color: var(--ok); }
.perm-total b { color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }
.perm-bar-acts { display: flex; gap: 6px; }

.perm-sec { margin-bottom: 20px; }
.perm-sec-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.perm-sec-head span { font-size: 12.5px; font-weight: 700; color: var(--muted); letter-spacing: .2px; white-space: nowrap; }
.perm-sec-head i { flex: 1; height: 1px; background: var(--line); }
.perm-group { border-color: var(--line-2); }
.perm-group.all { border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.perm-ico { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--brand-50); color: var(--brand); flex: none; }
.perm-ico .ic { width: 15px; height: 15px; }
.perm-group.all .perm-ico { background: var(--ok-bg); color: var(--ok); }
.perm-item span { flex: 1; }

/* ---------- theme + a11y polish ---------- */
[data-theme=dark] { color-scheme: dark; }
/* the selected chip must read as raised, not sunken */
[data-theme=dark] .seg { background: #10161f; }
[data-theme=dark] .seg button.on, [data-theme=dark] .seg-opt input:checked + span { background: var(--brand-50); color: var(--brand-700); box-shadow: inset 0 0 0 1px var(--brand-100); }
[data-theme=dark] .day-pill span { background: var(--surface-2); }
/* one footer strip per card, not two */
.pager { border-top: 1px solid var(--line); background: transparent; }
.pager + .card-foot { border-top: 0; }
/* visible keyboard focus on every interactive element */
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px;
}
.side-nav a:focus-visible, .side-collapse:focus-visible { outline-color: #93b3f5; }
/* row-action tooltips are drawn on <body> (app.js), so tables no longer clip them */
.act[data-tip]:hover::after { display: none; }
.tip-float { position: fixed; transform: translate(-50%, -100%); background: #0f172a; color: #fff; font-size: 12px; font-weight: 500; padding: 4px 9px; border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 60; box-shadow: var(--shadow); }
[data-theme=dark] .tip-float { background: #e2e7ee; color: #11161e; }

/* temporary-licence strip */
.lic-strip { display: flex; align-items: center; gap: 9px; padding: 9px 28px; font-size: 13px; background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid color-mix(in srgb, var(--warn) 25%, transparent); }
.lic-strip.urgent { background: var(--bad-bg); color: var(--bad); border-bottom-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.lic-strip .ic { width: 16px; height: 16px; flex: none; }
.lic-strip a { margin-inline-start: auto; color: inherit; font-weight: 700; text-decoration: underline; }
body.has-side .lic-strip { margin-inline-start: var(--side-w); }
.warn-txt { color: var(--warn); } .bad-txt { color: var(--bad); }
@media (max-width: 1024px) { body.has-side .lic-strip { margin-inline-start: 0; } .lic-strip { padding: 8px 14px; } }

.feat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .feat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .feat-grid { grid-template-columns: 1fr; } }
/* settings: the alerts card spans the full width instead of leaving a gap */
.grid2 > .card.span2 { grid-column: 1 / -1; }

/* trial banner */
.plan-hero.trial { background: linear-gradient(135deg, #b45309 0%, #92400e 45%, #451a03 100%); }
[data-theme=dark] .plan-hero.trial { background: linear-gradient(135deg, #7c3f0a 0%, #5b2d06 45%, #2b1403 100%); }
.plan-hero.trial .plan-lead, .plan-hero.trial .plan-save { color: #fde8c8; }
.plan-hero.trial .plan-save .ic { color: #fcd34d; }
.plan-hero.trial .plan-meta { background: rgba(0,0,0,.22); }
.plan-hero.trial .plan-meta span { color: #f1cfa0; }
.trial-count { display: flex; align-items: baseline; gap: 10px; margin-top: 20px; }
.trial-count b { font-size: 52px; font-weight: 700; line-height: 1; letter-spacing: -1.5px; }
.trial-count span { font-size: 15px; color: #fde8c8; }

/* =========================================================
   Product typography & finish
   ========================================================= */
:root { --font-ar: 'IBM Plex Sans Arabic', 'Tajawal', system-ui, sans-serif;
        --font-lt: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; }
body { font-family: var(--font-ar); font-size: 14px; line-height: 1.65; letter-spacing: 0; }
[dir=ltr] body { font-family: var(--font-lt); }
.num, .tbl td.num, .tbl th.num, input[dir=ltr], .code-txt, .code-input,
time, .stat b, .rate-num, .plan-price b, .trial-count b {
  font-family: var(--font-lt); font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1;
}
h1 { font-size: 21px; font-weight: 600; letter-spacing: -.2px; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 13.5px; font-weight: 600; }
.page-head .sub, .card-head .sub { font-size: 13px; }
.btn, .act, .badge, .chip-btn, th, .side-nav a { font-weight: 500; }
.btn.primary, .tbl th, .stat b, .card-head h2, .role-sum b { font-weight: 600; }
b, strong { font-weight: 600; }
/* quieter chrome, closer to a product than a document */
.card, .stat, .perm-group, .feat, .person { border-radius: 12px; }
.card { box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
[data-theme=dark] .card { box-shadow: none; }
.tbl th { font-size: 12px; letter-spacing: .1px; text-transform: none; }
.tbl td { font-size: 13.5px; }
.badge { font-size: 11.5px; padding: 2px 9px; }
.btn { border-radius: 9px; }
.btn.sm { border-radius: 8px; }
input:not([type=checkbox]):not([type=radio]), select, textarea { border-radius: 9px; }
.side-nav a { font-size: 13.5px; border-radius: 9px; }
.side-label { font-size: 11px; letter-spacing: .4px; text-transform: uppercase; font-weight: 600; }
[dir=rtl] .side-label { letter-spacing: 0; text-transform: none; }
.topbar .crumb { font-size: 13px; }
.logo-mark, .brandname, .plan-title, .auth-logo, .side-brand b { font-family: var(--font-lt); letter-spacing: -.2px; }

/* ---------- API keys ---------- */
.key-box { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px dashed var(--field-line); border-radius: 10px; background: var(--surface-2); }
.key-box code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; background: none; padding: 0; font-size: 13px; direction: ltr; text-align: left; }
.key-reveal { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.api-docs { display: flex; flex-direction: column; gap: 8px; }
.api-ep { display: flex; align-items: flex-start; gap: 12px; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 10px; }
.api-ep code { flex: none; min-width: 160px; direction: ltr; font-size: 12.5px; }
.api-ep b { display: block; font-size: 13.5px; }
.api-ep small { display: block; color: var(--muted); font-size: 12px; direction: ltr; text-align: start; }
.api-sample { margin: 0; padding: 14px 16px; border-radius: 10px; background: var(--side-bg); color: #cbd5e1; font-family: 'Inter', ui-monospace, monospace; font-size: 12.5px; line-height: 1.7; overflow-x: auto; }

/* ---------- settings tabs & API panel ---------- */
.tabs a .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); display: inline-block; }
.tabs a .dot.ok { background: var(--ok); }
.tab-panel[hidden] { display: none; }
.sub-block { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.sub-block .field { width: 100%; }

.key-row { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line-2); }
.key-row:last-child { border-bottom: 0; }
.key-row.off { opacity: .6; }
.key-row .grow { min-width: 0; }
.key-row b { display: block; font-size: 14px; }
.key-row small { display: block; color: var(--muted); font-size: 12px; }
.key-row code { background: none; padding: 0; font-size: 12px; }
.key-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); flex: none; }
.key-ico .ic { width: 17px; height: 17px; }
.key-scopes { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.key-meta { text-align: center; flex: none; }
.key-meta .xs { font-size: 11.5px; display: block; }

.scope-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.scope-opt { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.scope-opt:hover { background: var(--hover); }
.scope-opt b { display: block; font-family: 'Inter', monospace; font-size: 13px; }
.scope-opt small { display: block; color: var(--muted); font-size: 12px; }
.api-ep { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 10px; }
.api-ep .verb { font-family: 'Inter', monospace; font-size: 11px; font-weight: 700; color: var(--ok); background: var(--ok-bg); border-radius: 5px; padding: 2px 7px; flex: none; }
.api-ep code { direction: ltr; font-size: 12.5px; min-width: 110px; flex: none; background: none; padding: 0; }
/* the generic .stack label rule would stack these vertically */
.stack .scope-list .scope-opt { flex-direction: row; align-items: flex-start; font-weight: 400; }
.scope-opt input { margin-top: 3px; }
.scope-opt > span { flex: 1; min-width: 0; }

/* ---------- settings: side navigation + setting rows ---------- */
.set-layout { display: block; }
.set-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; padding: 8px; margin-bottom: 18px; }
.set-nav a { display: flex; align-items: center; gap: 11px; padding: 12px 13px; border-radius: 10px; color: var(--ink-2); }
.set-nav a:hover { background: var(--hover); color: var(--ink); }
.set-nav a.on { background: var(--brand-50); color: var(--brand-700); }
.set-nav a.on .set-ico { background: var(--brand); color: #fff; }
.set-nav b { display: block; font-size: 13.5px; font-weight: 600; }
.set-nav small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.set-nav .grow { min-width: 0; }
.set-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--grey-bg); color: var(--muted); flex: none; }
.set-ico .ic { width: 16px; height: 16px; }
.set-state { font-size: 10.5px; color: var(--muted); background: var(--grey-bg); border-radius: 999px; padding: 1px 7px; white-space: nowrap; flex: none; }
.set-nav a.on .set-state { background: rgba(255,255,255,.55); }
[data-theme=dark] .set-nav a.on { background: rgba(123,161,240,.14); }
[data-theme=dark] .set-nav a.on .set-state { background: rgba(0,0,0,.25); }
.set-body { display: flex; flex-direction: column; }

.set-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding-bottom: 14px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.set-head h2 { display: flex; align-items: center; gap: 9px; }
.set-head h2 .ic { color: var(--brand); }
.set-head p { width: 100%; color: var(--muted); font-size: 13px; margin: 0; order: 3; }
.set-head .badge { margin-inline-start: auto; }

.set-rows { display: flex; flex-direction: column; }
.set-row { display: flex; align-items: flex-start; gap: 24px; padding: 16px 0; border-bottom: 1px solid var(--line-2); }
.set-row:last-child { border-bottom: 0; padding-bottom: 0; }
.set-row .txt { flex: 1; min-width: 0; }
.set-row .txt b { display: block; font-size: 13.5px; font-weight: 600; }
.set-row .txt small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.6; margin-top: 2px; }
.set-row .ctl { width: 190px; flex: none; }
.set-row .ctl.wide { width: 340px; }
.set-row .ctl input, .set-row .ctl select { width: 100%; }
.unit { position: relative; }
.unit span { position: absolute; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--muted); pointer-events: none; }
[dir=rtl] .unit span { left: 12px; } [dir=ltr] .unit span { right: 12px; }
[dir=rtl] .unit input { padding-left: 52px; } [dir=ltr] .unit input { padding-right: 52px; }

/* a switch reads faster than a checkbox for an on/off setting */
.switch { display: inline-block; position: relative; width: 42px; height: 24px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--grey-bg); border: 1px solid var(--field-line); transition: background .15s, border-color .15s; }
.switch i::after { content: ''; position: absolute; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
[dir=rtl] .switch i::after { right: 3px; } [dir=ltr] .switch i::after { left: 3px; }
.switch input:checked + i { background: var(--brand); border-color: var(--brand); }
[dir=rtl] .switch input:checked + i::after { transform: translateX(-18px); }
[dir=ltr] .switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--brand); outline-offset: 2px; }

/* three-step explainer */
.steps { list-style: none; counter-reset: st; margin: 16px 0 4px; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.steps li { counter-increment: st; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface-2); }
.steps li::before { content: counter(st); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; margin-bottom: 8px; font-family: 'Inter', sans-serif; }
.steps b { display: block; font-size: 13.5px; }
.steps small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; line-height: 1.5; }

@media (max-width: 1000px) {
  .set-nav { display: flex; overflow-x: auto; gap: 6px; }
  .set-nav a { flex: none; }
  .set-nav small, .set-nav .set-state { display: none; }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .set-row { flex-direction: column; gap: 10px; }
  .set-row .ctl, .set-row .ctl.wide { width: 100%; }
}

.set-nav .grow { display: flex; flex-direction: column; }
.set-nav a { align-items: flex-start; }
.set-nav .set-state { margin-inline-start: auto; align-self: center; }

/* =========================================================
   API documentation
   ========================================================= */
.docs { display: grid; grid-template-columns: 262px minmax(0, 1fr); min-height: 100vh; background: var(--bg); }
.docs-nav { position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto; padding: 20px 14px 40px;
  background: var(--side-bg); border-inline-end: 1px solid rgba(255,255,255,.07); }
.docs-brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 18px; color: #fff; }
.docs-brand b { display: block; font-family: 'Inter', sans-serif; font-weight: 600; font-size: 16px; letter-spacing: -.2px; }
.docs-brand small { display: block; color: var(--side-muted); font-size: 11.5px; }
.docs-links { display: flex; flex-direction: column; gap: 1px; }
.docs-links a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; color: var(--side-ink); font-size: 13px; }
.docs-links a:hover { background: rgba(255,255,255,.07); color: #fff; }
.docs-links a.on { background: rgba(255,255,255,.11); color: #fff; font-weight: 600; }
.docs-links code { background: none; padding: 0; color: inherit; font-size: 12.5px; direction: ltr; }
.docs-links .v { font-size: 9.5px; font-weight: 700; color: #6ee7b7; background: rgba(110,231,183,.14); border-radius: 4px; padding: 2px 5px; letter-spacing: .3px; }
.docs-links a.out { color: var(--side-muted); font-size: 12.5px; margin-top: 4px; }
.docs-label { font-size: 10px; font-weight: 700; color: var(--side-muted); letter-spacing: .6px; margin: 16px 10px 5px; text-transform: uppercase; }

.docs-main { min-width: 0; }
.docs-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 28px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--line); }
.docs-bar .ver { font-family: 'Inter', sans-serif; font-size: 11.5px; font-weight: 600; color: var(--brand); background: var(--brand-50); border-radius: 999px; padding: 3px 10px; }
.docs-bar .grow { flex: 1; }

.docs-body { padding: 36px 40px 80px; max-width: 880px; }
.docs-body section { padding-bottom: 30px; margin-bottom: 30px; border-bottom: 1px solid var(--line); scroll-margin-top: 70px; }
.docs-body section:last-of-type { border-bottom: 0; }
.docs-body h1 { font-size: 30px; font-weight: 600; letter-spacing: -.5px; margin-bottom: 6px; }
.docs-body h2 { font-size: 19px; font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; }
.docs-body h3 { font-size: 15px; margin: 22px 0 8px; }
.docs-body h4 { font-size: 11.5px; color: var(--muted); margin: 18px 0 6px; font-weight: 600; letter-spacing: .3px; text-transform: uppercase; }
.docs-body p { color: var(--ink-2); margin-bottom: 10px; line-height: 1.85; font-size: 14px; }
.docs-body .lead { font-size: 15.5px; color: var(--muted); margin-bottom: 20px; }
.docs-body code { font-family: 'Inter', ui-monospace, monospace; font-size: 12.5px; }
.docs-body pre { background: var(--side-bg); color: #d7dee9; padding: 15px 18px; border-radius: 10px; overflow-x: auto;
  font-family: 'Inter', ui-monospace, monospace; font-size: 12.5px; line-height: 1.75; margin: 0; }
.code { position: relative; margin-bottom: 8px; }
.code .copy { position: absolute; top: 8px; border: 0; border-radius: 7px; background: rgba(255,255,255,.1); color: #cbd5e1;
  font: inherit; font-size: 11.5px; padding: 4px 10px; cursor: pointer; opacity: 0; transition: opacity .12s; }
[dir=rtl] .code .copy { left: 8px; } [dir=ltr] .code .copy { right: 8px; }
.code:hover .copy, .code .copy:focus-visible { opacity: 1; }
.code .copy:hover { background: rgba(255,255,255,.18); color: #fff; }
.code .copy.done { background: var(--ok); color: #06251a; opacity: 1; }

.docs-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-top: 18px; }
.docs-kv > div { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface); }
.docs-kv span { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 4px; }
.docs-kv code { direction: ltr; display: block; word-break: break-all; background: none; padding: 0; }
.rule-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-top: 12px; }
.rule-grid > div { border: 1px solid var(--line); border-radius: 10px; padding: 13px 15px; background: var(--surface); }
.rule-grid b { display: block; font-size: 13.5px; margin-bottom: 3px; }
.rule-grid small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.65; }

.docs-table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 10px 0 6px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.docs-table th { background: var(--surface-2); color: var(--muted); font-size: 11.5px; font-weight: 600; text-align: start; padding: 9px 13px; border-bottom: 1px solid var(--line); }
.docs-table td { padding: 9px 13px; border-bottom: 1px solid var(--line-2); font-size: 13px; vertical-align: top; }
.docs-table tr:last-child td { border-bottom: 0; }
.docs-table td.muted { color: var(--muted); font-size: 12.5px; }
.http { font-family: 'Inter', monospace; font-size: 11.5px; font-weight: 700; border-radius: 5px; padding: 2px 7px; background: var(--grey-bg); color: var(--ink-2); }
.http.h4 { background: var(--warn-bg); color: var(--warn); }
.http.h5 { background: var(--bad-bg); color: var(--bad); }

.docs-ep h2 .verb { font-family: 'Inter', monospace; font-size: 11px; font-weight: 700; color: var(--ok); background: var(--ok-bg); border-radius: 5px; padding: 3px 8px; }
.docs-ep h2 code { font-size: 17px; background: none; padding: 0; }
.scope-line { font-size: 13px; color: var(--muted); }
.docs-body .note { display: flex; align-items: center; gap: 9px; background: var(--info-bg); color: var(--info); border-radius: 10px; padding: 11px 14px; font-size: 13px; margin-top: 10px; }
.docs-body .note .ic { width: 16px; height: 16px; flex: none; }
.docs-foot { color: var(--faint); font-size: 12.5px; padding-top: 6px; }
@media (max-width: 900px) {
  .docs { grid-template-columns: 1fr; }
  .docs-nav { position: static; height: auto; }
  .docs-body { padding: 24px 16px 60px; }
  .docs-bar { padding: 0 16px; }
}

.try-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 4px; }
.docs-steps { margin-top: 14px; }
.docs-steps li { background: var(--surface); }

/* ---------- API panel v2 ---------- */
.set-head .head-acts { margin-inline-start: auto; display: flex; gap: 6px; }
.conn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-top: 16px; }
.conn-lbl { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.conn small { display: block; color: var(--muted); font-size: 12px; margin-top: 6px; }
.conn .key-box { padding: 9px 11px; }
.conn .key-box code { font-size: 12px; }
.api-steps { margin-top: 18px; }

.key-row { display: grid; grid-template-columns: 34px minmax(140px, 1.2fr) minmax(0, 1.4fr) repeat(4, minmax(78px, .8fr)) auto auto;
  align-items: center; gap: 14px; padding: 13px 18px; border-bottom: 1px solid var(--line-2); }
.key-row:last-child { border-bottom: 0; }
.key-id b { display: block; font-size: 14px; }
.key-id small { display: block; color: var(--muted); font-size: 11.5px; }
.key-id code { background: none; padding: 0; font-size: 11.5px; }
.key-cell span { display: block; color: var(--muted); font-size: 11px; }
.key-cell b { font-size: 12.5px; font-weight: 500; }
.key-scopes { display: flex; gap: 4px; flex-wrap: wrap; }
.ep-card > summary .key-ico { background: var(--grey-bg); color: var(--muted); }
.ep-body { padding: 16px 20px 20px; }
@media (max-width: 1100px) {
  .key-row { grid-template-columns: 34px 1fr auto; grid-auto-rows: auto; row-gap: 8px; }
  .key-scopes, .key-cell { grid-column: 2 / -1; }
  .key-cell { display: flex; gap: 6px; align-items: baseline; }
  .key-cell span { font-size: 11.5px; }
}

/* ---------- product finish: rhythm, weight, motion ---------- */
/* long URLs wrap instead of hiding behind a scrollbar */
.conn .key-box { align-items: flex-start; }
.conn .key-box code { white-space: normal; word-break: break-all; overflow: visible; line-height: 1.7; }
.key-box .btn { flex: none; }

/* one spacing rhythm everywhere */
.card { padding: 22px; margin-bottom: 16px; }
.card.flush { padding: 0; }
.card.flush > .card-head { padding: 16px 22px; }
.grid2, .stats, .dash-grid { gap: 16px; }
.page-head { margin-bottom: 22px; }

/* calmer, more deliberate controls */
.btn { height: 38px; padding: 0 15px; gap: 8px; transition: background-color .12s, border-color .12s, color .12s; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn.lg { height: 44px; padding: 0 20px; }
.btn.primary { box-shadow: 0 1px 2px rgba(16, 24, 40, .1); }
.act { transition: background-color .12s, color .12s, border-color .12s; }
.badge { font-weight: 500; letter-spacing: 0; }

/* tables read like a product, not a spreadsheet */
.tbl th { padding: 11px 14px; font-weight: 600; }
.tbl td { padding: 12px 14px; }
.tbl tbody tr { transition: background-color .1s; }

/* inputs: one height, one radius, one focus treatment */
input:not([type=checkbox]):not([type=radio]), select, textarea { min-height: 38px; transition: border-color .12s, box-shadow .12s; }
.field > input:not([type=checkbox]):not([type=radio]), .field > select,
.stack label > input:not([type=checkbox]):not([type=radio]), .stack label > select { width: 100%; }
label.inline { display: flex; align-items: center; gap: 9px; font-weight: 400; }
label.inline > input { flex: none; }

/* cards lift slightly on hover where they are actionable */
a.stat:hover, .person:hover, .role-card:hover { border-color: var(--brand-100); }
a.stat { transition: border-color .12s, transform .12s; }
a.stat:hover { transform: translateY(-1px); }

/* code example tabs */
.code-tabs { margin-bottom: 8px; }
.code-tabs .tabs.sm { gap: 2px; border-bottom: 0; margin-bottom: 6px; }
.code-tabs .tabs.sm button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 12.5px;
  padding: 4px 10px; border-radius: 7px; cursor: pointer; }
.code-tabs .tabs.sm button:hover { color: var(--ink); background: var(--hover); }
.code-tabs .tabs.sm button.on { color: var(--brand); background: var(--brand-50); font-weight: 600; }
.code-tabs .code[hidden] { display: none; }
/* a control column must never squeeze a label into a vertical strip */
.set-row .ctl label.inline { white-space: nowrap; }
.set-row .ctl .switch { margin-top: 6px; }
