:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.82);
  --surface-subtle: #fafafc;
  --text: #1d1d1f;
  --secondary: #6e6e73;
  --tertiary: #929297;
  --hairline: rgba(29, 29, 31, 0.1);
  --accent: #8b7350;
  --accent-soft: #f2eee7;
  --success: #4d775e;
  --success-soft: #edf4ef;
  --warning: #a26e35;
  --warning-soft: #f8f1e9;
  --danger: #a94f55;
  --danger-soft: #f8ebed;
  --blue: #54718e;
  --blue-soft: #edf3f8;
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 18px;
  --shadow-layer: 0 18px 48px rgba(0, 0, 0, 0.13);
  --motion: 180ms;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 84% 7%, rgba(255, 255, 255, 0.92), transparent 27rem),
    var(--bg);
}

body.layer-open { overflow: hidden; }

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.48; }
a { color: inherit; }
svg { display: block; }

:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent);
}

.hidden, [hidden] { display: none !important; }
.serif { font-family: "Cormorant Garamond", Georgia, serif; }
.muted { color: var(--secondary); }

.eyebrow {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.icon-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  transition: background var(--motion), color var(--motion), transform var(--motion);
}

.icon-button:hover { background: rgba(29, 29, 31, 0.055); }
.icon-button:active { transform: scale(0.96); }

.primary, .secondary, .text-button {
  min-height: 44px;
  border-radius: 12px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.055em;
  text-decoration: none;
  transition: transform var(--motion), background var(--motion), border-color var(--motion);
}

.primary {
  border: 1px solid var(--text);
  background: var(--text);
  color: #fff;
}

.primary:hover { background: #343436; }
.primary:active, .secondary:active { transform: scale(0.985); }

.secondary {
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
}

.secondary:hover { background: #fff; border-color: rgba(29, 29, 31, 0.17); }

.text-button {
  min-height: 44px;
  padding-inline: 10px;
  border: 0;
  background: transparent;
  color: var(--accent);
}

.wide-button { width: 100%; }

.login {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  place-items: center;
}

.login-card {
  width: min(420px, 100%);
  padding: 44px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-layer);
  backdrop-filter: blur(24px);
}

.login-mark {
  width: 36px;
  height: 36px;
  margin: 0 auto 28px;
  border: 1px solid color-mix(in srgb, var(--accent) 70%, transparent);
  transform: rotate(45deg);
  position: relative;
}

.login-mark::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}

.login h1 {
  margin: 0;
  font: 600 2.35rem/1 "Cormorant Garamond", Georgia, serif;
  text-align: center;
}

.login p {
  margin: 11px 0 28px;
  color: var(--secondary);
  text-align: center;
}

.login .primary { width: 100%; margin-top: 16px; }

.error {
  margin-top: 12px;
  color: var(--danger);
  font-size: 0.82rem;
}

.login .error { text-align: center; }

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field label, .label {
  color: var(--secondary);
  font-size: 0.76rem;
  font-weight: 600;
}

.field input, .field select, .field textarea,
.control, #dealContactNote, #dealFollowUpAt {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  outline: 0;
  transition: border-color var(--motion), box-shadow var(--motion);
}

.field textarea { min-height: 104px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .control:focus, #dealContactNote:focus, #dealFollowUpAt:focus { border-color: color-mix(in srgb, var(--accent) 58%, transparent); }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 100vh;
  padding: 24px 16px 18px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
  backdrop-filter: blur(28px) saturate(1.2);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 35;
  border: 0;
  background: rgba(10, 10, 12, 0.28);
  backdrop-filter: blur(2px);
}

.brand {
  padding: 6px 10px 21px;
  border-bottom: 1px solid var(--hairline);
}

.brand strong {
  display: block;
  font: 600 1.42rem/1.04 "Cormorant Garamond", Georgia, serif;
  letter-spacing: 0.045em;
}

.brand > span {
  display: block;
  margin-top: 7px;
  color: var(--accent);
  font-size: 0.61rem;
  font-weight: 650;
  letter-spacing: 0.23em;
}

.brand-switch { margin-top: 17px; }
.brand-switch select {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  font-size: 0.78rem;
}

.nav {
  margin-top: 18px;
  display: grid;
  gap: 4px;
}

.nav button, .nav a {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--secondary);
  font-size: 0.88rem;
  text-align: left;
  text-decoration: none;
  transition: background var(--motion), color var(--motion), transform var(--motion);
}

