:root {
  --bg: #f6f7f8;
  --surface: #ffffff;
  --surface-subtle: #f2f3f5;
  --border: #e7e9ec;
  --text-primary: #14181f;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --primary: #5d7fae;
  --primary-hover: #41658f;
  --primary-soft: #eaf0f8;
  --primary-focus-rgb: 93, 127, 174;
  --primary-gradient: linear-gradient(94deg, #6f91c0 0%, #41658f 100%);
  --ai-gradient: linear-gradient(94deg, #8b5cf6 0%, #d946ef 50%, #3b82f6 100%);
  --green-bg: #dcfce7;
  --green-fg: #15803d;
  --red-bg: #fee2e2;
  --red-fg: #b91c1c;
  --amber-bg: #fef3c7;
  --amber-fg: #b45309;
  --blue-bg: #dbeafe;
  --blue-fg: #1d4ed8;
  --sky-bg: #e0f2fe;
  --sky-fg: #0369a1;
  --teal-bg: #ccfbf1;
  --teal-fg: #0f766e;
  --purple-bg: #f3e8ff;
  --purple-fg: #7e22ce;
  --pink-bg: #fce7f3;
  --pink-fg: #be185d;
  --orange-bg: #ffedd5;
  --orange-fg: #c2410c;
  --gray-bg: #f3f4f6;
  --gray-fg: #4b5563;
  --radius-card: 16px;
  --radius-inner: 12px;
  --radius-btn: 10px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-hover: 0 4px 12px rgba(16, 24, 40, 0.08);
  --shadow-modal: 0 12px 32px rgba(16, 24, 40, 0.14);
  --radius-sm: 6px;
  --font-size-h3: 16px;
  --tenant-brand-primary: #5d7fae;
  --tenant-brand-primary-strong: #41658f;
  --tenant-brand-focus-rgb: 93, 127, 174;
  --theme-bg: #f4f6fa;
  --theme-panel: #ffffff;
  --theme-text: #17202a;
  --theme-muted: #667085;
  --theme-border: #d8dee8;
  --theme-danger: #b42318;
  --theme-warning: #b54708;
  --theme-surface-subtle: #f1f5f9;
  --theme-kanban-column: #f8fafc;
  --theme-stage-ink: #0f172a;
  --theme-stage-card: #fde047;
  --theme-stage-warehouse: #93c5fd;
  --theme-stage-supplier: #f9a8d4;
  --theme-stage-logistics: #5eead4;
  --theme-stage-economics: #fdba74;
  --theme-stage-documents: #86efac;
  --theme-stage-counter: rgba(255, 255, 255, 0.64);
  --theme-stage-counter-border: rgba(15, 23, 42, 0.08);
  --landing-bg: #0b1120;
  --landing-bg-bottom: #0e1526;
  --landing-accent: #2f7df6;
  --landing-accent-hover: #4a90f7;
  --landing-text: #f5f7fa;
  --landing-text-soft: #9aa5b5;
  --landing-panel: rgba(15, 23, 42, 0.78);
  --landing-panel-border: rgba(154, 165, 181, 0.22);
  --landing-glow-start: rgba(36, 86, 214, 0.45);
  --landing-glow-end: rgba(36, 86, 214, 0);
  --landing-screen-top: rgba(47, 125, 246, 0.14);
  --landing-screen-bottom: rgba(11, 17, 32, 0.98);
  --landing-device-frame: #121a2b;
  --landing-device-edge: #243149;
  --landing-device-base: #1b2638;
  --landing-device-shadow: rgba(0, 0, 0, 0.38);
  --landing-preview-bg: #f8fafc;
  --landing-preview-panel: #ffffff;
  --landing-preview-text: #17202a;
  --landing-preview-muted: #64748b;
  --landing-preview-border: #d8dee8;
  --landing-preview-line: #cbd5e1;
  --color-bg: var(--theme-bg);
  --color-panel: var(--theme-panel);
  --color-text: var(--theme-text);
  --color-muted: var(--theme-muted);
  --color-border: var(--theme-border);
  --color-accent: var(--tenant-brand-primary);
  --color-accent-strong: var(--tenant-brand-primary-strong);
  --color-danger: var(--theme-danger);
  --color-warning: var(--theme-warning);
  --color-surface-subtle: var(--theme-surface-subtle);
  --color-kanban-column: var(--theme-kanban-column);
  --color-stage-ink: var(--theme-stage-ink);
  --color-stage-card: var(--theme-stage-card);
  --color-stage-warehouse: var(--theme-stage-warehouse);
  --color-stage-supplier: var(--theme-stage-supplier);
  --color-stage-logistics: var(--theme-stage-logistics);
  --color-stage-economics: var(--theme-stage-economics);
  --color-stage-documents: var(--theme-stage-documents);
  --color-stage-counter: var(--theme-stage-counter);
  --color-stage-counter-border: var(--theme-stage-counter-border);
  --border-width: 1px;
  --radius-panel: 8px;
  --radius-control: 6px;
  --radius-pill: 999px;
  --space-0: 0;
  --space-1: 6px;
  --space-2: 10px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
  --layout-max-width: 1180px;
  --layout-sidebar-width: 216px;
  --layout-topbar-height: 64px;
  --kanban-column-min-width: 0;
  --layout-landing-max-width: 1240px;
  --control-inline-min: 160px;
  --control-theme-width: 128px;
  --control-landing-theme-width: 180px;
  --layout-mobile-breakpoint: 760px;
  --grid-single-column: 1fr;
  --grid-three-columns: repeat(3, minmax(0, 1fr));
  --font-size-title: 34px;
  --font-size-hero: 56px;
  --font-size-section: 18px;
  --font-size-subsection: 16px;
  --font-size-code: 12px;
  --landing-min-height: 100vh;
  --landing-shell-offset: 112px;
  --landing-board-min-height: 360px;
  --landing-side-min-width: 320px;
  --landing-copy-max-width: 680px;
  --landing-eyebrow-spacing: 0.12em;
  --landing-device-border: 12px;
  --landing-device-width: min(760px, 74vw);
  --landing-laptop-offset-x: -6%;
  --landing-device-base-width: 112%;
  --landing-device-base-offset: -6%;
  --landing-composition-width: min(860px, 80vw);
  --landing-phone-width: 176px;
  --landing-phone-border: 10px;
  --landing-phone-radius: 28px;
  --landing-phone-overlap-y: 43%;
  --landing-phone-shadow: 0 26px 70px rgba(0, 0, 0, 0.42);
  --landing-phone-island-width: 54px;
  --landing-phone-island-height: 14px;
  --landing-phone-island-top: 12px;
  --landing-phone-mobile-width: 104px;
  --landing-phone-mobile-top: 39%;
  --auth-panel-max-width: 520px;
  --kanban-min-height: 280px;
  --pre-min-height: 220px;
  --pre-max-height: 360px;
  --full-width: 100%;
  --font-body: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, monospace;
  --shadow-focus: 0 0 0 3px rgba(var(--tenant-brand-focus-rgb), 0.18);
  --landing-shadow-accent: 0 12px 38px rgba(47, 125, 246, 0.32);
  --landing-device-shadow-elevated: 0 36px 90px var(--landing-device-shadow);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --tenant-brand-primary: #2dd4bf;
    --tenant-brand-primary-strong: #5eead4;
    --tenant-brand-focus-rgb: 45, 212, 191;
    --theme-bg: #101418;
    --theme-panel: #171d23;
    --theme-text: #eef2f6;
    --theme-muted: #9aa4b2;
    --theme-border: #2d3743;
    --theme-surface-subtle: #202832;
    --shadow-focus: 0 0 0 3px rgba(var(--tenant-brand-focus-rgb), 0.2);
  }
}

:root[data-theme="light"] {
  --tenant-brand-primary: #0f766e;
  --tenant-brand-primary-strong: #115e59;
  --tenant-brand-focus-rgb: 15, 118, 110;
  --theme-bg: #f7f8fb;
  --theme-panel: #ffffff;
  --theme-text: #17202a;
  --theme-muted: #667085;
  --theme-border: #d8dee8;
  --theme-surface-subtle: #f1f5f9;
}

:root[data-theme="dark"] {
  --tenant-brand-primary: #2dd4bf;
  --tenant-brand-primary-strong: #5eead4;
  --tenant-brand-focus-rgb: 45, 212, 191;
  --theme-bg: #101418;
  --theme-panel: #171d23;
  --theme-text: #eef2f6;
  --theme-muted: #9aa4b2;
  --theme-border: #2d3743;
  --theme-surface-subtle: #202832;
  --shadow-focus: 0 0 0 3px rgba(var(--tenant-brand-focus-rgb), 0.2);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: var(--space-0);
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
}

button,
input,
select,
textarea {
  font: inherit;
  min-width: var(--space-0);
}

button {
  border: var(--space-0);
  border-radius: var(--radius-control);
  background: var(--color-accent);
  color: var(--color-panel);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
}

button:hover {
  background: var(--color-accent-strong);
}

input,
select,
textarea {
  width: var(--full-width);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-panel);
  color: var(--color-text);
  padding: var(--space-2) var(--space-3);
}

