:root {
  --ink: #1b2420;
  --muted: #5c6b63;
  --paper: #f3efe6;
  --card: #fffcf7;
  --line: #e4d9c8;
  --sidebar: #15211c;
  --sidebar-text: #e8f0eb;
  --sidebar-muted: #9eb0a6;
  --accent: #e06a1f;
  --accent-soft: #fff1e7;
  --accent-ink: #8d3e0e;
  --ok: #1c7a4d;
  --ok-soft: #e6f6ec;
  --warn: #8d5b08;
  --warn-soft: #fff3dc;
  --danger: #a3262d;
  --danger-soft: #fdecee;
  --info: #1d5f8a;
  --info-soft: #e7f3f9;
  --neutral-soft: #f3efe7;
  --shadow: 0 14px 34px rgba(28, 36, 31, 0.06);
  --radius: 18px;
  --font: "Outfit", "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
  --sidebar-width: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html:has(.login), body:has(.login) {
  height: 100%;
  overflow: hidden;
}
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(980px 420px at -10% -10%, rgba(224, 106, 31, 0.12), transparent 55%),
    radial-gradient(820px 380px at 110% 0%, rgba(31, 122, 104, 0.12), transparent 50%),
    var(--paper);
}
#app:has(.login) { height: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: var(--display); font-weight: 560; letter-spacing: -0.03em; }

