/* =========================================================================
   LawERP — design system
   RTL-first, Arabic-native. Built around a quiet navy/brass palette because a
   law firm's software should read like its letterhead, not like a dashboard
   demo. Everything is token-driven so a tenant can re-accent the whole app.
   ========================================================================= */

:root {
  /* Neutrals — cool grey with a trace of blue, so borders never look muddy */
  --n-0:   #ffffff;
  --n-25:  #fbfcfd;
  --n-50:  #f6f8fa;
  --n-100: #eef1f5;
  --n-150: #e4e9ef;
  --n-200: #d8dfe8;
  --n-300: #bcc6d4;
  --n-400: #94a1b4;
  --n-500: #6c7b91;
  --n-600: #526176;
  --n-700: #3d4a5c;
  --n-800: #2a3442;
  --n-900: #1a212c;
  --n-950: #11161e;

  /* Brand — deep counsel navy */
  --brand-50:  #eef2fb;
  --brand-100: #d8e0f5;
  --brand-200: #b3c2ea;
  --brand-400: #5d77be;
  --brand-500: #3f5aa6;
  --brand-600: #2f478a;
  --brand-700: #24386e;
  --brand-800: #1b2b55;
  --brand-900: #14203f;

  /* Accent — brass. Used sparingly: active nav, key figures, seals */
  --accent-100: #f7edd8;
  --accent-300: #e2c489;
  --accent-500: #c39a4b;
  --accent-600: #a87f34;
  --accent-700: #866328;

  --ok-50:  #e9f7ef;  --ok-500:  #16a34a;  --ok-700:  #14532d;
  --warn-50:#fdf3e3;  --warn-500:#d97706;  --warn-700:#7c3a06;
  --bad-50: #fdecec;  --bad-500: #dc2626;  --bad-700: #7f1d1d;
  --info-50:#e8f1fb;  --info-500:#2563eb;  --info-700:#1e3a8a;

  /* Semantic surface tokens — the only things components should reference */
  --bg:            var(--n-50);
  --surface:       var(--n-0);
  --surface-muted: var(--n-25);
  --surface-sunk:  var(--n-100);
  --border:        var(--n-150);
  --border-strong: var(--n-200);
  --text:          var(--n-900);
  --text-soft:     var(--n-600);
  --text-faint:    var(--n-400);
  --text-invert:   var(--n-0);
  --brand:         var(--brand-700);
  --brand-soft:    var(--brand-50);
  --accent:        var(--accent-600);
  --sidebar-bg:    var(--brand-900);
  --sidebar-text:  #c3cde4;
  --sidebar-hover: rgba(255, 255, 255, .07);

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-xs: 0 1px 2px rgba(17, 22, 30, .05);
  --shadow-sm: 0 1px 3px rgba(17, 22, 30, .07), 0 1px 2px rgba(17, 22, 30, .04);
  --shadow-md: 0 4px 12px rgba(17, 22, 30, .08), 0 1px 3px rgba(17, 22, 30, .05);
  --shadow-lg: 0 16px 40px rgba(17, 22, 30, .14), 0 2px 8px rgba(17, 22, 30, .06);

  --sidebar-w: 268px;
  --topbar-h: 62px;

  --font: "IBM Plex Sans Arabic", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-num: "IBM Plex Sans Arabic", ui-monospace, "SF Mono", monospace;

  --ease: cubic-bezier(.32, .72, 0, 1);
}

:root[data-theme="dark"] {
  --bg:            var(--n-950);
  --surface:       #182029;
  --surface-muted: #1d2630;
  --surface-sunk:  #131a22;
  --border:        #28323f;
  --border-strong: #35424f;
  --text:          #e8edf3;
  --text-soft:     #a3b0c0;
  --text-faint:    #6f7e91;
  --brand:         var(--brand-400);
  --brand-soft:    rgba(93, 119, 190, .14);
  --accent:        var(--accent-300);
  --sidebar-bg:    #0f151d;
  --sidebar-text:  #9aa8bd;
  --sidebar-hover: rgba(255, 255, 255, .05);

  --ok-50:  rgba(22,163,74,.14);
  --warn-50:rgba(217,119,6,.14);
  --bad-50: rgba(220,38,38,.14);
  --info-50:rgba(37,99,235,.14);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .45);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, .5);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, .6);
}

/* ---------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
svg { flex: none; }
/* Safety net: an inline icon must never stretch to its container's width. */
.icon { width: 18px; height: 18px; }
table { border-collapse: collapse; width: 100%; }
h1, h2, h3, h4 { line-height: 1.35; font-weight: 600; }

::selection { background: var(--accent-300); color: var(--n-900); }

:focus-visible {
  outline: 2px solid var(--accent-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.btn:focus-visible, .icon-btn:focus-visible, .chip:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent-500);
}

/* Numbers stay Western and aligned, even inside Arabic sentences */
.num, td.num, .stat-value, .money {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: isolate;
  white-space: nowrap;
}

/* ------------------------------------------------------------- scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--n-300) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--n-300);
  border: 3px solid transparent;
  border-radius: 99px;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--n-400); background-clip: content-box; }
:root[data-theme="dark"] *::-webkit-scrollbar-thumb { background: #33404f; background-clip: content-box; }

/* ================================================================= layout */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  /* The column itself stretches with the page (so its navy never stops
     mid-page); the inner wrapper is what sticks to the viewport. */
  align-self: stretch;
  min-height: 100vh;
  position: relative;
  z-index: 40;
  border-inline-start: 1px solid rgba(255, 255, 255, .06);
}
.sidebar-inner {
  position: sticky; top: 0;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
}

.sidebar-brand {
  min-height: var(--topbar-h);
  padding-block: 10px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 18px;
  flex: none;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.sidebar-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent-500), var(--accent-700));
  color: #1a1206;
  flex: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}
.sidebar-brand-text { min-width: 0; }
.sidebar-brand-name {
  color: #fff; font-weight: 600; font-size: 14px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sidebar-brand-sub { font-size: 11.5px; color: rgba(255,255,255,.42); letter-spacing: .02em; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 10px 24px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); background-clip: content-box; }

.nav-group + .nav-group { margin-top: 4px; }
.nav-group-head {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 0; background: none; cursor: pointer;
  color: var(--sidebar-text);
  border-radius: var(--radius);
  font-size: 13.5px; font-weight: 500;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-group-head:hover { background: var(--sidebar-hover); color: #fff; }
.nav-group-head .chev { margin-inline-start: auto; opacity: .45; transition: transform .22s var(--ease); }
.nav-group.open .nav-group-head { color: #fff; }
.nav-group.open .chev { transform: rotate(-90deg); }

.nav-items { display: none; padding: 2px 0 6px; }
.nav-group.open .nav-items { display: block; }

.nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 12px 7px 12px;
  margin-inline-start: 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: rgba(255,255,255,.58);
  position: relative;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.nav-link::before {
  content: ""; position: absolute; inset-inline-start: -10px; top: 50%;
  width: 3px; height: 0; border-radius: 3px; background: var(--accent-500);
  transform: translateY(-50%); transition: height .2s var(--ease);
}
.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link.active { background: rgba(255,255,255,.09); color: #fff; font-weight: 500; }
.nav-link.active::before { height: 16px; }
.nav-link .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .38; flex: none; }

.sidebar-foot {
  flex: none; padding: 10px; border-top: 1px solid rgba(255,255,255,.07);
}

/* --------------------------------------------------------------- content */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  flex: none;
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.crumbs { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-faint); min-width: 0; }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { opacity: .5; }
.crumbs .current { color: var(--text); font-weight: 500; }

.topbar-spacer { flex: 1; }

.search-trigger {
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 12px;
  min-width: 230px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--text-faint);
  font-size: 13px; cursor: pointer;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.search-trigger:hover { border-color: var(--border-strong); background: var(--surface); }
.search-trigger kbd {
  margin-inline-start: auto;
  font-family: var(--font-num); font-size: 11px;
  padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-faint);
}

.icon-btn {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
  border: 1px solid transparent; border-radius: var(--radius);
  background: none; color: var(--text-soft); cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.icon-btn:hover { background: var(--surface-sunk); color: var(--text); }

.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand); color: #fff;
  font-size: 12.5px; font-weight: 600; flex: none;
  object-fit: cover;
}
.avatar.lg { width: 56px; height: 56px; font-size: 19px; }

.page { padding: 22px 24px 48px; flex: 1; }
.page-narrow { max-width: 980px; margin-inline: auto; }

.page-head {
  display: flex; align-items: flex-start; gap: 16px;
  flex-wrap: wrap; margin-bottom: 20px;
}
.page-title { font-size: 21px; font-weight: 650; letter-spacing: -.01em; }
.page-sub { color: var(--text-soft); font-size: 13.5px; margin-top: 2px; }
.page-actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================= components */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 14.5px; font-weight: 600; }
.card-title .muted { font-weight: 400; color: var(--text-faint); }
.card-head .spacer { flex: 1; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }
.card-foot {
  padding: 12px 18px; border-top: 1px solid var(--border);
  background: var(--surface-muted);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  display: flex; align-items: center; gap: 8px;
}

/* ------------------------------------------------------------------ grid */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* Stat rows hold four or five tiles depending on the viewer's permissions;
   auto-fit keeps the last one from stranding on a row of its own. */
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
/* The form grid is used on its own, so it carries display:grid itself. */
.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px 16px;
  align-items: start;
}
.col-1  { grid-column: span 1; }
.col-2  { grid-column: span 2; }
.col-3  { grid-column: span 3; }
.col-4  { grid-column: span 4; }
.col-5  { grid-column: span 5; }
.col-6  { grid-column: span 6; }
.col-7  { grid-column: span 7; }
.col-8  { grid-column: span 8; }
.col-9  { grid-column: span 9; }
.col-10 { grid-column: span 10; }
.col-11 { grid-column: span 11; }
.col-12 { grid-column: span 12; }

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font-size: 13.5px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: background .14s var(--ease), border-color .14s var(--ease),
              box-shadow .14s var(--ease), transform .06s var(--ease);
}
.btn:hover { background: var(--surface-sunk); border-color: var(--n-300); }
.btn:active { transform: translateY(.5px); }
.btn[disabled], .btn.is-busy { opacity: .55; pointer-events: none; }

.btn-primary {
  background: var(--brand-700); border-color: var(--brand-700); color: #fff;
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover { background: var(--brand-800); border-color: var(--brand-800); }
:root[data-theme="dark"] .btn-primary { background: var(--brand-500); border-color: var(--brand-500); }
:root[data-theme="dark"] .btn-primary:hover { background: var(--brand-400); border-color: var(--brand-400); }

.btn-accent { background: var(--accent-600); border-color: var(--accent-600); color: #fff; }
.btn-accent:hover { background: var(--accent-700); border-color: var(--accent-700); }

/* Not a button: a row that is out of this user's hands says so and stays put. */
.btn.is-static { cursor: default; color: var(--text-faint); background: transparent; border-color: transparent; }
.btn.is-static:hover { background: transparent; color: var(--text-faint); }
.btn-danger { background: var(--bad-500); border-color: var(--bad-500); color: #fff; }
.btn-danger:hover { filter: brightness(.93); }

.btn-ghost { background: none; border-color: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--surface-sunk); color: var(--text); }

.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn-icon { width: 36px; padding: 0; }
.btn-sm.btn-icon { width: 30px; }

/* ----------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 12.5px; font-weight: 500; color: var(--text-soft); }
.field-label .req { color: var(--bad-500); margin-inline-start: 2px; }
.field-hint { font-size: 11.5px; color: var(--text-faint); }
.field-error { font-size: 11.5px; color: var(--bad-500); }
/* The weekday of a hearing date, and the warning when it is not the usual one. */
/* "هذا الاسم موجود عندنا": the records the office already has, before saving. */
.twin-lead { margin: 0 0 10px; font-size: 13.5px; line-height: 1.8; }
.twins { display: grid; gap: 6px; max-height: 240px; overflow-y: auto; }
.twin { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; background: var(--surface-muted); }
.twin-name { display: block; font-size: 13.5px; font-weight: 600; }
.twin-hint { display: block; font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }

/* A dashboard block the office granted, whose screen this user cannot open:
   it is shown, it simply does not pretend to be a way in. */
.stat.is-plain, .alert-chip.is-plain { cursor: default; }
.stat.is-plain:hover, .alert-chip.is-plain:hover { transform: none; box-shadow: var(--shadow-xs); }

/* أين وقع الإجراء: a link to the map, and how far the reading may be off. */
.act-where { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; text-decoration: none; color: var(--brand-600); white-space: nowrap; }
.act-where:hover { text-decoration: underline; }
.act-acc { font-size: 11px; color: var(--text-faint); margin-top: 2px; }

.day-note:empty { display: none; }
.day-note.is-ok { color: var(--ok-700); }
.day-note.is-warn { color: var(--warn-700, #92400e); font-weight: 600; }

.input, .select, .textarea {
  width: 100%;
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--n-300); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 16%, transparent);
}
.input[readonly] { background: var(--surface-sunk); color: var(--text-soft); }
.textarea { min-height: 92px; resize: vertical; line-height: 1.7; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236c7b91' 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;
  background-size: 15px;
  padding-inline-start: 11px;
  padding-inline-end: 32px;
}
.has-error .input, .has-error .select, .has-error .textarea { border-color: var(--bad-500); }

.input-group { display: flex; }
.input-group .input { border-start-end-radius: 0; border-end-end-radius: 0; }
.input-group .addon {
  display: grid; place-items: center; padding: 0 11px;
  border: 1px solid var(--border-strong); border-inline-start: 0;
  border-start-end-radius: var(--radius); border-end-end-radius: var(--radius);
  background: var(--surface-sunk); color: var(--text-faint); font-size: 12.5px;
}

/* switch */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 38px; height: 22px; border-radius: 99px;
  background: var(--n-300); position: relative; flex: none;
  transition: background .18s var(--ease);
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-xs);
  transition: transform .18s var(--ease);
}
.switch input:checked + .track { background: var(--ok-500); }
.switch input:checked + .track::after { transform: translateX(-16px); }
html[dir="ltr"] .switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500) 20%, transparent); }
.switch .switch-label { font-size: 13px; }

/* relation picker */
.picker { position: relative; }
.picker-input { padding-inline-end: 30px; }
.picker-clear {
  position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: none; color: var(--text-faint); cursor: pointer;
  width: 22px; height: 22px; display: none; place-items: center; border-radius: 5px;
}
.picker.has-value .picker-clear { display: grid; }
.picker-clear:hover { background: var(--surface-sunk); color: var(--text); }
.picker-menu {
  position: absolute; z-index: 60; inset-inline: 0; top: calc(100% + 4px);
  max-height: 260px; overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 4px; display: none;
}
.picker.open .picker-menu { display: block; }
/* The add form is taller than a list of options, and the warning under it
   must be readable without hunting for it. */
.picker-menu:has(.picker-new) { max-height: min(72vh, 460px); }
.picker-option {
  padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px;
}
.picker-option:hover, .picker-option.cursor { background: var(--brand-soft); }
.picker-option .hint { display: block; font-size: 11.5px; color: var(--text-faint); }
.picker-empty { padding: 12px; text-align: center; color: var(--text-faint); font-size: 12.5px; }

.form-section {
  grid-column: 1 / -1;
  margin-top: 6px; padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex; align-items: baseline; gap: 10px;
}
.form-section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.form-section h4 { font-size: 13px; font-weight: 600; color: var(--brand); }
.form-section .hint { font-size: 12px; color: var(--text-faint); }

/* ----------------------------------------------------------------- table */
.table-wrap { overflow-x: auto; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.table { font-size: 13.5px; }
.table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-muted);
  text-align: start;
  font-size: 12px; font-weight: 600; color: var(--text-soft);
  letter-spacing: .01em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table thead th.sortable { cursor: pointer; user-select: none; }
