/* Softspace Forms - app shell styles (Foundation, ARCHITECTURE section 13).
   Module CSS goes in public/css/{module}.css and is pushed via @stack('head'). */

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--ss-font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ss-ink);
  background: var(--ss-bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--ss-font-heading); font-weight: 600; line-height: 1.25; margin: 0; color: var(--ss-ink); letter-spacing: -0.01em; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; } h4 { font-size: 14px; }
p { margin: 0; }
/* With a neutral accent a link is the same colour as the sentence around it,
   so the underline carries the affordance instead of the hue (WCAG 1.4.1).
   Link-shaped things that are not prose - nav items, buttons, cards, tabs -
   opt out below. */
a { color: var(--ss-ink); text-decoration: underline; text-decoration-thickness: 1px;
    text-underline-offset: 3px; text-decoration-color: var(--ss-line-strong); }
a:hover { text-decoration-color: currentColor; }
.btn, .nav-link, .brand, .wordmark, .skip-link, .notif-item, .dropdown-item, .chip,
.tab, .card > a, .onboard-steps li a, .ws-switcher-btn, .int-card, .sk-card, .link-sm,
.stat-card, a.card, a.badge, .pagination a, .breadcrumb a, .tabs a
  { text-decoration: none; }
.btn:hover, .nav-link:hover, .brand:hover, .notif-item:hover, .dropdown-item:hover,
.chip:hover, .tab:hover, a.card:hover, a.badge:hover
  { text-decoration: none; }
.link-sm:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
img, svg { display: block; }
.sprite, [x-cloak], [hidden] { display: none !important; }
.num, .tabular { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-auto { margin-left: auto; }
.muted { color: var(--ss-muted); }
.small { font-size: 12.5px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.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; }

/* Skip link: off-screen until focused, then pinned over the topbar (WCAG 2.4.1). */
.skip-link {
  position: fixed; top: 8px; left: -9999px; z-index: 300;
  display: inline-flex; align-items: center; height: 40px; padding: 0 16px;
  background: var(--ss-surface); color: var(--ss-primary-600);
  border: 1px solid var(--ss-primary); border-radius: var(--ss-r-sm);
  font-weight: 600; text-decoration: none; box-shadow: var(--ss-shadow-lg);
}
.skip-link:focus { left: 8px; text-decoration: none; }

:focus-visible { outline: none; box-shadow: var(--ss-focus); border-radius: var(--ss-r-sm); }

/* ---------- Icons ---------- */
.icon {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 24px; height: 24px; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: var(--ss-sidebar-w);
  display: flex; flex-direction: column;
  background: var(--ss-surface);
  border-right: 1px solid var(--ss-line);

}
.app-main { flex: 1; min-width: 0; margin-left: var(--ss-sidebar-w); display: flex; flex-direction: column; }
.app-content { width: 100%; max-width: var(--ss-content-max); margin: 0 auto; padding: 28px 28px 48px; flex: 1; }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(22, 22, 29, .45); }

.sidebar-brand { display: flex; align-items: center; justify-content: space-between; height: var(--ss-topbar-h); padding: 0 18px; border-bottom: 1px solid var(--ss-line); }
.sidebar .sidebar-close { display: none; }
.wordmark { font-family: var(--ss-font-heading); font-weight: 700; font-size: 20px; color: var(--ss-ink); letter-spacing: -0.02em; text-decoration: none; }
.wordmark span { color: var(--ss-primary); font-weight: 600; }
.wordmark:hover { text-decoration: none; }
.wordmark-sm { font-size: 17px; }

.sidebar-nav { padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--ss-r-sm);
  color: var(--ss-ink-2); font-weight: 500; text-decoration: none;
  transition: background .12s, color .12s;
}
.nav-link .icon { color: var(--ss-muted); }
.nav-link:hover { background: var(--ss-surface-2); color: var(--ss-ink); text-decoration: none; }
.nav-link.is-active { background: var(--ss-primary-50); color: var(--ss-primary-600); }
.nav-link.is-active .icon { color: var(--ss-primary-600); }
.sidebar-foot { padding: 14px 18px; border-top: 1px solid var(--ss-line); }