textarea {
  resize: vertical;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: var(--space-0);
  box-shadow: var(--shadow-focus);
}

.landing-page {
  height: var(--landing-min-height);
  overflow: hidden;
  background: linear-gradient(180deg, var(--landing-bg), var(--landing-bg-bottom));
  color: var(--landing-text);
}

.landing-nav {
  width: min(var(--layout-landing-max-width), calc(100vw - (var(--space-3) * 2)));
  margin: 0 auto;
  padding: var(--space-4) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.landing-logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--landing-text);
}

.landing-logo span {
  width: var(--space-3);
  height: var(--space-3);
  border-radius: var(--radius-control);
  background: var(--landing-accent);
}

.landing-nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.landing-shell {
  position: relative;
  width: min(var(--layout-landing-max-width), calc(100vw - (var(--space-3) * 2)));
  margin: 0 auto;
  min-height: calc(var(--landing-min-height) - var(--landing-shell-offset));
  display: grid;
  place-items: center;
  padding: var(--space-4) 0;
}

.landing-hero {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  text-align: center;
  width: var(--full-width);
}

.landing-hero h1 {
  margin: var(--space-2) 0 var(--space-4);
  font-size: var(--font-size-hero);
  line-height: 1.04;
  letter-spacing: var(--space-0);
}

.landing-eyebrow {
  margin: var(--space-0);
  color: var(--landing-accent);
  font-weight: 700;
  letter-spacing: var(--landing-eyebrow-spacing);
  font-size: var(--font-size-code);
}

.text-accent {
  color: var(--landing-accent);
}

.landing-primary,
.landing-secondary {
  border-radius: var(--radius-pill);
  padding: var(--space-2) var(--space-4);
}

.landing-primary {
  background: var(--landing-accent);
  color: var(--landing-text);
  box-shadow: var(--landing-shadow-accent);
}

.landing-primary:hover {
  background: var(--landing-accent-hover);
}

.landing-secondary {
  border: var(--border-width) solid var(--landing-panel-border);
  background: transparent;
  color: var(--landing-text);
}

.landing-secondary:hover {
  background: var(--landing-panel);
}

.device-composition {
  position: relative;
  width: var(--landing-composition-width);
  margin-top: var(--space-3);
}

.laptop-device {
  position: relative;
  width: var(--landing-device-width);
  transform: translateX(var(--landing-laptop-offset-x));
  filter: drop-shadow(var(--landing-device-shadow-elevated));
}

.device-frame {
  position: relative;
  z-index: 2;
  display: block;
  width: var(--full-width);
  height: auto;
  pointer-events: none;
  user-select: none;
}

.device-screen {
  position: absolute;
  z-index: 1;
  overflow: hidden;
  background: var(--landing-preview-bg);
  color: var(--landing-preview-text);
}

.laptop-preview {
  left: 11.1%;
  top: 4.1%;
  width: 77.9%;
  height: 62.2%;
  border-radius: var(--radius-sm);
  padding: var(--space-3);
}

.preview-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 34px;
  border-bottom: var(--border-width) solid var(--color-border);
  font-size: var(--font-size-code);
}

.preview-layout {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: var(--space-3);
  height: calc(var(--full-width) - 34px);
  padding-top: var(--space-3);
}

.preview-sidebar,
.preview-board > div {
  border: var(--border-width) solid var(--landing-preview-border);
  border-radius: var(--radius-control);
  background: var(--landing-preview-panel);
}

.preview-sidebar {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  padding: var(--space-2);
}

.preview-sidebar span,
.preview-board span,
.phone-preview div {
  display: block;
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--landing-preview-line);
}

.preview-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
}

.preview-board > div {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  min-height: 100%;
  padding: var(--space-2);
  font-size: var(--font-size-code);
}

.preview-board strong {
  color: var(--tenant-brand-primary);
}

.phone-device {
  position: absolute;
  right: var(--space-0);
  top: 25%;
  width: var(--landing-phone-width);
  box-shadow: var(--landing-phone-shadow);
  z-index: 2;
}

.phone-preview {
  left: 13.2%;
  top: 5.2%;
  width: 73.6%;
  height: 88.2%;
  border-radius: 28px;
  display: grid;
  align-content: start;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-3) var(--space-3);
  font-size: var(--font-size-code);
}

.phone-preview strong {
  font-size: var(--font-size-h3);
}

.phone-preview span {
  color: var(--landing-preview-muted);
}

.landing-auth-panel,
.registration-hint {
  position: absolute;
  z-index: 2;
  bottom: var(--space-5);
  left: 50%;
  transform: translateX(-50%);
  width: min(var(--auth-panel-max-width), calc(100vw - (var(--space-3) * 2)));
  border: var(--border-width) solid var(--landing-panel-border);
  border-radius: var(--radius-panel);
  background: var(--landing-panel);
  color: var(--landing-text);
  padding: var(--space-4);
}

.landing-auth-panel input {
  background: var(--landing-bg);
  color: var(--landing-text);
  border-color: var(--landing-panel-border);
}

.landing-auth-panel label,
.registration-hint,
.landing-auth-panel p {
  color: var(--landing-text-soft);
}

.auth-panel {
  margin: var(--space-0);
  max-width: var(--auth-panel-max-width);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--layout-sidebar-width) minmax(0, 1fr);
  background: var(--color-bg);
}

.app-sidebar {
  position: sticky;
  top: var(--space-0);
  height: 100vh;
  border-right: var(--border-width) solid var(--color-border);
  background: var(--color-panel);
  padding: var(--space-4) var(--space-3);
}

.sidebar-brand {
  font-weight: 800;
  margin-bottom: var(--space-4);
}

.sidebar-nav {
  display: grid;
  gap: var(--space-1);
}

.sidebar-link {
  display: block;
  border-radius: var(--radius-control);
  color: var(--color-text);
  padding: var(--space-2) var(--space-3);
  text-decoration: none;
}

.sidebar-link:hover,
.sidebar-link-active {
  background: var(--color-surface-subtle);
  color: var(--color-accent-strong);
}

.app-workspace {
  min-width: var(--space-0);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: var(--space-3);
  padding: var(--space-0) var(--space-3) var(--space-3);
}

.admin-shell {
  min-height: var(--landing-min-height);
  display: grid;
  align-content: start;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--color-bg);
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-panel);
  background: var(--color-panel);
  padding: var(--space-3);
}

.admin-panel {
  width: min(var(--layout-landing-max-width), var(--full-width));
}

.admin-table {
  display: grid;
  gap: var(--space-2);
}

.admin-account-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.5fr) minmax(0, 0.9fr) minmax(0, 0.4fr);
  gap: var(--space-3);
  align-items: center;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-surface-subtle);
  padding: var(--space-3);
}

