/* ------------------------------------------------------------------------
   نظام الشؤون القانونية — v6 browser UI
   UI IMPLEMENTATION A — the APPROVED r2 VISUAL SYSTEM: Arabic-first, true RTL
   (logical properties throughout), Cairo typography, a deep navy shell with a
   restrained warm gold accent over calm neutrals. Desktop-first; verified at
   1024 / 1366 / 1440 / 1600 / 1920, usable below.

   ⚠ The class names the pages and the end-to-end suites address are kept;
   the legacy variables (--brand, --success, --danger …) are ALIASES of the r2
   tokens, so every older rule adopts the new palette without being rewritten.
   ------------------------------------------------------------------------ */

@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('/fonts/cairo-arabic.woff2') format('woff2');
  unicode-range:
    U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E,
    U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('/fonts/cairo-latin-ext.woff2') format('woff2');
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF,
    U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url('/fonts/cairo-latin.woff2') format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* r2 tokens */
  --shell: #15203a;
  --shell-2: #1b2846;
  --shell-3: #223253;
  --shell-line: rgba(255, 255, 255, 0.07);
  --shell-tx: #a8b3c7;
  --shell-tx-2: #eaf0f8;
  --gold: #a8843a;
  --gold-2: #86682a;
  --gold-soft: #f7f0e0;
  --gold-line: #e5d4ab;
  --gold-on-dark: #d9b86c;
  --ground: #f4f5f7;
  --paper: #ffffff;
  --paper-2: #fafbfc;
  --hover: #f5f8fc;
  --line: #e1e5eb;
  --line-2: #eceff3;
  --line-3: #cfd6df;
  --ink: #18212e;
  --ink-2: #3c4758;
  --muted: #66717f;
  --faint: #939dab;
  --primary: #1e3257;
  --primary-2: #172947;
  --link: #1c5aa3;
  --link-soft: #eaf1fb;
  --ok: #1b6c45;
  --ok-soft: #e7f4ed;
  --ok-line: #bfdfcc;
  --warn: #8c5405;
  --warn-soft: #fcf3e1;
  --warn-line: #edd5a4;
  --bad: #a1261e;
  --bad-soft: #fcedec;
  --bad-line: #efc5c1;
  --info: #225889;
  --info-soft: #eaf2fa;
  --info-line: #c7daed;
  --pause: #4a5487;
  --pause-soft: #eef0f8;
  --neutral: #4b5566;
  --neutral-soft: #f1f3f6;
  --neutral-line: #dce1e7;
  --r: 8px;
  --r-lg: 12px;
  --sh-1: 0 1px 2px rgba(16, 24, 40, 0.05);
  --sh-2: 0 12px 32px rgba(16, 24, 40, 0.14), 0 2px 6px rgba(16, 24, 40, 0.06);
  --nav-w: 236px;
  --nav-w-c: 64px;
  --top-h: 56px;
  --drawer-w: 316px;

  /* legacy names → r2 tokens */
  --brand: var(--primary);
  --brand-2: var(--link);
  --brand-soft: var(--link-soft);
  --success: var(--ok);
  --success-soft: var(--ok-soft);
  --danger: var(--bad);
  --danger-soft: var(--bad-soft);
  --radius: 10px;
  --shadow: var(--sh-1);
  font-size: 14px;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  font-family: 'Cairo', 'Segoe UI', Tahoma, system-ui, sans-serif;
  color: var(--ink);
  background: var(--ground);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
