/* CRM - Octopus — Design System (UI/UX Craftsmanship).
   Mosa Identity: Charcoal Navy + Calm Mint + Forest Green, Crisp White Surfaces.
   Pure Flat Design: No blurry drop-shadows, no garish gradients.
   One accent (Mint #a6cdbd) marks "current / selected" only. */

:root {
  /* Surfaces & Canvas */
  --paper: #ffffff;
  --card: #f8faf9;
  --card-hover: #f1f5f3;
  --soft: #edf2f0;
  --sand: #eaf4f0;
  --bg: #f8faf9;
  --bg-subtle: #f0f4f2;

  /* Brand Palette */
  --ink: #18242a;
  --ink-light: #24343d;
  --dark-surface: #223036;
  --dark-surface-hover: #2b3c43;
  --on-dark: #c5cbd0;
  --accent: #a6cdbd;
  --accent-hover: #92bfae;
  --accent-soft: #eaf4f0;
  --green: #2a6b55;
  --green-hover: #1f5442;

  /* Typography & Muted Grays */
  --muted: #55656d;
  --muted-light: #7e8e96;
  --control: #6e7c83;

  /* Borders & Dividers */
  --line: #e2e8e5;
  --line-dark: #cbd5d0;
  --border-subtle: #e2e8e5;
  --line-focus: #2a6b55;

  /* Semantic State Colors */
  --success: #2a6b55;
  --success-bg: #eaf4f0;
  --success-border: #bfe0d3;

  --warning: #995c00;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;

  --error: #b91c1c;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --danger: #b91c1c;

  --blue: #1d5a8c;
  --blue-bg: #eff6fb;
  --blue-border: #c8e0f4;

  /* Typography Scale */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Tahoma, "Geeza Pro", Arial, sans-serif;
  --f-display: 28px;
  --f-title: 22px;
  --f-section: 17px;
  --f-body: 15px;
  --f-small: 13px;
  --f-micro: 11.5px;

  /* Radius System */
  --radius: 14px;
  --radius-inner: 10px;
  --radius-control: 8px;
  --radius-pill: 9999px;
  --gap: 16px;

  /* Animation Timers */
  --ease-fast: 0.15s ease-in-out;
}

/* ---------------------------------------------------------------- Base Reset */

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--f-body);
  line-height: 1.65;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--green);
  text-decoration: none;
  transition: color var(--ease-fast);
}
a:hover {
  color: var(--ink);
}

h1, h2, h3, h4 {
  line-height: 1.35;
  margin: 0;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: normal;
}
h1 { font-size: var(--f-display); }
h2 { font-size: var(--f-title); }
h3 { font-size: var(--f-section); }
h4 { font-size: var(--f-body); }
p { margin: 0; }

small, .small { font-size: var(--f-small); line-height: 1.5; }
.micro { font-size: var(--f-micro); line-height: 1.4; }
.muted { color: var(--muted); }
.num {
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
}
.font-bold { font-weight: 700; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- Utility Flex & Spacing */

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

.gap-xs { gap: 6px; }
.gap-sm { gap: 10px; }
.gap-md { gap: 16px; }

.p-xs { padding: 6px 10px; }
.p-sm { padding: 12px 16px; }
.p-m { padding: 20px; }

.box-subtle {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-inner);
}

/* ---------------------------------------------------------------- Header (Topbar) */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--ink);
  color: var(--paper);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  width: min(1280px, 100% - 48px);
  margin-inline: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--paper);
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
  font-size: 16px;
}
.brand:hover {
  color: var(--accent);
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--ink);
  font-size: 19px;
  font-weight: 700;
  font-family: var(--font);
  line-height: 1;
}
.brand-mark.lg {
  width: 44px;
  height: 44px;
  font-size: 24px;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--dark-surface);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  color: var(--on-dark);
  text-decoration: none;
  font-size: var(--f-small);
  white-space: nowrap;
  transition: all var(--ease-fast);
  display: inline-flex;
  align-items: center;
}
.tabs a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--paper);
}
.tabs a[aria-current="page"] {
  background: var(--accent);
  color: var(--ink);
  font-weight: 700;
}
.tabs .count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-inline-start: 6px;
  border-radius: var(--radius-pill);
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--warning-border);
}

