/*
 * INSPIRE — application shell and components.
 * Depends on styles/tokens.css for every colour and measure.
 */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { overflow: hidden; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
p { margin: 0 0 var(--sp-3); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

::selection { background: var(--accent-soft); color: var(--text); }

/* Every inline icon gets a sane default size; the component rules below
   override it where a different size is wanted. Without this an icon dropped
   into a new context inherits nothing and renders at its intrinsic size. */
.icon {
  width: 17px;
  height: 17px;
  flex: none;
  vertical-align: middle;
}

/* Numerals stay Latin even in Arabic, which is the convention in finance and
   HR reporting at Direct Aid and keeps columns aligned. */
.num, td.num, .metric-value, time { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--n-300) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: var(--r-full);
  border: 3px solid transparent; background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--n-400); background-clip: content-box; }

/* ============================================================ app layout */
#app { height: 100vh; }

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas: "sidebar topbar" "sidebar main";
  height: 100vh;
  /* The page carries a soft wash of the active brand; every translucent
     surface above it (sidebar, top bar, metric tiles) blurs THIS, which is
     what makes the glass read as glass rather than as flat grey. */
  background: var(--page-wash), var(--bg);
  background-attachment: fixed;
  transition: grid-template-columns var(--t-base) var(--ease);
}
.shell.collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

