/* Helen Keller Intl brand system for KellerTracker */
:root {
  --purple-horizon: #7a4183;
  --blue-sky: #41b6e6;
  --coral-sunshine: #f87c56;
  --gray-shadow: #5b6770;
  --pale-blue-morning: #9cdbd9;
  --yellow-sunset: #f1c400;
  --pale-gray-dusk: #a7aca2;
  --brand: var(--purple-horizon);
  --brand-hover: #65366e;
  --brand-soft: #f3ebf4;
  --ink: #282d32;
  --muted: var(--gray-shadow);
  --line: #dce1e5;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-soft: #f7f5f8;
  --canvas: #f3f5f7;
  --danger: #a9432c;
  --danger-soft: #fff0eb;
  --success: #28755f;
  --success-soft: #e5f4f1;
  --warning: #795f00;
  --warning-soft: #fff6cc;
  --shadow-soft: 0 1px 2px rgb(38 29 41 / 5%), 0 10px 30px rgb(38 29 41 / 4%);
  --shadow-raised: 0 18px 48px rgb(27 20 29 / 16%);
  font-family: Aptos, "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  color-scheme: light;
}

html[data-theme="dark"] {
  --brand: #b27abb;
  --brand-hover: #c98fd2;
  --brand-soft: #372b3b;
  --ink: #f3f0f4;
  --muted: #b6bec4;
  --line: #3c3941;
  --surface: #211f25;
  --surface-raised: #29262e;
  --surface-soft: #2d2931;
  --canvas: #17151b;
  --danger: #ff9c7f;
  --danger-soft: #482b28;
  --success: #9cdbd9;
  --success-soft: #233b3c;
  --warning: #f1d45a;
  --warning-soft: #40391f;
  --shadow-soft: 0 1px 2px rgb(0 0 0 / 20%), 0 12px 32px rgb(0 0 0 / 16%);
  --shadow-raised: 0 22px 65px rgb(0 0 0 / 42%);
  color-scheme: dark;
}

html { background: var(--canvas); }
body { background: var(--canvas); color: var(--ink); font-size: 1rem; transition: background-color .18s ease, color .18s ease; }
button, input, select, textarea { color: inherit; }
a { color: var(--brand); }
:focus-visible { outline: 3px solid var(--blue-sky); outline-offset: 3px; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.brand-asset-dark { display: none !important; }
html[data-theme="dark"] .brand-asset-light { display: none !important; }
html[data-theme="dark"] .brand-asset-dark { display: block !important; }

/* Branded navigation rail */
.sidebar {
  width: var(--sidebar);
  background: var(--surface);
  border-right: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  transition: width .24s cubic-bezier(.22,.8,.25,1), background-color .18s ease;
}
.sidebar::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--purple-horizon) 0 36%, var(--blue-sky) 36% 58%, var(--coral-sunshine) 58% 78%, var(--yellow-sunset) 78% 100%);
}
.sidebar .brand {
  position: relative;
  height: 94px;
  min-height: 94px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  gap: 0;
}
.brand-logo-primary { display: grid; place-items: center; width: 43px; height: 68px; flex: 0 0 43px; transition: opacity .15s ease; }
.brand-logo-primary img { display: block; max-width: 39px; max-height: 62px; object-fit: contain; }
.brand-logo-expanded { position: absolute; left: 20px; width: 215px; opacity: 0; transform: translateX(-8px); transition: opacity .16s ease, transform .2s ease; }
.brand-wordmark { display: block; width: 185px; height: 28px; }
.brand-wordmark img { display: block; width: 185px; height: 19px; object-fit: contain; object-position: left center; }
.brand-logo-expanded strong { display: block; margin-top: 7px; color: var(--ink); font-size: 1rem; line-height: 1.1; letter-spacing: -.02em; }
.brand-logo-expanded small { display: block; margin-top: 3px; color: var(--muted); font-size: .72rem; font-weight: 600; letter-spacing: .04em; }
.sidebar:hover .brand-logo-primary,
.sidebar:focus-within .brand-logo-primary,
.sidebar.expanded .brand-logo-primary { opacity: 0; }
.sidebar:hover .brand-logo-expanded,
.sidebar:focus-within .brand-logo-expanded,
.sidebar.expanded .brand-logo-expanded { opacity: 1; transform: translateX(0); }
.sidebar nav { height: calc(100dvh - 94px); padding: 16px 10px 24px; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; }
.sidebar nav a {
  min-height: 47px;
  margin: 3px 0;
  padding: 8px 11px;
  gap: 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 650;
}
.sidebar nav a:hover,
.sidebar nav a:focus-visible { background: var(--brand-soft); color: var(--brand); }
.sidebar nav a.active {
  padding-left: 11px;
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
  border-left: 3px solid var(--brand);
  color: var(--brand);
}
.sidebar nav a > span:first-child { min-width: 32px; }
.nav-brand-icon { display: grid; place-items: center; width: 32px; height: 30px; flex: 0 0 32px; }
.nav-brand-icon img { display: block; width: 25px; height: 25px; object-fit: contain; }
.sidebar .nav-label { opacity: 0; transform: translateX(-3px); transition: opacity .14s ease, transform .18s ease; }
.sidebar:hover .nav-label,
.sidebar:focus-within .nav-label,
.sidebar.expanded .nav-label { opacity: 1; transform: translateX(0); }