/* Workspace switcher */
.ws-switcher { position: relative; padding: 12px 12px 4px; }
.ws-switcher-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 8px 10px; border: 1px solid var(--ss-line); border-radius: var(--ss-r);
  background: var(--ss-surface); cursor: pointer;
}
.ws-switcher-btn:hover { background: var(--ss-surface-2); }
.ws-avatar {
  width: 32px; height: 32px; flex: none; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--ss-primary); color: var(--ss-primary-ink);
  font-family: var(--ss-font-heading); font-weight: 700; font-size: 14px;
}
.ws-avatar-sm { width: 24px; height: 24px; font-size: 12px; border-radius: 6px; }
.ws-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.ws-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-role { font-size: 11.5px; color: var(--ss-muted); }
.ws-caret { color: var(--ss-muted); width: 16px; height: 16px; }
.ws-menu { left: 12px; right: 12px; top: calc(100% - 2px); }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--ss-topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 28px;
  background: color-mix(in srgb, var(--ss-bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--ss-line);
}
.topbar .topbar-menu { display: none; }
.topbar-title { min-width: 0; flex: 1; }
.page-title { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-subtitle { font-size: 12.5px; color: var(--ss-muted); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-search {
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 12px; width: 240px;
  background: var(--ss-surface); border: 1px solid var(--ss-line); border-radius: 999px;
  color: var(--ss-muted);
}
.topbar-search:focus-within { border-color: var(--ss-primary); box-shadow: var(--ss-focus); }
.topbar-search input { border: 0; background: transparent; outline: none; width: 100%; font: inherit; color: var(--ss-ink); }
.topbar-search input::placeholder { color: var(--ss-muted); }

.bell { position: relative; }
.bell-count {
  position: absolute; top: 2px; right: 2px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--ss-err); color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.user-btn { display: flex; align-items: center; gap: 4px; padding: 3px; border: 0; background: transparent; border-radius: 999px; cursor: pointer; }
.user-btn:hover { background: var(--ss-surface-2); }
.user-caret { width: 14px; height: 14px; color: var(--ss-muted); }
.avatar {
  width: 32px; height: 32px; border-radius: 999px; flex: none;
  display: grid; place-items: center;
  background: var(--ss-primary-50); color: var(--ss-primary-600);
  font-family: var(--ss-font-heading); font-weight: 700; font-size: 12.5px;
}
.avatar-lg { width: 40px; height: 40px; font-size: 14px; }
.user-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.user-card-meta { min-width: 0; display: flex; flex-direction: column; }
.user-card-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card-email { font-size: 12px; color: var(--ss-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu { width: 280px; }
.theme-toggle { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px 8px 8px; }
.theme-toggle button {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 6px; border: 1px solid var(--ss-line); border-radius: var(--ss-r-sm);
  background: var(--ss-surface); font-size: 12.5px; font-weight: 500; cursor: pointer; color: var(--ss-ink-2);
}
.theme-toggle button .icon { width: 15px; height: 15px; }
.theme-toggle button:hover { background: var(--ss-surface-2); }
.theme-toggle button.is-active { border-color: var(--ss-primary); background: var(--ss-primary-50); color: var(--ss-primary-600); }

/* Notifications */
.notif-menu { width: 340px; max-height: 480px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 10px 14px; color: inherit; text-decoration: none; }
.notif-item:hover { background: var(--ss-surface-2); text-decoration: none; }
.notif-dot { width: 8px; height: 8px; margin-top: 6px; border-radius: 999px; background: transparent; flex: none; }
.notif-item.is-unread .notif-dot { background: var(--ss-primary); }
.notif-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-title { font-weight: 600; font-size: 13px; }
.notif-text { font-size: 12.5px; color: var(--ss-ink-2); }
.notif-time { font-size: 11.5px; color: var(--ss-muted); }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 50;
  min-width: 200px; padding: 6px;
  background: var(--ss-surface); border: 1px solid var(--ss-line); border-radius: var(--ss-r);
  box-shadow: var(--ss-shadow-lg);
}
.dropdown-right { left: auto; right: 0; }
.dropdown-label { padding: 8px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ss-muted); }
.dropdown-item {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 8px 10px; border: 0; border-radius: var(--ss-r-sm);
  background: transparent; color: var(--ss-ink); cursor: pointer; text-decoration: none; font-weight: 500;
}
.dropdown-item .icon { color: var(--ss-muted); }
.dropdown-item:hover { background: var(--ss-surface-2); text-decoration: none; }
.dropdown-item.is-active { color: var(--ss-primary-600); }
.dropdown-item.is-danger { color: var(--ss-err); }
.dropdown-divider { height: 1px; margin: 6px 0; background: var(--ss-line); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--ss-line-strong); border-radius: var(--ss-r-sm);
  background: var(--ss-surface); color: var(--ss-ink);
  font-weight: 600; font-size: 13.5px; line-height: 1; white-space: nowrap;
  cursor: pointer; text-decoration: none;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.btn:hover { background: var(--ss-surface-2); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--ss-primary); border-color: var(--ss-primary); color: var(--ss-primary-ink); }
.btn-primary:hover { background: var(--ss-primary-600); border-color: var(--ss-primary-600); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ss-ink-2); }
.btn-ghost:hover { background: var(--ss-surface-2); color: var(--ss-ink); }
.btn-danger { background: var(--ss-err); border-color: var(--ss-err); color: var(--ss-err-ink); }
.btn-danger:hover { background: color-mix(in srgb, var(--ss-err) 88%, var(--ss-ink)); border-color: color-mix(in srgb, var(--ss-err) 88%, var(--ss-ink)); }
.btn-outline-danger { color: var(--ss-err); border-color: color-mix(in srgb, var(--ss-err) 40%, transparent); }
.btn-outline-danger:hover { background: var(--ss-err-bg); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; gap: 8px; }