/* ---------------------------------------------------------------- sidebar */
.sidebar {
  grid-area: sidebar;
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  border-inline-end: 1px solid var(--nav-line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 30;
}

.brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding-inline: var(--sp-4);
  border-block-end: 1px solid var(--nav-line);
  flex: none;
}
.brand-mark {
  width: 32px; height: 32px; flex: none;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--on-accent);
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px; letter-spacing: -0.03em;
}
.brand-text { min-width: 0; }
.brand-name {
  color: var(--nav-text);
  font-weight: 650; font-size: var(--fs-md); letter-spacing: -0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-org {
  font-size: var(--fs-xs); color: var(--nav-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.collapsed .brand-text { display: none; }

.nav {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: var(--sp-3) var(--sp-2) var(--sp-4);
}
.nav-group-label {
  padding: var(--sp-4) var(--sp-3) var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--nav-muted);
}

/* ------------------------------------------------- collapsible nav groups */
/* Twenty-one modules in one flat list is unreadable. Each group is a
   disclosure: opening one closes the others, so at most one group's items
   are on screen at a time. */
.nav-group {
  width: 100%;
  display: flex; align-items: center; gap: var(--sp-2);
  margin-block-start: var(--sp-2);
  padding: 9px var(--sp-3);
  border: 0; border-radius: var(--r-md);
  background: transparent; color: var(--nav-muted);
  font: inherit; font-size: var(--fs-xs); font-weight: 650;
  letter-spacing: .04em; text-align: start; cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.nav-group:hover { background: var(--nav-group-bg); color: var(--nav-text); }
.nav-group[aria-expanded="true"] { background: var(--nav-group-bg); color: var(--nav-text); }
.nav-group .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-group .chev {
  flex: none; width: 16px; height: 16px;
  transition: transform var(--t-base) var(--ease);
}
.nav-group[aria-expanded="false"] .chev { transform: rotate(-90deg); }
[dir="rtl"] .nav-group[aria-expanded="false"] .chev { transform: rotate(90deg); }
.nav-count {
  flex: none; font-size: 10px; font-weight: 600;
  opacity: .8; font-variant-numeric: tabular-nums;
}
.nav-group-items { display: flex; flex-direction: column; gap: 2px; }

/* A caption inside a section — "إدارة الخدمات" over the two service entries.
   Carried over from the original app, where it labelled a run of items and
   was not itself clickable. Styled off the same muted nav token as the group
   labels so it adds structure without adding a colour. */
.nav-cap {
  padding: var(--sp-3) var(--sp-3) var(--sp-1);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .05em;
  color: var(--nav-muted);
}
.nav-group-items .nav-cap:first-child { padding-block-start: var(--sp-2); }

.collapsed .nav-cap { display: none; }

/* An entry whose screen is not built yet. It keeps its place and its colour;
   only the weight of the ink changes, so it reads as "not yet" rather than as
   a different kind of thing. */
.nav-pending { opacity: .62; }
.nav-pending:hover { opacity: 1; }
.collapsed .nav-group, .collapsed .nav-count { display: none; }
.collapsed .nav-group-label {
  padding: var(--sp-3) 0 var(--sp-1);
  text-align: center;
  font-size: 9px;
  letter-spacing: 0;
}

.nav-item {
  width: 100%;
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 9px var(--sp-3);
  margin-block-end: 2px;
  border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--nav-text);
  font: inherit; font-size: var(--fs-base); text-align: start;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  position: relative;
}
.nav-item { color: var(--nav-text); border-radius: var(--r-md); }
.nav-item:hover { background: var(--nav-group-bg); }
.nav-item.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(16, 40, 25, .10);
}

/* A section that is a destination rather than a disclosure (Tasks, Reports,
   Alerts) sits at section level, so it carries the section's weight. Declared
   after .nav-item so it wins the cascade on colour — both are one class deep. */
.nav-item-top {
  margin-block-start: var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 650;
  letter-spacing: .04em;
  color: var(--nav-muted);
}
.nav-item-top:hover { color: var(--nav-text); }
.nav-item-top.active { color: var(--nav-active-text); }
.collapsed .nav-item-top { margin-block-start: 0; font-size: var(--fs-base); }
.nav-item .icon { flex: none; width: 18px; height: 18px; }
.nav-item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-badge {
  flex: none; min-width: 20px; height: 18px; padding: 0 6px;
  border-radius: var(--r-full);
  background: var(--err); color: #fff;
  font-size: var(--fs-xs); font-weight: 600;
  display: grid; place-items: center;
}
.collapsed .nav-item { justify-content: center; padding-inline: 0; }
.collapsed .nav-item .label { display: none; }
.collapsed .nav-badge {
  position: absolute; inset-block-start: 2px; inset-inline-end: 6px;
  min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px;
}

.sidebar-foot {
  flex: none; padding: var(--sp-2);
  border-block-start: 1px solid var(--nav-line);
}

/* ----------------------------------------------------------------- topbar */
.topbar {
  grid-area: topbar;
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  border-block-end: 1px solid var(--glass-line);
  display: flex; align-items: center; gap: var(--sp-3);
  padding-inline: var(--sp-4);
  z-index: 20;
}
.topbar-title { font-size: var(--fs-md); font-weight: 650; letter-spacing: -0.02em; }
.topbar-spacer { flex: 1; }

.search {
  position: relative;
  flex: 0 1 380px;
  min-width: 140px;
}
.search input {
  width: 100%;
  height: 36px;
  padding-inline: 34px var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font: inherit; font-size: var(--fs-base);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.search input:focus {
  outline: none; border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search .icon {
  position: absolute; inset-inline-start: 10px; inset-block-start: 9px;
  width: 17px; height: 17px; color: var(--text-3); pointer-events: none;
}
.search-results {
  position: absolute; inset-inline: 0; inset-block-start: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  max-height: 60vh; overflow-y: auto;
  z-index: 60;
  padding: var(--sp-1);
}
.search-result {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; padding: var(--sp-2) var(--sp-3);
  border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text);
  font: inherit; text-align: start; cursor: pointer;
}
.search-result:hover { background: var(--surface-3); }
.search-result .module { font-size: var(--fs-xs); color: var(--text-3); }

/* ------------------------------------------------------------------- main */
.main {
  grid-area: main;
  overflow-y: auto;
  min-width: 0;
  scroll-behavior: smooth;
}
.page { padding: var(--sp-6); max-width: 1500px; margin-inline: auto; }
.page-head {
  display: flex; align-items: flex-start; gap: var(--sp-4);
  margin-block-end: var(--sp-5); flex-wrap: wrap;
}
.page-title { font-size: var(--fs-xl); font-weight: 650; letter-spacing: -0.025em; }
.page-sub { color: var(--text-2); font-size: var(--fs-sm); margin-block-start: 2px; }
.page-actions { margin-inline-start: auto; display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* ============================================================= components */

/* -- buttons -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2);
  height: 34px; padding-inline: var(--sp-4);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit; font-size: var(--fs-base); font-weight: 550;
  cursor: pointer; white-space: nowrap;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast),
              color var(--t-fast), transform var(--t-fast);
}
.btn:hover:not(:disabled) { background: var(--surface-3); border-color: var(--n-300); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn.primary {
  background: var(--accent); border-color: var(--accent); color: var(--on-accent);
}
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--surface-3); border-color: transparent; }
.btn.danger { color: var(--err); border-color: var(--line); }
.btn.danger:hover:not(:disabled) { background: var(--err-soft); border-color: var(--err); }
.btn.sm { height: 28px; padding-inline: var(--sp-3); font-size: var(--fs-sm); }
.btn.icon-only { width: 34px; padding-inline: 0; }
.btn.icon-only.sm { width: 28px; }
.btn .icon { width: 16px; height: 16px; flex: none; }

/* -- cards -- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-block-end: 1px solid var(--line-soft);
}
.card-title { font-size: var(--fs-md); font-weight: 620; }
.card-body { padding: var(--sp-5); }
.card-body.flush { padding: 0; }

/* -- metric tiles -- */
/* Tiles carry one number each. At minmax(200px) on a 1440px screen five of
   them spread out and each held a number in a 110px-tall box that was mostly
   air; the charts below — the part you actually read — were pushed off the
   fold. Narrower, shorter, and closer together: same six figures, half the
   vertical cost. */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(164px, 1fr));
  gap: var(--sp-3);
  margin-block-end: var(--sp-4);
}
.metric {
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-line);
  border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 2px;
  position: relative; overflow: hidden;
}
.metric-label {
  font-size: var(--fs-sm); color: var(--text-2); font-weight: 550;
  display: flex; align-items: center; gap: var(--sp-2);
}
.metric-label .icon { width: 15px; height: 15px; color: var(--text-3); }
.metric-value {
  font-size: var(--fs-xl); font-weight: 650; letter-spacing: -0.03em; line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.metric-note { font-size: var(--fs-xs); color: var(--text-3); }

/* -- tables -- */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); }
table.grid {
  width: 100%; border-collapse: collapse; font-size: var(--fs-base);
}
table.grid th {
  text-align: start; font-weight: 600; font-size: var(--fs-sm);
  color: var(--text-2);
  padding: var(--sp-2) var(--sp-4);
  background: var(--surface-2);
  border-block-end: 1px solid var(--line);
  white-space: nowrap; position: sticky; inset-block-start: 0; z-index: 2;
}
table.grid th.sortable { cursor: pointer; user-select: none; }
table.grid th.sortable:hover { color: var(--text); }
table.grid th .sort-mark { margin-inline-start: 4px; opacity: .55; font-size: 10px; }
table.grid td {
  padding: var(--sp-2) var(--sp-4);
  border-block-end: 1px solid var(--line-soft);
  vertical-align: middle;
  max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* A header like "الكود الجديد AX" mixes scripts. Without isolation the browser
   reorders the run and renders "AXالكود الجديد" — the Latin part jumps to the
   wrong end of the phrase. Isolating every cell fixes it table-wide. */
table.grid th, table.grid td { unicode-bidi: isolate; }
table.grid tbody tr { transition: background var(--t-fast); }
table.grid tbody tr:hover { background: var(--surface-2); }
table.grid tbody tr.clickable { cursor: pointer; }
/* Both the body cell AND the header must claim no width. With only the body
   cell shrunk, the unconstrained header took every spare pixel and opened a
   third of the table as dead space while the data crowded the other edge. */
table.grid th.actions, table.grid td.actions { white-space: nowrap; width: 1%; }
table.grid tbody tr:last-child td { border-block-end: 0; }

/* Three buttons on every row is 8,000 icons on a 2,669-row table. They stay in
   the layout — nothing shifts — but only ink up for the row under the cursor,
   or when tabbed into, so the keyboard path is unharmed. Coarse pointers have
   no hover, so there they stay visible. */
@media (hover: hover) and (pointer: fine) {
  table.grid td.actions .btn { opacity: 0; transition: opacity var(--t-fast); }
  table.grid tbody tr:hover td.actions .btn,
  table.grid td.actions:focus-within .btn { opacity: 1; }
}

/* Yes/no as a dot and a word: same information, a fraction of the ink. */
.bool { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.bool .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.bool.yes .dot { background: var(--ok); }
.bool.yes { color: var(--text); }

/* A quiet label for list values — grouping, not status. */
.tag {
  display: inline-flex; align-items: center;
  height: 19px; padding-inline: 6px;
  border-radius: var(--r-sm);
  background: var(--surface-3); color: var(--text-2);
  font-size: var(--fs-xs); white-space: nowrap;
}

.empty {
  padding: var(--sp-12) var(--sp-6);
  text-align: center; color: var(--text-3);
}
.empty .icon { width: 34px; height: 34px; margin-block-end: var(--sp-3); opacity: .5; }
.empty-title { font-size: var(--fs-md); color: var(--text-2); font-weight: 550; margin-block-end: var(--sp-1); }

/* -- toolbar above a grid -- */
.toolbar {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-block-end: 1px solid var(--line-soft);
  flex-wrap: wrap;
}
.toolbar .search { flex: 0 1 280px; }
.toolbar .spacer { flex: 1; }

.filter-chip {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  height: 28px; padding-inline: var(--sp-3);
  border: 1px solid var(--accent-line); border-radius: var(--r-full);
  background: var(--accent-soft); color: var(--accent);
  font-size: var(--fs-sm); font-weight: 550;
}
.filter-chip button {
  border: 0; background: transparent; color: inherit; cursor: pointer;
  padding: 0; line-height: 1; font-size: 14px;
}

/* -- pagination -- */
.pager {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-block-start: 1px solid var(--line-soft);
  font-size: var(--fs-sm); color: var(--text-2);
  flex-wrap: wrap;
}
.pager .spacer { flex: 1; }

/* -- badges -- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 21px; padding-inline: var(--sp-2);
  border-radius: var(--r-full);
  font-size: var(--fs-xs); font-weight: 600;
  background: var(--surface-3); color: var(--text-2);
  white-space: nowrap;
}
.badge.ok   { background: var(--ok-soft);   color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err  { background: var(--err-soft);  color: var(--err); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

/* -- forms -- */
.field { margin-block-end: var(--sp-4); }
.field label {
  display: block; font-size: var(--fs-sm); font-weight: 550;
  color: var(--text-2); margin-block-end: var(--sp-2);
}
.field label .req { color: var(--err); margin-inline-start: 2px; }
.field .hint { font-size: var(--fs-xs); color: var(--text-3); margin-block-start: var(--sp-1); }
.field .error { font-size: var(--fs-xs); color: var(--err); margin-block-start: var(--sp-1); }

input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="number"], input[type="search"], input[type="tel"], select, textarea {
  width: 100%;
  min-height: 36px;
  padding: 7px var(--sp-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit; font-size: var(--fs-base);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
textarea { min-height: 88px; resize: vertical; line-height: 1.6; }
select { cursor: pointer; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input:disabled, select:disabled, textarea:disabled {
  background: var(--surface-3); color: var(--text-3); cursor: not-allowed;
}
input.invalid, select.invalid, textarea.invalid { border-color: var(--err); }

.checkbox {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-base); cursor: pointer;
}
.checkbox input { width: 16px; height: 16px; min-height: 0; accent-color: var(--accent); cursor: pointer; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0 var(--sp-5);
}
.form-grid .field.wide { grid-column: 1 / -1; }

.fieldset-title {
  grid-column: 1 / -1;
  font-size: var(--fs-sm); font-weight: 650; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .05em;
  padding-block: var(--sp-4) var(--sp-2);
  border-block-end: 1px solid var(--line-soft);
  margin-block-end: var(--sp-4);
}

/* -- modal -- */
.modal-scrim {
  position: fixed; inset: 0; background: var(--scrim);
  display: grid; place-items: center; padding: var(--sp-4);
  z-index: 100;
  animation: fade var(--t-base) var(--ease);
}
.modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: min(760px, 100%);
  max-height: min(88vh, 900px);
  display: flex; flex-direction: column;
  animation: rise var(--t-base) var(--ease);
}
.modal.wide { width: min(1040px, 100%); }
.modal.narrow { width: min(460px, 100%); }
.modal-head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-block-end: 1px solid var(--line-soft);
  flex: none;
}
.modal-title { font-size: var(--fs-md); font-weight: 650; flex: 1; }
.modal-body { padding: var(--sp-5); overflow-y: auto; flex: 1; min-height: 0; }
.modal-foot {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-5);
  border-block-start: 1px solid var(--line-soft);
  flex: none;
}
.modal-foot .spacer { flex: 1; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }

