/* Atrium UI v1: the family's shared console shell.
   Load order in every console: tokens.css → shell.css → the console's own app.css. This file owns
   the classes every console already shares (the shell, controls, cards, tables, dialogs, the command
   palette, the toast); a console's app.css keeps only what is its own, plus the alias block that maps
   its variable names onto `--at-*`. Base rules first, variants after, every breakpoint at the end —
   the same ordering rule the consoles follow, so overrides win by order rather than `!important`.

   The look is legalwork's (see tokens.css): white canvas inside a light-grey chrome, the sidebar
   on the chrome behind one hairline, a white top bar over a white workspace, thin
   translucent lines, 10px controls, glass dialogs and palette. */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--at-font-sans);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: var(--at-tracking-body);
  color: var(--at-text);
  background: var(--at-chrome);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
h1, h2, h3, h4 { letter-spacing: var(--at-tracking-head); }
button, input, select, textarea { letter-spacing: inherit; }
::selection { background: #2563eb; color: #fff; }
* { scrollbar-width: thin; scrollbar-color: var(--at-border-strong) transparent; }

.hidden { display: none !important; }
a { color: inherit; cursor: pointer; text-decoration: none; }
a:hover { text-decoration: underline; }
/* The family's rule, not legalwork's: the focus ring wears the module's brand (`--brand`, set by
   each console's alias block), because it is identity, not a control. */
:focus-visible { outline: 2px solid var(--brand, var(--at-text)); outline-offset: 2px; border-radius: var(--at-radius-xs); }

/* ── sign-in ───────────────────────────────────────────────────────────── */
#login {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: var(--at-chrome);
}
.login-tools { position: fixed; top: 16px; right: 16px; display: flex; gap: 6px; z-index: 5; }
.login-tools .iconbtn { background: var(--at-surface); border: 1px solid var(--at-border); }
.login-card {
  width: 100%; max-width: 380px;
  background: var(--at-surface);
  border: 1px solid var(--at-border);
  border-radius: var(--at-radius-3xl);
  padding: 32px;
  box-shadow: var(--at-shadow-md);
}
.login-card .logo { width: 40px; height: 40px; display: block; }
.login-card h1 { font-size: 22px; font-weight: 600; margin: 18px 0 2px; }
.lsub { color: var(--at-text-muted); font-size: 13px; margin-bottom: 24px; }
.login-card .banner { margin: 14px 0 0; }
.login-card .btn { margin-top: 20px; width: 100%; justify-content: center; }

/* ── shell ─────────────────────────────────────────────────────────────── */
#app { display: flex; min-height: 100vh; background: var(--at-chrome); }
.sidebar {
  width: var(--at-sidebar-w);
  flex: none;
  background: var(--at-sidebar);
  border-right: 1px solid var(--at-border-subtle);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  transition: width 250ms var(--at-ease-out);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 12px 14px 10px 16px; min-height: var(--at-topbar-h); }