h1,
h2,
h3 {
  margin: 0;
  font-weight: 700;
  line-height: 1.35;
}
h1 {
  font-size: 1.5rem;
}
h2 {
  font-size: 1.05rem;
}
h3 {
  font-size: 1rem;
  margin-block: 1rem 0.5rem;
  color: var(--ink-2);
}
p {
  margin: 0.35rem 0;
}
a {
  color: var(--link);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
:focus-visible {
  outline: 2px solid #2f6fd0;
  outline-offset: 2px;
}
.mono {
  font-family: Consolas, 'Courier New', monospace;
  font-size: 0.95em;
  letter-spacing: 0.01em;
}
.strong {
  font-weight: 700;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.89rem;
}
.plain {
  margin: 0;
  padding-inline-start: 1.1rem;
}
.plain li:empty {
  display: none;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
svg.ic {
  width: 18px;
  height: 18px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}
.btn svg.ic,
.badge svg.ic {
  width: 16px;
  height: 16px;
}
svg.ic.chev {
  width: 14px;
  height: 14px;
}
.note {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.89rem;
  color: var(--muted);
  margin: 0 0 0.9rem;
}

/* --- the application frame ---------------------------------------------------- */
.app {
  min-height: 100vh;
  display: flex;
  /* The shell colour runs the full height behind the sticky sidebar (RTL: the
     sidebar is on the right), so a long page never shows the sidebar ending. */
  background: linear-gradient(to left, var(--shell) var(--nav-w), transparent var(--nav-w));
}
.app.nav-collapsed {
  background: linear-gradient(to left, var(--shell) var(--nav-w-c), transparent var(--nav-w-c));
}
.skip-link {
  position: absolute;
  inset-inline-start: 0.5rem;
  inset-block-start: -3rem;
  z-index: 100;
  background: var(--paper);
  color: var(--ink);
  padding: 0.4rem 0.8rem;
  border-radius: var(--r);
  box-shadow: var(--sh-2);
}
.skip-link:focus {
  inset-block-start: 0.5rem;
}

/* sidebar */
.side-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  width: var(--nav-w);
  flex: none;
  background: var(--shell);
  color: var(--shell-tx);
  display: flex;
  flex-direction: column;
  z-index: 30;
  transition: width 0.18s ease;
}
.nav-brand {
  height: var(--top-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-block-end: 1px solid var(--shell-line);
  flex: none;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(217, 184, 108, 0.45);
  color: var(--gold-on-dark);
  background: rgba(217, 184, 108, 0.08);
  flex: none;
}
.brand-mark.big {
  width: auto;
  height: auto;
  border: none;
  background: none;
  font-size: 3rem;
  color: var(--gold);
}
.brand-text {
  min-width: 0;
}
.brand-title {
  color: var(--shell-tx-2);
  font-weight: 700;
  font-size: 13.5px;
  line-height: 1.25;
}
.brand-sub {
  font-size: 11px;
  color: var(--shell-tx);
}
.nav-groups {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 10px 14px;
  scrollbar-width: thin;
  scrollbar-color: #2c3c5e transparent;
}
.nav-group {
  margin-block-start: 12px;
}
.nav-group:first-child {
  margin-block-start: 2px;
}
.nav-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  font-size: 11px;
  font-weight: 700;
  color: #7f8ba2;
  padding: 0 10px 4px;
  letter-spacing: 0.2px;
  background: none;
  border: 0;
  text-align: start;
  font-family: inherit;
}
.nav-group-toggle {
  cursor: pointer;
  border-radius: 6px;
  padding-block: 2px 4px;
}
.nav-group-toggle:hover {
  color: var(--shell-tx-2);
}
.nav-group-toggle .chev {
  margin-inline-start: auto;
  transition: transform 0.15s ease;
}
.nav-group.folded .nav-group-toggle .chev {
  transform: rotate(90deg);
}
.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.nav-list a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 7px;
  color: var(--shell-tx);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
}
.nav-list a:hover {
  background: var(--shell-2);
  color: var(--shell-tx-2);
  text-decoration: none;
}
.nav-list a.active {
  background: rgba(217, 184, 108, 0.12);
  color: #f4e6c4;
}
.nav-list a.active::before {
  content: '';
  position: absolute;
  inset-inline-start: -10px;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 3px;
  background: var(--gold-on-dark);
}
.nav-list a:focus-visible {
  outline-color: var(--gold-on-dark);
}
.nav-ic {
  opacity: 0.92;
}
.nav-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-foot {
  flex: none;
  font-size: 11px;
  color: #7f8ba2;
  padding: 8px 14px 10px;
  border-block-start: 1px solid var(--shell-line);
  line-height: 1.5;
}
.app.nav-collapsed .side-nav {
  width: var(--nav-w-c);
}
.app.nav-collapsed .nav-brand {
  padding: 0;
  justify-content: center;
}
.app.nav-collapsed .brand-text,
.app.nav-collapsed .nav-text,
.app.nav-collapsed .nav-foot,
.app.nav-collapsed .nav-group-title span,
.app.nav-collapsed .nav-group-title .chev {
  display: none;
}
.app.nav-collapsed .nav-group-title {
  height: 6px;
  padding: 0;
}
.app.nav-collapsed .nav-group {
  border-block-start: 1px solid var(--shell-line);
  padding-block-start: 6px;
  margin-block-start: 8px;
}
.app.nav-collapsed .nav-group:first-child {
  border-block-start: 0;
}
.app.nav-collapsed .nav-list a {
  justify-content: center;
  padding: 0;
}

