/* ============ HomeInventory AI — the insurance binder ============
   Warm paper, olive accent, serif display figures. Rooms are binder
   tabs; items are photo cards; the dashboard is a coverage summary. */

:root {
  --olive: #4d7c0f;
  --olive-deep: #3f6212;
  --olive-soft: #eef4e2;
  --olive-ring: rgba(77, 124, 15, .15);
  --paper: #faf7f0;
  --paper-deep: #f3eee1;
  --card: #ffffff;
  --ink: #292524;
  --ink-soft: #57534e;
  --muted: #8a8175;
  --line: #e7dfcc;
  --line-soft: #f0ebdb;
  --radius: 0;
  --radius-sm: 0;
  --shadow: 0 1px 2px rgba(68, 54, 28, .06), 0 10px 26px rgba(68, 54, 28, .07);
  --shadow-sm: 0 1px 2px rgba(68, 54, 28, .07);
  --red: #b91c1c; --red-soft: #fbe7e5;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--sans); background: var(--paper); color: var(--ink);
  font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1180px; margin: 0 auto; padding-left: 28px; padding-right: 28px; }
h2 { font-family: var(--serif); font-size: 21px; font-weight: 600; letter-spacing: -.2px; margin: 0 0 12px; }
h3 { font-size: 15px; font-weight: 700; margin: 0; }
button { font-family: var(--sans); cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hint { color: var(--muted); font-size: 14px; }
a { color: var(--olive-deep); }
.error { color: var(--red); font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.error:empty { display: none; }

/* ---------- topbar ---------- */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); }
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding-top: 16px; padding-bottom: 12px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 11px; font-size: 19px; font-weight: 800; letter-spacing: -.3px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 0; background: var(--olive); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  box-shadow: 0 4px 12px rgba(77, 124, 15, .35);
}
.brand em {
  font-style: normal; font-size: 10.5px; font-weight: 700; letter-spacing: 1.2px;
  color: var(--olive-deep); background: var(--olive-soft); border-radius: 0; padding: 3px 8px; margin-left: 2px;
}
.tagline { color: var(--muted); font-size: 13.5px; margin: 0; padding-bottom: 14px; }
.tabs { display: flex; gap: 26px; }
.tabs button {
  background: none; border: none; padding: 10px 2px; font-size: 14.5px; font-weight: 600;
  color: var(--ink-soft); border-bottom: 3px solid transparent; border-radius: 0;
  transition: color .15s, border-color .15s;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--olive-deep); border-bottom-color: var(--olive); }

/* ---------- layout ---------- */
main { padding-top: 26px; padding-bottom: 60px; }
.tabpage { display: none; }
.tabpage.active { display: block; }