.brand .logo { width: 28px; height: 28px; flex: none; border-radius: var(--at-radius-md); }
.brand .nm { font-weight: 600; letter-spacing: -0.02em; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { flex: 1; overflow-y: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  min-height: 38px; padding: 0 12px; border-radius: var(--at-radius-lg);
  color: var(--at-text); cursor: pointer; font-size: 14px; line-height: 1.3;
  transition: background var(--at-dur-fast) var(--at-ease), color var(--at-dur-fast) var(--at-ease);
}
.nav-item > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover { background: var(--at-hover); color: var(--at-text); text-decoration: none; }
.nav-item.on { background: var(--at-active); color: var(--at-text); font-weight: 500; }
.nav-item svg { flex: none; width: 18px; height: 18px; color: var(--at-text-secondary); }
.nav-item.on svg, .nav-item:hover svg { color: var(--at-text); }
/* The count is a <span> too: it must not shrink or ellipsise like the label beside it. */
.nav-item .cnt {
  flex: none; overflow: visible; margin-left: auto; font-size: 11px; font-weight: 500; font-variant-numeric: tabular-nums;
  background: var(--at-active); color: var(--at-text-secondary);
  border-radius: var(--at-radius-full); padding: 1px 7px;
}
.nav-item .cnt.hot { background: var(--at-danger-soft); color: var(--at-danger-text); }
.nav-sep {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .12em;
  color: var(--at-text-muted); padding: 20px 12px 8px;
  display: flex; align-items: center; gap: 8px;
}
/* legalwork's section mark: a small filled square before the label. */
.nav-sep::before { content: ""; width: 6px; height: 6px; border-radius: 1px; background: var(--at-text); flex: none; }
.sidebar-foot { flex: none; border-top: 1px solid var(--at-border-subtle); padding-bottom: 10px; }

/* Collapse to icons (Ctrl/⌘+B or #navCollapse, wired by shell.js): the rail itself is drawn under
   the breakpoints, because only a sidebar that is a column can be one — under 881px it is a drawer. */
#navCollapse { margin-left: auto; flex: none; }
/* The collapsed rail's hint (shell.js): the label beside the icon, as legalwork's tooltip does. */
.nav-tip {
  position: fixed; z-index: 50; transform: translateY(-50%); pointer-events: none;
  background: var(--at-text); color: var(--at-canvas); font-size: 12px; font-weight: 500;
  padding: 4px 8px; border-radius: var(--at-radius-md); white-space: nowrap; box-shadow: var(--at-shadow-md);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--at-canvas); }
.topbar {
  display: flex; align-items: center; gap: 6px;
  height: var(--at-topbar-h); padding: 0 14px 0 18px;
  background: var(--at-canvas); border-bottom: 1px solid var(--at-border-subtle);
  position: sticky; top: 0; z-index: 4;
}
.spacer { flex: 1; }
.vdiv { width: 1px; height: 18px; background: var(--at-border); margin: 0 4px; }
.crumb {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  overflow-x: auto; white-space: nowrap; scrollbar-width: none;
  color: var(--at-text-muted); font-size: 13px;
}
.crumb::-webkit-scrollbar { display: none; }
.crumb b { color: var(--at-text); font-weight: 550; }
/* legalwork divides title and context with a hairline, not a slash. */
.crumb .sep { font-size: 0; width: 1px; height: 16px; background: var(--at-border); margin: 0 6px; flex: none; }
/* The workspace: white, under the white top bar. The
   inline padding centres a 72rem column without a wrapper element — percentages in padding resolve
   against the containing block's width, which here is `.main`. */
.content {
  flex: 1; width: 100%; min-width: 0;
  background: var(--at-canvas);
  padding: 40px max(32px, calc((100% - var(--at-content-max)) / 2)) 40px;
}

#navToggle { display: none; }
#navScrim { display: none; }
.appcard.m-only { display: none; }

/* ── global search button ──────────────────────────────────────────────── */
.searchbar {
  display: inline-flex; align-items: center; gap: 8px;
  min-width: 220px; height: 32px; padding: 0 6px 0 10px;
  border: 1px solid var(--at-border); border-radius: var(--at-radius-lg);
  background: var(--at-canvas); color: var(--at-text-placeholder);
  font: inherit; font-size: 13px; cursor: text;
  box-shadow: var(--at-shadow-xs);
}
.searchbar:hover { border-color: var(--at-border-strong); }
.searchbar .sp { flex: 1; text-align: left; }
.searchbar svg { width: 15px; height: 15px; }
.searchbar kbd {
  font: inherit; font-size: 10.5px; color: var(--at-text-faint);
  border: 1px solid var(--at-border); border-radius: var(--at-radius-xs); padding: 0 5px;
}