.admin-account-row span {
  display: block;
  color: var(--color-muted);
  margin-top: var(--space-1);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--layout-topbar-height);
  margin-inline: calc(var(--space-3) * -1);
  border-bottom: var(--border-width) solid var(--color-border);
  background: var(--color-panel);
  padding: var(--space-3);
}

.topbar-spacer {
  min-width: var(--space-0);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.topbar-actions select {
  width: var(--control-theme-width);
}

.clock {
  min-width: 72px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-subtle);
  color: var(--color-text);
  font-weight: 800;
  padding: var(--space-1) var(--space-3);
  text-align: center;
}

.llm-switcher {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.split-button {
  display: inline-flex;
  align-items: stretch;
}

.split-button button {
  border-radius: var(--space-0);
  border: var(--border-width) solid var(--color-border);
  background: var(--color-panel);
  color: var(--color-text);
}

.split-button button:first-child {
  border-radius: var(--radius-pill) var(--space-0) var(--space-0) var(--radius-pill);
}

.split-button button:last-child {
  border-left: var(--space-0);
  border-radius: var(--space-0) var(--radius-pill) var(--radius-pill) var(--space-0);
  padding-inline: var(--space-2);
}

.split-button button.llm-active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-panel);
}

.llm-lab-panel {
  order: 0;
}

[data-page] {
  display: none;
}

[data-page].page-active {
  display: block;
}

.mail-page.page-active {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: var(--space-3);
  align-items: start;
}

.mail-folders {
  position: sticky;
  top: calc(var(--layout-topbar-height) + var(--space-3));
  display: grid;
  gap: var(--space-1);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-panel);
  background: var(--color-panel);
  padding: var(--space-3);
}

.mail-compose-button {
  margin-bottom: var(--space-2);
}

.mail-folder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: var(--border-width) solid transparent;
  background: transparent;
  color: var(--color-text);
  text-align: left;
}

.mail-folder:hover,
.mail-folder-active {
  border-color: var(--color-border);
  background: var(--color-surface-subtle);
  color: var(--color-accent-strong);
}

.mail-main {
  display: grid;
  gap: 0;
  min-width: var(--space-0);
}

.mail-head {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-panel);
  background: var(--color-panel);
  padding: var(--space-3);
}

.mail-view {
  display: none;
}

.mail-view-active {
  display: block;
}

.mail-settings-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.mail-settings-status {
  display: flex;
  justify-content: flex-end;
  margin-bottom: var(--space-3);
}

.mail-editor-field {
  display: grid;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
  color: var(--color-muted);
}

.mail-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  border: var(--border-width) solid var(--color-border);
  border-bottom: var(--space-0);
  border-radius: var(--radius-control) var(--radius-control) var(--space-0) var(--space-0);
  background: var(--color-surface-subtle);
  padding: var(--space-1);
}

.mail-editor-toolbar button {
  width: 36px;
  min-height: 32px;
  border: var(--border-width) solid transparent;
  background: transparent;
  color: var(--color-text);
  padding: var(--space-1);
}

.mail-editor-toolbar button:hover {
  border-color: var(--color-border);
  background: var(--color-panel);
}

.mail-editor {
  min-height: 220px;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--space-0) var(--space-0) var(--radius-control) var(--radius-control);
  background: var(--color-panel);
  color: var(--color-text);
  padding: var(--space-3);
  overflow-wrap: anywhere;
}

.mail-editor:focus {
  outline: var(--space-0);
  box-shadow: var(--shadow-focus);
}

.mail-compose-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

.mail-compose-actions button:first-child {
  border: var(--border-width) solid var(--color-border);
  background: var(--color-panel);
  color: var(--color-text);
}

.check-line {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 42px;
}

.check-line input {
  width: auto;
}

.mail-dev-panel {
  margin-top: var(--space-3);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: var(--font-size-title);
  letter-spacing: 0;
}

h2 {
  font-size: var(--font-size-section);
  margin-bottom: var(--space-3);
}

p {
  color: var(--color-muted);
  margin-top: var(--space-1);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.kanban {
  display: grid;
  grid-template-columns: repeat(6, minmax(var(--kanban-column-min-width), 1fr));
  gap: var(--space-2);
  min-height: 62vh;
}

.kanban-column {
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-panel);
  background: var(--color-kanban-column);
  padding: var(--space-2);
  min-width: var(--space-0);
}

.kanban-card-stage {
  --kanban-stage: var(--color-stage-card);
}

.kanban-warehouse {
  --kanban-stage: var(--color-stage-warehouse);
}

.kanban-supplier {
  --kanban-stage: var(--color-stage-supplier);
}

.kanban-logistics {
  --kanban-stage: var(--color-stage-logistics);
}

.kanban-economics {
  --kanban-stage: var(--color-stage-economics);
}

.kanban-documents {
  --kanban-stage: var(--color-stage-documents);
}

.kanban-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: 36px;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-control);
  background: var(--kanban-stage);
  color: var(--color-stage-ink);
  padding: var(--space-2);
}

.kanban-head .badge {
  background: var(--color-stage-counter);
  color: var(--color-stage-ink);
  border: var(--border-width) solid var(--color-stage-counter-border);
}

.kanban-list {
  display: grid;
  gap: var(--space-2);
}

.kanban-card {
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-panel);
  padding: var(--space-2);
  cursor: pointer;
}

.kanban-card:hover {
  border-color: var(--color-accent);
}

.panel {
  background: var(--color-panel);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-panel);
  padding: var(--space-3);
}

.kanban-panel {
  order: 1;
}

.controls-grid {
  order: 5;
}

.onboarding-panel {
  order: 2;
}

.requests-panel {
  order: 3;
  display: none !important;
}

.detail-panel {
  order: 4;
}

.data-grid {
  order: 6;
}

.panel-head,
.actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  justify-content: space-between;
}

label {
  display: grid;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
  color: var(--color-muted);
}

.session-state {
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-pill);
  color: var(--color-muted);
  padding: var(--space-1) var(--space-3);
}

.list {
  display: grid;
  gap: var(--space-2);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(var(--control-inline-min), auto);
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.checklist {
  display: grid;
  gap: var(--space-2);
}

.item {
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-control);
  padding: var(--space-3);
}

.status-card {
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-control);
  padding: var(--space-3);
  margin-bottom: var(--space-3);
  background: var(--color-surface-subtle);
}

.status-ok {
  border-color: var(--color-accent);
}

.status-warning {
  border-color: var(--color-warning);
}

.check-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: var(--space-3);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-control);
  padding: var(--space-3);
}

.check-item-done {
  border-color: var(--color-accent);
  background: var(--color-surface-subtle);
}

.item-active {
  border-color: var(--color-accent);
  background: var(--color-surface-subtle);
}

.item-row,
.detail-head,
.line-card,
.inline-form {
  display: grid;
  gap: var(--space-3);
  align-items: center;
}

.item-row,
.detail-head,
.line-card {
  grid-template-columns: minmax(0, 1fr) auto;
}

.inline-form {
  grid-template-columns: minmax(0, 1fr) minmax(var(--control-inline-min), auto) auto;
  margin-top: var(--space-3);
}

.line {
  margin-top: var(--space-2);
  color: var(--color-muted);
}

.line-select {
  display: inline-flex;
  gap: var(--space-2);
  align-items: center;
  margin-top: var(--space-2);
  color: var(--color-muted);
}

.detail-empty {
  color: var(--color-muted);
  border: var(--border-width) dashed var(--color-border);
  border-radius: var(--radius-control);
  padding: var(--space-4);
}

.detail {
  display: grid;
  gap: var(--space-3);
}

.lines-table {
  display: grid;
  gap: 0;
}

.request-requirements {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.request-requirements-head,
.requirement-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(100px, 160px) minmax(70px, 110px) minmax(70px, 90px);
  align-items: center;
}