/* ---------- Forms / inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
label { font-weight: 600; font-size: 13px; color: var(--ss-ink-2); }
/* Styled by exclusion, not enumeration. An input with NO type attribute behaves
   as text but is not matched by input[type="text"], so enumerating types left
   23 platform fields completely unstyled - and would have swallowed week,
   month, or any type added later. The types that must keep native rendering
   opt out explicitly; everything else is a text field and is styled.
   ONE :not() taking a list, not ten chained: :not() carries the specificity of
   its most specific argument, so ten of them scored (0,10,1) and outranked
   input:disabled at (0,1,1) - disabled inputs kept their editable styling
   while disabled selects dimmed correctly. A single list scores (0,1,1). */
input:not([type="checkbox"], [type="radio"], [type="file"], [type="submit"], [type="button"],
            [type="reset"], [type="image"], [type="range"], [type="color"], [type="hidden"]),
select, textarea, .input {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--ss-line-strong); border-radius: var(--ss-r-sm);
  background: var(--ss-surface); color: var(--ss-ink);
  font: inherit; transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; }
select { appearance: none; padding-right: 32px; background-image: var(--ss-chevron); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ss-primary); box-shadow: var(--ss-focus); }
input::placeholder, textarea::placeholder { color: var(--ss-muted); }
input.is-invalid, select.is-invalid, textarea.is-invalid { border-color: var(--ss-err); }

/* Disabled controls were indistinguishable from editable ones: platform/plans
   wraps its whole editor in <fieldset disabled> for staff without plans.write,
   so that reader met a normal-looking form that refused every keystroke.
   Muted surface and muted ink rather than opacity - opacity would compound
   with the placeholder's own dimming and leave it unreadable. */
input:disabled, select:disabled, textarea:disabled {
  background: var(--ss-surface-2); color: var(--ss-muted);
  border-color: var(--ss-line); cursor: not-allowed;
}
input:disabled::placeholder, textarea:disabled::placeholder { color: var(--ss-line-strong); }
fieldset:disabled label, fieldset:disabled .field-hint { color: var(--ss-muted); }
/* readonly is not disabled. The share link is readonly precisely so it can be
   selected and copied, so it keeps its ink and its text cursor. */