/* ── controls ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: var(--at-control-h); padding: 0 12px; border-radius: var(--at-radius-lg);
  border: 1px solid var(--at-border); background: var(--at-canvas);
  color: var(--at-text); font: inherit; font-size: 14px; font-weight: 500; line-height: 1.2;
  cursor: pointer; white-space: nowrap;
  transition: background var(--at-dur-fast) var(--at-ease), border-color var(--at-dur-fast) var(--at-ease), transform var(--at-dur-fast) var(--at-ease);
}
.btn:hover { background: var(--at-surface-hover); border-color: var(--at-border-strong); text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--at-primary); border-color: var(--at-primary); color: var(--at-primary-fg); }
.btn.primary:hover { background: var(--at-primary-hover); border-color: var(--at-primary-hover); }
.btn.primary:active { background: var(--at-primary-active); }
.btn.danger { color: var(--at-danger-text); }
.btn.danger:hover { background: var(--at-danger-soft); border-color: transparent; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sm { min-height: var(--at-control-h-sm); padding: 0 10px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; flex: none; }

.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--at-radius-md);
  border: 1px solid transparent; background: transparent;
  color: var(--at-text-muted); cursor: pointer; position: relative; flex: none;
  transition: background var(--at-dur-fast) var(--at-ease), color var(--at-dur-fast) var(--at-ease);
}
.iconbtn:hover { background: var(--at-hover); color: var(--at-text); }
.iconbtn:active { background: var(--at-active); }
.iconbtn.txt { font: 600 11px/1 var(--at-font-sans); letter-spacing: .04em; }
.iconbtn svg { width: 18px; height: 18px; }

.applist { display: grid; gap: 8px; }
.appcard {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--at-border);
  border-radius: var(--at-radius-xl); background: var(--at-surface); color: inherit;
}
a.appcard:hover, button.appcard:hover { background: var(--at-surface-hover); text-decoration: none; }
button.appcard { width: 100%; font: inherit; text-align: left; cursor: pointer; }
.appcard .ai {
  width: 36px; height: 36px; flex: none; border-radius: var(--at-radius-md);
  background: var(--brand-bg); color: var(--brand-fg);
  display: inline-flex; align-items: center; justify-content: center;
}
.appcard .an { font-weight: 550; }

.avatar {
  padding: 0; font-family: inherit; line-height: 1; letter-spacing: 0;
  width: 28px; height: 28px; flex: none; border-radius: 50%; margin-left: 4px;
  /* --brand-ink: these are initials, and text needs 4.5:1. */
  background: var(--brand-ink); border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--brand-fg); cursor: pointer;
}

.field { display: block; font-size: 13px; font-weight: 500; color: var(--at-text-secondary); }
.field > input, .field > select, .field > textarea, .pw-field > input {
  display: block; width: 100%; margin-top: 6px;
  min-height: var(--at-control-h); padding: 7px 12px; border-radius: var(--at-radius-lg);
  border: 1px solid var(--at-border); background: var(--at-canvas);
  color: var(--at-text); font: inherit; font-size: 14px; font-weight: 400;
  box-shadow: inset 0 1px 2px rgb(0 0 0 / .025);
  transition: border-color var(--at-dur-fast) var(--at-ease), box-shadow var(--at-dur-fast) var(--at-ease);
}
.field > input:hover, .field > select:hover, .field > textarea:hover, .pw-field > input:hover { border-color: var(--at-border-strong); }
.field > input:focus, .field > select:focus, .field > textarea:focus, .pw-field > input:focus {
  outline: none; border-color: var(--at-border-strong); box-shadow: 0 0 0 3px var(--at-focus-ring);
}
.field ::placeholder { color: var(--at-text-placeholder); }
.field > textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.pw-field { position: relative; display: block; }
.pw-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border: 0; background: transparent; border-radius: var(--at-radius-sm);
  color: var(--at-text-muted); cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center;
}
.pw-eye:hover { background: var(--at-hover); color: var(--at-text); }
/* A control outside .field or .toolbar still gets the family's shape instead of the browser's.
   :where() keeps this at zero specificity, so every styled context above and below still wins. */