/* Header, account and preferences */
.topbar {
  height: 78px;
  grid-template-columns: 40px minmax(180px, 560px) minmax(0, auto);
  padding: 13px 28px;
  gap: 20px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 12px rgb(36 28 39 / 4%);
  backdrop-filter: blur(14px);
}
.menu-button { width: 38px; height: 38px; border-radius: 9px; color: var(--muted); }
.menu-button:hover { background: var(--surface-soft); color: var(--brand); }
.global-search {
  width: min(560px, 100%);
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: .88rem;
  box-shadow: inset 0 1px 1px rgb(0 0 0 / 2%);
}
.global-search:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); background: var(--surface); }
.global-search > span:first-child { color: var(--brand); font-size: 1.2rem; }
.global-search kbd { margin-left: auto; border: 1px solid var(--line); border-radius: 5px; padding: 2px 6px; background: var(--surface); color: var(--muted); font-size: .68rem; box-shadow: 0 1px 1px rgb(0 0 0 / 5%); }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; min-width: 0; }
.notification-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 42px;
  height: 38px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
}
.notification-button:hover { border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); color: var(--brand); }
.notification-bell { font-size: 1.15rem; color: var(--brand); transform: rotate(45deg); }
.notification-button strong { display: grid; place-items: center; min-width: 21px; height: 21px; padding: 0 5px; border-radius: 20px; background: var(--coral-sunshine); color: #24130e; font-size: .72rem; }
.user-menu { position: relative; }
.user-menu summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 3px 7px 3px 3px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  font-size: .84rem;
  font-weight: 700;
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover,
.user-menu[open] summary { border-color: var(--line); background: var(--surface-soft); }
.account-avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--brand); color: #fff; font-size: .78rem; font-weight: 800; }
.account-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-chevron { color: var(--muted); font-size: .82rem; }
.user-menu-panel {
  top: calc(100% + 9px);
  min-width: 220px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-raised);
}
.user-menu-panel p { display: grid; gap: 2px; margin: 0 0 6px; padding: 10px 11px 12px; border-bottom: 1px solid var(--line); }
.user-menu-panel p small { color: var(--muted); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.user-menu-panel p strong { font-size: .9rem; }
.user-menu-panel a { padding: 9px 11px; border-radius: 7px; color: var(--ink); font-size: .85rem; }
.user-menu-panel a:hover { background: var(--brand-soft); color: var(--brand); }
.user-menu-panel .signout-link { color: var(--danger); }
.appearance-switch,
.language-switch {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}
.appearance-switch button,
.language-switch button {
  display: grid;
  place-items: center;
  min-width: 29px;
  height: 30px;
  padding: 0 7px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 750;
}
.appearance-switch button { font-size: 1rem; }
.appearance-switch button[aria-pressed="true"],
.language-switch button[aria-current="true"] { background: var(--surface); color: var(--brand); box-shadow: 0 1px 4px rgb(32 22 35 / 12%); }

/* Work surfaces */
.content { color: var(--ink); }
.workspace-heading h1,
.page-heading h1,
.section-heading h2,
.section-heading h3,
.tracking-list-panel h2,
.panel h2,
.panel h3 { color: var(--ink); }
.eyebrow { color: var(--brand) !important; font-size: .7rem; letter-spacing: .13em; }
.workspace-heading p:not(.eyebrow),
.page-heading p,
.page-heading small,
.workspace-footnote,
.quiet-empty { color: var(--muted); }
.live-label i { background: var(--pale-blue-morning); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pale-blue-morning) 25%, transparent); }
.primary-button,
.page-heading button,
.modal footer button,
.module-filter-form button,
.page-actions button,
.empty-state button,
.export-link { background: var(--brand); color: #fff; box-shadow: 0 5px 15px rgb(122 65 131 / 16%); }
.primary-button:hover,
.page-heading button:hover,
.modal footer button:hover,
.module-filter-form button:hover,
.page-actions button:hover,
.empty-state button:hover,
.export-link:hover { background: var(--brand-hover); }
.secondary-button,
.modal-card footer .secondary { border: 1px solid var(--line); background: var(--surface); color: var(--ink); box-shadow: none; }
.secondary-button:hover,
.modal-card footer .secondary:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); background: var(--brand-soft); color: var(--brand); }
.stat-tile,
.department-cards > a,
.incoming-panel,
.tracking-list-panel,
.panel,
.metric-card,
.catalog,
.administration-grid .catalog,
.report-cards article,
.report-cards-clickable button,
.report-cards-clickable article { background: var(--surface); border-color: var(--line); color: var(--ink); box-shadow: var(--shadow-soft); }
.stat-tile { position: relative; overflow: hidden; border-radius: 13px; }
.stat-tile::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: transparent; }
.stat-tile:hover { border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); box-shadow: 0 12px 30px rgb(70 45 75 / 9%); }
.stat-tile.is-selected::before { background: linear-gradient(90deg, var(--purple-horizon), var(--blue-sky)); }
.stat-tile.is-selected { border-bottom-color: var(--line); }
.stat-tile.attention { background: color-mix(in srgb, var(--coral-sunshine) 7%, var(--surface)); }
.stat-tile.attention > strong,
.warning-text,
.overdue-label { color: var(--danger) !important; }
.department-icon { background: var(--brand-soft); color: var(--brand); }
.department-cards em { color: var(--danger); }
.tracking-list-panel { border-radius: 13px; }
.tracking-filters,
.module-filter-form { background: var(--surface-soft); border-color: var(--line); }
.tracking-filters input,
.tracking-filters select,
.module-filter-form input,
.module-filter-form select,
.modal-card input,
.modal-card select,
.modal-card textarea { border-color: var(--line); background: var(--surface); color: var(--ink); }
.tracking-filters input::placeholder,
.modal-card input::placeholder,
.modal-card textarea::placeholder { color: color-mix(in srgb, var(--muted) 72%, transparent); }
.tracking-table th,
.report-detail-table th { background: color-mix(in srgb, var(--surface-soft) 88%, var(--pale-blue-morning)); color: var(--muted); border-color: var(--line); }
.tracking-table td,
th,
td,
.report-stage-row,
.search-result { border-color: var(--line); }
.tracking-table tbody tr:hover,
.search-result:hover,
.search-result:focus,
.report-stage-row:hover,
.report-stage-row:focus,
.report-workspace .report-bar:hover,
.report-workspace .report-bar:focus { background: var(--surface-soft); }
.item-title,
.stage-name,
.person-line strong,
.next-action,
.deadline-cell strong,
.report-stage-row,
.report-bar,
.search-result { color: var(--ink); }
.item-title:hover,
.reference-button,
.text-button,
.pagination a { color: var(--brand); }
.person-avatar { background: var(--brand-soft); color: var(--brand); }
.open-item { border-color: var(--line); background: var(--surface-soft); color: var(--brand); }
.open-item:hover { border-color: var(--brand); background: var(--brand-soft); }
.view-tabs a { color: var(--muted); }
.view-tabs a[aria-current] { color: var(--brand); border-bottom-color: var(--brand); }
.view-tabs b,
.facet-summary span,
.result-group h4 span { background: var(--brand-soft); color: var(--brand); }
.status-pill { border-radius: 6px; }
.status-active { background: color-mix(in srgb, var(--blue-sky) 17%, var(--surface)); color: color-mix(in srgb, var(--blue-sky) 60%, #14303b); }
.status-on_hold { background: var(--warning-soft); color: var(--warning); }
.status-completed { background: var(--success-soft); color: var(--success); }
.status-archived { background: color-mix(in srgb, var(--pale-gray-dusk) 22%, var(--surface)); color: var(--muted); }
.progress-track { background: color-mix(in srgb, var(--pale-gray-dusk) 28%, var(--surface)); }
.progress-track span { background: linear-gradient(90deg, var(--purple-horizon), var(--blue-sky)); }
.overdue td { background: color-mix(in srgb, var(--coral-sunshine) 6%, var(--surface)); }
.overdue td:first-child { border-left-color: var(--coral-sunshine); }
.alert-summary { border-left-color: var(--coral-sunshine); background: var(--danger-soft); color: var(--danger); }
.report-bar { background: var(--surface); }
.report-bar i { background: linear-gradient(to right, var(--purple-horizon) var(--value), color-mix(in srgb, var(--pale-gray-dusk) 30%, var(--surface)) var(--value)); }

/* Dialogs retain the same centered geometry in both themes. */
.modal { background: transparent; color: var(--ink); }
.modal::backdrop { background: rgb(28 20 31 / 60%); backdrop-filter: blur(5px); }
.modal-card { background: var(--surface-raised); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow-raised); }
.modal-card > header button { background: var(--surface-soft); color: var(--muted); }
.modal-card > header button:hover { background: var(--brand-soft); color: var(--brand); }
.modal-card > footer,
.detail-columns,
.related-items { border-color: var(--line); }
.form-intro,
.detail-focus,
.tracking-context { background: var(--surface-soft); border-color: var(--line); color: var(--muted); }
.relation-row { background: var(--surface-soft); border-color: var(--line); }
.relation-label { color: var(--brand); }
.route-steps li::before { background: var(--line); }
.route-steps .current { color: var(--brand); }
.route-steps .current .step-dot { background: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.route-steps .visited { color: var(--success); }
.route-steps .visited .step-dot { background: var(--success-soft); color: var(--success); }
.tracking-timeline li { border-color: var(--line); }
.tracking-timeline li:first-child .history-dot { background: var(--brand); }
.attention-banner { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--coral-sunshine) 35%, var(--line)); }
.transfer-banner { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--yellow-sunset) 35%, var(--line)); }
.modal-card .quiet-danger,
.form-error,
.errorlist,
.modal-card .errorlist { background: var(--danger-soft); color: var(--danger); }
.modal-card footer .danger { background: var(--danger); color: #fff; }

/* Sign-in */
.auth-page {
  min-height: 100dvh;
  padding: 54px 24px 24px;
  background:
    radial-gradient(circle at 14% 12%, color-mix(in srgb, var(--blue-sky) 17%, transparent), transparent 34%),
    radial-gradient(circle at 88% 84%, color-mix(in srgb, var(--coral-sunshine) 13%, transparent), transparent 30%),
    var(--canvas);
}
.auth-preferences { position: fixed; z-index: 2; top: 16px; right: 20px; display: flex; align-items: center; gap: 8px; }
.auth-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(300px, .9fr) minmax(380px, 1.1fr);
  width: min(1040px, 100%);
  min-height: 620px;
  margin: auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface-raised);
  box-shadow: 0 35px 100px rgb(39 25 42 / 18%);
}
.auth-brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 54px 48px 46px;
  overflow: hidden;
  background: linear-gradient(150deg, #603269 0%, var(--purple-horizon) 55%, #8c4d94 100%);
  color: #fff;
}
.auth-brand-panel::before,
.auth-brand-panel::after { content: ""; position: absolute; border: 1px solid rgb(255 255 255 / 16%); border-radius: 50%; }
.auth-brand-panel::before { width: 430px; height: 430px; left: -255px; top: 112px; }
.auth-brand-panel::after { width: 280px; height: 280px; right: -170px; bottom: 72px; }
.auth-wordmark { display: block; object-fit: contain; object-position: left center; }
.auth-brand-panel .auth-wordmark { position: relative; z-index: 1; width: min(280px, 88%); height: auto; }
.auth-brand-message { position: relative; z-index: 1; max-width: 320px; }
.auth-brand-message p { margin: 18px 0 0; color: #fff; font-size: 1.45rem; font-weight: 650; line-height: 1.38; letter-spacing: -.025em; }
.auth-brand-icon { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid rgb(255 255 255 / 25%); border-radius: 13px; background: rgb(255 255 255 / 10%); }
.auth-brand-icon img { width: 29px; height: 29px; object-fit: contain; }
.brand-color-ribbon { position: relative; z-index: 1; display: grid; grid-template-columns: 1.4fr 1fr .8fr .55fr; width: 170px; height: 5px; overflow: hidden; border-radius: 10px; }
.brand-color-ribbon i:nth-child(1) { background: var(--blue-sky); }
.brand-color-ribbon i:nth-child(2) { background: var(--coral-sunshine); }
.brand-color-ribbon i:nth-child(3) { background: var(--pale-blue-morning); }
.brand-color-ribbon i:nth-child(4) { background: var(--yellow-sunset); }
.auth-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: auto;
  padding: clamp(42px, 7vw, 82px);
  border: 0;
  border-radius: 0;
  background: var(--surface-raised);
  box-shadow: none;
}
.auth-card > .auth-wordmark { display: none !important; width: 220px; max-width: 70%; margin-bottom: 46px; }
.auth-card .eyebrow { margin: 0 0 8px; }
.auth-card h1 { margin: 0; color: var(--ink); font-size: clamp(2rem, 4vw, 2.8rem); letter-spacing: -.045em; }
.auth-card > p:not(.eyebrow) { margin: 12px 0 24px; color: var(--muted); font-size: .95rem; line-height: 1.65; }
.auth-card label { margin: 17px 0; color: var(--ink); font-size: .86rem; }
.auth-card input { min-height: 46px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); }
.auth-card input:focus { border-color: var(--blue-sky); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue-sky) 18%, transparent); outline: none; }
.auth-card button[type="submit"] { min-height: 48px; margin-top: 8px; border-radius: 9px; background: var(--brand); box-shadow: 0 8px 22px rgb(122 65 131 / 22%); }
.auth-card button[type="submit"]:hover { background: var(--brand-hover); }