.topbar-search {
  display: flex;
  align-items: center;
  background: var(--dark-surface);
  border-radius: var(--radius-pill);
  padding: 2px 6px 2px 14px;
  margin-inline-start: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: border-color var(--ease-fast);
}
.topbar-search:focus-within {
  border-color: var(--accent);
  background: var(--dark-surface-hover);
}
.topbar-search input {
  background: transparent;
  border: none;
  color: var(--paper);
  font-size: var(--f-small);
  padding: 6px 8px;
  width: 190px;
  outline: none;
  font-family: inherit;
}
.topbar-search input::placeholder {
  color: var(--on-dark);
  opacity: 0.8;
}
.topbar-search button {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  font-size: 14px;
  line-height: 1;
  color: var(--on-dark);
}
.topbar-search button:hover {
  color: var(--paper);
}

.account {
  position: relative;
}
.account > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 14px 4px 4px;
  padding-inline: 4px 14px;
  border-radius: var(--radius-pill);
  background: var(--dark-surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: background var(--ease-fast);
}
.account > summary:hover {
  background: var(--dark-surface-hover);
}
.account > summary::-webkit-details-marker { display: none; }
.account .who {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.account .who b {
  font-size: var(--f-small);
  color: var(--paper);
}
.account .who span {
  font-size: 11px;
  color: var(--on-dark);
}
.account .caret {
  color: var(--on-dark);
  font-size: 11px;
}

.menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  width: 320px;
  max-height: 72vh;
  overflow-y: auto;
  padding: 8px;
  border-radius: var(--radius-inner);
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  z-index: 50;
}
.menu-title {
  padding: 8px 12px 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.menu form { margin: 0; }
.menu button, .menu-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-control);
  background: none;
  font: inherit;
  font-size: var(--f-small);
  text-align: start;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--ease-fast);
}
.menu button:hover, .menu-link:hover {
  background: var(--card-hover);
  color: var(--ink);
}
.menu button[aria-current="true"] {
  background: var(--sand);
  font-weight: 700;
}
.menu .role {
  color: var(--muted);
  font-size: 11.5px;
  display: block;
  line-height: 1.3;
}
.menu hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 6px 0;
}

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--ink);
  font-size: 17px;
  line-height: 1;
}
.avatar.sm {
  width: 26px;
  height: 26px;
  font-size: 14px;
}

/* ---------------------------------------------------------------- Page Layout */

.wrap {
  width: min(1280px, 100% - 48px);
  margin-inline: auto;
}
main.wrap {
  padding-block: 28px 72px;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-head .eyebrow {
  color: var(--muted);
  font-size: var(--f-small);
  margin-bottom: 4px;
}
.page-head .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.crumb {
  font-size: var(--f-small);
  margin-bottom: 8px;
}
.crumb a {
  color: var(--muted);
  text-decoration: none;
}
.crumb a:hover {
  color: var(--ink);
}

.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.side { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.four { grid-template-columns: repeat(4, 1fr); }
.stack { display: grid; gap: var(--gap); align-content: start; }

/* ---------------------------------------------------------------- Cards & Surfaces */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color var(--ease-fast);
}
.card.white {
  background: var(--paper);
}
.card.escalation-card {
  border-inline-start: 4px solid var(--error);
  background: var(--error-bg);
  border-color: var(--error-border);
}
.card.escalation-card h2 {
  color: var(--error);
}
.card.notification-card {
  border-inline-start: 4px solid var(--accent);
  background: var(--card);
}
.card.accent-card {
  border-inline-start: 4px solid var(--accent);
}
.card.warn-card {
  border-inline-start: 4px solid var(--warning);
}
.card.kpi-card {
  padding: 16px 20px;
  border-top: 3px solid var(--ink);
  background: var(--paper);
}
.card.kpi-card.green { border-top-color: var(--green); }
.card.kpi-card.mint { border-top-color: var(--accent); }
.card.kpi-card.warn { border-top-color: var(--warning); }
.card.kpi-card.danger { border-top-color: var(--error); }
.card > h2, .card > h3, .card-head {
  margin-bottom: 16px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card-head h2, .card-head h3 {
  margin: 0;
}
.inner {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-inner);
  padding: 16px 18px;
}

/* Hero Action Banner */
.hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 22px 26px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  border: 1px solid #28373f;
}
.hero .icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: var(--radius-inner);
  background: var(--dark-surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 28px;
}
.hero .label {
  color: var(--accent);
  font-size: var(--f-small);
  font-weight: 700;
  margin-bottom: 2px;
}
.hero h2 {
  font-size: var(--f-title);
  color: var(--paper);
}
.hero p {
  color: var(--on-dark);
  font-size: var(--f-small);
}
.hero .who-line {
  color: var(--accent);
  font-size: var(--f-small);
  margin-top: 4px;
}
.hero .btn {
  background: var(--accent);
  color: var(--ink);
  font-weight: 700;
}
.hero .btn:hover {
  background: var(--paper);
  color: var(--ink);
}
.hero .btn.ghost {
  background: var(--dark-surface);
  color: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.16);
}
.hero .btn.ghost:hover {
  background: var(--dark-surface-hover);
}
.hero .acts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------- Buttons */