/* -- dropdown menu -- */
.menu {
  position: absolute; z-index: 80;
  min-width: 200px; padding: var(--sp-1);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  animation: fade var(--t-fast) var(--ease);
}
.menu-item {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; padding: 7px var(--sp-3);
  border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text);
  font: inherit; font-size: var(--fs-base); text-align: start; cursor: pointer;
}
.menu-item:hover { background: var(--surface-3); }
.menu-item.active { color: var(--accent); font-weight: 600; }
.menu-item .icon { width: 16px; height: 16px; flex: none; color: var(--text-3); }
.menu-item.active .icon { color: var(--accent); }
.menu-sep { height: 1px; background: var(--line-soft); margin: var(--sp-1) 0; }
.menu-label {
  padding: var(--sp-2) var(--sp-3) var(--sp-1);
  font-size: var(--fs-xs); font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .05em;
}

/* -- avatar -- */
.avatar {
  width: 32px; height: 32px; flex: none;
  border-radius: var(--r-full);
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center;
  font-weight: 650; font-size: var(--fs-sm);
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 56px; height: 56px; font-size: var(--fs-lg); }
.avatar.xl { width: 84px; height: 84px; font-size: var(--fs-xl); }

/* -- tabs -- */
.tabs {
  display: flex; gap: var(--sp-1);
  border-block-end: 1px solid var(--line);
  margin-block-end: var(--sp-5);
  overflow-x: auto;
}
.tab {
  padding: var(--sp-3) var(--sp-4);
  border: 0; border-block-end: 2px solid transparent;
  background: transparent; color: var(--text-2);
  font: inherit; font-size: var(--fs-base); font-weight: 550;
  cursor: pointer; white-space: nowrap;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-block-end-color: var(--accent); font-weight: 620; }