input[readonly], textarea[readonly] { background: var(--ss-surface-2); cursor: text; }
.input-wrap { position: relative; }
.input-wrap input { padding-right: 40px; }
.input-affix {
  position: absolute; right: 4px; top: 4px; width: 32px; height: 32px;
  display: grid; place-items: center; border: 0; border-radius: var(--ss-r-sm);
  background: transparent; color: var(--ss-muted); cursor: pointer;
}
.input-affix:hover { background: var(--ss-surface-2); color: var(--ss-ink); }
.field-hint { font-size: 12.5px; color: var(--ss-muted); }
.field-error { font-size: 12.5px; color: var(--ss-err); font-weight: 500; }
.error-summary {
  padding: 12px 14px; margin-bottom: 16px;
  background: var(--ss-err-bg); border: 1px solid var(--ss-err); border-radius: var(--ss-r);
  color: var(--ss-ink);
}
.error-summary:focus-visible { box-shadow: var(--ss-focus); }
.error-summary h2 { font-size: 14px; margin-bottom: 6px; }
.error-summary ul { margin: 0; padding-left: 18px; font-size: 13px; }
.error-summary a { color: var(--ss-err); font-weight: 600; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; color: var(--ss-ink-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--ss-primary); margin: 0; }
.switch { position: relative; display: inline-flex; width: 38px; height: 22px; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--ss-line-strong); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 999px; background: #fff; transition: transform .15s; box-shadow: var(--ss-shadow-sm); }
.switch input:checked + span { background: var(--ss-primary); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { box-shadow: var(--ss-focus); }

/* ---------- Cards ---------- */
.card {
  background: var(--ss-surface); border: 1px solid var(--ss-line); border-radius: var(--ss-r-lg);
  box-shadow: var(--ss-shadow-sm);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--ss-line); }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--ss-line); display: flex; justify-content: flex-end; gap: 8px; }
.card-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.stat { padding: 16px 20px; }
.stat-label { font-size: 12.5px; color: var(--ss-muted); font-weight: 500; }
.stat-value { font-family: var(--ss-font-heading); font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 4px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--ss-line); border-radius: var(--ss-r-lg); background: var(--ss-surface); }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 12px 16px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--ss-line); }
.table th { font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ss-muted); background: var(--ss-surface-2); white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--ss-surface-2); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table a.row-link { color: inherit; font-weight: 600; }

/* ---------- Foregrounds for text on a tinted surface (Module D: WCAG AA for the 11.5px/600
   badge and the 13.5px alert). --ss-ok / --ss-warn / --ss-muted are tuned for the dark theme's
   tints, where they pass; on the light tints the same values land at 3.25 / 3.85 / 4.43:1.
   These variants darken only the light theme and fall back to the tokens in dark. ---------- */
:root {
  --ss-on-ok-tint: #157048;      /* 5.4:1 on --ss-ok-bg */
  --ss-on-warn-tint: #8a5a05;    /* 5.3:1 on --ss-warn-bg */
  --ss-on-muted-tint: #5f6376;   /* 5.3:1 on --ss-surface-2 */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ss-on-ok-tint: var(--ss-ok);
    --ss-on-warn-tint: var(--ss-warn);
    --ss-on-muted-tint: var(--ss-muted);
  }
}
:root[data-theme="dark"] {
  --ss-on-ok-tint: var(--ss-ok);
  --ss-on-warn-tint: var(--ss-warn);
  --ss-on-muted-tint: var(--ss-muted);
}

/* ---------- Badges (one class per colour token; status -> colour via config('forms.statuses')) ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em; white-space: nowrap;
  background: var(--ss-surface-2); color: var(--ss-ink-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; opacity: .8; }
.badge-primary     { background: var(--ss-primary-50); color: var(--ss-primary-600); }   /* new */
.badge-primary-600 { background: var(--ss-primary-100); color: var(--ss-primary-600); }  /* assigned */
.badge-ink-2       { background: var(--ss-surface-3); color: var(--ss-ink-2); }          /* viewed */
.badge-warn        { background: var(--ss-warn-bg); color: var(--ss-on-warn-tint); }             /* in_progress, contacted */
.badge-ok          { background: var(--ss-ok-bg); color: var(--ss-on-ok-tint); }                 /* completed */
.badge-err         { background: var(--ss-err-bg); color: var(--ss-err); }               /* rejected, spam */
.badge-muted       { background: var(--ss-surface-2); color: var(--ss-on-muted-tint); }          /* archived */
.badge-info        { background: var(--ss-info-bg); color: var(--ss-info); }
.badge-plain::before { display: none; }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--ss-r); font-size: 13.5px; border: 1px solid transparent; margin-bottom: 16px; }
.alert .icon { margin-top: 1px; }
.alert-ok { background: var(--ss-ok-bg); color: var(--ss-on-ok-tint); }
.alert-warn { background: var(--ss-warn-bg); color: var(--ss-on-warn-tint); }
.alert-err { background: var(--ss-err-bg); color: var(--ss-err); }
.alert-info { background: var(--ss-info-bg); color: var(--ss-info); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--ss-line); margin-bottom: 20px; overflow-x: auto; }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; margin-bottom: -1px;
  border: 0; border-bottom: 2px solid transparent; background: transparent;
  color: var(--ss-muted); font-weight: 600; font-size: 13.5px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.tab:hover { color: var(--ss-ink); text-decoration: none; }