.request-requirements-head {
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.request-requirements-head > *,
.requirement-row > * {
  min-width: 0;
  padding: 8px 10px;
  border-right: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.request-requirements-head > *:last-child,
.requirement-row > *:last-child {
  border-right: 0;
}

.requirement-row {
  min-height: 38px;
  background: var(--panel);
}

.requirement-row + .requirement-row {
  border-top: 1px solid var(--border);
}

.requirement-row > * {
  font-size: 13px;
  line-height: 1.3;
  font-weight: 400;
}

.requirement-row span {
  color: var(--muted);
}

.requirement-row .requirement-name {
  color: var(--text);
}

.line-card {
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-control);
  padding: var(--space-3);
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-panel);
  padding: var(--space-1) var(--space-2);
  white-space: nowrap;
}

.badge-muted {
  background: var(--color-surface-subtle);
  color: var(--color-muted);
  border: var(--border-width) solid var(--color-border);
}

.badge-overdue {
  background: var(--color-danger);
}

.badge-soon {
  background: var(--color-warning);
}

.badge-none,
.badge-ok {
  background: var(--color-surface-subtle);
  color: var(--color-muted);
  border: var(--border-width) solid var(--color-border);
}

h3 {
  margin: var(--space-2) var(--space-0) var(--space-0);
  font-size: var(--font-size-subsection);
  letter-spacing: var(--space-0);
}

pre {
  min-height: var(--pre-min-height);
  max-height: var(--pre-max-height);
  overflow: auto;
  margin: var(--space-0);
  color: var(--color-muted);
  font-family: var(--font-mono);
  font-size: var(--font-size-code);
  white-space: pre-wrap;
}

@media (max-width: 760px) {
.request-requirements {
    overflow-x: auto;
  }

  .request-requirements-head,
  .requirement-row {
    min-width: 700px;
  }

  .app-shell {
    grid-template-columns: var(--grid-single-column);
  }

  .app-sidebar {
    position: static;
    height: auto;
    border-right: var(--space-0);
    border-bottom: var(--border-width) solid var(--color-border);
  }

  .sidebar-nav,
  .topbar-actions {
    display: flex;
    flex-wrap: wrap;
  }

  .grid,
  .landing-hero,
  .landing-strip,
  .kanban,
  .mail-page.page-active,
  .mail-settings-form,
  .toolbar,
  .topbar,
  .admin-topbar,
  .admin-account-row,
  .landing-nav,
    .item-row,
    .detail-head,
    .line-card,
    .check-item,
    .inline-form {
    grid-template-columns: var(--grid-single-column);
    display: grid;
  }

  .landing-nav-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: var(--full-width);
  }

  .landing-nav-actions select {
    width: var(--full-width);
  }

  .device-composition {
    width: var(--full-width);
  }

  .laptop-device {
    width: var(--full-width);
    transform: none;
  }

  .phone-device {
    width: var(--landing-phone-mobile-width);
    top: var(--landing-phone-mobile-top);
  }

  .laptop-preview {
    padding: var(--space-2);
  }

  .preview-layout {
    grid-template-columns: var(--grid-single-column);
  }

  .preview-sidebar {
    display: none;
  }
}

/* Office One app redesign. Landing selectors above stay isolated. */
.app-shell {
  --color-bg: var(--bg);
  --color-panel: var(--surface);
  --color-text: var(--text-primary);
  --color-muted: var(--text-secondary);
  --color-border: var(--border);
  --color-accent: var(--primary);
  --color-accent-strong: var(--primary-hover);
  --color-surface-subtle: var(--surface-subtle);
  --app-sidebar-width: 232px;
  --mail-folders-width: 232px;
  --mail-sender-width: 240px;
  --mail-subject-width: 170px;
  --mail-snippet-width: 360px;
  --mail-meta-width: 108px;
  --mail-date-width: 110px;
  grid-template-columns: var(--app-sidebar-width) minmax(0, 1fr);
  background: var(--bg);
  color: var(--text-primary);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 20px;
}

.app-shell.app-sidebar-collapsed {
  --app-sidebar-width: 72px;
}

.app-shell button,
.app-shell input,
.app-shell select,
.app-shell textarea {
  min-height: 36px;
  border-radius: var(--radius-btn);
  font-size: 14px;
  line-height: 20px;
}

.app-shell button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  background: var(--primary-gradient);
  color: var(--surface);
  font-weight: 600;
  padding: 0 16px;
  transition: background 150ms ease, box-shadow 150ms ease, transform 150ms ease, filter 150ms ease;
}

.app-shell button:hover {
  filter: brightness(0.95);
  background: var(--primary-gradient);
}

.app-shell input,
.app-shell select,
.app-shell textarea,
.mail-editor {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  padding: 0 12px;
}

.app-shell textarea,
.mail-editor {
  padding-block: 10px;
}

.app-shell input::placeholder,
.app-shell textarea::placeholder {
  color: var(--text-tertiary);
}

.app-shell button:focus-visible,
.app-shell input:focus-visible,
.app-shell select:focus-visible,
.app-shell textarea:focus-visible,
.mail-editor:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-focus-rgb), 0.12);
}

.app-sidebar {
  width: var(--app-sidebar-width);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 20px 14px;
  transition: width 160ms ease, padding 160ms ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 6px 22px;
  color: var(--text-primary);
  font-size: 18px;
  line-height: 24px;
  font-weight: 700;
}

.sidebar-toggle,
.mail-folders-toggle {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  border: 0 !important;
  border-radius: var(--radius-btn);
  background: transparent !important;
  color: var(--text-secondary) !important;
  padding: 0 !important;
}

.sidebar-toggle:hover,
.mail-folders-toggle:hover {
  background: var(--surface-subtle) !important;
  color: var(--text-primary) !important;
}

.sidebar-nav {
  gap: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  border-radius: var(--radius-btn);
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0 12px;
}

.app-sidebar-collapsed .sidebar-brand {
  justify-content: center;
  margin-inline: 0;
  gap: 0;
}

.app-sidebar-collapsed .sidebar-brand > span,
.app-sidebar-collapsed .sidebar-link:not([data-icon]),
.app-sidebar-collapsed .sidebar-link {
  overflow: hidden;
}

.request-requirements-title {
  padding: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.requirement-row.is-collapsed {
  display: none;
}

.app-shell .request-lines-toggle {
  width: auto;
  min-height: 32px;
  margin-top: 8px;
  padding: 0 12px;
  border: 1px solid #cbd8ea;
  border-radius: 8px;
  background: #eaf0f8;
  color: #41658f;
  box-shadow: none;
  font-weight: 600;
}

.app-shell .request-lines-toggle:hover {
  background: #dfe9f6;
  filter: none;
}

.app-sidebar-collapsed .sidebar-brand > span,
.app-sidebar-collapsed .sidebar-link {
  font-size: 0;
}

.app-sidebar-collapsed .sidebar-brand > span {
  display: none;
}

.app-sidebar-collapsed .sidebar-link {
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
  gap: 0;
  padding: 0;
  margin-inline: auto;
}

.app-sidebar-collapsed .sidebar-toggle {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  margin-inline: auto;
  transform: translateX(0.5px);
}

.app-sidebar-collapsed .sidebar-nav {
  align-items: center;
}

.app-sidebar-collapsed .sidebar-account {
  grid-template-columns: 32px;
  justify-content: center;
  padding-inline: 0;
}

.app-sidebar-collapsed .sidebar-account > div {
  display: none;
}

.sidebar-link:hover,
.sidebar-link-active {
  background: var(--surface-subtle);
  color: var(--text-primary);
  font-weight: 600;
}

.sidebar-link:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(var(--primary-focus-rgb), 0.12);
}

[data-icon] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: currentColor;
}

[data-icon] svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.sidebar-account {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: auto;
  padding: 12px 6px 0;
}

.account-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--surface-subtle);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
}

.sidebar-account strong,
.sidebar-account span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-account strong {
  font-size: 13px;
  font-weight: 600;
}

.sidebar-account span {
  color: var(--text-secondary);
  font-size: 13px;
}

.app-workspace {
  gap: 16px;
  padding: 0 24px 24px;
}

.topbar {
  min-height: 56px;
  margin-inline: -24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 8px 24px;
}

