/* Shared semantic surfaces keep DENCO's navy/cyan identity in both themes. */
:root {
  --surface: #fff; --heading: #013041; --text: #202020;
  --notice-surface: #fff9e8; --notice-ink: #79590f;
  --danger-surface: #fff1ef; --danger-ink: #9b3029;
  --scroll-thumb: #82b5c7; --scroll-track: #e8f1f5;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e1edf2; --text: #e1edf2; --heading: #edf8fc;
  --muted: #a6bfca; --label: #bfd3dd; --icon-muted: #a0bfcd;
  --page-background: #091d27; --surface: #102b38;
  --surface-subtle: #0e2632; --surface-muted: #193744; --surface-hover: #1a414f;
  --line: #2b4957; --line-soft: #233f4c; --border-strong: #4b788d;
  --brand-ice: #143d4c; --brand-blue: #72d7f4; --brand-blue-hover: #9ce6fa;
  --notice-surface: #372f1c; --notice-ink: #efcd83;
  --danger-surface: #432c30; --danger-ink: #ffb0a8;
  --scroll-thumb: #477b90; --scroll-track: #0e2632;
}
* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) var(--scroll-track); }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: var(--scroll-track); }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border: 2px solid var(--scroll-track); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--brand-blue); }
::-webkit-scrollbar-button { display: none; }
.sidebar { --scroll-thumb: #367a90; --scroll-track: #013041; }
.sidebar-scroll { scrollbar-gutter: stable; }
.sidebar-admin { margin-top: 20px; padding-top: 8px; border-top: 1px solid var(--sidebar-border); }
.sidebar-admin .nav-item { min-height: 38px; }
.language-bar { align-items: center; gap: 12px; }
.theme-toggle { gap: 6px; min-width: 78px; }
.theme-symbol { font-size: 19px; line-height: 1; color: var(--accent); }
.theme-toggle[hidden], [data-manual-save][hidden], .autosave-feedback button[hidden] { display: none; }
.brand-mark, .brand-mark > span, .button:not(.button--secondary):not(.button--quiet):not(.button--danger) { color: var(--brand-navy); }
.button:not(.button--secondary):not(.button--quiet):not(.button--danger):hover { background: #057b9b; color: #fff; }
.button--secondary { color: var(--heading); }

/* One document scroll: no viewport-height cages around the conversation. */
.ticket-workspace, .alerts ~ .ticket-workspace { height: auto; min-height: calc(100dvh - 120px); align-items: stretch; }
.conversation-column, .conversation-queue, .ticket-inspector { min-height: 0; height: auto; max-height: none; }
.queue-items, .conversation-scroll, .ticket-inspector { overflow: visible; max-height: none; }
.conversation-column { align-self: start; }
.conversation-scroll { flex: none; }
.ticket-workspace .people-field > div { max-height: none; overflow: visible; }
.conversation-history-hint { font-size: 12px; line-height: 1.6; color: var(--muted); margin: 0; padding: 12px 20px; border-top: 1px solid var(--line-soft); background: var(--surface-subtle); }
.autosave-feedback { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-top: 10px; font-size: 11px; color: var(--muted); min-height: 20px; }
.autosave-feedback[data-state="saving"] { color: var(--accent); }
.autosave-feedback[data-state="error"] { color: var(--danger-ink); }
.autosave-feedback[data-state="saved"]::before { content: '✓'; color: var(--accent); }
[data-autosave] { scroll-margin-top: 20px; }

:root[data-theme="dark"] .status--open { background: #173e4c; color: #91e5fb; }
:root[data-theme="dark"] .status--waiting { background: #3d341f; color: #efd08b; }
:root[data-theme="dark"] .status--closed { background: #293d48; color: #c2d2db; }
:root[data-theme="dark"] :is(.custom-tag, .urgency-normal, .tag-blue) { background: #193e50; color: #a4dcef; }
:root[data-theme="dark"] .tag-purple { background: #392e4c; color: #d9bdf7; }
:root[data-theme="dark"] :is(.tag-green, .deadline-scheduled, .deadline-answered) { background: #203d35; color: #ace0cd; }
:root[data-theme="dark"] :is(.tag-amber, .urgency-high, .deadline-soon) { background: #3d341f; color: #efd08b; }
:root[data-theme="dark"] :is(.urgency-urgent, .deadline-overdue, .deadline-answered_late) { background: #452c33; color: #ffb3b5; }
:root[data-theme="dark"] :is(.urgency-low, .deadline-excluded) { background: #2a3b45; color: #c0d0da; }
:root[data-theme="dark"] :is(.deadline-critical, .deadline-today) { background: #493525; color: #f3c29a; }
@media(max-width: 900px) {
  .ticket-workspace { min-height: 0; }
  .language-bar { padding-inline: 14px; }
}
@media(forced-colors: active) { * { scrollbar-color: auto; } }
@media print {
  :root[data-theme="dark"] { --ink: #202020; --text: #202020; --heading: #013041; --surface: white; --canvas: white; --surface-subtle: white; --muted: #596e7a; --label: #395768; --line: #d9e6ed; }
  .theme-toggle, .autosave-feedback { display: none; }
}