/* -- toast -- */
.toasts {
  position: fixed; inset-block-end: var(--sp-5); inset-inline-end: var(--sp-5);
  display: flex; flex-direction: column; gap: var(--sp-2);
  z-index: 200; max-width: 380px;
}
.toast {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--accent);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-base);
  animation: rise var(--t-base) var(--ease);
}
.toast.ok   { border-inline-start-color: var(--ok); }
.toast.err  { border-inline-start-color: var(--err); }
.toast.warn { border-inline-start-color: var(--warn); }
/* `info` was a supported toast kind with no accent of its own, so it rendered
   with a bare edge while every other kind had one. */
.toast.info { border-inline-start-color: var(--info); }
.toast .icon { width: 17px; height: 17px; flex: none; margin-block-start: 1px; }
.toast.ok .icon { color: var(--ok); }
.toast.err .icon { color: var(--err); }
.toast.warn .icon { color: var(--warn); }
.toast.info .icon { color: var(--info); }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-weight: 600; }
.toast-note { color: var(--text-2); font-size: var(--fs-sm); }

/* -- loading -- */
.spinner {
  width: 18px; height: 18px; flex: none;
  border: 2px solid var(--line);
  border-block-start-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--line-soft) 37%, var(--surface-3) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  border-radius: var(--r-sm);
  height: 14px;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.loading-panel {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-3);
  padding: var(--sp-12); color: var(--text-3);
}