.nav button:hover, .nav a:hover { background: rgba(29, 29, 31, 0.045); color: var(--text); }
.nav button.active, .nav a.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.nav-separator { height: 1px; margin: 12px 10px; background: var(--hairline); }

.sidebar-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
}

.user {
  padding: 0 8px 12px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #d7c7aa, #9e865f);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
}

.user strong { display: block; overflow: hidden; font-size: 0.78rem; text-overflow: ellipsis; white-space: nowrap; }
.user span { display: block; margin-top: 1px; color: var(--tertiary); font-size: 0.67rem; }
.signout {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--secondary);
  text-align: left;
  font-size: 0.78rem;
}
.signout:hover { background: rgba(29, 29, 31, 0.045); color: var(--text); }

main { min-width: 0; }

.topbar {
  min-height: 72px;
  padding: 12px 28px;
  display: flex;
  align-items: center;
  gap: 15px;
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--hairline);
  background: rgba(245, 245, 247, 0.78);
  backdrop-filter: blur(26px) saturate(1.25);
}

.menu-toggle { display: none; }
.topbar-title { margin-right: auto; min-width: 0; }
.topbar-title h1 { margin: 0; font-size: 1.12rem; font-weight: 650; letter-spacing: -0.015em; }
.topbar-title p { margin: 3px 0 0; color: var(--secondary); font-size: 0.73rem; }

.brand-scope {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--secondary);
  font-size: 0.72rem;
  white-space: nowrap;
}

.brand-scope i { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-accent, var(--accent)); }

.search {
  width: min(330px, 29vw);
  min-height: 42px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--tertiary);
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.82rem;
}

.date-pill { color: var(--secondary); font-size: 0.73rem; white-space: nowrap; }

.content {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 30px 32px 58px;
}

.view { display: none; }
.view.active { display: block; }

.section-head {
  margin-bottom: 22px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.section-head h2 {
  margin: 4px 0 0;
  font: 600 2.15rem/1.02 "Cormorant Garamond", Georgia, serif;
  letter-spacing: -0.025em;
}

.section-head p { margin: 8px 0 0; color: var(--secondary); font-size: 0.86rem; }
.actions { display: flex; gap: 8px; }

.metrics {
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  min-height: 122px;
  padding: 18px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.84);
}

.metric::after {
  content: "";
  width: 76px;
  height: 76px;
  position: absolute;
  right: -30px;
  bottom: -38px;
  border-radius: 50%;
  background: var(--metric-tint, var(--accent-soft));
}

.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.metric-label { color: var(--secondary); font-size: 0.72rem; font-weight: 600; }
.metric-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--metric-tint, var(--accent-soft));
  color: var(--metric-color, var(--accent));
}
.metric-icon .icon { width: 15px; height: 15px; }
.metric-value { margin-top: 13px; font-size: 1.72rem; font-weight: 650; letter-spacing: -0.04em; }
.metric-note { margin-top: 3px; color: var(--tertiary); font-size: 0.72rem; }

.today-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.75fr);
  gap: 14px;
}

.panel {
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.86);
}

.panel-head {
  min-height: 60px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--hairline);
}

.panel-head h3 { margin: 0; font-size: 0.98rem; font-weight: 650; }
.panel-head button, .panel-head a { border: 0; background: transparent; color: var(--accent); font-size: 0.76rem; font-weight: 600; text-decoration: none; }

.attention-list, .tasks-list { padding: 6px 16px 12px; }

.attention-row {
  width: 100%;
  min-height: 66px;
  padding: 11px 4px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) minmax(105px, auto) 24px;
  gap: 11px;
  align-items: center;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  background: transparent;
  color: var(--text);
  text-align: left;
}
.attention-row:last-child { border-bottom: 0; }
.attention-row:hover .row-arrow { background: var(--accent-soft); color: var(--accent); }

.client-initial {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 650;
}

.attention-copy, .deal-main { min-width: 0; }
.attention-copy strong, .deal-main strong { display: block; overflow: hidden; font-size: 0.84rem; text-overflow: ellipsis; white-space: nowrap; }
.attention-copy span, .deal-main span { display: block; margin-top: 3px; overflow: hidden; color: var(--secondary); font-size: 0.73rem; text-overflow: ellipsis; white-space: nowrap; }
.attention-meta { text-align: right; }
.attention-meta strong { display: block; font-size: 0.8rem; }
.attention-meta span { display: block; margin-top: 3px; color: var(--tertiary); font-size: 0.68rem; }
.row-arrow { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; color: var(--tertiary); }
.row-arrow .icon { width: 13px; height: 13px; }