/* ---------- toolbar ---------- */
.toolbar { display: flex; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar input[type="search"] { flex: 1 1 260px; max-width: 420px; }
.toolbar-btns { display: flex; gap: 10px; margin-left: auto; }

/* ---------- binder layout ---------- */
.cols { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 22px; align-items: start; }
.binder {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 18px 14px; position: sticky; top: 20px;
}
.binder h2 { font-size: 17px; padding: 0 8px; }
.rooms { display: flex; flex-direction: column; gap: 3px; margin-bottom: 12px; }
.room {
  text-align: left; background: none; border: none; border-radius: 0;
  padding: 9px 12px; font-size: 14px; font-weight: 500; color: var(--ink-soft);
  border-left: 3px solid transparent; transition: background .13s, color .13s, border-color .13s;
  display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
}
.room .rname { font-weight: 600; }
.room .rmeta {
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  background: var(--paper-deep); padding: 2px 9px; flex: none;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.room.active .rmeta { background: #fff; color: var(--olive-deep); }
.room:hover { background: var(--paper); }
.room.active {
  background: var(--olive-soft); color: var(--olive-deep); font-weight: 700;
  border-left-color: var(--olive);
}
.room.active .rcount { background: #fff; color: var(--olive-deep); }
.wide { width: 100%; }

/* ---------- buttons / inputs ---------- */
.primary {
  background: var(--olive); color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 11px 22px; min-height: 44px; font-size: 14.5px; font-weight: 700;
  box-shadow: 0 4px 14px rgba(77, 124, 15, .3); transition: background .15s, transform .12s;
}
.primary:hover { background: var(--olive-deep); transform: translateY(-1px); }
.secondary {
  background: var(--card); border: 1px solid var(--line); color: var(--ink);
  border-radius: var(--radius-sm); padding: 10px 18px; min-height: 42px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow-sm);
  transition: border-color .15s, color .15s;
}
.secondary:hover { border-color: var(--olive); color: var(--olive-deep); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; box-shadow: 0 0 0 3px var(--olive-ring);
}
input, select, textarea {
  font-family: var(--sans); font-size: 14.5px; color: var(--ink);
  border: 1px solid #d8cdb4; border-radius: var(--radius-sm); background: #fff;
  padding: 10px 13px; width: 100%; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--olive); }
textarea { resize: vertical; line-height: 1.55; }
label { display: block; margin: 0 0 14px; font-weight: 600; font-size: 13.5px; color: var(--ink-soft); }
label input, label select, label textarea { margin-top: 6px; font-weight: 400; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.row { display: flex; gap: 10px; margin-top: 6px; }

/* ---------- item cards ---------- */
.itemgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin-bottom: 24px; }
.itemcard {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden; display: flex; flex-direction: column;
  transition: transform .16s, box-shadow .16s;
}
.itemcard:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.ic-photo {
  height: 150px; background: var(--paper-deep); display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid var(--line-soft); overflow: hidden;
}
.ic-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ic-nophoto { color: var(--muted); font-size: 12.5px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase; }
.ic-body { padding: 15px 17px 16px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.ic-body h3 { font-size: 15.5px; letter-spacing: -.1px; }
.ic-cat {
  align-self: flex-start; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
  color: var(--olive-deep); background: var(--olive-soft); border-radius: 0; padding: 3px 10px;
}
.ic-price {
  font-family: var(--serif); font-size: 21px; font-weight: 700; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ic-meta { display: grid; gap: 3px; margin: 2px 0 0; }
.ic-meta > div { display: flex; gap: 8px; font-size: 13px; }
.ic-meta dt { color: var(--muted); font-weight: 600; min-width: 74px; }
.ic-meta dd { margin: 0; color: var(--ink-soft); word-break: break-word; }
.ic-notes { font-size: 13px; color: var(--ink-soft); margin: 0; border-top: 1px dashed var(--line); padding-top: 8px; }
.ic-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 8px; }
.ic-actions button {
  border: 1px solid var(--line); background: #fff; border-radius: 0;
  padding: 7px 14px; font-size: 13px; font-weight: 600; color: var(--ink-soft);
}
.ic-actions button:hover { border-color: var(--olive); color: var(--olive-deep); }
.ic-actions .danger { color: var(--red); }
.ic-actions .danger:hover { background: var(--red-soft); border-color: #efc4c1; }

.empty-state {
  grid-column: 1 / -1; text-align: center; padding: 54px 24px;
  border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted);
  background: rgba(255,255,255,.5);
}
.empty-state strong { display: block; font-family: var(--serif); font-size: 19px; color: var(--ink); margin-bottom: 6px; font-weight: 600; }

/* ---------- add/edit form ---------- */
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px;
}
.form-head { margin-bottom: 16px; }
.form-head .muted { margin: 4px 0 0; font-size: 14px; }
#photoPreview img { max-width: 220px; border-radius: 0; border: 1px solid var(--line); display: block; margin: 4px 0 10px; }
#photoPreview button {
  border: 1px solid var(--line); background: #fff; border-radius: 0;
  padding: 6px 12px; font-size: 13px; color: var(--ink-soft); font-weight: 600;
}

/* ---------- coverage dashboard ---------- */
.grand {
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
  margin-bottom: 26px; flex-wrap: wrap; background: var(--card);
  border: 1px solid var(--line); border-top: 4px solid var(--olive);
}
.grand .big {
  font-family: var(--serif); font-size: 46px; font-weight: 700; letter-spacing: -.5px;
  font-variant-numeric: tabular-nums; line-height: 1.1; margin-top: 4px;
}
.grand-side { max-width: 300px; }
.grand-side p { margin: 0 0 12px; }
.grand-side button {
  background: var(--olive); color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 10px 20px; font-weight: 700; font-size: 14px;
}
.grand-side button:hover { background: var(--olive-deep); }
.section-title { margin: 0 0 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.cards .card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 18px;
}
.cards .card h3 { font-size: 14.5px; margin-bottom: 8px; }
.cards .card .big {
  font-family: var(--serif); font-size: 27px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.cards .card .muted { font-size: 13px; }
.vbar { height: 7px; background: var(--paper-deep); border-radius: 0; margin-top: 12px; overflow: hidden; }
.vbar span { display: block; height: 100%; background: var(--olive); border-radius: 0; }

/* ---------- guidance ---------- */
.eyebrow {
  font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.6px;
  color: var(--olive-deep); margin: 0 0 6px;
}
.guide-title { font-size: 26px; margin: 0 0 20px; }
.guides { display: grid; gap: 14px; margin-bottom: 18px; counter-reset: guide; }
.guide {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 20px 22px 20px 84px; position: relative; counter-increment: guide;
}
.guide::before {
  content: counter(guide, decimal-leading-zero);
  position: absolute; left: 24px; top: 18px;
  font-family: var(--serif); font-size: 30px; font-weight: 700; color: var(--olive);
}
.guide h3 { font-size: 16px; margin-bottom: 6px; }
.guide p { margin: 0; color: var(--ink-soft); font-size: 14.5px; max-width: 720px; }

/* ---------- footer ---------- */
footer { text-align: center; padding: 26px 20px; border-top: 1px solid var(--line); }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .tabpage.active { animation: viewIn .3s ease-out; }
  @keyframes viewIn { from { opacity: 0; transform: translateY(10px); } }
  .itemcard { animation: riseIn .45s cubic-bezier(.2,.7,.25,1) both; }
  .itemgrid .itemcard:nth-child(2) { animation-delay: .05s; }
  .itemgrid .itemcard:nth-child(3) { animation-delay: .1s; }
  .itemgrid .itemcard:nth-child(4) { animation-delay: .15s; }
  @keyframes riseIn { from { opacity: 0; transform: translateY(14px); } }
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .cols { grid-template-columns: 1fr; }
  .binder { position: static; }
  .rooms { flex-direction: row; flex-wrap: wrap; }
  .room { border-left: none; border-bottom: 3px solid transparent; }
  .room.active { border-bottom-color: var(--olive); }
  .grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .tabs { gap: 18px; }
  .grid { grid-template-columns: 1fr; }
  .grand .big { font-size: 36px; }
  .toolbar-btns { margin-left: 0; }
  .guide { padding-left: 22px; padding-top: 66px; }
  .guide::before { top: 14px; }
}

/* ---------- print: the insurance report ---------- */
@media print {
  .no-print, .topbar .tabs, .toolbar, .binder, #itemForm, footer { display: none !important; }
  body { background: #fff; }
  .topbar { border-bottom: 2px solid #000; }
  .tagline { padding-bottom: 6px; }
  main { padding: 0; }
  .tabpage { display: none; }
  #tab-inventory.tabpage, #tab-dashboard.tabpage { display: block; }
  .cols { display: block; }
  .itemgrid { display: block; }
  .itemcard {
    box-shadow: none; border: 1px solid #999; border-radius: 0;
    flex-direction: row; margin-bottom: 10px; break-inside: avoid;
  }
  .itemcard:hover { transform: none; }
  .ic-photo { width: 110px; height: 90px; flex: none; border-bottom: none; border-right: 1px solid #999; }
  .ic-actions, .ic-nophoto { display: none; }
  .grand { border: 2px solid #000; }
  .cards { grid-template-columns: 1fr 1fr; }
  .vbar { display: none; }
}

/* ---------- sorting, duplicate serials, backup ---------- */
.toolbar select { max-width: 210px; }
.serial-warn {
  margin: 0 0 14px; padding: 10px 14px;
  background: #fdf3e7; border: 1px solid #e8c07a; border-left: 4px solid #c98a2b;
  font-size: 13.5px; color: var(--ink);
}
.warnserial {
  display: inline-block; margin: 2px 6px 2px 0; padding: 2px 8px;
  background: #fff; border: 1px solid #e8c07a; font-weight: 600;
}

/* warranties / loans / service log */
.ic-meta dd.warn { color: #a16207; font-weight: 700; }
#serviceSection, #loanSection { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
#serviceSection h3, #loanSection h3 { margin: 0 0 10px; font-size: 16px; }
.srow {
  display: grid; grid-template-columns: 110px 1fr 90px auto; gap: 10px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px;
}
.srow span:nth-child(3) { text-align: right; font-variant-numeric: tabular-nums; }
#loanStatus p { margin: 0 0 10px; }

/* ---------- 2026 redesign: proof badges + readiness ring ---------- */
.proof { display: flex; align-items: center; gap: 8px; margin: 8px 0 2px; }
.proof-lbl {
  font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted);
}
.pdots { display: inline-flex; gap: 4px; }
.pdot {
  width: 22px; height: 22px; display: grid; place-items: center;
  font-size: 10px; font-weight: 800;
  background: var(--paper-deep); color: var(--muted); border: 1px solid var(--line);
}
.pdot.on { background: var(--olive); border-color: var(--olive); color: #fff; }
.ringwrap { position: relative; width: 92px; height: 92px; }
.ringwrap .ring-bg { fill: none; stroke: var(--line); stroke-width: 9; }
.ringwrap .ring-fg { fill: none; stroke: var(--olive); stroke-width: 9; }
.ringwrap .ring-num {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--serif); font-size: 21px; font-weight: 700; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