/* -- inline alerts -- */
.alert {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: var(--fs-base);
  margin-block-end: var(--sp-4);
}
.alert .icon { width: 17px; height: 17px; flex: none; margin-block-start: 1px; }
.alert.err  { background: var(--err-soft);  border-color: transparent; color: var(--err); }
.alert.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.alert.info { background: var(--info-soft); border-color: transparent; color: var(--info); }
.alert.ok   { background: var(--ok-soft);   border-color: transparent; color: var(--ok); }

/* -- description list (record detail) -- */
.dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-4) var(--sp-6);
}
.dl-item { min-width: 0; }
.dl-term {
  font-size: var(--fs-xs); font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .04em;
  margin-block-end: 3px;
}
.dl-value { font-size: var(--fs-base); word-break: break-word; }
.dl-value.empty-value { color: var(--text-3); }

/* -- timeline -- */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  display: flex; gap: var(--sp-3);
  padding-block: var(--sp-3);
  position: relative;
}
.timeline-item::before {
  content: ""; position: absolute;
  inset-inline-start: 11px; inset-block-start: 28px; bottom: 0;
  width: 1px; background: var(--line);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  width: 23px; height: 23px; flex: none; z-index: 1;
  border-radius: var(--r-full);
  background: var(--surface-3); color: var(--text-2);
  display: grid; place-items: center;
}
.timeline-dot .icon { width: 13px; height: 13px; }
.timeline-body { flex: 1; min-width: 0; font-size: var(--fs-sm); }
.timeline-time { font-size: var(--fs-xs); color: var(--text-3); }

/* -- charts (hand-drawn SVG, no chart library) -- */
.chart { width: 100%; display: block; overflow: visible; }
.chart .axis-line { stroke: var(--line); stroke-width: 1; }
.chart .grid-line { stroke: var(--line-soft); stroke-width: 1; }
.chart .axis-text { fill: var(--text-3); font-size: 10.5px; font-family: var(--font); }
.chart .bar { fill: var(--accent); transition: opacity var(--t-fast); }
.chart .bar:hover { opacity: .78; }
.chart .line-path { fill: none; stroke: var(--accent); stroke-width: 2;
  stroke-linejoin: round; stroke-linecap: round; }
.chart .area-path { fill: var(--accent); opacity: .12; }
.chart .point { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.chart .donut-track { fill: none; stroke: var(--surface-3); }
.chart .donut-value { fill: none; stroke: var(--accent); stroke-linecap: round; }

.legend { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-block-start: var(--sp-3); }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-2); }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* -- permission matrix -- */
.matrix-wrap { overflow: auto; max-height: 65vh; }
table.matrix { border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
table.matrix th, table.matrix td {
  padding: var(--sp-2) var(--sp-3);
  border-block-end: 1px solid var(--line-soft);
  white-space: nowrap;
}
table.matrix thead th {
  position: sticky; inset-block-start: 0; z-index: 3;
  background: var(--surface-2); font-weight: 600;
  border-block-end: 1px solid var(--line);
}
table.matrix tbody th {
  position: sticky; inset-inline-start: 0; z-index: 2;
  background: var(--surface); text-align: start; font-weight: 550;
}
table.matrix td { text-align: center; }
table.matrix input[type="checkbox"] {
  width: 15px; height: 15px; min-height: 0; accent-color: var(--accent); cursor: pointer;
}
.matrix-module-row th { background: var(--surface-2); font-weight: 650; }

/* -- login -- */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--bg);
}
@media (min-width: 900px) {
  .login-page { grid-template-columns: 1.05fr .95fr; }
}
.login-aside {
  display: none;
  padding: var(--sp-12);
  background:
    radial-gradient(1100px 600px at 20% 0%, var(--brand-700) 0%, transparent 60%),
    linear-gradient(160deg, var(--brand-900), var(--brand-700) 55%, var(--brand-600));
  color: #fff;
  flex-direction: column; justify-content: space-between;
}
@media (min-width: 900px) { .login-aside { display: flex; } }
.login-aside h2 { font-size: var(--fs-3xl); letter-spacing: -0.03em; max-width: 12ch; }
.login-aside p { opacity: .82; max-width: 44ch; font-size: var(--fs-md); line-height: 1.7; }
.login-points { display: flex; flex-direction: column; gap: var(--sp-3); margin-block-start: var(--sp-6); }
.login-point { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-base); opacity: .92; }
.login-point .icon { width: 18px; height: 18px; flex: none; }