/* main column + top bar */
.main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.top-bar {
  position: sticky;
  top: 0;
  z-index: 25;
  height: var(--top-h);
  flex: none;
  background: rgba(255, 255, 255, 0.97);
  border-block-end: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
}
.top-title {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.top-crumbs {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-heading {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-search {
  position: relative;
  width: 300px;
  flex: 0 1 300px;
  transition: width 0.15s ease;
}
.top-search:focus-within {
  width: 380px;
}
.top-search-input {
  height: 36px;
  border: 1px solid var(--line-3);
  background: var(--paper-2);
  border-radius: 8px;
  padding: 0 12px;
  padding-inline-start: 36px;
}
.top-search-input:focus {
  background: #fff;
  border-color: #8aa7d1;
  box-shadow: 0 0 0 3px rgba(47, 111, 208, 0.12);
  outline: none;
}
.top-search-ic {
  position: absolute;
  inset-inline-start: 10px;
  top: 9px;
  color: var(--muted);
  pointer-events: none;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.top-primary-slot a,
.top-primary-slot a:hover {
  text-decoration: none;
}
.icon-btn {
  position: relative;
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid transparent;
  background: none;
  color: var(--ink-2);
  cursor: pointer;
  flex: none;
}
.icon-btn:hover {
  background: var(--hover);
  border-color: var(--line);
}
.drawer-count {
  position: absolute;
  inset-block-start: 1px;
  inset-inline-end: 0;
  min-width: 18px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--bad);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 17px;
}
.menu-host {
  position: relative;
}
.menu {
  position: absolute;
  inset-block-start: calc(100% + 6px);
  inset-inline-end: 0;
  z-index: 70;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--sh-2);
  padding: 6px;
  display: flex;
  flex-direction: column;
}
.menu[hidden] {
  display: none;
}
.menu a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--ink);
  font-size: 13.5px;
}
.menu a:hover,
.menu a:focus-visible {
  background: var(--hover);
  text-decoration: none;
}
.identity {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 8px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
}
.identity:hover {
  background: var(--hover);
  border-color: var(--line);
}
.identity-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--primary);
  background: #e6ecf5;
  border: 1px solid #d3dcea;
  flex: none;
}
.identity-text {
  display: flex;
  flex-direction: column;
  text-align: start;
  line-height: 1.25;
}
.identity-name {
  font-size: 13px;
  font-weight: 700;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.identity-role {
  font-size: 11.5px;
  color: var(--muted);
}
.identity-menu {
  padding: 10px 12px;
  gap: 6px;
  min-width: 260px;
}
.identity-menu-name {
  font-weight: 700;
}
.identity-meta {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
  font-size: 12px;
}
.identity-unit {
  color: var(--muted);
}

.content {
  flex: 1;
  width: 100%;
  max-width: 1560px;
  margin-inline: auto;
  padding: 18px 24px 40px;
  min-width: 0;
}
.content:focus {
  outline: none;
}

/* the «أعمالي» drawer: overlays below 1600px, docks beside the page at ≥1600px */
.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  inset-inline-end: 0;
  width: var(--drawer-w);
  max-width: 100vw;
  background: #fff;
  border-inline-start: 1px solid var(--line);
  z-index: 40;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(16, 24, 40, 0.14);
}
.drawer[hidden] {
  display: none;
}
.drawer:focus {
  outline: none;
}
@media (min-width: 1600px) {
  .app.drawer-open .main-col {
    margin-inline-end: var(--drawer-w);
  }
  .drawer {
    box-shadow: none;
  }
}
.drawer-head {
  height: var(--top-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 16px;
  border-block-end: 1px solid var(--line);
  flex: none;
}
.drawer-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  flex: 1;
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0 16px;
}
.drawer-section {
  padding: 8px 0 4px;
  border-block-end: 1px solid var(--line-2);
}
.drawer-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
}
.drawer-section-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
  flex: 1;
}
.drawer-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.drawer-list a {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 8px;
  padding: 7px 16px;
  color: var(--ink);
}
.drawer-list a:hover {
  background: var(--hover);
  text-decoration: none;
}
.drawer-list li.muted {
  padding: 4px 16px;
}
.drawer-item-text {
  font-size: 13px;
  font-weight: 600;
  flex: 1 1 100%;
  line-height: 1.45;
}
.drawer-item-meta {
  font-size: 11.5px;
  color: var(--muted);
}
.drawer-more {
  display: inline-block;
  padding: 4px 16px 6px;
  font-size: 12px;
}

/* --- page header --------------------------------------------------------------- */
.page-header {
  margin-block-end: 1.1rem;
}
.page-header-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-header-row > div:first-child {
  flex: 1 1 300px;
}
.subtitle {
  color: var(--muted);
  margin-block-start: 0.15rem;
}
.crumbs {
  font-size: 12px;
  color: var(--muted);
  margin-block-end: 0.35rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.crumbs a {
  color: var(--muted);
}
.crumbs a:hover {
  color: var(--link);
}
.crumb-sep {
  opacity: 0.6;
}
.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-block-end: 0.75rem;
}
.page-header .actions {
  margin: 0;
}

/* the strong RECORD HEADER (case / request detail) */
.page-header.rec {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid #0f1a31;
  box-shadow: var(--sh-1);
  background: var(--shell);
}
.page-header.rec::before {
  content: '';
  position: absolute;
  top: 0;
  inset-inline: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--gold-on-dark) 18%,
    var(--gold-on-dark) 82%,
    transparent
  );
  opacity: 0.75;
}
.rec > .crumbs {
  margin: 0;
  padding: 12px 22px 0;
  color: #9fabbf;
}
.rec > .crumbs a {
  color: #c4cddb;
}
.rec-band {
  color: #e8eef7;
  padding: 6px 22px 0;
}
.rec-top {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}
.rec-id {
  min-width: 0;
  flex: 1 1 320px;
}
.rec-kicker {
  font-size: 12.5px;
  color: #9fabbf;
}
.rec h1 {
  color: #fff;
  font-size: 20px;
  margin: 2px 0;
}
.rec-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-block-start: 6px;
}
.rec .badge {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: #e7edf6;
}
.rec .badge-danger {
  background: rgba(214, 72, 60, 0.2);
  border-color: rgba(240, 130, 120, 0.45);
  color: #ffd6d1;
}
.rec .badge-warn {
  background: rgba(217, 160, 60, 0.18);
  border-color: rgba(230, 180, 90, 0.45);
  color: #ffe6b8;
}
.rec .badge-success {
  background: rgba(60, 170, 110, 0.18);
  border-color: rgba(110, 200, 150, 0.4);
  color: #cff3de;
}
.rec .badge-info,
.rec .badge-brand {
  background: rgba(80, 140, 210, 0.2);
  border-color: rgba(130, 170, 230, 0.4);
  color: #d7e7fb;
}
.rec-actions {
  margin-inline-start: auto;
  justify-content: flex-end;
}
.rec .btn-secondary,
.rec .btn-ghost {
  color: #e2e9f4;
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
}
.rec .btn-secondary:hover,
.rec .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
}
.rec .btn-primary {
  background: var(--gold-on-dark);
  border-color: var(--gold-on-dark);
  color: var(--shell);
}
.rec .btn-primary:hover {
  background: #e3c47d;
}
.rec-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin: 14px 0 0;
  border-block-start: 1px solid rgba(255, 255, 255, 0.08);
}
.rec-fact {
  padding: 10px 0 13px;
  padding-inline-end: 14px;
  min-width: 0;
}
.rec-fact + .rec-fact {
  padding-inline-start: 14px;
  border-inline-start: 1px solid rgba(255, 255, 255, 0.07);
}
.rec-fact dt {
  font-size: 11.5px;
  color: #8f9bb1;
}
.rec-fact dd {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: #f4f7fb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rec-next {
  background: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 22px;
  border-inline-start: 4px solid var(--line-3);
  font-size: 13px;
}
.rec-next-label {
  font-size: 12px;
  color: var(--muted);
}
.rec-next-value {
  font-weight: 700;
  color: var(--ink);
}
.rec-next-danger {
  border-inline-start-color: var(--bad);
}
.rec-next-danger .rec-next-value {
  color: var(--bad);
}
.rec-next-warn {
  border-inline-start-color: #c98716;
}
.rec-next-info {
  border-inline-start-color: var(--info);
}
.rec-next-success {
  border-inline-start-color: var(--ok);
}

