:root {
  --ink: #2d2d2d; --muted: #77716b; --line: #e3ddd5; --bg: #f7f5f1;
  --card: #ffffff; --brand: #aa512f; --brand-ink: #823d20;
  --accent: #b0651f; --floor: #a33; --ok: #5a7a3d;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 "DM Sans", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--ink); }

h1, h2, h3, .brand, .quote-brand, .stat b {
  font-family: "Belleza", Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: .01em;
}
main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; }
h1 { font-size: 22px; margin: 8px 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 18px 0 8px; }
a { color: var(--brand); }
code { background: #eef1f4; padding: 1px 5px; border-radius: 4px; }

.topnav { display: flex; align-items: center; gap: 18px; background: var(--brand); padding: 10px 20px; }
.topnav a { color: #f3ded3; text-decoration: none; font-weight: 500; }
.topnav a:hover { color: #fff; }
.topnav .brand { color: #fff; font-weight: 700; font-size: 17px; }
.topnav .brand span { color: #eec9b5; font-weight: 400; }
.topnav .spacer { flex: 1; }
.topnav .who { color: #eec9b5; font-size: 13px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 16px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; font-weight: 400; }
.error { color: var(--floor); }
.ok { color: var(--ok); font-weight: 600; }
.hint { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }

.btn { display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 8px; padding: 8px 14px; font-size: 14px; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.big { padding: 12px 22px; font-size: 16px; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.wide { width: 100%; }

input, select, textarea { font: inherit; border: 1px solid var(--line); border-radius: 7px;
  padding: 8px 10px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #f0cdb9; border-color: var(--brand); }
input:disabled { background: #f0f2f4; color: var(--muted); }
.num-in { text-align: right; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
label input, label select { margin-top: 4px; color: var(--ink); font-size: 14.5px; }
.muted-label { color: #9aa5b1; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: 6px 8px; border-bottom: 2px solid var(--line); }
td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.inactive td { opacity: .45; }
.newrow td { background: #f7f9fa; }
.indent { padding-left: 26px; }

table input, table select { padding: 6px 8px; font-size: 14px; }
table textarea.tiers { font-size: 12.5px; font-family: ui-monospace, Menlo, monospace; }

.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 14px; align-items: end; }
@media (max-width: 800px) { .grid3, .grid4 { grid-template-columns: 1fr; } }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 800px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }
.stat { text-align: center; }
.stat b { display: block; font-size: 22px; color: var(--brand-ink); }
.stat span { font-size: 12.5px; color: var(--muted); }

.searchbar { display: flex; gap: 8px; margin-bottom: 14px; max-width: 420px; }

/* estimate builder */
.est-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 950px) { .est-grid { grid-template-columns: 1fr; } }
.est-side { position: sticky; top: 12px; }
.summary .srow { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.summary .srow.total { border-top: 2px solid var(--line); margin-top: 4px; padding-top: 8px; font-size: 15px; }
.summary .srow.total b { color: var(--brand-ink); }
.summary .srow.ladder b { color: var(--brand); }
.summary .srow.floor b { color: var(--floor); }
.summary .srow.usd { font-size: 13px; }
.summary .srow.usd b { color: var(--ink); }
.summary hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
.sizes input { min-width: 60px; }

/* printable quote */
.quote-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.quote-brand { font-weight: 400; font-size: 20px; color: var(--brand-ink); }
.quote-brand span { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.breakdown td { font-size: 14.5px; }
.breakdown .total td { border-top: 2px solid var(--ink); }

/* login */
.login-wrap { min-height: 80vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 340px; }
.login-card h1 { color: var(--brand); margin-bottom: 2px; font-size: 30px; }
.pw-cell { white-space: nowrap; }
.pw-cell input { width: 150px; display: inline-block; }

@media print {
  .topnav, .no-print { display: none; }
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  .card { border: none; padding: 0; }
}

.badge { display: none; margin-top: 6px; padding: 3px 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .05em; }
.badge.show { display: inline-block; }
.badge.woven { background: #f7e7dc; color: var(--brand-ink); border: 1px solid #e9c6b2; }
.badge.knit { background: #edeae5; color: #2d2d2d; border: 1px solid #d8d2ca; }

.propose-cell { min-width: 300px; }
.propose-cell input, .propose-cell select { display: inline-block; width: auto; margin-right: 4px; margin-bottom: 4px; }
.propose-cell .prop-price { width: 90px; }
.propose-cell .prop-supplier { width: 130px; }
.propose-cell .prop-note { width: 150px; }
.inline-form { display: flex; gap: 4px; }

.addfabric { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.addfabric label { margin: 0; }
.addfabric input, .addfabric select { width: auto; min-width: 120px; }
.section-cell { white-space: nowrap; }
.section-cell select { width: auto; margin-right: 6px; }

.sup-line { display: block; color: var(--brand); font-size: 11.5px; margin-top: 2px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.small-label { font-size: 12px; margin-bottom: 4px; }
.small-label input { padding: 5px 8px; font-size: 13.5px; }
.stat-row.health .card { text-decoration: none; color: inherit; }
.card.stat.warn b { color: var(--accent); }
.card.stat.warn { border-color: #f2c8a8; }

.preset-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.preset-name { width: 180px; }
.check-label { display: flex; gap: 8px; align-items: center; color: var(--ink); font-size: 14px; }
.check-label input { width: auto; }
.status-bar { margin: 6px 0; font-size: 13.5px; align-items: center; }
.chip { padding: 2px 9px; border-radius: 12px; font-size: 11.5px; font-weight: 600; }
.st-won { background: #e6efdd; color: var(--ok); }
.st-lost { background: #f7e0dc; color: var(--floor); }
.st-quoted { background: #f0ede8; color: var(--muted); }
table.sizes input { min-width: 52px; }