.login-main {
  display: grid; place-items: center;
  padding: var(--sp-6);
}
.login-card { width: min(400px, 100%); }
.login-brand { display: flex; align-items: center; gap: var(--sp-3); margin-block-end: var(--sp-6); }
.login-title { font-size: var(--fs-2xl); letter-spacing: -0.03em; margin-block-end: var(--sp-2); }
.login-sub { color: var(--text-2); margin-block-end: var(--sp-6); }
.login-divider {
  display: flex; align-items: center; gap: var(--sp-3);
  margin-block: var(--sp-5); color: var(--text-3); font-size: var(--fs-sm);
}
.login-divider::before, .login-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}
.login-foot {
  margin-block-start: var(--sp-6); display: flex; gap: var(--sp-3);
  align-items: center; justify-content: center;
  font-size: var(--fs-sm); color: var(--text-3);
}

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

@media (max-width: 1024px) {
  .shell, .shell.collapsed {
    grid-template-columns: 1fr;
    grid-template-areas: "topbar" "main";
    /* Below this width the sidebar is off-canvas, so animating the grid
       column is not an affordance — and transitioning a track across a media
       query leaves a stale width behind on resize. */
    transition: none;
  }
  .sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0;
    width: var(--sidebar-w);
    transform: translateX(calc(var(--rtl, -1) * 100%));
    transition: transform var(--t-base) var(--ease);
    box-shadow: var(--shadow-lg);
  }
  :root[dir="rtl"] .sidebar { --rtl: 1; }
  .sidebar.open { transform: none; }
  .sidebar-scrim {
    display: block; position: fixed; inset: 0;
    background: var(--scrim); z-index: 25;
    animation: fade var(--t-fast) var(--ease);
  }
  .page { padding: var(--sp-4); }

  /* At tablet and phone widths the page itself must never scroll sideways.
     Anything that genuinely needs horizontal room — a wide grid — carries its
     own .table-wrap with overflow-x: auto, so nothing is lost by clipping here. */
  .main { overflow-x: hidden; }
  .page { max-width: 100%; }
}

@media (max-width: 720px) {
  .topbar { padding-inline: var(--sp-3); gap: var(--sp-2); }
  .topbar-title { display: none; }
  .search { flex: 1; min-width: 0; }
  .page { padding: var(--sp-3); }
  .page-head { gap: var(--sp-3); }
  .page-actions { width: 100%; }
  .metrics { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-3); }
  .metric-value { font-size: var(--fs-xl); }
  .modal { max-height: 94vh; }
  .modal-foot { flex-wrap: wrap; }
  .form-grid { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; }
  .toasts { inset-inline: var(--sp-3); inset-block-end: var(--sp-3); max-width: none; }
  table.grid td, table.grid th { padding: var(--sp-2) var(--sp-3); }
  /* Below this width a grid becomes a list of cards so nothing is clipped. */
  table.grid.stack thead { display: none; }
  table.grid.stack, table.grid.stack tbody, table.grid.stack tr, table.grid.stack td { display: block; width: 100%; }
  table.grid.stack tr {
    border: 1px solid var(--line); border-radius: var(--r-md);
    margin-block-end: var(--sp-3); padding: var(--sp-2);
  }
  table.grid.stack td {
    border: 0; padding: var(--sp-2) var(--sp-3);
    max-width: none; white-space: normal;
    display: grid; grid-template-columns: 40% 1fr; gap: var(--sp-3);
  }
  table.grid.stack td > * { min-width: 0; max-width: 100%; }
  table.grid.stack td::before {
    content: attr(data-label);
    font-size: var(--fs-xs); font-weight: 600; color: var(--text-3);
    text-transform: uppercase; letter-spacing: .04em;
  }
}

/* --------------------------------------------------------------- utility */
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.gap-1 { gap: var(--sp-1); } .gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); } .gap-4 { gap: var(--sp-4); }
.gap-5 { gap: var(--sp-5); } .gap-6 { gap: var(--sp-6); }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.small { font-size: var(--fs-sm); }
.tiny { font-size: var(--fs-xs); }
.strong { font-weight: 620; }
.mono { font-family: var(--font-mono); font-size: var(--fs-sm); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-0 { margin-block-end: 0; }
.mb-3 { margin-block-end: var(--sp-3); }
.mb-4 { margin-block-end: var(--sp-4); }
.mb-5 { margin-block-end: var(--sp-5); }
.mt-3 { margin-block-start: var(--sp-3); }
.mt-4 { margin-block-start: var(--sp-4); }
.mt-5 { margin-block-start: var(--sp-5); }
.hidden { display: none !important; }
.cols-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--sp-4); }
.cols-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--sp-4); }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

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