.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  font-size: var(--f-small);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--ease-fast);
}
.btn:hover {
  background: var(--green);
  color: var(--paper);
}
.btn:active {
  transform: translateY(1px);
}
.btn.primary {
  background: var(--ink);
  color: var(--paper);
}
.btn.primary:hover {
  background: var(--green);
}
.btn.secondary {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--line-dark);
}
.btn.secondary:hover {
  background: var(--sand);
  border-color: var(--accent);
  color: var(--ink);
}
.btn.approve {
  background: var(--green);
  color: var(--paper);
}
.btn.approve:hover {
  background: var(--green-hover);
}
.btn.danger {
  background: var(--error);
  color: var(--paper);
}
.btn.danger:hover {
  background: #991b1b;
}
.btn.small, .btn.sm {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
  border-radius: 6px;
}
.btn.xs {
  min-height: 26px;
  padding: 0 8px;
  font-size: 11.5px;
  border-radius: 6px;
}
.btn.block, .btn.full {
  width: 100%;
}
.btn[disabled], .btn[aria-disabled="true"] {
  background: var(--soft);
  color: var(--control);
  border-color: var(--line);
  cursor: not-allowed;
  transform: none;
}
.link-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--green);
  cursor: pointer;
  text-decoration: underline;
}

/* ---------------------------------------------------------------- Tags & Badges */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--soft);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.5;
  border: 1px solid transparent;
}
.tag.ok {
  background: var(--sand);
  color: var(--green);
  border-color: var(--success-border);
}
.tag.current {
  background: var(--accent);
  color: var(--ink);
  font-weight: 700;
  border-color: var(--accent-hover);
}
.tag.warn, .tag.warm {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning-border);
}
.tag.err {
  background: var(--error-bg);
  color: var(--error);
  border-color: var(--error-border);
}
.tag.blue, .tag.cold {
  background: var(--blue-bg);
  color: var(--blue);
  border-color: var(--blue-border);
}
.tag.mute {
  background: var(--paper);
  color: var(--muted);
  border-color: var(--line);
}
.tag.code {
  font-weight: 700;
  background: var(--ink);
  color: var(--paper);
}
.tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

/* ---------------------------------------------------------------- Notices & Alerts */

.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  display: grid;
  gap: 8px;
}
.notice {
  padding: 12px 18px;
  border-radius: var(--radius-inner);
  background: var(--soft);
  font-size: var(--f-body);
  border: 1px solid var(--line);
}
.notice.success {
  background: var(--sand);
  color: var(--green);
  border-color: var(--success-border);
}
.notice.error {
  background: var(--error-bg);
  color: var(--error);
  border-color: var(--error-border);
}
.notice.warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning-border);
}
.notice b {
  display: block;
  margin-bottom: 2px;
}
.need {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
}
.need li::before {
  content: "○ ";
  color: var(--warning);
  font-weight: bold;
}
.need.done li::before {
  content: "✓ ";
  color: var(--green);
  font-weight: bold;
}

/* ---------------------------------------------------------------- Forms */