.task-row {
  min-height: 57px;
  padding: 10px 2px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: start;
  border-bottom: 1px solid var(--hairline);
}
.task-row:last-child { border-bottom: 0; }
.task-check {
  width: 20px;
  height: 20px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(29, 29, 31, 0.18);
  border-radius: 50%;
  background: #fff;
  color: #fff;
}
.task-check .icon { width: 12px; height: 12px; }
.task-row.done { opacity: 0.52; }
.task-row.done .task-check { border-color: var(--success); background: var(--success); }
.task-row.done .task-copy { text-decoration: line-through; }
.task-copy strong { display: block; font-size: 0.79rem; font-weight: 560; }
.task-copy span { display: block; margin-top: 3px; color: var(--tertiary); font-size: 0.68rem; }
.task-time { color: var(--warning); font-size: 0.67rem; white-space: nowrap; }

.today-all { margin: 0 16px 14px; }
.today-all summary { min-height: 44px; display: flex; align-items: center; color: var(--accent); cursor: pointer; font-size: 0.75rem; font-weight: 600; }
.compact-task-form { padding: 12px 0 4px; display: grid; gap: 10px; }

.pipeline-strip-panel { margin-top: 14px; }
.pipeline-strip {
  padding: 14px 16px 17px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.stage-pill {
  min-width: 142px;
  min-height: 56px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--hairline);
  border-left: 2px solid var(--stage-tone, var(--accent));
  border-radius: 12px;
  background: var(--surface-subtle);
}
.stage-pill span { color: var(--secondary); font-size: 0.72rem; white-space: nowrap; }
.stage-pill b { font-size: 1rem; }

.empty {
  padding: 36px 20px;
  color: var(--tertiary);
  font-size: 0.8rem;
  text-align: center;
}
.empty-mark {
  width: 34px;
  height: 34px;
  margin: 0 auto 9px;
  display: grid;
  place-items: center;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  color: var(--accent);
}

.loading-row {
  min-height: 64px;
  margin: 8px 0;
  border-radius: 12px;
  background: linear-gradient(90deg, #f2f2f4 25%, #fafafa 48%, #f2f2f4 72%);
  background-size: 240% 100%;
  animation: shimmer 1.15s linear infinite;
}

@keyframes shimmer { to { background-position: -240% 0; } }

.pipeline-toolbar {
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.direction-tabs, .deal-view-toggle, .settings-tabs, .record-tabs, .kb-tabs {
  padding: 3px;
  display: inline-flex;
  gap: 2px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
}

.direction-tabs button, .deal-view-toggle button, .settings-tabs button, .record-tabs button, .kb-tab {
  min-height: 36px;
  padding: 0 13px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--secondary);
  font-size: 0.74rem;
  white-space: nowrap;
}

.direction-tabs button.active, .deal-view-toggle button.active, .settings-tabs button.active, .record-tabs button.active, .kb-tab.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
  font-weight: 600;
}

.pipeline-filters { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.pipeline-filters select { width: auto; min-width: 145px; }

.deal-list {
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.86);
}

.deal-list-head, .deal-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(180px, 1.3fr) 130px 120px minmax(160px, 1fr) 80px;
  gap: 14px;
  align-items: center;
}

.deal-list-head {
  min-height: 44px;
  padding: 0 18px;
  border-bottom: 1px solid var(--hairline);
  color: var(--tertiary);
  font-size: 0.67rem;
  font-weight: 600;
}

.deal-row {
  width: 100%;
  min-height: 72px;
  padding: 10px 18px;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  background: transparent;
  color: var(--text);
  text-align: left;
}
.deal-row:last-child { border-bottom: 0; }
.deal-row:hover { background: rgba(29, 29, 31, 0.022); }