/* --- cards / kv / stats ------------------------------------------------------------ */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin-block-end: 16px;
  box-shadow: var(--sh-1);
  min-width: 0;
}
.card-title {
  font-size: 14px;
  padding-block-end: 0.55rem;
  border-block-end: 1px solid var(--line-2);
  margin-block-end: 0.8rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.two-col > .card {
  margin: 0;
}
.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  margin: 0;
  font-size: 13.5px;
}
.kv dt {
  color: var(--muted);
  font-weight: 600;
  font-size: 12.5px;
  padding-block-start: 1px;
}
.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}
/* H2A — before/after snapshots inside the account history table. */
.kv-compact {
  font-size: 0.8rem;
  gap: 0.15rem 0.6rem;
}
.kv-compact dt {
  direction: ltr;
  font-weight: 500;
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-block-end: 16px;
}
.stats a {
  text-decoration: none;
  color: inherit;
}
.stat {
  position: relative;
  height: 100%;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 16px 12px;
  box-shadow: var(--sh-1);
  transition:
    border-color 0.12s,
    box-shadow 0.12s;
}
.stats a:hover .stat {
  border-color: #b9c6d8;
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.07);
}
.stat::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 3px;
  background: var(--primary);
}
.stat-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.3px;
}
.stat-label {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}
.stat-info::before {
  background: var(--info);
}
.stat-warn::before {
  background: #c98716;
}
.stat-warn .stat-value {
  color: var(--warn);
}
.stat-danger::before {
  background: var(--bad);
}
.stat-danger .stat-value {
  color: var(--bad);
}
.stat-success::before {
  background: var(--ok);
}
.stat-muted::before {
  background: var(--faint);
}
.stat-na .stat-value {
  color: var(--faint);
}
.dashboard .dash-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.dash-grid > .card {
  margin: 0;
}
.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-block-end: 0.75rem;
}
.sector-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 13px;
}
.sector-filter select {
  width: auto;
}

/* --- badges -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--neutral-line);
  white-space: nowrap;
  vertical-align: middle;
  line-height: 1.5;
}
.badge-muted {
  background: var(--neutral-soft);
  color: var(--neutral);
}
.badge-brand {
  background: var(--link-soft);
  border-color: #c9d9ef;
  color: var(--primary);
}
.badge-info {
  background: var(--info-soft);
  border-color: var(--info-line);
  color: var(--info);
}
.badge-warn {
  background: var(--warn-soft);
  border-color: var(--warn-line);
  color: var(--warn);
}
.badge-danger {
  background: var(--bad-soft);
  border-color: var(--bad-line);
  color: var(--bad);
}

/* ONLINE TENANCY T1 — the server-configured workspace notice (setup, suspension, Demo). */
.workspace-notices {
  display: grid;
  gap: 6px;
  padding: 10px 24px 0;
}
.workspace-notice {
  border: 1px solid var(--info-line);
  background: var(--info-soft);
  color: var(--info);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
}
.workspace-notice-demo {
  border-color: var(--warn-line);
  background: var(--warn-soft);
  color: var(--warn);
  font-weight: 600;
}
.badge-success {
  background: var(--ok-soft);
  border-color: var(--ok-line);
  color: var(--ok);
}
.badge.stage {
  white-space: normal;
}
.legend {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.89rem;
  color: var(--muted);
  margin-block-end: 0.75rem;
}