.topbar h1 {
  font-size: 22px;
  line-height: 28px;
  font-weight: 700;
}

.topbar p {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 18px;
  margin-top: 0;
}

.topbar-actions {
  gap: 8px;
}

.llm-switcher {
  gap: 8px;
}

.llm-switcher select {
  width: 168px;
}

.icon-button,
.app-shell .icon-button {
  width: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
}

.icon-button:hover,
.app-shell .icon-button:hover {
  background: var(--surface-subtle);
  color: var(--text-primary);
  filter: none;
}

.app-shell #exportBtn,
.app-shell .mail-settings-form button,
.app-shell .inline-form button,
.app-shell .item-row button,
.app-shell .line-card button,
.app-shell .actions button,
.app-shell .mail-compose-actions button:first-child,
.app-shell .mail-folder {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  font-weight: 500;
}

.app-shell #exportBtn:hover,
.app-shell .mail-settings-form button:hover,
.app-shell .inline-form button:hover,
.app-shell .item-row button:hover,
.app-shell .line-card button:hover,
.app-shell .actions button:hover,
.app-shell .mail-compose-actions button:first-child:hover,
.app-shell .mail-folder:hover {
  background: var(--surface-subtle);
  filter: none;
}

.app-shell #quickCreateBtn,
.app-shell .mail-compose-button {
  background: var(--primary-gradient);
  color: var(--surface);
  border: 0;
}

.app-shell #proposalBtn {
  background: var(--ai-gradient);
  color: var(--surface);
  border: 0;
}

.app-shell #matchBtn {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.clock {
  min-width: auto;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0;
}

.panel,
.mail-head,
.mail-folders,
.kanban-column,
.admin-topbar,
.admin-panel {
  border: 0;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  padding: 18px;
}

.panel-head,
.actions {
  gap: 8px;
}

.kanban-panel .panel-head {
  display: grid;
  grid-template-columns: auto auto minmax(220px, 1fr);
  align-items: center;
  column-gap: 14px;
  row-gap: 10px;
  margin-bottom: 16px;
}

.kanban-panel .panel-head h2 {
  margin-bottom: 0;
}

.kanban-search {
  display: block;
  width: 100%;
  margin: 0;
}

.kanban-search input {
  width: 100%;
}

.kanban-panel .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-start;
}

.kanban-panel .actions button {
  margin: 0;
}

.app-shell #quickCreateBtn {
  min-width: 132px;
}

.app-shell #manualCreateBtn {
  min-width: 220px;
}

h2 {
  color: var(--text-primary);
  font-size: 16px;
  line-height: 22px;
  font-weight: 600;
  margin-bottom: 12px;
}

h3 {
  color: var(--text-primary);
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  margin: 16px 0 8px;
}

label {
  gap: 6px;
  margin-bottom: 12px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 18px;
}

.grid {
  gap: 16px;
}

.kanban {
  display: flex;
  align-items: stretch;
  gap: 12px;
  min-height: 60vh;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  padding-bottom: 8px;
  scrollbar-gutter: stable;
}

.kanban-column {
  flex: 0 0 280px;
  min-width: 280px;
  background: var(--stage-column-bg, var(--surface-subtle));
  border-color: color-mix(in srgb, var(--stage-fg, var(--border)) 32%, var(--border));
  box-shadow: none;
  padding: 8px;
}

.kanban-column[data-custom-color="true"] {
  --stage-bg: color-mix(in srgb, var(--stage-custom) 18%, white);
  --stage-column-bg: color-mix(in srgb, var(--stage-custom) 10%, white);
  --stage-fg: color-mix(in srgb, var(--stage-custom) 78%, black);
}

.app-shell .kanban-head,
.kanban-head {
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--stage-fg, var(--border)) 24%, var(--border));
  min-height: 32px;
  margin-bottom: 8px;
  background: var(--stage-bg, var(--surface-subtle));
  color: var(--stage-fg, var(--text-primary));
  padding: 8px;
  cursor: pointer;
  justify-content: space-between;
  filter: none;
}

.kanban-head-toggle {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 30px;
  flex: 1 1 auto;
  border: 0 !important;
  background: transparent !important;
  color: inherit !important;
  padding: 0 !important;
  text-align: left;
}

.kanban-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.kanban-color-control {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin: 0;
  color: var(--stage-fg, var(--text-secondary));
  cursor: pointer;
}

.kanban-color-control svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kanban-color-control input {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 0;
  opacity: 0;
  cursor: pointer;
}

.app-shell .kanban-head:hover,
.kanban-head:hover {
  background: var(--stage-bg, var(--surface-subtle));
  filter: none;
}

.kanban-head strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
}

.kanban-stage-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  color: var(--stage-fg, var(--blue-fg));
}

.kanban-stage-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kanban-card-stage {
  --stage-bg: #fef3c7;
  --stage-column-bg: #fff7d6;
  --stage-fg: #854d0e;
}

.kanban-warehouse {
  --stage-bg: #dbeafe;
  --stage-column-bg: #eaf3ff;
  --stage-fg: #1d4ed8;
}

.kanban-supplier {
  --stage-bg: #fce7f3;
  --stage-column-bg: #fff0f7;
  --stage-fg: #be185d;
}

.kanban-logistics {
  --stage-bg: #ccfbf1;
  --stage-column-bg: #e2faf5;
  --stage-fg: #0f766e;
}

.kanban-economics {
  --stage-bg: #ffedd5;
  --stage-column-bg: #fff5e8;
  --stage-fg: #c2410c;
}

.kanban-documents {
  --stage-bg: #dcfce7;
  --stage-column-bg: #eefbea;
  --stage-fg: #15803d;
}

.kanban-head .badge {
  min-width: 24px;
  justify-content: center;
  background: rgba(255, 255, 255, 0.68);
  color: var(--stage-fg, var(--text-secondary));
}

.mail-folder > span[id$="Count"] {
  min-width: 0;
  justify-content: center;
  background: transparent;
  color: var(--text-secondary);
}

.kanban-card {
  border: 0;
  border-radius: var(--radius-inner);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  padding: 12px;
  transition: box-shadow 150ms ease, transform 150ms ease;
  min-width: 0;
  overflow: hidden;
}