html[data-theme="dark"] .sidebar { background: #1d1921; }
html[data-theme="dark"] .topbar { background: rgb(33 31 37 / 92%); }
html[data-theme="dark"] .tracking-table th,
html[data-theme="dark"] .report-detail-table th { background: #2a2930; }
html[data-theme="dark"] .tracking-table tbody tr:hover { background: #29262e; }
html[data-theme="dark"] .stat-tile.attention { background: #2c2224; }
html[data-theme="dark"] .auth-brand-panel { background: linear-gradient(150deg, #402344, #67376f 58%, #7a4183); }

@media (max-width: 1100px) {
  .topbar { padding-inline: 18px; gap: 12px; }
  .topbar-actions { gap: 5px; }
  .account-name { max-width: 105px; }
}

@media (max-width: 820px) {
  .auth-shell { grid-template-columns: 1fr; width: min(520px, 100%); min-height: 0; }
  .auth-brand-panel { display: none; }
  .auth-card { min-height: 590px; padding: 58px clamp(28px, 9vw, 62px); border-radius: 22px; }
  .auth-card > .auth-wordmark { display: block !important; }
}

@media (max-width: 700px) {
  :root { --sidebar: 56px; }
  .sidebar .brand { height: 74px; min-height: 74px; padding: 8px 10px; }
  .brand-logo-primary { width: 36px; height: 56px; flex-basis: 36px; }
  .brand-logo-primary img { max-width: 32px; max-height: 52px; }
  .brand-logo-expanded { left: 16px; }
  .sidebar nav { height: calc(100dvh - 74px); padding-inline: 5px; }
  .sidebar nav a { padding-inline: 6px; }
  .sidebar nav a.active { padding-left: 6px; border-left-width: 2px; }
  .topbar { left: var(--sidebar); height: 68px; grid-template-columns: 32px minmax(38px, 1fr) auto; padding: 8px 10px; gap: 5px; }
  .menu-button { width: 32px; height: 36px; }
  .global-search { min-height: 38px; width: 100%; padding: 6px 10px; }
  .global-search .search-label,
  .global-search kbd { display: none; }
  .topbar-actions { gap: 3px; }
  .notification-button { min-width: 34px; width: 34px; height: 36px; padding: 4px; }
  .notification-button strong { position: absolute; width: 8px; min-width: 8px; height: 8px; padding: 0; overflow: hidden; color: transparent; transform: translate(10px,-10px); }
  .account-name,
  .account-chevron { display: none; }
  .user-menu summary { width: 36px; min-height: 36px; padding: 2px; }
  .user-menu summary::after { content: none !important; display: none !important; }
  .account-avatar { width: 30px; height: 30px; }
  .appearance-switch,
  .language-switch { height: 36px; padding: 2px; border-radius: 9px; }
  .appearance-switch button,
  .language-switch button { min-width: 27px; height: 30px; padding-inline: 5px; }
  .content { padding-top: 91px; }
}

@media (max-width: 500px) {
  .topbar { padding-inline: 6px; }
  .notification-button { display: none; }
  .appearance-switch button { min-width: 25px; }
  .language-switch button { min-width: 25px; font-size: .68rem; }
  .auth-page { padding: 62px 12px 12px; }
  .auth-preferences { right: 12px; top: 12px; }
  .auth-card { min-height: calc(100dvh - 74px); padding: 44px 26px; }
}

@media (prefers-reduced-motion: reduce) {
  body, .sidebar, .brand-logo-primary, .brand-logo-expanded, .sidebar .nav-label { transition: none !important; }
}

/* R5.5 — visible movement, direct row access and grouped settings */
[data-row-modal-url] { cursor: pointer; }
tr[data-row-modal-url] > td { transition: background-color .14s ease, box-shadow .14s ease; }
tr[data-row-modal-url]:hover > td { background: color-mix(in srgb, var(--brand-soft) 48%, var(--surface-raised)); }
tr[data-row-modal-url]:focus-visible { outline: none; }
tr[data-row-modal-url]:focus-visible > td { background: var(--brand-soft); box-shadow: inset 0 2px var(--brand), inset 0 -2px var(--brand); }
tr[data-row-modal-url]:focus-visible > td:first-child { box-shadow: inset 2px 0 var(--brand), inset 0 2px var(--brand), inset 0 -2px var(--brand); }
tr[data-row-modal-url]:focus-visible > td:last-child { box-shadow: inset -2px 0 var(--brand), inset 0 2px var(--brand), inset 0 -2px var(--brand); }

.journey-section {
  margin: 24px 0 18px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--blue-sky) 34%, var(--line));
  border-radius: 13px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--pale-blue-morning) 17%, var(--surface-raised)), var(--surface-raised) 56%);
}
.journey-section .section-heading { align-items: end; margin-bottom: 18px; }
.journey-section .section-heading h3 { font-size: 17px; }
.journey-scroll { max-width: 100%; overflow-x: auto; padding: 6px 2px 12px; scrollbar-width: thin; }
.journey-track { display: flex; align-items: stretch; width: max-content; min-width: 100%; margin: 0; padding: 0; list-style: none; }
.journey-point { display: flex; align-items: center; }
.journey-node {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 205px;
  min-height: 112px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-raised);
  box-shadow: 0 7px 22px rgb(39 25 42 / 7%);
}
.journey-avatar { display: grid; place-items: center; flex: 0 0 35px; width: 35px; height: 35px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: .78rem; font-weight: 800; text-transform: uppercase; }
.journey-node > div { min-width: 0; }
.journey-node strong, .journey-node span, .journey-node small { display: block; }
.journey-node strong { overflow: hidden; color: var(--ink); font-size: .77rem; text-overflow: ellipsis; white-space: nowrap; }
.journey-node div > span { margin-top: 3px; color: var(--brand); font-size: .68rem; font-weight: 700; }
.journey-node small { margin-top: 7px; color: var(--muted); font-size: .61rem; line-height: 1.45; }
.journey-node .journey-due { color: var(--warning); font-weight: 700; }
.journey-node b { display: inline-block; margin-top: 7px; padding: 3px 7px; border-radius: 5px; background: var(--success-soft); color: var(--success); font-size: .58rem; }
.journey-point.pending .journey-node { border-style: dashed; border-color: var(--warning); }
.journey-point.refused .journey-node { border-color: var(--danger); background: var(--danger-soft); }
.journey-point.current .journey-node { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft), 0 8px 24px rgb(122 65 131 / 11%); }
.journey-link { position: relative; display: grid; place-items: center; width: 108px; min-width: 108px; height: 112px; }
.journey-link > i { position: absolute; left: 8px; right: 8px; top: 55px; height: 2px; background: linear-gradient(90deg, var(--blue-sky), var(--brand)); }
.journey-link > em { position: absolute; right: 6px; top: 42px; color: var(--brand); font-size: 20px; font-style: normal; }
.journey-item { z-index: 1; display: grid; place-items: center; width: 38px; height: 38px; border: 2px solid var(--surface-raised); border-radius: 11px; background: var(--pale-blue-morning); box-shadow: 0 5px 13px rgb(65 182 230 / 24%); transform: rotate(-4deg); }
.journey-item img { width: 23px; height: 23px; object-fit: contain; }
.journey-key { margin: 3px 0 0; color: var(--muted); font-size: .65rem; }