.form {
  display: grid;
  gap: 4px 16px;
  grid-template-columns: 1fr 1fr;
}
.form.one {
  grid-template-columns: 1fr;
}
.form .full, .form fieldset, .form .form-actions, .form .notice {
  grid-column: 1 / -1;
}
.form fieldset {
  border: 0;
  padding: 0;
  margin: 8px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
}
.form legend {
  font-weight: 700;
  font-size: var(--f-section);
  margin-bottom: 8px;
  padding: 0;
}
.form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 10px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
  min-width: 0;
}
.field label, .field .label {
  font-size: var(--f-small);
  font-weight: 700;
  color: var(--ink);
}
.field input:not([type=checkbox]):not([type=radio]):not([type=file]),
.field select,
.field textarea,
.input {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-control);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: var(--f-small);
  transition: border-color var(--ease-fast);
}
.input.sm, .field select.sm, .field input.sm {
  min-height: 34px;
  padding: 4px 8px;
  font-size: 12.5px;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
  border-color: var(--green);
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.field textarea {
  min-height: 80px;
  resize: vertical;
}
.field input[dir="ltr"] {
  text-align: right;
}
.field input[type=file] {
  font: inherit;
  font-size: var(--f-small);
}
.field.check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}
.field.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}
.field.check label {
  font-weight: 400;
  font-size: var(--f-body);
}
.field.has-error input, .field.has-error select, .field.has-error textarea {
  border-color: var(--error);
  background: var(--error-bg);
}
.field .error {
  color: var(--error);
  font-size: var(--f-micro);
  font-weight: 600;
}
.field .help {
  color: var(--muted);
  font-size: var(--f-micro);
}
fieldset[disabled] .field input, fieldset[disabled] .field select, fieldset[disabled] .field textarea {
  background: var(--card);
  border-color: var(--line);
}
.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
}

details.more > summary {
  cursor: pointer;
  color: var(--green);
  font-size: var(--f-small);
  list-style: none;
  padding: 8px 0;
  font-weight: 600;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "＋ "; }
details.more[open] > summary::before { content: "－ "; }

/* Quick Selectable Chips */
.req { color: var(--green); font-weight: 700; }
.field.ok > label .req, .field.ok > .label .req { color: var(--control); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; display: inline-flex; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--paper);
  border: 1px solid var(--line-dark);
  font-size: var(--f-small);
  line-height: 1.4;
  transition: all var(--ease-fast);
}
.chip b { font-weight: 400; }
.chip:hover > span { border-color: var(--green); }
.chip input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
}
.chip input:checked + span b { font-weight: 700; }
.chip input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 2px; }

.chips.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chips.cards .chip > span {
  border-radius: var(--radius-inner);
  padding: 12px 16px;
  width: 100%;
}
.chips.cards .chip b { font-size: var(--f-body); }
.chips.cards small { color: var(--muted); font-size: 11.5px; }

.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--ease-fast);
}
.pill:hover {
  background: var(--sand);
  border-color: var(--accent);
}
.pill.on {
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
}
.count {
  display: inline-grid;
  place-items: center;
  min-width: 48px;
  padding: 0 8px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--warning-border);
}
.count.complete {
  background: var(--sand);
  color: var(--green);
  border-color: var(--success-border);
}
.draft-note { font-size: 12px; color: var(--muted); }

/* ---------------------------------------------------------------- Stage Rails */

.chapters {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.chapters span {
  flex: var(--w) 1 0;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  padding-inline-start: 2px;
}
.chapters span.here {
  color: var(--ink);
}

.rail {
  display: grid;
  grid-template-columns: repeat(var(--n, 12), minmax(0, 1fr));
  gap: 4px;
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
}
.rail li {
  display: grid;
  gap: 4px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.35;
  min-width: 0;
}
.rail li::before {
  content: "";
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--soft);
}
.rail li.done::before {
  background: var(--green);
}
.rail li.done {
  color: var(--ink);
}
.rail li.current::before {
  background: var(--accent);
}
.rail li.current {
  color: var(--ink);
  font-weight: 700;
}
.rail .n { font-weight: 700; }
.rail .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- Gate Cards */

