:root {
  color-scheme: light;
  --paper: #f7f4ee;
  --surface: #fffdfa;
  --ink: #3d3035;
  --muted: #6b6063;
  --line: #e5ded4;
  --accent: #6d3047;
  --accent-dark: #552439;
  --accent-soft: #f1e7eb;
  --sage: #eaf0e9;
  --focus: #8d365b;
  --radius: 14px;
  --serif: Georgia, 'Times New Roman', serif;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, input, select, textarea { font: inherit; }
button, a { color: inherit; touch-action: manipulation; }
button { cursor: pointer; border: 0; }
button:disabled { cursor: default; opacity: .56; }
a { text-underline-offset: 3px; }
:where(button, a, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
.sr-only, .skip:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip:focus { position: fixed; top: 10px; left: 10px; z-index: 20; padding: 10px 16px; background: var(--surface); }

.shell { max-width: 1600px; margin-inline: auto; }
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr) auto;
  align-items: center;
  gap: 30px;
  min-height: 76px;
  padding: 12px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 11px; width: fit-content; text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 9px;
  color: #fff7ec;
  background: var(--accent);
  font: normal 25px/1 var(--serif);
}
.wordmark { font: normal 25px/1 var(--serif); letter-spacing: .045em; white-space: nowrap; }
.wordmark span { margin-left: 2px; color: var(--muted); font: 600 10px/1.2 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; letter-spacing: .13em; }
.top-links { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.identity { display: grid; max-width: 220px; min-width: 0; line-height: 1.35; }
.identity > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 650; }
.identity small { color: var(--muted); font-size: 12px; }
.search { position: relative; max-width: 560px; }
.search::before, .search::after { content: ''; position: absolute; pointer-events: none; z-index: 1; }
.search::before { top: 14px; left: 14px; width: 12px; height: 12px; border: 1.5px solid var(--muted); border-radius: 50%; }
.search::after { top: 25px; left: 24px; width: 6px; height: 1.5px; background: var(--muted); transform: rotate(45deg); }
.search input { padding: 9px 68px 9px 38px; background: var(--paper); }
.search kbd {
  position: absolute;
  top: 10px;
  right: 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
  font: inherit;
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
}
.nav-toggle { display: none !important; }
.layout { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: calc(100dvh - 76px); }
.nav {
  align-self: stretch;
  min-width: 0;
  padding: 24px 16px 32px 20px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.nav-group + .nav-group { margin-top: 21px; padding-top: 18px; border-top: 1px solid var(--line); }
.nav-group h2 { margin: 0 0 7px; padding-inline: 12px; color: var(--muted); font-size: 12px; font-weight: 600; }
.nav-group ul { list-style: none; margin: 0; padding: 0; }
.nav-group a {
  display: flex;
  align-items: center;
  min-height: 40px;
  margin: 2px 0;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 14px;
  text-decoration: none;
}
.nav-group a:hover { background: var(--paper); }
.nav-group a[aria-current='page'] { border-color: #e7d8df; background: var(--accent-soft); color: var(--accent-dark); font-weight: 650; }
main { min-width: 0; padding: clamp(24px, 4vw, 54px); }
main:focus { outline: none; }
#page { max-width: 1180px; margin-inline: auto; }
main > .notice { margin: 0 auto 15px; max-width: 1180px; }

h1 { margin: 0; font: normal clamp(30px, 4vw, 47px)/1.13 var(--serif); letter-spacing: -.025em; overflow-wrap: anywhere; }
h2 { margin: 0 0 14px; font-size: 20px; font-weight: 650; line-height: 1.25; }
h3 { margin: 0 0 9px; font-size: 17px; line-height: 1.3; }
.muted { color: var(--muted); font-size: 14px; }
.eyebrow, .source, .counter-label { color: var(--muted); font-size: 13px; }
.counter-label select, .counter-label input { display: block; margin-top: 5px; }
.toolbar, .day-header, .section-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px 22px; }
.toolbar { margin: 0 0 23px; }
.toolbar h1 { font-size: clamp(28px, 3.4vw, 42px); }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.primary, .outline, .small-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}
.primary { border-color: var(--accent); background: var(--accent); color: #fffaf7; }
.primary:hover { border-color: var(--accent-dark); background: var(--accent-dark); }
.outline:hover, .small-btn:hover { border-color: #cbb9c2; background: var(--accent-soft); color: var(--accent-dark); }
.small-btn { min-height: 34px; padding: 6px 9px; font-size: 13px; }
.inline-link, .text-link { padding: 0; background: none; color: var(--accent-dark); font-size: 14px; text-decoration: underline; }

.day-header { margin-bottom: 27px; align-items: flex-end; }
.day-header h1 { font-size: clamp(38px, 5vw, 64px); }
.day-header .actions { margin-bottom: 3px; }
.office-date { margin: 0 0 7px; color: var(--muted); font-size: 14px; }
.office-date::first-letter { text-transform: uppercase; }
.office-name { margin: 7px 0 0; color: var(--muted); overflow-wrap: anywhere; }
.day-summary { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; margin: 0 1px 8px; }
.day-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.day-metric {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: 'title arrow' 'value arrow';
  gap: 4px 12px;
  align-items: center;
  min-height: 104px;
  padding: 13px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
}
.day-metric > span:first-child { grid-area: title; color: var(--muted); font-size: 13px; }
.day-metric strong { grid-area: value; font: normal 36px/.95 var(--serif); color: var(--accent-dark); font-variant-numeric: lining-nums tabular-nums; }
.link-arrow { grid-area: arrow; font-size: 18px; color: var(--accent); }
.day-metric:hover, .quick-link:hover { border-color: #cbb9c2; background: #fcf8f9; }
.day-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(250px, 1fr); align-items: start; gap: 17px; margin-top: 22px; }
.day-panel, .day-control { border: 1px solid var(--line); border-radius: var(--radius); }
.day-panel { background: var(--surface); }
.day-panel .section-head { gap: 8px 16px; padding: 17px 19px; border-bottom: 1px solid var(--line); }
.day-panel h2, .day-control h2 { margin: 0; }
.day-tasks, .day-control ul { list-style: none; padding: 0; margin: 0; }
.day-tasks li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(85px, auto) auto; align-items: center; gap: 12px; padding: 11px 18px; }
.day-tasks li + li { border-top: 1px solid var(--line); }
.day-task-title { display: grid; min-width: 0; overflow-wrap: anywhere; }
.day-task-title small, .task-time { color: var(--muted); font-size: 13px; }
.task-time b { display: block; color: var(--accent-dark); font-weight: 650; }
.day-tasks .small-btn { justify-self: end; }
.day-empty { padding: 20px; }
.day-empty p { margin: 0 0 12px; color: var(--muted); }
.day-control { border-color: var(--accent-dark); background: var(--accent-dark); color: #fffaf7; padding: 17px 19px 15px; }
.day-control h2 { font: normal 24px/1.1 var(--serif); margin-bottom: 12px; }
.day-control li + li { border-top: 1px solid #ffffff36; }
.day-control li a { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 43px; padding: 7px 0; font-size: 14px; text-decoration: none; }
.day-control li a:hover { text-decoration: underline; }
.day-control b { color: #f6e2d4; font-weight: 650; font-variant-numeric: tabular-nums; }
.day-control a:focus-visible { outline-color: #f4d0b4; }
.control-link { display: inline-block; margin-top: 13px; font-size: 13px; color: #ffe2cc; }
.shortcuts { margin-top: 25px; }
.quick-grid, .grid, .mini-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.quick-link { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); padding: 10px 13px; text-decoration: none; font-weight: 600; }
.quick-link::after { content: '↗'; color: var(--accent); }
.demo-action { margin-top: 30px; }
.card { display: flex; flex-direction: column; align-items: flex-start; text-align: left; min-height: 120px; padding: 19px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.card:hover { border-color: #cbb9c2; background: var(--accent-soft); }
.card-title { font-size: 17px; line-height: 1.25; font-weight: 650; }
.card p { font-size: 14px; color: var(--muted); margin: 7px 0 0; }
.mini-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.subnav { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 20px; padding: 3px 0 8px; border-bottom: 1px solid var(--line); }
.subnav button { background: transparent; border: 1px solid transparent; padding: 7px 11px; min-height: 38px; border-radius: 7px; font-size: 14px; }
.subnav button:hover { background: var(--surface); border-color: var(--line); }
.subnav button[aria-pressed='true'] { background: var(--accent-soft); color: var(--accent-dark); border-color: #e7d8df; font-weight: 650; }
.section { margin: 29px 0; }
.panel, .empty, .metric, .data-table-wrap, .stage-col, .search-result {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.panel { padding: 19px; margin-bottom: 17px; }
.panel p { white-space: pre-wrap; overflow-wrap: anywhere; }
.empty { border-style: dashed; padding: 20px; color: var(--muted); }
.notice { padding: 11px 15px; border: 1px solid #d5dfd3; border-radius: 9px; background: var(--sage); font-size: 14px; }
.error { color: #8f2d4e; white-space: pre-wrap; overflow-wrap: anywhere; }
.error:empty { margin: 0; }
.data-table-wrap { max-width: 100%; overflow: auto; }
.data-table-wrap:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 11px 13px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-weight: 650; background: #f3efe8; }
td { min-width: 92px; }
td:first-child { min-width: 156px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #faf7f1; }
.row-title { display: block; font-weight: 650; margin-bottom: 3px; }
.cell-note { display: block; color: var(--muted); font-size: 13px; max-width: 270px; overflow-wrap: anywhere; }
.status { display: inline-block; padding: 3px 7px; border-radius: 5px; background: var(--sage); color: #3c574a; font-size: 12px; white-space: nowrap; }
.status.warn { background: #f7e9dd; color: #714528; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.metric { padding: 15px; }
.metric b { display: block; color: var(--accent-dark); font: normal 29px/1.2 var(--serif); overflow-wrap: anywhere; }
.metric span, .metric small { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; }
.board { display: grid; grid-template-columns: repeat(3, minmax(190px, 1fr)); gap: 14px; overflow: auto; }
.stage-col { padding: 13px; background: #f3efe8; }
.stage-col h2 { font-size: 16px; }
.deal-card { padding: 13px; margin-top: 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.deal-card h3 { font-size: 15px; }
.deal-card p { margin: 7px 0; font-size: 14px; }
.deal-overview { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; margin-bottom: 16px; }
.deal-overview .panel { margin: 0; }
.deal-checks { list-style: none; margin: 0; padding: 0; }
.deal-checks.panel { padding-inline: 16px; }
.deal-checks li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
.deal-checks li + li { border-top: 1px solid var(--line); }
.deal-checks li p { margin: 6px 0 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.deal-checks .status { margin-left: 8px; }
.key-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.key-values div { padding: 9px 0; border-bottom: 1px solid var(--line); }
.key-values dt { color: var(--muted); font-size: 13px; }
.key-values dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.bars { height: 190px; display: flex; gap: 4px; align-items: flex-end; margin: 16px 0 23px; border-bottom: 1px solid var(--line); }
.bar { position: relative; flex: 1; min-width: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }
.bar span { position: absolute; bottom: -19px; left: 0; font-size: 10px; color: var(--muted); }
.truncate { max-height: 350px; overflow: auto; }
.search-result { display: block; width: 100%; text-align: left; padding: 12px 15px; margin-bottom: 9px; }
.search-result:hover { background: var(--accent-soft); }
.search-result small { display: block; color: var(--muted); }
.land-pages { margin-top: 12px; }
.map { height: 420px; z-index: 0; margin: 17px 0; border: 1px solid var(--line); border-radius: var(--radius); }
.leaflet-container { font-family: inherit; }
.crm-map-pin { display: grid; place-items: center; font-weight: 700; }
.crm-map-pin i { display: block; width: 12px; height: 12px; border: 2px solid #fffaf0; border-radius: 50%; background: #76614d; box-shadow: 0 1px 5px #55453066; }
.crm-map-pin.settlement i { background: #4e6258; }
.crm-map-pin.cluster { background: #f8f2e7; border: 1px solid #b2a593; border-radius: 50%; color: #4b4032; box-shadow: 0 2px 5px #55453033; }
.crm-map-pin:focus-visible { outline: 2px solid #4e6258; outline-offset: 1px; border-radius: 50%; }

input, select, textarea {
  width: 100%; min-height: 42px; padding: 9px 11px; color: var(--ink);
  border: 1px solid #d7cdc3; border-radius: 8px; background: var(--surface);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { min-height: 108px; resize: vertical; }
.auth-screen { min-height: 100dvh; display: grid; place-items: center; padding: 22px; }
.auth-card { width: min(100%, 450px); padding: clamp(22px, 5vw, 40px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.auth-brand { margin-bottom: 26px; }
.auth-card h1 { font-size: clamp(29px, 5vw, 36px); }
.auth-card p { color: var(--muted); }
.auth-card form { display: grid; gap: 13px; margin-top: 22px; }
.auth-card label { display: grid; gap: 5px; }
.auth-card .error, .error { color: #8f2d4e; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dialog-head h2 { margin: 0; }
dialog { width: min(calc(100% - 24px), 720px); max-height: 92dvh; padding: clamp(15px, 4vw, 27px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: 0 15px 64px #493b442e; }
dialog::backdrop { background: #43323e73; }
.form-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 19px 0; }
.form-fields label, .form-fields fieldset { display: grid; align-content: start; gap: 6px; font-size: 14px; }
.form-fields .wide { grid-column: 1 / -1; }
.form-fields fieldset { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 7px; }
.form-fields fieldset label, .check-item { display: flex; align-items: center; gap: 8px; }
.form-fields input[type='checkbox'], .check-item input { width: 18px; min-height: 18px; flex-shrink: 0; }
.form-actions { display: flex; gap: 10px; padding-top: 15px; border-top: 1px solid var(--line); }
.check-item { margin-block: 10px; }

@media (max-width: 1060px) {
  .top { grid-template-columns: 165px minmax(0, 1fr) auto; gap: 16px; padding-inline: 22px; }
  .layout { grid-template-columns: 190px minmax(0, 1fr); }
  .nav { padding-inline: 13px; }
  main { padding-inline: 25px; }
  .identity { max-width: 146px; }
  .day-grid { grid-template-columns: minmax(0, 1.3fr) minmax(210px, 1fr); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board { grid-template-columns: repeat(2, minmax(170px, 1fr)); }
}
@media (max-width: 760px) {
  .top { grid-template-columns: minmax(0, 1fr) auto; row-gap: 9px; padding: 9px 15px; }
  .top-links { grid-column: 2; grid-row: 1; gap: 7px; }
  .top-links .outline { min-height: 36px; padding: 5px 9px; }
  .nav-toggle { display: inline-flex !important; }
  .identity { display: none; }
  .search { grid-column: 1 / -1; grid-row: 2; max-width: none; }
  .search input { min-height: 40px; padding-right: 12px; }
  .search kbd { display: none; }
  input, select, textarea { font-size: 16px; }
  .layout { display: block; }
  .nav { display: none; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 15px; }
  .nav[data-open] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 10px; }
  .nav-group + .nav-group { margin: 0; padding: 0; border: 0; }
  .nav-group a { min-height: 41px; }
  main { padding: 22px 15px 36px; }
  .day-header { margin-bottom: 20px; }
  .day-grid { grid-template-columns: 1fr; }
  .form-fields, .key-values { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel { padding: 15px; }
  .map { height: 335px; }
}
@media (max-width: 470px) {
  .brand { gap: 7px; }
  .brand-mark { width: 33px; height: 33px; font-size: 21px; }
  .wordmark { font-size: 21px; }
  .day-metrics, .quick-grid, .mini-grid, .board { grid-template-columns: 1fr; gap: 8px; }
  .day-metric { grid-template-columns: minmax(0, 1fr) auto 17px; grid-template-areas: 'title value arrow'; min-height: 56px; padding: 8px 12px; }
  .day-metric strong { font-size: 29px; }
  .day-panel .section-head, .day-tasks li { padding-inline: 12px; }
  .day-tasks li { grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px; }
  .day-tasks .task-time { grid-column: 1; grid-row: 2; }
  .day-tasks .task-time b { display: inline; }
  .day-tasks .small-btn { grid-column: 2; grid-row: 1 / 3; }
  .metric b { font-size: 23px; }
  .bar span { display: none; }
}
@media print {
  .top, .nav, .toolbar .actions, .subnav, .small-btn, .auth-screen { display: none !important; }
  .layout { display: block; }
  main { padding: 0; }
  .panel { border: 0; break-inside: avoid; }
}