/* --- buttons ---------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 7px;
  border: 1px solid var(--line-3);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.3;
  white-space: nowrap;
}
.btn:hover {
  background: var(--hover);
  text-decoration: none;
}
.btn:disabled {
  opacity: 0.55;
  cursor: progress;
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-2);
}
.btn-secondary:hover {
  border-color: #b9c4d3;
}
.btn-danger {
  background: #fff;
  border-color: var(--bad-line);
  color: var(--bad);
}
.btn-danger:hover {
  background: var(--bad-soft);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--link);
}
.btn-ghost:hover {
  background: var(--link-soft);
}
.btn-sm {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12.5px;
  border-radius: 6px;
}
.btn-lg {
  min-height: 44px;
  padding: 0 1.6rem;
  font-size: 1.05rem;
}
.row-actions {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

/* --- tables ------------------------------------------------------------------------------ */
.table-wrap {
  overflow-x: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--sh-1);
}
.card .table-wrap {
  box-shadow: none;
}
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.table th {
  text-align: start;
  background: #f7f8fa;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 9px 12px;
  border-block-end: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 9px 12px;
  border-block-end: 1px solid var(--line-2);
  vertical-align: middle;
}
.table tbody tr:last-child td {
  border-block-end: 0;
}
.table tr.row-link {
  cursor: pointer;
}
.table tr.row-link:hover td {
  background: var(--hover);
}
.actions-cell {
  width: 1%;
  white-space: nowrap;
}
.empty {
  padding: 1.75rem;
  text-align: center;
  color: var(--muted);
  background: var(--paper);
  border: 1px dashed var(--line-3);
  border-radius: 10px;
}
.pager {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-end;
  margin-block: 0.75rem;
  color: var(--muted);
  font-size: 12.5px;
}
.next-session,
.last-activity {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.next-session .badge {
  align-self: flex-start;
}

/* --- forms -------------------------------------------------------------------------------- */
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-block-end: 1rem;
  align-items: center;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.filters input[type='search'] {
  flex: 1 1 260px;
}
.check {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
}
input,
select,
textarea {
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-3);
  border-radius: 7px;
  padding: 0.4rem 0.7rem;
  min-width: 0;
  width: 100%;
}
input:not([type='checkbox']):not([type='radio']):not([type='file']),
select {
  min-height: 34px;
}
.filters input,
.filters select {
  width: auto;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #8aa7d1;
  box-shadow: 0 0 0 3px rgba(47, 111, 208, 0.14);
}
.btn:focus-visible,
.tab:focus-visible,
.icon-btn:focus-visible,
.identity:focus-visible {
  outline: 2px solid #2f6fd0;
  outline-offset: 2px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem 1.25rem;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.field-wide {
  grid-column: 1 / -1;
}
.field label {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--ink-2);
}
.field-check {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}
.field-check input {
  width: auto;
}
.req {
  color: var(--bad);
}
.help {
  font-size: 0.82rem;
  color: var(--muted);
}
.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.5rem;
  margin-block-start: 0.5rem;
}

/* --- v6.7: discussions thread, comments, attachments ------------------------------------- */
.thread {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.thread-item {
  background: var(--paper);
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--primary);
  border-radius: 10px;
  padding: 0.85rem 1rem;
}
.thread-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-block-end: 0.5rem;
}
.thread-meta {
  font-size: 0.82rem;
  color: var(--muted);
}
.thread-body {
  margin: 0 0 0.5rem;
  white-space: pre-wrap;
  line-height: 1.75;
}
.thread-foot {
  margin-block-end: 0.5rem;
}
.prewrap {
  white-space: pre-wrap;
}
.upload-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-block-end: 0.75rem;
}
.file-input {
  max-width: 340px;
}
/* The two tracks, told apart at a glance: official = primary, internal = warn. */
.track-banner {
  border-radius: 10px;
  padding: 0.7rem 1rem;
  margin-block-end: 0.75rem;
  font-size: 0.93rem;
  line-height: 1.7;
  border: 1px solid var(--line);
}
.track-banner.official {
  background: var(--link-soft);
  border-inline-start: 4px solid var(--primary);
}
.track-banner.internal {
  background: var(--warn-soft);
  border-inline-start: 4px solid #c98716;
}

/* --- v6.8A: operational views ---------------------------------------------------------- */
.hits {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.hit {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
}
.hit-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.hit-context {
  margin-block-start: 0.2rem;
}
.cal-days {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.cal-day {
  margin: 0;
}
.cal-day-today {
  border-inline-start: 4px solid var(--info);
}
.cal-events {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.cal-event {
  padding: 0.4rem 0;
  border-block-end: 1px solid var(--line-2);
}
.cal-event:last-child {
  border-block-end: none;
}
.cal-event > a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  flex-wrap: wrap;
}
.cal-event > a:hover .cal-title {
  color: var(--link);
  text-decoration: underline;
}
.cal-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.cal-chip-session svg.ic {
  color: #1d4f86;
}
.cal-chip-appeal svg.ic {
  color: var(--bad);
}
.cal-chip-request_due svg.ic {
  color: var(--info);
}
.cal-chip-task_due svg.ic {
  color: var(--ok);
}
.cal-time {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--ink-2);
  direction: ltr;
  unicode-bidi: isolate;
}
.cal-ident {
  margin-block-start: 2px;
  padding-inline-start: 2px;
}
.tabs .tab {
  text-decoration: none;
}

/* --- v5→v6 parity: the involved Work Team on the request overview --------------------- */
.team-primary {
  margin-block-end: 0.6rem;
}
.team-list {
  list-style: none;
  margin: 0 0 0.6rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.team-item {
  background: var(--paper);
  border: 1px solid var(--line);
  border-inline-start: 4px solid #c98716;
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
}
.team-item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-block-end: 0.35rem;
}
.team-item-body {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  font-size: 0.93rem;
  margin-block-end: 0.35rem;
}
.team-item-stage {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}
.team-member-picker {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.team-member-picker .field {
  margin: 0;
}

/* --- dialogs ------------------------------------------------------------------------ */
.dialog {
  border: none;
  border-radius: 12px;
  padding: 0;
  max-width: min(640px, 94vw);
  width: 100%;
  box-shadow: var(--sh-2);
}
.dialog::backdrop {
  background: rgba(15, 23, 42, 0.38);
}
.dialog-form {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  direction: rtl;
}
.dialog-intro {
  color: var(--muted);
  font-size: 0.93rem;
  margin: 0;
}
.dialog-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-start;
  margin-block-start: 0.5rem;
}

/* --- alerts / toasts ------------------------------------------------------------------ */
.alert {
  border-radius: 9px;
  padding: 0.7rem 1rem;
  border: 1px solid;
  margin-block: 0.5rem;
  font-size: 13px;
}
.alert-detail {
  font-size: 0.93rem;
  margin-block-start: 0.15rem;
}
.alert-muted {
  background: var(--paper-2);
  border-color: var(--line);
  color: var(--ink-2);
}
.alert-info {
  background: var(--info-soft);
  border-color: var(--info-line);
  color: #1d466b;
}
.alert-warn {
  background: var(--warn-soft);
  border-color: var(--warn-line);
  color: #6b4206;
}
.alert-danger {
  background: var(--bad-soft);
  border-color: var(--bad-line);
  color: #7c1d17;
}
.alert-success {
  background: var(--ok-soft);
  border-color: var(--ok-line);
  color: #145235;
}
#toasts {
  position: fixed;
  inset-block-end: 1rem;
  inset-inline-start: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 1000;
  max-width: 420px;
}
.toast {
  padding: 0.65rem 1rem;
  border-radius: 9px;
  color: #fff;
  box-shadow: var(--sh-2);
  font-weight: 600;
}
.toast-success {
  background: var(--ok);
}
.toast-warn {
  background: var(--warn);
}
.toast-danger {
  background: var(--bad);
}
.toast-info,
.toast-brand {
  background: #17233d;
}
.toast-muted {
  background: var(--ink-2);
}

