
:root {
  color-scheme: light;
  --ink: #172624;
  --muted: #657471;
  --line: #dce5e2;
  --soft: #f3f7f5;
  --paper: #ffffff;
  --green: #176b5b;
  --green-dark: #0d4c40;
  --mint: #dff1eb;
  --amber: #a85d0b;
  --amber-soft: #fff3d9;
  --red: #a23b3b;
  --red-soft: #fce9e7;
  --blue: #31659c;
  --shadow: 0 18px 50px rgba(28, 54, 49, .12);
}

* { box-sizing: border-box; }
html { background: #edf3f0; }
body {
  margin: 0;
  min-width: 320px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 5% 0%, rgba(116, 181, 158, .18), transparent 30rem),
    #edf3f0;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.mobile-only { display: none; }

.app-shell { min-height: 100vh; }
.topbar {
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 64px);
  background: rgba(255,255,255,.88);
  border-bottom: 1px solid rgba(196, 211, 206, .85);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.1;
}
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  color: white; background: var(--green);
  font-family: Georgia, serif; font-weight: 700; font-size: 22px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.22);
}
.brand strong { display: block; font-size: 15px; letter-spacing: -.01em; }
.brand small { display: block; color: var(--muted); margin-top: 3px; font-size: 11px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.sync-state { color: var(--muted); font-size: 12px; margin-right: 5px; }

main { max-width: 1500px; margin: 0 auto; padding: 42px clamp(18px, 4vw, 64px) 64px; }
.login-panel {
  max-width: 700px;
  margin: 9vh auto 0;
  padding: clamp(34px, 7vw, 70px);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255,255,255,.9);
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-weight: 750;
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.login-panel h1, .page-heading h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -.035em;
  line-height: 1.06;
}
.login-panel h1 { margin: 0; max-width: 590px; font-size: clamp(40px, 7vw, 68px); }
.login-panel > p:not(.eyebrow):not(.error-text) {
  color: var(--muted); font-size: 18px; line-height: 1.65; max-width: 570px; margin: 24px 0 30px;
}
.error-text { color: var(--red); margin: 18px 0 0; }

.button {
  border: 0;
  border-radius: 10px;
  min-height: 42px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 700;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button:focus-visible, .icon-button:focus-visible, .tab:focus-visible, .row-open:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(38, 126, 109, .25);
  outline-offset: 2px;
}
.button-primary { background: var(--green); color: white; box-shadow: 0 8px 20px rgba(23,107,91,.2); }
.button-primary:hover { background: var(--green-dark); }
.button-secondary { background: var(--mint); color: var(--green-dark); }
.button-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.button-danger { background: var(--red-soft); color: var(--red); }
.button-small { min-height: 34px; padding: 0 11px; font-size: 12px; }

.page-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 28px; }
.page-heading h1 { margin: 0; font-size: clamp(38px, 5vw, 56px); }
.subhead { margin: 8px 0 0; color: var(--muted); }
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.metric-card {
  min-height: 126px;
  padding: 21px;
  border-radius: 16px;
  background: rgba(255,255,255,.82);
  border: 1px solid rgba(211, 223, 219, .9);
}
.metric-card.featured { background: var(--green); color: white; border-color: var(--green); }
.metric-label { display: block; color: var(--muted); font-size: 12px; font-weight: 650; }
.featured .metric-label { color: rgba(255,255,255,.74); }
.metric-value { display: block; margin-top: 13px; font-family: Georgia, serif; font-size: 36px; line-height: 1; }
.metric-detail { display: block; margin-top: 11px; color: var(--muted); font-size: 11px; }
.featured .metric-detail { color: rgba(255,255,255,.72); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid #cad7d2; }
.tab {
  position: relative;
  border: 0;
  color: var(--muted);
  background: transparent;
  padding: 13px 17px;
  font-weight: 700;
  font-size: 13px;
}
.tab span {
  display: inline-grid; place-items: center;
  min-width: 22px; height: 20px; margin-left: 5px; padding: 0 6px;
  border-radius: 10px; background: rgba(109,128,122,.12);
  font-size: 10px;
}
.tab.active { color: var(--green-dark); }
.tab.active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px;
  height: 3px; border-radius: 3px 3px 0 0; background: var(--green);
}
.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) repeat(3, auto);
  gap: 10px;
  margin: 18px 0;
}
.toolbar input, .toolbar select {
  width: 100%; min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.82);
  color: var(--ink);
  padding: 0 13px;
}
.search-field { position: relative; }
.search-field > span:not(.sr-only) { position: absolute; left: 13px; top: 9px; color: var(--muted); font-size: 19px; }
.search-field input { padding-left: 38px; }
.warning-banner {
  margin: 0 0 14px; padding: 13px 15px; border-radius: 10px;
  background: var(--amber-soft); color: #78440d; border: 1px solid #edd6a4;
  font-size: 13px;
}