.gate {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-inner);
  padding: 16px 20px;
  display: grid;
  gap: 12px;
}
.gate-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.gate-head h3 {
  font-size: var(--f-body);
}
.signers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.signer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 12px 3px 4px;
  padding-inline: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 12.5px;
}
.signer .dot {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-pill);
  background: var(--paper);
  font-size: 12px;
}
.signer.signed {
  background: var(--sand);
  border-color: var(--success-border);
}
.signer.signed .dot {
  background: var(--green);
  color: var(--paper);
}
.gate-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}
.gate-facts div {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  min-width: 0;
}
.gate-facts div.secret {
  background: var(--sand);
  border-color: var(--success-border);
}
.gate-facts dt {
  font-size: 11px;
  color: var(--muted);
}
.gate-facts dd {
  margin: 0;
  font-weight: 700;
  font-size: var(--f-small);
}
.gate-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.gate-actions details {
  flex: 1 1 240px;
}
.gate-actions details > summary {
  list-style: none;
}
.gate-actions details > summary::-webkit-details-marker { display: none; }
.reject-box {
  margin-top: 10px;
  padding: 14px;
  border-radius: var(--radius-inner);
  background: var(--card);
  border: 1px solid var(--line);
}

/* ---------------------------------------------------------------- Tables & Lists */

.table-wrap {
  overflow-x: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-inner);
}
table, .table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--f-small);
}
th, td {
  text-align: start;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th {
  background: var(--card);
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover {
  background: var(--card-hover);
}
td a {
  font-weight: 700;
  text-decoration: none;
}

.rows {
  display: grid;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-inner);
  background: var(--paper);
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  transition: all var(--ease-fast);
}
a.row:hover {
  background: var(--sand);
  border-color: var(--accent);
  color: var(--ink);
}
.row.overdue-action {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  background: var(--warning-bg);
  border-color: var(--warning-border);
}
.row.overdue-action .action-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.row.overdue-action .action-header a {
  text-decoration: none;
  color: inherit;
}
.row.overdue-action .quick-postpone {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-inline-start: 36px;
}
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 700; display: block; font-size: var(--f-small); }
.row .sub { color: var(--muted); font-size: 12px; display: block; }
.row .icon { font-size: 20px; flex: none; width: 28px; text-align: center; }

.empty { color: var(--muted); padding: 12px 0; }
.empty-state { text-align: center; padding: 32px 16px; color: var(--muted); }
.empty-state .big { font-size: 36px; display: block; margin-bottom: 8px; }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.fact {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-inner);
  padding: 12px 16px;
}
.fact span { display: block; color: var(--muted); font-size: 12px; }
.fact b { font-size: var(--f-section); }
.fact.secret { background: var(--sand); border-color: var(--success-border); }

/* ---------------------------------------------------------------- Kanban Board */

.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 20px;
}
.toolbar .field { margin: 0; }
.toolbar .field select, .toolbar .field input { min-height: 38px; }

.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--soft);
  border: 1px solid var(--line);
}
.seg a {
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  text-decoration: none;
  color: var(--ink);
  font-size: var(--f-small);
  font-weight: 600;
  transition: all var(--ease-fast);
}
.seg a[aria-current="page"] {
  background: var(--ink);
  color: var(--paper);
}
.seg a.seg-gantt {
  background: var(--ink);
  color: var(--accent);
  font-weight: 700;
}
.seg a.seg-gantt:hover {
  background: var(--green);
  color: var(--paper);
}

.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 265px;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
}
.col {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-inner);
  padding: 12px;
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 220px;
  transition: background var(--ease-fast), outline var(--ease-fast);
}
.col-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  padding: 4px 6px 8px;
}
.col-head .count {
  color: var(--muted);
  font-weight: 700;
  font-size: 11px;
}
.col.zone-offer .col-head { color: var(--blue); }
.col.zone-exec .col-head { color: var(--green); }

.deal-card {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  border-radius: var(--radius-control);
  background: var(--paper);
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  border-inline-start: 4px solid transparent;
  transition: all var(--ease-fast);
}
.deal-card:hover {
  background: var(--card-hover);
  border-color: var(--line-dark);
}
.deal-card.warm { border-inline-start-color: var(--warning); }
.deal-card.cold { border-inline-start-color: var(--blue); }
.deal-card .lay { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.deal-card .name { font-weight: 700; font-size: 14px; line-height: 1.35; color: var(--ink); }
.deal-card .foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
}

