:root {
  --ink: #17232b;
  --ink-soft: #46545d;
  --muted: #69767d;
  --canvas: #f2f5f3;
  --surface: #ffffff;
  --surface-raised: #fbfcfb;
  --line: #d9e0de;
  --line-strong: #b9c5c1;
  --cobalt: #3157d5;
  --cobalt-dark: #2544a6;
  --cobalt-pale: #e9edff;
  --danger: #c8443e;
  --danger-dark: #9e2f2b;
  --danger-pale: #fff0ee;
  --warning: #a96d0f;
  --warning-dark: #805006;
  --warning-pale: #fff7e6;
  --success: #2c7562;
  --success-dark: #1f5a4b;
  --success-pale: #e8f5f0;
  --today: #315b78;
  --today-pale: #eaf4f9;
  --shadow-card: 0 1px 1px rgba(23, 35, 43, 0.04), 0 7px 20px rgba(23, 35, 43, 0.035);
  --shadow-float: 0 24px 70px rgba(19, 32, 39, 0.2), 0 3px 14px rgba(19, 32, 39, 0.09);
  --radius-control: 10px;
  --radius-card: 14px;
  --radius-panel: 18px;
  --font-ui: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-data: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --z-sticky: 120;
  --z-dropdown: 240;
  --z-backdrop: 540;
  --z-dialog: 640;
  --z-drawer: 740;
  --z-toast: 940;
  color-scheme: light;
  font-synthesis: none;
  scrollbar-color: #aebbb7 #edf1ef;
  scrollbar-width: thin;
}

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

* {
  scrollbar-color: #aebbb7 #edf1ef;
  scrollbar-width: thin;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: #edf1ef;
}

*::-webkit-scrollbar-thumb {
  min-height: 32px;
  border: 2px solid #edf1ef;
  border-radius: 999px;
  background: #aebbb7;
}

*::-webkit-scrollbar-thumb:hover {
  background: #85958f;
}

*::-webkit-scrollbar-thumb:active {
  background: #657872;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  color: var(--ink);
  background: var(--canvas);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Hidden must win over component display declarations. */
[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
a,
select,
label {
  -webkit-tap-highlight-color: transparent;
}

button,
a,
select {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid rgba(49, 87, 213, 0.34);
  outline-offset: 2px;
}

::selection {
  color: #fff;
  background: var(--cobalt);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: calc(var(--z-toast) + 1);
  padding: 10px 14px;
  border-radius: var(--radius-control);
  color: #fff;
  background: var(--ink);
  transform: translateY(-160%);
  transition: transform 160ms ease-out;
}

.skip-link:focus {
  transform: translateY(0);
}

#app-shell {
  min-height: 100%;
}

.app-view {
  min-width: 0;
}

.board-view {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 680px;
  height: 100dvh;
  background:
    linear-gradient(rgba(23, 35, 43, 0.018) 1px, transparent 1px),
    var(--canvas);
  background-size: 100% 32px;
}

.app-header,
.simple-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  min-height: 72px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 0 rgba(23, 35, 43, 0.02);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 11px;
  min-width: 146px;
  text-decoration: none;
}

.brand > span:last-child {
  display: grid;
  gap: 1px;
}