.table-panel {
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255,255,255,.92);
  border: 1px solid #d6e0dd;
  box-shadow: 0 10px 32px rgba(31,59,52,.06);
}
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 1030px; }
th {
  padding: 13px 16px;
  text-align: left;
  color: #76837f;
  background: #f7faf8;
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}
td { padding: 17px 16px; border-bottom: 1px solid #e7eeeb; vertical-align: middle; font-size: 13px; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: #f8fbfa; }
.hoa-name { font-weight: 760; margin-bottom: 4px; }
.cell-subtext { color: var(--muted); font-size: 11px; }
.quote-amount { font-weight: 720; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 25px; padding: 0 9px; border-radius: 999px;
  font-size: 10px; font-weight: 750; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.badge-green { color: var(--green); background: var(--mint); }
.badge-amber { color: var(--amber); background: var(--amber-soft); }
.badge-red { color: var(--red); background: var(--red-soft); }
.badge-blue { color: var(--blue); background: #e7f0fb; }
.badge-gray { color: #61706c; background: #edf1ef; }
.timeline-value { font-weight: 700; }
.timeline-sub { margin-top: 4px; font-size: 11px; }
.tone-red { color: var(--red); }
.tone-amber { color: var(--amber); }
.tone-green { color: var(--green); }
.note-preview { max-width: 260px; color: #455552; line-height: 1.4; }
.row-open, .icon-button {
  width: 36px; height: 36px; border: 0; border-radius: 10px;
  background: var(--soft); color: var(--green-dark); font-weight: 800;
}
.empty-state { text-align: center; padding: 70px 20px; }
.empty-state h2 { margin: 14px 0 5px; font-family: Georgia, serif; font-weight: 500; }
.empty-state p { margin: 0; color: var(--muted); }
.empty-icon {
  width: 48px; height: 48px; display: inline-grid; place-items: center;
  border-radius: 50%; background: var(--mint); color: var(--green); font-size: 22px;
}

.drawer-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(19, 35, 32, .32); backdrop-filter: blur(2px);
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
  width: min(620px, 100vw);
  background: #fbfdfc;
  box-shadow: -20px 0 60px rgba(18,42,36,.18);
  transform: translateX(103%);
  transition: transform .24s ease;
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-header {
  display: flex; align-items: start; justify-content: space-between;
  padding: 28px 30px 22px;
  background: white; border-bottom: 1px solid var(--line);
}
.drawer-header h2 {
  margin: 0; font-family: Georgia, serif; font-size: 30px; font-weight: 500; letter-spacing: -.02em;
}
.drawer-contact { color: var(--muted); margin: 6px 0 0; font-size: 12px; }
.drawer-body { overflow-y: auto; padding: 24px 30px 50px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 22px; }
.detail-card { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.detail-card span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.detail-card strong { display: block; margin-top: 7px; font-size: 13px; }
.section-card { background: white; border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-top: 14px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-heading h3 { margin: 0; font-size: 14px; }
.form-row { display: flex; gap: 8px; align-items: end; }
.field { display: block; flex: 1; }
.field > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 650; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; background: white; padding: 10px; color: var(--ink);
}
.field textarea { min-height: 92px; resize: vertical; line-height: 1.45; }
.note-list { display: grid; gap: 10px; margin-top: 14px; }
.note { border: 1px solid var(--line); border-radius: 11px; padding: 13px; background: #fbfdfc; }
.note p { margin: 0; white-space: pre-wrap; line-height: 1.5; font-size: 13px; }
.note-meta { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-top: 10px; color: var(--muted); font-size: 10px; }
.note-actions { display: flex; gap: 5px; }
.text-button { border: 0; background: transparent; color: var(--green); font-weight: 700; font-size: 10px; padding: 3px; }
.text-button.danger { color: var(--red); }
.stale-message { margin: 12px 0 0; color: var(--amber); font-size: 11px; }
.correction-panel { margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line); }
.correction-panel summary { color: var(--red); font-size: 11px; font-weight: 750; cursor: pointer; }
.correction-panel .field { margin-top: 11px; }
.correction-reason textarea { min-height: 70px; }
.correction-panel .button { margin-top: 9px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 80;
  transform: translateX(-50%);
  padding: 12px 17px; border-radius: 10px;
  background: var(--ink); color: white; box-shadow: var(--shadow); font-size: 12px;
}

@media (max-width: 900px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
  .topbar .sync-state, .topbar #syncButton { display: none !important; }
  .mobile-only { display: inline-flex; }
}
@media (max-width: 620px) {
  .topbar { padding: 0 17px; }
  .brand small { display: none; }
  main { padding: 26px 14px 50px; }
  .page-heading { align-items: center; }
  .subhead { max-width: 270px; font-size: 13px; }
  .metric-grid { gap: 9px; }
  .metric-card { min-height: 112px; padding: 16px; }
  .metric-value { font-size: 30px; }
  .toolbar { grid-template-columns: 1fr; }
  .search-field { grid-column: auto; }
  .tabs { overflow-x: auto; }
  .tab { padding-inline: 12px; white-space: nowrap; }
  .drawer-header, .drawer-body { padding-left: 18px; padding-right: 18px; }
  .detail-grid { grid-template-columns: 1fr; }
  .form-row { align-items: stretch; flex-direction: column; }
}