[draggable="true"] { cursor: grab; }
.dragging { opacity: 0.45; }
.col.drop-over {
  background: var(--sand);
  outline: 2px dashed var(--green);
  outline-offset: -3px;
}
.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }
@media (prefers-reduced-motion: reduce) { .shake { animation: none; } }
.col-cards { display: grid; gap: 8px; align-content: start; min-height: 60px; }

/* ---------------------------------------------------------------- Dashboard Stats */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px;
  display: grid;
  gap: 4px;
}
.stat .k { color: var(--muted); font-size: 12.5px; }
.stat .v { font-size: 26px; font-weight: 700; line-height: 1.3; color: var(--ink); }
.stat .s { color: var(--muted); font-size: 12px; }
.stat.dark {
  background: var(--ink);
  color: var(--paper);
  border-color: #28373f;
}
.stat.dark .v { color: var(--paper); }
.stat.dark .k, .stat.dark .s { color: var(--on-dark); }

.bars { display: grid; gap: 8px; }
.bar {
  display: grid;
  grid-template-columns: minmax(120px, 220px) 1fr 32px;
  gap: 12px;
  align-items: center;
  font-size: var(--f-small);
}
.bar .track {
  display: flex;
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--soft);
  overflow: hidden;
}
.bar .fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--green);
}
.bar .fill.warn { background: var(--warning); }
.bar b { text-align: end; }

/* ---------------------------------------------------------------- Comments & Mentions */

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.comment-bubble {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-inner);
  padding: 14px 16px;
  transition: border-color var(--ease-fast);
}
.comment-bubble.financial {
  border-inline-start: 4px solid var(--warning);
  background: var(--warning-bg);
}

/* ---------------------------------------------------------------- Calendar */

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-inner);
  overflow: hidden;
}
.calendar-header-cell {
  background: var(--card);
  padding: 10px 8px;
  text-align: center;
  font-weight: 700;
  font-size: var(--f-small);
  color: var(--muted);
}
.calendar-cell {
  background: var(--paper);
  min-height: 98px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
}
.calendar-cell.other-month {
  background: #fafbfa;
  opacity: 0.6;
}
.calendar-cell.today {
  background: #f4faf7;
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}
.calendar-cell .day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.calendar-cell .day-number {
  font-weight: 700;
  font-size: 13px;
}
.events-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.calendar-event {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-inline-start: 3px solid var(--ink);
  background: var(--card);
}
.calendar-event:hover {
  filter: brightness(0.96);
}
.calendar-event.next_step {
  border-inline-start-color: #d97706;
  background: #fffbeb;
}
.calendar-event.meeting {
  border-inline-start-color: #2563eb;
  background: #eff6ff;
}
.calendar-event.delivery {
  border-inline-start-color: var(--green);
  background: #ecfdf5;
}

/* ---------------------------------------------------------------- Gantt Chart */