.kanban-card:hover,
.kanban-card:focus-visible {
  outline: 0;
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.kanban-card strong,
.item strong,
.line-card strong {
  color: var(--text-primary);
  font-weight: 600;
}

.kanban-card.item-active {
  background: var(--surface);
}

.kanban-card > strong {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  line-height: 19px;
  overflow-wrap: anywhere;
}

.kanban-card-deadline {
  display: block;
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
}

.kanban-column-collapsed {
  flex-basis: 52px;
  min-width: 52px;
  padding: 6px;
}

.kanban-column-collapsed .kanban-head {
  min-height: 78px;
  margin-bottom: 0;
  flex-direction: column;
  justify-content: center;
  padding: 8px 4px;
}

.kanban-column-collapsed .kanban-head-toggle {
  flex: 0 0 auto;
}

.kanban-column-collapsed .kanban-head-actions {
  flex-direction: column;
  gap: 4px;
}

.kanban-column-collapsed .kanban-head strong {
  justify-content: center;
}

.kanban-column-collapsed .kanban-stage-label,
.kanban-column-collapsed .kanban-list {
  display: none;
}

.kanban-column-collapsed .kanban-head .badge {
  min-width: 24px;
}

.kanban-list {
  gap: 8px;
}

.kanban-list p,
.list p,
.detail-empty {
  color: var(--text-tertiary);
  font-size: 13px;
}

.tender-admin-panel {
  display: none;
}

.tender-monitor-panel {
  display: none !important;
}

[data-page].tender-admin-panel.page-active {
  display: none;
}

.tender-chat-panel {
  grid-column: 1 / -1;
  width: min(1180px, 100%);
  min-height: calc(100vh - 154px);
  height: calc(100vh - 154px);
  display: none;
  grid-template-rows: minmax(260px, 1fr) auto;
  gap: 12px;
}

[data-page].tender-chat-panel.page-active {
  display: grid;
}

.tender-chat-messages {
  min-height: 260px;
  display: grid;
  align-content: end;
  gap: 10px;
  overflow: auto;
  padding-right: 2px;
}

.tender-chat-message {
  display: flex;
}

.tender-chat-message.operator {
  justify-content: flex-end;
}

.tender-chat-bubble {
  max-width: min(1080px, 94%);
  border-radius: var(--radius-card);
  background: var(--surface-subtle);
  color: var(--text-primary);
  padding: 12px;
}

.tender-chat-bubble time {
  display: block;
  margin-top: 8px;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 16px;
  text-align: right;
}

.tender-chat-message.operator .tender-chat-bubble time {
  color: rgba(255, 255, 255, 0.72);
}

.tender-chat-message.operator .tender-chat-bubble {
  background: var(--primary-gradient);
  color: var(--surface);
}

.tender-chat-tenders {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.tender-chat-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-radius: var(--radius-inner);
  background: var(--surface);
  padding: 12px;
  box-shadow: var(--shadow-card);
}

.tender-chat-card button,
.tender-chat-composer button {
  min-height: 40px;
}

.tender-chat-detail {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  border-radius: var(--radius-inner);
  background: var(--surface);
  padding: 12px;
  box-shadow: var(--shadow-card);
}

.tender-chat-tenderplan {
  border-radius: var(--radius-inner);
  background: var(--surface-subtle);
  padding: 10px;
}

.tender-chat-tenderplan summary {
  cursor: pointer;
  font-weight: 700;
}

.tender-chat-tenderplan dl {
  margin-top: 10px;
}

.tender-chat-detail dl {
  display: grid;
  grid-template-columns: minmax(100px, auto) minmax(0, 1fr);
  gap: 6px 10px;
  margin: 0;
}

.tender-chat-detail dt {
  color: var(--text-tertiary);
}

.tender-chat-detail dd {
  min-width: 0;
  margin: 0;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.tender-chat-links,
.tender-chat-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tender-chat-positions,
.tender-chat-documents {
  min-width: 0;
}

.tender-chat-positions summary,
.tender-chat-documents summary {
  cursor: pointer;
  font-weight: 700;
  margin-bottom: 8px;
}

.tender-chat-positions summary span,
.tender-chat-documents summary span {
  margin-left: 4px;
  color: var(--text-tertiary);
  font-weight: 600;
}

.tender-chat-position-table {
  min-width: 560px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-inner);
  overflow: hidden;
}

.tender-chat-positions[open] {
  overflow-x: auto;
}

.tender-chat-position-head,
.tender-chat-position-row {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 110px 72px 60px;
}

.tender-chat-position-head {
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-weight: 700;
}

.tender-chat-position-head span,
.tender-chat-position-row span {
  min-width: 0;
  padding: 7px 8px;
  border-right: 1px solid var(--border-subtle);
  overflow-wrap: anywhere;
}

.tender-chat-position-head span:last-child,
.tender-chat-position-row span:last-child {
  border-right: 0;
}

.tender-chat-position-row + .tender-chat-position-row {
  border-top: 1px solid var(--border-subtle);
}

.tender-chat-links a,
.tender-chat-attachments a,
.tender-chat-attachments span {
  border-radius: var(--radius-pill);
  background: var(--surface-subtle);
  color: var(--text-primary);
  padding: 6px 10px;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.tender-chat-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin: 0;
  position: sticky;
  bottom: 0;
  padding-top: 8px;
  background: var(--color-panel);
}

.item,
.line-card,
.check-item {
  border: 0;
  border-radius: var(--radius-inner);
  background: transparent;
  padding: 12px;
}

.list > .item,
.list > .line-card,
.list > .check-item {
  border-radius: 0;
  border-bottom: 1px solid var(--border);
  padding-inline: 0;
}

.list > .item:last-child,
.list > .line-card:last-child,
.list > .check-item:last-child {
  border-bottom: 0;
}

.item:hover,
.line-card:hover,
.check-item:hover {
  background: var(--surface-subtle);
}

.item-active,
.check-item-done {
  background: var(--primary-soft);
}

.detail-empty {
  display: grid;
  place-items: center;
  min-height: 120px;
  border: 0;
  border-radius: var(--radius-inner);
  background: var(--surface-subtle);
  padding: 18px;
}

.line {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 18px;
}

.badge {
  min-height: 22px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--blue-bg);
  color: var(--blue-fg);
  padding: 2px 10px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
}

.badge-muted,
.badge-none,
.badge-ok {
  background: var(--gray-bg);
  color: var(--gray-fg);
}

.badge-overdue {
  background: var(--red-bg);
  color: var(--red-fg);
}

.badge-soon {
  background: var(--amber-bg);
  color: var(--amber-fg);
}

.badge-success,
.check-item-done .badge {
  background: var(--green-bg);
  color: var(--green-fg);
}

.mail-page.page-active {
  grid-template-columns: var(--mail-folders-width) minmax(0, 1fr);
  gap: 16px;
}

.mail-page.mail-folders-collapsed {
  --mail-folders-width: 72px;
}

.mail-folders {
  top: 72px;
  gap: 4px;
  transition: width 160ms ease;
}

.mail-compose-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.mail-compose-button {
  width: 100%;
  min-width: 0;
  margin-bottom: 0;
  padding-inline: 12px;
}

.mail-folder {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  justify-content: start;
  gap: 10px;
  min-height: 38px;
  border: 0;
  border-radius: var(--radius-btn);
  color: var(--text-secondary);
  padding: 0 10px;
  text-align: left;
}

.mail-folders-toggle {
  justify-self: end;
}

.mail-folders-collapsed .mail-folders {
  align-items: center;
}

.mail-folders-collapsed .mail-compose-row {
  grid-template-columns: 44px;
  justify-content: center;
  justify-items: center;
}

.mail-folders-collapsed .mail-folders-toggle {
  justify-self: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
}

.mail-folders-collapsed .mail-compose-button,
.mail-folders-collapsed .mail-folder {
  width: 44px;
  min-width: 44px;
  justify-content: center;
  justify-items: center;
  padding: 0;
  overflow: hidden;
  font-size: 0;
}

.mail-folders-collapsed .mail-compose-button::before {
  content: "+";
  font-size: 22px;
  line-height: 1;
}

.mail-folders-collapsed .mail-folder {
  grid-template-columns: 18px;
}

.mail-folders-collapsed .mail-folder span:not([data-icon]) {
  display: none;
}

.app-shell .mail-folder {
  border: 0;
}

.app-shell .mail-folder-active {
  background: var(--surface-subtle);
  color: var(--text-primary);
  font-weight: 600;
}

.mail-head {
  align-items: center;
  padding: 16px 18px;
}

.mail-head h2 {
  margin-bottom: 0;
}

.mail-head p {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 18px;
}

.mail-view.panel {
  overflow: auto;
  padding: 0;
}

.mail-view .list > .mail-empty {
  margin: 0;
  padding: 14px 18px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 18px;
}

.mail-compose-form.mail-view.panel {
  padding: 16px;
}

.mail-compose-form.mail-view-active {
  display: grid;
  gap: 14px;
}

.mail-compose-form label,
.mail-editor-field {
  display: grid;
  gap: 6px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  line-height: 18px;
}

.mail-compose-form input {
  font-weight: 500;
}

.mail-compose-actions {
  margin-top: 0;
}

#mailSettingsPanel.mail-view.panel {
  padding: 16px;
}

.mail-settings-status {
  justify-content: flex-start;
  margin-bottom: 10px;
}

.mail-settings-form {
  gap: 18px 14px;
}

.mail-settings-form label,
.mail-settings-form .check-line {
  display: grid;
  gap: 6px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  line-height: 18px;
}

.mail-settings-form .check-line {
  display: flex;
  align-items: center;
  min-height: 40px;
  color: var(--text-primary);
}

.mail-settings-form .check-line input {
  flex: 0 0 auto;
}

.mail-settings-form button[type="submit"] {
  justify-self: start;
  align-self: end;
}