/* --- tabs: ONE row that scrolls, never wraps, never clips silently ------------------ */
.tabs-strip {
  position: relative;
  margin-block-end: 1rem;
}
.tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  border-block-end: 1px solid var(--line);
  margin-block-end: 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--line-3) transparent;
}
.tabs-strip .tabs {
  margin-block-end: 0;
}
.tabs-strip::before,
.tabs-strip::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 1px;
  width: 36px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
/* RTL: the START of the row is the right-hand edge. */
.tabs-strip::before {
  inset-inline-start: 0;
  background: linear-gradient(to left, var(--ground), rgba(244, 245, 247, 0));
}
.tabs-strip::after {
  inset-inline-end: 0;
  background: linear-gradient(to right, var(--ground), rgba(244, 245, 247, 0));
}
.tabs-strip.more-start::before,
.tabs-strip.more-end::after {
  opacity: 1;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  background: none;
  border: none;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  padding: 10px 13px 9px;
  cursor: pointer;
  border-block-end: 2px solid transparent;
  margin-block-end: -1px;
  white-space: nowrap;
}
.tab:hover {
  color: var(--ink);
}
.tab.active {
  color: var(--ink);
  border-block-end-color: var(--primary);
}
.tab-panel:focus {
  outline: none;
}
.tab-panel:focus-visible {
  outline: 2px solid #2f6fd0;
  outline-offset: 4px;
}
.timeline {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}
.step {
  border-block-start: 4px solid var(--line);
  padding-block-start: 0.4rem;
}
.step-title {
  font-weight: 700;
  font-size: 0.93rem;
}
.step-detail {
  font-size: 0.86rem;
  color: var(--muted);
}
.step-done {
  border-block-start-color: var(--ok);
}
.step-active {
  border-block-start-color: #c98716;
}
.step-pending {
  border-block-start-color: var(--info);
}
.step-danger {
  border-block-start-color: var(--bad);
}
.step-danger .step-detail {
  color: var(--bad);
  font-weight: 700;
}
.wf {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.wf-step {
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: var(--neutral-soft);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--neutral-line);
}
.wf-step.done {
  background: var(--ok-soft);
  border-color: var(--ok-line);
  color: var(--ok);
}
.wf-step.current {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
/* PM correction 3 — a step that did not apply (a portal request's GM triage). */
.wf-step.skipped {
  border-style: dashed;
  color: var(--muted);
  text-decoration: line-through;
}
.stage-cell {
  min-width: 180px;
}

/* --- picker ---------------------------------------------------------------------------- */
.picker {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.chips {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.chip {
  background: var(--link-soft);
  color: var(--primary);
  border-radius: 999px;
  padding: 0.1rem 0.3rem 0.1rem 0.7rem;
  font-size: 0.89rem;
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
}
.chip-x {
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
  line-height: 1;
}
.picker-results {
  position: absolute;
  inset-block-start: 100%;
  inset-inline: 0;
  z-index: 20;
  list-style: none;
  margin: 0.2rem 0 0;
  padding: 0.25rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--sh-2);
  max-height: 260px;
  overflow: auto;
}
.picker-item {
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.picker-item:hover {
  background: var(--link-soft);
}
.picker-name {
  font-weight: 600;
}
.picker-meta {
  font-size: 0.82rem;
  color: var(--muted);
}
.picker-empty {
  padding: 0.5rem 0.6rem;
  color: var(--muted);
  font-size: 0.89rem;
}

/* --- login / boot ------------------------------------------------------------------------ */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, var(--shell-3) 0%, var(--shell) 60%, #0d152a 100%);
  padding: 1rem;
}
.login-card {
  background: var(--paper);
  border-radius: 16px;
  padding: 2.5rem 2.25rem;
  max-width: 460px;
  width: 100%;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  border-block-start: 5px solid var(--gold-on-dark);
}
.boot,
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--muted);
  padding: 2rem;
}
.spin {
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--line);
  border-block-start-color: var(--primary);
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* v6.8B — management analytics: bar charts drawn from server buckets, compliance figure, period bar */
.period-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-block-end: 1rem;
}
.period-bar .tabs {
  margin: 0;
}
.period-custom {
  padding: 6px 10px;
  margin: 0;
}
.period-custom label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-inline-end: 0.5rem;
  font-size: 0.93rem;
}
.bars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}
.bar-row {
  display: grid;
  grid-template-columns: minmax(7rem, 1fr) 3fr auto;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.93rem;
}
.bar-label {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-track {
  background: var(--line-2);
  border-radius: 999px;
  height: 0.7rem;
  overflow: hidden;
}
.bar-fill {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
}
.bar-value {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--muted);
}
.bars a {
  text-decoration: none;
  color: inherit;
}
.bars a:hover .bar-fill {
  background: var(--info);
}
.compliance {
  display: grid;
  gap: 0.5rem;
  padding: 0.5rem 0;
}
.compliance-value {
  font-size: 2.3rem;
  font-weight: 800;
  line-height: 1.1;
}
.compliance-ratio {
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}
.compliance-parts a {
  text-decoration: none;
}
.sub-title {
  font-size: 0.97rem;
  color: var(--muted);
  margin: 1rem 0 0.5rem;
  font-weight: 700;
}
.stat-drill {
  margin-block-start: 0.25rem;
}
.filter-badges {
  margin-block-end: 0.75rem;
}
td.num,
th.num {
  text-align: center;
  font-variant-numeric: tabular-nums;
}
/* --- v6.9 audit ---------------------------------------------------------------------- */
.audit-filters .filter-picker .filter-label {
  font-size: 0.82rem;
  color: var(--muted);
}
.audit-filters .filter-picker .picker-results {
  min-width: 16rem;
}
.audit-filters .filter {
  display: inline-flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.89rem;
  color: var(--ink-2);
}
.list-meta {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  margin-block-end: 0.6rem;
}
.filter-chips {
  display: inline-flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.audit-actor-name {
  font-weight: 600;
}
.audit-action {
  white-space: nowrap;
}
.nowrap {
  white-space: nowrap;
}
.audit-history .table-wrap {
  margin-block-start: 0.25rem;
}
.audit-raw {
  margin-block-start: 0.5rem;
}
.audit-json {
  direction: ltr;
  text-align: left;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 0.89rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 24rem;
  overflow: auto;
  margin: 0;
}
/* --- v6.10 technical opinions (restyled; the product rules are unchanged) ------------ */
.to-list {
  display: grid;
  gap: 1rem;
}
.to-card {
  border-inline-start: 4px solid var(--line-3);
}
.to-card[data-state='overdue'] {
  border-inline-start-color: var(--bad);
}
.to-card[data-state='due_soon'] {
  border-inline-start-color: #c98716;
}
.to-card[data-state='responded'] {
  border-inline-start-color: var(--ok);
}
.to-card .card {
  box-shadow: none;
  border: 1px solid var(--line);
  background: var(--paper-2);
  margin-block-start: 0.75rem;
}
.to-text {
  white-space: pre-wrap;
  line-height: 1.75;
  margin: 0.25rem 0 0;
}
.to-notices {
  margin-block-start: 0.75rem;
  font-size: 0.93rem;
  color: var(--ink-2);
}
.to-notices summary {
  cursor: pointer;
  font-weight: 600;
}
.to-notice-list {
  margin: 0.5rem 0 0;
  padding-inline-start: 1.25rem;
  display: grid;
  gap: 0.35rem;
}
.dialog-warning .dialog-form {
  border-block-start: 4px solid #c98716;
}

/* --- PM closure correction 1: «مساحة الإدارة التقنية» ------------------------------------ */
.ws-cards {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.ws-cards a,
.ws-cards a:hover {
  text-decoration: none;
  color: inherit;
}
.ws-card {
  height: 100%;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--gold);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: var(--sh-1);
  transition:
    border-color 0.12s,
    box-shadow 0.12s;
}
.ws-cards a:hover .ws-card,
.ws-cards a:focus-visible .ws-card {
  border-color: #b9c6d8;
  border-inline-start-color: var(--gold);
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.08);
}
.ws-card-ic {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--shell);
  color: var(--gold-on-dark);
}
.ws-card-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}
.ws-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.ws-card-body {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.7;
}
.ws-card-go {
  align-self: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--link);
  flex: none;
}