:where(select, textarea, input:not([type="checkbox"], [type="radio"], [type="file"], [type="range"], [type="color"])) {
  min-height: var(--at-control-h-sm); padding: 5px 10px; border-radius: var(--at-radius-lg);
  border: 1px solid var(--at-border); background: var(--at-canvas); color: var(--at-text);
  font: inherit; font-size: 13.5px;
}
:where(select, textarea, input):focus-visible { outline: none; border-color: var(--at-border-strong); box-shadow: 0 0 0 3px var(--at-focus-ring); }
input[type="file"] { font: inherit; font-size: 13.5px; color: var(--at-text-secondary); }
input[type="file"]::file-selector-button {
  margin-right: 10px; min-height: var(--at-control-h-sm); padding: 0 12px; border-radius: var(--at-radius-lg);
  border: 1px solid var(--at-border); background: var(--at-canvas); color: var(--at-text);
  font: inherit; font-weight: 500; cursor: pointer;
}
input[type="file"]::file-selector-button:hover { background: var(--at-surface-hover); border-color: var(--at-border-strong); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* ── page furniture ────────────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 32px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 30px; font-weight: 600; line-height: 1.2; letter-spacing: var(--at-tracking-title); }
.page-head .sub { color: var(--at-text-secondary); font-size: 14px; margin-top: 8px; }
.page-head .acts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.card {
  background: var(--at-surface); border: 1px solid var(--at-border);
  border-radius: var(--at-radius-2xl); padding: 20px 22px;
}
.card + .card { margin-top: 16px; }
.card h3 { margin: 0 0 14px; font-size: 14px; font-weight: 600; }
.card h3 .n { color: var(--at-text-faint); font-weight: 500; margin-left: 6px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tile {
  background: var(--at-surface); border: 1px solid var(--at-border);
  border-radius: var(--at-radius-2xl); padding: 16px 18px;
  /* legalwork's starter cards: a faint top-to-bottom wash instead of a shadow. */
  background: linear-gradient(180deg, var(--at-surface), var(--at-surface-hover));
}
.tile .k { font-size: 12px; font-weight: 500; color: var(--at-text-muted); }
.tile .v { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: var(--at-tracking-title); margin-top: 4px; }
.tile.hot { border-color: var(--at-danger); }
.tile.hot .v { color: var(--at-danger-text); }
.tile.warn { border-color: var(--at-warning); }
.tile.warn .v { color: var(--at-warning-text); }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-size: 12px; font-weight: 500; letter-spacing: 0;
  color: var(--at-text-muted); padding: 10px 12px;
  border-bottom: 1px solid var(--at-border); white-space: nowrap;
}
td { padding: 11px 12px; border-bottom: 1px solid var(--at-border-subtle); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { transition: background var(--at-dur-fast) var(--at-ease); }
tbody tr.click:hover { background: var(--at-hover); cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
/* A sortable head reads as the head itself, not as a button sitting in it. */
th > .btn.sm { min-height: 24px; padding: 0 6px; margin: 0 -6px; border-color: transparent; background: transparent;
  font: inherit; color: inherit; }
th > .btn.sm:hover { background: var(--at-hover); color: var(--at-text); }
td.shrink { width: 1%; }
td.mono { font-family: var(--at-font-mono); font-size: 12.5px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 20px; padding: 0 8px; border-radius: var(--at-radius-full);
  font-size: 12px; font-weight: 500; line-height: 1.4;
  background: var(--at-active); color: var(--at-text-secondary);
  border: 1px solid transparent; white-space: nowrap;
}
.chip.ok { background: var(--at-success-soft); color: var(--at-success-text); }
.chip.warn { background: var(--at-warning-soft); color: var(--at-warning-text); }
.chip.err { background: var(--at-danger-soft); color: var(--at-danger-text); }

.banner {
  padding: 10px 14px; border-radius: var(--at-radius-lg); font-size: 13px;
  border: 1px solid var(--at-border-subtle); background: var(--at-sunken);
}
.banner.err { background: var(--at-danger-soft); color: var(--at-danger-text); border-color: transparent; }
.banner.warn { background: var(--at-warning-soft); color: var(--at-warning-text); border-color: transparent; }
.banner.ok { background: var(--at-success-soft); color: var(--at-success-text); border-color: transparent; }
.banner + .banner, .card > .banner:first-child { margin-bottom: 12px; }

.empty {
  padding: 40px 24px; text-align: center; color: var(--at-text-muted);
  border: 1px dashed var(--at-border-strong); border-radius: var(--at-radius-2xl); font-size: 13.5px;
}
.faint { color: var(--at-text-muted); }
.tiny { font-size: 12px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input, .toolbar select {
  min-height: var(--at-control-h-sm); padding: 5px 10px; border-radius: var(--at-radius-lg);
  border: 1px solid var(--at-border); background: var(--at-canvas);
  color: var(--at-text); font: inherit; font-size: 13.5px;
}
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--at-border-strong); box-shadow: 0 0 0 3px var(--at-focus-ring); }
.toolbar input[type="search"] { min-width: 220px; }
/* A checkbox in the toolbar is a filter, not a field: no field box around it, and its label lines up. */
.toolbar label { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--at-text-secondary); }
.toolbar input[type="checkbox"], .toolbar input[type="radio"] {
  min-height: 0; width: 16px; height: 16px; padding: 0; margin: 0; accent-color: var(--at-primary);
}