.tab.is-active { color: var(--ss-primary-600); border-bottom-color: var(--ss-primary); }
.tab .badge { height: 18px; padding: 0 6px; }
.tab .badge::before { display: none; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(22, 22, 29, .55);
}
.modal {
  width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow: auto;
  background: var(--ss-surface); border: 1px solid var(--ss-line); border-radius: var(--ss-r-lg);
  box-shadow: var(--ss-shadow-lg);
}
.modal-sm { max-width: 440px; }
.modal-lg { max-width: 800px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px 0; }
.modal-icon { width: 38px; height: 38px; flex: none; border-radius: 999px; display: grid; place-items: center; background: var(--ss-primary-50); color: var(--ss-primary-600); }
.modal-icon.is-danger { background: var(--ss-err-bg); color: var(--ss-err); }
.modal-title { font-size: 17px; }
.modal-body { padding: 12px 22px 4px; color: var(--ss-ink-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 18px 22px 22px; }

/* ---------- Toast ---------- */
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 40px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 12px 12px 14px;
  background: var(--ss-surface); border: 1px solid var(--ss-line); border-left-width: 4px; border-radius: var(--ss-r);
  box-shadow: var(--ss-shadow-lg); font-size: 13.5px;
  animation: toast-in .18s ease-out;
}
.toast .icon { margin-top: 1px; }
.toast-text { flex: 1; color: var(--ss-ink); }
.toast-close { border: 0; background: transparent; color: var(--ss-muted); cursor: pointer; padding: 0; border-radius: 4px; }
.toast-close:hover { color: var(--ss-ink); }
.toast-success { border-left-color: var(--ss-ok); } .toast-success .icon:first-child { color: var(--ss-ok); }
.toast-error { border-left-color: var(--ss-err); } .toast-error .icon:first-child { color: var(--ss-err); }
.toast-warning { border-left-color: var(--ss-warn); } .toast-warning .icon:first-child { color: var(--ss-warn); }
.toast-info { border-left-color: var(--ss-primary); } .toast-info .icon:first-child { color: var(--ss-primary); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Empty state ---------- */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 56px 24px; color: var(--ss-muted); }
.empty-state h2 { color: var(--ss-ink); font-size: 18px; }
.empty-state p { max-width: 420px; }
.empty-state .btn { margin-top: 8px; }
.empty-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--ss-primary-50); color: var(--ss-primary-600); }
.empty-icon .icon { width: 26px; height: 26px; }
.empty-state-sm { padding: 24px 16px; gap: 6px; font-size: 13px; }

