:root {
  font-family: Inter, system-ui, sans-serif;
  color: #142b28;
  background: #f5f7f5;
  line-height: 1.5;
  --green: #176652;
  --dark: #142e2b;
  --line: #dce6e0;
  --muted: #51645d;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
body.signed-in { display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.workspace-main { min-width: 0; }
.side {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  padding: 26px 16px;
  background: var(--dark);
  color: #eef6f1;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; font-size: 20px; font-weight: 750; }
.brand small { display: block; color: #b1c9bf; font-size: 10px; letter-spacing: .1em; }
.logo { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: #a9e7c9; color: #163d32; font-size: 24px; }
#mobile-menu, .mobile-cell-label { display: none; }
.nav-label { margin: 47px 8px 12px; color: #b1c9bf; font-size: 10px; letter-spacing: .13em; }
.side nav { display: grid; gap: 6px; }
.side nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: stretch;
  padding: 11px;
  background: transparent;
  border-color: transparent;
  color: #dbe9e3;
  text-align: left;
  font-weight: 600;
}
.side nav button:hover, .side nav button[aria-current="page"] { background: #264b41; color: #e8fff1; }
.side nav button [aria-hidden] { width: 16px; flex-shrink: 0; font-size: 17px; }
.side-foot { margin-top: auto; padding: 17px 4px 0; border-top: 1px solid #35514b; font-size: 12px; }
.dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #99dfbf; }
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 34px;
  background: white;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
}
#breadcrumb { color: var(--muted); }
.badge { display: inline-flex; padding: 4px 10px; border-radius: 999px; background: #e3f3e9; color: #155744; font-size: 11px; font-weight: 700; white-space: nowrap; }
main { max-width: 1450px; margin: auto; padding: 28px 34px 50px; }
body:not(.signed-in) main { max-width: 690px; }
.eyebrow { margin: 0 0 8px; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .13em; }
h1 { margin: 0; font-size: clamp(28px, 4vw, 43px); line-height: 1.1; letter-spacing: -.035em; }
h2 { margin: 0 0 10px; font-size: 19px; }
h3 { margin: 12px 0 4px; }
.panel { min-width: 0; margin-top: 16px; padding: 22px; background: white; border: 1px solid var(--line); border-radius: 13px; }
form { display: grid; gap: 12px; margin: 12px 0; }
label { display: grid; gap: 4px; font-size: 13px; font-weight: 650; }
input, select { width: 100%; min-width: 0; padding: 9px; border: 1px solid #bfcfc6; border-radius: 8px; background: white; color: inherit; font: inherit; }
fieldset { display: grid; gap: 8px; border: 1px solid var(--line); border-radius: 7px; }
button { justify-self: start; padding: 8px 13px; border: 1px solid var(--green); border-radius: 8px; background: var(--green); color: white; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #328c73; outline-offset: 3px; }
.secondary { border-color: var(--line); background: white; color: #125740; }
.home-contact-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-inline-start: 8px;
  vertical-align: middle;
  border-radius: 50%;
  background: #e3f3e9;
  color: #155744;
  font-size: 15px;
  line-height: 1;
}
button:disabled { opacity: .6; cursor: wait; }
.row { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.form-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.check { display: flex; align-items: center; gap: 7px; }
.check input { width: auto; }
#user-homes { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 5px; }
hr { margin: 22px 0; border: 0; border-top: 1px solid var(--line); }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
td, th { padding: 11px 14px; border-bottom: 1px solid #edf1ee; }
th { background: #f7faf8; color: var(--muted); font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
tfoot { border-top: 2px solid var(--line); background: #eef6f1; font-weight: 750; }
tfoot th { background: transparent; color: inherit; }
#status { margin: 8px 0 0; }
#status:empty { display: none; }
.error { color: #9c2424; }
.dashboard-intro { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 12px; margin: 10px 0 17px; }
.dashboard-intro p { margin: 0; }
.muted { color: var(--muted); font-size: 13px; }
.callout { margin: 0 0 17px; padding: 12px 16px; border: 1px solid #d5e7dc; border-left: 4px solid #378366; border-radius: 10px; background: #edf5ef; color: #2b5244; font-size: 13px; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.metric { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.metric p { margin: 0; color: var(--muted); font-size: 13px; font-weight: 650; }
.metric strong { display: block; margin: 7px 0 3px; font-size: clamp(18px, 2.2vw, 28px); letter-spacing: -.035em; overflow-wrap: anywhere; }
.metric small { display: block; color: var(--muted); font-size: 12px; }
.dashboard-panel { padding: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; }
.panel-note { margin: 0; padding: 10px 18px; }
.dashboard-panel .table-wrap { border-radius: 0 0 13px 13px; }
.dashboard-panel td, .dashboard-panel th { white-space: nowrap; }
.dashboard-panel .table-wrap:empty { display: none; }
#dashboard-balances:not(:has(table)) { padding: 6px 18px 14px; font-size: 13px; color: var(--muted); }
@media (max-width: 1120px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media screen and (max-width: 760px) {
  body.signed-in { display: block; }
  .side {
    height: auto;
    max-height: 76vh;
    max-height: 76dvh;
    padding: 10px max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left));
    z-index: 5;
  }
  .side-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .brand { padding: 0; font-size: 17px; }
  .logo { width: 36px; height: 36px; font-size: 21px; }
  .brand small, .nav-label, .side-foot { display: none; }
  #mobile-menu {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #264b41;
    border-color: #50786b;
    color: #eef6f1;
    white-space: nowrap;
  }
  .side nav { display: none; margin-top: 10px; padding-top: 10px; border-top: 1px solid #35514b; }
  .side nav.is-open { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .side nav button { min-width: 0; padding: 9px 10px; font-size: 14px; }
  header { padding: 8px 14px; flex-wrap: wrap; }
  .signed-in header { justify-content: flex-end; }
  .signed-in #workspace-heading { display: none; }
  main { min-width: 0; padding: 20px 14px 35px; }
  #title { scroll-margin-top: 78px; }
  .panel:not(.dashboard-panel) { padding: 14px; }
  .panel-head { padding: 13px 14px; }
  .panel-note { padding-inline: 14px; }
  button, input:not([type="checkbox"]), select { min-height: 44px; }
  input:not([type="checkbox"]), select { font-size: 16px; }
  input[type="file"] { max-width: 100%; }
  form, fieldset, .form-columns, .form-columns > label { min-width: 0; }
  textarea { max-width: 100%; font-size: 16px; }
  .table-wrap { max-width: 100%; }
  .table-wrap :is(th, td) { padding-inline: 10px; }
  dialog { width: min(640px, calc(100% - 20px)); max-height: 88vh; max-height: 88dvh; }
  .check { min-height: 44px; }
  .check input, .table-wrap input[type="checkbox"] { width: 19px; height: 19px; }
}

@media screen and (max-width: 560px) {
  .side nav.is-open, .form-columns, .metrics { grid-template-columns: minmax(0, 1fr); }
  .metric { padding: 12px 14px; }
  .metric strong { font-size: 23px; }
  [data-mobile-cards] table { display: block; }
  [data-mobile-cards] thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  [data-mobile-cards] tbody { display: grid; gap: 9px; }
  [data-mobile-cards] tbody tr {
    display: grid;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fbfcfb;
  }
  [data-mobile-cards] tbody td {
    display: grid;
    grid-template-columns: minmax(0, 35%) minmax(0, 1fr);
    gap: 6px 10px;
    align-items: start;
    padding: 6px 0;
    border: 0;
    overflow-wrap: anywhere;
  }
  [data-mobile-cards] tbody td + td { border-top: 1px solid #edf1ee; }
  .mobile-cell-label { display: block; color: var(--muted); font-weight: 650; }
  .mobile-cell-value { min-width: 0; }
  .mobile-cell-value .row { gap: 6px; }
  [data-mobile-cards] button { max-width: 100%; white-space: normal; }
}

@media screen and (max-width: 360px) {
  .signed-in header > .row { gap: 5px; }
  .signed-in header button { padding-inline: 8px; }
  main { padding-inline: 10px; }
  .panel:not(.dashboard-panel) { padding: 12px; }
}

#registry-import { margin-bottom: 18px; }
#registry-import summary { cursor: pointer; font-weight: 650; }
#registry-import-preview input { width: auto; }

#extra-homes { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 6px; }
.extra-list { border-left: 4px solid #ad4741; }
#finance-import { margin: 18px 0; }
#finance-matrix th, #finance-matrix td { white-space: nowrap; }
.report-actions { margin-top: 14px; }
dialog { width: min(760px, 96vw); max-height: 86vh; border: 1px solid var(--line); border-radius: 13px; padding: 0; }
dialog > .panel { margin: 0; }
dialog::backdrop { background: #142e2b80; }
@media print {
  body:has(#finance:not([hidden]) #delivery-report:not([hidden])) { display: block; background: #fff; }
  body:has(#finance:not([hidden]) #delivery-report:not([hidden])) :is(.side, header, #title, .eyebrow, #status, #finance > section:first-child, #finance > section:last-child, #delivery-form) { display: none; }
  #finance > section { border: 0; padding: 0; }
  #delivery-results { overflow: visible; }
}