/* ── dialog ────────────────────────────────────────────────────────────── */
#modalRoot:empty { display: none; }
@keyframes at-fade { from { opacity: 0; } }
@keyframes at-pop { from { opacity: 0; transform: translateY(4px) scale(.98); } }
.scrim {
  position: fixed; inset: 0; background: var(--at-overlay);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 48px 16px; z-index: 40; overflow-y: auto;
  animation: at-fade var(--at-dur-base) var(--at-ease);
}
.modal {
  background: var(--at-glass-strong);
  backdrop-filter: blur(var(--at-glass-blur)); -webkit-backdrop-filter: blur(var(--at-glass-blur));
  border: 1px solid var(--at-border-subtle);
  border-radius: var(--at-radius-3xl); box-shadow: var(--at-shadow-pop); width: 100%;
  max-width: 560px; padding: 24px;
  animation: at-pop var(--at-dur-slow) var(--at-ease-out);
}
.modal.wide { max-width: 760px; }
.modal h3 { margin: 0 0 4px; font-size: 18px; font-weight: 550; letter-spacing: -0.02em; }
.modal .msub { color: var(--at-text-muted); font-size: 13px; margin-bottom: 18px; }
.modal .acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 22px; }
.modal .stack .field + .field { margin-top: 0; }

/* ── command palette ───────────────────────────────────────────────────── */
/* legalwork's shape: the query in its own glass capsule, the results in a second glass sheet below
   it, the hint attached to the bottom of that sheet. Same markup the consoles already render
   (.search-modal > .sin + .search-results + .shint), so no console changes for it. */
