:root {
  color-scheme: light;
  font: 16px/1.5 system-ui, sans-serif;
  color: #062714;
  background: #f3f4ed;
}
* { box-sizing: border-box; }
body { margin: 0; }
header {
  background: #062714;
  color: #f3f4ed;
  padding: 16px max(16px, calc((100% - 960px) / 2));
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
header strong { letter-spacing: .12em; margin-right: 10px; }
header span { color: #d6e4d9; }
header a { color: #e5fab2; }
.crm-notification:not([hidden]) {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 8px clamp(14px, 2.5vw, 34px);
  background: #f5e7db;
  border-bottom: 1px solid #91512d;
  color: #18211d;
  font-weight: 650;
}
.crm-notification button { background: #91512d; color: #fff; border-color: #91512d; }
main { max-width: 992px; margin: 0 auto; padding: 26px 16px 56px; }
h1 { font-size: clamp(1.9rem, 5vw, 3rem); line-height: 1.1; margin: 8px 0 24px; }
h2 { font-size: 1.15rem; margin: 0; overflow-wrap: anywhere; }
p { margin: 6px 0; overflow-wrap: anywhere; }
a { color: #155735; text-underline-offset: .18em; }
.environment, .time { color: #466353; font-size: .875rem; }
.login, .controls, .lead, .empty {
  background: #fff;
  border: 1px solid #d7e0d6;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
}
.login { max-width: 400px; }
.lead { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 18px; }
.phone { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
form { min-width: 0; }
label { display: grid; gap: 4px; margin-bottom: 12px; font-weight: 600; }
input, select, textarea, button { font: inherit; min-height: 44px; }
input, select, textarea {
  width: 100%;
  background: #fff;
  color: inherit;
  border: 1px solid #80968a;
  padding: 8px 10px;
  border-radius: 8px;
}
textarea { resize: vertical; }
button {
  cursor: pointer;
  border: 1px solid #062714;
  background: #c8f34a;
  color: #062714;
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 650;
}
button.subtle { background: #f4f7ee; }
button:hover { filter: brightness(.96); }
:focus-visible { outline: 3px solid #27874c; outline-offset: 3px; }
.controls { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; }
.success, [role="alert"] { padding: 8px 12px; border-radius: 8px; margin-bottom: 16px; }
.success { background: #e1f1dc; }
[role="alert"] { background: #f9e5df; color: #7a2b17; }
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.workspace { max-width: 1660px; }
.crm-shell { display: grid; grid-template-columns: 174px minmax(0, 1fr); min-height: calc(100vh - 76px); }
.crm-shell main { width: 100%; min-width: 0; padding-inline: clamp(12px, 2vw, 28px); }
.crm-shell h1 { font-size: clamp(1.75rem, 3.2vw, 2.6rem); }
body:has(.crm-shell) > header { padding-inline: clamp(14px, 2.5vw, 34px); }
.account { display: flex; align-items: center; gap: 12px; }
.account span { font-size: .9rem; }
.crm-sidebar { background: #e3eadc; border-right: 1px solid #cad7c8; padding: 20px 12px; align-content: start; display: grid; gap: 5px; }
.crm-sidebar a { display: block; min-height: 44px; padding: 10px 9px; text-decoration: none; border-radius: 7px; color: #234837; font-size: .9rem; }
.crm-sidebar a:hover { background: #d4e1d1; }
.crm-sidebar a[aria-current="page"] { background: #062714; color: #f3f4ed; font-weight: 650; }
.crm-sidebar a[href="/crm"][aria-current="page"] { background-color: #91512D; }
.car-queue { max-width: 38rem; }
.crm-toolbar, .crm-search, .access-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.crm-toolbar { margin-bottom: 18px; gap: 12px 20px; }
.crm-search input { width: min(51vw, 290px); }
.access-settings summary { cursor: pointer; min-height: 44px; padding-block: 10px; }
.access-actions { margin-bottom: 8px; }
.back { display: inline-block; padding: 8px 0; margin-bottom: 10px; }
.pipeline {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(135px, 1fr);
  align-items: start;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 12px;
}
.lane {
  --stage-color: #81988a;
  border-top: 4px solid var(--stage-color);
  background: #e9ede5;
  border-radius: 10px;
  padding: 10px;
  min-height: 146px;
  display: grid;
  align-content: start;
  gap: 8px;
}
.lane[data-stage="new"] { --stage-color: #6ab1a2; }
.lane[data-stage="working"] { --stage-color: #c1a95d; }
.lane[data-stage="car_search"] { --stage-color: #9a85ae; }
.lane[data-stage="preparing"] { --stage-color: #7f9d4a; }
.lane[data-stage="review"] { --stage-color: #8295ba; }
.lane[data-stage="approved"] { --stage-color: #589778; }
.lane[data-stage="funded"] { --stage-color: #277343; }
.lane h2 { font-size: .94rem; line-height: 1.25; min-height: 38px; }
.lane h2 span { color: #466353; font-size: .8rem; margin-left: 3px; font-variant-numeric: tabular-nums; }
.lane-empty, .ticket-label { color: #466353; font-size: .78rem; }
.pipeline .lane { min-height: 210px; }
.pipeline .drop-target { outline: 2px solid #27874c; outline-offset: -2px; background: #e0efda; }
.move-feedback { margin: 0 0 12px; padding: 8px 12px; background: #e1eddf; border-radius: 8px; }
.ticket { background: white; border: 1px solid #d7e0d6; border-radius: 8px; }
.ticket[draggable=true], .ticket[draggable=true] .ticket-link { cursor: grab; }
.ticket.in-transit { opacity: .45; }
.ticket-link { display: grid; gap: 2px; padding: 10px; color: inherit; text-decoration: none; }
.ticket-link:hover strong { text-decoration: underline; }
.ticket-link strong { overflow-wrap: anywhere; }
.ticket-phone { font-size: .9rem; font-variant-numeric: tabular-nums; }
.ticket .time { font-size: .75rem; }
.primary-link { border: 1px solid #062714; border-radius: 8px; background: #c8f34a; color: #062714; font-weight: 650; padding: 9px 14px; text-decoration: none; }
.deal-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); align-items: start; gap: 16px; }
.deal-data { grid-template-columns: minmax(0, 1fr); gap: 16px; }
.amounts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.deal-panel { background: #fff; border: 1px solid #d7e0d6; border-radius: 14px; padding: 16px; margin-bottom: 12px; }
.deal-panel h2 { margin-bottom: 10px; }
.activity-actions details { border: 1px solid #d7e0d6; border-radius: 8px; padding: 0 10px; margin: 8px 0; }
.activity-actions summary { cursor: pointer; font-weight: 650; min-height: 44px; padding: 10px 0; }
.activity-actions form { padding: 4px 0 12px; }
.table-scroll { overflow-x: auto; border: 1px solid #d7e0d6; border-radius: 12px; background: #fff; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { border-bottom: 1px solid #d7e0d6; padding: 10px 14px; white-space: nowrap; }
th { background: #e9ede5; }
tr:last-child td { border-bottom: 0; }
.history, .task-list { padding: 0; margin: 0 0 14px; list-style: none; }
.history li { padding: 10px 0 10px 12px; border-left: 2px solid #adc6ae; }
.history li p { white-space: pre-wrap; }
.event-meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 12px; }
.event-meta strong { font-size: .9rem; }
.task-list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; background: #e9ede5; padding: 10px; border-radius: 8px; margin: 8px 0; }
.late { color: #8a3427; font-size: .8rem; }
.contact-card:target { outline: 2px solid #27874c; }
.confirm-removal { display: flex; align-items: center; gap: 8px; }
.confirm-removal input { width: 18px; min-height: 24px; }
@media (max-width: 740px) { .board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .crm-shell { grid-template-columns: minmax(0, 1fr); }
  .crm-sidebar { display: flex; flex-wrap: wrap; gap: 2px 5px; padding: 6px 10px; border-right: 0; border-bottom: 1px solid #cad7c8; }
  .crm-sidebar a { display: inline-block; padding-inline: 8px; }
}
@media (max-width: 560px) {
  .lead, .board { grid-template-columns: minmax(0, 1fr); }
  .lead button, .login button { width: 100%; }
  .pipeline { grid-auto-flow: row; grid-template-columns: minmax(0, 1fr); }
  .lane { min-height: 0; }
  .pipeline .lane { min-height: 0; }
  .lane h2 { min-height: 0; }
  .deal-columns, .amounts { grid-template-columns: minmax(0, 1fr); }
}
