:root {
  --ink: #172735;
  --muted: #68757d;
  --paper: #f4f5f4;
  --line: #e0e5e4;
  --accent: #f3bd48;
  --dark: #111e2b;
  --green: #20765c;
  --red: #a33f31;
  --round: 14px;
  --nav-h: 0px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100%;
}

button, input, select, textarea { font: inherit; }
button, a, label, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { cursor: pointer; border: 0; background: none; }
button:disabled { opacity: .45; cursor: not-allowed; }
a { color: inherit; }
svg { display: block; flex-shrink: 0; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #568bce;
  outline-offset: 3px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 28px; line-height: 1.2; letter-spacing: -1px; margin-bottom: 8px; }
h2 { font-size: 19px; letter-spacing: -.3px; margin-bottom: 6px; }
h3 { font-size: 15px; margin-bottom: 6px; }
p { margin-bottom: 12px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.eyebrow {
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--muted);
}

.skip {
  position: fixed;
  left: 10px;
  top: -60px;
  background: #fff;
  padding: 12px;
  z-index: 100;
}
.skip:focus { top: 10px; }

/* Mobile-first chrome */
.sidebar { display: none; }
.layout { margin: 0; }

.topbar {
  height: 67px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
  background: #fafbf9;
  position: sticky;
  top: 0;
  z-index: 15;
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 750;
  margin-right: auto;
  letter-spacing: -.5px;
}

.brandmark {
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--dark);
  width: 29px;
  height: 32px;
  border-radius: 6px;
}

.searchbutton {
  min-width: 0;
  padding: 9px;
  border: 0;
  background: none;
  color: var(--muted);
  display: flex;
  gap: 12px;
  align-items: center;
}
.searchbutton span, .searchbutton kbd { display: none; }

.topright {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
}
.topright .date, .topright .device, .topright .avatar { display: none; }

.avatar {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 33px;
  height: 33px;
  background: #fff;
  font-size: 11px;
  font-weight: 700;
}

.main {
  max-width: 1500px;
  margin: auto;
  padding: 24px 16px calc(100px + env(safe-area-inset-bottom));
}

.pagehead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}
.pagehead p { margin: 0; color: var(--muted); font-size: 13px; }