.settings-shell { display: grid; grid-template-columns: 265px minmax(0, 1fr); gap: 22px; max-width: 78rem; margin: 24px auto 0; align-items: start; }
.settings-sidebar { position: sticky; top: 98px; padding: 18px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-raised); }
.settings-sidebar > .eyebrow { padding-inline: 9px; }
.settings-sidebar nav { display: grid; gap: 5px; }
.settings-sidebar a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 10px; border-radius: 9px; color: var(--ink); text-decoration: none; }
.settings-sidebar a:hover { background: var(--surface-soft); }
.settings-sidebar a.active { background: var(--brand-soft); color: var(--brand); }
.settings-sidebar a span { min-width: 0; }
.settings-sidebar a strong, .settings-sidebar a small { display: block; }
.settings-sidebar a strong { font-size: .78rem; }
.settings-sidebar a small { margin-top: 3px; color: var(--muted); font-size: .62rem; line-height: 1.35; }
.settings-sidebar a b { display: grid; place-items: center; min-width: 28px; height: 24px; padding: 0 6px; border-radius: 12px; background: var(--surface-soft); color: var(--muted); font-size: .65rem; }
.settings-content { min-width: 0; }
.settings-group-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.settings-group-heading h2 { margin: 2px 0; font-size: 1.35rem; }
.settings-group-heading p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: .8rem; }
.settings-group-heading > span { padding: 6px 10px; border-radius: 7px; background: var(--brand-soft); color: var(--brand); font-size: .7rem; font-weight: 700; }
.settings-index { display: flex; gap: 8px; margin-bottom: 16px; overflow-x: auto; padding-bottom: 4px; }
.settings-index a { display: inline-flex; align-items: center; gap: 8px; min-width: max-content; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-raised); color: var(--ink); text-decoration: none; font-size: .68rem; font-weight: 650; }
.settings-index a:hover { border-color: var(--brand); color: var(--brand); }
.settings-index a b { color: var(--brand); }
.settings-content .administration-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: none; margin: 0; }
.settings-content .catalog { scroll-margin-top: 96px; padding: 15px; background: var(--surface-raised); }
.settings-content .catalog h3 { margin: 0; font-size: .88rem; }
.settings-content .catalog h3 span { font-size: .62rem; }
.parameter-row { align-items: center; border-radius: 7px; padding-inline: 7px !important; }
.parameter-row:hover, .parameter-row:focus-visible { background: var(--surface-soft); outline: none; }
.parameter-row > span:first-child { min-width: 0; overflow: hidden; font-size: .72rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.parameter-row .row-actions { justify-content: flex-end; }
.parameter-row .view-button { color: var(--brand); font-weight: 750; }
.parameter-empty { color: var(--muted); font-size: .75rem; }
.parameter-detail { width: 760px; }
.parameter-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.parameter-detail-grid > div { min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.parameter-detail-grid dt { margin-bottom: 4px; color: var(--muted); font-size: .63rem; font-weight: 700; letter-spacing: .045em; text-transform: uppercase; }
.parameter-detail-grid dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); font-size: .78rem; line-height: 1.5; }