.search-scrim { padding-top: clamp(24px, 12vh, 112px); background: rgba(20, 22, 28, .18); }
.search-modal {
  width: 100%; max-width: 560px;
  display: flex; flex-direction: column;
  animation: at-pop var(--at-dur-slow) var(--at-ease-out);
}
.search-modal .sin {
  display: flex; align-items: center; gap: 12px;
  height: 64px; padding: 0 22px 0 24px;
  border-radius: var(--at-radius-full);
  background: var(--at-glass-strong);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--at-border-subtle);
  box-shadow: 0 18px 52px rgba(28, 32, 44, .16), 0 2px 8px rgba(28, 32, 44, .04);
  color: var(--at-text-muted);
}
.search-modal .sin svg { width: 20px; height: 20px; flex: none; }
.search-modal .sin input {
  flex: 1; border: 0; background: none; color: var(--at-text);
  font: inherit; font-size: 18px; letter-spacing: var(--at-tracking-title); outline: none; padding: 0;
  box-shadow: none;  /* the capsule is the field; the bare-input focus ring would draw a box inside it */
}
.search-modal .sin input::placeholder { color: var(--at-text-placeholder); }
.search-results {
  margin-top: 12px; padding: 8px;
  max-height: 58vh; overflow-y: auto; overflow-x: hidden;
  background: var(--at-glass-strong);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--at-border-subtle); border-bottom: 0;
  border-radius: 28px 28px 0 0;
  box-shadow: 0 18px 52px rgba(28, 32, 44, .16);
}
.search-results:empty { display: none; }
.search-results:empty + .shint { border-top: 1px solid var(--at-border-subtle); border-radius: 28px; margin-top: 12px; }
.search-results .sgroup {
  padding: 10px 12px 4px; font-size: 11px; font-weight: 500;
  color: var(--at-text-faint);
}
.search-results .sitem {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 9px 12px; border: 0; border-radius: 18px; background: none; color: var(--at-text);
  font: inherit; font-size: 13px; text-align: left; cursor: pointer;
}
.search-results .sitem:hover, .search-results .sitem.on {
  background: var(--at-active); box-shadow: inset 0 0 0 1px var(--at-border-subtle);
}
.search-results .sitem .ic {
  width: 28px; height: 28px; flex: none; border-radius: var(--at-radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--at-text-muted); background: var(--at-hover);
}
.search-results .sitem .sb { min-width: 0; flex: 1; }
.search-results .sitem .st, .search-results .sitem .ss { display: block; }
.search-results .sitem .st { font-weight: 550; line-height: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-results .sitem .ss {
  font-size: 11.5px; line-height: 16px; color: var(--at-text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search-modal .shint {
  padding: 10px 20px 12px;
  background: var(--at-glass-strong);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--at-border-subtle); border-top: 1px solid var(--at-border-subtle);
  border-radius: 0 0 28px 28px;
  font-size: 11px; color: var(--at-text-faint);
}
.search-empty { padding: 24px 14px; text-align: center; color: var(--at-text-muted); font-size: 13px; }

/* ── toast ─────────────────────────────────────────────────────────────── */
@keyframes at-toast-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 60; }
.toast {
  background: var(--at-surface); color: var(--at-text);
  border: 1px solid var(--at-border);
  padding: 12px 16px; border-radius: var(--at-radius-2xl); max-width: 24rem;
  font-size: 13.5px; box-shadow: var(--at-shadow-md);
  animation: at-toast-in var(--at-dur-slow) var(--at-ease-out);
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .modal, .search-modal .sin, .search-results, .search-modal .shint { background: var(--at-surface); }
}

/* ── breakpoints (widest first, always last) ─────────────────────────────── */
/* The icon rail: the sidebar collapsed, or standing beside a module's own column (Atrium's `.mod-col`).
   Labels live in a <span> in every console's nav markup, which is what lets one rule hide them. */
@media (min-width: 881px) {
  #app:is(.nav-min, .mod-col) .sidebar { width: var(--at-sidebar-min-w); }
  #app:is(.nav-min, .mod-col) .brand { flex-direction: column; gap: 8px; padding: 12px 0 8px; }
  #app:is(.nav-min, .mod-col) #navCollapse { margin-left: 0; }
  #app.nav-min #navCollapse { transform: scaleX(-1); }
  #app:is(.nav-min, .mod-col) .brand .nm, #app:is(.nav-min, .mod-col) .sidebar .nav-item .cnt,
  #app:is(.nav-min, .mod-col) .sidebar .nav-sep { display: none; }
  /* The label is hidden from sight, not from a screen reader: it stays the link's name, and the
     hint reads it. A console's icon may itself be a <span> (Atrium's `.mi`), so the first span stays. */
  #app:is(.nav-min, .mod-col) .sidebar .nav-item > span:not(:first-child):not(.cnt) {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  /* legalwork's icon rail: square tiles centred in the rail, the active one keeping its ground. */
  #app:is(.nav-min, .mod-col) .sidebar .nav { align-items: center; padding: 8px 0; }
  #app:is(.nav-min, .mod-col) .sidebar .nav-item {
    justify-content: center; gap: 0; padding: 0; width: 38px; min-height: 38px; position: relative;
  }
  /* A pending count survives as a dot on the icon's corner. */
  #app:is(.nav-min, .mod-col) .sidebar .nav-item .cnt.hot {
    display: block; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; padding: 0;
    font-size: 0; background: var(--at-danger);
  }
}
@media (max-width: 1100px) { .col-opt { display: none !important; } }