.table thead th.sortable:hover { color: var(--text); }
.table thead th .sort-mark { opacity: 0; margin-inline-start: 4px; font-size: 10px; }
.table thead th[aria-sort] { color: var(--brand); }
.table thead th[aria-sort] .sort-mark { opacity: 1; }
.table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr { transition: background .1s var(--ease); }
.table tbody tr:hover { background: var(--surface-muted); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .cell-title { font-weight: 550; color: var(--text); }
.table .cell-title a:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.table .muted { color: var(--text-faint); }
/* خليةٌ تُفتح بالضغط: لا تُلوَّن كالرابط حتى يُقترب منها، فلا يزدحم الجدول. */
.table .cell-open { color: inherit; display: inline-block; }
.table .cell-open:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.table .row-note td { border-top: 0; }
.table .row-actions { display: flex; gap: 2px; justify-content: flex-end; opacity: .35; transition: opacity .12s var(--ease); }
.table tr:hover .row-actions { opacity: 1; }
.table td.end, .table th.end { text-align: end; }
.table td.center, .table th.center { text-align: center; }

.table-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.table-search { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.table-search .input { padding-inline-start: 34px; }
.table-search svg { position: absolute; inset-inline-start: 10px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }

.table-foot {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 11px 14px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-soft);
}
.pager { display: flex; gap: 3px; margin-inline-start: auto; }
.pager button, .pager span, .pager a {
  min-width: 30px; height: 30px; padding: 0 8px;
  display: grid; place-items: center;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: none; cursor: pointer; font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-soft);
}
.pager button:hover, .pager a:hover { background: var(--surface-sunk); color: var(--text); }
.pager button.current, .pager a.current { background: var(--brand-700); border-color: var(--brand-700); color: #fff; font-weight: 600; }
.pager span.gap { cursor: default; color: var(--text-faint); }
.pager button[disabled] { opacity: .35; pointer-events: none; }

.empty { padding: 56px 24px; text-align: center; color: var(--text-faint); }
.empty svg { margin: 0 auto 12px; color: var(--n-300); }
.empty h3 { font-size: 15px; color: var(--text-soft); font-weight: 550; margin-bottom: 4px; }
.empty p { font-size: 13px; max-width: 360px; margin: 0 auto 16px; }

/* skeleton shimmer while a table loads */
.skeleton-row td { padding: 14px; }
.skeleton {
  height: 11px; border-radius: 4px;
  background: linear-gradient(90deg, var(--surface-sunk) 25%, var(--border) 37%, var(--surface-sunk) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* --------------------------------------------------------------- badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 550; line-height: 1.7;
  border: 1px solid transparent; white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge-neutral { background: var(--surface-sunk); color: var(--text-soft); border-color: var(--border); }
.badge-ok      { background: var(--ok-50);   color: var(--ok-500); }
.badge-warn    { background: var(--warn-50); color: var(--warn-500); }
.badge-bad     { background: var(--bad-50);  color: var(--bad-500); }
.badge-info    { background: var(--info-50); color: var(--info-500); }
.badge-brand   { background: var(--brand-soft); color: var(--brand); }
.badge-accent  { background: var(--accent-100); color: var(--accent-700); }
:root[data-theme="dark"] .badge-accent { background: rgba(195,154,75,.16); color: var(--accent-300); }

/* ----------------------------------------------------------------- stats */
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 15px 17px;
  display: flex; align-items: flex-start; gap: 13px;
  box-shadow: var(--shadow-xs);
  position: relative; overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; inset-block: 0; inset-inline-start: 0;
  width: 3px; background: var(--tone, var(--brand-500));
}
.stat-icon { /* the glyph inside is sized by the icon() call */
  width: 38px; height: 38px; flex: none;
  border-radius: 10px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--tone, var(--brand-500)) 12%, transparent);
  color: var(--tone, var(--brand-500));
}
.stat-body { min-width: 0; }
.stat-label { font-size: 12.5px; color: var(--text-soft); }
.stat-value { font-size: 22px; font-weight: 650; letter-spacing: -.02em; line-height: 1.3; }
.stat-meta { font-size: 11.5px; color: var(--text-faint); }
.stat.tone-ok    { --tone: var(--ok-500); }
.stat.tone-warn  { --tone: var(--warn-500); }
.stat.tone-bad   { --tone: var(--bad-500); }
.stat.tone-info  { --tone: var(--info-500); }
.stat.tone-accent{ --tone: var(--accent-600); }

/* ---------------------------------------------------------------- modals */
.overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(17, 22, 30, .45);
  backdrop-filter: blur(3px);
  display: grid; place-items: start center;
  padding: 5vh 16px 16px;
  overflow-y: auto;
  opacity: 0; transition: opacity .18s var(--ease);
}
.overlay.show { opacity: 1; }
.modal {
  width: 100%; max-width: 640px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  transform: translateY(-10px) scale(.985);
  opacity: 0;
  transition: transform .2s var(--ease), opacity .2s var(--ease);
}
.overlay.show .modal { transform: none; opacity: 1; }
.modal.sm { max-width: 460px; }
.modal.lg { max-width: 780px; }
.modal.xl { max-width: 1040px; }
.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 20px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 15.5px; font-weight: 600; }
.modal-head .close { margin-inline-start: auto; }
.modal-body { padding: 20px; max-height: 66vh; overflow-y: auto; }
.modal-foot {
  padding: 13px 20px; border-top: 1px solid var(--border);
  background: var(--surface-muted);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  display: flex; gap: 8px;
}
.modal-foot .spacer { flex: 1; }

/* command palette */
.palette { max-width: 600px; }
.palette .modal-body { padding: 0; max-height: 400px; }
.palette-input {
  width: 100%; border: 0; border-bottom: 1px solid var(--border);
  padding: 16px 20px; font-size: 15px; background: none;
}
.palette-input:focus { outline: none; }
.palette-list { padding: 6px; }
.palette-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius); cursor: pointer;
  font-size: 13.5px;
}
.palette-item .where { margin-inline-start: auto; font-size: 11.5px; color: var(--text-faint); }
.palette-item:hover, .palette-item.cursor { background: var(--brand-soft); }
.palette-item svg { color: var(--text-faint); }