/* --- UI IMPLEMENTATION A: the Service Guide and the case report ------------------------- */
.guide-dept {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.case-report {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.report-actions {
  margin: 0;
}
.report-head {
  background: #fff;
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--gold);
  border-radius: 10px;
  padding: 14px 18px;
}
.report-kicker {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}
.report-title {
  font-size: 18px;
  font-weight: 700;
}
.report-sub {
  color: var(--ink-2);
}
.report-block {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
}
.report-block h2 {
  font-size: 14px;
  margin-block-end: 0.6rem;
  padding-block-end: 0.4rem;
  border-block-end: 1px solid var(--line-2);
}

/* --- UI IMPLEMENTATION B — «تخصيص اللوحة» ------------------------------------------------ */
/* A `full` block spans both grid columns; `half` is the Implementation A single column. */
.dashboard .dash-grid > .dash-full {
  grid-column: 1 / -1;
}
/* The side sheet: a modal <dialog> docked at the inline end, full height. */
.sheet {
  border: none;
  padding: 0;
  margin: 0;
  margin-inline-start: auto;
  inset-block: 0;
  height: 100%;
  max-height: 100%;
  width: min(460px, 100vw);
  max-width: 100vw;
  background: var(--paper);
  box-shadow: var(--sh-2);
  direction: rtl;
}
.sheet[open] {
  display: flex;
  flex-direction: column;
}
.sheet::backdrop {
  background: rgba(15, 23, 42, 0.38);
}
.sheet-head {
  height: var(--top-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 16px;
  border-block-end: 1px solid var(--line);
  flex: none;
}
.sheet-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  flex: 1;
}
.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 16px;
}
.sheet-sub {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  margin: 14px 0 6px;
}
.sheet-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-block-start: 1px solid var(--line);
  flex: none;
}
.sheet-actions [data-testid='customize-reset'] {
  margin-inline-start: auto;
}
.cust-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cust-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--paper);
}
.cust-row.cust-hidden {
  background: var(--neutral-soft);
}
.cust-row.cust-hidden .cust-label > span {
  color: var(--muted);
}
.cust-row.cust-dragging {
  opacity: 0.5;
}
.cust-row.cust-drop {
  border-color: var(--link);
  background: var(--link-soft);
}
.cust-grip {
  display: inline-flex;
  color: var(--faint);
  cursor: grab;
}
.cust-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  font-size: 13px;
  cursor: pointer;
}
.cust-label input[type='checkbox'] {
  width: auto;
  flex: none;
  margin: 0;
  padding: 0;
}
.cust-label > span {
  line-height: 1.4;
}
.cust-width {
  font-size: 12px;
  padding: 2px 6px;
  width: auto;
  flex: none;
  max-width: 120px;
}
.cust-moves {
  display: inline-flex;
  gap: 2px;
}
.cust-move[disabled] {
  opacity: 0.35;
  cursor: default;
}