.mail-view.panel > h2 {
  display: none;
}

.mail-reading-active .mail-view-active {
  display: none;
}

.mail-view .list {
  gap: 0;
}

.app-shell .mail-folder {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  justify-content: stretch;
  justify-items: start;
  text-align: left;
}

.mail-folder [data-icon] {
  align-self: center;
}

.mail-folder span:not([data-icon]) {
  justify-self: end;
}

.app-shell .mail-folder > span[id^="mail"][id$="Count"] {
  min-width: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.mail-row {
  display: grid;
  grid-template-columns:
    28px
    40px
    minmax(120px, var(--mail-sender-width))
    6px
    minmax(80px, var(--mail-subject-width))
    6px
    minmax(120px, var(--mail-snippet-width))
    6px
    minmax(72px, var(--mail-meta-width))
    6px
    minmax(86px, var(--mail-date-width))
    6px;
  gap: 8px;
  align-items: center;
  min-height: 48px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 5px 14px;
  transition: background 150ms ease;
  cursor: pointer;
}

.mail-row:last-child {
  border-bottom: 0;
}

.mail-row:hover {
  background: var(--surface-subtle);
}

.mail-row:focus-visible {
  outline: 3px solid rgba(var(--tenant-brand-focus-rgb), 0.24);
  outline-offset: -3px;
}

.mail-row-selected {
  background: var(--primary-soft);
}

.mail-row-check {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.mail-row-check input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  border-radius: 6px;
  padding: 0;
}

.mail-avatar {
  display: inline-flex;
  position: relative;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  background: var(--gray-bg);
  color: var(--gray-fg);
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
}

.mail-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}

.mail-avatar-loaded img {
  opacity: 1;
}

.mail-avatar-loaded .mail-avatar-initials {
  opacity: 0;
}

.mail-sender,
.mail-subject,
.mail-snippet,
.mail-meta,
.mail-date {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-sender {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 400;
}

.mail-state-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-pill);
  background: transparent;
}

.mail-state-unread {
  background: var(--primary);
}

.mail-subject-cell {
  display: flex;
  min-width: 0;
  gap: 8px;
  align-items: baseline;
}

.mail-subject {
  min-width: 0;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 400;
}

.mail-snippet {
  color: var(--text-secondary);
  font-size: 13px;
}

.mail-snippet:not(:empty)::before {
  content: "";
}

.mail-meta,
.mail-date {
  color: var(--text-secondary);
  font-size: 13px;
  justify-self: end;
}

.mail-date {
  font-weight: 400;
}

.mail-column-resize {
  align-self: stretch;
  width: 6px;
  border-radius: var(--radius-pill);
  cursor: col-resize;
  touch-action: none;
}

.mail-column-resize:hover,
.mail-column-resize:focus-visible {
  background: var(--border);
}

.mail-row.mail-unread {
  background: #eef1f4;
  box-shadow: none;
}

.mail-row.mail-unread:hover {
  background: #e5e9ee;
}

.mail-row.mail-unread .mail-avatar {
  background: var(--blue-bg);
  color: var(--blue-fg);
}

.mail-row.mail-unread .mail-sender,
.mail-row.mail-unread .mail-subject,
.mail-row.mail-unread .mail-date {
  font-weight: 700;
}

.mail-row:not(.mail-unread) .mail-sender,
.mail-row:not(.mail-unread) .mail-subject,
.mail-row:not(.mail-unread) .mail-date {
  font-weight: 400;
}

.mail-row.mail-unread .mail-snippet,
.mail-row.mail-unread .mail-meta {
  color: #475569;
}

.app-shell .mail-row-action {
  grid-column: 9 / 13;
  grid-row: 1;
  justify-self: end;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
}

.mail-message-panel {
  padding: 0;
  overflow: hidden;
}

.mail-message-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
}

.mail-message-actions {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 8px;
  min-width: 0;
}

.mail-message-toolbar button {
  min-height: 32px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  padding: 0 12px;
}

.mail-message-opened {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.mail-message-opened-head {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.mail-message-opened-head h2 {
  margin: 0 0 6px;
  font-size: 20px;
  line-height: 28px;
}

.mail-message-opened-date,
.mail-message-opened-meta {
  color: var(--text-secondary);
  font-size: 13px;
}

.mail-message-opened-date {
  justify-self: end;
  white-space: nowrap;
}

.mail-message-opened-meta {
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.mail-message-opened-body {
  min-height: 260px;
  max-height: calc(100vh - 360px);
  max-width: 100%;
  overflow: auto;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.mail-message-opened-body a {
  color: var(--primary);
  text-decoration: underline;
  overflow-wrap: anywhere;
}

.mail-message-opened-body-html {
  padding: 0;
  white-space: normal;
}

.mail-message-frame {
  display: block;
  width: 100%;
  height: min(680px, calc(100vh - 390px));
  min-height: 360px;
  border: 0;
  background: var(--surface);
}

.mail-message-content-notice {
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 18px;
  padding: 8px 10px;
}

.mail-message-attachments {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.mail-message-attachments h3 {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 22px;
}

.mail-attachments-list {
  display: grid;
  gap: 8px;
}

.mail-attachment {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-inner);
  background: var(--surface-subtle);
  padding: 10px 12px;
}

.mail-attachment button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.mail-editor-toolbar {
  border: 0;
  border-radius: var(--radius-inner) var(--radius-inner) 0 0;
  background: var(--surface-subtle);
  padding: 8px 10px;
}

.mail-editor-toolbar button {
  width: 32px;
  min-height: 32px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  padding: 0;
}

.mail-editor-toolbar button:hover {
  background: var(--surface);
  color: var(--text-primary);
  filter: none;
}

.mail-editor {
  min-height: 180px;
  border-radius: 0 0 var(--radius-inner) var(--radius-inner);
  font-weight: 500;
  line-height: 1.55;
}

.mail-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--text-tertiary);
}

.mail-delivery-status {
  margin-bottom: 18px;
  background: var(--surface-subtle);
  color: var(--text-secondary);
  padding: 10px 12px;
}

.mail-delivery-status strong {
  color: var(--text-primary);
}

.status-card {
  border: 0;
  border-radius: var(--radius-inner);
  background: var(--surface-subtle);
  padding: 12px;
}

.status-ok {
  background: var(--green-bg);
  color: var(--green-fg);
}

.status-warning {
  background: var(--amber-bg);
  color: var(--amber-fg);
}

.controls-grid,
.data-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

pre {
  border-radius: var(--radius-inner);
  background: var(--surface-subtle);
  color: var(--text-secondary);
  padding: 12px;
}

.line-select {
  display: flex;
  margin-top: 8px;
  font-size: 13px;
}

.line-select input,
.check-line input {
  min-height: auto;
}

.mailbox-accounts {
  display: grid;
  gap: 6px;
  padding: 8px 0;
}

.mailbox-account {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  text-align: left;
}

.mailbox-account-active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.mailbox-primary {
  color: var(--muted);
  font-size: 12px;
}

.request-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.request-chat {
  min-width: 0;
}

.deal-history {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.deal-history-event {
  max-width: min(720px, 92%);
  padding: 10px 12px;
  border-radius: var(--radius-inner);
  background: var(--color-surface-subtle);
  color: var(--text);
}

.deal-history-event.operator {
  justify-self: end;
  background: var(--primary-gradient);
  color: var(--color-panel);
}

.deal-history-event.participant {
  background: var(--green-bg);
}

.deal-history-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.deal-history-event.operator .deal-history-meta,
.deal-history-event.operator .line {
  color: rgba(255, 255, 255, .78);
}

.request-tender-summary {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  gap: 6px 14px;
  max-width: 820px;
  margin: 14px 0 0;
  padding: 14px;
  border-radius: var(--radius-inner);
  background: var(--color-surface-subtle);
}

.request-tender-summary dt {
  color: var(--muted);
  font-weight: 600;
}

.request-tender-summary dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.request-tender-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.request-tender-links a {
  color: var(--color-accent-strong);
  font-weight: 600;
  text-decoration: none;
}

.request-tender-links a:hover {
  text-decoration: underline;
}

.request-tenderplan-data {
  max-width: 820px;
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius-inner);
  background: var(--panel);
}

.request-tenderplan-data summary {
  cursor: pointer;
  font-weight: 700;
}

.request-tenderplan-data dl {
  display: grid;
  grid-template-columns: minmax(150px, 210px) minmax(0, 1fr);
  gap: 6px 14px;
  margin: 12px 0 0;
  font-size: 13px;
}

.request-tenderplan-data dt {
  color: var(--muted);
  font-weight: 600;
}

.request-tenderplan-data dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.request-documents {
  max-width: 820px;
  margin-top: 16px;
  padding: 0;
  border-radius: var(--radius-inner);
  background: transparent;
}

.request-documents-head,
.timeline-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.request-documents-head strong {
  font-size: 14px;
}

.request-documents-head span {
  color: var(--muted);
  font-size: 13px;
}

.request-document-list {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  padding: 12px;
  border-radius: var(--radius-inner);
  background: var(--panel);
  box-shadow: var(--shadow-card);
}

.request-document-list p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.app-shell .request-document-link {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  min-height: 0;
  padding: 3px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #245c95;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  text-decoration: none;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.app-shell .request-document-link:hover,
.app-shell .request-document-link:focus-visible {
  background: transparent;
  color: #174976;
  filter: none;
  text-decoration: underline;
}

.request-document-name {
  min-width: 0;
}

.document-type {
  flex: 0 0 auto;
  padding: 3px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
}

.document-type-doc {
  background: #e8f1ff;
  color: #2463ad;
}

.document-type-xls {
  background: #e8f5e9;
  color: #347a3b;
}

.document-type-ppt {
  background: #fff0e8;
  color: #bd5d29;
}

.document-type-pdf {
  background: #feeceb;
  color: #b23d35;
}

.document-type-zip {
  background: #f0eaff;
  color: #6d50a2;
}

.document-type-file {
  background: #eef1f5;
  color: #5b6471;
}

.request-document-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.app-shell .request-participate-button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #b9dec7;
  background: #dff1e6;
  color: #2c6d4e;
  box-shadow: none;
}

.app-shell .request-participate-button:hover {
  background: #d2ebdb;
  filter: none;
}

.app-shell .request-participate-button:disabled {
  cursor: default;
  opacity: 0.8;
}

.app-shell .request-documents-zip {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #dddfea;
  background: var(--panel);
  color: var(--text-primary);
  box-shadow: none;
}

.app-shell .request-documents-zip:hover {
  background: #fafaff;
  filter: none;
}

.request-document-actions .inline-form {
  display: flex;
  gap: 8px;
  margin: 0;
}

.request-document-actions .inline-form input[type="file"] {
  max-width: 210px;
}

.timeline {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.timeline-event {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--panel);
}

.timeline-event.operator,
.timeline-event.assistant,
.timeline-event.participant {
  border-color: color-mix(in srgb, var(--primary) 32%, var(--border));
}

.timeline-meta,
.timeline-note {
  color: var(--muted);
  font-size: 13px;
}

.timeline-content {
  margin-top: 8px;
  white-space: pre-wrap;
}

.timeline-note {
  margin-top: 8px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: static;
    width: auto;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-nav {
    display: flex;
    flex-wrap: wrap;
  }

  .sidebar-account {
    margin-top: 12px;
  }

  .topbar,
  .mail-page.page-active,
  .request-workbench,
  .controls-grid,
  .data-grid,
  .grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    gap: 12px;
  }

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: start;
  }
}

