/* Approved platform UI, 2026-09-20. Loaded after the existing layout rules.
   Tokens bridge existing components; domain behaviour remains untouched. */
:root {
  color-scheme: light;
  --canvas: #f3f6f9; --surface: #fff; --surface-soft: #f5f7f9; --pill: #edf0f3;
  --ink: #202e3c; --muted: #5c6976; --line: #dce3e9; --line-soft: #e8edf1;
  --control-line: #8895a2;
  --accent: #425b76; --accent-hover: #30465e; --accent-soft: #eaf0f6; --accent-ink: #304b67;
  --header: #334b62; --header-muted: #e0eaf3;
  --success: #176439; --success-soft: #e9f6ee;
  --warning: #795000; --warning-soft: #fff3d3;
  --danger: #aa2924; --danger-soft: #fff0ed;
  --violet: #6842a3; --violet-soft: #f2ecfc;
  --teal: #0c6b63; --teal-soft: #e4f4f0;
  --shadow-popover: 0 12px 32px -12px rgb(0 0 0 / 28%);
  --radius-sm: 8px; --radius-md: 13px; --radius-lg: 16px;
  --sidebar-width: 188px; --shadow-panel: none;
  font-size: 14px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #111820; --surface: #1b2530; --surface-soft: #202c38; --pill: #2a3745;
  --ink: #eef3f8; --muted: #b5c3d0; --line: #3b4a59; --line-soft: #31404e;
  --control-line: #8193a6;
  --accent: #b0c8df; --accent-hover: #d4e6f7; --accent-soft: #2c3b4c; --accent-ink: #bbd2e8;
  --header: #23374b; --header-muted: #dfebf6;
  --success: #9ae0b8; --success-soft: #203e32;
  --warning: #f3d17b; --warning-soft: #433920;
  --danger: #ffb4aa; --danger-soft: #4a2a2b;
  --violet: #d3baff; --violet-soft: #3a2d50;
  --teal: #a0e3d8; --teal-soft: #24423e;
  --shadow-popover: 0 12px 32px -12px rgb(0 0 0 / 65%);
}
body[data-module="documents"] {
  --accent: #2457c5; --accent-hover: #1c469e; --accent-soft: #eaf0fd; --accent-ink: #214faf;
  --header: #194991; --header-muted: #d4e4ff;
}
body[data-module="bags"] {
  --accent: #0f766e; --accent-hover: #0a5e58; --accent-soft: #e4f4f0; --accent-ink: #0c6b63;
  --header: #0a625e; --header-muted: #d2efea;
}
body[data-module="marketing"] {
  --accent: #76539f; --accent-hover: #593d7b; --accent-soft: #f2ecf8; --accent-ink: #66418e;
  --header: #574071; --header-muted: #ede1fa;
}
body[data-module="tools"] {
  --accent: #855c20; --accent-hover: #6c4715; --accent-soft: #faf0de; --accent-ink: #76501a;
  --header: #655036; --header-muted: #f2e7d4;
}
:root[data-theme="dark"] body[data-module="documents"] {
  --accent: #9abcff; --accent-hover: #c1d6ff; --accent-soft: #273e62; --accent-ink: #b0ccff; --header: #153b73;
}
:root[data-theme="dark"] body[data-module="bags"] {
  --accent: #86d9cb; --accent-hover: #a7eadf; --accent-soft: #24423e; --accent-ink: #a0e3d8; --header: #094c49;
}
:root[data-theme="dark"] body[data-module="marketing"] {
  --accent: #cfb1f0; --accent-hover: #e4cffb; --accent-soft: #3a2e4c; --accent-ink: #dfc4fc; --header: #403052;
}
:root[data-theme="dark"] body[data-module="tools"] {
  --accent: #e5c38a; --accent-hover: #f5deb9; --accent-soft: #413727; --accent-ink: #edcf9d; --header: #443827;
}
:root, body {
  --color-background: var(--canvas); --color-surface: var(--surface);
  --color-surface-subtle: var(--surface-soft); --color-surface-strong: var(--pill);
  --color-text: var(--ink); --color-text-muted: var(--muted); --color-text-soft: var(--muted);
  --color-border: var(--line); --color-border-strong: var(--control-line);
  --color-primary: var(--accent); --color-primary-hover: var(--accent-hover); --color-primary-soft: var(--accent-soft);
  --color-project-heading: var(--header);
  --color-success: var(--success); --color-success-soft: var(--success-soft);
  --color-warning: var(--warning); --color-warning-soft: var(--warning-soft);
  --color-danger: var(--danger); --color-danger-soft: var(--danger-soft);
  --color-violet: var(--violet); --color-violet-soft: var(--violet-soft);
  --color-teal: var(--teal); --color-teal-soft: var(--teal-soft);
  --color-chart-printed: #3669d6; --color-chart-plain: #188b80;
}
:root[data-theme="dark"] body { --color-chart-printed: #8cafff; --color-chart-plain: #70c9bb; }
body { font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Arial, sans-serif; font-size: 14px; line-height: 1.45; }
::selection { color: var(--ink); background: var(--accent-soft); }
input, textarea, [contenteditable="true"] { caret-color: var(--accent); }
* { scrollbar-color: var(--control-line) var(--surface-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
.ui-icon { width: 16px; height: 16px; flex: 0 0 16px; vertical-align: middle; }
.sidebar { width: var(--sidebar-width); padding: 14px 9px 12px; overflow: hidden; background: var(--surface); border-color: var(--line); }
.brand { min-height: 33px; gap: 9px; padding: 0 7px; }
.brand strong { font-size: 15px; }
.brand small { display: none; }
.brand__mark { width: 29px; height: 29px; flex-basis: 29px; border-radius: 8px; font-size: 13px; font-weight: 700; }
.primary-nav { min-height: 0; overflow-y: auto; flex: 1; gap: 1px; margin-top: 17px; scrollbar-width: thin; }
.nav-section-label { margin: 0 8px 5px; color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: 0; text-transform: none; }
.nav-section-label--project, .nav-section-label--secondary { margin-top: 14px; }
.nav-section-label--project { min-height: auto; padding: 0; background: transparent; border: 0; }
.nav-item { display: flex; align-items: center; gap: 8px; min-height: 29px; padding: 4px 8px; color: var(--muted); font-size: 12px; font-weight: 500; border-radius: 8px; }
.nav-item .ui-icon { width: 15px; height: 15px; flex-basis: 15px; }
.nav-item:hover { color: var(--ink); background: var(--surface-soft); }
.nav-item.is-active { color: var(--accent-ink); background: var(--accent-soft); font-weight: 650; }
.sidebar-user { flex-shrink: 0; padding: 10px 4px 0; margin-top: 9px; border-color: var(--line); gap: 7px; }
.sidebar-user .user-avatar { width: 26px; height: 26px; background: var(--accent-soft); color: var(--accent-ink); }
.sidebar-user__identity strong, .sidebar-user__identity span { font-size: 12px; }
.sidebar-user form { margin: 0; }
.sidebar-user form .button { min-height: 26px; font-size: 12px; padding: 3px 8px; }
.app-workspace { margin-left: var(--sidebar-width); min-width: 0; }
.workspace-header { position: relative; isolation: isolate; padding: 0 20px; color: #fff; background: var(--header); }
.workspace-header__art { position: absolute; inset: 0 0 0 auto; z-index: -1; width: 58%; height: 100%; object-fit: cover; object-position: right center; opacity: .22; mix-blend-mode: luminosity; pointer-events: none; }
.personal-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; }
.personal-bar__welcome, .personal-bar__actions { display: flex; align-items: center; gap: 10px; }
.personal-greeting { margin: 0; font-size: 14px; font-weight: 650; line-height: 18px; }
.personal-welcome { margin: 2px 0 0; color: var(--header-muted); font-size: 12px; }
.workspace-header .header-tool { display: grid; place-items: center; min-width: 32px; min-height: 32px; width: 32px; height: 32px; padding: 0; color: #fff; background: transparent; border: 0; border-radius: 50%; cursor: pointer; }
.workspace-header .header-tool:hover { color: #fff; background: rgb(255 255 255 / 15%); }
.workspace-header :focus-visible { outline-color: #fff; }
.profile-popover :focus-visible { outline-color: var(--accent); }
.theme-toggle__sun { display: none; }
:root[data-theme="dark"] .theme-toggle__sun { display: inline; }
:root[data-theme="dark"] .theme-toggle__moon { display: none; }
.profile-menu { position: relative; }
.profile-avatar { display: grid; width: 32px; height: 32px; place-items: center; color: #234c7b; background: #edf4ff; border: 2px solid rgb(255 255 255 / 70%); border-radius: 50%; font-size: 12px; font-weight: 700; list-style: none; cursor: pointer; }
.profile-avatar::-webkit-details-marker { display: none; }
.profile-popover { position: absolute; z-index: 70; top: calc(100% + 8px); right: 0; width: 260px; padding: 16px; color: var(--ink); background: var(--surface); border-radius: 13px; box-shadow: var(--shadow-popover); font-size: 13px; }
.profile-popover > strong, .profile-popover > span { display: block; }
.profile-popover > span, .profile-popover p { color: var(--muted); }
.profile-popover p { margin: 10px 0; }
.workspace-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 0 0 12px; }
.workspace-heading__identity { display: flex; align-items: center; gap: 9px; min-width: 0; }
.workspace-heading h1 { margin: 0; color: #fff; font-size: 20px; font-weight: 650; letter-spacing: -.02em; overflow-wrap: anywhere; }
.workspace-heading__actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.workspace-count, .workspace-heading__identity > span { display: inline-flex; padding: 2px 7px; color: #fff; background: rgb(255 255 255 / 14%); border-radius: 6px; font-size: 12px; font-variant-numeric: tabular-nums; }
.workspace-heading__actions > .button, .workspace-heading__actions > a.button, .workspace-heading__actions > details > summary { min-height: 32px; padding: 5px 13px; color: #173756; background: #fff; border: 0; border-radius: 18px; font-size: 13px; font-weight: 600; text-decoration: none; }
.workspace-heading__actions > .button:hover { background: #eaf0f8; }
.workspace-header > p { margin: 0; padding-bottom: 12px; color: var(--header-muted); font-size: 13px; }
.workspace-subtitle:empty, .modal-page-subtitle:empty { display: none; }
.modal-page-subtitle { margin: 0; padding: 8px 16px; color: var(--muted); }
.workspace-header .navigation-toggle { display: none; }
.navigation-backdrop,
.navigation-backdrop:hover,
.navigation-backdrop:focus-visible { position: fixed; z-index: 800; inset: 0; padding: 0; border: 0; border-radius: 0; background: rgb(0 0 0 / 40%); }
.content-container { width: 100%; min-width: 0; max-width: none; margin: 0; padding: 12px 12px 28px; }
.content-container > * { min-width: 0; }
h1 { font-size: 20px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; }
.page-header, .page-header-with-action { gap: 12px; margin-bottom: 12px; }
.page-subtitle { font-size: 13px; }
.back-link { min-height: 28px; margin: 0 0 10px; font-size: 13px; }
.panel { padding: 16px; border-radius: 13px; box-shadow: none; }
.table-panel { padding: 0; }
.panel + .panel, .content-grid + .panel, .callout + .panel { margin-top: 12px; }
.panel-heading { gap: 12px; margin-bottom: 12px; }
.content-grid, .form-grid { gap: 14px; margin-bottom: 14px; }
.section-block { margin-top: 20px; }
.section-heading { margin-bottom: 12px; }
.section-heading h2 { font-size: 16px; }
.data-table { color: var(--ink); font-size: 13px; font-variant-numeric: tabular-nums; }
.data-table th { padding: 8px 10px; color: var(--muted); background: var(--surface-soft); font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; border-color: var(--line); }
.data-table td { padding: 8px 10px; border-color: var(--line-soft); }
.data-table tbody tr:hover, .clickable-row:hover, .clickable-row:focus-visible { background: var(--surface-soft); }
.primary-cell-link { color: var(--accent-ink); }
.cell-secondary { margin-top: 2px; font-size: 12px; line-height: 1.35; }
.table-wrap { scrollbar-color: var(--control-line) var(--surface-soft); }
.filter-tabs { gap: 4px; margin: 10px 0; padding: 0; border: 0; }
.filter-tabs a { min-height: 32px; padding: 5px 12px; font-size: 13px; border-radius: 18px; background: var(--pill); }
.filter-tabs a.is-active { color: var(--accent-ink); background: var(--accent-soft); }
.filter-summary { font-size: 13px; }
.button { min-height: 34px; padding: 6px 13px; font-size: 13px; font-weight: 600; border-radius: 8px; color: var(--surface); background: var(--accent); border-color: transparent; box-shadow: none; }
.button:hover { color: var(--surface); background: var(--accent-hover); }
.button--secondary, .button--ghost { color: var(--ink); background: var(--surface); border-color: var(--line); }
.button--ghost { background: transparent; border-color: transparent; }
.button--secondary:hover, .button--ghost:hover { color: var(--ink); background: var(--pill); border-color: var(--line); }
.button--danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.button--danger:hover { color: var(--danger); background: var(--danger-soft); border-color: var(--danger); }
.button--compact { min-height: 28px; padding: 3px 9px; font-size: 12px; }
.button:disabled, .button[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.status-badge { min-height: 20px; padding: 1px 6px; border: 0; border-radius: 5px; font-size: 12px; line-height: 18px; letter-spacing: 0; font-weight: 600; }
.form-field label { font-size: 13px; margin-bottom: 5px; }
.form-field input, .form-field select, .form-field textarea { min-height: 36px; padding: 7px 10px; background: var(--surface); color: var(--ink); border-color: var(--control-line); border-radius: 8px; font-size: 14px; }
.form-field textarea { min-height: 110px; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--accent); box-shadow: none; outline: 2px solid var(--accent); outline-offset: 1px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
.form-field input[type="checkbox"], .form-field input[type="radio"] { min-height: 16px; width: 16px; height: 16px; }
input:disabled, textarea:disabled, select:disabled { opacity: .65; cursor: not-allowed; }
.field-help, .permission-note, .privacy-note, .section-intro, .quiet-state { font-size: 12px; color: var(--muted); }
.field-errors, .errorlist, .form-errors { color: var(--danger); }
.form-field--error input, .form-field--error select, .form-field--error textarea { border-color: var(--danger); }
.detail-list > div { padding: 8px 0; gap: 12px; }
.detail-list dt { font-size: 12px; }
.detail-list dd { font-size: 14px; }
.editor-panel > summary, .technical-details > summary { min-height: 38px; padding: 8px 12px; font-size: 13px; }
.editor-panel__content, .technical-details__content { padding: 14px; gap: 16px; }
.callout { grid-template-columns: minmax(0, 1fr); gap: 8px; margin-bottom: 14px; padding: 12px 14px; border-color: var(--line); }
.callout__marker { display: none; }
.callout__title { font-size: 14px; }
.metric-grid { gap: 12px; margin-bottom: 18px; }
.metric-card { min-height: 100px; padding: 14px; border-radius: 13px; box-shadow: none; }
.metric-card::before { display: none; }
.metric-card strong { font-size: 24px; }
.empty-state { padding: 30px 20px; color: var(--muted); background: var(--surface); border-radius: 13px; }
.empty-state h2 { color: var(--ink); font-size: 17px; }
.pagination { gap: 8px; margin-top: 12px; font-size: 13px; }
.toast { border-radius: 10px; box-shadow: var(--shadow-popover); background: var(--surface); color: var(--ink); }
.toast--error { color: var(--danger); background: var(--danger-soft); }
.toast--success { color: var(--success); background: var(--success-soft); }
.job-modal { color: var(--ink); background: var(--surface); border: 0; border-radius: 16px; box-shadow: var(--shadow-popover); }
.job-modal::backdrop { background: rgb(0 0 0 / 48%); }
.job-modal__bar { background: var(--surface-soft); border-color: var(--line); }
.job-modal__body { background: var(--canvas); }
.job-modal__close { color: var(--muted); background: transparent; }
.modal-page-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; color: var(--ink); background: var(--surface); border-bottom: 1px solid var(--line); }
.modal-page-heading h1 { margin: 0; color: var(--ink); font-size: 20px; }
.modal-page-heading:has(h1:empty) { display: none; }
.app-anonymous .workspace-header { max-width: 520px; margin: 24px auto 0; border-radius: 13px 13px 0 0; }
.app-anonymous .public-header { display: none; }
.app-anonymous .public-main { padding: 0 16px 28px; }
@media (min-width: 1400px) { .nav-item { min-height: 30px; } }
@media (max-width: 900px) {
  .app-workspace { margin-left: 0; }
  .sidebar { position: relative; width: 100%; max-height: 360px; }
  .navigation-ready .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 810; width: 230px; max-height: none; visibility: hidden; transform: translateX(-100%); transition: transform 180ms ease-out; }
  .navigation-ready .navigation-open .sidebar { visibility: visible; transform: translateX(0); }
  .sidebar > .brand { display: flex; }
  .sidebar .primary-nav { flex-direction: column; gap: 1px; margin-top: 17px; overflow-x: hidden; overflow-y: auto; }
  .sidebar .nav-section-label { display: block; }
  .sidebar .nav-item { flex: 0 0 auto; min-height: 36px; padding: 6px 8px; }
  .sidebar .sidebar-user { display: grid; }
  .navigation-ready .workspace-header .navigation-toggle { display: grid; }
  .navigation-open { overflow: hidden; }
  .workspace-header { padding: 0 12px; }
  .workspace-header__art { width: 75%; opacity: .16; }
  .workspace-heading { gap: 8px; }
  .workspace-heading__actions { gap: 6px; }
  .workspace-heading__actions > .button { font-size: 12px; padding: 5px 10px; }
  .content-container { padding: 10px 10px 24px; }
  .form-grid, .content-grid--balanced { grid-template-columns: minmax(0, 1fr); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .data-table { min-width: 640px; }
  .public-main .panel { padding: 18px; }
}
@media (max-width: 480px) {
  .personal-bar__welcome { gap: 4px; }
  .personal-bar__actions { gap: 4px; }
  .personal-greeting { font-size: 13px; }
  .personal-welcome { max-width: 215px; font-size: 11px; }
  .workspace-heading h1 { font-size: 20px; }
  .workspace-heading__actions { max-width: 52%; }
  .workspace-heading__actions > .button { white-space: normal; }
  .app-anonymous .workspace-header { margin: 16px 16px 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