.deal-client { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 9px; align-items: center; }
.deal-client .client-initial { width: 34px; height: 34px; }
.deal-client small, .deal-main small { margin-top: 4px; display: block; color: var(--tertiary); font-size: 0.67rem; }
.deal-main strong { display: block; overflow: hidden; font-size: 0.78rem; text-overflow: ellipsis; white-space: nowrap; }
.priority-dot { width: 6px; height: 6px; margin-right: 6px; display: inline-block; border-radius: 50%; background: var(--danger); vertical-align: 1px; }
.deal-cell-label { display: none; color: var(--tertiary); font-size: 0.66rem; }
.stage {
  width: fit-content;
  padding: 5px 8px;
  border-left: 2px solid var(--stage-tone, var(--accent));
  border-radius: 5px;
  background: color-mix(in srgb, var(--stage-tone, var(--accent)) 7%, #fff);
  color: color-mix(in srgb, var(--stage-tone, var(--accent)) 74%, #111);
  font-size: 0.68rem;
  font-weight: 600;
}
.deal-value { font-size: 0.8rem; font-weight: 620; }
.deal-next strong { display: block; overflow: hidden; font-size: 0.76rem; text-overflow: ellipsis; white-space: nowrap; }
.deal-next span, .deal-age { display: block; margin-top: 3px; color: var(--tertiary); font-size: 0.68rem; }
.deal-age { margin-top: 0; text-align: right; }

.pipeline {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(250px, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.pipe-column { min-height: 520px; overflow: hidden; border: 1px solid var(--hairline); border-radius: var(--r); background: rgba(255, 255, 255, 0.68); }
.pipe-head { min-height: 54px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; border-top: 2px solid var(--stage-tone, var(--accent)); border-bottom: 1px solid var(--hairline); }
.pipe-head strong { font-size: 0.75rem; }
.count { min-width: 23px; height: 23px; padding: 0 6px; display: grid; place-items: center; border-radius: 999px; background: #fff; color: var(--secondary); font-size: 0.68rem; }
.pipe-body { padding: 10px; }
.deal-card { width: 100%; margin-bottom: 8px; padding: 13px; border: 1px solid var(--hairline); border-radius: 12px; background: #fff; color: var(--text); text-align: left; }
.deal-card:hover { border-color: rgba(29, 29, 31, 0.17); }
.deal-card h4 { margin: 9px 0 0; font-size: 0.84rem; }
.deal-card p { margin: 4px 0 0; color: var(--secondary); font-size: 0.72rem; }
.deal-card footer { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.72rem; }
.board-more { margin: 10px 3px 2px; color: var(--tertiary); font-size: 0.68rem; text-align: center; }
.compact-empty { padding: 24px 8px; }

.brand-chip, .status-chip {
  width: fit-content;
  min-height: 24px;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--secondary);
  font-size: 0.66rem;
  font-weight: 580;
}
.brand-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--chip, var(--accent)); }

.load-more { min-height: 62px; display: flex; align-items: center; justify-content: center; gap: 14px; color: var(--secondary); font-size: 0.74rem; }

.client-list, .asset-list { display: grid; gap: 10px; }
.client-row, .asset-row {
  min-height: 76px;
  padding: 12px 16px;
  display: grid;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  text-align: left;
}
.client-row { grid-template-columns: 42px minmax(0, 1.4fr) minmax(160px, 1fr) 100px 130px 24px; }
.client-row .client-initial { width: 42px; height: 42px; }
.client-row strong { font-size: 0.84rem; }
.client-row p { margin: 3px 0 0; color: var(--secondary); font-size: 0.72rem; }
.client-stat span { display: block; color: var(--tertiary); font-size: 0.66rem; }
.client-stat b { display: block; margin-top: 3px; font-size: 0.78rem; }

.report-grid, .settings-grid, .site-grid, .kb-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.report-card, .settings-card, .site-card, .kb-card { padding: 18px; border: 1px solid var(--hairline); border-radius: var(--r); background: rgba(255, 255, 255, 0.86); }
.report-card h3, .settings-card h3, .site-card h3, .kb-card h3 { margin: 8px 0 0; font-size: 0.95rem; }
.report-card p, .settings-card p, .site-card p, .kb-card p { margin: 7px 0 0; color: var(--secondary); font-size: 0.76rem; }
.big-number { margin-top: 16px; font-size: 2rem; font-weight: 650; letter-spacing: -0.05em; }
.bar-row { margin-top: 14px; display: grid; grid-template-columns: 100px minmax(0, 1fr) 30px; gap: 10px; align-items: center; font-size: 0.73rem; }
.bar { height: 6px; overflow: hidden; border-radius: 999px; background: #ececef; }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.report-wide { grid-column: 1 / -1; }
.report-bars { margin-top: 18px; }
.bar i { background: var(--bar-tone, var(--accent)); }
.insight-number { margin-top: 18px; font: 600 2.2rem/1 "Cormorant Garamond", Georgia, serif; }

.settings-tabs { margin-bottom: 14px; }
.settings-panel { min-height: 240px; }
.settings-callout { padding: 18px; border: 1px solid var(--hairline); border-radius: var(--r); background: rgba(255, 255, 255, 0.78); }
.settings-callout strong { font-size: 0.88rem; }
.settings-callout p { margin: 6px 0 0; color: var(--secondary); font-size: 0.76rem; }
.settings-section-head { margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.settings-section-head h3 { margin: 0; font-size: 0.96rem; }

.site-card-head, .kb-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.site-host, .kb-card-key { margin-top: 7px; color: var(--secondary); font-size: 0.72rem; }
.site-stats { margin-top: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.site-stats span { display: block; color: var(--tertiary); font-size: 0.66rem; }
.site-stats b { display: block; margin-top: 4px; font-size: 0.78rem; }
.site-actions, .kb-actions { margin-top: 14px; display: flex; gap: 7px; flex-wrap: wrap; }

.kb-tabs { margin-bottom: 12px; overflow-x: auto; }
.kb-tab b { margin-left: 4px; }
.kb-scope-note { color: var(--secondary); font-size: 0.74rem; }
.kb-card-copy { margin-top: 12px; color: var(--secondary); font-size: 0.76rem; white-space: pre-wrap; }
.kb-meta { margin-top: 14px; display: flex; gap: 8px 14px; flex-wrap: wrap; color: var(--tertiary); font-size: 0.67rem; }
.kb-audio { width: 100%; margin-top: 12px; }
.kb-guide { margin-bottom: 14px; padding: 16px; display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; border: 1px solid var(--hairline); border-radius: var(--r); background: var(--accent-soft); }
.kb-guide-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, 0.7); color: var(--accent); }
.kb-guide strong { font-size: 0.82rem; }
.kb-guide p { margin: 5px 0 0; color: var(--secondary); font-size: 0.73rem; }

.modal-backdrop, .drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  border: 0;
  background: rgba(10, 10, 12, 0.28);
  backdrop-filter: blur(3px);
}

.modal {
  width: min(720px, calc(100% - 28px));
  max-height: min(88vh, 860px);
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 71;
  overflow: auto;
  transform: translate(-50%, -50%);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  background: #fbfbfd;
  box-shadow: var(--shadow-layer);
}

.modal-head, .drawer-head {
  min-height: 72px;
  padding: 13px 18px 13px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 4;
  border-bottom: 1px solid var(--hairline);
  background: rgba(251, 251, 253, 0.88);
  backdrop-filter: blur(22px);
}
.modal-head h2, .drawer-head h2 { margin: 3px 0 0; font-size: 1.08rem; }
.modal form { padding: 20px 22px 22px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.modal-actions { margin-top: 20px; display: flex; justify-content: flex-end; gap: 8px; }
.advanced-intake { grid-column: 1 / -1; border-top: 1px solid var(--hairline); }
.advanced-intake summary { min-height: 48px; display: flex; align-items: center; color: var(--accent); cursor: pointer; font-size: 0.76rem; font-weight: 600; }
.advanced-fields { padding-top: 5px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check { min-height: 44px; display: flex; align-items: center; gap: 9px; color: var(--secondary); font-size: 0.78rem; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.drawer {
  width: min(520px, 100%);
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 71;
  overflow: auto;
  background: #fbfbfd;
  box-shadow: var(--shadow-layer);
  transition: width var(--motion);
}
.drawer.is-full { width: min(680px, 100%); }
.drawer-body { padding: 18px 22px 28px; }
.deal-summary { margin-bottom: 15px; }
.deal-summary-top { display: flex; gap: 6px; flex-wrap: wrap; }
.deal-summary h3 { margin: 12px 0 0; font-size: 1.32rem; letter-spacing: -0.025em; }
.deal-summary p { margin: 5px 0 0; color: var(--secondary); font-size: 0.78rem; }
.quick-stage { padding: 13px 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.quick-actions { padding: 14px 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.action-chip {
  min-height: 44px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font-size: 0.73rem;
  font-weight: 570;
  text-decoration: none;
}
.action-chip.disabled, .quick-actions.is-disabled .action-chip { pointer-events: none; opacity: 0.42; }
.quick-stage-select { width: auto; min-width: 160px; }
.quick-asset { margin-bottom: 15px; overflow: hidden; border: 1px solid var(--hairline); border-radius: var(--r); background: var(--surface-subtle); }
.quick-asset img { width: 100%; height: 220px; display: block; object-fit: cover; }
.quick-asset-copy { padding: 14px; }
.quick-asset-copy strong { font-size: 0.84rem; }
.quick-asset-copy p { margin: 4px 0 0; color: var(--secondary); font-size: 0.73rem; }
.next-action { margin-bottom: 16px; padding: 14px; border-radius: var(--r); background: var(--accent-soft); }
.next-action span { display: block; color: var(--accent); font-size: 0.68rem; font-weight: 650; }
.next-action strong { display: block; margin-top: 4px; font-size: 0.82rem; }
.next-action small { margin-top: 4px; display: block; color: var(--secondary); font-size: 0.69rem; }
.inline-task { margin-top: 12px; display: grid; gap: 8px; }
.inline-task input { width: 100%; min-height: 42px; padding: 0 11px; border: 1px solid var(--hairline); border-radius: var(--r-sm); background: #fff; color: var(--text); }
.quick-footer {
  margin-top: 20px;
  padding-top: 16px;
  display: grid;
  gap: 3px;
  border-top: 1px solid var(--hairline);
}

.deal-action { min-height: calc(100vh - 126px); }
.deal-action-head {
  min-height: 58px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--hairline);
}
.deal-action-head h3 { margin: 3px 0 0; font-size: 1.18rem; letter-spacing: -0.025em; }
.action-back { margin-left: -12px; }
.action-back .icon { transform: rotate(180deg); }
.action-section { margin-top: 17px; }
.action-label {
  margin-bottom: 7px;
  display: block;
  color: var(--secondary);
  font-size: 0.7rem;
  font-weight: 620;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}
.action-section textarea { min-height: 104px; resize: vertical; }
.outcome-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.outcome-option {
  width: 100%;
  min-height: 72px;
  padding: 13px 14px;
  display: grid;
  grid-template-columns: 13px minmax(0, 1fr);
  gap: 2px 10px;
  align-items: center;
  border: 1px solid var(--hairline);
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
  text-align: left;
  transition: border-color var(--motion), background var(--motion), box-shadow var(--motion), transform var(--motion);
}
.outcome-option:hover { border-color: rgba(29, 29, 31, 0.19); background: #fff; }
.outcome-option:active { transform: scale(0.99); }
.outcome-option.active {
  border-color: color-mix(in srgb, var(--accent) 52%, transparent);
  background: color-mix(in srgb, var(--accent-soft) 70%, #fff);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 13%, transparent);
}
.outcome-dot {
  width: 10px;
  height: 10px;
  grid-row: 1 / span 2;
  border: 1.5px solid var(--tertiary);
  border-radius: 50%;
}
.outcome-option.active .outcome-dot { border: 3px solid var(--accent); background: #fff; }
.outcome-option strong { font-size: 0.8rem; }
.outcome-option small { color: var(--secondary); font-size: 0.7rem; }
.effect-preview {
  margin-top: 18px;
  padding: 13px 14px;
  display: grid;
  gap: 3px;
  border-radius: var(--r);
  background: var(--surface-subtle);
}
.effect-preview strong { font-size: 0.76rem; }
.effect-preview span { color: var(--secondary); font-size: 0.7rem; }
.deal-action-footer { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--hairline); }
.subhead { margin: 18px 0 6px; }
.subhead h3 { margin: 0; font-size: 0.86rem; }

.timeline { display: grid; }
.timeline-item { min-height: 50px; padding: 9px 0; display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 8px; }
.timeline-dot { width: 7px; height: 7px; margin: 6px auto 0; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline-item strong { display: block; font-size: 0.76rem; }
.timeline-item span { display: block; margin-top: 3px; color: var(--tertiary); font-size: 0.69rem; }

.record-tabs {
  width: 100%;
  margin-bottom: 16px;
  position: sticky;
  top: 72px;
  z-index: 3;
  overflow-x: auto;
  background: rgba(251, 251, 253, 0.92);
  backdrop-filter: blur(18px);
}
.record-tabs button { flex: 1; }
.deal-values, .advanced-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ai-summary { margin-top: 15px; padding: 13px 14px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--hairline); border-radius: var(--r); background: var(--surface-subtle); font-size: 0.76rem; }
.ai-summary .icon { color: var(--accent); }
.ai-panel { margin-top: 15px; padding: 15px; border: 1px solid var(--hairline); border-radius: var(--r); background: var(--surface-subtle); }
.ai-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ai-panel h4 { margin: 0; font-size: 0.84rem; }
.ai-panel p { margin: 8px 0 0; color: var(--secondary); font-size: 0.74rem; }
.ai-facts { margin-top: 11px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ai-fact { padding: 10px; border-radius: var(--r-sm); background: #fff; }
.ai-fact span { display: block; color: var(--tertiary); font-size: 0.66rem; }
.ai-fact b { display: block; margin-top: 3px; font-size: 0.8rem; }
.ai-list { margin: 8px 0 0; padding-left: 18px; color: var(--secondary); font-size: 0.73rem; }
.ai-list-block { margin-top: 13px; }
.ai-actions { margin-top: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ai-history { margin-top: 13px; padding-top: 10px; border-top: 1px solid var(--hairline); }
.ai-history-row { padding: 5px 0; display: flex; justify-content: space-between; gap: 8px; color: var(--tertiary); font-size: 0.68rem; }
.drawer-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--hairline); }
.drawer-section h3 { margin: 0 0 9px; font-size: 0.88rem; }
.audit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.audit-grid div { padding: 10px; border-radius: var(--r-sm); background: var(--surface-subtle); }
.audit-grid span { display: block; color: var(--tertiary); font-size: 0.66rem; }
.audit-grid b { display: block; margin-top: 3px; font-size: 0.78rem; }
.drawer-actions { margin-top: 20px; padding-top: 14px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--hairline); }

.piece-record { margin-top: 10px; overflow: hidden; border: 1px solid var(--hairline); border-radius: var(--r); background: #fff; }
.piece-record-media { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--hairline); }
.piece-record-media img { width: 100%; height: 130px; object-fit: cover; background: var(--surface-subtle); }
.piece-record-copy { padding: 14px; }
.piece-record-copy strong { font-size: 0.85rem; }
.piece-record-copy p { margin: 5px 0 0; color: var(--secondary); font-size: 0.73rem; }
.piece-specs { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.piece-specs span { padding: 5px 8px; border-radius: 999px; background: var(--surface-subtle); color: var(--secondary); font-size: 0.67rem; }

.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.contact-link { min-height: 58px; padding: 11px 13px; border: 1px solid var(--hairline); border-radius: var(--r); background: #fff; color: var(--text); font-size: 0.74rem; text-decoration: none; }
.brand-profile, .history-row { margin-top: 8px; padding: 12px; border: 1px solid var(--hairline); border-radius: var(--r); background: #fff; }
.brand-profile header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand-profile p, .history-row span { margin: 7px 0 0; color: var(--secondary); font-size: 0.71rem; }
.history-row { width: 100%; color: var(--text); text-align: left; }
.history-row strong { display: block; margin-top: 8px; font-size: 0.8rem; }

.kb-safety, .file-note { color: var(--secondary); font-size: 0.72rem; }
.kb-safety { padding: 12px; border-radius: var(--r-sm); background: var(--accent-soft); }
.site-key-result { padding: 18px; }
.site-key-result code { margin: 12px 0; padding: 12px; display: block; overflow-wrap: anywhere; border-radius: var(--r-sm); background: #eeedf0; font-size: 0.72rem; }

.toast {
  max-width: min(360px, calc(100% - 28px));
  min-height: 48px;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  position: fixed;
  right: 18px;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 100;
  border-radius: 13px;
  background: rgba(29, 29, 31, 0.94);
  color: #fff;
  box-shadow: var(--shadow-layer);
  font-size: 0.78rem;
}

@media (max-width: 1120px) {
  .shell { display: block; }
  .sidebar {
    width: 270px;
    position: fixed;
    left: 0;
    transform: translateX(-104%);
    box-shadow: var(--shadow-layer);
    transition: transform var(--motion);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-grid; }
  .today-grid { grid-template-columns: 1fr; }
  .search { width: min(270px, 30vw); }
  .report-grid, .settings-grid { grid-template-columns: 1fr; }
  .deal-list-head, .deal-row { grid-template-columns: minmax(170px, 1.35fr) minmax(160px, 1.1fr) 120px 105px minmax(140px, 0.9fr) 68px; }
}

@media (max-width: 760px) {
  .topbar {
    min-height: 64px;
    padding: max(8px, env(safe-area-inset-top)) 14px 8px;
    flex-wrap: wrap;
    gap: 7px;
  }
  .topbar-title p, .brand-scope, .date-pill { display: none; }
  .topbar-title h1 { font-size: 1rem; }
  .topbar .primary { min-height: 42px; padding-inline: 13px; }
  .search { width: 100%; order: 10; min-height: 40px; }
  .content { padding: 21px 15px 48px; }
  .section-head { align-items: flex-start; }
  .section-head h2 { font-size: 1.92rem; }
  .section-head p { font-size: 0.8rem; }
  .actions .secondary { display: none; }

  .metrics {
    display: flex;
    gap: 9px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }
  .metrics::-webkit-scrollbar { display: none; }
  .metric { min-width: 172px; min-height: 112px; scroll-snap-align: start; }
  .today-grid { gap: 11px; }
  .panel { border-radius: var(--r); }
  .attention-list, .tasks-list { padding-inline: 12px; }
  .attention-row { grid-template-columns: 34px minmax(0, 1fr) 24px; }
  .attention-meta { display: none; }
  .pipeline-strip-panel { margin-top: 11px; }

  .pipeline-toolbar { align-items: stretch; flex-direction: column; }
  .direction-tabs { width: 100%; }
  .direction-tabs button { flex: 1; }
  .pipeline-filters { display: grid; grid-template-columns: 1fr 1fr; justify-content: stretch; }
  .pipeline-filters select { width: 100%; min-width: 0; }
  .deal-view-toggle { flex: 0 0 auto; }

  .deal-list { border: 0; background: transparent; overflow: visible; }
  .deal-list-head { display: none; }
  .deal-row {
    margin-bottom: 9px;
    padding: 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    border: 1px solid var(--hairline);
    border-radius: var(--r);
    background: rgba(255, 255, 255, 0.86);
  }
  .deal-client, .deal-main { grid-column: 1 / -1; }
  .deal-cell-label { display: block; margin-bottom: 3px; }
  .deal-next { grid-column: 1 / -1; }
  .deal-age { text-align: left; }

  .client-row {
    grid-template-columns: 38px minmax(0, 1fr) 24px;
    gap: 10px;
  }
  .client-row .client-initial { width: 38px; height: 38px; }
  .client-stat { display: none; }
  .report-grid, .site-grid, .kb-grid { grid-template-columns: 1fr; }

  .modal { width: calc(100% - 16px); max-height: calc(100vh - 16px); }
  .modal-head, .drawer-head { min-height: 66px; padding-inline: 16px 10px; }
  .modal form, .drawer-body { padding-inline: 16px; }
  .form-grid, .advanced-fields, .deal-values, .advanced-grid { grid-template-columns: 1fr; }
  .form-grid .wide, .advanced-intake { grid-column: auto; }

  .drawer { width: 100%; padding-top: env(safe-area-inset-top); }
  .drawer.is-full { width: 100%; }
  .quick-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .action-chip { padding-inline: 6px; }
  .record-tabs { top: 66px; }
  .record-tabs button { min-width: 100px; }
  .drawer-actions {
    margin: 18px -16px calc(-28px + env(safe-area-inset-bottom));
    padding: 12px 16px max(12px, env(safe-area-inset-bottom));
    position: sticky;
    bottom: 0;
    z-index: 5;
    background: rgba(251, 251, 253, 0.92);
    backdrop-filter: blur(18px);
  }
  .deal-action { min-height: calc(100dvh - 112px - env(safe-area-inset-top)); }
  .deal-action-footer {
    margin: 20px -16px calc(-28px + env(safe-area-inset-bottom));
    padding: 12px 16px max(12px, env(safe-area-inset-bottom));
    position: sticky;
    bottom: 0;
    z-index: 5;
    background: rgba(251, 251, 253, 0.92);
    backdrop-filter: blur(18px);
  }
  .contact-grid { grid-template-columns: 1fr; }
  .toast { right: 14px; }
}

@media (max-width: 390px) {
  .topbar .primary span { display: none; }
  .pipeline-filters { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr; }
}

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