.auth-shell { min-height: 530px; }
.auth-brand-panel { align-items: flex-start; justify-content: center; }
.auth-brand-panel .brand-color-ribbon { position: absolute; left: 48px; bottom: 44px; }
.auth-card { padding-block: 54px; }
.auth-card > p:not(.eyebrow) { margin-bottom: 18px; }
.password-label { gap: .4rem !important; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 48px; }
.auth-card .password-toggle { position: absolute; top: 50%; right: 5px; display: grid; place-items: center; width: 38px; height: 36px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--muted); box-shadow: none; transform: translateY(-50%); }
.auth-card .password-toggle:hover, .auth-card .password-toggle[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); }
.password-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }

@media (max-width: 980px) {
  .settings-shell { grid-template-columns: 1fr; }
  .settings-sidebar { position: static; }
  .settings-sidebar nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .auth-card { min-height: 500px; padding-block: 46px; }
  .auth-card > .auth-wordmark { margin-bottom: 30px; }
}

@media (max-width: 700px) {
  .journey-section { padding: 15px; }
  .journey-node { width: 178px; }
  .journey-link { width: 76px; min-width: 76px; }
  .settings-sidebar nav, .settings-content .administration-grid { grid-template-columns: 1fr; }
  .settings-group-heading { align-items: flex-start; }
  .parameter-row { align-items: flex-start; flex-direction: column; }
  .parameter-row .row-actions { justify-content: flex-start; width: 100%; }
  .parameter-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 500px) {
  .auth-card { min-height: calc(100dvh - 74px); padding-block: 38px; }
  .auth-card > .auth-wordmark { margin-bottom: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  tr[data-row-modal-url] > td { transition: none !important; }
}

/* R5.6 — horizontal settings navigation attached below the main header */
.settings-page .content { padding-top: 220px; }
.settings-subheader {
  position: fixed;
  z-index: 9;
  top: 78px;
  right: 0;
  left: var(--sidebar);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-raised) 96%, transparent);
  box-shadow: 0 8px 24px rgb(39 25 42 / 5%);
  backdrop-filter: blur(14px);
}
.settings-primary-tabs,
.settings-secondary-tabs {
  display: flex;
  align-items: stretch;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
}
.settings-primary-tabs::-webkit-scrollbar,
.settings-secondary-tabs::-webkit-scrollbar { display: none; }
.settings-primary-tabs { min-height: 67px; padding: 7px 30px 0; gap: 5px; }
.settings-primary-tabs a {
  position: relative;
  display: flex;
  flex: 0 1 220px;
  align-items: center;
  gap: 10px;
  min-width: 170px;
  padding: 8px 13px 11px;
  border-radius: 9px 9px 0 0;
  color: var(--muted);
  text-decoration: none;
}
.settings-primary-tabs a::after { content: ""; position: absolute; right: 10px; bottom: 0; left: 10px; height: 3px; border-radius: 3px 3px 0 0; background: transparent; }
.settings-primary-tabs a:hover { background: var(--surface-soft); color: var(--ink); }
.settings-primary-tabs a.active { background: linear-gradient(180deg, var(--brand-soft), color-mix(in srgb, var(--brand-soft) 32%, transparent)); color: var(--brand); }
.settings-primary-tabs a.active::after { background: var(--brand); }
.settings-tab-symbol { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-raised); color: var(--brand); font-size: 1rem; }
.settings-primary-tabs a.active .settings-tab-symbol { border-color: color-mix(in srgb, var(--brand) 25%, var(--line)); background: var(--brand); color: #fff; }
.settings-primary-tabs a > span:last-child { display: flex; min-width: 0; align-items: center; gap: 7px; }
.settings-primary-tabs strong { overflow: hidden; font-size: .73rem; text-overflow: ellipsis; white-space: nowrap; }
.settings-primary-tabs small { display: grid; place-items: center; min-width: 22px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--surface-soft); color: var(--muted); font-size: .59rem; font-weight: 750; }
.settings-primary-tabs a.active small { background: var(--surface-raised); color: var(--brand); }
.settings-secondary-tabs { min-height: 45px; padding: 0 36px; gap: 2px; border-top: 1px solid var(--line); background: var(--surface-soft); }
.settings-secondary-tabs > strong { position: sticky; left: 0; z-index: 1; display: flex; align-items: center; min-width: max-content; padding: 0 18px 0 0; background: var(--surface-soft); color: var(--muted); font-size: .62rem; letter-spacing: .06em; text-transform: uppercase; }
.settings-secondary-tabs a { display: flex; align-items: center; gap: 7px; min-width: max-content; padding: 0 13px; border-bottom: 2px solid transparent; color: var(--ink); font-size: .68rem; font-weight: 650; text-decoration: none; }
.settings-secondary-tabs a:hover { border-bottom-color: var(--blue-sky); color: var(--brand); }
.settings-secondary-tabs a b { color: var(--brand); font-size: .6rem; }
.settings-heading { align-items: center; margin-bottom: 22px; }
.settings-heading .eyebrow { color: var(--brand) !important; }
.settings-total { display: flex; align-items: baseline; gap: 6px; min-width: max-content; padding: 10px 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-raised); color: var(--muted); font-size: .67rem; }
.settings-total strong { color: var(--brand); font-size: 1.05rem; }
.settings-content { max-width: 78rem; margin: 0 auto; }
.settings-content .administration-grid { gap: 16px; }
.settings-content .catalog { overflow: hidden; padding: 0; border-radius: 11px; }
.settings-content .catalog > header { align-items: center; min-height: 69px; padding: 13px 15px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface-soft) 72%, var(--surface-raised)); }
.settings-content .catalog h2 { margin: 2px 0 0; font-size: .91rem; }
.settings-content .catalog h2 span { display: inline-grid; place-items: center; min-width: 25px; height: 21px; padding: 0 6px; border-radius: 11px; background: var(--brand-soft); color: var(--brand); font-size: .61rem; }
.catalog-kicker { margin: 0; color: var(--muted); font-size: .55rem; font-weight: 750; letter-spacing: .1em; }
.catalog-create { padding: 7px 9px !important; border-radius: 7px; background: var(--brand-soft) !important; color: var(--brand) !important; font-weight: 750; }
.settings-content .catalog ul { padding: 5px 8px 9px; }
.settings-content .catalog li { border-top: 0; border-bottom: 1px solid var(--line); }
.settings-content .catalog li:last-child { border-bottom: 0; }