/* ---------- Skeleton ---------- */
.skeleton {
  position: relative; overflow: hidden; border-radius: var(--ss-r-sm);
  background: var(--ss-surface-2); color: transparent !important; min-height: 1em;
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--ss-surface) 60%, transparent), transparent);
  transform: translateX(-100%); animation: shimmer 1.4s infinite;
}
.skeleton-text { height: 12px; margin: 6px 0; }
.skeleton-title { height: 20px; width: 40%; }
.skeleton-block { height: 120px; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- Guest (auth / error) ---------- */
.ss-guest { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 32px 16px; }
.guest-shell { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.guest-card { width: 100%; padding: 32px; background: var(--ss-surface); border: 1px solid var(--ss-line); border-radius: var(--ss-r-lg); box-shadow: var(--ss-shadow); }
.guest-card-wide { max-width: 560px; }
.guest-title { font-size: 21px; margin-bottom: 6px; }
.guest-lead { color: var(--ss-muted); margin-bottom: 22px; }
.guest-footer { color: var(--ss-muted); font-size: 13.5px; }
.guest-icon { width: 48px; height: 48px; margin-bottom: 14px; border-radius: 14px; display: grid; place-items: center; background: var(--ss-primary-50); color: var(--ss-primary-600); }
.guest-icon .icon { width: 24px; height: 24px; }
.link-sm { font-size: 12.5px; font-weight: 500; }
.error-card { text-align: center; }
.error-code { display: inline-block; font-family: var(--ss-font-heading); font-weight: 700; font-size: 13px; letter-spacing: .12em; color: var(--ss-primary-600); background: var(--ss-primary-50); padding: 4px 10px; border-radius: 999px; margin-bottom: 14px; }
.error-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .topbar-search { width: 180px; }
}
@media (max-width: 860px) {
  /* Coarse-pointer sizing: 36px controls are below the 40px comfortable-tap floor. */
  .btn { height: 40px; padding: 0 16px; }
  .btn-sm { height: 34px; padding: 0 12px; }
  .btn-icon { width: 40px; padding: 0; }
  .btn-icon.btn-sm { width: 34px; }
  .nav-link { padding: 11px 12px; }
  .dropdown-item { min-height: 40px; }
  .sidebar { transform: translateX(-100%); box-shadow: none; transition: transform .2s ease; }
  .nav-open .sidebar { transform: none; box-shadow: var(--ss-shadow-lg); }
  .sidebar .sidebar-close { display: inline-flex; }
  .app-main { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .topbar .topbar-menu { display: inline-flex; }
  .topbar-search { display: none; }
  .app-content { padding: 20px 16px 40px; }
  .notif-menu, .user-menu { width: min(340px, calc(100vw - 32px)); }
}
@media (max-width: 640px) {
  /* The title lost to ~70px beside the actions; give it its own full-width row. */
  .topbar { height: auto; min-height: var(--ss-topbar-h); flex-wrap: wrap; row-gap: 2px; padding: 8px 16px 10px; }
  .topbar .topbar-menu { order: 0; }
  .topbar-actions { order: 1; margin-left: auto; }
  .topbar-title { order: 2; flex: 1 0 100%; }
  .page-subtitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}


/* Sidebar sits tighter than the sign-in page. */
.sidebar .brand-mark { height: 22px; }
.sidebar .brand-name { font-size: 17px; }

/* The sign-in card gives the company wordmark room to be read. */
.guest-shell .brand-word { height: 40px; }
@media (max-width: 480px) { .guest-shell .brand-word { height: 32px; } }

/* Public form pages: a quiet footer credit, never competing with the form. */
.ssf-credit { display: flex; align-items: center; justify-content: center; gap: 7px;
  margin: 28px auto 0; font-size: 12px; color: var(--ss-muted); text-decoration: none; }
.ssf-credit:hover { color: var(--ss-ink-2); text-decoration: none; }
.ssf-credit .brand-mark { height: 14px; }


/* ===========================================================================
   Brand lockup and the collapsible sidebar
   =========================================================================== */

/* --- lockup: lettering with the product name set beneath it ---------------- */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ss-ink); min-width: 0; }
.brand:hover { text-decoration: none; }
.brand:focus-visible { outline: 2px solid var(--ss-primary); outline-offset: 3px; border-radius: var(--ss-r-sm); }

.brand-mark { height: 24px; width: auto; flex: none; display: block; color: var(--ss-ink); }
.brand-word { height: 18px; width: auto; display: block; }
.brand-word-dark { display: none; }

.brand-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
/* Small, letterspaced and quiet: it qualifies the logo rather than competing
   with it, which is what the old 19px inline "Forms" was doing. */
.brand-suffix {
  font-size: 10px; font-weight: 600; line-height: 1;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ss-primary); padding-left: 1px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-word-light { display: none; }
  :root:not([data-theme="light"]) .brand-word-dark  { display: block; }
}
:root[data-theme="dark"] .brand-word-light { display: none; }
:root[data-theme="dark"] .brand-word-dark  { display: block; }

.guest-shell .brand-word { height: 40px; }
@media (max-width: 480px) { .guest-shell .brand-word { height: 32px; } }

/* Sidebar rail, peek and lockup collapse now live in nav.css. */