.brand strong {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.brand small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-mark {
  display: flex;
  align-items: end;
  gap: 2px;
  width: 27px;
  height: 31px;
  padding: 5px;
  border-radius: 8px 8px 8px 3px;
  color: #fff;
  background: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.brand-mark i {
  display: block;
  width: 2px;
  border-radius: 2px;
  background: currentColor;
}

.brand-mark i:nth-child(1) { height: 6px; opacity: 0.35; }
.brand-mark i:nth-child(2) { height: 9px; opacity: 0.5; }
.brand-mark i:nth-child(3) { height: 12px; opacity: 0.66; }
.brand-mark i:nth-child(4) { height: 16px; opacity: 0.82; }
.brand-mark i:nth-child(5) { height: 20px; }

.search {
  position: relative;
  flex: 1 1 420px;
  max-width: 520px;
  margin-left: clamp(20px, 4vw, 68px);
}

.search > svg {
  position: absolute;
  z-index: 1;
  left: 14px;
  top: 50%;
  width: 18px;
  height: 18px;
  color: var(--muted);
  transform: translateY(-50%);
}

.search input {
  width: 100%;
  height: 44px;
  padding: 0 46px 0 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
  color: var(--ink);
  background: #f7f9f8;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.search input::placeholder {
  color: #84918d;
}

.search input::-webkit-search-cancel-button {
  appearance: none;
}

.search input:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.search input:focus {
  border-color: var(--cobalt);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(49, 87, 213, 0.12);
}

.search-clear {
  position: absolute;
  z-index: 2;
  right: 8px;
  top: 6px;
  width: 32px;
  height: 32px;
}

.search-results {
  position: absolute;
  z-index: var(--z-dropdown);
  top: calc(100% + 8px);
  left: 0;
  width: min(520px, calc(100vw - 32px));
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(23, 35, 43, 0.16);
}

.search-results::before {
  content: "Угоди";
  display: block;
  padding: 6px 10px 8px;
  color: var(--muted);
  font-family: var(--font-data);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.search-results a {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 54px;
  padding: 8px 10px;
  border-radius: 9px;
  text-decoration: none;
}

.search-results a:hover,
.search-results a.is-active {
  background: var(--cobalt-pale);
}

.search-results a > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.search-results a strong,
.search-results a small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-results a strong {
  font-size: 13px;
  font-weight: 700;
}

.search-results a small {
  color: var(--muted);
  font-size: 11px;
}

.result-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
  color: var(--cobalt-dark);
  background: var(--cobalt-pale);
  font-family: var(--font-data);
  font-size: 10px;
  font-weight: 600;
}

.search-results kbd {
  color: var(--muted);
  font: 500 11px/1 var(--font-data);
}

.search-empty {
  margin: 0;
  padding: 20px 10px;
  color: var(--muted);
  text-align: center;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.today {
  display: grid;
  gap: 1px;
  margin: 0 10px 0 0;
  text-align: right;
}

.today span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.today strong {
  font-family: var(--font-data);
  font-size: 12px;
  font-weight: 600;
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  text-decoration: none;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.button {
  min-height: 40px;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.button svg {
  width: 17px;
  height: 17px;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button-primary {
  color: #fff;
  background: var(--cobalt);
  box-shadow: 0 6px 15px rgba(49, 87, 213, 0.18);
}

.button-primary:hover {
  background: var(--cobalt-dark);
  box-shadow: 0 8px 20px rgba(49, 87, 213, 0.24);
}

.button-secondary {
  color: var(--cobalt-dark);
  border-color: #c8d1f4;
  background: var(--cobalt-pale);
}

.button-secondary:hover {
  border-color: var(--cobalt);
  background: #dfe5ff;
}

.button-quiet {
  color: var(--ink-soft);
  border-color: var(--line);
  background: var(--surface);
}

.button-quiet:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: #f7f9f8;
}

.button-warning {
  color: var(--warning-dark);
  border-color: #e7c988;
  background: var(--warning-pale);
}

.button-warning:hover {
  border-color: var(--warning);
  background: #ffefc9;
}

.button-danger-quiet {
  color: var(--danger-dark);
  border-color: #efc0bc;
  background: #fff;
}

.button-danger {
  color: #fff;
  border-color: var(--danger);
  background: var(--danger);
  box-shadow: 0 6px 15px rgba(200, 68, 62, 0.18);
}

.button-danger:hover {
  border-color: var(--danger-dark);
  background: var(--danger-dark);
}

.button-danger-quiet:hover {
  border-color: var(--danger);
  background: var(--danger-pale);
}

.button-success {
  color: var(--success-dark);
  border-color: #a9d6c8;
  background: var(--success-pale);
}

.button-success:hover {
  border-color: var(--success);
  background: #d8eee6;
}

.icon-button {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
}

.icon-button:hover {
  color: var(--ink);
  border-color: var(--line);
  background: #f5f7f6;
}

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

.workspace-toolbar {
  position: relative;
  z-index: 5;
  padding: 16px 24px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(242, 245, 243, 0.96);
}

.workspace-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--cobalt-dark);
  font-family: var(--font-data);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.workspace-title h1,
.form-intro h1,
.login-form h1 {
  margin: 0;
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 650;
  letter-spacing: -0.045em;
  line-height: 1.1;
}

.risk-summary {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-bottom: 3px;
}

.risk-summary > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.risk-summary strong {
  color: var(--ink);
  font: 600 12px/1 var(--font-data);
}

.signal {
  display: inline-block;
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(23, 35, 43, 0.04);
}

.signal-danger { background: var(--danger); }
.signal-warning { background: var(--warning); }
.signal-success { background: var(--success); }

.filters {
  display: flex;
  align-items: end;
  gap: 8px;
  min-width: 0;
}

.filter-control {
  display: grid;
  flex: 1 1 120px;
  min-width: 112px;
  gap: 4px;
}

.filter-control-wide {
  flex-basis: 180px;
}

.filter-control > span {
  padding-left: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.filter-control select {
  width: 100%;
  height: 38px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  color: var(--ink-soft);
  background: var(--surface);
  font-size: 11px;
  font-weight: 600;
}

.filter-control select:hover {
  border-color: var(--line-strong);
}

.filter-control select:focus {
  border-color: var(--cobalt);
  box-shadow: 0 0 0 3px rgba(49, 87, 213, 0.1);
}

.filter-control:has(select:not([value=""])) select,
.filter-control.is-active select {
  color: var(--cobalt-dark);
  border-color: #b4c0ef;
  background: var(--cobalt-pale);
}

.filter-toggle {
  flex: 0 0 auto;
}

.filter-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.filter-toggle span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink-soft);
  background: var(--surface);
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.filter-toggle span:hover {
  border-color: var(--line-strong);
}

.filter-toggle input:focus-visible + span {
  outline: 3px solid rgba(49, 87, 213, 0.34);
  outline-offset: 2px;
}

.filter-toggle input:checked + span {
  border-color: #b4c0ef;
  color: var(--cobalt-dark);
  background: var(--cobalt-pale);
}

.reset-filters {
  min-height: 38px;
  padding: 0 6px;
  border: 0;
  color: var(--cobalt-dark);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
}

.reset-filters:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.active-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.active-filters > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 8px 0 10px;
  border: 1px solid #c6d0f5;
  border-radius: 999px;
  color: var(--cobalt-dark);
  background: var(--cobalt-pale);
  font-size: 10px;
  font-weight: 650;
}

.filter-chip button {
  display: grid;
  width: 20px;
  height: 20px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: inherit;
  background: transparent;
}

.filter-chip button:hover {
  background: rgba(49, 87, 213, 0.12);
}

.filter-chip svg {
  width: 12px;
  height: 12px;
}

.board-shell {
  min-width: 0;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 14px 24px 18px;
  scrollbar-gutter: stable;
}

.board {
  display: flex;
  align-items: stretch;
  gap: 12px;
  width: max-content;
  min-width: 100%;
  height: 100%;
}

.column {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 288px;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(250, 252, 251, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.column-header {
  position: sticky;
  z-index: var(--z-sticky);
  top: 0;
  display: grid;
  grid-template-columns: 35px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 72px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 252, 251, 0.96);
  backdrop-filter: blur(10px);
}

.stage-coordinate {
  display: grid;
  grid-template-rows: auto 1fr;
  align-items: center;
  justify-items: center;
  align-self: stretch;
  min-height: 46px;
}

.stage-coordinate span {
  color: var(--cobalt-dark);
  font: 600 10px/1 var(--font-data);
}

.stage-coordinate i {
  position: relative;
  width: 1px;
  height: 100%;
  margin-top: 5px;
  background: #cbd3d0;
}

.stage-coordinate i::before,
.stage-coordinate i::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 5px;
  height: 5px;
  border: 1px solid var(--cobalt);
  border-radius: 50%;
  background: #fff;
  transform: translateX(-50%);
}

.stage-coordinate i::before { top: 0; }
.stage-coordinate i::after { bottom: 0; background: var(--cobalt); }

.column-header h2 {
  margin: 0 0 2px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: -0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column-header p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.column-header p span {
  font-family: var(--font-data);
  font-weight: 600;
}

.column-total {
  color: var(--ink-soft);
  font: 600 10px/1.45 var(--font-data);
  text-align: right;
  white-space: nowrap;
}

.column-total small {
  color: var(--muted);
  font: inherit;
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 130px;
  overflow-y: auto;
  padding: 10px;
  scroll-padding: 10px;
  scrollbar-gutter: stable;
  transition: background 150ms ease, box-shadow 150ms ease;
}

.cards.is-drop-target {
  background: rgba(49, 87, 213, 0.055);
  box-shadow: inset 0 0 0 2px rgba(49, 87, 213, 0.24);
}

.filter-empty {
  display: grid;
  min-height: 120px;
  margin: 0;
  place-items: center;
  padding: 20px;
  border: 1px dashed #c9d2cf;
  border-radius: var(--radius-card);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.5);
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

.filter-empty[hidden] {
  display: none;
}

.deal-card {
  position: relative;
  flex: 0 0 168px;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #d7dfdc;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease, opacity 150ms ease;
}

.deal-card:hover {
  border-color: #b8c5c1;
  box-shadow: 0 10px 28px rgba(23, 35, 43, 0.1);
  transform: translateY(-1px);
}

.deal-card.is-selected {
  border-color: var(--cobalt);
  box-shadow: 0 0 0 2px rgba(49, 87, 213, 0.12), var(--shadow-card);
}

.deal-card.is-dragging {
  opacity: 0.56;
  box-shadow: 0 20px 44px rgba(23, 35, 43, 0.16);
  transform: rotate(1deg) scale(1.01);
}

.deal-open {
  display: grid;
  grid-template-rows: auto 36px auto 44px;
  width: 100%;
  height: 100%;
  padding: 13px 13px 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: grab;
}

.deal-open:active {
  cursor: grabbing;
}

.deal-open:focus-visible {
  box-shadow: inset 0 0 0 3px rgba(49, 87, 213, 0.34);
}

.deal-topline {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-right: 29px;
}

.deal-topline strong {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: -0.022em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deal-age {
  flex: 0 0 auto;
  color: var(--muted);
  font: 500 9px/1 var(--font-data);
}

.deal-age-stale {
  color: var(--warning-dark);
  font-weight: 600;
}

.deal-title {
  display: -webkit-box;
  overflow: hidden;
  align-self: center;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.deal-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.deal-meta b {
  overflow: hidden;
  color: var(--ink);
  font: 600 10px/1 var(--font-data);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manager {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manager i {
  display: grid;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 6px;
  color: var(--cobalt-dark);
  background: var(--cobalt-pale);
  font: normal 600 7px/1 var(--font-data);
}

.next-action {
  display: grid;
  grid-template-columns: 18px auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-width: 0;
  margin: 0 -13px;
  padding: 0 13px;
  color: var(--today);
  border-top: 1px solid #dce8ed;
  background: var(--today-pale);
}

.next-action svg {
  width: 15px;
  height: 15px;
}

.next-action strong {
  font: 600 9px/1 var(--font-data);
  white-space: nowrap;
}

.next-action small {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.next-action-danger {
  color: var(--danger-dark);
  border-color: #f0c9c5;
  background: var(--danger-pale);
}

.next-action-warning {
  color: var(--warning-dark);
  border-color: #ead39e;
  background: var(--warning-pale);
}

.next-action-today {
  color: var(--cobalt-dark);
  border-color: #ccd4f3;
  background: var(--cobalt-pale);
}

.move-next {
  position: absolute;
  z-index: 3;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-color: transparent;
  background: rgba(255, 255, 255, 0.88);
  opacity: 0;
  transform: translateX(-2px);
}

.move-next svg {
  width: 15px;
  height: 15px;
}

.deal-card:hover .move-next,
.move-next:focus-visible {
  opacity: 1;
  transform: translateX(0);
}

.drag-grip {
  position: absolute;
  z-index: 2;
  right: 13px;
  bottom: 14px;
  color: currentColor;
  font-size: 13px;
  line-height: 1;
  opacity: 0.25;
  pointer-events: none;
}

.deal-card[hidden] {
  display: none;
}

.column-empty {
  display: grid;
  min-height: 148px;
  place-items: center;
  align-content: center;
  gap: 7px;
  padding: 22px;
  border: 1px dashed #c9d2cf;
  border-radius: var(--radius-card);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.48);
  text-align: center;
}

.column-empty > span {
  display: flex;
  align-items: end;
  gap: 4px;
  height: 26px;
}

.column-empty > span i {
  display: block;
  width: 5px;
  border-radius: 4px;
  background: #c3cdca;
}

.column-empty > span i:nth-child(1) { height: 9px; }
.column-empty > span i:nth-child(2) { height: 17px; }
.column-empty > span i:nth-child(3) { height: 25px; background: #aebcb7; }

.column-empty strong {
  color: var(--ink-soft);
  font-size: 11px;
}

.column-empty p {
  max-width: 180px;
  margin: 0;
  font-size: 10px;
}

.simple-header {
  justify-content: space-between;
}

.form-view {
  min-height: 100dvh;
  background:
    linear-gradient(90deg, transparent 0 49.9%, rgba(23, 35, 43, 0.028) 50%, transparent 50.1%),
    var(--canvas);
  background-size: 64px 100%;
}

.form-page {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(560px, 720px);
  align-items: start;
  justify-content: center;
  gap: clamp(44px, 6vw, 92px);
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(48px, 7vw, 88px) 32px 80px;
}

.form-intro {
  position: sticky;
  top: 42px;
}

.form-intro > p:not(.eyebrow) {
  max-width: 300px;
  margin: 16px 0 30px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.form-progress {
  position: relative;
  display: grid;
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.form-progress::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 32px;
  bottom: 32px;
  width: 1px;
  background: var(--line-strong);
}

.form-progress li {
  position: relative;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 0 12px;
  min-height: 45px;
}

.form-progress li > span {
  z-index: 1;
  display: grid;
  grid-row: 1 / 3;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--muted);
  background: var(--canvas);
  font: 600 9px/1 var(--font-data);
}

.form-progress li.is-current > span {
  color: #fff;
  border-color: var(--cobalt);
  background: var(--cobalt);
}

.form-progress strong {
  font-size: 12px;
}

.form-progress small {
  color: var(--muted);
  font-size: 10px;
}

.panel-form {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(23, 35, 43, 0.08);
}

.form-section {
  padding: 28px;
  border-bottom: 1px solid var(--line);
}

.form-section-accent {
  background: #fbfcff;
}

.section-heading,
.drawer-section-heading {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}

.section-heading > span,
.drawer-section-heading > span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid #c9d2ef;
  border-radius: 8px;
  color: var(--cobalt-dark);
  background: var(--cobalt-pale);
  font: 600 9px/1 var(--font-data);
}

.section-heading h2,
.drawer-section-heading h3 {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.section-heading p,
.drawer-section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 14px;
}

.field {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 6px;
}

.field-span-2 {
  grid-column: 1 / -1;
}

.field > span:first-child,
.field > span:not(.password-control):not(.compound-control) {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
}

.field b {
  color: var(--danger);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  outline: 0;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.field input,
.field select {
  height: 42px;
  padding: 0 11px;
}

.field textarea {
  min-height: 76px;
  padding: 10px 11px;
  line-height: 1.5;
  resize: none;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #98a39f;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--line-strong);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--cobalt);
  box-shadow: 0 0 0 3px rgba(49, 87, 213, 0.1);
}

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: var(--danger);
  background: #fffbfa;
  box-shadow: 0 0 0 3px rgba(200, 68, 62, 0.1);
}

.field-error {
  min-height: 14px;
  color: var(--danger-dark);
  font-size: 9px;
}

.form-alert,
.drawer-alert {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  margin: 20px 28px 0;
  padding: 12px 14px;
  border: 1px solid #efc1bd;
  border-radius: 11px;
  color: var(--danger-dark);
  background: var(--danger-pale);
}

.form-alert svg,
.drawer-alert > svg {
  width: 19px;
  height: 19px;
  margin-top: 1px;
}

.form-alert strong,
.drawer-alert strong {
  font-size: 11px;
}

.form-alert p,
.drawer-alert p {
  margin: 2px 0 0;
  color: #79413e;
  font-size: 10px;
}

.form-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 28px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -1px 0 var(--line);
  backdrop-filter: blur(10px);
}

.button-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.button.is-busy .button-spinner {
  display: block;
}

.button.is-busy {
  pointer-events: none;
}

.login-view {
  display: grid;
  grid-template-columns: minmax(380px, 46%) 1fr;
  min-height: 100dvh;
  background: var(--surface);
}

.login-visual {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100dvh;
  overflow: hidden;
  padding: 34px clamp(36px, 6vw, 84px) 44px;
  color: #eef4f1;
  background: #14262e;
}

.login-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent 92%);
}

.login-visual::after {
  content: "";
  position: absolute;
  right: -18%;
  bottom: -18%;
  width: 66%;
  aspect-ratio: 1;
  border: 1px solid rgba(115, 150, 255, 0.22);
  border-radius: 50%;
  box-shadow: 0 0 0 55px rgba(115, 150, 255, 0.025), 0 0 0 110px rgba(115, 150, 255, 0.02);
}

.login-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 11px;
}

.login-brand > span:last-child {
  display: grid;
}

.login-brand strong {
  font-size: 16px;
}

.login-brand small {
  color: #a9bab4;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.brand-mark-light {
  color: #14262e;
  background: #eef4f1;
}

.control-map {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  gap: 22px;
  width: min(100%, 520px);
}

.control-map > p {
  max-width: 500px;
  margin: 0 0 30px;
  font-size: clamp(34px, 4.5vw, 66px);
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 1.02;
}

.map-track {
  position: relative;
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.map-track span {
  color: #9fb0aa;
  font: 600 9px/1 var(--font-data);
}

.map-track i {
  display: block;
  height: 1px;
  background: rgba(223, 233, 229, 0.22);
}

.map-track b {
  position: absolute;
  left: calc(38px + var(--position));
  width: 9px;
  height: 9px;
  border: 2px solid #14262e;
  border-radius: 50%;
  background: #85a0ff;
  box-shadow: 0 0 0 3px rgba(133, 160, 255, 0.24);
  transform: translateX(-50%);
}

.track-2 b { background: #e2b452; box-shadow: 0 0 0 3px rgba(226, 180, 82, 0.22); }
.track-4 b { background: #e5776f; box-shadow: 0 0 0 3px rgba(229, 119, 111, 0.22); }
.track-5 b { background: #7dc6af; box-shadow: 0 0 0 3px rgba(125, 198, 175, 0.22); }

.visual-caption {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #a9bab4;
  font-size: 11px;
}

.visual-caption span {
  color: #eef4f1;
  font: 600 11px/1 var(--font-data);
}

.login-main {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 48px;
}

.login-form {
  width: min(100%, 380px);
}

.login-copy {
  margin: 12px 0 30px;
  color: var(--muted);
  font-size: 13px;
}

.login-form .form-alert {
  margin: 0 0 20px;
}

.password-control {
  position: relative;
  display: block;
}

.password-control input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  right: 3px;
  top: 2px;
}

.password-toggle .eye-closed {
  display: none;
}

.password-toggle[aria-pressed="true"] .eye-open {
  display: none;
}

.password-toggle[aria-pressed="true"] .eye-closed {
  display: block;
}

.login-submit {
  width: 100%;
  margin-top: 10px;
}

.login-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.drawer-layer {
  position: fixed;
  z-index: var(--z-backdrop);
  inset: 0;
}

.drawer-backdrop {
  position: absolute;
  z-index: var(--z-backdrop);
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(15, 29, 35, 0.3);
  opacity: 0;
  cursor: pointer;
  transition: opacity 180ms ease-out;
  backdrop-filter: blur(1px);
}

.deal-drawer {
  position: absolute;
  z-index: var(--z-drawer);
  top: 0;
  right: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(680px, 96vw);
  height: 100dvh;
  overflow: hidden;
  border-left: 1px solid var(--line);
  outline: 0;
  background: var(--surface);
  box-shadow: var(--shadow-float);
  transform: translateX(102%);
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.drawer-layer.is-open .drawer-backdrop {
  opacity: 1;
}

.drawer-layer.is-open .deal-drawer {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px 12px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.drawer-statusline {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 8px;
  color: var(--cobalt-dark);
  background: var(--cobalt-pale);
  font-size: 10px;
  font-weight: 700;
}

.stage-badge i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cobalt);
}

.save-state {
  display: inline-flex;
  min-width: 150px;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 9px;
}

.save-state svg {
  width: 14px;
  height: 14px;
  color: var(--success);
}

.save-state.is-saving svg {
  border: 1.5px solid var(--cobalt);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
  stroke: none;
}

.drawer-form {
  min-height: 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.drawer-hero {
  padding: 24px 28px 22px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfb;
}

.drawer-client {
  display: block;
  width: 100%;
  padding: 0 0 7px;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 650;
  letter-spacing: -0.05em;
  line-height: 1.1;
}

.drawer-client:hover {
  border-bottom-color: var(--line-strong);
}

.drawer-client:focus {
  border-bottom-color: var(--cobalt);
  box-shadow: 0 2px 0 rgba(49, 87, 213, 0.1);
}

.drawer-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
  margin-top: 10px;
}

.drawer-summary > * {
  padding: 0 10px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.drawer-summary > *:first-child {
  padding-left: 0;
}

.drawer-summary > *:last-child {
  border-right: 0;
}

.drawer-summary strong {
  color: var(--ink);
  font: 600 12px/1 var(--font-data);
}

.drawer-alert {
  grid-template-columns: 22px minmax(0, 1fr) 30px;
  margin: 18px 28px 0;
}

.drawer-alert .icon-button {
  width: 28px;
  height: 28px;
  margin: -3px -5px 0 0;
  color: var(--danger-dark);
}

.drawer-body {
  padding: 0 28px 48px;
}

.drawer-section {
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}

.drawer-section:last-child {
  border-bottom: 0;
}

.drawer-section-heading {
  margin-bottom: 18px;
}

.drawer-field-grid {
  gap: 14px 12px;
}

.compound-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px;
}

.compound-control input {
  border-radius: var(--radius-control) 0 0 var(--radius-control);
}

.compound-control select {
  border-left: 0;
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
  background: #f7f9f8;
}

.step-card {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 13px;
  border: 1px solid #efc5c1;
  border-radius: 12px;
  background: var(--danger-pale);
}

.step-date {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  align-content: center;
  border: 1px solid #e6b3ae;
  border-radius: 10px;
  color: var(--danger-dark);
  background: #fff;
}

.step-date span {
  font: 600 16px/1 var(--font-data);
}

.step-date small {
  margin-top: 2px;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
}

.step-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.step-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--danger-dark);
  font-size: 9px;
  font-weight: 700;
}

.step-copy strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.step-copy small {
  color: var(--muted);
  font-size: 9px;
}

.step-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.step-actions .button {
  min-height: 36px;
}

.step-actions .icon-button {
  width: 34px;
  height: 34px;
}

.add-step {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(130px, 0.7fr);
  gap: 12px;
  margin-top: 16px;
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: #fbfcfb;
}

.add-step-button {
  justify-self: end;
  align-self: end;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  scrollbar-gutter: stable;
}

table {
  width: 100%;
  min-width: 550px;
  border-collapse: collapse;
  font-size: 10px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  background: #f7f9f8;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tr.is-paid {
  color: var(--muted);
}

.payment-index {
  display: inline-block;
  width: 22px;
  color: var(--muted);
  font: 500 8px/1 var(--font-data);
}

.numeric {
  font-family: var(--font-data);
  font-weight: 600;
  white-space: nowrap;
}

.payment-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--success-dark);
  font-size: 9px;
  font-weight: 700;
}

.payment-status svg {
  width: 13px;
  height: 13px;
}

.payment-status-pending {
  color: var(--warning-dark);
}

.timeline {
  position: relative;
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 114px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--line);
}

.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 96px 14px minmax(0, 1fr);
  gap: 12px;
  padding: 0 0 18px;
}

.timeline li:last-child {
  padding-bottom: 0;
}

.timeline time {
  padding-top: 2px;
  color: var(--muted);
  font: 500 8px/1.4 var(--font-data);
  text-align: right;
}

.timeline li > i {
  position: relative;
  z-index: 1;
  width: 9px;
  height: 9px;
  margin-top: 3px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--cobalt);
  box-shadow: 0 0 0 1px #b5c1be;
}