/* ------------------------------------------------------------------ glass */
/* "Balanced": the frame is glass, the data is not. Tables and cards keep an
   opaque surface so 800-row lists stay at full text contrast. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .sidebar { background: var(--surface); }
  .topbar, .metric { background: var(--surface); border-color: var(--line); }
}

/* ----------------------------------------------------------------- filters */
/* The filter panel is one dialog holding every field, applied in one go: a
   user filtering by department AND office AND status should not wait for three
   round trips to the server, one per choice. */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--sp-4);
  max-height: 60vh;
  overflow-y: auto;
  padding-inline-end: var(--sp-1);
}
.filter-grid .field { margin: 0; }
.filter-grid .row.gap-2 > input { min-width: 0; flex: 1; }

/* ================================================== sign-in (split layout) */
/* Two panels: the society's own board, and the sign-in. The board carries the
   brand at full strength; the sign-in side stays quiet so the eye lands on the
   one action. */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-brand {
  display: flex; flex-direction: column; justify-content: space-between;
  padding: var(--sp-10) var(--sp-12);
  color: #fff;
  background:
    repeating-linear-gradient(115deg, rgba(255,255,255,.035) 0 1px, transparent 1px 84px),
    radial-gradient(1px 1px at 50% 50%, rgba(255,255,255,.10) 50%, transparent 51%) 0 0 / 26px 26px,
    linear-gradient(200deg, #4a8451 0%, #3a7042 46%, #27562f 100%);
  position: relative; overflow: hidden;
}
.auth-brand-top { display: flex; align-items: center; gap: var(--sp-3); }
.auth-org   { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -.01em; }
.auth-motto { font-size: var(--fs-sm); opacity: .78; margin-block-start: 2px; }

/* Wide enough for the wordmark to stand on one line; the blurb keeps its own
   reading measure below, so widening this block does not stretch the prose. */
.auth-brand-mid { max-width: min(34rem, 100%); }
.auth-pill {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 7px var(--sp-4);
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, .13);
  border: 1px solid rgba(255, 255, 255, .20);
  font-size: var(--fs-sm); font-weight: 550;
  margin-block-end: var(--sp-6);
}
.auth-dot { width: 7px; height: 7px; border-radius: 50%; background: #e8a33d; flex: none; }
/* Readex Pro sets wider than the previous stack, so INSPIRE at the old 7vw
   ran past the panel and was cut off by its overflow:hidden. Sized to keep
   all seven letters on one line inside the panel's content box. */
.auth-wordmark {
  font-size: clamp(44px, 6.2vw, 96px);
  font-weight: 700; line-height: 1.06; letter-spacing: -.03em;
  white-space: nowrap;
  margin: 0 0 var(--sp-5);
}
.auth-blurb {
  font-size: var(--fs-md); opacity: .84; line-height: 1.75;
  margin: 0; max-width: 30ch;
}

.auth-main {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-10);
  background:
    radial-gradient(1px 1px at 50% 50%, rgba(20, 45, 32, .13) 50%, transparent 51%) 0 0 / 26px 26px,
    var(--n-25);
}
.lang-chip {
  position: absolute; inset-block-start: var(--sp-6); inset-inline-end: var(--sp-6);
  display: inline-flex; align-items: center; gap: var(--sp-2);
  height: 38px; padding-inline: var(--sp-4);
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--n-0); color: var(--text);
  font: inherit; font-size: var(--fs-sm); font-weight: 650; cursor: pointer;
}
.lang-chip:hover { border-color: var(--accent); }
.lang-chip .icon { width: 15px; height: 15px; color: var(--text-3); }

.auth-card { width: min(430px, 100%); }
.auth-eyebrow {
  display: flex; align-items: center; gap: var(--sp-3);
  color: var(--brand-700); font-size: var(--fs-sm); font-weight: 700;
  margin-block-end: var(--sp-4);
}
.auth-rule { width: 46px; height: 2px; border-radius: 2px; background: var(--brand-700); flex: none; }
.auth-title {
  font-size: clamp(34px, 3.4vw, 46px); font-weight: 700; line-height: 1.22;
  letter-spacing: -.03em; margin: 0 0 var(--sp-3); color: var(--n-900);
}
.auth-title span { color: var(--brand-700); }
.auth-sub { color: var(--text-2); font-size: var(--fs-md); margin: 0 0 var(--sp-6); }

.auth-chip {
  display: inline-flex; align-items: center; gap: var(--sp-3);
  padding: 9px var(--sp-4); border-radius: var(--r-md);
  background: var(--brand-50); color: var(--brand-700);
  font-size: var(--fs-base); font-weight: 600;
  margin-block-end: var(--sp-5);
}
.auth-chip .icon { width: 17px; height: 17px; }

.sso-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: var(--sp-3);
  min-height: 62px; padding: var(--sp-4) var(--sp-5);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--n-0); color: var(--n-900);
  font: inherit; font-size: var(--fs-md); font-weight: 650;
  cursor: pointer; box-shadow: var(--shadow-sm);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.sso-btn:hover { border-color: var(--accent); box-shadow: var(--shadow-md); }