/* R5.7 — all edit screens use the same large, auditable record layout. */
.modal.parameter-detail,
.modal.record-editor-modal {
  width: min(70rem, calc(100vw - 2rem));
  max-width: min(70rem, calc(100vw - 2rem));
}
.modal.record-editor-modal {
  height: min(50rem, calc(100dvh - 2rem));
  max-height: min(50rem, calc(100dvh - 2rem));
}
.parameter-detail .modal-card,
.record-editor-card {
  width: 100%;
  max-width: none;
}
.record-editor-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  max-height: none;
  padding: 0;
  overflow: hidden;
}
.record-editor-card > header {
  align-items: flex-start;
  padding: 20px 24px 17px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-soft) 58%, var(--surface-raised));
}
.record-editor-card > header h2 { margin: 3px 0 4px; font-size: 1.25rem; }
.record-editor-card > header small { color: var(--muted); font-size: .72rem; }
.record-editor-card > footer {
  margin: 0;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface-raised);
}
.record-editor-body {
  min-height: 0;
  padding: 20px 24px 28px;
  overflow: auto;
  overscroll-behavior: contain;
}
.record-editor-audit {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--blue-sky) 28%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--pale-blue-morning) 14%, var(--surface-raised));
}
.record-editor-audit > header,
.record-editor-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.record-editor-audit h3,
.record-editor-section-heading h3 { margin: 2px 0 0; font-size: .9rem; }
.record-editor-audit .eyebrow,
.record-editor-section-heading .eyebrow { margin: 0; font-size: .55rem; }
.record-editor-audit > header > span {
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--brand);
  font-size: .62rem;
  font-weight: 750;
}
.record-editor-audit dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 0;
}
.record-editor-audit dl > div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-raised);
}
.record-editor-audit dt {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: .55rem;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.record-editor-audit dd { margin: 0; overflow-wrap: anywhere; font-size: .7rem; font-weight: 650; }
.record-editor-section-heading { margin-bottom: 12px; }
.record-editor-section-heading > small { max-width: 30rem; color: var(--muted); font-size: .65rem; text-align: right; }
.record-editor-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}
.record-editor-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  margin: 0 !important;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}
.record-editor-field-wide { grid-column: 1 / -1; }
.record-editor-field > label {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: .63rem;
  font-weight: 750;
  letter-spacing: .02em;
}
.record-editor-field input:not([type="checkbox"]):not([type="radio"]),
.record-editor-field select,
.record-editor-field textarea {
  width: 100%;
  min-height: 42px;
  margin: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-raised);
  color: var(--ink);
  font-size: .78rem;
}
.record-editor-field textarea { min-height: 84px; resize: vertical; }
.record-editor-field input:disabled,
.record-editor-field select:disabled,
.record-editor-field textarea:disabled { background: color-mix(in srgb, var(--surface-soft) 78%, var(--line)); color: var(--muted); cursor: not-allowed; }
.record-editor-field.field-widget-checkbox { display: grid; grid-template-columns: 1fr auto; align-items: center; }
.record-editor-field.field-widget-checkbox > input { grid-column: 2; grid-row: 1; width: 20px; height: 20px; accent-color: var(--brand); }
.record-editor-field .helptext { color: var(--muted); font-size: .61rem; line-height: 1.45; }
.record-editor-field .errorlist { margin: 0; padding: 7px 9px; font-size: .65rem; }
.record-editor-field ul:not(.errorlist) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin: 2px 0 0; padding: 0; list-style: none; }
.record-editor-field ul:not(.errorlist) label { display: flex; align-items: center; gap: 7px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-raised); font-size: .7rem; font-weight: 600; }
.record-editor-field ul:not(.errorlist) input { width: 17px; height: 17px; accent-color: var(--brand); }

@media (max-width: 780px) {
  .modal.record-editor-modal { width: calc(100vw - 20px); max-width: calc(100vw - 20px); height: calc(100dvh - 20px); max-height: calc(100dvh - 20px); }
  .record-editor-card > header { padding: 16px; }
  .record-editor-card > footer { padding: 12px 16px; }
  .record-editor-body { padding: 15px 16px 22px; }
  .record-editor-audit dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .record-editor-fields { grid-template-columns: 1fr; }
  .record-editor-field { grid-column: auto; }
  .record-editor-section-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
  .record-editor-section-heading > small { text-align: left; }
}

@media (max-width: 1100px) {
  .settings-primary-tabs { padding-inline: 18px; }
  .settings-secondary-tabs { padding-inline: 22px; }
  .settings-primary-tabs a { flex-basis: 190px; }
}

@media (max-width: 700px) {
  .settings-page .content { padding-top: 190px; }
  .settings-subheader { top: 68px; left: 56px; }
  .settings-primary-tabs { min-height: 62px; padding: 5px 8px 0; }
  .settings-primary-tabs a { flex-basis: auto; min-width: 156px; padding: 7px 10px 9px; }
  .settings-tab-symbol { flex-basis: 29px; width: 29px; height: 29px; }
  .settings-secondary-tabs { min-height: 42px; padding-inline: 10px; }
  .settings-secondary-tabs > strong { padding-right: 12px; }
  .settings-secondary-tabs a { padding-inline: 10px; }
  .settings-heading { align-items: flex-start; }
  .settings-total { display: none; }
}