/* --------------------------------------------------------------- toasts */
.toasts {
  position: fixed; inset-block-end: 20px; inset-inline-end: 20px;
  z-index: 100; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  min-width: 260px; max-width: 420px;
  padding: 11px 14px;
  background: var(--n-900); color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  animation: toast-in .24s var(--ease);
}
.toast.ok  { background: var(--ok-700); }
.toast.bad { background: var(--bad-700); }
.toast.out { animation: toast-out .2s var(--ease) forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(10px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

/* ------------------------------------------------------------------ misc */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab {
  padding: 9px 14px; font-size: 13.5px; color: var(--text-soft);
  border-bottom: 2px solid transparent; white-space: nowrap; cursor: pointer;
  background: none; border-top: 0; border-inline: 0;
  transition: color .14s var(--ease), border-color .14s var(--ease);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 550; }

.dl { display: grid; grid-template-columns: max-content 1fr; gap: 9px 18px; font-size: 13.5px; }
.dl dt { color: var(--text-faint); font-size: 12.5px; }
.dl dd { color: var(--text); }

.timeline { position: relative; padding-inline-start: 22px; }
.timeline::before {
  content: ""; position: absolute; inset-block: 6px 6px; inset-inline-start: 5px;
  width: 1px; background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item::before {
  content: ""; position: absolute; inset-inline-start: -21px; top: 6px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--brand-400);
}
.timeline-item.done::before { background: var(--ok-500); border-color: var(--ok-500); }
.timeline-when { font-size: 11.5px; color: var(--text-faint); }
.timeline-what { font-size: 13.5px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 99px;
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: 12.5px; cursor: pointer;
}
.chip.on { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }

.alert {
  display: flex; gap: 10px; padding: 12px 14px;
  border-radius: var(--radius); font-size: 13px;
  border: 1px solid transparent;
}
.alert-ok   { background: var(--ok-50);   color: var(--ok-700);   border-color: color-mix(in srgb, var(--ok-500) 28%, transparent); }
.alert-bad  { background: var(--bad-50);  color: var(--bad-700);  border-color: color-mix(in srgb, var(--bad-500) 28%, transparent); }
.alert-warn { background: var(--warn-50); color: var(--warn-700); border-color: color-mix(in srgb, var(--warn-500) 28%, transparent); }
.alert-info { background: var(--info-50); color: var(--info-700); border-color: color-mix(in srgb, var(--info-500) 28%, transparent); }
:root[data-theme="dark"] .alert-ok   { color: #86efac; }
:root[data-theme="dark"] .alert-bad  { color: #fca5a5; }
:root[data-theme="dark"] .alert-warn { color: #fcd34d; }
:root[data-theme="dark"] .alert-info { color: #93c5fd; }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; inset-inline-end: 0; top: calc(100% + 6px);
  min-width: 200px; z-index: 50;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 5px; display: none;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 8px 10px;
  border: 0; background: none; text-align: start;
  border-radius: var(--radius-sm); font-size: 13px; cursor: pointer; color: var(--text);
}
.dropdown-item:hover { background: var(--surface-sunk); }
.dropdown-item.danger { color: var(--bad-500); }
.dropdown-sep { height: 1px; background: var(--border); margin: 5px 0; }
.dropdown-head { padding: 9px 10px 7px; font-size: 12px; color: var(--text-faint); }

/* ---------------------------------------------------------------- login */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr;
  background: var(--surface);
}
.auth-aside {
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(195,154,75,.16), transparent 60%),
    linear-gradient(160deg, var(--brand-900), var(--brand-700));
  color: #fff; padding: 48px; display: flex; flex-direction: column;
  position: relative; overflow: hidden;
}
.auth-aside::after {
  content: ""; position: absolute; inset-inline-end: -120px; bottom: -140px;
  width: 460px; height: 460px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 0 0 60px rgba(255,255,255,.025);
}
.auth-quote { margin-top: auto; max-width: 420px; position: relative; z-index: 1; }
.auth-quote p { font-size: 19px; line-height: 1.8; font-weight: 300; }
.auth-quote cite { display: block; margin-top: 14px; font-size: 13px; color: rgba(255,255,255,.55); font-style: normal; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-box { width: 100%; max-width: 380px; }
.auth-box h1 { font-size: 23px; margin-bottom: 6px; }
.auth-box .sub { color: var(--text-soft); font-size: 13.5px; margin-bottom: 26px; }

/* --------------------------------------------------------- responsive */
.sidebar-backdrop { display: none; }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed; inset-block: 0; right: 0; left: auto; min-height: 0;
    transform: translateX(100%); transition: transform .24s var(--ease);
    box-shadow: var(--shadow-lg);
    visibility: hidden;
  }
  .sidebar-inner { height: 100%; }
  html[dir="ltr"] .sidebar { left: 0; right: auto; transform: translateX(-100%); }
  body.nav-open .sidebar { visibility: visible; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 39;
    background: rgba(17,22,30,.45);
  }
  .search-trigger { min-width: 0; width: 36px; padding: 0; justify-content: center; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}

@media (max-width: 860px) {
  .grid-12 > [class*="col-"] { grid-column: span 6; }
  .grid-12 > .col-12, .grid-12 > .form-section { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .grid-12 > [class*="col-"] { grid-column: 1 / -1; }
  .page { padding: 16px 14px 40px; }
  .topbar { padding: 0 14px; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .hide-sm { display: none !important; }
  .modal-body { max-height: 70vh; }
}
@media (max-width: 860px) { .hide-md { display: none !important; } }
/* The other half of the same idea: a line that appears only where a column
   was hidden, so a phone still shows what the column carried. */
.only-md { display: none; }
@media (max-width: 860px) { .only-md { display: block; font-size: 11.5px; color: var(--text-soft); margin-top: 2px; white-space: normal; } .only-md .lbl { color: var(--text-faint); } }

/* ---------------------------------------------------------------- print */
@media print {
  .sidebar, .topbar, .page-actions, .table-toolbar, .table-foot, .row-actions, .no-print { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .card { border: 0; box-shadow: none; }
  .page { padding: 0; }
  .table thead th { background: #f1f1f1 !important; -webkit-print-color-adjust: exact; }
  .print-head { display: block !important; margin-bottom: 16px; }
}
.print-head { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ================================================================ reports */
/* Printed reports carry the firm's letterhead; on screen the page header
   already says where you are, so the letterhead stays hidden. */
.letterhead {
  display: flex; align-items: flex-start; gap: 20px;
  padding-bottom: 12px; margin-bottom: 14px;
  border-bottom: 2px double var(--n-800);
}
.letterhead-side { flex: 0 0 200px; text-align: end; }
.letterhead-side.start { text-align: start; }
.letterhead-label { font-size: 10pt; color: var(--text-faint); }
.letterhead-office { font-size: 14pt; font-weight: 700; }
.letterhead-owner { font-size: 10pt; color: var(--text-soft); }
.letterhead-middle { flex: 1; text-align: center; }
.letterhead-title {
  display: inline-block;
  font-size: 13pt; font-weight: 700;
  padding: 4px 16px; border-radius: 4px;
  background: #fff7cc; border: 1px solid #e6d27a;   /* the old report's highlight */
  box-shadow: 2px 2px 0 rgba(0, 0, 0, .12);
}
.letterhead-sub { font-size: 10pt; color: var(--text-soft); margin-top: 6px; }

.print-foot {
  display: none;
  justify-content: space-between; gap: 16px;
  margin-top: 16px; padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 9pt; color: var(--text-soft);
}

.report-note {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 14px; margin-bottom: 14px;
  border-radius: var(--radius);
  background: var(--warn-50); color: var(--warn-700);
  border: 1px solid color-mix(in srgb, var(--warn-500) 28%, transparent);
  font-size: 13px;
}
:root[data-theme="dark"] .report-note { color: #fcd34d; }

/* A grouping band inside the table, the way the old report banded by client. */
.report-table .group-row td {
  padding: 9px 14px;
  background: var(--surface-sunk);
  border-top: 2px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
}
.report-table .group-row:first-child td { border-top: 0; }
.report-table .group-row:hover td { background: var(--surface-sunk); }
.report-group-label {
  display: inline-block; margin-inline-end: 9px;
  font-size: 11.5px; color: var(--text-faint);
  padding: 2px 8px; border-radius: 4px;
  background: var(--surface); border: 1px solid var(--border);
}
.report-group-name { font-size: 14.5px; font-weight: 650; margin-inline-end: 9px; }

.report-table { font-size: 13px; }
.report-table td { vertical-align: top; }
.report-table .day-cell { background: #fffbe6; font-weight: 550; }
:root[data-theme="dark"] .report-table .day-cell { background: rgba(195, 154, 75, .12); }
.report-table .subject { color: var(--text-soft); line-height: 1.6; }
.report-table .circle {
  display: block; font-size: 11px; color: var(--text-faint);
  margin-top: 2px; padding-top: 2px; border-top: 1px dotted var(--border-strong);
}

@media print {
  .print-foot { display: flex; }
  .report-note { display: none; }
  .report-table .group-row { break-after: avoid; break-inside: avoid; }
  .report-table .group-row td { background: #ededed !important; -webkit-print-color-adjust: exact; }
  .report-table tr { break-inside: avoid; }
  .report-table thead { display: table-header-group; }   /* repeat on every page */
  .report-table .day-cell { -webkit-print-color-adjust: exact; }
  .letterhead-title { -webkit-print-color-adjust: exact; }
  .table-wrap { overflow: visible; }
}

/* The overdue strip on the dashboard: loud on purpose, and absent when the
   office is clear. */
.alert-strip { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 18px; }
.alert-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px 8px 10px;
  border-radius: 99px;
  background: var(--bad-50);
  border: 1px solid color-mix(in srgb, var(--bad-500) 32%, transparent);
  color: var(--bad-700);
  font-size: 13px; font-weight: 500;
  transition: background .15s var(--ease), transform .06s var(--ease);
}
.alert-chip:hover { background: color-mix(in srgb, var(--bad-500) 16%, transparent); }
.alert-chip:active { transform: translateY(.5px); }
.alert-chip-count {
  min-width: 22px; height: 22px; padding: 0 6px;
  display: grid; place-items: center;
  border-radius: 99px;
  background: var(--bad-500); color: #fff;
  font-size: 12px; font-weight: 700;
}
:root[data-theme="dark"] .alert-chip { color: #fca5a5; }
@media print { .alert-strip { display: none; } }

/* ================================================================= agenda */
.agenda-tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  margin-bottom: 16px; padding-bottom: 2px;
}
.agenda-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text-soft);
  font-size: 13px; white-space: nowrap;
  transition: border-color .14s var(--ease), background .14s var(--ease), color .14s var(--ease);
}
.agenda-tab:hover { border-color: var(--n-300); color: var(--text); }
.agenda-tab.active {
  background: var(--brand-700); border-color: var(--brand-700); color: #fff; font-weight: 500;
}
:root[data-theme="dark"] .agenda-tab.active { background: var(--brand-500); border-color: var(--brand-500); }
.agenda-tab.empty { opacity: .55; }
.agenda-tab-count {
  min-width: 20px; padding: 0 6px;
  border-radius: 99px; background: var(--surface-sunk);
  font-size: 11.5px; font-weight: 600;
}
.agenda-tab.active .agenda-tab-count { background: rgba(255, 255, 255, .22); color: #fff; }

.agenda-day { margin-bottom: 12px; overflow: hidden; }
.agenda-day.is-empty { opacity: .55; }
.agenda-day-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
}
.agenda-day-head .spacer { flex: 1; }
.agenda-day-name { font-size: 14.5px; font-weight: 650; }
.agenda-day-date { font-size: 12.5px; color: var(--text-faint); }
.agenda-day-empty { padding: 16px; font-size: 12.5px; color: var(--text-faint); }

.agenda-table { font-size: 12.5px; }
.agenda-table td { vertical-align: top; padding: 8px 10px; }
.agenda-table th { padding: 8px 10px; }
.agenda-table .soft { color: var(--text-soft); line-height: 1.6; }

@media print {
  .agenda-day { break-inside: auto; margin-bottom: 8px; border: 0; }
  .agenda-day.is-empty { display: none; }   /* a blank day wastes a printed line */
  .agenda-day-head { break-after: avoid; background: #ededed !important; -webkit-print-color-adjust: exact; }
  .agenda-table tr { break-inside: avoid; }
  .agenda-table thead { display: table-header-group; }
  .agenda-table { font-size: 8.5pt; }
}

/* A fieldset that only exists to disable a locked form; it takes no box. */
fieldset.contents { display: contents; border: 0; margin: 0; padding: 0; min-width: 0; }

/* ------------------------------------------------------------ printed pages */
.letterhead-logo { max-height: 64px; max-width: 160px; object-fit: contain; display: block; margin-inline-start: auto; margin-bottom: 4px; }
.letterhead-side.start .letterhead-logo { margin-inline-start: 0; }
body.print-page { background: #eef0f3; }
.print-page .print-head { display: block; margin-bottom: 14px; }
.print-toolbar { position: sticky; top: 0; z-index: 5; display: flex; gap: 8px; justify-content: center; padding: 10px; background: #fff; border-bottom: 1px solid var(--border); }
.print-sheet { background: #fff; color: #111; width: 210mm; min-height: 297mm; margin: 16px auto; padding: 14mm 12mm; box-shadow: 0 2px 12px rgba(0,0,0,.08); }
.print-sheet.landscape { width: 297mm; min-height: 210mm; }
.print-sheet .print-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 8px; border-top: 1px solid #ccc; font-size: 9pt; color: #555; }
.voucher { border: 1.5px solid #222; border-radius: 6px; padding: 14px 16px; }
.voucher + .voucher { margin-top: 18mm; }
.voucher-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px dashed #999; padding-bottom: 8px; margin-bottom: 10px; }
.voucher-title { font-size: 15pt; font-weight: 700; }
.voucher-no { font-size: 12pt; }
.voucher-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; }
.voucher-row { display: flex; gap: 8px; border-bottom: 1px dotted #bbb; padding: 4px 0; }
.voucher-row.full { grid-column: 1 / -1; }
.voucher-label { color: #555; min-width: 96px; }
.voucher-value { font-weight: 600; }
.voucher-amount { font-size: 16pt; font-weight: 700; }
.voucher-words { background: #f5f5f5; border-radius: 4px; padding: 6px 10px; margin-top: 8px; }
.voucher-signs { display: flex; justify-content: space-between; margin-top: 26px; font-size: 10pt; }
.voucher-signs > div { text-align: center; min-width: 150px; border-top: 1px solid #333; padding-top: 4px; }
.sheet-table { width: 100%; border-collapse: collapse; font-size: 10pt; }
.sheet-table th, .sheet-table td { border: 1px solid #999; padding: 4px 6px; text-align: start; vertical-align: top; }
.sheet-table th { background: #eee; font-weight: 600; }
.sheet-table tfoot td { font-weight: 700; background: #f5f5f5; }
.sheet-group { background: #f0f0f0; font-weight: 700; }
@media print {
  body.print-page { background: #fff; }
  .print-sheet { width: auto; min-height: 0; margin: 0; padding: 0; box-shadow: none; }
}

/* ================================================================ polish v2
   Data-dense office screens: compact rows by default (the density toggle
   switches to "comfortable" and is remembered per browser), sticky headers,
   truncated long names with a tooltip, filter chips, and phone layouts.
   ========================================================================= */
.nowrap { white-space: nowrap; }
/* Several short lines inside one cell of a dense table (a case and its parties). */
.cell-lines { font-size: 11.5px; line-height: 1.65; color: var(--text-soft); white-space: normal; }
.cell-lines b { font-weight: 600; color: var(--text); }
.cell-lines .vs { color: var(--text-faint); }
.truncate {
  display: inline-block; max-width: 100%; vertical-align: bottom;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kbd, kbd.kbd {
  font-family: var(--font-num); font-size: 10.5px; line-height: 1;
  padding: 3px 5px; border-radius: 4px;
  border: 1px solid var(--border-strong); background: var(--surface-sunk); color: var(--text-faint);
}
.btn-primary .kbd { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.25); color: #fff; }

/* --- tables: compact by default ---------------------------------------- */
.table { font-size: 13px; }
.table tbody td { padding: 6px 12px; line-height: 1.5; }
.table thead th { padding: 8px 12px; font-size: 11.5px; }
.table .cell-title { font-weight: 600; white-space: nowrap; }
.table td .truncate { max-width: 240px; }
.table td.cell-wide .truncate { max-width: 340px; }
.table .row-actions { opacity: .55; gap: 0; }
.table .row-actions .btn-sm.btn-icon { width: 28px; height: 28px; }
.table tbody tr:focus-within .row-actions { opacity: 1; }
html[data-density="comfortable"] .table { font-size: 13.5px; }
html[data-density="comfortable"] .table tbody td { padding: 11px 14px; line-height: 1.6; }
html[data-density="comfortable"] .table thead th { padding: 10px 14px; }
html[data-density="comfortable"] .table td .truncate { max-width: 360px; }

/* Sticky header: the list scrolls inside its card so the header stays put. */
.table-wrap.scroll-y { max-height: calc(100vh - var(--topbar-h) - 190px); min-height: 240px; overflow: auto; }
.table-wrap.scroll-y thead th { position: sticky; top: 0; z-index: 2; box-shadow: inset 0 -1px 0 var(--border); }

/* A locked record: a small muted padlock by its reference, not a button. */
.lock-mark { display: inline-flex; vertical-align: -2px; margin-inline-start: 5px; color: var(--text-faint); opacity: .7; }
.lock-mark .icon { width: 12px; height: 12px; }

.money-zero { color: var(--text-faint); }

/* --- toolbar: search, filters, chips ------------------------------------ */
.table-toolbar { padding: 10px 12px; gap: 8px; }
.table-toolbar .field { min-width: 140px !important; }
.table-toolbar .select, .table-toolbar .input { min-height: 34px; padding-block: 5px; font-size: 13px; }
.table-toolbar .tools { margin-inline-start: auto; display: flex; gap: 6px; align-items: center; }
.density-toggle { height: 34px; width: 34px; }
.select.is-set { border-color: var(--brand-400); background-color: var(--brand-soft); color: var(--brand); font-weight: 500; }

.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 0 12px 10px; }
.filter-chips:empty { display: none; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 4px 2px 10px; border-radius: 99px;
  background: var(--brand-soft); color: var(--brand);
  border: 1px solid color-mix(in srgb, var(--brand-500) 25%, transparent);
  font-size: 12px;
}
.filter-chip button {
  width: 18px; height: 18px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: none; color: inherit; cursor: pointer;
}
.filter-chip button:hover { background: color-mix(in srgb, var(--brand-500) 18%, transparent); }
.filter-chips .clear-all { border: 0; background: none; color: var(--text-soft); font-size: 12px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* --- empty states -------------------------------------------------------- */
.empty { padding: 44px 24px; }
.empty .empty-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* --- page head ----------------------------------------------------------- */
.page-head { align-items: center; margin-bottom: 16px; }
.page-title { font-size: 20px; }
.quick-links .btn { gap: 6px; }

/* --- forms: check rows, switch grid, permission tree --------------------- */
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--brand-600); margin: 0; flex: none; }
.check-row { display: flex; flex-wrap: wrap; gap: 10px 22px; padding: 6px 0; }
.switch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px 18px; }
.input-group .addon-btn { cursor: pointer; gap: 6px; display: inline-flex; align-items: center; white-space: nowrap; }
.input-group .addon-btn:hover { color: var(--text); }

.perm-tree { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-muted); }
.perm-tree-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.perm-tree-bar .spacer { flex: 1; }
.perm-filter { max-width: 220px; min-height: 32px; padding-block: 4px; }
.perm-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; padding: 12px; align-items: start; }
.perm-group { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 8px 12px 10px; margin: 0; min-width: 0; display: grid; gap: 6px; align-content: start; }
.perm-group[hidden] { display: none; }
.perm-group legend { display: flex; align-items: center; gap: 8px; width: 100%; padding: 4px 0 6px; border-bottom: 1px dashed var(--border); margin-bottom: 2px; float: left; }
.perm-group legend .check { font-weight: 600; color: var(--brand); }
.perm-group legend .icon { width: 15px; height: 15px; }
.perm-count { margin-inline-start: auto; font-size: 11px; color: var(--text-faint); }
.perm-group .check[hidden] { display: none; }
.perm-tree.all-on .perm-groups { opacity: .5; pointer-events: none; }
.perm-role-note { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; padding: 8px 12px; font-size: 12px; line-height: 1.8; color: var(--brand-600); background: var(--brand-soft); border-radius: var(--radius); }
.perm-role-note svg { flex: none; margin-top: 3px; }
.perm-everything-note { display: none; margin: 0; padding: 8px 12px; font-size: 12px; line-height: 1.8; color: var(--warn-700, #92400e); background: var(--warn-50, #fdf3e0); border-bottom: 1px solid var(--border); }
.perm-tree.all-on .perm-everything-note { display: block; }
/* A group whose own "all" is on: the ticks below belong to that switch. */
.perm-governed { display: none; margin: 0 0 2px; font-size: 11px; line-height: 1.7; color: var(--warn-700, #92400e); background: var(--warn-50, #fdf3e0); border-radius: 8px; padding: 5px 8px; }
.perm-group.is-all .perm-governed { display: block; }
.perm-group.is-all .check[data-perm-item] { opacity: .55; }

.logo-picker { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.logo-preview {
  width: 180px; height: 96px; flex: none; display: grid; place-items: center;
  border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-muted);
  background-image: linear-gradient(45deg, var(--surface-sunk) 25%, transparent 25%, transparent 75%, var(--surface-sunk) 75%);
  background-size: 14px 14px;
}
.logo-preview img { max-width: 160px; max-height: 80px; object-fit: contain; }
.backup-figure { font-size: 22px; font-weight: 650; margin-bottom: 6px; }
.backup-figure .muted { font-size: 13px; font-weight: 400; color: var(--text-faint); }

/* --- command palette with record results --------------------------------- */
.palette .modal-body { max-height: 70vh; }
.palette-group { padding: 8px 12px 4px; font-size: 11.5px; font-weight: 600; color: var(--text-faint); display: flex; align-items: center; gap: 6px; }
.palette-item .meta { display: block; font-size: 11.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-item .body { min-width: 0; flex: 1; }
.palette-item .title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-hint { padding: 8px 14px; font-size: 11.5px; color: var(--text-faint); border-top: 1px solid var(--border); display: flex; gap: 14px; flex-wrap: wrap; }
.palette-loading { padding: 10px 14px; font-size: 12px; color: var(--text-faint); }

/* --- toasts --------------------------------------------------------------- */
.toast { gap: 9px; }
.toast .icon { width: 16px; height: 16px; flex: none; }

/* --- client portal --------------------------------------------------------- */
body.portal { background: var(--bg); }
.portal-bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; background: var(--brand-900); color: #fff;
}
.portal-logo { max-height: 38px; max-width: 110px; object-fit: contain; background: #fff; border-radius: 6px; padding: 2px 4px; }
.portal-office { font-weight: 600; font-size: 14px; line-height: 1.4; }
.portal-sub { font-size: 11.5px; color: rgba(255,255,255,.55); }
.portal-bar .btn-ghost { color: rgba(255,255,255,.8); }
.portal-bar .btn-ghost:hover { background: rgba(255,255,255,.1); color: #fff; }
.portal-main { max-width: 1040px; margin: 0 auto; padding: 22px 18px 48px; }
.auth.auth-single { grid-template-columns: 1fr; background: var(--bg); }
.auth-single .auth-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px 24px; box-shadow: var(--shadow-sm); }

/* --- dashboard ------------------------------------------------------------- */
.dash-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }

/* --- phones ---------------------------------------------------------------- */
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
}
/* ------------------------------------------------- الكتابة على الآيفون
   Safari يكبّر الصفحة عند الكتابة في أي حقل خطه أصغر من 16px، وبعد التكبير
   تخرج الصفحة عن الشاشة ويظهر تمرير جانبي. القاعدة عتبة في المتصفح، لا ذوق:
   كل حقل يُكتب فيه على الهاتف لا ينزل عن 16px. */
@media (max-width: 860px) {
  .input, .select, .textarea,
  input[type="text"], input[type="search"], input[type="password"],
  input[type="number"], input[type="email"], input[type="tel"],
  input[type="date"], input[type="time"], textarea, select { font-size: 16px; }
  .input, .select, .textarea { min-height: 42px; }
}

@media (max-width: 640px) {
  html, body { overflow-x: hidden; }
  .page-head { gap: 10px; }
  .page-actions { margin-inline-start: 0; width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 11px 12px; gap: 9px; }
  .stat-icon { width: 30px; height: 30px; }
  .stat-value { font-size: 18px; }
  .stat-meta { display: none; }
  .table-toolbar .table-search { max-width: none; min-width: 100%; }
  .table-toolbar .field { flex: 1 1 45%; min-width: 0 !important; }
  .table-toolbar .tools { margin-inline-start: 0; }
  .table-wrap.scroll-y { max-height: none; overflow-x: auto; }
  /* Wide lists scroll sideways with the first column pinned. */
  .table-wrap .table { min-width: 560px; }
  .table-wrap .table th:first-child,
  .table-wrap .table td:first-child {
    position: sticky; inset-inline-start: 0; z-index: 1;
    background: var(--surface); box-shadow: inset -1px 0 0 var(--border);
  }
  .table-wrap .table thead th:first-child { z-index: 3; background: var(--surface-muted); }
  .table td .truncate { max-width: 170px; }
  .table .row-actions { opacity: 1; }
  .quick-links .btn { flex: 1 1 40%; }
  .quick-links .kbd { display: none; }
  .toasts { inset-inline: 12px; inset-block-end: 12px; }
  .toast { min-width: 0; max-width: none; }
  .crumbs { overflow: hidden; }
  .crumbs > *:not(:first-child):not(:last-child) { display: none; }
  .portal-main { padding: 16px 12px 40px; }
}
@media print {
  .table-wrap.scroll-y { max-height: none; overflow: visible; }
  .filter-chips, .density-toggle { display: none !important; }
}

/* Compact lists keep every row on one line; a cell that overflows gets its
   full text as a tooltip (app.js), and "مريح" lets long cells wrap again. */
html:not([data-density="comfortable"]) .table-wrap.scroll-y .table td {
  white-space: nowrap; max-width: 250px; overflow: hidden; text-overflow: ellipsis;
}
/* The actions column stays in view when a wide list scrolls sideways. */
.table-wrap.scroll-y .table thead th:last-child,
.table-wrap.scroll-y .table tbody td:last-child {
  position: sticky; inset-inline-end: 0; z-index: 1;
  background: var(--surface); box-shadow: inset 1px 0 0 var(--border);
}
.table-wrap.scroll-y .table thead th:last-child { z-index: 3; background: var(--surface-muted); }
.table-wrap.scroll-y .table tbody tr:hover td:last-child { background: var(--surface-muted); }
html:not([data-density="comfortable"]) .table-wrap.scroll-y .table td br { display: none; }
html:not([data-density="comfortable"]) .table-wrap.scroll-y .table td.end { overflow: visible; }
/* Nested dashboard columns must shrink too, or a wide table pushes the page sideways. */
.dash-grid > .grid, .dash-grid > * { min-width: 0; grid-template-columns: minmax(0, 1fr); }
@media (max-width: 640px) {
  .table-wrap.scroll-y .table td { max-width: 210px; }
  .card .table-wrap { max-width: 100%; }
}

/* The actions column takes exactly the width of its icons — a fixed width let
   five or six icons spill over the column beside it. */
.table th.col-actions, .table tbody td:last-child { width: 1%; white-space: nowrap; }
.table .row-actions { flex-wrap: nowrap; }
/* On a phone a row keeps its first two actions (the record's own page first);
   the rest stay one tap away inside that page, and the name gets the room. */
@media (max-width: 640px) {
  .table .row-actions > :nth-child(n+3) { display: none; }
}
/* Long names are clipped (the full text is in the tooltip) so a ten-column list
   fits a laptop screen instead of hiding its last columns behind the scroll. */
html:not([data-density="comfortable"]) .table-wrap.scroll-y .table td { max-width: 180px; }
@media (max-width: 1500px) {
  html:not([data-density="comfortable"]) .table-wrap.scroll-y .table td { max-width: 150px; }
}
@media (max-width: 1500px) { .hide-lg { display: none !important; } }

/* Sidebar sections open one at a time and fold with a short slide, so the
   eye follows which section closed instead of the list jumping. */
.nav-items {
  display: block; overflow: hidden; max-height: 0; opacity: 0;
  padding-block: 0; transition: max-height .24s var(--ease), opacity .18s var(--ease), padding .24s var(--ease);
}
.nav-group.open .nav-items { max-height: 720px; opacity: 1; padding-block: 2px 6px; }
.chev { transition: transform .2s var(--ease); }
@media (prefers-reduced-motion: reduce) { .nav-items, .chev { transition: none; } }

/* The menu button opens the sidebar only where the sidebar folds away
   (the same 900px as above); on a desktop the sidebar is always there.
   It used to carry .hide-md, which hides under 860px — so phones, the only
   screens that need it, never saw it. */
.nav-toggle { display: none; }
@media (max-width: 900px) { .topbar .nav-toggle { display: grid; } }

/* ------------------------------------------------- dashboard date window */
.dfilter { position: relative; display: inline-flex; align-items: center; gap: 4px; }
.dfilter-step, .dfilter-main, .dfilter-today {
  height: 42px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  text-decoration: none; font: inherit; cursor: pointer; transition: background .13s var(--ease), border-color .13s var(--ease);
}
.dfilter-step { width: 38px; border-radius: var(--radius); color: var(--text-soft); }
.dfilter-step:hover { background: var(--surface-muted); color: var(--text); border-color: var(--border-strong); }
.dfilter-step:active { transform: translateY(1px); }
.dfilter-main { gap: 10px; padding: 0 14px; border-radius: var(--radius); min-width: 190px; }
.dfilter-main:hover { background: var(--surface-muted); border-color: var(--border-strong); }
.dfilter-main .icon:first-child { color: var(--accent); }
.dfilter-text { display: grid; text-align: start; line-height: 1.25; }
.dfilter-text b { font-size: 13.5px; font-weight: 600; }
.dfilter-text small { font-size: 11px; color: var(--text-faint); }
.dfilter-today { padding: 0 14px; border-radius: var(--radius); font-size: 13px; font-weight: 600; color: var(--brand); }
.dfilter-today:hover { background: var(--brand-soft); }
.dfilter.open .dfilter-main { border-color: var(--brand-500, #3b5998); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500, #3b5998) 16%, transparent); }

.dfilter-pop {
  position: absolute; top: calc(100% + 8px); inset-inline-start: 0; z-index: 45; width: 340px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 12px; animation: dfilterIn .14s var(--ease);
}
@keyframes dfilterIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.dfilter-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.dfilter-preset {
  padding: 9px 10px; border-radius: 10px; font-size: 13px; text-align: center; text-decoration: none;
  color: var(--text); background: var(--surface-muted); border: 1px solid transparent;
}
.dfilter-preset:hover { background: var(--surface-sunk); }
.dfilter-preset.on { background: var(--brand); color: #fff; }
/* Two dates side by side, and the button on its own row: three columns never
   fitted the popover, so the button spilled outside it. */
/* One day, which is what the office asks for most, then the range under it. */
.dfilter-one { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.dfilter-one .btn { height: 38px; white-space: nowrap; }
.dfilter-or { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; color: var(--text-faint); font-size: 11.5px; }
.dfilter-or::before, .dfilter-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.dfilter-custom { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: end; margin-top: 10px; }
.dfilter-custom .btn { grid-column: 1 / -1; justify-content: center; }
.dfilter-field { min-width: 0; }
.dfilter-field label { display: block; font-size: 11.5px; color: var(--text-soft); margin-bottom: 4px; }
.dfilter-field input { width: 100%; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 0 10px; font: inherit; font-size: 13px; }
.dfilter-field input:focus { outline: none; border-color: var(--brand-500, #3b5998); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500, #3b5998) 16%, transparent); }
.dfilter-custom .btn { height: 38px; }
.dfilter-note { margin: 10px 2px 0; font-size: 11.5px; color: var(--text-faint); }

@media (max-width: 640px) {
  .dfilter { width: 100%; }
  .dfilter-main { flex: 1; min-width: 0; }
  .dfilter-pop { width: min(340px, calc(100vw - 28px)); inset-inline-start: auto; inset-inline-end: 0; }
}

/* ------------------------------------------------- "الدخول كـ" (impersonation) */
.imp-back-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px;
  border-radius: var(--radius); cursor: pointer; font: inherit; text-align: start;
  background: var(--warn-50); color: var(--warn-700);
  border: 1px solid color-mix(in srgb, var(--warn-500) 45%, transparent);
  transition: background .13s var(--ease);
}
.imp-back-btn:hover { background: color-mix(in srgb, var(--warn-500) 18%, var(--surface)); }
.imp-back-text { display: grid; line-height: 1.2; }
.imp-back-text small { font-size: 10.5px; opacity: .85; }
.imp-back-text b { font-size: 12.5px; font-weight: 700; }
:root[data-theme="dark"] .imp-back-btn { color: #fcd34d; background: color-mix(in srgb, var(--warn-500) 18%, transparent); }
/* A hairline across the top says the session belongs to someone else. */
body.is-impersonating .topbar { box-shadow: inset 0 3px 0 var(--warn-500); }
@media (max-width: 860px) { .imp-back-text small { display: none; } }
@media (max-width: 640px) { .imp-back-text { display: none; } .imp-back-btn { padding: 0 10px; } }

/* ------------------------------------- adding an option from inside a picker */
.picker-add {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 12px;
  border: 0; border-top: 1px solid var(--border); background: var(--surface-muted);
  color: var(--brand); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-align: start;
  position: sticky; bottom: 0;
}
.picker-add:hover { background: var(--brand-soft); }
.picker-new { padding: 12px; display: grid; gap: 10px; }
.picker-new-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text); }
.picker-new-head b { font-weight: 700; }
.picker-new-field { display: grid; gap: 4px; }
.picker-new-field span { font-size: 11.5px; color: var(--text-soft); }
.picker-new-field input, .picker-new-field select {
  height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); padding: 0 10px; font: inherit; font-size: 13.5px; width: 100%;
}
.picker-new-field input:focus, .picker-new-field select:focus {
  outline: none; border-color: var(--brand-500, #3b5998);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-500, #3b5998) 16%, transparent);
}
.picker-new-note { margin: 0; font-size: 11.5px; color: var(--text-faint); display: flex; align-items: center; gap: 6px; }
.picker-new-foot { display: flex; gap: 6px; justify-content: flex-end; }
.picker-similar { border-top: 1px dashed var(--border-strong); margin-top: 4px; padding-top: 10px; display: grid; gap: 6px; }
.picker-similar > p { display: flex; align-items: flex-start; gap: 6px; margin: 0 0 2px; font-size: 12.5px; color: var(--warn-700); }
:root[data-theme="dark"] .picker-similar > p { color: #fcd34d; }
.picker-similar-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 13px; cursor: pointer; text-align: start;
}
.picker-similar-item:hover { border-color: var(--ok-500); background: var(--ok-50); }
.picker-similar-item span { margin-inline-start: auto; font-size: 11.5px; color: var(--text-faint); white-space: nowrap; }
.picker-similar [data-force] { justify-self: start; }

/* A plain select whose options live in a table: "+" sits against the field,
   and the add form floats under it, so nothing moves on the page. */
.select-add { position: relative; display: flex; align-items: stretch; gap: 6px; }
.select-add > .select, .select-add > select { flex: 1; min-width: 0; }
.select-add-btn {
    flex: 0 0 auto; width: 36px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--brand-600); cursor: pointer; display: grid; place-items: center;
    transition: background .15s, border-color .15s, color .15s;
}
.select-add-btn:hover { background: var(--brand-soft); border-color: var(--brand-500); }
.select-add-btn svg { width: 15px; height: 15px; }
.picker-new.floating {
    /* Pinned to the viewport: the field may sit inside a table that scrolls,
       and a panel clipped by it would be no help at all. */
    position: fixed; z-index: 120; width: min(320px, 90vw);
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

/* ------------------------------------------------------- بوابة الموقع (GPS)
   الصفحة الوحيدة التي يراها الموظف قبل أن يقول جهازه أين هو. */
.geo-gate {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(800px 420px at 50% -10%, var(--brand-soft), transparent 70%),
    var(--bg);
}
.geo-card {
  width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 32px 28px; text-align: center;
  box-shadow: 0 18px 50px rgba(16, 24, 40, .10);
}
.geo-brand { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--text-soft); font-weight: 600; font-size: 14px; }
.geo-brand img { max-height: 34px; max-width: 110px; object-fit: contain; }
.geo-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: #fff; }
.geo-pin {
  margin: 22px auto 14px; width: 68px; height: 68px; border-radius: 50%;
  display: grid; place-items: center; color: var(--brand);
  background: var(--brand-soft); box-shadow: 0 0 0 10px var(--brand-soft);
  animation: geo-beat 2s ease-in-out infinite;
}
.geo-pin.on { color: var(--ok-500); background: var(--ok-50); box-shadow: 0 0 0 10px var(--ok-50); animation: none; }
@keyframes geo-beat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .geo-pin { animation: none; } }
.geo-card h1 { font-size: 21px; font-weight: 700; margin: 0 0 8px; color: var(--text); }
.geo-lead { color: var(--text-soft); font-size: 14px; line-height: 1.9; margin: 0 0 18px; }
.geo-state {
  display: flex; flex-direction: column; gap: 6px; text-align: start;
  background: var(--surface-muted); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-size: 13px; line-height: 1.85;
}
.geo-state[hidden] { display: none; }
.geo-state.geo-bad { border-color: color-mix(in srgb, var(--bad-500) 32%, transparent); background: var(--bad-50); color: var(--bad-700); }
.geo-state.geo-ok { border-color: color-mix(in srgb, var(--ok-500) 32%, transparent); background: var(--ok-50); color: var(--ok-700); flex-direction: row; align-items: center; gap: 8px; }
.geo-state ul { margin: 4px 0 0; padding-inline-start: 18px; }
.geo-state li { margin-bottom: 4px; }
.geo-state[data-geo-state="asking"] { flex-direction: row; align-items: center; gap: 10px; }
.geo-spin {
  width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--brand);
  animation: geo-spin .8s linear infinite;
}
@keyframes geo-spin { to { transform: rotate(360deg); } }
.geo-actions { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.geo-foot { margin: 20px 0 0; font-size: 12px; color: var(--text-faint); line-height: 1.8; }
.geo-actions .btn { height: 42px; padding: 0 18px; font-size: 14px; }
:root[data-theme="dark"] .geo-state.geo-bad { color: #fca5a5; }
:root[data-theme="dark"] .geo-state.geo-ok { color: #86efac; }

/* --------------------------------------------------- بوابة تثبيت التطبيق
   تُرسم مع الصفحة وتبقى مخفية، ويكشفها data-install على <html> قبل الرسم. */
.install-gate { display: none; }
:root[data-install="required"] .install-gate {
  display: grid; place-items: center; position: fixed; inset: 0; z-index: 9999;
  padding: 24px 16px; overflow: auto;
  background:
    radial-gradient(800px 420px at 50% -10%, var(--brand-soft), transparent 70%),
    var(--bg);
}
/* ولا يُرسم خلفها شيء: لا الواجهة ولا الشات ولا الحوارات. */
:root[data-install="required"] body > .app,
:root[data-install="required"] body > .chat-dock,
:root[data-install="required"] body > .toasts { display: none !important; }
:root[data-install="required"] body { overflow: hidden; }

.install-card {
  width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 30px 28px; text-align: center;
  box-shadow: 0 18px 50px rgba(16, 24, 40, .10);
}
.install-brand { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--text-soft); font-weight: 600; font-size: 14px; }
.install-brand img { max-height: 34px; max-width: 110px; object-fit: contain; }
.install-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: #fff; }
.install-icon { display: block; margin: 20px auto 14px; border-radius: 18px; box-shadow: 0 8px 22px rgba(16, 24, 40, .18); }
.install-card h1 { font-size: 21px; font-weight: 700; margin: 0 0 8px; color: var(--text); }
.install-lead { color: var(--text-soft); font-size: 14px; line-height: 1.9; margin: 0 0 18px; }

.install-state {
  display: flex; flex-direction: column; gap: 8px; text-align: start;
  background: var(--surface-muted); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px; margin-bottom: 16px; font-size: 13.5px; line-height: 1.9;
}
.install-state[hidden] { display: none; }
.install-state[data-install-state="ready"] { align-items: center; text-align: center; }
.install-state ol { margin: 0; padding-inline-start: 20px; color: var(--text-soft); }
.install-state li { margin-bottom: 6px; }
.install-state li b { color: var(--text); }
.install-state .icon { vertical-align: -3px; }
.install-note { font-size: 12.5px; color: var(--text-faint); }
.install-state.install-bad { border-color: color-mix(in srgb, var(--bad-500) 32%, transparent); background: var(--bad-50); color: var(--bad-700); }
.install-state.install-ok { border-color: color-mix(in srgb, var(--ok-500) 32%, transparent); background: var(--ok-50); color: var(--ok-700); flex-direction: row; align-items: center; }
:root[data-theme="dark"] .install-state.install-bad { color: #fca5a5; }
:root[data-theme="dark"] .install-state.install-ok { color: #86efac; }
.install-actions { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.install-state[data-install-state="ready"] .btn { height: 44px; padding: 0 22px; font-size: 15px; }

/* ---------------------------------------------- صفّ ترويسة الرئيسية
   الساعة والفلتر وزر الإجراءات على سطر واحد، فارتفاعهم واحد وحوافّهم واحدة.
   كان كلٌّ منها يقرر ارتفاعه بنفسه فبدا الصف مكسورًا. */
.quick-links { --row-h: 54px; align-items: center; }
.quick-links .clock,
.quick-links .dfilter-step,
.quick-links .dfilter-main,
.quick-links .dfilter-today,
.quick-links .qa-btn { height: var(--row-h); border-radius: 13px; }
.quick-links .dfilter-step { width: var(--row-h); }

/* ------------------------------------------------------------ ساعة المكتب
   بتوقيت القاهرة مهما كان الجهاز — وبعقاربها، تُقرأ بالنظرة قبل الأرقام. */
.clock {
  display: inline-flex; align-items: center; gap: 11px;
  padding: 0 16px 0 4px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface), var(--surface-muted));
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  white-space: nowrap;
}

.clock-dial { width: 44px; height: 44px; flex: none; overflow: visible; }
.clock-rim {
  fill: var(--surface);
  stroke: var(--border-strong); stroke-width: 2.5;
}
:root[data-theme="dark"] .clock-rim { fill: var(--surface-sunk); }

.clock-ticks line { stroke: var(--text-faint); stroke-width: 2.4; stroke-linecap: round; opacity: .55; }
.clock-ticks line.is-quarter { stroke: var(--text-soft); stroke-width: 3.4; opacity: 1; }

/* العقارب تدور حول مركز القرص، لا حول ركن الصندوق. */
.clock-hand { transform-origin: 50px 50px; transform-box: view-box; }
.clock-hand line { stroke-linecap: round; }
.clock-hand-hour line { stroke: var(--text); stroke-width: 6; }
.clock-hand-minute line { stroke: var(--text); stroke-width: 4.2; }
.clock-hand-second line { stroke: var(--accent); stroke-width: 2.2; }
.clock-hand-hour, .clock-hand-minute { transition: transform .4s cubic-bezier(.4, 2.1, .55, 1); }
/* الثانية تقفز قفزة حيّة كعقرب حقيقي. */
.clock-hand-second { transition: transform .18s cubic-bezier(.3, 2.6, .5, 1); }
@media (prefers-reduced-motion: reduce) { .clock-hand { transition: none; } }

.clock-cap { fill: var(--text); }
.clock-cap-dot { fill: var(--accent); }

/* الوقت يُقرأ من اليسار إلى اليمين — 1:08:02 ص — حتى داخل صفحة عربية:
   بغير ذلك يقلب الاتجاهُ الثوانيَ وعلامةَ الصباح فيصير "ص 02: 1:08". */
.clock-face { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.clock-face b {
  font-size: 20px; font-weight: 700; color: var(--text); line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: .4px;
  display: flex; align-items: baseline; gap: 0;
  direction: ltr; justify-content: flex-start;
}
/* الثواني أهدأ من الساعة والدقيقة، و«ص/م» علامة لا رقم. */
.clock-face b i { font-style: normal; font-size: 12px; font-weight: 600; color: var(--text-faint); }
.clock-face b em {
  font-style: normal; font-size: 11px; font-weight: 700; color: var(--accent);
  margin-inline-start: 5px; letter-spacing: 0;
}
.clock-face small { font-size: 11.5px; color: var(--text-soft); letter-spacing: .1px; }

@media (max-width: 1100px) {
  .quick-links { --row-h: 46px; }
  .clock { padding: 0 13px 0 7px; gap: 9px; }
  .clock-dial { width: 34px; height: 34px; }
  .clock-face b { font-size: 17px; }
  .clock-face b i { font-size: 11px; }
  .clock-face small { font-size: 10.5px; }
}
@media (max-width: 560px) {
  .clock { flex: 1 1 auto; justify-content: center; }
}

/* ------------------------------------------------- زر الإجراءات المجمّعة */
.qa-btn { padding: 0 18px; gap: 8px; font-size: 14.5px; font-weight: 600; }
.qa-btn .icon:last-child { opacity: .75; transition: transform .15s var(--ease); }
.qa.open .qa-btn .icon:last-child { transform: rotate(180deg); }

.qa .dropdown-menu.qa-menu {
  width: min(340px, calc(100vw - 24px)); padding: 0; overflow: hidden; border-radius: 16px;
}
.qa-head {
  display: flex; flex-direction: column; gap: 1px; padding: 13px 16px 11px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 9%, var(--surface)), var(--surface));
  border-bottom: 1px solid var(--border);
}
.qa-head b { font-size: 13.5px; color: var(--text); }
.qa-head span { font-size: 11.5px; color: var(--text-faint); }

.qa-grid { display: flex; flex-direction: column; padding: 6px; gap: 2px; }
.qa-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px;
  border-radius: 11px; text-decoration: none; color: var(--text);
  transition: background .12s var(--ease), transform .12s var(--ease);
}
.qa-item:hover, .qa-item:focus-visible { background: var(--surface-sunk); }
.qa-item:active { transform: scale(.985); }
.qa-item > .icon { color: var(--text-faint); flex: none; margin-inline-start: auto; }
.qa-item:hover > .icon { color: var(--brand); }

.qa-ico {
  width: 38px; height: 38px; flex: none; border-radius: 11px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--tone, var(--brand)) 13%, transparent);
  color: var(--tone, var(--brand));
}
.qa-ico.tone-accent { --tone: var(--accent-600); }
.qa-ico.tone-info   { --tone: var(--brand-500); }
.qa-ico.tone-ok     { --tone: var(--ok-500); }
.qa-ico.tone-brand  { --tone: var(--brand); }
.qa-ico.tone-muted  { --tone: var(--text-soft); }
.qa-ico.tone-warn   { --tone: var(--warn-500); }

.qa-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.qa-text b { font-size: 13.5px; font-weight: 600; }
.qa-text small { font-size: 11.5px; color: var(--text-faint); }
/* الإجراء الأكثر استعمالًا يُقرأ أولًا. */
.qa-item.is-lead .qa-text b { color: var(--brand); }
.qa-item .kbd { margin-inline-start: auto; flex: none; }

@media (max-width: 560px) {
  .qa { flex: 1 1 100%; }
  .qa-btn { width: 100%; justify-content: center; }
}

/* --------------------------------------------------- صفحة الدخول: العين */
.input-reveal { position: relative; display: block; }
.input-reveal .input { padding-inline-start: 42px; }
.reveal-btn {
  position: absolute; inset-inline-start: 6px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; display: grid; place-items: center;
  border: 0; background: none; cursor: pointer; color: var(--text-faint);
  border-radius: 8px; padding: 0;
}
.reveal-btn:hover { color: var(--text); background: var(--surface-sunk); }
.reveal-btn[aria-pressed="true"] { color: var(--brand); }

/* الموقع عند الدخول */
.login-geo {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 12.5px; line-height: 1.7; color: var(--text-soft);
  background: var(--surface-muted); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 11px;
}
.login-geo-dot {
  width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--warn-500);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn-500) 18%, transparent);
  animation: clock-pulse 1.6s ease-in-out infinite;
}
.login-geo.is-ok { border-color: color-mix(in srgb, var(--ok-500) 32%, transparent); background: var(--ok-50); color: var(--ok-700); }
.login-geo.is-ok .login-geo-dot { background: var(--ok-500); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok-500) 18%, transparent); animation: none; }
.login-geo.is-bad { border-color: color-mix(in srgb, var(--bad-500) 32%, transparent); background: var(--bad-50); color: var(--bad-700); }
.login-geo.is-bad .login-geo-dot { background: var(--bad-500); box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad-500) 18%, transparent); animation: none; }
@keyframes clock-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .login-geo-dot { animation: none; } }

/* ------------------------------------------------- جلسات اليوم في الرئيسية
   عمل اليوم كله: عرض الصفحة كاملًا، ولون يميّزها عن بقية البطاقات. */
.card-today {
  border-color: color-mix(in srgb, var(--brand) 32%, var(--border));
  box-shadow: 0 10px 30px color-mix(in srgb, var(--brand) 12%, transparent);
}
/* الرأس يُدوَّر بنفسه بدل قصّ البطاقة لما يخرج عنها — فالقائمة المنسدلة
   في عمود الإجراءات كانت تُقصّ معه فلا تظهر. */
.card-today > .card-head {
  border-start-start-radius: inherit; border-start-end-radius: inherit;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--brand) 14%, var(--surface)),
    color-mix(in srgb, var(--accent) 9%, var(--surface)) 70%,
    var(--surface));
  border-bottom-color: color-mix(in srgb, var(--brand) 22%, var(--border));
}
.card-today > .card-head .icon { color: var(--brand); }
.card-today .card-title { color: var(--text); font-weight: 700; }
.today-count {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px;
  padding: 0 7px; margin-inline-start: 6px; border-radius: 999px;
  background: var(--brand); color: #fff; font-size: 12px; font-weight: 700;
}
/* صفّ الجلسة أوسع قليلًا: فيه أزرار تُضغط بالإصبع. */
.card-today .table td { padding-top: 10px; padding-bottom: 10px; }
.card-today .table tbody tr:hover { background: color-mix(in srgb, var(--brand) 5%, transparent); }

/* عمود الإجراءات */
.hx { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.hx .btn { white-space: nowrap; }
@media (max-width: 1100px) {
  .hx .hx-label { display: none; }
  .hx .btn-primary { width: 30px; padding: 0; }
}

/* حقل يُقرأ ليُنسخ: العنوان والمفتاح في ربط الموقع. */
.input-copy { display: flex; gap: 6px; align-items: center; }
.input-copy .input { flex: 1; min-width: 0; background: var(--surface-sunk); }
.input-copy .btn { flex: none; }

/* قائمة اختيار بلغت سقفها: تقول ذلك بدل أن تبدو كاملة. */
.picker-more {
  padding: 7px 12px; font-size: 11.5px; line-height: 1.7;
  color: var(--warn-700); background: var(--warn-50);
  border-top: 1px solid color-mix(in srgb, var(--warn-500) 22%, transparent);
}
:root[data-theme="dark"] .picker-more { color: #fcd34d; }

/* محوٌ لا رجعة فيه: ما سيذهب معه يُعرض قبل السؤال. */
.erase-warn { color: var(--bad-700); font-size: 13px; margin: 10px 0 6px; }
:root[data-theme="dark"] .erase-warn { color: #fca5a5; }
.erase-list {
  margin: 0; padding: 8px 10px; list-style: none; max-height: 190px; overflow: auto;
  background: var(--bad-50); border: 1px solid color-mix(in srgb, var(--bad-500) 25%, transparent);
  border-radius: 10px; font-size: 13px; line-height: 2;
}
.erase-list li { display: flex; gap: 8px; align-items: baseline; }
.erase-list b { min-width: 42px; text-align: end; color: var(--bad-700); }
:root[data-theme="dark"] .erase-list b { color: #fca5a5; }
/* أرقام توكيل المكتب: الموكل الواحد له عدة توكيلات، وكلٌّ منها رقمٌ يُقرأ
   وحده — فتُصفّ لا تُلصق في سطرٍ واحد. */
.poa-numbers { display: flex; flex-wrap: wrap; gap: 3px 5px; }
.poa-numbers b {
  font-weight: 600; font-size: 12.5px; line-height: 1.6;
  padding: 1px 7px; border-radius: 6px;
  background: var(--surface-sunk); color: var(--text);
}

/* نقل بيانات موكل إلى آخر: ما سيُنقل يُعرض قبل السؤال. */
.transfer-note { font-size: 13px; color: var(--text-soft); line-height: 1.9; margin: 0 0 14px; }
.transfer-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.transfer-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 6px 4px 4px; border-radius: 8px; font-size: 12.5px;
  background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand-500) 25%, transparent);
}
.transfer-chip .chip-x {
  display: inline-flex; padding: 2px; border: 0; border-radius: 6px; cursor: pointer;
  background: transparent; color: var(--text-soft);
}
.transfer-chip .chip-x:hover { background: var(--bad-50); color: var(--bad-700); }
.transfer-chip .chip-x svg { width: 13px; height: 13px; }
.transfer-head { font-size: 13.5px; margin: 14px 0 6px; }
.transfer-warn { color: var(--bad-700); font-size: 13px; margin: 10px 0 0; }
:root[data-theme="dark"] .transfer-warn { color: #fca5a5; }
.transfer-list {
  margin: 0; padding: 8px 10px; list-style: none; max-height: 200px; overflow: auto;
  background: var(--surface-muted); border: 1px solid var(--border);
  border-radius: 10px; font-size: 13px; line-height: 2;
}
.transfer-list li { display: flex; gap: 8px; align-items: baseline; }
.transfer-list b { min-width: 46px; text-align: end; color: var(--brand); }
:root[data-theme="dark"] .transfer-list b { color: #a5b4fc; }

.row-actions .btn.bad { color: var(--bad-500); }
.row-actions .btn.bad:hover { background: var(--bad-50); }

/* ------------------------------------------------------ قراءة أوضح (body.readable)
   الخط كان صغيرًا وباهتًا، والقائمة الجانبية أكثر. هذه الطبقة على شاشات
   النظام وحدها (layouts/app يضع الصنف على body، فتشمل النوافذ المنبثقة
   أيضًا)؛ الأوراق المطبوعة وبوابة الموكل على مقاساتها كما هي. */
body.readable {
  font-size: 15.5px;
  /* التنعيم الرقيق يُرقّق الخط العربي على الماك فيبدو باهتًا. */
  -webkit-font-smoothing: auto;
  --text-soft:  var(--n-700);
  --text-faint: var(--n-500);
  --sidebar-text: #e6ebf5;
  --sidebar-w: 284px;
}
:root[data-theme="dark"] body.readable {
  --text-soft:  #c4cedb;
  --text-faint: #96a4b6;
  --sidebar-text: #dbe3ee;
}

/* القائمة الجانبية */
.readable .sidebar-brand-name { font-size: 15px; }
.readable .sidebar-brand-sub { font-size: 12.5px; color: rgba(255,255,255,.7); }
.readable .nav-group-head { font-size: 15px; font-weight: 600; padding: 10px 12px; }
.readable .nav-link { font-size: 14.5px; font-weight: 500; color: rgba(255,255,255,.86); padding: 8px 12px; }
.readable .nav-link:hover, .readable .nav-link.active { color: #fff; }
.readable .nav-link.active { font-weight: 600; }
.readable .nav-link .dot { opacity: .6; }

/* رأس الصفحة والمسار */
.readable .crumbs { font-size: 14px; }
.readable .page-title { font-size: 23px; }
.readable .page-sub { font-size: 14.5px; }
.readable .card-title { font-size: 16px; }
.readable .modal-title { font-size: 17px; }

/* الجداول */
.readable .table { font-size: 14.5px; }
.readable .table thead th { font-size: 13px; }
.readable .table-foot, .readable .pager button, .readable .pager a { font-size: 13.5px; }
.readable .cell-lines { font-size: 12.5px; }
.readable .filter-chips, .readable .filter-chips .clear-all { font-size: 13px; }

/* الأزرار والنماذج */
.readable .btn { font-size: 14.5px; }
.readable .btn-sm { font-size: 13.5px; }
/* على الحاسب فقط: على الهاتف تبقى الحقول 16px كي لا يكبّر Safari الصفحة. */
@media (min-width: 861px) { .readable .input, .readable .select, .readable .textarea { font-size: 14.5px; } }
.readable .field-label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.readable .field-hint, .readable .field-error { font-size: 12.5px; }
.readable .form-section .hint { font-size: 13px; }
.readable .switch .switch-label { font-size: 14px; }
.readable .picker-option { font-size: 14px; }
.readable .picker-option .hint, .readable .picker-empty { font-size: 12.5px; }

/* البطاقات والقوائم الصغيرة */
.readable .badge { font-size: 12.5px; }
.readable .tab { font-size: 14.5px; }
.readable .dl dt { font-size: 13.5px; }
.readable .stat-label { font-size: 13.5px; }
.readable .stat-meta, .readable .timeline-when { font-size: 12.5px; }
.readable .dropdown-item { font-size: 14px; }
.readable .dropdown-head { font-size: 13px; }
.readable .palette-item .meta, .readable .palette-item .where, .readable .palette-group, .readable .palette-hint { font-size: 12.5px; }
.readable .agenda-table { font-size: 13.5px; }

/* زر «رجوع» في الشريط العلوي: في كل صفحة، إلى آخر مكان كان فيه الموظف. */
.topbar-back { flex: none; height: 34px; padding: 0 12px; gap: 6px; }
@media (max-width: 640px) { .topbar-back .topbar-back-label { display: none; } .topbar-back { padding: 0 9px; } }

/* ------------------------------------------------------------ مساعد النظام
   الزر تحت على الشمال (inline-end في RTL)، زرٌّ دائري بجوار رؤوس المحادثات؛
   ودرج المحادثات (.chat-dock) يُزاح بعرضه فلا يتراكبان أبدًا. */
.asst-launcher {
  position: fixed; bottom: 18px; inset-inline-end: 18px; z-index: 56;
  display: inline-grid; place-items: center;
  width: 52px; height: 52px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--brand-700, var(--brand)); color: #fff; font-weight: 600; font-size: 14.5px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .28);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.asst-launcher:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(15, 23, 42, .32); }
.asst.is-open .asst-launcher { transform: none; }
/* الاسم يظهر بجوار الزر عند المرور عليه. */
.asst-launcher-label {
  position: absolute; inset-inline-start: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  white-space: nowrap; padding: 5px 11px; border-radius: 8px; font-size: 13px;
  background: var(--n-900); color: #fff; opacity: 0; pointer-events: none; transition: opacity .15s var(--ease);
}
.asst-launcher:hover .asst-launcher-label, .asst-launcher:focus-visible .asst-launcher-label { opacity: 1; }
.asst.is-open .asst-launcher-label { opacity: 0; }
body.has-assistant .chat-dock { inset-inline-end: 82px; }

.asst-panel {
  position: fixed; z-index: 57; inset-inline-end: 18px; bottom: 82px;
  width: 390px; height: 580px; max-height: calc(100dvh - 100px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
}
.asst-panel[hidden] { display: none; }
@media (max-width: 640px) { .asst-panel { inset: 64px 8px 82px 8px; width: auto; height: auto; max-height: none; } }

.asst-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-muted); }
.asst-avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.asst-head-text { flex: 1; min-width: 0; line-height: 1.35; }
.asst-head-text strong { display: block; font-size: 15px; }
.asst-head-text small { font-size: 12.5px; color: var(--text-soft); }

.asst-log { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.asst-row { display: flex; }
.asst-row.is-user { justify-content: flex-start; }
.asst-row.is-bot { justify-content: flex-end; }
.asst-bubble { max-width: 88%; padding: 9px 13px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-muted); font-size: 14.5px; line-height: 1.85; overflow-wrap: anywhere; }
.asst-row.is-user .asst-bubble { background: var(--brand-soft); border-color: transparent; border-start-start-radius: 4px; }
.asst-row.is-bot .asst-bubble { border-start-end-radius: 4px; }
.asst-bubble.is-miss { border-color: color-mix(in srgb, var(--warn-500) 45%, transparent); background: var(--warn-50); }
.asst-bubble.is-error { border-color: var(--bad-500); background: var(--bad-50); color: var(--bad-700); }
.asst-text { white-space: pre-line; }
.asst-html p { margin: 0 0 4px; }
.asst-html p:last-child { margin-bottom: 0; }
.asst-html ul, .asst-html ol { margin: 4px 0; padding-inline-start: 20px; }
.asst-html li + li { margin-top: 2px; }
.asst-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.asst-actions small { color: inherit; opacity: .7; }

.asst-typing { display: inline-flex; gap: 5px; align-items: center; padding: 12px 14px; }
.asst-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); opacity: .35; animation: asstDot 1s infinite ease-in-out; }
.asst-typing i:nth-child(2) { animation-delay: .15s; }
.asst-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes asstDot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.asst-chips { flex: none; padding: 8px 12px 10px; border-top: 1px solid var(--border); max-height: 150px; overflow-y: auto; }
.asst-chips[hidden] { display: none; }
.asst-chips p { margin: 0 0 6px; font-size: 12.5px; color: var(--text-soft); }
.asst-chips > div { display: flex; flex-wrap: wrap; gap: 6px; }
.asst-chip { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); border-radius: 999px; padding: 4px 11px; font-size: 13px; cursor: pointer; text-align: start; }
.asst-chip:hover { border-color: var(--brand); color: var(--brand); }

.asst-form { flex: none; display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); background: var(--surface-muted); }
.asst-input { flex: 1; resize: none; min-height: 42px; max-height: 112px; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); font-size: 14.5px; line-height: 1.6; }
.asst-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
@media (max-width: 860px) { .asst-input { font-size: 16px; } }
.asst-send { width: 42px; height: 42px; padding: 0; justify-content: center; border-radius: 12px; }
@media print { .asst { display: none !important; } }

/* ------------------------------------------------------ مواقع مهمة للمحامي
   رأسٌ بتدرّج لون المكتب، وشبكة بطاقات لكل منها لون جهتها (--c). */
.ul-box {
  position: relative; margin-bottom: 20px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 32px -18px rgba(15, 23, 42, .25);
}
.ul-head {
  position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  padding: 22px 24px 20px; color: #fff; isolation: isolate;
  background:
    radial-gradient(600px 200px at 0% 0%, rgba(255, 255, 255, .16), transparent 60%),
    radial-gradient(420px 220px at 100% 120%, color-mix(in srgb, var(--accent-500, #f59e0b) 45%, transparent), transparent 65%),
    linear-gradient(135deg, var(--brand-900, #0b1f3a), var(--brand-700, #1e3a8a) 60%, var(--brand-500, #2563eb));
}
/* شبكة نقاط خفيفة تعطي الرأس عمقًا دون أن تشغل العين. */
.ul-head::after {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .18;
  background-image: radial-gradient(rgba(255, 255, 255, .55) 1px, transparent 1.2px); background-size: 18px 18px;
  mask-image: linear-gradient(90deg, transparent, #000 40%, #000 60%, transparent);
}
.ul-kicker { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; letter-spacing: .02em; padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, .14); backdrop-filter: blur(4px); }
.ul-head h2, .ul-title-lg { margin: 8px 0 2px; font-size: 21px; font-weight: 700; color: #fff; }
.ul-title-lg { font-size: 25px; }
.ul-head p { margin: 0; font-size: 14px; color: rgba(255, 255, 255, .8); }
.ul-head-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ul-search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; min-width: 240px; border-radius: 12px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .22); color: rgba(255, 255, 255, .85); transition: background .15s var(--ease), border-color .15s var(--ease); }
.ul-search:focus-within { background: rgba(255, 255, 255, .22); border-color: rgba(255, 255, 255, .5); }
.ul-search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: #fff; font-size: 14px; }
.ul-search input::placeholder { color: rgba(255, 255, 255, .65); }
.ul-all { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 12px; font-size: 14px; font-weight: 600; color: var(--brand-900, #0b1f3a); background: #fff; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .35); transition: transform .15s var(--ease); }
.ul-all:hover { transform: translateY(-1px); }

.ul-chips { display: flex; gap: 8px; flex-wrap: wrap; padding: 16px 24px 0; }
.ul-chip { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-soft); font-size: 13.5px; font-weight: 600; cursor: pointer; }
.ul-chip .num { font-size: 12px; padding: 1px 7px; border-radius: 999px; background: var(--surface-sunk); color: var(--text-soft); }
.ul-chip:hover { color: var(--text); border-color: var(--brand); }
.ul-chip.is-on { background: var(--brand-700, var(--brand)); border-color: transparent; color: #fff; }
.ul-chip.is-on .num { background: rgba(255, 255, 255, .2); color: #fff; }

.ul-group { padding: 0 24px; }
.ul-group-title { margin: 22px 0 10px; font-size: 14px; font-weight: 700; color: var(--text-soft); display: flex; align-items: center; gap: 10px; }
.ul-group-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.ul-group:last-of-type, .ul-box > .ul-grid { padding-bottom: 20px; }
.ul-box > .ul-grid { padding: 18px 24px 22px; }

.ul-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.ul-tile {
  --c: var(--brand);
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 76px; padding: 12px 14px;
  border-radius: 14px; border: 1px solid var(--border); color: var(--text); text-decoration: none; overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 7%, var(--surface)), var(--surface) 70%);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease);
}
.ul-tile::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; background: var(--c); opacity: .85; }
.ul-tile:hover, .ul-tile:focus-visible {
  transform: translateY(-3px); border-color: color-mix(in srgb, var(--c) 55%, var(--border));
  box-shadow: 0 14px 28px -14px color-mix(in srgb, var(--c) 70%, transparent); outline: none;
}
.ul-tile[hidden] { display: none; }
.ul-badge {
  flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px;
  font-size: 14.5px; font-weight: 800; color: #fff; letter-spacing: -.02em;
  background: linear-gradient(145deg, color-mix(in srgb, var(--c) 78%, #fff), var(--c) 55%, color-mix(in srgb, var(--c) 80%, #000));
  box-shadow: 0 8px 18px -8px var(--c), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.ul-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ul-name { font-size: 14.5px; font-weight: 700; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ul-desc { font-size: 12.5px; color: var(--text-soft); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ul-domain { font-size: 12px; color: var(--text-faint); font-family: var(--font-num, inherit); text-align: end; unicode-bidi: plaintext; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ul-go { flex: none; align-self: flex-start; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); transition: transform .18s var(--ease); }
.ul-tile:hover .ul-go { transform: translate(-2px, -2px); }
.ul-hot { position: absolute; top: 8px; inset-inline-end: 42px; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--surface)); }
.ul-empty { padding: 26px 24px; text-align: center; color: var(--text-soft); font-size: 14px; }
.ul-empty a { color: var(--brand); font-weight: 600; margin-inline-start: 6px; }
.ul-mini { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; font-size: 12px; font-weight: 800; color: #fff; background: var(--c); }

@media (max-width: 640px) {
  .ul-head { padding: 18px 16px; }
  .ul-search { min-width: 0; flex: 1; }
  .ul-head-tools { width: 100%; }
  .ul-box > .ul-grid, .ul-group, .ul-chips { padding-inline: 16px; }
  .ul-grid { grid-template-columns: 1fr; }
}
@media print { .ul-box { display: none !important; } }

/* --------------------------------------------------------- طيّ القائمة
   زرٌّ دائري على حافة القائمة يطويها إلى شريط أيقونات (72px) فتتّسع
   الصفحة. الحالة على <html> (sb-collapsed) تُوضع قبل الرسم في الرأس. */
.sidebar-collapse {
  position: absolute; z-index: 2; top: calc(var(--topbar-h) / 2 - 13px); inset-inline-end: -13px;
  width: 26px; height: 26px; padding: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-soft);
  box-shadow: 0 2px 8px rgba(15, 23, 42, .18);
  transition: color .15s var(--ease), background .15s var(--ease), transform .15s var(--ease);
}
.sidebar-collapse:hover { color: #fff; background: var(--brand-700, var(--brand)); border-color: transparent; transform: scale(1.08); }
.sidebar-collapse svg { transition: transform .2s var(--ease); }
@media (max-width: 900px) { .sidebar-collapse { display: none; } }

@media (min-width: 901px) {
  .sidebar { transition: width .2s var(--ease); }
  html.sb-collapsed .sidebar { width: 72px; }
  html.sb-collapsed .sidebar-collapse svg { transform: rotate(180deg); }

  html.sb-collapsed .sidebar-brand { padding: 0; justify-content: center; }
  html.sb-collapsed .sidebar-brand-text,
  html.sb-collapsed .sidebar-nav .nav-link > span,
  html.sb-collapsed .nav-group-head > span,
  html.sb-collapsed .sidebar-foot .nav-link > span { display: none; }
  html.sb-collapsed .nav-items { display: none !important; }

  html.sb-collapsed .sidebar-nav { padding-inline: 10px; overflow-x: hidden; }
  html.sb-collapsed .nav-group-head,
  html.sb-collapsed .sidebar-nav > .nav-link,
  html.sb-collapsed .sidebar-foot .nav-link {
    justify-content: center; gap: 0; margin-inline-start: 0 !important; padding: 11px 0 !important; border-radius: 12px;
  }
  html.sb-collapsed .nav-link::before { display: none; }
  /* المجموعة التي فيها الصفحة المفتوحة تبقى مميّزة في الشريط. */
  html.sb-collapsed .nav-group:has(.nav-link.active) .nav-group-head { background: rgba(255, 255, 255, .1); color: #fff; box-shadow: inset 3px 0 0 var(--accent-500); }
}

/* ------------------------------------------- جلسات اليوم: محكمة أم خبراء
   شارة النوع قبل رقم القضية، وخطٌّ بنفسجي على صف جلسة الخبراء. */
.sit-kind { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; line-height: 1.6; padding: 1px 8px; border-radius: 99px; margin-inline-end: 6px; vertical-align: middle; white-space: nowrap; }
.sit-kind.is-court { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); }
.sit-kind.is-expert { background: rgba(124, 58, 237, .13); color: #6d28d9; }
:root[data-theme="dark"] .sit-kind.is-expert { background: rgba(167, 112, 245, .2); color: #d4b8fb; }
tr.sit-expert td:first-child { box-shadow: inset -3px 0 0 #7c3aed; }
tr.sit-expert { background: color-mix(in srgb, #7c3aed 4%, transparent); }
.sit-split { margin-inline-start: 8px; font-size: 12px; font-weight: 500; color: var(--text-soft); }

/* ===================================================================
   مكتبي — صفحة شغل المحامي
   =================================================================== */
.ws-hero {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1fr auto; gap: 18px 24px; align-items: center;
  padding: 24px 26px; margin-bottom: 14px; border-radius: var(--radius-xl);
  color: #fff;
  background:
    radial-gradient(600px 220px at 10% -20%, rgba(226, 196, 137, .28), transparent 60%),
    radial-gradient(500px 260px at 100% 120%, rgba(93, 119, 190, .45), transparent 60%),
    linear-gradient(135deg, var(--brand-800), var(--brand-600));
  box-shadow: var(--shadow-lg);
}
.ws-hero-main { display: flex; align-items: center; gap: 16px; min-width: 0; }
.ws-avatar {
  flex: none; width: 58px; height: 58px; border-radius: 18px;
  display: grid; place-items: center; font-size: 26px; font-weight: 700;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .25); color: var(--accent-300);
}
.ws-hello { font-size: 22px; font-weight: 700; line-height: 1.35; }
.ws-sub { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13.5px; color: rgba(255, 255, 255, .78); margin-top: 3px; }
.ws-sub .dot { opacity: .6; }
.ws-pick { display: flex; align-items: center; gap: 8px; }
.ws-hero .ws-pick label { font-size: 12.5px; color: rgba(255, 255, 255, .8); white-space: nowrap; }
.ws-hero .ws-pick .select { min-width: 220px; background-color: rgba(255, 255, 255, .95); }
.ws-kpis { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.ws-kpi {
  --tone: #fff;
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  padding: 12px 14px; border-radius: var(--radius-lg); text-decoration: none; color: #fff;
  background: rgba(255, 255, 255, .09); border: 1px solid rgba(255, 255, 255, .14);
  transition: background .15s, transform .15s;
}
.ws-kpi:hover { background: rgba(255, 255, 255, .16); transform: translateY(-2px); }
.ws-kpi-icon { grid-row: span 2; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 255, 255, .12); color: var(--tone); }
.ws-kpi-value { font-size: 24px; font-weight: 700; line-height: 1.1; }
.ws-kpi-label { font-size: 12px; color: rgba(255, 255, 255, .78); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-kpi.tone-brand  { --tone: #b3c2ea; }
.ws-kpi.tone-info   { --tone: #93c5fd; }
.ws-kpi.tone-accent { --tone: var(--accent-300); }
.ws-kpi.tone-ok     { --tone: #86efac; }
.ws-kpi.tone-warn   { --tone: #fcd34d; }
.ws-kpi.tone-bad    { --tone: #fca5a5; }

.ws-nav {
  position: sticky; top: calc(var(--topbar-h) + 4px); z-index: 5;
  display: flex; gap: 6px; overflow-x: auto; padding: 6px; margin-bottom: 16px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(8px);
  border: 1px solid var(--border); border-radius: 99px; box-shadow: var(--shadow-sm); scrollbar-width: none;
}
.ws-nav a { flex: none; padding: 6px 14px; border-radius: 99px; font-size: 13px; font-weight: 600; color: var(--text-soft); text-decoration: none; }
.ws-nav a:hover { background: var(--brand-soft); color: var(--brand); }
.ws-nav a .num { display: inline-block; min-width: 20px; padding: 0 6px; margin-inline-start: 4px; border-radius: 99px; background: var(--surface-sunk); font-size: 11.5px; text-align: center; }

.ws-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.ws-card { margin-bottom: 16px; scroll-margin-top: calc(var(--topbar-h) + 64px); }
.ws-grid > .ws-card { margin-bottom: 0; }
.today-count.is-warn { background: var(--warn-50); color: var(--warn-500); }

.ws-empty { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 26px 16px; color: var(--text-faint); font-size: 13.5px; }
.ws-empty.is-ok { color: var(--ok-500); }

.ws-timeline { list-style: none; margin: 0; padding: 0; }
.ws-tl { --tone: var(--brand); display: grid; grid-template-columns: 52px 14px 1fr; gap: 10px; position: relative; padding-bottom: 14px; }
.ws-tl:last-child { padding-bottom: 0; }
.ws-tl::before { content: ""; position: absolute; inset-inline-start: 68px; top: 16px; bottom: -2px; width: 2px; background: var(--border); }
.ws-tl:last-child::before { display: none; }
.ws-tl-time { font-weight: 700; font-size: 13px; color: var(--text-soft); padding-top: 2px; text-align: end; }
.ws-tl-dot { width: 14px; height: 14px; margin-top: 4px; border-radius: 50%; background: var(--surface); border: 3px solid var(--tone); position: relative; z-index: 1; }
.ws-tl-body { min-width: 0; }
.ws-tl-title { font-weight: 600; color: var(--text); text-decoration: none; margin-inline-start: 4px; }
a.ws-tl-title:hover { color: var(--brand); text-decoration: underline; }
.ws-tl-meta { font-size: 12.5px; color: var(--text-soft); margin-top: 2px; }

.ws-tag { --tone: var(--brand); display: inline-flex; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 99px; white-space: nowrap; color: var(--tone); background: color-mix(in srgb, var(--tone) 13%, transparent); }
:is(.ws-tl, .ws-tag).tone-brand  { --tone: var(--brand-500); }
:is(.ws-tl, .ws-tag).tone-violet { --tone: #7c3aed; }
:is(.ws-tl, .ws-tag).tone-teal   { --tone: #0d9488; }
:is(.ws-tl, .ws-tag).tone-amber  { --tone: #d97706; }
:is(.ws-tl, .ws-tag).tone-slate  { --tone: #475569; }
:is(.ws-tl, .ws-tag).tone-rose   { --tone: #e11d48; }

.ws-list { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; }
.ws-list li { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--border); }
.ws-list li:last-child { border-bottom: 0; }
.ws-list li:hover { background: var(--surface-muted); }
.ws-list-main { flex: 1; min-width: 0; }
.ws-list-title { display: block; font-weight: 600; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.ws-list-title:hover { color: var(--brand); }
.ws-list-meta { font-size: 12.5px; color: var(--text-soft); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-date { flex: none; font-size: 12.5px; font-weight: 600; color: var(--text-soft); padding: 2px 8px; border-radius: 6px; background: var(--surface-sunk); white-space: nowrap; }
.ws-date.is-today { background: var(--info-50); color: var(--info-500); }
.ws-date.is-late { background: var(--bad-50); color: var(--bad-500); }

.ws-legend { display: inline-flex; gap: 2px; }
.ws-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.ws-day { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px; background: var(--surface-muted); }
.ws-day-head { display: flex; align-items: baseline; gap: 8px; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px dashed var(--border-strong); }
.ws-day-name { font-weight: 700; color: var(--brand); }
.ws-day-date { font-size: 12.5px; color: var(--text-soft); }
.ws-day-in { margin-inline-start: auto; font-size: 11.5px; color: var(--text-faint); }
.ws-sit { padding: 8px 10px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); border-inline-start: 3px solid var(--brand-500); }
.ws-sit + .ws-sit { margin-top: 8px; }
.ws-sit.is-expert { border-inline-start-color: #7c3aed; }
.ws-sit-title { font-weight: 600; color: var(--text); text-decoration: none; }
a.ws-sit-title:hover { color: var(--brand); text-decoration: underline; }
.ws-sit-meta { font-size: 12.5px; color: var(--text-soft); margin-top: 3px; }

.ws-filter { max-width: 260px; }
.ws-scroll { max-height: 560px; overflow-y: auto; }
.ws-decision { max-width: 340px; color: var(--text-soft); font-size: 13px; }
.ws-progress { flex: none; width: 90px; height: 7px; border-radius: 99px; background: var(--surface-sunk); overflow: hidden; }
.ws-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand-500), var(--accent-500)); }
.ws-pct { flex: none; font-size: 12px; font-weight: 700; color: var(--text-soft); width: 36px; }

@media (max-width: 1200px) { .ws-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .ws-hero { grid-template-columns: 1fr; padding: 18px 16px; }
  .ws-hero .ws-pick .select { min-width: 0; flex: 1; }
  .ws-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ws-grid { grid-template-columns: 1fr; }
  .ws-filter { max-width: 150px; }
}

/* ===================================================================
   اللغة: زر التبديل، واتجاه الأيقونات في الواجهة الإنجليزية
   =================================================================== */
.lang-switch { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; font-size: 12.5px; letter-spacing: .02em; }
.lang-float { position: fixed; top: 14px; inset-inline-end: 14px; z-index: 60; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
@media (max-width: 860px) { .topbar-lang span { display: none; } }
/* الأسهم مرسومة لاتجاه العربية: «التالي» يشير يسارًا. في الإنجليزية تنقلب.
   scale لا transform، فلا تُلغى الدورة التي تُطوى بها القوائم. */
html[dir="ltr"] .icon.i-arrow-left, html[dir="ltr"] .icon.i-arrow-right,
html[dir="ltr"] .icon.i-chevron-left, html[dir="ltr"] .icon.i-chevron-right,
html[dir="ltr"] .icon.i-chevrons-left, html[dir="ltr"] .icon.i-chevrons-right { scale: -1 1; }
html[lang="en"] body { letter-spacing: 0; }
/* «رجوع» يشير إلى الخلف في الاتجاهين: سهمه لا ينقلب مع الأسهم الأخرى. */
html[dir="ltr"] [data-back] .icon { scale: none; }
.field[hidden] { display: none; }

/* ===================================================================
   المرفقات: صندوق الرفع، وصفوف الملفات، والماسح الضوئي
   =================================================================== */
.uploader { display: grid; gap: 10px; }
.upl-drop { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 16px; border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-muted); transition: border-color .15s, background .15s; }
.uploader.is-over .upl-drop { border-color: var(--brand-500); background: var(--brand-soft); }
.upl-drop-icon { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--brand-soft); color: var(--brand); }
.upl-drop-text { flex: 1; min-width: 180px; display: grid; gap: 2px; }
.upl-drop-text b { font-size: 13.5px; }
.upl-drop-text small { font-size: 12px; color: var(--text-soft); }
.upl-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.upl-actions label.btn { cursor: pointer; }
.upl-queue:empty { display: none; }
.upl-queue { display: grid; gap: 6px; }
.upl-item { display: grid; grid-template-columns: minmax(0, 1fr) auto 120px; grid-template-rows: auto auto; gap: 2px 10px; align-items: center; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: 13px; }
.upl-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.upl-size { color: var(--text-faint); font-size: 12px; }
.upl-bar { height: 6px; border-radius: 99px; background: var(--surface-sunk); overflow: hidden; }
.upl-bar span { display: block; height: 100%; width: 0; background: var(--brand-500); transition: width .2s; }
.upl-state { grid-column: 1 / -1; font-size: 12px; color: var(--text-soft); }
.upl-item.is-done .upl-bar span { background: var(--ok-500); width: 100% !important; }
.upl-item.is-done .upl-state { color: var(--ok-500); }
.upl-item.is-bad .upl-bar span { background: var(--bad-500); }
.upl-item.is-bad .upl-state { color: var(--bad-500); }
.poa-files { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; }
.att-row { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--border); }
.att-row:last-child { border-bottom: 0; }
.att-row .att-name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.att-row .att-meta { font-size: 11.5px; color: var(--text-faint); white-space: nowrap; }

.cl-file { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.cl-file:last-child { border-bottom: 0; }
.cl-file[hidden] { display: none; }
.cl-file:hover { background: var(--surface-muted); }
.cl-file-icon { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--surface-sunk); color: var(--text-soft); }
.cl-file-icon.is-pdf { background: var(--bad-50); color: var(--bad-500); }
.cl-file-icon.is-image { background: var(--info-50); color: var(--info-500); }
.cl-file-main { flex: 1; min-width: 0; }
.cl-file-name { display: block; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-file-meta { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.cl-files-filter { max-width: 220px; }

/* الماسح: يغطي الشاشة فوق أي نافذة مفتوحة. */
html.scan-open { overflow: hidden; }
.scan-overlay { position: fixed; inset: 0; z-index: 2000; background: rgba(9, 13, 20, .82); display: grid; place-items: center; padding: 16px; }
.scan-box { width: min(1180px, 100%); height: min(820px, 100%); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--surface); border-radius: var(--radius-xl); overflow: hidden; box-shadow: var(--shadow-lg); }
.scan-head, .scan-foot { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.scan-foot { border-bottom: 0; border-top: 1px solid var(--border); }
.scan-foot label.btn { cursor: pointer; }
.scan-head b { font-size: 15px; }
.scan-count { font-size: 12.5px; color: var(--text-soft); background: var(--surface-sunk); padding: 2px 10px; border-radius: 99px; }
.scan-main { display: grid; grid-template-columns: minmax(0, 1fr) 300px; min-height: 0; }
.scan-stage { position: relative; background: #0b0f16; overflow: hidden; display: grid; place-items: center; }
.scan-stage video { width: 100%; height: 100%; object-fit: cover; }
.scan-guide { position: absolute; inset: 6% 18%; border: 2px solid rgba(255, 255, 255, .9); border-radius: 12px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .38); pointer-events: none; }
.scan-guide::after { content: "ضع الورقة داخل الإطار"; position: absolute; top: -30px; inset-inline: 0; text-align: center; color: #fff; font-size: 12.5px; font-weight: 600; }
.scan-nocam { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 24px; text-align: center; color: #e5e9f0; font-size: 13.5px; max-width: 460px; margin: auto; }
.scan-nocam[hidden], .scan-guide[hidden], .scan-stage video[hidden] { display: none; }
.scan-nocam .icon { width: 40px; height: 40px; opacity: .7; }
.scan-nocam label.btn { cursor: pointer; }
.scan-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.scan-flash.go { animation: scanFlash .35s ease-out; }
@keyframes scanFlash { from { opacity: .8; } to { opacity: 0; } }
.scan-side { display: grid; grid-template-rows: auto minmax(0, 1fr); border-inline-start: 1px solid var(--border); min-height: 0; }
.scan-opts { display: grid; gap: 6px; padding: 12px; border-bottom: 1px solid var(--border); }
.scan-opts-label { font-size: 11.5px; font-weight: 700; color: var(--text-soft); margin-top: 4px; }
.scan-seg { display: flex; padding: 3px; gap: 3px; background: var(--surface-sunk); border-radius: 10px; }
.scan-seg button { flex: 1; padding: 6px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text-soft); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.scan-seg button.on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-xs); }
.scan-pages { overflow-y: auto; padding: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-content: start; }
.scan-empty { grid-column: 1 / -1; font-size: 12.5px; color: var(--text-faint); text-align: center; margin: 24px 0; }
.scan-page { position: relative; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; }
.scan-page canvas { display: block; width: 100%; height: auto; }
.scan-page-no { position: absolute; top: 6px; inset-inline-start: 6px; min-width: 22px; padding: 1px 6px; border-radius: 99px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; text-align: center; }
.scan-page-tools { position: absolute; bottom: 6px; inset-inline-end: 6px; display: flex; gap: 4px; }
.scan-page-tools button { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 8px; background: rgba(17, 22, 30, .72); color: #fff; cursor: pointer; }
.scan-page-tools button:last-child:hover { background: var(--bad-500); }
.scan-page-tools .icon { width: 16px; height: 16px; }
.scan-shutter { width: 64px; height: 64px; border-radius: 50%; border: 4px solid var(--brand-500); background: var(--surface); padding: 4px; cursor: pointer; }
.scan-shutter span { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--brand-500); transition: transform .1s; }
.scan-shutter:active span { transform: scale(.88); }
.scan-shutter[hidden] { display: none; }
@media (max-width: 860px) {
  .scan-overlay { padding: 0; }
  .scan-box { height: 100%; border-radius: 0; }
  .scan-main { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) 210px; }
  .scan-side { border-inline-start: 0; border-top: 1px solid var(--border); grid-template-columns: 170px minmax(0, 1fr); grid-template-rows: none; }
  .scan-opts { border-bottom: 0; border-inline-end: 1px solid var(--border); overflow-y: auto; }
  .scan-pages { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
  .scan-guide { inset: 5% 8%; }
  .upl-item { grid-template-columns: minmax(0, 1fr) auto; }
  .upl-bar { grid-column: 1 / -1; }
}
.poa-files-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-muted); font-size: 13px; color: var(--text-soft); }
a.poa-files-count { cursor: pointer; text-decoration: none; }
a.poa-files-count:hover { filter: brightness(.92); }
.poa-files-btn { gap: 4px; padding-inline: 8px; }

/* ===================================================================
   ضغط الملفات
   =================================================================== */
.cmp-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; margin-bottom: 16px; align-items: start; }
.cmp-drop { display: grid; justify-items: center; gap: 8px; padding: 48px 20px; border: 2px dashed var(--border-strong); border-radius: var(--radius-xl); background: var(--surface-muted); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.cmp-drop:hover, .cmp-drop.is-over { border-color: var(--brand-500); background: var(--brand-soft); }
.cmp-drop b { font-size: 16px; }
.cmp-drop small { color: var(--text-soft); font-size: 13px; }
.cmp-drop-icon { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 20px; background: var(--brand-soft); color: var(--brand); margin-bottom: 4px; }
.cmp-privacy { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12.5px; color: var(--ok-500); }
.cmp-targets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.cmp-chip input { position: absolute; opacity: 0; pointer-events: none; }
.cmp-chip span { display: inline-block; padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 99px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--text-soft); }
.cmp-chip input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.cmp-chip input:focus-visible + span { outline: 2px solid var(--brand-400); outline-offset: 2px; }
.cmp-custom { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--text-soft); }
.cmp-custom .input { max-width: 120px; }
.cmp-hint { font-size: 12px; color: var(--text-faint); margin: 6px 0 0; }
.cmp-item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.cmp-item:last-child { border-bottom: 0; }
.cmp-icon { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 12px; font-size: 11px; font-weight: 800; letter-spacing: .04em; background: var(--surface-sunk); color: var(--text-soft); }
.cmp-icon.is-pdf { background: var(--bad-50); color: var(--bad-500); }
.cmp-icon.is-image { background: var(--info-50); color: var(--info-500); }
.cmp-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.cmp-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-sizes { display: flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--text-soft); }
.cmp-sizes b { font-size: 15px; color: var(--text); }
.cmp-arrow { display: inline-block; color: var(--text-faint); }
html[dir="ltr"] .cmp-arrow { scale: -1 1; }
.cmp-saved { font-size: 12px; font-weight: 700; color: var(--ok-500); background: var(--ok-50); padding: 1px 8px; border-radius: 99px; }
.cmp-saved:empty { display: none; }
.cmp-detail { font-size: 12.5px; color: var(--text-faint); }
.cmp-bar { height: 4px; border-radius: 99px; background: var(--surface-sunk); overflow: hidden; display: none; }
.cmp-bar span { display: block; height: 100%; width: 35%; background: var(--brand-500); border-radius: inherit; animation: cmpSlide 1.1s ease-in-out infinite; }
@keyframes cmpSlide { from { margin-inline-start: -35%; } to { margin-inline-start: 100%; } }
.cmp-item.is-busy .cmp-bar { display: block; }
.cmp-item.is-ok .cmp-sizes b { color: var(--ok-500); }
.cmp-item.is-warn .cmp-sizes b, .cmp-item.is-warn .cmp-detail { color: var(--warn-500); }
.cmp-item.is-bad .cmp-detail { color: var(--bad-500); }
.cmp-actions { display: flex; gap: 6px; flex: none; }
.cmp-notes { margin-top: 16px; padding: 14px 18px; border-radius: var(--radius-lg); background: var(--surface-muted); border: 1px solid var(--border); font-size: 13px; color: var(--text-soft); }
.cmp-notes ul { margin: 6px 0 0; padding-inline-start: 18px; display: grid; gap: 4px; }
@media (max-width: 980px) { .cmp-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .cmp-item { flex-wrap: wrap; }
  .cmp-actions { width: 100%; justify-content: flex-end; }
  .cmp-drop { padding: 32px 16px; }
}

/* ===================================================================
   عُهد المحامين
   =================================================================== */
.cu-card { overflow: hidden; margin-bottom: 16px; scroll-margin-top: calc(var(--topbar-h) + 64px); }
.cu-card-top { display: grid; grid-template-columns: auto 1fr auto; gap: 18px 28px; align-items: center; padding: 18px 20px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-500) 12%, var(--surface)), var(--surface) 60%); border-bottom: 1px solid var(--border); }
.cu-balance { display: grid; gap: 2px; }
.cu-balance-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--text-soft); }
.cu-balance b { font-size: 32px; line-height: 1.15; font-weight: 800; color: var(--text); letter-spacing: -.01em; }
.cu-balance b.is-neg, .cu-now b.is-neg, b.is-neg { color: var(--bad-500); }
.cu-balance-note { font-size: 12px; color: var(--bad-500); font-weight: 600; }
.cu-stats { display: flex; gap: 22px; flex-wrap: wrap; }
.cu-stats > div { display: grid; gap: 2px; }
.cu-stats span { font-size: 12px; color: var(--text-faint); }
.cu-stats b { font-size: 16px; }
.cu-stats small { justify-self: start; margin-top: 2px; }
.cu-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.cu-card-body { padding: 4px 0 6px; }
.cu-card-sub { display: flex; gap: 6px; align-items: baseline; padding: 10px 20px 4px; font-size: 13px; color: var(--text-soft); }
.cu-more { display: block; padding: 10px 20px; font-size: 13px; font-weight: 600; text-align: center; border-top: 1px solid var(--border); }

.cu-moves { display: grid; }
.cu-move { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--border); }
.cu-move:last-child { border-bottom: 0; }
.cu-move:hover { background: var(--surface-muted); }
.cu-move-icon { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--surface-sunk); color: var(--text-soft); }
.cu-move.is-in .cu-move-icon { background: var(--ok-50); color: var(--ok-500); }
.cu-move.is-spend .cu-move-icon { background: var(--warn-50); color: var(--warn-500); }
.cu-move.is-back .cu-move-icon { background: var(--info-50); color: var(--info-500); }
.cu-move-main { flex: 1; min-width: 0; }
.cu-move-title { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cu-move-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.cu-chip { display: inline-flex; align-items: center; gap: 3px; padding: 0 8px; border-radius: 99px; background: var(--surface-sunk); color: var(--text-soft); font-size: 11.5px; font-weight: 600; }
.cu-chip.is-link { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.cu-move-amount { flex: none; font-weight: 800; font-size: 15px; }
.cu-move.is-in .cu-move-amount { color: var(--ok-500); }
.cu-move.is-spend .cu-move-amount, .cu-move.is-back .cu-move-amount { color: var(--text); }
.cu-move-del { opacity: .5; }
.cu-move:hover .cu-move-del { opacity: 1; }

/* النوافذ */
.cu-now { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 10px; padding: 12px 14px; margin-bottom: 14px; border-radius: var(--radius-lg); background: var(--surface-muted); border: 1px solid var(--border); font-size: 13px; color: var(--text-soft); }
.cu-now b { font-size: 18px; color: var(--text); }
.cu-now-arrow { color: var(--text-faint); }
html[dir="ltr"] .cu-now-arrow { display: inline-block; scale: -1 1; }
.input.cu-amount { font-size: 22px; font-weight: 800; height: 52px; }
.cu-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cu-quick-btn { padding: 5px 12px; border-radius: 99px; border: 1px solid var(--border-strong); background: var(--surface); font: inherit; font-size: 13px; font-weight: 700; color: var(--text-soft); cursor: pointer; }
.cu-quick-btn:hover { border-color: var(--brand-500); color: var(--brand); background: var(--brand-soft); }
.cu-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.cu-cat { display: inline-block; padding: 5px 12px; border-radius: 99px; border: 1px solid var(--border-strong); background: var(--surface); font: inherit; font-size: 13px; cursor: pointer; color: var(--text-soft); }
.cu-cat:hover { border-color: var(--brand-500); color: var(--brand); }
.cu-cat.is-on { background: var(--brand); border-color: var(--brand); color: #fff; }
.cu-hint { font-size: 12.5px; color: var(--text-faint); margin: 0; }
.cu-period { font-size: 13px; color: var(--text-soft); margin: 0 0 10px; }
.cu-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.cu-sum > div { display: grid; gap: 2px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-muted); border: 1px solid var(--border); }
.cu-sum span { font-size: 12px; color: var(--text-faint); }
.cu-sum b { font-size: 16px; }
.cu-sum .is-in b { color: var(--ok-500); }
.cu-sum .is-total { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 25%, transparent); }
.cu-sum .is-total b { font-size: 19px; color: var(--brand); }
.cu-warn { display: flex; align-items: center; gap: 6px; margin: 10px 0 0; font-size: 13px; color: var(--bad-500); }
.cu-items { margin-top: 12px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cu-items summary { padding: 10px 14px; cursor: pointer; font-weight: 600; font-size: 13px; background: var(--surface-muted); }
.cu-items .cu-move { padding-inline: 14px; }
.cu-diff { margin-top: 6px; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 8px; display: inline-block; }
.cu-diff.is-ok { background: var(--ok-50); color: var(--ok-500); }
.cu-diff.is-bad { background: var(--bad-50); color: var(--bad-500); }
.cu-diff.is-info { background: var(--info-50); color: var(--info-500); }
.cu-counted-help { align-self: end; }

/* الكشف */
.cu-closing { border-bottom: 1px solid var(--border); }
.cu-closing:last-child { border-bottom: 0; }
.cu-closing > summary { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 18px; cursor: pointer; list-style: none; }
.cu-closing > summary::-webkit-details-marker { display: none; }
.cu-closing > summary:hover { background: var(--surface-muted); }
.cu-closing-date { display: grid; min-width: 92px; }
.cu-closing-date small { color: var(--text-faint); font-size: 11.5px; }
.cu-closing-nums { flex: 1; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--text-soft); align-items: center; }
.cu-closing-nums b { color: var(--text); }
.cu-closing-body { padding: 0 0 12px; background: var(--surface-muted); border-top: 1px dashed var(--border); }
.cu-report { margin: 12px 18px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); font-size: 13.5px; }
.cu-report p { margin: 4px 0 0; white-space: pre-line; color: var(--text-soft); }
.cu-closing-body .cu-hint { padding: 0 18px 8px; }
.cu-closing-body .cu-move { background: var(--surface); }
.cu-closing-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 18px 0; font-size: 12.5px; }
.cu-review { display: flex; gap: 6px; flex-wrap: wrap; }
.cu-review .input { min-width: 220px; }

/* صفحة العُهد */
.cu-issue-pick { display: flex; gap: 8px; }
.cu-issue-pick .select { min-width: 200px; }
.cu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.cu-tile { display: grid; gap: 10px; padding: 16px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs); border-top: 3px solid var(--accent-500); }
.cu-tile.is-neg { border-top-color: var(--bad-500); }
.cu-tile-head { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.cu-tile-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--brand-soft); color: var(--brand); font-weight: 800; }
.cu-tile-name { font-weight: 700; }
.cu-tile-balance { display: grid; }
.cu-tile-balance span { font-size: 12px; color: var(--text-faint); }
.cu-tile-balance b { font-size: 24px; font-weight: 800; }
.cu-tile.is-neg .cu-tile-balance b { color: var(--bad-500); }
.cu-tile-open, .cu-tile-last { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12.5px; color: var(--text-soft); align-items: center; }
.cu-tile-actions { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 10px; border-top: 1px solid var(--border); }
.cu-pending { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; padding: 12px 18px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text-soft); font-size: 13px; }
.cu-pending:last-child { border-bottom: 0; }
.cu-pending:hover { background: var(--surface-muted); }
.cu-pending b { color: var(--text); }
.cu-pending-name { font-weight: 700; color: var(--text); min-width: 140px; }
.cu-pending-report { flex-basis: 100%; color: var(--text-faint); font-size: 12.5px; }
@media (max-width: 860px) {
  .cu-card-top { grid-template-columns: 1fr; }
  .cu-actions { justify-content: flex-start; }
  .cu-actions .btn { flex: 1; justify-content: center; }
  .cu-move { padding-inline: 14px; }
  .cu-issue-pick { width: 100%; }
  .cu-issue-pick .select { flex: 1; min-width: 0; }
}
@media print {
  .cu-actions, .cu-move-del, .cu-review, .cu-more { display: none !important; }
  .cu-closing { break-inside: avoid; }
  .cu-closing-body { display: block !important; }
}

/* ===================================================================
   الصفحة الحالية في القائمة الجانبية: واضحة من أول نظرة.
   خلفية ذهبية مصمتة ونص كحلي على القائمة الداكنة، وقسمها يحمل علامتها.
   =================================================================== */
.sidebar .nav-link.active,
.readable .sidebar .nav-link.active {
  background: linear-gradient(135deg, var(--accent-300), var(--accent-500));
  color: var(--brand-900);
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(195, 154, 75, .35), inset 0 0 0 1px rgba(255, 255, 255, .25);
}
.sidebar .nav-link.active:hover { color: var(--brand-900); filter: brightness(1.04); }
.sidebar .nav-link.active::before { height: 22px; width: 4px; background: var(--accent-300); }
.sidebar .nav-link.active .dot { opacity: 1; width: 6px; height: 6px; background: var(--brand-900); }
.sidebar .nav-link.active .icon { color: var(--brand-900); }

/* القسم الذي فيه الصفحة الحالية. */
.sidebar .nav-group:has(.nav-link.active) > .nav-group-head {
  color: var(--accent-300);
  background: rgba(255, 255, 255, .05);
  box-shadow: inset -3px 0 0 var(--accent-500); /* على الحافة اليمنى: بداية السطر العربي */
}
html[dir="ltr"] .sidebar .nav-group:has(.nav-link.active) > .nav-group-head { box-shadow: inset 3px 0 0 var(--accent-500); }
.sidebar .nav-group:has(.nav-link.active) > .nav-group-head .icon { color: var(--accent-300); }

/* ===================================================================
   لوحة إجراءات التأسيس: عمود لكل مرحلة بلونها
   =================================================================== */
.st-swatch { display: inline-block; width: 22px; height: 22px; border-radius: 7px; background: var(--st); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); vertical-align: middle; }
.st-colors { display: flex; flex-wrap: wrap; gap: 8px; }
.st-color input { position: absolute; opacity: 0; pointer-events: none; }
.st-color span { display: block; width: 34px; height: 34px; border-radius: 10px; background: var(--st); cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); transition: transform .12s; }
.st-color span:hover { transform: scale(1.08); }
.st-color input:checked + span { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--st); }
.st-color input:focus-visible + span { outline: 2px solid var(--brand-400); outline-offset: 4px; }

.fk-toolbar { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; padding: 12px 14px; }
.fk-toolbar .field { min-width: 170px; margin: 0; }
.fk-summary { font-size: 13px; color: var(--text-soft); }
.fk-late-n { color: var(--bad-500); }

.fk-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.fk-col { --st: var(--brand-500); display: flex; flex-direction: column; min-height: 420px; border-radius: var(--radius-lg); background: color-mix(in srgb, var(--st) 7%, var(--surface-sunk)); border: 1px solid color-mix(in srgb, var(--st) 18%, var(--border)); overflow: hidden; }
.fk-col-head { display: flex; align-items: center; gap: 8px; padding: 11px 12px; background: var(--surface); border-top: 4px solid var(--st); border-bottom: 1px solid color-mix(in srgb, var(--st) 18%, var(--border)); position: sticky; top: 0; z-index: 1; }
.fk-col-step { width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--st); color: #fff; font-size: 12px; font-weight: 800; }
.fk-col-name { font-weight: 700; font-size: 13.5px; line-height: 1.35; flex: 1; min-width: 0; }
.fk-col-count { min-width: 26px; padding: 1px 8px; border-radius: 99px; text-align: center; font-size: 12px; font-weight: 700; color: var(--st); background: color-mix(in srgb, var(--st) 14%, transparent); }
.fk-col-body { flex: 1; display: flex; flex-direction: column; gap: 9px; padding: 10px; min-height: 120px; border: 2px dashed transparent; border-radius: 0 0 var(--radius-lg) var(--radius-lg); transition: background .12s, border-color .12s; }
.fk-col-body.is-over { border-color: var(--st); background: color-mix(in srgb, var(--st) 12%, transparent); }
.fk-empty { margin: auto; font-size: 12px; color: var(--text-faint); padding: 18px 0; }

.fk-card { position: relative; display: grid; gap: 6px; padding: 11px 12px; background: var(--surface); border: 1px solid var(--border); border-inline-start: 4px solid var(--st); border-radius: 11px; box-shadow: var(--shadow-xs); cursor: pointer; transition: box-shadow .14s, transform .14s; }
.fk-card[draggable="true"] { cursor: grab; }
.fk-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.fk-card.dragging { opacity: .45; transform: rotate(1.5deg); }
.fk-card.is-stopped { opacity: .72; background: repeating-linear-gradient(135deg, var(--surface), var(--surface) 10px, var(--surface-muted) 10px, var(--surface-muted) 20px); }
.fk-card.is-late { box-shadow: 0 0 0 1px color-mix(in srgb, var(--bad-500) 35%, transparent), var(--shadow-xs); }
.fk-card-top { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.fk-file { font-size: 11px; font-weight: 700; color: var(--st); background: color-mix(in srgb, var(--st) 12%, transparent); padding: 1px 7px; border-radius: 99px; }
.fk-type { font-size: 11px; color: var(--text-soft); background: var(--surface-sunk); padding: 1px 7px; border-radius: 99px; }
.fk-name { font-weight: 700; font-size: 14px; line-height: 1.45; color: var(--text); text-decoration: none; }
.fk-name:hover { color: var(--brand); }
.fk-clients { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fk-progress { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-faint); font-weight: 600; }
.fk-bar { flex: 1; height: 6px; border-radius: 99px; background: var(--surface-sunk); overflow: hidden; }
.fk-bar span { display: block; height: 100%; border-radius: inherit; background: var(--st); }
.fk-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; font-size: 11.5px; color: var(--text-faint); }
.fk-meta > span { display: inline-flex; align-items: center; gap: 3px; }
.fk-due.is-late { color: var(--bad-500); font-weight: 700; }
.fk-due.is-today { color: var(--info-500); font-weight: 700; }
.fk-who { margin-inline-start: auto; width: 24px; height: 24px; justify-content: center; border-radius: 50%; background: color-mix(in srgb, var(--st) 15%, var(--surface)); color: var(--st); font-weight: 800; font-size: 11.5px; }
@media (max-width: 860px) { .fk-board { grid-auto-columns: 82vw; scroll-snap-type: x mandatory; } .fk-col { scroll-snap-align: start; } }

/* ===================================================================
   ترجمة المستندات
   =================================================================== */
.tr-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; margin-bottom: 16px; align-items: start; }
.tr-drop { display: grid; justify-items: center; gap: 8px; padding: 48px 20px; border: 2px dashed var(--border-strong); border-radius: var(--radius-xl); background: var(--surface-muted); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.tr-drop:hover, .tr-drop.is-over { border-color: var(--brand-500); background: var(--brand-soft); }
.tr-drop.has-file { border-style: solid; border-color: var(--ok-500); }
.tr-drop b { font-size: 16px; }
.tr-drop small { color: var(--text-soft); font-size: 13px; }
.tr-drop-icon { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 20px; background: var(--brand-soft); color: var(--brand); margin-bottom: 4px; }
.tr-picked { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 6px 12px; border-radius: 99px; background: var(--ok-50); color: var(--ok-500); font-weight: 700; font-size: 13px; }
.tr-langs { display: grid; gap: 10px; }
.tr-langs .field { margin: 0; }
.tr-swap { justify-self: center; }
.tr-start { height: 46px; font-size: 15px; justify-content: center; }
.tr-bar { height: 8px; border-radius: 99px; background: var(--surface-sunk); overflow: hidden; }
.tr-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand-500), var(--accent-500)); transition: width .2s; }
.tr-status { font-size: 13px; color: var(--text-soft); }
.tr-status.is-bad { color: var(--bad-500); font-weight: 600; }
.tr-unsupported { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; margin-bottom: 16px; border-radius: var(--radius-lg); background: var(--warn-50); color: var(--warn-700); border: 1px solid color-mix(in srgb, var(--warn-500) 30%, transparent); }
.tr-unsupported p { margin: 4px 0 0; font-size: 13px; }
.tr-unsupported[hidden] { display: none; }
.tr-review-head { flex-wrap: wrap; gap: 8px; }
.tr-filter { max-width: 220px; }
.tr-cols, .tr-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) minmax(0, 1fr); gap: 12px; padding: 10px 16px; }
.tr-cols { font-size: 12px; font-weight: 700; color: var(--text-faint); border-bottom: 1px solid var(--border); background: var(--surface-muted); }
.tr-list { max-height: 70vh; overflow-y: auto; }
.tr-row { border-bottom: 1px solid var(--border); align-items: start; }
.tr-row[hidden] { display: none; }
.tr-row:hover { background: var(--surface-muted); }
.tr-row.is-edited .tr-out { border-color: var(--accent-500); }
.tr-n { font-size: 12px; color: var(--text-faint); padding-top: 9px; text-align: center; }
.tr-src { font-size: 14px; line-height: 1.7; padding-top: 6px; white-space: pre-wrap; color: var(--text); }
.tr-out { font-size: 14px; line-height: 1.7; min-height: 44px; resize: vertical; }
@media (max-width: 980px) { .tr-grid { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .tr-cols { display: none; } .tr-row { grid-template-columns: 1fr; } .tr-n { text-align: start; padding: 0; } }

/* ===================================================================
   محرر الصورة: ملء الشاشة بخلفية داكنة، وأزرار كبيرة للمس
   =================================================================== */
.ie { position: fixed; inset: 0; z-index: 2100; display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; background: #0b0f16; color: #e5e9f0; user-select: none; -webkit-user-select: none; }
.ie-top { display: flex; align-items: center; gap: 6px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); }
.ie-title { flex: 1; font-weight: 700; font-size: 15px; }
.ie-btn { width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .08); color: #fff; cursor: pointer; }
.ie-btn:disabled { opacity: .3; cursor: default; }
.ie-done { display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 18px; border: 0; border-radius: 99px; background: var(--ok-500); color: #fff; font: inherit; font-weight: 800; font-size: 15px; cursor: pointer; }
.ie-stage { display: grid; place-items: center; overflow: hidden; touch-action: none; }
.ie-canvas-wrap { position: relative; }
.ie-canvas { display: block; width: 100%; height: 100%; touch-action: none; box-shadow: 0 6px 30px rgba(0, 0, 0, .5); }
.ie-crop { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .55); cursor: move; touch-action: none; }
.ie-crop[hidden] { display: none; }
.ie-crop::before, .ie-crop::after { content: ""; position: absolute; inset: 0; pointer-events: none; border: 1px solid rgba(255, 255, 255, .35); }
.ie-crop::before { inset: 0 33.33%; border-block: 0; }
.ie-crop::after { inset: 33.33% 0; border-inline: 0; }
.ie-crop span { position: absolute; width: 26px; height: 26px; touch-action: none; }
.ie-crop span::after { content: ""; position: absolute; inset: 8px; background: #fff; border-radius: 3px; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.ie-crop [data-h="nw"] { top: -13px; left: -13px; cursor: nwse-resize; }
.ie-crop [data-h="ne"] { top: -13px; right: -13px; cursor: nesw-resize; }
.ie-crop [data-h="sw"] { bottom: -13px; left: -13px; cursor: nesw-resize; }
.ie-crop [data-h="se"] { bottom: -13px; right: -13px; cursor: nwse-resize; }
.ie-crop [data-h="n"] { top: -13px; left: calc(50% - 13px); cursor: ns-resize; }
.ie-crop [data-h="s"] { bottom: -13px; left: calc(50% - 13px); cursor: ns-resize; }
.ie-crop [data-h="e"] { right: -13px; top: calc(50% - 13px); cursor: ew-resize; }
.ie-crop [data-h="w"] { left: -13px; top: calc(50% - 13px); cursor: ew-resize; }
.ie-options { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; min-height: 56px; padding: 6px 12px; }
.ie-opt { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 99px; background: rgba(255, 255, 255, .06); color: #fff; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.ie-opt.is-on { background: #fff; color: #0b0f16; }
.ie-opt.is-primary { background: var(--brand-500); border-color: var(--brand-500); }
.ie-color { width: 32px; height: 32px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .25); background: var(--c); cursor: pointer; padding: 0; }
.ie-color.is-on { border-color: #fff; transform: scale(1.12); }
.ie-size { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .18); background: transparent; cursor: pointer; }
.ie-size i { width: var(--s); height: var(--s); border-radius: 50%; background: #fff; }
.ie-size.is-on { background: rgba(255, 255, 255, .18); border-color: #fff; }
.ie-sep { width: 1px; height: 26px; background: rgba(255, 255, 255, .18); margin-inline: 4px; }
.ie-hint { font-size: 13px; color: rgba(255, 255, 255, .7); }
.ie-tools { display: flex; justify-content: safe center; gap: 4px; overflow-x: auto; padding: 8px 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); border-top: 1px solid rgba(255, 255, 255, .08); scrollbar-width: none; }
.ie-tool { flex: none; display: grid; justify-items: center; gap: 3px; min-width: 62px; padding: 8px 6px; border: 0; border-radius: 14px; background: transparent; color: rgba(255, 255, 255, .72); font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer; }
.ie-tool.is-on { background: rgba(255, 255, 255, .14); color: #fff; }
.ie-text-input { position: absolute; z-index: 2; min-width: 120px; max-width: 80%; padding: 4px 8px; border: 2px dashed rgba(255, 255, 255, .8); border-radius: 8px; background: rgba(255, 255, 255, .92); font-family: inherit; font-weight: 700; line-height: 1.3; resize: none; outline: 0; transform: translateY(-6px); }
.scan-autoedit { margin-top: 6px; }
.scan-autoedit .switch-label { font-size: 12.5px; }
@media (max-width: 600px) {
  .ie-title { display: none; }
  .ie-tools { gap: 0; padding-inline: 4px; }
  .ie-tool { min-width: 0; flex: 1 1 0; padding: 7px 2px; font-size: 10.5px; border-radius: 12px; }
  .ie-tool .icon { width: 20px; height: 20px; }
}

/* أيقونة المساعد تُسحب إلى أي مكان؛ وحين تبتعد عن ركنها لا يُزاح درج المحادثات. */
.asst-launcher { touch-action: none; user-select: none; -webkit-user-select: none; }
.asst-launcher.is-dragging { cursor: grabbing; transition: none; transform: scale(1.08); box-shadow: 0 18px 40px rgba(15, 23, 42, .38); }
.asst-launcher.is-dragging .asst-launcher-label { opacity: 0; }
body.has-assistant.asst-moved .chat-dock { inset-inline-end: 18px; }

/* ===================================================================
   جرس الإشعارات
   =================================================================== */
.nt { position: relative; }
.nt-btn { position: relative; }
.nt-badge { position: absolute; top: 2px; inset-inline-end: 2px; }
.nt-panel { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 70; width: 380px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; }
.nt-panel[hidden] { display: none; }
.nt-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.nt-list { max-height: 460px; overflow-y: auto; }
.nt-item { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); }
.nt-item:last-child { border-bottom: 0; }
.nt-item:hover { background: var(--surface-muted); }
.nt-dot { flex: none; width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; background: transparent; }
.nt-item.is-unread { background: color-mix(in srgb, var(--brand-500) 6%, transparent); }
.nt-item.is-unread .nt-dot { background: var(--brand-500); }
.nt-main { display: grid; gap: 3px; min-width: 0; }
.nt-main b { font-size: 13.5px; }
.nt-body { font-size: 12.5px; color: var(--text-soft); line-height: 1.6; }
.nt-main small { font-size: 11.5px; color: var(--text-faint); }
.nt-empty { padding: 26px 14px; text-align: center; color: var(--text-faint); font-size: 13px; }
@media (max-width: 640px) { .nt-panel { position: fixed; top: calc(var(--topbar-h) + 4px); inset-inline: 8px; width: auto; } }
.nt-device { display: flex; align-items: center; gap: 8px; padding: 9px 14px; background: var(--warn-50); color: var(--warn-700); font-size: 12.5px; border-bottom: 1px solid var(--border); }
.nt-device[hidden] { display: none; }
.nt-device span { flex: 1; }