.sso-btn.is-disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

.da-mark { display: inline-flex; align-items: center; justify-content: center; flex: none; }
/* The supplied mark is a finished badge — a disc of its own — so it needs no
   plate behind it, only a size. */
.da-mark[data-tone="light"] img { width: 46px; height: 46px; }
.da-mark[data-tone="light"] svg {
  width: 26px; height: 26px; padding: 10px; border-radius: 50%;
  background: rgba(255, 255, 255, .17);
}
.da-mark[data-tone="brand"] img,
.da-mark[data-tone="brand"] svg { width: 24px; height: 24px; }

.auth-note {
  color: var(--text-3); font-size: var(--fs-sm); line-height: 1.8;
  margin: var(--sp-4) 0 0; text-align: center;
}
.login-reveal {
  display: block; width: 100%; margin-block-start: var(--sp-4);
  border: 0; background: transparent; color: var(--brand-700);
  font: inherit; font-size: var(--fs-sm); font-weight: 650;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.login-form { margin-block-start: var(--sp-4); }
.login-form .btn.lg { width: 100%; height: 44px; }

.auth-rule-h {
  height: 1px; background: var(--line-soft);
  margin: var(--sp-6) 0 var(--sp-4);
}
.auth-copy { text-align: center; color: var(--text-3); font-size: var(--fs-sm); margin: 0; }

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  /* On a phone the green panel was 42vh — more than a third of the screen
     spent on a wordmark before the first field, so signing in began with a
     scroll. It keeps the brand and the office line; it stops being the page. */
  .auth-brand {
    padding: var(--sp-6) var(--sp-5);
    gap: var(--sp-4);
    min-height: 0;
  }
  .auth-brand-mid { max-width: none; }
  .auth-wordmark { font-size: clamp(34px, 10vw, 52px); margin-block-end: var(--sp-2); }
  .auth-blurb { font-size: var(--fs-sm); }
  .auth-main { padding: var(--sp-6) var(--sp-4); }
}

/* ------------------------------------------------- per-employee permissions */
/* Three states, not a checkbox: "from role" is a real answer and has to stay
   distinguishable from an explicit yes, or an administrator cannot tell what
   will move when the role changes underneath them. */
.perm-top{
  display:flex; flex-wrap:wrap; gap:var(--sp-4); align-items:end;
  justify-content:space-between; margin-block-end:var(--sp-5);
}
.perm-top .input[type="search"]{min-width:min(280px,100%)}

.perm-groups{display:grid; gap:var(--sp-4)}
.perm-group{border:1px solid var(--line); border-radius:var(--r-lg); overflow:hidden}
.perm-group-head{
  display:flex; align-items:center; justify-content:space-between; gap:var(--sp-3);
  padding:var(--sp-3) var(--sp-4); background:var(--surface-2);
  border-block-end:1px solid var(--line);
}
.perm-group-head .badge{margin-inline-start:var(--sp-2)}
.perm-rows{display:grid}

.perm-row{
  display:flex; align-items:center; justify-content:space-between; gap:var(--sp-4);
  padding:var(--sp-3) var(--sp-4);
  border-block-end:1px solid var(--line-soft);
}
.perm-row:last-child{border-block-end:0}
.perm-row[data-on="false"] .perm-label > span:first-child{color:var(--text-3); text-decoration:line-through; text-decoration-color:var(--line)}
.perm-label{display:grid; gap:2px; min-width:0}
.perm-label > span:first-child{font-weight:500}
.warn-text{color:var(--warn)}

.perm-opts{display:inline-flex; flex:none; border:1px solid var(--line); border-radius:var(--r-full); overflow:hidden}
.perm-opt{
  font:inherit; font-size:var(--fs-sm); line-height:1; cursor:pointer;
  background:var(--surface); color:var(--text-2);
  border:0; padding:7px 14px; white-space:nowrap;
}
.perm-opt + .perm-opt{border-inline-start:1px solid var(--line)}
.perm-opt:hover:not(:disabled){background:var(--surface-2)}
.perm-opt:disabled{opacity:.5; cursor:not-allowed}
.perm-opt:focus-visible{outline:2px solid var(--brand-500); outline-offset:-2px}
.perm-opt[aria-pressed="true"][data-kind="inherit"]{background:var(--surface-3); color:var(--text); font-weight:600}
.perm-opt[aria-pressed="true"][data-kind="allow"]{background:var(--ok); color:#fff; font-weight:600}
.perm-opt[aria-pressed="true"][data-kind="deny"]{background:var(--err); color:#fff; font-weight:600}

@media (max-width: 640px){
  .perm-row{flex-direction:column; align-items:stretch}
  .perm-opts{align-self:stretch}
  .perm-opt{flex:1; text-align:center}
}