@media (max-width: 880px) {
  /* `visibility` as well as `transform`: a closed drawer must not be clickable or reachable by
     keyboard. Only `transform` transitions — a transitioned `visibility` sticks when frames are
     throttled. */
  .sidebar {
    position: fixed; z-index: 20;
    background: var(--at-sidebar);
    box-shadow: var(--at-shadow-lg);
    transform: translateX(-100%); visibility: hidden;
    transition: transform .18s;
  }
  .sidebar.open { transform: none; visibility: visible; }
  #navCollapse { display: none; }
  #navToggle { display: inline-flex; }
  #navScrim.on { display: block; position: fixed; inset: 0; background: var(--at-overlay); z-index: 19; }
  .content { padding: 20px 16px 32px; }

  .topbar .js-tool { display: none; }
  .appcard.m-only { display: flex; }
  .search-modal .shint { display: none; }
  .search-results { border-radius: 24px; border-bottom: 1px solid var(--at-border-subtle); max-height: 62vh; }
  .topbar { padding: 0 10px; gap: 4px; }
  .page-head { margin-bottom: 16px; }
  .page-head .acts { margin-left: 0; width: 100%; }
  .page-head .acts .btn { flex: 1; }
  /* A whole row of its own: beside the filters it shrank to a few letters. */
  .toolbar input[type="search"] { min-width: 0; flex: 1 1 100%; }
  .scrim { padding: 12px; }
  .search-scrim { padding-top: 8vh; }
  .search-modal .sin { height: 56px; }
  .modal { padding: 18px; border-radius: var(--at-radius-2xl); }
  .modal .acts { flex-wrap: wrap; }
  .modal .acts .btn { flex: 1; }
  .tile .v { font-size: 22px; }
  .page-head h2 { font-size: 24px; }
}

@media (max-width: 700px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

@media (max-width: 640px) {
  table.rt thead { display: none; }
  table.rt, table.rt tbody, table.rt tr { display: block; width: 100%; }
  table.rt tr { padding: 10px 0; border-bottom: 1px solid var(--at-border-subtle); }
  table.rt tr:last-child { border-bottom: 0; }
  table.rt td {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    padding: 3px 0; border: 0; text-align: right; width: auto;
  }
  table.rt td::before {
    content: attr(data-label); flex: none; text-align: left; padding-top: 2px;
    font-size: 11px; font-weight: 500; color: var(--at-text-faint);
  }
  table.rt td:first-child { justify-content: flex-start; text-align: left; font-weight: 600; padding-bottom: 6px; }
  table.rt td:first-child::before, table.rt td.acts-cell::before { content: none; }
  table.rt td.acts-cell { justify-content: flex-end; padding-top: 8px; }
  table.rt td.acts-cell:empty { display: none; }
  table.rt td > div { text-align: inherit; }
  table.rt td:not(:first-child) .row { justify-content: flex-end; }
  table.rt .btncol { flex-direction: row; }
  table.rt td.nowrap { white-space: normal; }
  .card .tablewrap { margin: 0; }
}

/* ── usability pass (Web Interface Guidelines) ───────────────────────────────
   The page title is the page's h1 (one per screen, so a screen reader can jump to it); a skip link
   past the sidebar; no double-tap zoom delay on controls; a scroll inside a dialog, the drawer or a
   menu never drags the page behind it; 44px targets wherever the pointer is a finger. */
.page-head h1 { margin: 0; font-size: 30px; font-weight: 600; line-height: 1.2; letter-spacing: var(--at-tracking-title); }
@media (max-width: 640px) { .page-head h1 { font-size: 24px; } }
.skip {
  position: fixed; left: 12px; top: -60px; z-index: 100; padding: 8px 14px;
  border-radius: var(--at-radius-lg); border: 1px solid var(--at-border-strong);
  background: var(--at-surface); color: var(--at-text); font-size: 14px;
}
.skip:focus { top: 12px; text-decoration: none; }
button, a, input, select, textarea, label, summary { touch-action: manipulation; }
.modal, .search-modal, .search-results, .waffle, .sidebar { overscroll-behavior: contain; }
@media (pointer: coarse) { .iconbtn, .btn.sm { min-width: 44px; min-height: 44px; } }
/* The first click of a two-step removal (confirmTwice). */
.btn.armed { border-color: var(--at-danger); color: var(--at-danger-text); }
#content:focus { outline: none; }   /* the skip link lands here; the page itself needs no ring */