/* R5.8 — one active settings reference list, full-width table and clearer actions. */
.settings-secondary-tabs a.active {
  border-bottom-color: var(--brand);
  background: var(--surface-raised);
  color: var(--brand);
}
.settings-secondary-tabs a.active b {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--brand-soft);
}
.settings-page .page-heading.settings-heading,
.settings-page .pending-changes,
.settings-page .settings-content {
  width: 100%;
  max-width: none;
  margin-inline: 0;
}
.settings-content .administration-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  width: 100%;
  max-width: none;
  margin: 0;
}
.settings-content .catalog { width: 100%; }
.settings-content .catalog > header { min-height: 72px; padding: 14px 20px; }
.settings-content .catalog ul { padding: 7px 14px 12px; }
.settings-content .parameter-row {
  min-height: 56px;
  gap: 18px;
  padding: 10px 12px !important;
}
.settings-content .parameter-row > span:first-child { font-size: .77rem; }
.catalog-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow: 0 1px 2px rgb(39 25 42 / 4%);
  cursor: pointer;
  font: inherit;
  font-size: .68rem;
  font-weight: 750;
  line-height: 1;
  transition: transform .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
}
.catalog-action > span {
  display: grid;
  place-items: center;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: .75rem;
  font-weight: 850;
}
.catalog-action:hover,
.catalog-action:focus-visible {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
  color: var(--brand);
  box-shadow: 0 5px 12px rgb(39 25 42 / 9%);
  outline: none;
  transform: translateY(-1px);
}
.catalog-action.catalog-create {
  padding: 7px 10px !important;
  border-color: color-mix(in srgb, var(--brand) 25%, var(--line));
  background: var(--brand-soft) !important;
  color: var(--brand) !important;
}
.catalog-action.catalog-create > span { background: var(--brand); color: #fff; }
.catalog-action.action-simulate > span { background: color-mix(in srgb, var(--blue-sky) 18%, var(--surface-raised)); color: var(--blue-sky); }
.catalog-action.action-publish > span { background: color-mix(in srgb, #2c8a5d 16%, var(--surface-raised)); color: #23734d; }
.catalog-action.action-delete { color: var(--danger); }
.catalog-action.action-delete > span { background: var(--danger-soft); color: var(--danger); }
.catalog-action.action-delete:hover,
.catalog-action.action-delete:focus-visible { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); color: var(--danger); }
.topbar-actions .user-menu { margin-left: 2px; }

@media (max-width: 900px) {
  .settings-content .parameter-row { align-items: flex-start; flex-direction: column; gap: 8px; }
  .settings-content .parameter-row .row-actions { justify-content: flex-start; width: 100%; }
}

/* R5.9 — user identity, in-app validation and version information. */
.nav-brand-icon svg,
.sidebar-version svg {
  display: block;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}
.sidebar nav { padding-bottom: 82px; }
.sidebar-version {
  position: absolute;
  z-index: 2;
  right: 10px;
  bottom: 12px;
  left: 10px;
  display: flex;
  align-items: center;
  min-height: 44px;
  gap: 14px;
  padding: 8px 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-raised) 92%, var(--brand-soft));
  color: var(--brand);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  font: inherit;
  font-size: .72rem;
  font-weight: 800;
  white-space: nowrap;
}
.sidebar-version:hover,
.sidebar-version:focus-visible { border-color: color-mix(in srgb, var(--brand) 42%, var(--line)); background: var(--brand-soft); }
.sidebar-version .nav-label { min-width: 6rem; text-align: left; }

.staff-avatar {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--brand) 20%, var(--line));
  background: var(--brand-soft);
  color: var(--brand);
}
.staff-avatar > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.staff-avatar > svg { width: 66%; height: 66%; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.65; }
.staff-avatar.gender-woman { background: color-mix(in srgb, var(--coral-sunshine) 13%, var(--surface-raised)); color: color-mix(in srgb, var(--coral-sunshine) 76%, var(--ink)); }
.staff-avatar.gender-man { background: color-mix(in srgb, var(--blue-sky) 13%, var(--surface-raised)); color: color-mix(in srgb, var(--blue-sky) 78%, var(--ink)); }
.staff-avatar.gender-other { background: color-mix(in srgb, var(--pale-blue-morning) 23%, var(--surface-raised)); color: color-mix(in srgb, var(--purple-horizon) 74%, var(--ink)); }
.account-avatar { width: 32px; height: 32px; border-radius: 9px; }
.profile-identity-preview { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); }
.profile-avatar { width: 72px; height: 72px; border-radius: 18px; font-size: 1.08rem; font-weight: 850; }
.profile-identity-preview > div { display: grid; gap: 4px; }
.profile-identity-preview strong { color: var(--ink); font-size: .92rem; }
.profile-identity-preview small { max-width: 34rem; color: var(--muted); font-size: .68rem; line-height: 1.5; }
.journey-avatar { width: 37px; height: 37px; border-radius: 50%; }
.route-staff-avatar { width: 27px; height: 27px; margin: -3px auto 7px; border-radius: 50%; }
.route-steps li:has(.route-staff-avatar) .step-dot { margin-bottom: 7px; }

.form-validation-summary { margin: 0 28px 16px; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--danger) 28%, var(--line)); border-radius: 8px; font-size: .75rem; font-weight: 700; }
.auth-card .form-validation-summary { margin: 0 0 14px; }
.client-errorlist { width: 100%; list-style: none; }
.modal-card input[aria-invalid="true"],
.modal-card select[aria-invalid="true"],
.modal-card textarea[aria-invalid="true"],
.auth-card input[aria-invalid="true"] { border-color: var(--danger) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 12%, transparent); }

.application-info-modal { width: min(760px, calc(100vw - 28px)); }
.application-info-modal .modal-card { width: 100%; max-height: calc(100dvh - 40px); overflow: auto; }
.application-info-language { display: flex; justify-content: flex-end; gap: 4px; margin: -4px 0 14px; }
.application-info-language button { min-width: 39px; height: 32px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); color: var(--muted); cursor: pointer; font-size: .7rem; font-weight: 800; }
.application-info-language button[aria-pressed="true"] { border-color: color-mix(in srgb, var(--brand) 36%, var(--line)); background: var(--brand-soft); color: var(--brand); }
.application-info-copy dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.application-info-copy dl > div { padding: 13px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); }
.application-info-copy dl > div:nth-child(5) { grid-column: 1 / -1; }
.application-info-copy dt { margin-bottom: 5px; color: var(--muted); font-size: .62rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.application-info-copy dd { margin: 0; color: var(--ink); font-size: .78rem; line-height: 1.48; }
.application-info-note { margin: 14px 0 0; padding: 11px 14px; border-left: 3px solid var(--coral-sunshine); border-radius: 6px; background: color-mix(in srgb, var(--coral-sunshine) 9%, var(--surface-raised)); color: var(--ink); font-size: .72rem; font-weight: 750; }

@media (max-width: 620px) {
  .application-info-copy dl { grid-template-columns: 1fr; }
  .application-info-copy dl > div:nth-child(5) { grid-column: auto; }
  .form-validation-summary { margin-inline: 16px; }
}

/* R5.10 — header title and compact global search. */
.topbar {
  grid-template-columns: minmax(120px, 1fr) 42px minmax(0, 1fr);
}
.topbar-brand {
  justify-self: start;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -.025em;
  text-decoration: none;
  white-space: nowrap;
}
.topbar-brand:hover,
.topbar-brand:focus-visible { color: var(--brand); }
.global-search {
  display: grid;
  place-items: center;
  justify-self: center;
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
}
.global-search svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
}
.topbar-actions { justify-self: end; }

@media (max-width: 700px) {
  .topbar { grid-template-columns: auto 38px minmax(0, 1fr); }
  .topbar-brand { font-size: .88rem; }
  .global-search { width: 38px; min-width: 38px; height: 38px; min-height: 38px; padding: 0; }
}