.login {
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(280px, 1.15fr) minmax(300px, 0.85fr);
}
.login-story {
  min-height: 0;
  padding: clamp(18px, 2.4vh, 28px) clamp(22px, 3vw, 40px);
  color: var(--sidebar-text);
  background:
    linear-gradient(165deg, rgba(224, 106, 31, 0.18), transparent 42%),
    var(--sidebar);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: clamp(10px, 1.6vh, 16px);
  align-content: stretch;
}
.login-story .brand { flex-shrink: 0; }
.brand { display: flex; align-items: center; }
.brand-logo { height: clamp(48px, 7vh, 72px); width: auto; display: block; }
.login-intro { min-width: 0; }
.login-story h1 {
  font-size: clamp(1.35rem, 2.2vw + 0.6vh, 2.1rem);
  line-height: 1.08;
  max-width: 18ch;
  margin: 0 0 6px;
}
.login-intro > p {
  margin: 0;
  max-width: 42ch;
  color: #d5e2da;
  font-size: clamp(0.82rem, 0.35vw + 0.7vh, 0.95rem);
  line-height: 1.35;
}
.stage-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0;
  margin: 8px 0 0;
  list-style: none;
}
.stage-list li {
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 999px;
  padding: 3px 8px;
  color: #f3eee4;
  font-size: 0.72rem;
}
.login-ads {
  margin-top: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
  width: 100%;
  max-width: none;
  min-height: 0;
  align-self: stretch;
  justify-self: stretch;
}
.login-ads-empty {
  grid-template-rows: auto auto;
  align-content: start;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
}
.login-ads-placeholder {
  margin: 0;
  color: #9eb0a6;
  font-size: 0.86rem;
}
.login-ads-kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9eb0a6;
  font-weight: 700;
}
.login-slider {
  overflow: hidden;
  min-height: 0;
  height: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
}
.login-slides {
  display: flex;
  align-items: stretch;
  height: 100%;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
.login-slide {
  flex: 0 0 100%;
  min-width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 0;
  display: grid;
  gap: 0;
  align-content: stretch;
  background: transparent;
  border: 0;
  border-radius: 0;
  min-height: 0;
}
.login-slide.has-media {
  grid-template-rows: minmax(0, 1fr) auto;
}
.login-ad-media {
  width: 100%;
  min-height: 0;
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05), transparent 55%),
    rgba(0, 0, 0, 0.28);
  display: grid;
  place-items: center;
}
.login-ad-image {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  margin: 0 auto;
}
.login-ad-copy {
  display: grid;
  gap: 2px;
  min-height: 0;
  padding: 8px 12px 10px;
  background: rgba(12, 18, 15, 0.35);
}
.login-ad strong {
  display: block;
  color: #fff7ef;
  font-size: 0.88rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.login-ad p {
  margin: 0;
  color: #d5e2da;
  font-size: 0.8rem;
  line-height: 1.3;
  max-width: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.login-slider-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
}
.login-slider-btn {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #f3eee4;
  border-radius: 8px;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 1.05rem;
  line-height: 1;
}
.login-slider-btn:hover { background: rgba(255, 255, 255, 0.12); }
.login-slider-dots {
  display: flex;
  gap: 5px;
  justify-content: center;
  flex: 1;
}
.login-slider-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  border: 0;
  padding: 0;
  background: rgba(255, 255, 255, 0.28);
}
.login-slider-dot.active { background: #f3eee4; width: 16px; }
.ad-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.ad-preview-item {
  display: grid;
  gap: 6px;
}
.ad-preview {
  width: 100%;
  height: 96px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--neutral-soft);
}
.ad-thumb-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ad-thumb {
  width: 40px;
  height: 30px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  display: block;
  background: var(--neutral-soft);
}
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 0;
  font-weight: 600;
  cursor: pointer;
}
.check-row input {
  width: auto;
  margin: 0;
}
.login-panel {
  min-height: 0;
  display: grid;
  place-items: center;
  padding: clamp(16px, 2.5vh, 28px) 18px;
  overflow: hidden;
}
.login-card {
  width: min(380px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(16px, 2.2vh, 24px);
  box-shadow: var(--shadow);
}
.login-card h2 { margin-bottom: 4px; font-size: clamp(1.45rem, 2vh + 0.6rem, 1.85rem); }
.login-card .lede {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lede { color: var(--muted); line-height: 1.45; }
.login-card .stack { display: grid; gap: 6px; margin-bottom: 10px; }
.stack { display: grid; gap: 8px; margin-bottom: 14px; }
.login-card input { padding: 9px 11px; }
label { font-size: 0.86rem; font-weight: 600; }
input, select, textarea {
  width: 100%;
  border: 1px solid #d9d0c2;
  background: white;
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
}
textarea { resize: vertical; min-height: 96px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: #c96a32; box-shadow: 0 0 0 4px rgba(224, 106, 31, 0.15); }
.btn {
  border: 0; border-radius: 12px; padding: 11px 14px; font-weight: 600;
  background: var(--sidebar); color: white;
}
.btn:hover { background: #24362e; }
.btn.accent { background: var(--accent); }
.btn.accent:hover { background: #c85a14; }
.btn.ghost, .btn.danger {
  background: transparent; color: var(--ink); border: 1px solid var(--line);
}
.btn.danger { color: var(--danger); border-color: #f0c6c8; }
.btn.full { width: 100%; }
.btn:disabled { opacity: 0.65; cursor: wait; }
.credentials {
  margin-top: 16px;
  background: var(--neutral-soft);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 0.92rem;
}
.credentials strong { color: var(--ink); }
.credential-note { margin: 8px 0 0; font-size: 0.82rem; line-height: 1.4; }
.banner {
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) 1fr; }
.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
.nav { display: grid; gap: 6px; overflow: auto; min-height: 0; }
.nav button, .logout {
  text-align: left;
  background: transparent;
  color: var(--sidebar-text);
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nav button.active, .nav button:hover, .logout:hover { background: rgba(255,255,255,0.08); }
.nav button small, .count-chip {
  color: var(--sidebar-muted);
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.75rem;
}
.sidebar-foot { margin-top: auto; display: grid; gap: 8px; flex-shrink: 0; }
.who strong { display: block; }
.who span { color: var(--sidebar-muted); font-size: 0.85rem; text-transform: capitalize; }
.main { min-width: 0; padding: 22px 28px 48px; }
.topbar {
  display: flex; gap: 16px; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 2;
  margin: -22px -28px 22px;
  padding: 22px 28px 12px;
  background: var(--paper);
}
.signout-btn { display: none; }
.topbar h1 { font-size: 2rem; margin: 0; }
.menu-btn { display: none; }
.top-tools { display: flex; gap: 10px; align-items: center; }
.search {
  width: min(360px, 46vw);
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%235c6b63' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") 12px 50% no-repeat;
  padding-left: 38px;
}
.bell-wrap { position: relative; }
.bell {
  position: relative;
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  font-weight: 700;
}
.bell:hover { border-color: #d7b89a; }
.bell-count {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--danger);
  color: white;
  font-size: 0.72rem;
  display: grid;
  place-items: center;
}
.bell-count[hidden] { display: none; }
.note-panel {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(360px, 78vw);
  max-height: 420px;
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 6;
  padding: 8px;
}
.note-panel.open { display: grid; gap: 6px; }
.note-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 6px 2px; }
.note-head .btn { padding: 6px 8px; }
.note-empty { margin: 8px; }
.note-row {
  display: grid;
  gap: 3px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 12px;
  padding: 8px;
}
.note-row:hover { background: var(--neutral-soft); }
.note-row.unread { background: var(--accent-soft); }
.note-row strong { font-size: 0.92rem; }
.note-row span, .note-row small { color: var(--muted); font-size: 0.82rem; line-height: 1.35; }
.pop-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 7;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100% - 24px));
}
.pop-note {
  text-align: left;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 4px;
}
.pop-note.followup { border-left-color: var(--warn); }
.pop-note.payment { border-left-color: var(--ok); }
.pop-note strong { font-size: 0.95rem; }
.pop-note span { color: var(--muted); font-size: 0.88rem; line-height: 1.4; }
.pop-note small { color: var(--accent-ink); font-weight: 700; }
.metrics { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin: 8px 0 18px; }
.metrics.pay-metrics { grid-template-columns: repeat(4, 1fr); }
.metric {
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.metric span { display: block; color: var(--muted); font-size: 0.82rem; }
.metric strong { display: block; font-family: var(--display); font-size: 2rem; margin-top: 6px; letter-spacing: -0.04em; }
.metric.danger strong { color: var(--danger); }
.metric.warn strong { color: var(--warn); }
.metric.money strong { font-size: 1.35rem; }
.metric:hover { border-color: #d7b89a; }
.grid-2 { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 14px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 8px;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 1.45rem; margin-bottom: 4px; }
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; line-height: 1.45; }
.attention { display: grid; gap: 8px; margin: 12px 0 16px; }
.attention article {
  border: 1px solid var(--line);
  border-left: 4px solid var(--warn);
  border-radius: 12px;
  padding: 10px 12px;
  background: white;
}
.attention article.danger { border-left-color: var(--danger); background: #fffafa; }
.attention button { padding: 0; border: 0; background: none; font-weight: 700; }
.attention p { margin: 4px 0 0; }
.bars { display: grid; gap: 10px; margin: 12px 0 18px; }
.bar-row { display: grid; grid-template-columns: 92px 1fr 28px; gap: 8px; align-items: center; font-size: 0.92rem; }
.bar-track { height: 8px; background: #efe8dc; border-radius: 99px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--teal, #1f7a68); border-radius: 99px; }
.bar-fill.ok { background: var(--ok); }
.bar-fill.info { background: var(--info); }
.bar-fill.warn { background: #e0a33a; }
.bar-fill.danger { background: var(--danger); }
.bar-fill.neutral { background: #8d8478; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filters select, .filters input { width: auto; min-width: 140px; background: white; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 10px; }
.toolbar-actions { display: flex; gap: 8px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: var(--shadow); max-height: calc(100vh - 220px); }
table { width: 100%; border-collapse: collapse; min-width: 980px; }
table.monitoring { width: max-content; min-width: 100%; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid #efe6d8; vertical-align: middle; }
th { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); background: #faf7f1; position: sticky; top: 0; }
table.monitoring th, table.monitoring td { white-space: nowrap; }
table.monitoring td.wrap { white-space: pre-line; min-width: 180px; max-width: 280px; }
table.monitoring thead .group {
  top: 0;
  z-index: 3;
  text-align: center;
  color: var(--accent-ink);
  background: #efe6d8;
  border-left: 1px solid #e4d9c8;
  border-bottom: 1px solid #e4d9c8;
}
table.monitoring thead tr.cols th { top: 38px; }
.sort { border: 0; background: transparent; padding: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; font-weight: 700; }
tbody tr { cursor: pointer; }
tbody td { background: var(--card); }
tbody tr:hover td { background: #fbf6ee; }
tbody tr.is-delayed td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
th:first-child, td:first-child { position: sticky; left: 0; z-index: 1; min-width: 220px; }
th:first-child { z-index: 2; background: #faf7f1; }
table.monitoring thead tr.groups th:first-child { left: auto; z-index: 3; min-width: 0; }
table.monitoring thead tr.cols th:first-child { z-index: 4; }
.pill {
  display: inline-flex; align-items: center; border-radius: 999px;
  padding: 3px 8px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.02em;
  background: var(--neutral-soft); color: var(--muted); white-space: nowrap;
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.info { background: var(--info-soft); color: var(--info); }
.detail-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.crumbs { color: var(--muted); font-size: 0.88rem; margin-bottom: 6px; }
.crumbs button { border: 0; background: none; color: var(--accent-ink); padding: 0; font-weight: 700; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.actions { display: flex; gap: 8px; align-items: center; }
.dirty { color: var(--warn); font-size: 0.85rem; font-weight: 700; }
.sections { display: grid; gap: 14px; }
.section-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.section-card h2 { font-size: 1.55rem; margin-bottom: 2px; }
.kicker { color: var(--accent-ink); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; margin-top: 14px; }
.wide { grid-column: 1 / -1; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.calc-box {
  margin-top: 14px;
  background: #f7f4ee;
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 8px;
}
.calc-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.calc-note { margin: 0; color: var(--muted); font-size: 0.92rem; line-height: 1.45; }
.notice {
  background: var(--info-soft);
  color: var(--info);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.status-trail {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.status-step {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.status-step span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}
.status-step strong {
  display: block;
  margin-top: 6px;
  font-size: 0.95rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.attachment-card, .thread-card, .gap-card { margin-top: 14px; }
.gap-box {
  margin-top: 12px;
  background: var(--warn-soft);
  border-radius: 14px;
  padding: 12px;
}
.gap-box strong { display: block; margin-bottom: 6px; }
.gap-list { margin: 0; padding-left: 18px; }
.gap-list li { margin: 2px 0; }
.gap-clear {
  margin: 12px 0 0;
  background: var(--ok-soft);
  color: var(--ok);
  border-radius: 12px;
  padding: 10px 12px;
}
.follow-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.follow-row input { flex: 1; min-width: 0; background: white; }
.follow-row .btn { flex-shrink: 0; }
.gap-box .banner { margin: 10px 0 0; }
.thread { display: grid; gap: 8px; margin-top: 14px; }
.thread-empty { margin: 14px 0 0; }
.bubble {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: #fbf8f3;
}
.bubble.mine { background: var(--accent-soft); border-color: #f0d2bc; }
.bubble header { display: flex; justify-content: space-between; gap: 8px; font-size: 0.82rem; }
.bubble header span { color: var(--muted); }
.bubble p { margin: 6px 0 0; white-space: pre-wrap; line-height: 1.45; }
.composer { display: grid; gap: 8px; margin-top: 14px; }
.composer textarea { min-height: 72px; }
.upload-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.upload-row input[type="file"] { flex: 1; min-width: 220px; padding: 8px 10px; background: white; }
.attachment-card .banner, .proof-block .banner { margin-top: 12px; }
.proof-block { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.proof-block h3 { font-size: 1.05rem; margin: 0 0 4px; }
.proof-flag {
  display: inline-block;
  margin-left: 8px;
  background: var(--ok-soft);
  color: var(--ok);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  vertical-align: middle;
}
.file-empty { margin: 14px 0 0; }
.file-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.file-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fbf8f3;
}
.file-copy { min-width: 0; }
.file-copy strong { display: block; word-break: break-word; }
.file-meta { display: block; color: var(--muted); font-size: 0.82rem; margin-top: 2px; }
.file-actions { display: flex; gap: 8px; flex-shrink: 0; }
.file-actions .btn { padding: 8px 10px; }
.empty { padding: 28px 12px 36px; text-align: center; color: var(--muted); }
.map-layout { display: grid; grid-template-columns: minmax(240px, 300px) 1fr; gap: 14px; align-items: start; }
.map-panel { max-height: calc(100vh - 128px); overflow: auto; }
.map-sites { display: grid; gap: 8px; }
.map-site {
  display: grid; gap: 6px;
  background: var(--neutral-soft); border: 1px solid transparent; border-radius: 12px; padding: 10px 12px;
}
.map-site-pick {
  display: grid; gap: 2px; width: 100%; text-align: left;
  background: transparent; border: 0; padding: 0;
}
.map-site strong { font-size: 0.95rem; }
.map-site span { color: var(--muted); font-size: 0.82rem; line-height: 1.35; }
.map-site.active { border-color: var(--accent); background: var(--accent-soft); }
.map-site.unmapped { opacity: 0.72; }
.map-coords { white-space: pre-line; color: var(--ink); font-variant-numeric: tabular-nums; }
.map-open {
  justify-self: start; background: transparent; border: 0; padding: 0;
  color: var(--accent-ink); font-weight: 600; font-size: 0.82rem;
}
.map-all { justify-self: start; margin-bottom: 4px; }
.site-map { height: calc(100vh - 128px); min-height: 460px; border-radius: var(--radius); border: 1px solid var(--line); background: #d7e2d8; }
.borehole-map { height: 360px; border-radius: 14px; border: 1px solid var(--line); background: #d7e2d8; }
.borehole-map[hidden] { display: none; }
.map-card { margin-bottom: 14px; }
.map-pin-wrap { background: transparent; border: 0; }
.map-pin {
  display: block; width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 2px solid #fff;
}
.map-pin.ok { background: var(--ok); }
.map-pin.warn { background: var(--warn); }
.map-pin.borehole { width: 12px; height: 12px; background: var(--info); }
.map-popup { display: grid; gap: 4px; min-width: 180px; }
.map-popup p { margin: 0; color: var(--muted); font-size: 0.86rem; }
.map-popup-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.map-popup-actions .btn { padding: 6px 8px; font-size: 0.82rem; }
.leaflet-container { font-family: var(--font); }
.account-layout { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 14px; align-items: start; }
.account-form { padding-bottom: 16px; }
.account-form .stack:last-of-type { margin-bottom: 0; }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.account-table table { min-width: 720px; }
.account-table th:first-child, .account-table td:first-child { position: static; min-width: 0; }
.pay-clients { display: grid; gap: 14px; }
.pay-client { margin: 0; }
.payment-table table { min-width: 760px; }
.payment-table th:first-child, .payment-table td:first-child { position: static; min-width: 180px; }
.payment-table tbody tr { cursor: pointer; }
.field-hint { margin: 4px 0 0; color: var(--muted); font-size: 0.82rem; line-height: 1.4; }
.metrics.income-metrics { grid-template-columns: repeat(3, 1fr); }
.income-card { padding-bottom: 16px; }
.income-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 8px 0 12px; color: var(--muted); font-size: 0.85rem; }
.income-legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.swatch.whole { background: #1f7a68; }
.swatch.development { background: var(--accent); }
.swatch.projected {
  background: repeating-linear-gradient(-45deg, #1f7a68, #1f7a68 2px, rgba(31, 122, 104, 0.35) 2px, rgba(31, 122, 104, 0.35) 4px);
}
.income-scroll { overflow-x: auto; padding-bottom: 4px; }
.income-plot { display: flex; gap: 6px; align-items: end; min-width: min-content; }
.income-col {
  border: 0;
  background: transparent;
  padding: 6px 4px 0;
  min-width: 64px;
  display: grid;
  gap: 6px;
  justify-items: center;
  border-radius: 12px;
}
.income-col.active { background: var(--accent-soft); }
.income-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: 46px; height: 180px; align-items: end; }
.income-stack {
  height: 100%;
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-start;
  background: #efe8dc;
  border-radius: 6px 6px 2px 2px;
  overflow: hidden;
}
.income-bar { display: block; width: 100%; }
.income-bar.whole { background: #1f7a68; }
.income-bar.development { background: var(--accent); }
.income-bar.projected { opacity: 0.55; }
.income-tick { color: var(--muted); font-size: 0.72rem; line-height: 1.2; white-space: pre-line; text-align: center; }
.income-table table { min-width: 760px; }
.income-table th:first-child, .income-table td:first-child { position: static; min-width: 140px; }
.income-table tbody tr.selected td { background: var(--accent-soft); }
.income-detail { margin-top: 14px; padding-bottom: 16px; }
.income-note { margin-top: 12px; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.money.due { color: var(--danger); font-weight: 700; }
.money.clear { color: var(--ok); font-weight: 700; }
.account-table tbody tr.selected td { background: var(--accent-soft); }
.password-cell { font-family: ui-monospace, Consolas, monospace; letter-spacing: 0.01em; }
.row-actions { display: flex; gap: 6px; }
.btn.compact { padding: 7px 10px; font-size: 0.82rem; }
.secret-input { font-family: ui-monospace, Consolas, monospace; }
.toast {
  position: fixed; bottom: 86px; right: 18px; z-index: 9;
  background: var(--sidebar); color: white; border-radius: 14px;
  padding: 12px 14px; box-shadow: var(--shadow); max-width: min(360px, calc(100% - 24px));
}
.chat-widget {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 8;
  display: grid;
  gap: 10px;
  justify-items: end;
}
.chat-fab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  box-shadow: 0 12px 28px rgba(141, 62, 14, 0.35);
  position: relative;
}
.chat-fab:hover { background: #c85a14; }
.chat-fab-icon { font-size: 1.15rem; line-height: 1; }
.chat-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid white;
}
.chat-fab .chat-badge { position: absolute; top: -7px; right: -4px; }
.chat-badge[hidden] { display: none; }
.chat-badge.static { position: static; border: 0; flex: none; }
.chat-panel {
  width: min(360px, calc(100vw - 24px));
  height: min(520px, calc(100dvh - 110px));
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 20px 44px rgba(28, 36, 31, 0.22);
  overflow: hidden;
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  flex: none;
}
.chat-head-copy { min-width: 0; flex: 1; display: grid; gap: 1px; }
.chat-head-copy strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head-copy span { color: var(--sidebar-muted); font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-icon-btn {
  border: 0;
  background: rgba(255,255,255,0.08);
  color: inherit;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  font-size: 1.15rem;
  line-height: 1;
  flex: none;
  display: grid;
  place-items: center;
}
.chat-icon-btn:hover { background: rgba(255,255,255,0.16); }
.chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 0.82rem;
  display: grid;
  place-items: center;
  flex: none;
}
.chat-contacts { overflow: auto; flex: 1; padding: 6px; display: flex; flex-direction: column; }
.chat-contact {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 14px;
  padding: 9px 8px;
}
.chat-contact:hover { background: var(--neutral-soft); }
.chat-contact-copy { min-width: 0; flex: 1; display: grid; gap: 1px; }
.chat-contact-copy strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-contact-meta { color: var(--muted); font-size: 0.76rem; }
.chat-contact-preview {
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-contact.unread .chat-contact-preview { color: var(--ink); font-weight: 600; }
.chat-contact-side { display: grid; gap: 5px; justify-items: end; flex: none; }
.chat-contact-side small { color: var(--muted); font-size: 0.7rem; max-width: 86px; text-align: right; }
.chat-conversation { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-messages {
  flex: 1;
  overflow: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fbf8f3;
}
.chat-bubble {
  max-width: 82%;
  align-self: flex-start;
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px 16px 16px 4px;
  padding: 8px 11px;
}
.chat-bubble.mine {
  align-self: flex-end;
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  border-radius: 16px 16px 4px 16px;
}
.chat-bubble p { margin: 0; white-space: pre-wrap; line-height: 1.4; overflow-wrap: anywhere; }
.chat-bubble small { display: block; margin-top: 4px; font-size: 0.7rem; opacity: 0.75; }
.chat-empty { margin: auto; padding: 18px; text-align: center; }
.chat-error { margin: 8px 10px 0; }
.chat-composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: var(--card);
  flex: none;
}
.chat-composer textarea { min-height: 42px; max-height: 110px; flex: 1; }
.chat-composer .btn { flex: none; }
.privacy-login-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}
.privacy-gate {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px 16px;
}
.privacy-card {
  width: min(740px, 100%);
  max-height: calc(100dvh - 40px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 22px 22px 16px;
}
.privacy-kicker {
  margin: 0;
  color: var(--accent-ink);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.privacy-card h1 { margin: 0; font-size: clamp(1.6rem, 2vw, 2.15rem); }
.privacy-card .lede { margin: 0; }
.privacy-body {
  overflow: auto;
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  padding: 4px 16px 12px;
}
.privacy-body h2 {
  font-family: var(--font);
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0;
  margin: 14px 0 4px;
}
.privacy-body p { margin: 0; line-height: 1.5; }
.privacy-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 600;
  line-height: 1.45;
}
.privacy-check input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex: none;
}
.privacy-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.audit-table table { min-width: 880px; }
.audit-table th:first-child, .audit-table td:first-child { position: static; min-width: 168px; }
.audit-table tbody tr.audit-row { cursor: pointer; }
.audit-table tbody tr.audit-detail { cursor: default; }
.audit-table tbody tr.audit-detail td { background: #faf7f1; white-space: normal; }
.audit-statement {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--font);
  font-size: 0.92rem;
  line-height: 1.5;
}
.audit-meta { margin: 10px 0 0; color: var(--muted); font-size: 0.82rem; }
.scrim { display: none; }
@media (max-width: 1100px) {
  .metrics, .metrics.pay-metrics, .metrics.income-metrics { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .login {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1.05fr) minmax(0, 0.95fr);
  }
  .login-story {
    padding: 16px 16px 12px;
    gap: 8px;
  }
  .login-story h1 { font-size: clamp(1.25rem, 5vw, 1.7rem); max-width: none; }
  .login-ads { width: 100%; max-width: none; justify-self: stretch; }
  .login-panel { padding: 12px 14px 16px; align-items: start; }
  .login-card { width: 100%; border-radius: 16px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 4; width: min(84vw, 300px); transform: translateX(-105%);
    transition: transform 160ms ease; height: 100vh;
  }
  .sidebar.open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(18, 24, 20, 0.45); z-index: 3; }
  .menu-btn { display: inline-flex; }
  .main { padding: 16px 14px 40px; }
  .topbar { align-items: flex-start; margin: -16px -14px 16px; padding: 16px 14px 10px; }
  .signout-btn { display: inline-flex; flex: none; padding: 11px 12px; }
  .topbar h1 { font-size: 1.6rem; }
  .top-tools { width: 100%; }
  .search { width: auto; flex: 1; min-width: 0; }
  .metrics, .metrics.pay-metrics, .metrics.income-metrics { grid-template-columns: 1fr 1fr; }
  .status-trail { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .account-layout, .map-layout { grid-template-columns: 1fr; }
  .map-panel, .site-map { max-height: none; height: auto; }
  .site-map { height: 68vh; min-height: 320px; }
  .detail-head, .toolbar, .card-head, .file-row, .follow-row, .bubble header { flex-direction: column; align-items: stretch; }
  .file-actions { justify-content: flex-start; }
  .chat-widget { right: 12px; bottom: 12px; }
  .chat-fab-label { display: none; }
  .chat-fab { padding: 13px; border-radius: 999px; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
  .login-slides { transition: none; }
}