@media (max-width: 760px) {
  .app-workspace {
    padding-inline: 16px;
  }

  .topbar {
    margin-inline: -16px;
    padding-inline: 16px;
  }

  .kanban {
    display: grid;
    grid-template-columns: 1fr;
    min-height: auto;
    overflow-x: visible;
    gap: 12px;
  }

  .kanban-column {
    min-width: 0;
    min-height: 0;
    padding: 6px;
    border-radius: 14px;
    background: var(--stage-column-bg, var(--surface-subtle));
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    position: relative;
    overflow: hidden;
  }

  .kanban-column::before {
    content: "";
    display: block;
    height: 4px;
    margin: -6px -6px 6px;
    background: var(--stage-fg, var(--primary));
  }

  .app-shell .kanban-head,
  .kanban-head {
    min-height: 58px;
    margin-bottom: 0;
    border: 1px solid color-mix(in srgb, var(--stage-fg, var(--border)) 30%, rgba(255, 255, 255, 0.65));
    border-radius: 10px;
    background: color-mix(in srgb, var(--stage-bg, var(--surface-subtle)) 86%, white);
    color: var(--stage-fg, var(--text-primary));
    cursor: pointer;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    box-shadow: none;
  }

  .app-shell .kanban-head:hover,
  .kanban-head:hover {
    background: color-mix(in srgb, var(--stage-bg, var(--surface-subtle)) 86%, white);
  }

  .kanban-head strong {
    grid-column: 1;
    justify-content: flex-start;
    min-width: 0;
    text-align: left;
    font-size: 15px;
    line-height: 20px;
  }

  .kanban-stage-icon {
    width: 18px;
    height: 18px;
  }

  .kanban-stage-icon svg {
    width: 18px;
    height: 18px;
  }

  .kanban-head .badge {
    grid-column: 2;
    min-width: 34px;
    min-height: 34px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    justify-self: end;
  }

  .kanban-panel .panel-head {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .kanban-search {
    width: 100%;
  }

  .kanban-panel .actions {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.45fr);
    gap: 10px;
    width: 100%;
  }

  .app-shell #quickCreateBtn,
  .app-shell #manualCreateBtn {
    width: 100%;
    min-width: 0;
  }

  .kanban-list {
    display: none;
    margin-top: 8px;
  }

  .kanban-column.kanban-column-open .kanban-list {
    display: grid;
  }

  .kanban-column.kanban-column-collapsed {
    padding: 6px;
  }

  .kanban-column.kanban-column-collapsed .kanban-head {
    min-height: 58px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    justify-content: space-between;
    padding: 10px 12px;
  }

  .kanban-column.kanban-column-collapsed .kanban-stage-label {
    display: inline;
  }

  .tender-chat-panel {
    min-height: calc(100vh - 230px);
    padding: 12px;
    overflow: hidden;
  }

  .tender-chat-bubble {
    max-width: 94%;
    overflow-wrap: anywhere;
  }

  .tender-chat-messages,
  .tender-chat-card,
  .tender-chat-detail {
    min-width: 0;
  }

  .tender-chat-card,
  .tender-chat-composer {
    grid-template-columns: 1fr;
  }

  .tender-chat-composer input,
  .tender-chat-composer button {
    font-size: 16px;
  }

  .tender-chat-detail dl {
    grid-template-columns: 1fr;
  }

  .mail-settings-form,
  .inline-form,
  .item-row,
  .detail-head,
  .line-card,
  .check-item {
    grid-template-columns: 1fr;
  }

  .request-documents-rail {
    position: static;
    border-left: 0;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 12px;
  }

  .mail-row {
    grid-template-columns: 28px 36px minmax(0, 1fr) auto;
    gap: 10px;
  }

  .mail-column-resize {
    display: none;
  }

  .mail-sender,
  .mail-subject-cell,
  .mail-snippet {
    grid-column: 3 / 5;
  }

  .mail-state-dot {
    display: none;
  }

  .mail-meta {
    grid-column: 3;
    justify-self: start;
  }

  .mail-date {
    grid-column: 4;
  }

  .app-shell .mail-row-action {
    grid-column: 3 / 5;
    grid-row: auto;
  }

  .mail-message-opened-head {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .mail-message-opened-date {
    grid-column: 2;
    justify-self: start;
  }

  .mail-message-toolbar,
  .mail-message-actions {
    align-items: stretch;
    flex-wrap: wrap;
  }
}