/* R5.11 — grouped search/notifications and visible collapsed version. */
.topbar { grid-template-columns: minmax(120px, 1fr) auto; }
.global-search { justify-self: auto; }
.sidebar-version {
  right: 6px;
  left: 6px;
  justify-content: center;
  gap: 0;
  padding-inline: 4px;
}
.sidebar-version svg { display: none; }
.sidebar-version .nav-label {
  min-width: 0;
  opacity: 1;
  transform: none;
  color: var(--brand);
  font-size: .57rem;
  letter-spacing: -.02em;
  text-align: center;
}
.sidebar:hover .sidebar-version,
.sidebar:focus-within .sidebar-version,
.sidebar.expanded .sidebar-version {
  right: 10px;
  left: 10px;
  justify-content: flex-start;
  gap: 14px;
  padding-inline: 14px;
}
.sidebar:hover .sidebar-version svg,
.sidebar:focus-within .sidebar-version svg,
.sidebar.expanded .sidebar-version svg { display: block; }
.sidebar:hover .sidebar-version .nav-label,
.sidebar:focus-within .sidebar-version .nav-label,
.sidebar.expanded .sidebar-version .nav-label {
  min-width: 6rem;
  font-size: .72rem;
  text-align: left;
}

@media (max-width: 700px) {
  .topbar { grid-template-columns: auto minmax(0, 1fr); }
}

/* R5.12 — explicit Staff account lifecycle. */
.account-row-identity { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.account-row-identity strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-row-identity small { color: var(--muted); font-size: .66rem; }
.account-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: .62rem;
  font-weight: 750;
  white-space: nowrap;
}
.account-status.status-active { border-color: color-mix(in srgb, #27875b 35%, var(--line)); background: color-mix(in srgb, #27875b 11%, var(--surface-raised)); color: #207149; }
.account-status.status-temporary_password,
.account-status.status-password_required { border-color: color-mix(in srgb, var(--yellow-sunset) 55%, var(--line)); background: color-mix(in srgb, var(--yellow-sunset) 15%, var(--surface-raised)); color: color-mix(in srgb, #775d00 86%, var(--ink)); }
.account-status.status-locked,
.account-status.status-inactive { border-color: color-mix(in srgb, var(--coral-sunshine) 55%, var(--line)); background: color-mix(in srgb, var(--coral-sunshine) 13%, var(--surface-raised)); color: color-mix(in srgb, #9b351f 86%, var(--ink)); }
.account-overview { display: flex; align-items: center; gap: 14px; margin: 0 0 16px; }
.account-overview p { margin: 0; color: var(--muted); }
.account-actions { flex-wrap: wrap; }
.password-change-shell { min-height: 100dvh; }

@media (max-width: 760px) {
  .account-row { align-items: flex-start !important; }
  .account-row .row-actions { justify-content: flex-start; }
}

/* ── Messagerie et notifications ─────────────────────────────────────────── */

/* Listes de définitions et textes d'aide : employés dans tout le paramétrage
   sans avoir jamais reçu de présentation propre. */
.definitions { display: grid; grid-template-columns: minmax(10rem, auto) 1fr; gap: 6px 18px; margin: 0; }
.definitions dt { color: var(--muted); font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .02em; }
.definitions dd { margin: 0; font-size: .82rem; }
.helptext { display: block; color: var(--muted); font-size: .74rem; line-height: 1.5; }

.email-settings .page-panel { max-width: 78rem; margin: 0 auto 18px; }
.email-settings .section-heading { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.email-settings .section-heading h2 { margin: 2px 0 0; font-size: 1.05rem; }
.email-settings .section-heading small { color: var(--muted); font-size: .74rem; max-width: 34rem; }

.page-flash { max-width: 78rem; margin: 0 auto 18px; padding: 0; list-style: none; display: grid; gap: 8px; }
.page-flash li { padding: 12px 16px; border: 1px solid var(--line); border-left-width: 4px; border-radius: 9px; background: var(--surface); font-size: .85rem; font-weight: 600; box-shadow: var(--shadow-soft); }
.page-flash .flash-success { border-left-color: var(--success); background: var(--success-soft); color: var(--ink); }
.page-flash .flash-error { border-left-color: var(--danger); background: var(--danger-soft); color: var(--ink); }

.email-kpi .report-cards { grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
.email-kpi article { display: grid; gap: 6px; align-content: start; padding: 14px 16px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); }
.email-kpi article small { color: var(--muted); font-size: .68rem; font-weight: 650; text-transform: uppercase; letter-spacing: .03em; }
.email-kpi article strong { font-size: 1.6rem; line-height: 1.15; }
.email-kpi .kpi-service strong { font-size: .95rem; line-height: 1.35; }
.email-kpi .kpi-service { border-left: 4px solid var(--warning); }
.email-kpi .kpi-service.is-live { border-left-color: var(--success); background: var(--success-soft); }
.email-kpi > .helptext { margin-top: 12px; }

.email-fieldset { padding: 16px 0; border-top: 1px solid var(--line); }
.email-fieldset:first-of-type { border-top: 0; padding-top: 0; }
.email-fieldset > .eyebrow { margin: 0 0 10px; }
.email-fieldset > .helptext { margin-top: 10px; }
.email-fieldset .definitions { margin-top: 12px; }
.record-editor-field.is-imposed input,
.record-editor-field.is-imposed select { background: var(--surface-soft); color: var(--muted); }
.record-editor-field a.text-button { justify-self: start; margin-top: 4px; font-size: .74rem; }

.email-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.email-actions button { padding: 10px 20px; border: 1px solid var(--brand); border-radius: 9px; background: var(--brand); color: #fff; font-size: .84rem; font-weight: 650; cursor: pointer; }
.email-actions button:hover { background: var(--brand-hover); border-color: var(--brand-hover); }

.email-guide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 16px; }
.email-guide-grid article { padding: 16px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); }
.email-guide-grid h3 { margin: 0 0 6px; font-size: .88rem; color: var(--brand); }
.email-guide-grid p { margin: 0 0 10px; font-size: .8rem; color: var(--muted); }
.email-guide-grid ol { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: .8rem; }

.email-rules-scroll { overflow-x: auto; }
.email-rules-table { width: 100%; min-width: 46rem; border-collapse: collapse; font-size: .8rem; }
.email-rules-table th { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .03em; }
.email-rules-table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.email-rules-table td small { display: block; color: var(--muted); font-size: .7rem; }
.plain-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 3px; }

.parameter-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.parameter-list .parameter-row span:first-child small { display: block; color: var(--muted); font-size: .7rem; }

@media (max-width: 760px) {
  .definitions { grid-template-columns: 1fr; gap: 2px 0; }
  .definitions dd { margin-bottom: 8px; }
  /* La table reste une table et défile horizontalement dans son cadre :
     l'empiler ferait disparaître les en-têtes, donc le sens des colonnes. */
  .email-rules-scroll { margin-inline: -4px; padding-inline: 4px; }
  .email-actions { justify-content: stretch; }
  .email-actions button { width: 100%; }
}

/* ── Notifications d'evenement (R5.17) ─────────────────────────────────── */
.notification-feed { margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.notification-feed .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.notification-feed h3 { margin: 0; font-size: .95rem; }
.notification-feed .badge { display: inline-block; min-width: 1.4em; padding: 1px 7px; border-radius: 999px; background: var(--brand); color: #fff; font-size: .72rem; text-align: center; }
.notification-feed .alert-row { border-left: 3px solid transparent; }
.notification-feed .alert-row.is-unread { border-left-color: var(--brand); background: var(--brand-soft); }
.notification-feed .alert-row[data-role="action"] strong { color: var(--brand); }