.gantt-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-inner);
  background: var(--paper);
  margin-top: 16px;
}
.gantt-header-row {
  display: flex;
  background: var(--card);
  border-bottom: 2px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
}
.gantt-item-label-col {
  width: 270px;
  min-width: 270px;
  padding: 10px 14px;
  font-weight: 700;
  border-inline-end: 2px solid var(--line);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.gantt-timeline-days {
  display: flex;
  flex: 1;
}
.gantt-day-col {
  width: 38px;
  min-width: 38px;
  text-align: center;
  padding: 6px 2px;
  border-inline-end: 1px solid var(--line);
  font-size: 11px;
}
.gantt-day-col.today {
  background: #f4faf7;
  font-weight: 700;
  color: var(--green);
}
.gantt-day-col.weekend {
  background: #f8faf9;
  color: var(--muted);
}
.gantt-item-block {
  border-bottom: 1px solid var(--line);
}
.gantt-item-head {
  display: flex;
  background: #fbfcfb;
  border-bottom: 1px dashed var(--line);
  padding: 8px 14px;
  align-items: center;
  justify-content: space-between;
}
.gantt-task-row {
  display: flex;
  align-items: center;
  min-height: 42px;
  border-bottom: 1px solid #f2f5f4;
}
.gantt-task-row:hover {
  background: var(--card-hover);
}
.gantt-task-info {
  width: 270px;
  min-width: 270px;
  padding: 6px 14px;
  border-inline-end: 2px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--paper);
}
.gantt-task-title {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gantt-task-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.gantt-task-bars {
  display: flex;
  flex: 1;
  position: relative;
  align-items: center;
  height: 42px;
}
.gantt-day-grid-bg {
  position: absolute;
  inset: 0;
  display: flex;
  pointer-events: none;
}
.gantt-cell-bg {
  width: 38px;
  min-width: 38px;
  height: 100%;
  border-inline-end: 1px solid #f6f7f6;
}
.gantt-cell-bg.today {
  background: rgba(166, 205, 189, 0.18);
}
.gantt-cell-bg.weekend {
  background: rgba(0, 0, 0, 0.02);
}
.gantt-bar {
  position: absolute;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 1;
  cursor: pointer;
  transition: transform var(--ease-fast);
}
.gantt-bar:hover {
  transform: translateY(-1px);
  z-index: 3;
}
.gantt-bar.done { background: var(--green); color: #fff; }
.gantt-bar.in_progress { background: var(--ink); color: #fff; border: 1px solid var(--accent); }
.gantt-bar.blocked { background: var(--error); color: #fff; }
.gantt-bar.todo { background: #e2e8e5; color: var(--ink); }
.gantt-bar.overdue { border: 2px solid var(--error); }

/* ---------------------------------------------------------------- Toasts */

.toast {
  position: fixed;
  inset-inline: 16px;
  bottom: 24px;
  margin-inline: auto;
  max-width: 500px;
  z-index: 100;
  padding: 12px 18px;
  border-radius: var(--radius-inner);
  background: var(--ink);
  color: var(--paper);
  font-size: var(--f-body);
  border: 1px solid #28373f;
}
.toast.warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning-border);
}
.toast.success {
  background: var(--green);
  color: var(--paper);
}

/* ---------------------------------------------------------------- Onboarding Tour */

.tour-card {
  background: var(--paper);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 22px 26px;
  margin-bottom: 24px;
}
.tour-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.tour-body {
  font-size: var(--f-body);
  line-height: 1.6;
}
.tour-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
  gap: 12px;
}

/* ---------------------------------------------------------------- Login Page */

.login-page {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background: var(--paper);
}
.login-card {
  width: min(440px, 100%);
}
.demo-users {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.demo-users button {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--paper);
  font: inherit;
  font-size: var(--f-small);
  text-align: start;
  cursor: pointer;
  transition: all var(--ease-fast);
}
.demo-users button:hover {
  background: var(--sand);
  border-color: var(--accent);
}

/* ---------------------------------------------------------------- Responsive */

@media (max-width: 1100px) {
  .grid.four { grid-template-columns: 1fr 1fr; }
  .grid.three { grid-template-columns: 1fr 1fr; }
  .grid.side { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root {
    --f-display: 24px;
    --f-title: 19px;
    --radius: 12px;
  }
  .wrap, .topbar-inner {
    width: calc(100% - 24px);
  }
  main.wrap {
    padding-block: 16px 48px;
  }
  .topbar-inner {
    flex-wrap: wrap;
    gap: 8px 12px;
    padding-block: 8px;
    min-height: 0;
  }
  .brand .brand-name { display: none; }
  .tabs { order: 3; width: 100%; }
  .account .who, .account .caret { display: none; }
  .account > summary { padding: 4px; }
  .menu { position: fixed; top: 60px; inset-inline: 12px; width: auto; }
  .grid.two, .grid.three, .form, .form fieldset { grid-template-columns: 1fr; }
  .grid.four { grid-template-columns: 1fr 1fr; }
  .card { padding: 16px; }
  .hero { grid-template-columns: auto 1fr; padding: 18px; }
  .hero .icon { width: 44px; height: 44px; font-size: 22px; }
  .hero > .btn, .hero > form { grid-column: 1 / -1; }
  .rail { grid-template-columns: repeat(var(--n, 12), 1fr); }
  .rail .t { display: none; }
  .board { grid-auto-columns: 82vw; }
  .toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .toolbar .field label { font-size: 12px; }
  .bar { grid-template-columns: 110px 1fr 28px; }
  .demo-users { grid-template-columns: 1fr; }
  .chips.cards { grid-template-columns: 1fr; }
  .chapters { display: none; }
}