/* --- responsive ---------------------------------------------------------------------------- */
@media (max-width: 1200px) {
  .top-search {
    width: 220px;
    flex-basis: 220px;
  }
  .top-search:focus-within {
    width: 280px;
  }
  .identity-text {
    display: none;
  }
}
@media (max-width: 1100px) {
  .dashboard .dash-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 900px) {
  .side-nav {
    width: var(--nav-w-c);
  }
  .nav-brand {
    padding: 0;
    justify-content: center;
  }
  .brand-text,
  .nav-text,
  .nav-foot,
  .nav-group-title span,
  .nav-group-title .chev {
    display: none;
  }
  .nav-list a {
    justify-content: center;
    padding: 0;
  }
  .top-search {
    display: none;
  }
  .content {
    padding: 1rem;
  }
  .two-col,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .timeline {
    grid-template-columns: 1fr 1fr;
  }
}

/* --- print: the case report («طباعة / PDF») ----------------------------------------------- */
@media print {
  body {
    background: #fff;
  }
  .side-nav,
  .top-bar,
  .drawer,
  .skip-link,
  #toasts,
  .report-actions {
    display: none !important;
  }
  .content {
    padding: 0;
    max-width: none;
  }
  .content:has(.case-report) .rec,
  .content:has(.case-report) .tabs-strip {
    display: none;
  }
  .card,
  .table-wrap,
  .report-block,
  .report-head {
    box-shadow: none;
  }
  .report-block {
    break-inside: avoid-page;
  }
  a {
    color: inherit;
  }
}

/* ===========================================================================
   PRE-T3 PRODUCT REFINEMENT R1 — files, sessions, work, indicators, calendar
   Calm, token-based; no inline styles (CSP).
   =========================================================================== */
.file-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--ground);
}
.file-item .file-name {
  flex: 0 1 auto;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.file-item .file-title {
  flex: 1 1 160px;
  min-width: 120px;
}
.attach-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.attach-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
}
.attach-title {
  flex: 1 1 200px;
  overflow-wrap: anywhere;
}
.thread-title {
  margin: 4px 0;
  font-size: 15px;
  color: var(--ink);
}
.official-track {
  list-style: none;
  margin: 12px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.official-step {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--ok);
  border-radius: 6px;
  background: var(--paper);
}
.exec-summary .stats {
  margin-top: 10px;
}
.compact-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.compact-list li {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
}
.sortable {
  white-space: nowrap;
}
.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.disclosure {
  margin-top: 12px;
}
.disclosure > summary {
  cursor: pointer;
  list-style-position: inside;
}
.kpi-r1 .kpi-formula {
  margin-top: 6px;
}
.kpi-r1 .kpi-formula summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
}
.last-update {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 320px;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin: 12px 0 16px;
}
.cal-head {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding: 4px 0;
}
.cal-cell {
  min-height: 64px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.cal-cell:hover {
  background: var(--hover);
}
.cal-cell.cal-blank {
  border: none;
  background: transparent;
  cursor: default;
}
.cal-cell.cal-today {
  border-color: var(--info);
  box-shadow: inset 0 0 0 1px var(--info);
}
.cal-num {
  font-weight: 600;
  color: var(--ink);
}
.cal-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}
@media (max-width: 720px) {
  .cal-cell {
    min-height: 44px;
    padding: 4px;
  }
  .cal-head {
    font-size: 10px;
  }
  .file-item {
    flex-wrap: wrap;
  }
}

/* --- PRE-T3 R1 correction 4: the portal catalogue — family sections → service cards ---- */
.svc-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.svc-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: var(--sh-1);
}
.svc-card h3 {
  margin: 0;
  font-size: 14px;
  color: var(--ink);
}
.svc-card .svc-meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.svc-summary {
  border: 1px solid var(--info-line);
  background: var(--info-soft);
  border-radius: 10px;
  padding: 12px 14px;
  margin-block-end: 14px;
}
.svc-summary ul {
  margin: 4px 0 0;
  padding-inline-start: 18px;
}
