:root {
  --bg: #f3f5f7;
  --bg-deep: #e7ecef;
  --panel: #ffffff;
  --ink: #15202b;
  --muted: #667788;
  --line: #d9e1e8;
  --sales: #1f6f8b;
  --sales-soft: #e5f3f8;
  --prod: #2f6b4f;
  --prod-soft: #e7f3ec;
  --alert: #c0392b;
  --alert-soft: #fdeceb;
  --warn: #c56a17;
  --warn-soft: #fff3e6;
  --shadow: 0 1px 0 rgba(21,32,43,.04), 0 12px 28px rgba(21,32,43,.06);
  --radius: 16px;
  --font: "Geologica", "Manrope", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    linear-gradient(180deg, rgba(255,255,255,.55), transparent 220px),
    repeating-linear-gradient(90deg, transparent, transparent 47px, rgba(21,32,43,.025) 47px, rgba(21,32,43,.025) 48px),
    repeating-linear-gradient(0deg, transparent, transparent 47px, rgba(21,32,43,.025) 47px, rgba(21,32,43,.025) 48px);
  display: flex;
  min-height: 100vh;
}

a { color: var(--sales); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ——— Shell (drill-down nav) ——— */
.app-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
}

.app-chrome {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  background: rgba(16, 24, 32, .94);
  color: #d7e0e8;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.chrome-left, .chrome-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.chrome-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease, transform .15s ease;
}
.chrome-back:hover { background: rgba(255,255,255,.18); text-decoration: none; transform: translateX(-1px); }
.chrome-back-arrow { font-size: 16px; line-height: 1; }
.chrome-sep {
  width: 1px; height: 24px;
  background: rgba(255,255,255,.14);
  flex-shrink: 0;
}
.chrome-brand {
  display: flex; align-items: center; gap: 10px;
  color: #fff; text-decoration: none; min-width: 0;
}
.chrome-brand:hover { text-decoration: none; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.18), transparent 50%),
    linear-gradient(135deg, #2f6b4f, #1f6f8b);
  display: grid; place-items: center;
  font-weight: 800; color: #fff; letter-spacing: .04em;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.2);
  flex-shrink: 0;
}
.brand-mark-sm { width: 36px; height: 36px; border-radius: 10px; font-size: 13px; }
.chrome-brand-text {
  display: flex; flex-direction: column; min-width: 0; line-height: 1.2;
}
.chrome-brand-text strong {
  font-size: 15px; letter-spacing: -.02em;
}
.chrome-crumb {
  font-size: 12px; opacity: .62;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 42vw;
}
.chrome-bell {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px;
  color: #c9d5df; text-decoration: none;
  background: rgba(255,255,255,.06);
}
.chrome-bell:hover { color: #fff; text-decoration: none; background: rgba(255,255,255,.12); }
.chrome-bell .badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; padding: 1px 5px; font-size: 10px;
}
.chrome-user {
  display: flex; flex-direction: column; align-items: flex-end;
  line-height: 1.2; padding: 0 4px;
}
.chrome-user strong { color: #fff; font-size: 13px; }
.chrome-user span { font-size: 11px; opacity: .6; }
.chrome-logout {
  background: none; border: 1px solid rgba(255,255,255,.16);
  color: #8ea0b0; cursor: pointer; font: inherit;
  padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
}
.chrome-logout:hover { color: #fff; border-color: rgba(255,255,255,.35); }

.badge {
  background: #e07a3d; color: #fff; border-radius: 999px;
  padding: 2px 8px; font-size: 11px; font-weight: 700; min-width: 20px; text-align: center;
}
.badge.alert { background: var(--alert); }

.main { flex: 1; min-width: 0; padding: 22px 28px 48px; max-width: 1280px; width: 100%; margin: 0 auto; }
.main-full {
  max-width: 440px; margin: 10vh auto; padding: 24px;
  background: transparent;
}
.app-shell.is-menu-hub .main { max-width: 1080px; }

/* ——— Menu hub ——— */
.menu-hub { padding: 6px 0 32px; }
.menu-hub-intro { margin-bottom: 28px; }
.menu-hub-kicker {
  margin: 0 0 8px;
  font-size: 13px; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase; color: var(--sales);
}
.menu-hub-intro h2 {
  margin: 0 0 10px;
  font-size: clamp(32px, 5vw, 48px);
  letter-spacing: -.045em; font-weight: 800; line-height: 1.05;
}
.menu-hub-hint {
  margin: 0; max-width: 46ch; line-height: 1.5;
  font-size: 16px; color: var(--muted);
}
.menu-hub-hint strong { color: var(--ink); font-weight: 700; }

.menu-room {
  margin-bottom: 20px;
  padding: 20px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.72);
  box-shadow: var(--shadow);
}
.menu-room-sales {
  background:
    linear-gradient(145deg, rgba(31,111,139,.08), rgba(255,255,255,.9) 42%),
    #fff;
  border-color: #b9d4e0;
}
.menu-room-prod {
  background:
    linear-gradient(145deg, rgba(47,107,79,.09), rgba(255,255,255,.9) 42%),
    #fff;
  border-color: #b7d6c5;
}
.menu-room-settings {
  background: #f7f9fb;
}
.menu-room-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.menu-room-badge {
  display: inline-block;
  font-size: 11px; font-weight: 800;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 4px;
}
.menu-room-sales .menu-room-badge { color: var(--sales); }
.menu-room-prod .menu-room-badge { color: var(--prod); }
.menu-room-head h3 {
  margin: 0;
  font-size: clamp(22px, 3vw, 28px);
  letter-spacing: -.03em; font-weight: 800;
}
.menu-room-head p {
  margin: 4px 0 0;
  color: var(--muted); font-size: 15px; line-height: 1.35;
}

.menu-grid {
  display: grid;
  gap: 12px;
}
.menu-grid-1 { grid-template-columns: 1fr; }
.menu-grid-2 { grid-template-columns: 1fr 1fr; }

.menu-btn {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  min-height: 112px;
  padding: 22px 22px 22px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(21,32,43,.03);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.menu-btn:hover {
  transform: translateY(-3px);
  border-color: #9eb4c4;
  text-decoration: none;
  box-shadow: 0 14px 28px rgba(21,32,43,.1);
}
.menu-btn:focus-visible {
  outline: 3px solid rgba(31,111,139,.45);
  outline-offset: 2px;
}
.menu-btn-sales {
  background: linear-gradient(180deg, #f4fafc, #fff);
  border-color: #c5dde7;
}
.menu-btn-prod {
  background: linear-gradient(180deg, #f3faf6, #fff);
  border-color: #c5ddcf;
}
.menu-btn-alert {
  background: linear-gradient(180deg, #fff6f4, #fff);
  border-color: #f0c2bc;
}
.menu-btn.is-start {
  border-width: 2px;
  border-color: #2f6b4f;
  box-shadow: inset 0 0 0 1px rgba(47,107,79,.12), 0 10px 24px rgba(47,107,79,.12);
}
.menu-room-sales .menu-btn.is-start { border-color: var(--sales); }

.menu-start-tag {
  position: absolute;
  top: 10px; right: 12px;
  font-size: 11px; font-weight: 800;
  letter-spacing: .04em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px;
  background: #2f6b4f; color: #fff;
}
.menu-room-sales .menu-start-tag { background: var(--sales); }

.menu-btn-ico {
  width: 64px; height: 64px; border-radius: 16px;
  display: grid; place-items: center;
  font-size: 28px; font-weight: 700;
  background: #eef2f5; color: var(--ink);
  flex-shrink: 0;
}
.menu-btn-sales .menu-btn-ico { background: #d9eef6; color: var(--sales); }
.menu-btn-prod .menu-btn-ico { background: #d8efe3; color: var(--prod); }
.menu-btn-alert .menu-btn-ico { background: #fde2de; color: var(--alert); }

.menu-btn-text {
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
  padding-right: 4px;
}
.menu-btn-title {
  font-size: clamp(20px, 2.4vw, 24px);
  font-weight: 800; letter-spacing: -.03em; line-height: 1.15;
}
.menu-btn-sub {
  font-size: 15px; color: var(--muted); line-height: 1.35;
}

.menu-btn-go {
  align-self: center;
  font-size: 14px; font-weight: 800;
  color: var(--sales);
  white-space: nowrap;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--sales-soft);
}
.menu-btn-prod .menu-btn-go,
.menu-btn-alert .menu-btn-go { color: var(--prod); background: var(--prod-soft); }
.menu-btn-alert .menu-btn-go { color: var(--alert); background: var(--alert-soft); }
.menu-btn:hover .menu-btn-go { filter: brightness(.97); }

.menu-btn-count {
  min-width: 44px; height: 44px; padding: 0 12px;
  border-radius: 999px;
  display: grid; place-items: center;
  background: #e07a3d; color: #fff;
  font-size: 18px; font-weight: 800;
  font-family: var(--mono);
}
.menu-btn-count.alert { background: var(--alert); }

@media (prefers-reduced-motion: reduce) {
  .menu-btn, .menu-btn:hover { transition: none; transform: none; }
}

.topbar {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 20px;
}
.topbar-copy { min-width: 0; }
.topbar h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: -.03em;
  font-weight: 800;
}
.topbar .lede {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
  max-width: 52ch;
  line-height: 1.45;
}
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.content { display: flex; flex-direction: column; gap: 16px; }

/* ——— Surfaces ——— */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.panel-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; margin-bottom: 14px;
}
.panel h2, .panel h3 { margin: 0 0 12px; letter-spacing: -.02em; }
.panel-head h2, .panel-head h3 { margin: 0; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

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

/* ——— Home / action tiles ——— */
.home-hero {
  display: grid;
  grid-template-columns: 1.4fr .9fr;
  gap: 16px;
}
.home-primary {
  background:
    linear-gradient(145deg, rgba(255,255,255,.55), transparent 40%),
    linear-gradient(160deg, #163528 0%, #1f6f8b 100%);
  color: #fff;
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  min-height: 200px;
}
.home-primary::after {
  content: "";
  position: absolute; right: -40px; top: -40px;
  width: 180px; height: 180px; border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.home-primary h2 { margin: 0 0 8px; font-size: 26px; position: relative; }
.home-primary p { margin: 0 0 18px; opacity: .85; max-width: 40ch; position: relative; }
.home-primary .btn { position: relative; }
.home-stack { display: grid; gap: 12px; }
.action-tile {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease;
}
.action-tile:hover { transform: translateY(-1px); text-decoration: none; border-color: #b7c6d2; }
.action-tile .t-title { font-weight: 800; font-size: 16px; }
.action-tile .t-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.action-tile .t-count {
  font-family: var(--mono);
  font-size: 28px; font-weight: 700; letter-spacing: -.04em;
}
.action-tile.alert { background: var(--alert-soft); border-color: #f0c2bc; }
.action-tile.alert .t-count { color: var(--alert); }
.action-tile.sales { background: var(--sales-soft); border-color: #c5dde7; }
.action-tile.prod { background: var(--prod-soft); border-color: #c5ddcf; }

.kpi {
  padding: 16px 18px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.kpi .label { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi .value {
  font-family: var(--mono);
  font-size: 30px; font-weight: 700; margin-top: 8px; letter-spacing: -.04em;
}
.kpi.danger { background: var(--alert-soft); border-color: #f0c2bc; }
.kpi.danger .value { color: var(--alert); }
.kpi.warn { background: var(--warn-soft); border-color: #f0d2ad; }
.kpi.warn .value { color: var(--warn); }

/* ——— Controls ——— */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 11px 16px;
  font-weight: 700; font-size: 14px; cursor: pointer;
  text-decoration: none; font-family: inherit; white-space: nowrap;
}
.btn:hover { text-decoration: none; filter: brightness(1.04); }
.btn-primary { background: var(--prod); color: #fff; }
.btn-sales { background: var(--sales); color: #fff; }
.btn-secondary { background: #e8eef3; color: var(--ink); }
.btn-danger { background: var(--alert); color: #fff; }
.btn-warm { background: #d9772f; color: #fff; }
.btn-ghost { background: transparent; border: 1px solid rgba(255,255,255,.35); color: #fff; }
.btn-lg { padding: 16px 20px; font-size: 16px; min-height: 56px; border-radius: 14px; }
.btn-block { width: 100%; }

label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 6px; color: var(--muted); letter-spacing: .02em; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px;
  font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(31,111,139,.25); border-color: var(--sales);
}
textarea { min-height: 90px; resize: vertical; }
.form-row { margin-bottom: 12px; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }

.alert {
  padding: 12px 14px; border-radius: 12px; margin-bottom: 4px; font-weight: 600;
  animation: slideIn .25s ease;
}
.alert.ok { background: var(--prod-soft); color: var(--prod); }
.alert.err { background: var(--alert-soft); color: var(--alert); }
.alert ul { margin: 0; padding-left: 18px; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.pill {
  display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px;
  background: #e8eef3; font-size: 12px; font-weight: 700;
}
.pill.red { background: var(--alert-soft); color: var(--alert); }
.pill.green { background: var(--prod-soft); color: var(--prod); }
.pill.orange { background: var(--warn-soft); color: var(--warn); }
.pill.blue { background: var(--sales-soft); color: var(--sales); }

.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: end;
  padding: 4px 0;
}
.filters .form-row { margin: 0; min-width: 150px; }

/* ——— Order card redesign ——— */
.order-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}
.order-hero {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 16px;
}
.order-hero-top {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  align-items: flex-start;
}
.order-num {
  font-family: var(--mono);
  font-size: 34px; font-weight: 700; letter-spacing: -.04em; margin: 0;
}
.order-stage-now {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 10px; padding: 8px 12px; border-radius: 999px;
  background: var(--prod-soft); color: var(--prod); font-weight: 800;
}
.money-block { text-align: right; }
.money-block .sum {
  font-family: var(--mono); font-size: 28px; font-weight: 700; letter-spacing: -.03em;
}
.route-track {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 18px;
}
.route-step {
  padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: #eef2f5; color: var(--muted);
}
.route-step.done { background: #dcefe4; color: var(--prod); }
.route-step.now {
  background: var(--prod); color: #fff;
  box-shadow: 0 0 0 3px rgba(47,107,79,.18);
}
.route-step.todo { opacity: .7; }

.order-aside {
  position: sticky; top: 18px;
  display: grid; gap: 12px;
}
.aside-action {
  background: #163528; color: #fff; border-radius: 18px; padding: 18px;
  box-shadow: var(--shadow);
}
.aside-action h3 { margin: 0 0 6px; color: #fff; }
.aside-action p { margin: 0 0 14px; opacity: .75; font-size: 13px; }
.aside-action label { color: rgba(255,255,255,.65); }
.aside-action select, .aside-action input, .aside-action textarea {
  background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: #fff;
}
.aside-action option { color: #15202b; }

.section-nav {
  display: flex; gap: 6px; flex-wrap: wrap;
  background: #e8eef3; padding: 6px; border-radius: 14px; margin-bottom: 14px;
}
.section-nav .tab {
  border: 0; background: transparent; cursor: pointer;
  padding: 10px 14px; border-radius: 10px;
  font-weight: 700; font-size: 13px; color: var(--muted); font-family: inherit;
}
.section-nav .tab.active {
  background: #fff; color: var(--ink);
  box-shadow: 0 1px 3px rgba(21,32,43,.08);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: .4; } to { opacity: 1; } }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
  padding: 12px 0 12px 16px;
  border-left: 3px solid var(--line);
  margin-left: 8px;
}
.timeline li strong { display: block; }
.timeline .when { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ——— Kanban ——— */
.kb-hero {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  align-items: flex-end; margin-bottom: 14px;
  padding: 18px 20px; border-radius: 18px;
  background: linear-gradient(135deg, #1a3d32 0%, #2f6b4f 55%, #1f6f8b 100%);
  box-shadow: var(--shadow);
}
.kb-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.kb-stat {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18);
  border-radius: 12px; padding: 8px 12px; min-width: 70px; color: #fff;
}
.kb-stat span { display: block; font-size: 10px; font-weight: 700; opacity: .8; text-transform: uppercase; letter-spacing: .04em; }
.kb-stat strong { font-size: 20px; letter-spacing: -.03em; }
.kb-stat.alert { background: rgba(200,70,50,.35); }

.kb-toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between;
  align-items: center; margin-bottom: 12px;
}
.kb-filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.kb-filters input[type="text"],
.kb-filters input:not([type]),
.kb-filters select {
  padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; font: inherit; font-weight: 600; font-size: 13px;
  min-width: 0;
}
.kb-filters input[name="search"] { min-width: 140px; }
.kb-check {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer;
  background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px;
}
.kb-check input { margin: 0; }
.kb-type-pills {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px;
}
.kb-pill {
  text-decoration: none; font-weight: 700; font-size: 13px;
  padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--ink);
}
.kb-pill.active { background: var(--prod); color: #fff; border-color: var(--prod); }

.kanban {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 280px);
  gap: 12px; overflow-x: auto; padding: 4px 2px 16px; align-items: start;
  scroll-snap-type: x proximity;
}
.kanban-col {
  background: #eef2f4; border: 1px solid var(--line);
  border-radius: 16px; padding: 0; min-height: 320px;
  display: flex; flex-direction: column; max-height: calc(100vh - 220px);
  scroll-snap-align: start;
}
.kanban-col.prod { background: #e8f3ec; border-color: #c5ddcf; }
.kanban-col.pre { background: #eef3f7; }
.kanban-col.orphan { background: #f7f0e8; }
.kanban-col.has-problems { box-shadow: inset 0 0 0 1px rgba(200,70,50,.25); }
.kanban-col-head {
  display: flex; justify-content: space-between; gap: 8px; align-items: flex-start;
  padding: 12px 12px 8px; position: sticky; top: 0; z-index: 2;
  background: inherit; border-radius: 16px 16px 0 0;
}
.kanban-col-head h3 {
  margin: 0; font-size: 13px; color: var(--ink);
  text-transform: none; letter-spacing: -.01em; font-weight: 800;
}
.kb-col-meta { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; }
.kb-col-count {
  font-weight: 800; font-size: 18px; font-family: var(--mono);
  display: flex; align-items: center; gap: 4px;
}
.kb-col-hot {
  background: #c0392b; color: #fff; font-size: 11px; border-radius: 999px;
  padding: 2px 6px; font-family: var(--sans, inherit);
}
.kanban-col-body { padding: 0 10px 12px; overflow-y: auto; flex: 1; }
.kb-empty {
  text-align: center; color: var(--muted); font-size: 13px; font-weight: 600;
  padding: 24px 8px; border: 1px dashed #cfd8de; border-radius: 12px; background: rgba(255,255,255,.45);
}

.kb-card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 12px; margin-bottom: 10px; box-shadow: var(--shadow);
  border-left: 3px solid #9db7c4;
}
.kb-card.hot { border-left-color: #c0392b; background: linear-gradient(180deg, #fff8f7, #fff); border-color: #f0c2bc; }
.kb-card.waiting { border-left-color: #c56a17; }
.kb-card.no-draw { border-left-color: #d45a4a; }
.kb-card.prio { box-shadow: 0 0 0 1px rgba(200,70,50,.15), var(--shadow); }
.kb-card-top { display: flex; justify-content: space-between; gap: 6px; align-items: flex-start; }
.kb-num {
  font-family: var(--mono); font-weight: 800; font-size: 18px;
  color: inherit; text-decoration: none; letter-spacing: -.02em;
}
.kb-num:hover { color: var(--sales); }
.kb-card-title { font-weight: 700; font-size: 14px; margin-top: 4px; line-height: 1.25; }
.kb-card-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kb-card-facts {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px;
  font-size: 12px; font-weight: 700; color: var(--ink);
}
.kb-card-who { font-size: 11px; color: var(--muted); margin-top: 6px; font-weight: 600; }
.kb-card-actions {
  display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap;
}
.kb-card-actions .btn { flex: 1; justify-content: center; padding: 8px 10px; font-size: 13px; }
.kb-card-actions form { flex: 1; display: flex; }
.kb-card-actions form .btn { width: 100%; }

/* —— Problem orders —— */
.prob-hero {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  align-items: flex-end; margin-bottom: 14px;
  padding: 18px 20px; border-radius: 18px;
  background: linear-gradient(135deg, #5c1f1a 0%, #8b3a2f 45%, #a65d2f 100%);
  box-shadow: var(--shadow);
}
.prob-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.prob-stat {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2);
  border-radius: 12px; padding: 8px 12px; min-width: 78px; color: #fff;
  text-decoration: none;
}
.prob-stat span { display: block; font-size: 10px; font-weight: 700; opacity: .85; text-transform: uppercase; letter-spacing: .04em; }
.prob-stat strong { font-size: 20px; letter-spacing: -.03em; color: #fff; }
.prob-stat.active, .prob-stat:hover { background: rgba(255,255,255,.22); }

.prob-section { margin-bottom: 22px; }
.prob-sec-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.prob-sec-head h2 { margin: 0; font-size: 18px; }
.prob-list { display: flex; flex-direction: column; gap: 12px; }

.prob-card {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .9fr);
  gap: 0; background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; overflow: hidden; box-shadow: var(--shadow);
  border-left: 5px solid #d9772f;
}
.prob-card.sev-critical { border-left-color: #c0392b; }
.prob-card.sev-warning { border-left-color: #c56a17; }
.prob-card.sev-fresh { border-left-color: #b8952e; }
.prob-card-main { padding: 16px 18px; }
.prob-card-action {
  padding: 16px 18px; background: #faf6f4; border-left: 1px solid var(--line);
}
.prob-card-action h3 { margin: 0 0 4px; font-size: 15px; }
.prob-card-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.prob-num {
  font-family: var(--mono); font-size: 26px; font-weight: 800;
  text-decoration: none; color: inherit; letter-spacing: -.03em;
}
.prob-num:hover { color: var(--sales); }
.prob-title { font-weight: 700; margin-top: 2px; }
.prob-hours { text-align: right; }
.prob-hours strong { display: block; font-size: 28px; letter-spacing: -.04em; line-height: 1; color: #c0392b; }
.prob-hours span { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.prob-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.prob-links a { font-size: 13px; font-weight: 700; color: var(--sales); text-decoration: none; }
.prob-links a:hover { text-decoration: underline; }
.prob-extra { margin-top: 4px; }

/* —— People directory —— */
.people-hero {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  align-items: flex-end; margin-bottom: 14px;
  padding: 18px 20px; border-radius: 18px;
  background: linear-gradient(135deg, #1e3a5f 0%, #1f6f8b 55%, #2f8f6b 100%);
  box-shadow: var(--shadow);
}
.people-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.people-stat {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2);
  border-radius: 12px; padding: 8px 12px; min-width: 78px; color: #fff; text-decoration: none;
}
.people-stat span { display: block; font-size: 10px; font-weight: 700; opacity: .85; text-transform: uppercase; letter-spacing: .04em; }
.people-stat strong { font-size: 20px; color: #fff; letter-spacing: -.03em; }
.people-stat.active, .people-stat:hover { background: rgba(255,255,255,.22); }

.people-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px;
}
.people-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
  border-top: 3px solid #3a7ca5;
}
.people-card.room-production { border-top-color: #2f8f6b; }
.people-card.room-sales { border-top-color: #1f6f8b; }
.people-card.room-office { border-top-color: #5a6a7a; }
.people-card.off { opacity: .72; filter: grayscale(.25); }
.people-card-top { display: flex; gap: 12px; align-items: center; }
.people-avatar {
  width: 44px; height: 44px; border-radius: 14px;
  background: linear-gradient(145deg, #1f6f8b, #2f8f6b); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; letter-spacing: -.02em; flex-shrink: 0;
}
.people-avatar.lg { width: 72px; height: 72px; font-size: 24px; border-radius: 20px; }
.people-name { margin: 0; font-size: 17px; }
.people-name a { color: inherit; text-decoration: none; }
.people-name a:hover { color: var(--sales); }
.people-contacts { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.people-contacts a { color: var(--muted); text-decoration: none; font-weight: 600; }
.people-contacts a:hover { color: var(--sales); }

.people-profile-head {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px;
  align-items: center; margin-bottom: 16px;
  padding: 20px; border-radius: 18px; background: var(--panel);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.people-wl { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.people-wl-item {
  background: #f3f6f8; border-radius: 12px; padding: 8px 12px; min-width: 70px; text-align: center;
}
.people-wl-item span { display: block; font-size: 10px; font-weight: 800; color: var(--muted); text-transform: uppercase; }
.people-wl-item strong { font-size: 20px; letter-spacing: -.03em; }
.people-wl-item.hot strong { color: #c0392b; }
.people-row {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.people-row:last-child { border-bottom: 0; }

/* —— Product routes —— */
.route-hero {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  align-items: flex-end; margin-bottom: 14px;
  padding: 18px 20px; border-radius: 18px;
  background: linear-gradient(135deg, #1a3d32 0%, #2f6b4f 50%, #1f6f8b 100%);
  box-shadow: var(--shadow);
}
.route-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.route-stat {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2);
  border-radius: 12px; padding: 8px 12px; color: #fff; min-width: 78px;
}
.route-stat span { display: block; font-size: 10px; font-weight: 700; opacity: .85; text-transform: uppercase; }
.route-stat strong { font-size: 20px; letter-spacing: -.03em; }
.route-presets {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px;
}
.route-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px;
}
.route-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px;
}
.route-card.off { opacity: .72; }
.route-card-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.route-card-name { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.route-card-name a { color: inherit; text-decoration: none; }
.route-card-name a:hover { color: var(--sales); }
.route-card-orders { text-align: right; }
.route-card-orders strong { display: block; font-size: 24px; letter-spacing: -.03em; }
.route-card-orders span { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.route-track-card { flex-wrap: wrap; overflow: visible; }
.route-track-card .route-step { font-size: 11px; padding: 4px 8px; }

.route-show-head {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  align-items: flex-start; margin-bottom: 16px;
}
.route-flow { display: flex; flex-direction: column; gap: 6px; }
.route-flow-step {
  display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: start;
  padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: #f7fafc;
}
.route-flow-step.prod { background: #eef8f2; border-color: #c5ddcf; }
.route-flow-step.office { background: #f3f6f9; }
.route-flow-idx {
  width: 36px; height: 36px; border-radius: 12px; background: #fff; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-weight: 800;
}
.route-flow-arrow { text-align: center; color: var(--muted); font-weight: 800; }
.route-stage-orders { margin-top: 8px; font-size: 13px; font-weight: 600; }
.route-stage-orders a { color: var(--sales); }

.steps-editor { display: flex; flex-direction: column; gap: 10px; }
.step-row {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px;
  align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #f7fafc;
}
.step-num {
  width: 36px; height: 36px; border-radius: 12px; background: #fff; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-weight: 800; margin-top: 22px;
}
.step-controls { display: flex; flex-direction: column; gap: 4px; margin-top: 22px; }
.step-controls .btn { padding: 6px 10px; min-width: 36px; }

.panel-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px;
}
.panel-head h2 { margin: 0; font-size: 16px; }
.panel-head a { font-size: 13px; font-weight: 700; color: var(--sales); text-decoration: none; }

.card-order {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.card-order.hot { border-color: #f0a8a0; background: #fff8f7; }
.card-order .num { font-family: var(--mono); font-weight: 700; font-size: 18px; }
.card-order .meta { font-size: 13px; color: var(--muted); margin-top: 4px; }

.login-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 20px; padding: 28px; box-shadow: var(--shadow);
}
.login-card h1 { letter-spacing: -.03em; }

.empty-state {
  text-align: center; padding: 36px 16px; color: var(--muted);
}
.empty-state strong { display: block; color: var(--ink); font-size: 18px; margin-bottom: 6px; }

.help-hint {
  font-size: 13px; color: var(--muted);
  padding: 10px 12px; border-radius: 12px; background: #eef2f5;
  margin-bottom: 12px; line-height: 1.4;
}

/* ——— Leads ——— */
.lead-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.lead-stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; text-decoration: none; color: inherit; box-shadow: var(--shadow);
  transition: transform .15s ease;
}
.lead-stat:hover { transform: translateY(-1px); text-decoration: none; }
.lead-stat .ls-label { font-size: 12px; color: var(--muted); font-weight: 700; }
.lead-stat .ls-value { font-family: var(--mono); font-size: 26px; font-weight: 700; margin-top: 4px; }
.lead-stat.active { outline: 2px solid var(--sales); }

.view-switch {
  display: inline-flex; background: #e8eef3; padding: 4px; border-radius: 12px; gap: 2px;
}
.view-switch a {
  padding: 8px 12px; border-radius: 10px; font-weight: 700; font-size: 13px;
  color: var(--muted); text-decoration: none;
}
.view-switch a.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.lead-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px;
}
.lead-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.lead-card:hover { border-color: #b7c9d6; box-shadow: 0 10px 28px rgba(21,32,43,.1); }
.lead-card.attention { border-color: #f0c2bc; background: linear-gradient(180deg, #fff8f7, #fff); }
.lead-card.prepay { border-color: #9fd0b4; }
.lead-card-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.lead-card-name { font-weight: 800; font-size: 17px; letter-spacing: -.02em; margin: 0; }
.lead-card-name a { color: inherit; text-decoration: none; }
.lead-card-name a:hover { color: var(--sales); }
.lead-meta-row { display: flex; flex-wrap: wrap; gap: 6px; }
.lead-facts {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  background: #f4f7fa; border-radius: 12px; padding: 10px;
  font-size: 13px;
}
.lead-facts dt { color: var(--muted); font-size: 11px; font-weight: 700; margin: 0; }
.lead-facts dd { margin: 2px 0 0; font-weight: 600; }
.lead-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.lead-actions form { display: inline; }
.lead-quick-status {
  width: 100%; font-size: 13px; padding: 8px 10px; border-radius: 10px;
  border: 1px dashed var(--line); background: #fff; cursor: pointer; font-weight: 600;
}
.lead-quick-status:hover { border-color: var(--sales); }

.pipeline {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr);
  gap: 12px; overflow-x: auto; padding-bottom: 8px;
}
.pipeline-col {
  background: rgba(255,255,255,.72); border: 1px solid var(--line);
  border-radius: 16px; padding: 10px; min-height: 280px;
}
.pipeline-col h3 {
  margin: 0 0 10px; font-size: 12px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted);
}
.pipe-card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; margin-bottom: 8px; cursor: grab; box-shadow: var(--shadow);
}
.pipe-card:active { cursor: grabbing; }
.pipe-card.dragging { opacity: .5; }
.pipeline-col.drag-over { background: var(--sales-soft); border-color: #9ec5d6; }

.lead-show-layout {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); gap: 16px;
  align-items: start;
}
.lead-hero {
  background: linear-gradient(145deg, #1f6f8b, #163528);
  color: #fff; border-radius: 20px; padding: 22px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.lead-hero h2 { margin: 0; font-size: 28px; letter-spacing: -.03em; }
.lead-hero .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.lead-hero .chip {
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 700;
}
.note-feed { display: flex; flex-direction: column; gap: 10px; }
.note-item {
  border-left: 3px solid var(--sales); padding: 8px 0 8px 12px; background: #f7fafc;
  border-radius: 0 10px 10px 0;
}
.note-item .note-type { font-size: 11px; font-weight: 800; color: var(--sales); text-transform: uppercase; }
.note-item .note-body { margin-top: 4px; }
.note-item .note-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }

.priority-hot { color: #c0392b; }
.priority-high { color: #c56a17; }

/* Orders */
.order-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.order-card:hover { border-color: #b7c9d6; box-shadow: 0 10px 28px rgba(21,32,43,.1); }
.order-card.problem { border-color: #f0c2bc; background: linear-gradient(180deg, #fff8f7, #fff); }
.order-card.overdue { border-color: #e8a090; }
.order-card.no-draw { box-shadow: inset 3px 0 0 #d45a4a; }
.order-card-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.order-card-num { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.03em; }
.order-card-num a { color: inherit; text-decoration: none; }
.order-card-num a:hover { color: var(--sales); }
.order-card-title { margin: 4px 0 0; font-size: 14px; font-weight: 600; color: var(--ink); }
.order-card-money { font-size: 16px; font-weight: 800; white-space: nowrap; }
.order-card-addr { margin: 0; font-size: 12px; line-height: 1.35; }

.pay-bar {
  height: 6px; background: #e8eef3; border-radius: 999px; overflow: hidden;
}
.pay-bar > span {
  display: block; height: 100%; background: linear-gradient(90deg, #2f8f6b, #1f6f8b);
  border-radius: 999px; min-width: 0;
}

.order-spec-strip {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px;
  margin: 0 0 16px; padding: 14px 16px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
}
.order-spec-strip > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.order-spec-strip .muted { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.order-spec-strip strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.spec-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 16px 0 0;
}
.spec-grid dt { margin: 0; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.spec-grid dd { margin: 2px 0 0; font-weight: 600; }

.form-section {
  border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px;
}
.form-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.form-section h3 { margin: 0 0 12px; font-size: 15px; }
.check-row { display: flex; flex-wrap: wrap; gap: 14px; margin: 4px 0 14px; font-size: 14px; font-weight: 600; }
.check-row label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.row-alert td { background: #fff8f7; }

.grid-4 {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px;
}

/* —— Calendar (Google-like grid) —— */
.cal-toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between;
  align-items: center; margin-bottom: 12px;
}
.cal-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cal-title {
  margin: 0 0 0 6px; font-size: 22px; letter-spacing: -.03em; text-transform: capitalize;
}
.cal-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.cal-filters select {
  min-width: 160px; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; font-weight: 600;
}
.cal-legend {
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center;
  margin-bottom: 14px; font-size: 12px; font-weight: 600; color: var(--muted);
}
.cal-leg { display: inline-flex; align-items: center; gap: 6px; }
.cal-leg i {
  width: 12px; height: 12px; border-radius: 4px; display: inline-block;
  background: #9bb;
}
.cal-leg.tone-measure i { background: #3a7ca5; }
.cal-leg.tone-control i { background: #2a9d8f; }
.cal-leg.tone-install i { background: #2f8f6b; }
.cal-leg.tone-due i { background: #c56a17; }
.cal-leg.plan i {
  background: transparent; border: 2px dashed #8aa;
}

.cal-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start;
}
.cal-main {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); overflow: hidden;
}
.cal-weekdays {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  background: #f3f6f8; border-bottom: 1px solid var(--line);
}
.cal-weekdays > div {
  padding: 10px 8px; font-size: 12px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); text-align: center;
}
.cal-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(110px, 1fr);
}
.cal-cell {
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 6px; min-height: 110px; cursor: pointer; background: #fff;
  transition: background .12s ease;
}
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell:hover { background: #f7fafc; }
.cal-cell.out { background: #fafbfc; color: #9aa7b2; }
.cal-cell.out .cal-chip { opacity: .72; }
.cal-cell.today { background: linear-gradient(180deg, #eef7fb, #fff 40%); }
.cal-cell.today .cal-daynum {
  background: var(--sales); color: #fff; border-radius: 999px;
  width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
}
.cal-cell-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.cal-daynum { font-weight: 800; font-size: 13px; }
.cal-daycount {
  font-size: 11px; font-weight: 800; color: var(--muted); background: #eef2f5;
  border-radius: 999px; padding: 1px 7px;
}
.cal-cell-events { display: flex; flex-direction: column; gap: 3px; }
.cal-chip {
  display: flex; gap: 4px; align-items: baseline; border-radius: 6px;
  padding: 2px 6px; font-size: 11px; font-weight: 700; line-height: 1.25;
  text-decoration: none; color: #123; overflow: hidden; white-space: nowrap;
  border-left: 3px solid transparent;
}
.cal-chip-time { opacity: .8; flex-shrink: 0; }
.cal-chip-text { overflow: hidden; text-overflow: ellipsis; }
.cal-chip.tone-measure { background: #e7f2f8; border-left-color: #3a7ca5; color: #1f4e66; }
.cal-chip.tone-control { background: #e5f6f3; border-left-color: #2a9d8f; color: #1a5f57; }
.cal-chip.tone-install { background: #e6f5ee; border-left-color: #2f8f6b; color: #1d5c45; }
.cal-chip.tone-due { background: #fff1e4; border-left-color: #c56a17; color: #7a3d0a; }
.cal-chip.is-plan {
  background: #fff; border: 1px dashed #b7c4ce; border-left-width: 3px;
}
.cal-more {
  border: 0; background: transparent; color: var(--sales); font-size: 11px;
  font-weight: 800; cursor: pointer; text-align: left; padding: 2px 4px;
}
.cal-more:hover { text-decoration: underline; }

/* Week view */
.cal-week-head {
  display: grid; grid-template-columns: 56px repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--line); background: #f3f6f8;
}
.cal-week-dayhead {
  text-align: center; padding: 10px 4px; cursor: pointer; border-left: 1px solid var(--line);
}
.cal-week-dayhead.today .cal-week-date {
  background: var(--sales); color: #fff; border-radius: 999px;
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; margin: 0 auto;
}
.cal-week-date { font-size: 18px; font-weight: 800; }
.cal-week-body {
  display: grid; grid-template-columns: 56px repeat(7, minmax(0, 1fr));
  position: relative; min-height: calc(13 * 56px);
}
.cal-hours { position: relative; }
.cal-hour-label {
  height: 56px; font-size: 11px; color: var(--muted); font-weight: 700;
  text-align: right; padding-right: 6px; transform: translateY(-7px);
}
.cal-week-col {
  position: relative; border-left: 1px solid var(--line); cursor: pointer;
  background-image: repeating-linear-gradient(
    to bottom, transparent, transparent 55px, var(--line) 55px, var(--line) 56px
  );
}
.cal-week-col.today { background-color: #f7fbfd; }
.cal-hour-slot { height: 56px; }
.cal-week-event {
  position: absolute; left: 3px; right: 3px; border-radius: 8px; padding: 4px 6px;
  font-size: 11px; font-weight: 700; overflow: hidden; z-index: 2;
  text-decoration: none; color: #123; border-left: 3px solid transparent;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.cal-week-event strong { display: block; font-size: 11px; }
.cal-week-event.tone-measure { background: #d7ebf5; border-left-color: #3a7ca5; }
.cal-week-event.tone-control { background: #d4f0eb; border-left-color: #2a9d8f; }
.cal-week-event.tone-install { background: #d5efe3; border-left-color: #2f8f6b; }
.cal-week-event.tone-due { background: #ffe6cc; border-left-color: #c56a17; }
.cal-week-event.is-plan { border-style: dashed; background: #fff; }

.cal-aside { display: grid; gap: 12px; }
.cal-aside .panel.pulse { outline: 2px solid var(--sales); box-shadow: 0 0 0 4px rgba(31,111,139,.15); }
.cal-upcoming {
  display: grid; grid-template-columns: 52px 1fr; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.cal-upcoming:last-child { border-bottom: 0; }
.cal-up-date {
  font-weight: 800; font-size: 15px; line-height: 1.1;
}
.cal-up-date span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }

.cal-drawer[hidden] { display: none !important; }
.cal-drawer { position: fixed; inset: 0; z-index: 80; }
.cal-drawer-backdrop { position: absolute; inset: 0; background: rgba(20,30,40,.35); }
.cal-drawer-panel {
  position: absolute; top: 0; right: 0; width: min(400px, 100%); height: 100%;
  background: #fff; padding: 18px; overflow: auto; box-shadow: -12px 0 40px rgba(0,0,0,.18);
}
.cal-drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-drawer-head h3 { margin: 0; }
.cal-drawer-item {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px;
}

/* —— Tasks —— */
.task-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px;
}
.task-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 10px;
}
.task-card.overdue { border-color: #f0c2bc; background: linear-gradient(180deg, #fff8f7, #fff); }
.task-card.today { border-color: #f0d9a8; }
.task-card.done { opacity: .78; }
.task-card.hot { box-shadow: inset 3px 0 0 #d45a4a; }
.task-card-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.task-due { font-weight: 800; font-size: 15px; white-space: nowrap; }
.task-title { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.task-desc { margin: 0; color: var(--muted); font-size: 13px; }
.task-done-form { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.task-result-input {
  flex: 1; min-width: 120px; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--line); font: inherit;
}
.task-embed { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.task-embed-row {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #f7fafc;
}
.task-embed-row.overdue { border-color: #f0c2bc; background: #fff8f7; }

/* —— Today agenda —— */
.today-hero {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  align-items: flex-end; margin-bottom: 14px;
  padding: 18px 20px; border-radius: 18px;
  background: linear-gradient(135deg, #163528 0%, #1f6f8b 100%);
  color: #fff; box-shadow: var(--shadow);
}
.today-hero .muted { color: rgba(255,255,255,.72); }
.today-hero h2 { color: #fff; }
.today-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.today-stat {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18);
  border-radius: 12px; padding: 8px 12px; min-width: 72px;
}
.today-stat span { display: block; font-size: 11px; font-weight: 700; opacity: .8; text-transform: uppercase; letter-spacing: .04em; }
.today-stat strong { font-size: 22px; letter-spacing: -.03em; }
.today-stat.alert { background: rgba(217, 90, 60, .28); border-color: rgba(255,180,140,.4); }
.today-jump {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px;
}
.today-jump a {
  text-decoration: none; font-weight: 700; font-size: 13px;
  padding: 8px 12px; border-radius: 999px; background: #fff;
  border: 1px solid var(--line); color: var(--ink);
}
.today-jump a:hover { border-color: var(--sales); color: var(--sales); }
.today-section { margin-bottom: 22px; }
.today-sec-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  margin-bottom: 10px;
}
.today-sec-head h2 { margin: 0; font-size: 18px; }
.today-sec-head a { font-size: 13px; font-weight: 700; color: var(--sales); text-decoration: none; }
.today-list { display: flex; flex-direction: column; gap: 10px; }
.today-item {
  display: grid; grid-template-columns: 88px minmax(0, 1fr) auto;
  gap: 14px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px 16px; box-shadow: var(--shadow);
  border-left: 4px solid #3a7ca5;
}
.today-item.tone-measure { border-left-color: #3a7ca5; }
.today-item.tone-control { border-left-color: #2a9d8f; }
.today-item.tone-install { border-left-color: #2f8f6b; }
.today-item.tone-due { border-left-color: #c56a17; }
.today-item.stage { border-left-color: #d9772f; }
.today-item.is-overdue { background: linear-gradient(180deg, #fff8f7, #fff); border-color: #f0c2bc; }
.today-item-time {
  font-weight: 800; font-size: 18px; line-height: 1.15; text-align: center;
}
.today-item-time span {
  display: block; font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .03em; margin-top: 2px;
}
.today-ordnum { font-size: 16px; letter-spacing: -.02em; }
.today-item-body h3 { margin: 0 0 4px; font-size: 16px; letter-spacing: -.02em; }
.today-item-body p { margin: 0; }
.today-item-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

@media (max-width: 900px) {
  .today-item { grid-template-columns: 72px minmax(0, 1fr); }
  .today-item-actions { grid-column: 1 / -1; justify-content: stretch; }
  .today-item-actions .btn { flex: 1; }
  .prob-card { grid-template-columns: 1fr; }
  .prob-card-action { border-left: 0; border-top: 1px solid var(--line); }
  .people-profile-head { grid-template-columns: auto 1fr; }
  .people-wl { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 1100px) {
  .order-spec-strip { grid-template-columns: 1fr 1fr 1fr; }
  .home-hero, .order-layout, .lead-show-layout, .cal-layout { grid-template-columns: 1fr; }
  .order-aside { position: static; }
  .grid-4, .lead-stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  body { flex-direction: column; }
  .app-shell { flex-direction: column; }
  .app-chrome {
    flex-wrap: wrap;
    padding: 10px 14px;
    gap: 8px;
  }
  .chrome-user { display: none; }
  .chrome-crumb { max-width: 28vw; }
  .main { padding: 16px; }
  .menu-grid-2 { grid-template-columns: 1fr; }
  .menu-btn {
    min-height: 96px;
    padding: 18px 16px;
    gap: 14px;
  }
  .menu-btn-ico { width: 56px; height: 56px; font-size: 24px; border-radius: 14px; }
  .menu-btn-go { display: none; }
  .menu-room { padding: 16px; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .order-spec-strip { grid-template-columns: 1fr 1fr; }
  .spec-grid { grid-template-columns: 1fr; }
  .cal-grid { grid-auto-rows: minmax(88px, auto); }
  .cal-cell { min-height: 88px; }
  .cal-chip-time { display: none; }
}
@media (max-width: 640px) {
  .grid-4, .lead-stats { grid-template-columns: 1fr; }
  .money-block { text-align: left; }
  .order-spec-strip { grid-template-columns: 1fr; }
  .cal-weekdays > div:nth-child(n) { font-size: 10px; padding: 8px 2px; }
}