.buttons { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.btn {
  background: #fff;
  border: 1px solid #d8dfdf;
  min-height: 41px;
  border-radius: 8px;
  padding: 9px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
  white-space: nowrap;
}
.btn:hover { border-color: #8c9da5; }
.btn.primary { background: var(--accent); color: #1b2830; border-color: var(--accent); }
.btn.dark { background: var(--dark); color: #fff; border-color: var(--dark); }
.btn.ghost { background: none; border-color: transparent; }
.btn.danger { color: var(--red); }
.btn.sm { min-height: 34px; padding: 6px 10px; font-size: 12px; }

.hero {
  background: var(--dark);
  color: #fff;
  border-radius: var(--round);
  padding: 24px;
  position: relative;
  overflow: hidden;
  margin-bottom: 22px;
  min-height: 220px;
}
.hero .eyebrow { color: var(--accent); margin-bottom: 14px; }
.hero h2 { font-size: 26px; letter-spacing: -.8px; max-width: 290px; margin-bottom: 12px; }
.hero p { color: #aebcc5; max-width: 340px; font-size: 14px; margin-bottom: 22px; }
.hero > div { position: relative; z-index: 1; }
.hero-art {
  position: absolute;
  right: -70px;
  top: 0;
  opacity: .14;
  width: 320px;
  height: 230px;
}
.hero-art text { font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; fill: #a2b4be; }

.sectionhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 25px 0 13px;
  gap: 15px;
}
.sectionhead h2 { margin: 0; }
.textbtn {
  background: none;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  border: 0;
  padding: 8px;
  cursor: pointer;
}

.quickgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
}
.quickcard {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 18px;
  color: var(--ink);
}
.quickcard .arrow { float: right; font-size: 17px; }
.toolicon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #f5f1e7;
  color: #7e6828;
  margin-bottom: 16px;
}
.quickcard:nth-child(2) .toolicon { background: #eaf2ef; color: #327a64; }
.quickcard:nth-child(3) .toolicon { background: #edf0f6; color: #4c6790; }
.quickcard:nth-child(4) .toolicon { background: #f3edf4; color: #806187; }
.quickcard h3 { font-size: 14px; margin-bottom: 5px; }
.quickcard p { font-size: 12px; color: var(--muted); margin: 0; }

.grid2, .grid3, .estimate-grid, .resources { display: grid; gap: 16px; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--round);
  padding: 19px;
}
.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}
.card-title h2 { margin: 0; }

.empty { text-align: center; padding: 27px 14px; color: var(--muted); }
.empty svg { margin: 0 auto 13px; color: #9caaa9; }
.empty h3 { color: var(--ink); font-size: 16px; }
.empty p { font-size: 13px; max-width: 340px; margin: 0 auto 17px; }

.statrow {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--round);
  overflow: hidden;
  margin-top: 22px;
}
.stat { background: #fff; padding: 14px 12px; }
.stat strong { font-size: 22px; font-weight: 650; display: block; letter-spacing: -.6px; }
.stat span { font-size: 10px; color: var(--muted); }

.guide {
  padding: 14px 0;
  border-top: 1px solid #eef0ef;
  display: flex;
  gap: 13px;
  align-items: flex-start;
}
.guide:first-of-type { border-top: 0; }
.guide .number {
  width: 25px; height: 25px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #eef2ef;
  color: #4b6a5e;
  font-size: 11px;
  flex-shrink: 0;
}
.guide p { font-size: 12px; color: var(--muted); margin: 3px 0 0; }

.notice {
  background: #faf5e8;
  border: 1px solid #e9dfc4;
  border-radius: 9px;
  padding: 14px 16px;
  color: #755c27;
  font-size: 12px;
  line-height: 1.55;
  margin: 18px 0;
}
.notice.neutral { background: #eef3f5; border-color: #dde7eb; color: #536874; }
.notice.error { background: #fff0eb; color: #993d2d; border-color: #e9c2b7; }

.tag {
  padding: 4px 9px;
  border-radius: 5px;
  background: #eff2f3;
  font-size: 10px;
  font-weight: 750;
  display: inline-block;
  color: #60717a;
  letter-spacing: .3px;
  text-transform: capitalize;
}
.tag.active { background: #e5f2eb; color: #277354; }
.tag.waiting { background: #fcf1d5; color: #8c681b; }
.tag.complete { background: #e8edf3; color: #536b89; }
.tag.planned { background: #eff2f3; color: #60717a; }

.jobrow {
  padding: 16px 0;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.jobrow:first-child { border-top: 0; }
.jobrow strong, .jobrow span.muted { display: block; }
.jobrow span.muted { font-size: 12px; }
.jobtitle { text-align: left; color: var(--ink); padding: 0; }
.jobtitle:hover { text-decoration: underline; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.toolbar .field { min-width: 0; flex: 1 1 180px; }
.toolbar select { max-width: 100%; }

.tabs {
  display: flex;
  gap: 6px;
  background: #e8edeb;
  padding: 5px;
  border-radius: 9px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.tabs button {
  padding: 9px 11px;
  color: #596d77;
  background: transparent;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 650;
}
.tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px #15253512; }

.field {
  display: grid;
  gap: 6px;
  text-align: left;
  font-size: 12px;
  font-weight: 650;
  color: #50616a;
}
.field small { font-size: 11px; font-weight: 400; color: var(--muted); }

input, select, textarea {
  width: 100%;
  padding: 11px 12px;
  min-height: 44px;
  border: 1px solid #d8dfdf;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
textarea { resize: vertical; min-height: 100px; font-size: 14px; }
input:focus, select:focus, textarea:focus { border-color: #829ba9; }
input[type=checkbox] {
  width: 20px; height: 20px; min-height: 20px;
  accent-color: #28785f;
}

.formgrid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.formgrid .wide { grid-column: 1 / -1; }
.formactions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 24px; flex-wrap: wrap; }

.calc-layout { display: block; }
.calclist {
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  margin-bottom: 18px;
  gap: 5px;
  padding-bottom: 4px;
}
.calclist button {
  flex-shrink: 0;
  border: 1px solid transparent;
  background: none;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  border-radius: 9px;
  color: #596c76;
  font-size: 12px;
}
.calclist button.active {
  background: #fff;
  border-color: #c8d6cf;
  color: var(--ink);
  font-weight: 700;
}
.calc-card { max-width: 820px; }
.calc-card > p { font-size: 13px; color: var(--muted); margin-bottom: 25px; }

.result {
  margin: 22px 0 0;
  padding: 18px;
  background: #eef5f0;
  border: 1px solid #d8e7dc;
  border-radius: 10px;
}
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 9px; }
.result strong { font-size: 22px; display: block; letter-spacing: -.8px; color: #245a43; }
.result span { font-size: 10px; color: #506d5e; }
.result p { font-size: 12px; margin: 17px 0 0; }
.result.error { background: #fff0eb; border-color: #edc6bc; color: #9c402e; }
.result svg { width: 100%; height: 90px; margin-bottom: 13px; }
.result-placeholder {
  border: 1px dashed #d8dfdf;
  margin-top: 22px;
  border-radius: 9px;
  padding: 24px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.source { font-size: 11px; color: var(--muted); line-height: 1.65; margin-top: 17px; }
.source a { color: #376d83; text-underline-offset: 3px; }
a[target=_blank] { text-underline-offset: 3px; }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; white-space: nowrap; text-align: left; }
th { background: #f5f7f6; color: #6e7b82; font-size: 10px; letter-spacing: .7px; text-transform: uppercase; font-weight: 650; }
td, th { padding: 13px 12px; border-bottom: 1px solid #e9edec; }
td.wrap { white-space: normal; min-width: 140px; }

.iconbtn {
  display: inline-grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 6px;
  color: #667b86;
}
.iconbtn:hover { background: #eff2f1; }

.note {
  border-left: 3px solid #e6bb55;
  padding: 12px 15px;
  background: #fafbf9;
  margin: 12px 0;
  border-radius: 0 7px 7px 0;
}
.note p { white-space: pre-wrap; font-size: 13px; margin: 7px 0; }
.notehead { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }

.photos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.photo img { width: 100%; height: 150px; object-fit: cover; border-radius: 8px; display: block; }
.photo p { font-size: 11px; margin: 7px 0 0; }
.photo button { float: right; }

.checkrow {
  display: flex;
  gap: 13px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.checkrow input { flex-shrink: 0; margin-top: 2px; }
.checkrow strong { display: block; font-size: 13px; }
.checkrow span { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.checkrow.checked strong { text-decoration: line-through; color: #738177; }
.checkmeta { color: var(--green) !important; font-size: 10px !important; }

.progress { height: 5px; border-radius: 4px; background: #e7ece9; overflow: hidden; margin: 12px 0; }
.progress > div { height: 100%; background: #62957c; }

.summaryline { display: flex; justify-content: space-between; gap: 15px; font-size: 12px; padding: 8px 0; }
.summaryline.total { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 7px; font-weight: 700; }
.quote-total { font-size: 31px; font-weight: 650; letter-spacing: -1px; margin: 8px 0 0; }

.stack { display: grid; gap: 20px; }

.resource { display: block; text-decoration: none; }
.resource:hover { border-color: #a0b1b9; }
.resource .eyebrow { font-size: 9px; letter-spacing: 1px; margin-bottom: 17px; }
.resource p { font-size: 12px; color: var(--muted); margin-top: 7px; }
.resource .link { display: flex; gap: 7px; align-items: center; color: #396d80; font-size: 12px; font-weight: 650; }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  margin-top: 32px;
  padding-top: 17px;
  font-size: 10px;
  color: #7e8b91;
}
.footer button, .footer a { background: none; color: inherit; padding: 0; text-decoration: underline; }
.credit { font-size: 10px; color: #7e8b91; }
.credit a { color: #396d80; text-decoration: none; }
.credit a:hover { text-decoration: underline; }

.mobile-nav {
  display: flex;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  z-index: 30;
  justify-content: space-around;
}
.mobile-nav button {
  background: none;
  display: grid;
  justify-items: center;
  gap: 4px;
  font-size: 9px;
  color: #71818a;
  padding: 5px 10px;
  min-width: 55px;
}
.mobile-nav button.active { color: #1c5e4b; }
.mobile-nav button.active svg { stroke-width: 2.4; }

dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  width: min(600px, calc(100% - 28px));
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 30px 100px #0004;
  color: var(--ink);
}
dialog::backdrop { background: #0c1a29aa; backdrop-filter: blur(3px); }
.dialoghead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 21px; }
.dialoghead h2 { margin: 0; font-size: 21px; }

#toast {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%);
  background: #172b38;
  color: #fff;
  border-radius: 8px;
  padding: 13px 20px;
  box-shadow: 0 5px 20px #0002;
  font-size: 13px;
  z-index: 100;
  width: max-content;
  max-width: calc(100vw - 28px);
  display: none;
}
#toast.show { display: block; }

.searchresult {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px;
  text-align: left;
  background: none;
  border-radius: 8px;
  color: var(--ink);
}
.searchresult:hover { background: var(--paper); }
.searchresult small { color: var(--muted); margin-left: auto; }

.dangerzone { margin-top: 25px; border-top: 1px solid var(--line); padding-top: 18px; }
.empty-inline { padding: 20px 0; color: var(--muted); font-size: 13px; }
.scope { white-space: pre-wrap; font-size: 13px; color: var(--muted); }
.printarea { display: none; }


/* Keep wide tables from stretching the page on phones */
.estimate-grid,
.stack,
.grid2,
.card,
.tablewrap,
.toolbar,
.calc-layout,
.calc-card {
  min-width: 0;
  max-width: 100%;
}
.tablewrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.summaryline { align-items: baseline; }
.summaryline > :last-child { flex-shrink: 0; font-variant-numeric: tabular-nums; }
body { overflow-x: hidden; }

@media (min-width: 480px) {
  .formgrid { grid-template-columns: 1fr 1fr; }
  .main { padding-left: 18px; padding-right: 18px; }
  h1, .pagehead h1 { font-size: 28px; }
  .hero h2 { font-size: 27px; }
  .stat strong { font-size: 23px; }
  .stat span { font-size: 11px; }
}

@media (min-width: 781px) {
  .sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    width: 224px;
    background: var(--dark);
    color: #b6c1c9;
    padding: 30px 18px;
    z-index: 20;
  }
  .brand {
    display: flex;
    align-items: center;
    gap: 11px;
    color: #fff;
    padding: 0 9px 28px;
  }
  .brand .brandmark { width: 38px; height: 42px; border-radius: 10px; }
  .brand strong { font-size: 22px; letter-spacing: -.6px; display: block; }
  .brand span { display: block; letter-spacing: 2.2px; font-size: 9px; color: #92a5b3; font-weight: 600; }
  .nav-label { padding: 0 14px; font-size: 10px; letter-spacing: 1.6px; color: #708390; margin-bottom: 12px; }
  .nav { display: grid; gap: 6px; }
  .nav button {
    color: inherit;
    background: none;
    padding: 13px 14px;
    display: flex;
    gap: 13px;
    align-items: center;
    text-align: left;
    border-radius: 8px;
    font-weight: 550;
    font-size: 14px;
  }
  .nav button:hover { background: #203241; }
  .nav button.active { background: #2b3540; color: var(--accent); }
  .sidefoot { margin-top: auto; border-top: 1px solid #293642; padding: 21px 10px 0; font-size: 12px; }
  .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #69bea0; margin-right: 7px; }

  .layout { margin-left: 224px; }
  .mobile-nav, .mobile-brand { display: none; }
  .topbar { height: 84px; padding: 0 32px; gap: 22px; position: static; }
  .searchbutton {
    border: 1px solid var(--line);
    background: #fff;
    padding: 10px 13px;
    border-radius: 8px;
    min-width: 260px;
    text-align: left;
  }
  .searchbutton span { display: inline; }
  .searchbutton kbd {
    display: inline;
    margin-left: auto;
    font-size: 10px;
    border: 1px solid var(--line);
    padding: 1px 5px;
    border-radius: 3px;
  }
  .topright { gap: 18px; }
  .topright .date, .topright .device, .topright .avatar { display: flex; align-items: center; }
  .topright .avatar { display: grid; }

  .main { padding: 32px 32px 50px; }
  .pagehead { align-items: center; }
  .pagehead h1 { font-size: 32px; }
  .hero { padding: 29px 32px; display: flex; align-items: center; justify-content: space-between; min-height: 218px; }
  .hero h2 { font-size: 29px; max-width: 460px; }
  .hero p { max-width: 470px; }
  .hero-art { position: static; width: 280px; height: 170px; margin-left: 15px; opacity: .9; flex-shrink: 0; }
  .quickgrid { grid-template-columns: repeat(4, 1fr); gap: 13px; }
  .grid2 { grid-template-columns: 1.35fr 1fr; gap: 20px; }
  .grid3 { grid-template-columns: repeat(3, 1fr); }
  .estimate-grid { grid-template-columns: minmax(0, 1.7fr) minmax(270px, 1fr); gap: 20px; }
  .resources { grid-template-columns: repeat(2, 1fr); gap: 17px; }
  .photos { grid-template-columns: repeat(3, 1fr); }
  .stat { padding: 17px 22px; }
  .stat strong { font-size: 25px; }
  .stat span { font-size: 12px; }
  .card { padding: 23px; }
  .calc-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 22px; }
  .calclist { flex-direction: column; overflow: visible; margin-bottom: 0; }
  .calclist button { padding: 14px 12px; font-size: 13px; }
  .calclist button.active { border-color: var(--line); }
  .result { padding: 22px; }
  .result strong { font-size: 26px; }
  .result span { font-size: 11px; }
  .result-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  #toast { bottom: 24px; left: calc(50% + 112px); width: auto; }
  .quote-total { font-size: 34px; }
  dialog { padding: 27px; }
  .tabs button { padding: 10px 16px; font-size: 13px; }
  .btn { min-height: 43px; padding: 10px 16px; }
}

@media (min-width: 1101px) {
  .hero-art { width: 300px; }
}

@media (min-width: 1450px) {
  .main { padding-top: 40px; }
  .hero { min-height: 240px; }
  .hero-art { width: 360px; }
  .hero h2 { font-size: 33px; }
}

@media print {
  body { background: #fff; color: #111; font-size: 11px; }
  #app, dialog, #toast, .mobile-nav { display: none !important; }
  .printarea { display: block !important; padding: 10mm; }
  .printarea h1 { font-size: 23px; }
  .printarea h2 { font-size: 16px; margin-top: 20px; }
  .printarea table { white-space: normal; font-size: 10px; }
  .printarea td, .printarea th { padding: 7px; }
  .printarea p { white-space: pre-wrap; }
  .printarea img { max-width: 160px; max-height: 140px; }
  .printarea .print-meta { color: #666; font-size: 10px; }
  .printarea tr { break-inside: avoid; }
  @page { margin: 10mm; }
}