.timeline li > div {
  display: grid;
  gap: 3px;
}

.timeline strong {
  font-size: 10px;
}

.timeline p {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.55;
}

.terminal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.confirm-layer {
  position: fixed;
  z-index: var(--z-dialog);
  inset: 0;
}

.confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 23, 28, 0.52);
  backdrop-filter: blur(2px);
}

.confirm-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 16px;
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(9, 20, 25, 0.28);
  transform: translate(-50%, -50%);
}

.confirm-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 12px;
  color: var(--warning-dark);
  background: var(--warning-pale);
}

.confirm-icon svg {
  width: 23px;
  height: 23px;
}

.confirm-dialog h2 {
  margin: 0 0 7px;
  font-size: 18px;
  letter-spacing: -0.03em;
}

.confirm-dialog > div > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.confirm-extra {
  grid-column: 1 / -1;
}

.confirm-dialog footer {
  display: flex;
  grid-column: 1 / -1;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

.toast-viewport {
  position: fixed;
  z-index: var(--z-toast);
  right: 20px;
  top: 20px;
  display: grid;
  width: min(350px, calc(100vw - 40px));
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 10px 13px;
  border: 1px solid #bfd8d0;
  border-radius: 12px;
  color: var(--success-dark);
  background: #f5fbf8;
  box-shadow: 0 16px 44px rgba(23, 35, 43, 0.16);
  animation: toast-in 220ms ease-out both;
  pointer-events: auto;
}

.toast > span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: var(--success-pale);
}

.toast svg {
  width: 16px;
  height: 16px;
}

.toast strong {
  font-size: 10px;
}

.toast p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 9px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1220px) {
  .app-header {
    padding-inline: 18px;
  }

  .search {
    margin-left: 22px;
  }

  .today {
    display: none;
  }

  .workspace-toolbar {
    padding-inline: 18px;
  }

  .filters {
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .filter-control {
    flex: 0 0 126px;
  }

  .filter-control-wide {
    flex-basis: 176px;
  }

  .board-shell {
    padding-inline: 18px;
  }
}

@media (max-width: 920px) {
  .board-view {
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .brand {
    min-width: auto;
  }

  .brand > span:last-child {
    display: none;
  }

  .search {
    flex-basis: auto;
    margin-left: 16px;
  }

  .logout-button {
    display: none;
  }

  .workspace-title {
    align-items: center;
  }

  .form-page {
    grid-template-columns: 1fr;
    gap: 32px;
    max-width: 760px;
  }

  .form-intro {
    position: static;
  }

  .form-progress {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-progress::before {
    left: 17px;
    right: calc(50% - 17px);
    top: 17px;
    bottom: auto;
    width: auto;
    height: 1px;
  }

  .login-view {
    grid-template-columns: minmax(320px, 42%) 1fr;
  }

  .control-map > p {
    font-size: clamp(32px, 5vw, 48px);
  }
}

@media (max-width: 720px) {
  .app-header {
    min-height: 64px;
    padding: 10px 12px;
  }

  .search {
    margin-left: 10px;
  }

  .search input {
    height: 40px;
  }

  .header-actions .button-primary {
    width: 40px;
    min-height: 40px;
    padding: 0;
    font-size: 0;
  }

  .workspace-toolbar {
    padding: 12px;
  }

  .workspace-title {
    margin-bottom: 10px;
  }

  .risk-summary {
    gap: 10px;
  }

  .risk-summary > span {
    font-size: 0;
  }

  .risk-summary > span strong {
    font-size: 11px;
  }

  .board-shell {
    padding: 10px 12px 14px;
  }

  .column {
    width: 280px;
  }

  .deal-drawer {
    width: 100vw;
  }

  .drawer-body,
  .drawer-hero {
    padding-inline: 18px;
  }

  .drawer-alert {
    margin-inline: 18px;
  }

  .field-grid,
  .drawer-field-grid,
  .add-step {
    grid-template-columns: 1fr;
  }

  .field-span-2 {
    grid-column: auto;
  }

  .step-card {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .step-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .login-view {
    grid-template-columns: 1fr;
  }

  .login-visual {
    display: none;
  }

  .login-main {
    padding: 32px 24px;
  }

  .form-page {
    padding: 38px 18px 60px;
  }

  .form-section {
    padding: 22px 18px;
  }

  .form-actions {
    padding: 15px 18px;
  }

  .timeline::before {
    left: 6px;
  }

  .timeline li {
    grid-template-columns: 14px minmax(0, 1fr);
  }

  .timeline time {
    grid-column: 2;
    grid-row: 1;
    text-align: left;
  }

  .timeline li > i {
    grid-column: 1;
    grid-row: 1 / 3;
  }

  .timeline li > div {
    grid-column: 2;
  }
}

@media (hover: none) {
  .move-next {
    opacity: 1;
    transform: none;
  }
}

@media (forced-colors: active) {
  * {
    scrollbar-color: auto;
  }

  .signal,
  .stage-badge i,
  .map-track b {
    border: 1px solid CanvasText;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto;
    transition-duration: 0.01ms;
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
  }

  .deal-card:hover,
  .button:hover {
    transform: none;
  }
}

/* =====================================================================
   Порт прототипу на Jinja2 + HTMX + SortableJS: доповнення до стилів.
   Усе нижче стосується лише розмітки бойових шаблонів.
   ===================================================================== */

.js .js-hide { display: none; }

/* Панель: #panel і є .drawer-layer; hidden лишається контрактом тестів. */
.panel-open { overflow: hidden; }
.panel.drawer-layer .drawer-backdrop { z-index: 1; }
.panel.drawer-layer .deal-drawer { z-index: 2; }

/* Контейнер підтвердження живе всередині фрагмента картки, тому має бути
   вищим за шухляду в тому самому контексті накладання, і невидимим, поки
   порожній (інакше фіксований шар перекривав би кліки). */
#confirm { z-index: 3; }
#confirm:empty { display: none; }
.confirm-icon-danger { color: var(--danger-dark); background: var(--danger-pale); }
.confirm-icon-success { color: var(--success-dark); background: var(--success-pale); }

/* Банери стану угоди поверх стандартного drawer-alert. */
.drawer-alert-success { color: var(--success-dark); border-color: #bfe0d3; background: var(--success-pale); }
.drawer-alert-success > svg { color: var(--success); }
.drawer-alert-warning { color: var(--warning-dark); border-color: #ead39e; background: var(--warning-pale); }
.drawer-alert-warning > svg { color: var(--warning); }
.stage-badge-paid i { background: var(--success); }
.stage-badge-lost i { background: var(--danger); }
.stage-badge-parked i { background: var(--warning); }
.save-state.is-error { color: var(--danger-dark); }
.save-state.is-error svg { color: var(--danger); }

/* Кроки: у прототипі показано лише прострочений крок, тому базовий вигляд
   .step-card червоний. Звичайний і сьогоднішній крок отримують спокійні кольори. */
.step-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.step-card:not(.step-card-overdue) { border-color: var(--line); background: var(--surface-raised); }
.step-card:not(.step-card-overdue) .step-date { border-color: var(--line); color: var(--ink-soft); }
.step-card:not(.step-card-overdue) .step-state { color: var(--ink-soft); }
.step-card-today { border-color: #ccd4f3; background: var(--cobalt-pale); }
.step-card-today .step-date { border-color: #ccd4f3; color: var(--cobalt-dark); }
.step-card-today .step-state { color: var(--cobalt-dark); }
.step-card-empty { display: block; padding: 14px 16px; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--muted); background: var(--surface-raised); font-size: 11px; }
.step-copy .step-state { order: -1; }
.step-copy strong { white-space: normal; }
.step-inline { position: relative; }
.step-inline summary { list-style: none; }
.step-inline summary::-webkit-details-marker { display: none; }
.step-inline[open] summary { border-color: #b4c0ef; color: var(--cobalt-dark); background: var(--cobalt-pale); }
.step-popover {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 5;
  display: grid; gap: 10px; width: 280px; padding: 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-float);
}
.step-popover .button { justify-self: end; }
.add-step .field-span-2 { grid-column: 1 / -1; }

/* Джерело у шухляді: поточне значення стоїть першим пунктом селекта. */
.drawer-field-grid select[name="source_id"] { max-width: 100%; }

/* Перетягування через SortableJS: класи з прототипу плюс привид. */
.deal-card.is-ghost { opacity: 0.35; border-style: dashed; }
.deal-card.is-drag-image { transform: rotate(1.2deg); }

/* Пошук: результати приходять з сервера як список посилань. */
.search-results:not([hidden]) { display: block; }

/* Історія: тип події як заголовок, тіло переноситься повністю. */
.timeline p { overflow-wrap: anywhere; }

/* Форма створення: textarea суті вирівняна з рештою полів. */
.create-form textarea { min-height: 78px; }

/* Пʼять колонок на ноутбуці 1440 px без горизонтальної прокрутки: ширина
   рахується від вікна, але не вужча за 248 і не ширша за 288 px прототипу. */
.column { width: clamp(248px, calc((100vw - 96px) / 5), 288px); }

/* Назви стадій у базі в нижньому регістрі (їх звіряють тести і бот),
   у заголовках показуємо з великої літери. */
.column-header h2::first-letter, .stage-badge::first-letter, .filter-chip::first-letter { text-transform: uppercase; }

/* Частина 2: графік оплат у картці (редагування). Дата й умова етапу -
   два окремих поля в одній комірці таблиці, кожне зі своїм hx-post. */
.payment-condition { display: grid; gap: 6px; }

/* Дії рядка (Виставлено/Сплачено/Скасувати) переносяться, якщо не влазять
   в один рядок - на вузькому вікні комірка звужується разом з колонкою. */
.payment-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* Порожній стан графіка (угода без жодного етапу): та сама коробка, що і
   .step-card-empty у списку кроків, але без прив'язки до тега li, бо тут не
   список, а таблиця. */
.drawer-section-empty { padding: 14px 16px; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--muted); background: var(--surface-raised); font-size: 11px; }

/* Кнопка форми додавання етапу - на всю ширину сітки і притиснута вправо,
   як і решта кнопок-сабмітів картки. */
.add-payment .add-step-button { grid-column: 1 / -1; }

/* Частина 3, Task 2: дашборд (/dashboard). Ті самі кольори й типографіка
   Кодекса, без бібліотек графіків - смуга воронки лише CSS-заливка, ширину
   для якої вважає Python (stats.funnel: share як % від найбільшої стадії),
   а не JS чи CSS. */
.dashboard-content { display: grid; gap: 20px; max-width: 1080px; margin: 0 auto; padding: 24px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat-card { display: grid; gap: 8px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--shadow-card); }
.stat-card strong { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }

/* Смуга воронки: блідий кобальт як фон, насичений - як заповнення. Ширина
   заповнення - inline-стиль --w з Python (частка від найбільшої стадії),
   кожен рядок має власне значення, тому в CSS лише width: var(--w). */
.bar { height: 8px; border-radius: 999px; background: var(--cobalt-pale); overflow: hidden; }
.bar > i { display: block; height: 100%; width: var(--w); background: var(--cobalt); }

/* Приглушений текст там, де дані неповні (без суми) чи рядок "без джерела"
   у конверсії - той самий сигнал, що і .drawer-section-empty: не помилка,
   а прогалина в довіднику. */
.muted { color: var(--muted); }

/* Таблиці конверсії ширші за типові 550px через додаткові стовпці (тип,
   дата заходу): без цього по джерелах уже на ноутбучному екрані була б
   зайва горизонтальна прокрутка. */
.conv-table { min-width: 760px; }

/* Частина 5, Task 4: тренди по місяцях. Число і смуга живуть в одній
   числовій клітинці, а не окремою колонкою, як частка у воронці (блок 02) -
   тут три метрики в рядку, і три додаткові колонки під самі лише смуги не
   влізли б без зайвої ширини таблиці. Той самий .bar/.bar > i трек+
   заповнення, що і в блоці 02: одна CSS-мова прогрес-бару на обидві
   таблиці, а не друга копія поруч. */
.trend-cell { display: flex; align-items: center; gap: 8px; }
.trend-cell .bar { width: 56px; flex: none; }

/* Частина 4, Task 2 (гігієна даних): третій лічильник у рядку ризиків -
   "без джерела". Нейтральний сірий, а не danger/warning: відсутність
   джерела в довіднику - прогалина в даних, а не ризик по угоді, як
   прострочення чи відсутній крок. */
.signal-muted { background: var(--muted); }

/* Нотатка з веба над стрічкою історії картки (design-web-ui-part4-2026-09.md,
   блок 1): той самий пунктирний контейнер, що .add-step, але один рядок -
   поле тексту і кнопка «Записати» без дати чи відповідального. Клас кнопки
   лишається .add-step-button (вирівнювання justify-self/align-self: end),
   заводити окремий модифікатор лише для цього немає сенсу. */
.add-note {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: #fbfcfb;
}

/* Частина 4, Task 4: сторінка оплат (/payments). Прострочений рядок -
   приглушено-червоний фон і колір тексту, той самий тон, що і
   .drawer-alert-warning для попереджень, лише як фон рядка таблиці: колонка
   "Дата або умова" і так показує дату в минулому, підсвітка рядка лише
   прискорює, що впадає в очі першим. */
.is-overdue { background: var(--danger-pale); }
.is-overdue td { color: var(--danger-dark); }

/* Підсумок по валютах під інтро сторінки і під кожним місяцем - однаковий
   вигляд скрізь (currency_totals у payments.html), тому один клас, а не
   дублювання inline-стилів по кількох місцях шаблону. */
.payments-totals { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.payments-totals strong { color: var(--ink); font-family: var(--font-data); }

/* --- /batches (частина 5) --- */

/* Одна картка пакета в черзі - той самий рецепт, що .stat-card (рамка,
   радіус, тінь картки), але з власним внутрішнім рітмом (шапка, превʼю,
   кнопки), тому окремий клас, а не перевикористання .stat-card. */
.batch-card {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

/* Пошкоджений пакет (read_batch повернув None - зіпсований JSON) не показує
   превʼю взагалі, лише рядок з ідентифікатором: приглушено-червоний фон, той
   самий тон, що .is-overdue на /payments, одразу сигналізує "з цим щось не
   так", ще до читання тексту. */
.batch-card-broken {
  border-color: var(--danger-pale);
  background: var(--danger-pale);
}

.batch-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* Протух понад добу (batches.is_expired, TTL_HOURS=24) - той самий тон
   danger, що і решта тривожних позначок сторінки: кнопка "Застосувати" для
   такого пакета в розмітці взагалі не рендериться (не просто disabled), тому
   позначка - єдиний сигнал власнику, чому кнопки немає. */
.batch-expired-mark {
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--danger-dark);
  background: var(--danger-pale);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

/* Превʼю - той самий текст, що власник бачить у Telegram
   (batch_flow.render_preview): моноширинний шрифт зберігає відступи
   групування по угодах, а обмежена висота з прокруткою не дає одному
   великому пакету (десяток угод одним диктантом) розтягнути сторінку нижче
   решти черги. */
.batch-preview {
  max-height: 260px;
  margin: 0;
  padding: 12px 14px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-raised);
  color: var(--ink-soft);
  font-family: var(--font-data);
  font-size: 11px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.batch-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Рапорт після POST /batches/{id}/apply - той самий текст, що бот шле в
   Telegram (BATCH_APPLIED + lines + BATCH_PARTIAL), лише зверху сторінки
   замість повідомлення в чаті. */
.batch-report {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-raised);
  font-size: 12px;
}

.batch-report p { margin: 0; }

/* --- гарячі клавіші і тост (частина 5) --- */
/* У "/" і "n" немає власного вигляду - лише фокус і навігація в app.js.
   Тост нижче - однорядкове службове повідомлення "Збережено" внизу екрана.

   Клас .toast тут навмисно збігається з .toast/.toast-viewport вище (порт
   візуальної системи Кодекса, cfdc048): та пара ніде в застосунку не
   задіяна (інший вигляд - картка вгорі праворуч з іконкою), і прибирати
   чужий незадіяний шматок дизайн-системи - поза межами цієї задачі.
   #toast.toast нижче за файлом і специфічніший (id+клас проти голого
   класу), тому явно перекриває кожну властивість старого правила (включно
   з animation - інакше стара toast-in наклалась би на власний перехід
   нижче), а не покладається на порядок джерела, який легко переплутати
   при наступному редагуванні файлу. */
#toast.toast {
  display: block;
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: var(--z-toast);
  min-height: 0;
  margin: 0;
  padding: 10px 20px;
  border: 0;
  border-radius: 999px;
  max-width: calc(100vw - 40px);
  color: #fff;
  background: var(--ink);
  box-shadow: var(--shadow-float);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  animation: none;
  transform: translate(-50%, 8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease-out, transform 180ms ease-out;
}

/* [hidden] { display: none !important } (правило на початку файлу) завжди
   перемагає display: block вище, поки атрибут hidden не знято - is-visible
   лише про плавну появу вже показаного контейнера. */
#toast.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* --- Джерела лідів v2 (Task 3): тип + вільне уточнення --- */

/* card.html: .source-control комбінує select (тип) і input (уточнення) в
   один рядок, за зразком .compound-control (сума/валюта) вище, але в
   зворотному порядку елементів - там спершу input, тут спершу select.
   .compound-control закладає скруглення країв за ТЕГОМ (input зліва,
   select справа), тому проста заміна порядку в розмітці зламала б кут без
   власної пари правил тут. */
.source-control {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
}

.source-control select {
  border-right: 0;
  border-radius: var(--radius-control) 0 0 var(--radius-control);
  background: #f7f9f8;
}

.source-control input {
  border-radius: 0 var(--radius-control) var(--radius-control) 0;
}

/* sources.html: перелік згрупований по шести універсальних джерелах -
   заголовок групи (підпис базового запису типу) над власною таблицею
   базового рядка і уточнень. */
.source-group {
  margin-bottom: 24px;
}

.source-group:last-child {
  margin-bottom: 0;
}

.source-group-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: -0.01em;
}
