:root {
  --ink: #1c1915;
  --ink-soft: #6d6256;
  --paper: #f3ecdf;
  --paper-deep: #e7dccb;
  --card: #fffdf9;
  --line: #e3d5c2;
  --indigo: #1b2740;
  --marigold: #d4652f;
  --marigold-deep: #b34d1c;
  --gold: #b08948;
  --teal: #1f6f62;
  --rose: #8d3d4a;
  --good: #1d6a4c;
  --bad: #9c3040;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Outfit", "Avenir Next", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --shadow: 0 20px 50px rgba(48, 32, 16, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.45;
  background:
    radial-gradient(circle at 8% -10%, rgba(212, 101, 47, 0.16), transparent 32%),
    radial-gradient(circle at 100% 0%, rgba(27, 39, 64, 0.08), transparent 28%),
    linear-gradient(180deg, #f7f2e8 0%, var(--paper) 40%, #efe4d4 100%);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 520; letter-spacing: -0.03em; margin: 0; }
h1 { font-size: 42px; line-height: 1.02; }
h2 { font-size: 26px; }
h3 { font-size: 22px; line-height: 1.15; }
p { margin: 0; }

.kicker {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 580;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}
.lead { color: var(--ink-soft); max-width: 46rem; margin-top: 8px; }
.fine, .muted, .hint { color: var(--ink-soft); font-size: 13.5px; }
.fine { margin-top: 12px; }
.mono { font-family: var(--mono); font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  color: #f6efe4;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), transparent 28%),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.015) 0 2px, transparent 2px 7px),
    var(--indigo);
}
.brand { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; padding: 0 8px; }
.brand strong { display: block; font-family: var(--serif); font-size: 28px; font-weight: 520; letter-spacing: -0.03em; line-height: 1; }
.brand em { display: block; margin-top: 3px; font-style: normal; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: #e7c39a; }
.mark {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  background:
    linear-gradient(135deg, rgba(255,255,255,.45) 0 9px, transparent 9px),
    linear-gradient(160deg, #f0c27a, var(--marigold) 55%, #8d3d4a);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}
.side-cta {
  margin: 18px 8px 6px;
  text-align: center;
  text-decoration: none;
  background: var(--marigold);
  color: #fffaf5;
  border-radius: 999px;
  padding: 11px 14px;
  font-weight: 580;
}
.side-cta:hover { background: var(--marigold-deep); }
.side-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 16px; }
.side-nav a {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: #ddd4c7;
  padding: 9px 12px; border-radius: 12px;
}
.side-nav a:hover { background: rgba(255,255,255,0.05); color: white; }
.side-nav a.is-on { background: rgba(255,255,255,0.1); color: #fff8ee; }
.ico { width: 18px; height: 18px; flex: none; }
.side-meta { margin-top: auto; padding: 16px 12px 6px; border-top: 1px solid rgba(255,255,255,0.08); }
.side-meta .kicker { color: #e7c39a; }
.side-meta strong { display: block; font-family: var(--serif); font-size: 30px; font-weight: 520; letter-spacing: -0.03em; }
.side-meta span, .side-meta a { display: block; color: #d9d0c3; font-size: 13px; text-decoration: none; }
.side-meta a { margin-top: 8px; color: #f0c27a; }

.main { padding: 26px 32px 72px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-end; margin-bottom: 22px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; border: 1px solid transparent;
  padding: 10px 16px; text-decoration: none; font-weight: 580;
  background: transparent; line-height: 1;
}
.btn-primary { background: var(--indigo); color: #f6f1e7; }
.btn-primary:hover { background: #243552; }
.btn-accent { background: var(--marigold); color: #fffaf6; }
.btn-accent:hover { background: var(--marigold-deep); }
.btn-ghost { background: transparent; border-color: #d9cbb8; color: var(--ink); }
.btn-ghost:hover { background: rgba(255,255,255,.55); }
.btn-danger { background: transparent; color: var(--bad); border-color: #e7c3c8; }
.btn-block { width: 100%; margin-top: 8px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.text-btn { border: 0; background: none; color: var(--rose); padding: 0; font-size: 13px; }

.flash {
  margin-bottom: 16px; padding: 12px 14px; border-radius: 14px;
  background: #e7f3ec; color: #14513a;
}
.flash-bad { background: #fde8e6; color: #8a2434; }
.form-error { color: var(--bad); margin-bottom: 8px; }

.pulse { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.pulse-slim { grid-template-columns: repeat(2, minmax(0, 280px)); }
.pulse-main, .pulse-card, .card, .sense, .slip {
  background: var(--card);
  border: 1px solid rgba(227, 213, 194, 0.9);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.pulse-main {
  position: relative; overflow: hidden;
  padding: 22px 24px 20px; color: #f7f1e7;
  background:
    radial-gradient(circle at 100% 0%, rgba(212,101,47,.55), transparent 42%),
    var(--indigo);
}
.pulse-main .kicker { color: #f0c27a; }
.pulse-main em { font-style: normal; color: #eadfce; }
.figure { font-family: var(--serif); font-weight: 520; letter-spacing: -0.045em; font-size: 58px; line-height: 0.95; display: block; margin: 10px 0 8px; }
.pulse-card { padding: 16px 16px 14px; }
.pulse-card strong { display: block; margin: 8px 0 4px; font-family: var(--serif); font-size: 28px; font-weight: 520; letter-spacing: -0.03em; }
.pulse-card span { color: var(--ink-soft); font-size: 13px; }

.low-row { margin-bottom: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.chip {
  display: inline-flex; flex-direction: column; gap: 2px;
  text-decoration: none; text-align: left;
  background: rgba(255,253,249,.8);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 12px;
  color: inherit;
}
.chip strong { font-size: 14px; }
.chip span { color: var(--ink-soft); font-size: 12px; }
.chip.is-on, .filters .chip.is-on { background: var(--indigo); color: #f6f1e7; border-color: var(--indigo); }
.chip.is-on span { color: #eadfce; }
.related { min-height: 0; margin-top: 10px; }

.split { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .78fr); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.card { padding: 16px 16px 18px; }
.card-head, .form-actions { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.card-head { margin-bottom: 12px; }
.card-head a, .sense a { color: var(--marigold-deep); font-weight: 580; text-decoration: none; }
.card h2, .form-card h2 { margin-bottom: 8px; }
.table-card { margin-top: 16px; }
.flat { box-shadow: none; border: 0; background: transparent; }

.week { display: flex; align-items: flex-end; gap: 10px; height: 120px; }
.week-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; }
.week-col i { display: block; width: 100%; border-radius: 9px 9px 4px 4px; background: linear-gradient(#243552, #8d5a3a); min-height: 8px; }
.week-col i.is-today { background: linear-gradient(#f0a36a, var(--marigold)); }
.week-col span { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 18px; background: var(--card); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); font-weight: 580; padding: 12px 14px; background: #faf6ef; }
td { padding: 12px 14px; border-top: 1px solid #f0e6d8; vertical-align: middle; }
tr:hover td { background: #fffaf4; }
tr.is-off td { opacity: 0.55; }
.cloth-line { display: flex; gap: 10px; align-items: center; text-decoration: none; }
.cloth-line strong, .cloth-copy strong { display: block; }
.cloth-line em, .cloth-copy em { display: block; font-style: normal; color: var(--ink-soft); font-size: 13px; }

.swatch {
  width: 36px; height: 46px; border-radius: 7px 12px 7px 7px; display: block; flex: none;
  background:
    linear-gradient(135deg, rgba(255,255,255,.7) 0 8px, transparent 8px),
    linear-gradient(var(--swatch), var(--swatch));
  box-shadow: inset 0 0 0 1px rgba(28,25,21,.12);
}
.swatch.lg { width: 46px; height: 58px; }
.swatch-field { display: flex; align-items: center; gap: 10px; }
.thread { width: 84px; height: 5px; border-radius: 99px; background: #efe4d4; overflow: hidden; margin-bottom: 6px; }
.thread span { display: block; height: 100%; background: var(--teal); }
.thread.is-low span { background: var(--marigold); }
.thread.is-out span { background: var(--bad); }

.badge { display: inline-flex; border-radius: 999px; padding: 3px 8px; background: #f3eadf; color: #5c4a38; font-size: 12px; }
.badge-low { background: #fde7d8; color: #9a3e12; }
.badge-ok { background: #e5f2ec; color: var(--good); }
.badge-upi { background: #e7eef8; color: #1d3f73; }
.badge-card { background: #f4e8f1; color: #6d345c; }
.badge-cash { background: #f3eadf; color: #5c4a38; }

.sense { padding: 16px 16px 14px; }
.sense h3 { margin: 2px 0 8px; }
.sense p { color: var(--ink-soft); }
.sense a { display: inline-block; margin-top: 10px; }
.sense-buy { box-shadow: inset 3px 0 0 var(--marigold), var(--shadow); }
.sense-price { box-shadow: inset 3px 0 0 var(--gold), var(--shadow); }
.sense-slow { box-shadow: inset 3px 0 0 var(--rose), var(--shadow); }
.sense-spend { box-shadow: inset 3px 0 0 #8a5a2b, var(--shadow); }
.sense-push { box-shadow: inset 3px 0 0 var(--teal), var(--shadow); }
.sense-note { box-shadow: inset 3px 0 0 var(--indigo), var(--shadow); }
.sense-group { margin-top: 22px; }
.sense-group h2 { margin-bottom: 10px; }
.sense-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.answer { margin-top: 14px; }

.ask {
  display: flex; gap: 8px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 6px 6px 16px; box-shadow: var(--shadow);
}
.ask input { border: 0; background: transparent; flex: 1; min-width: 0; padding: 8px 0; outline: none; }
.ask-wide { margin-bottom: 8px; }

.filters { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.filters input[type="search"] { min-width: min(420px, 100%); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field span, fieldset legend {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); font-weight: 580;
}
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="search"], select, textarea {
  width: 100%;
  background: #fff;
  border: 1px solid #e2d6c4;
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #c98458; box-shadow: 0 0 0 3px rgba(212,101,47,.15); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.span-2 { grid-column: span 2; }
.form-card { padding: 18px; }
.form-actions { margin-top: 8px; }
.narrow { max-width: 760px; }
.check { display: flex; gap: 8px; align-items: center; margin: 8px 0 12px; }
.drop { display: flex; flex-direction: column; gap: 8px; padding: 18px; border: 1px dashed #d7c6ae; border-radius: 16px; background: #fffaf4; margin-bottom: 12px; }
.barcode-block { margin: 8px 0 14px; }
.barcode-block svg { max-width: 220px; }

.move-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.move-list li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: baseline; }
.move-list em { font-style: normal; color: var(--ink-soft); font-size: 12px; }
.total-line { display: flex; justify-content: space-between; align-items: baseline; margin: 12px 0 0; }
.total-line strong { font-family: var(--serif); font-size: 32px; font-weight: 520; }
.empty-block { padding: 28px 8px; }
.empty-block h1, .empty-block h2 { margin-bottom: 12px; }

.counter { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .8fr); gap: 18px; align-items: start; }
.scanbar { display: flex; flex-direction: column; gap: 6px; }
.scanbar span { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); font-weight: 580; }
.scanbar input { font-size: 18px; padding: 14px 16px; border-radius: 16px; background: #fffdf9; }
.cloth-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 12px; }
.cloth-card {
  display: grid; grid-template-columns: 42px 1fr; grid-template-rows: auto auto;
  gap: 2px 10px; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 12px; color: inherit;
}
.cloth-card:hover { transform: translateY(-1px); border-color: #d7b89a; }
.cloth-card .swatch { grid-row: span 2; align-self: center; }
.cloth-card.is-dim { opacity: 0.45; }
.cloth-rate { font-family: var(--serif); font-size: 18px; font-weight: 520; }
.cloth-card small { color: var(--ink-soft); }

.slip { position: sticky; top: 16px; padding: 18px 16px 16px; }
.slip header { border-top: 3px solid var(--gold); padding-top: 12px; margin-bottom: 8px; }
.slip h2 { font-size: 32px; }
.slip-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.slip-lines li { display: grid; grid-template-columns: 1fr 78px auto; gap: 8px; align-items: center; }
.slip-lines strong, .slip-lines em { display: block; }
.slip-lines em { font-style: normal; color: var(--ink-soft); font-size: 12px; }
.slip-lines input { padding: 8px; }
.totals { border-top: 1px dashed #d9cbb6; margin-top: 12px; padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.pay-picks { border: 0; margin: 0; padding: 0; display: flex; gap: 8px; }
.pay-picks legend { margin-bottom: 6px; }
.pay-picks label { flex: 1; }
.pay-picks input { position: absolute; opacity: 0; }
.pay-picks span { display: block; text-align: center; border: 1px solid var(--line); border-radius: 999px; padding: 8px 6px; background: #fff; }
.pay-picks input:checked + span { background: var(--indigo); color: #f6f1e7; border-color: var(--indigo); }
.pay-picks input:focus-visible + span { outline: 2px solid var(--marigold); }
.sum-row { display: flex; justify-content: space-between; color: var(--ink-soft); }
.sum-row.payable { color: var(--ink); align-items: baseline; }
.sum-row.payable strong { font-family: var(--serif); font-size: 36px; font-weight: 520; letter-spacing: -0.04em; }
.toast {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  background: var(--indigo); color: #f6f1e7; padding: 12px 16px; border-radius: 999px;
  box-shadow: var(--shadow); z-index: 5;
}

.login-body { background: var(--indigo); }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 0.85fr; }
.login-story { color: #f6efe4; padding: 36px 48px; display: flex; flex-direction: column; justify-content: center; }
.login-story h1 { font-size: clamp(42px, 5vw, 68px); max-width: 12ch; margin: 28px 0 18px; }
.login-story ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; color: #eadfce; }
.login-story li::before { content: "— "; color: #f0c27a; }
.login-panel { background: var(--paper); display: flex; flex-direction: column; justify-content: center; gap: 16px; padding: 36px; }
.login-card, .demo-card { background: var(--card); border-radius: 24px; padding: 22px; box-shadow: var(--shadow); }
.login-card { display: flex; flex-direction: column; gap: 12px; }
.login-card h2 { margin-bottom: 4px; }
.demo-card strong { font-family: var(--mono); font-size: 14px; }

.bill-body { background: #e7dccb; }
.bill-toolbar { width: min(820px, calc(100% - 28px)); margin: 18px auto 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bill-toolbar form { margin: 0; }
.sheet-note { width: min(820px, calc(100% - 28px)); margin: 12px auto 0; }
.sheet {
  width: min(820px, calc(100% - 28px));
  margin: 16px auto 40px;
  background: white;
  padding: 36px 40px 28px;
  box-shadow: var(--shadow);
}
.sheet-head { display: flex; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.sheet h1 { font-size: 40px; }
.sheet-meta { text-align: right; display: flex; flex-direction: column; gap: 4px; }
.sheet-meta strong { font-size: 16px; }
.bill-to { margin: 14px 0; }
.bill-to span { display: block; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); }
.sheet table { margin-top: 8px; }
.sheet-sums { margin-left: auto; width: min(280px, 100%); display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.sheet-sums div { display: flex; justify-content: space-between; }
.sheet-sums .payable strong { font-family: var(--serif); font-size: 32px; }
.sheet-sums p, .sheet-foot p { color: var(--ink-soft); font-size: 13px; }
.sheet-foot { margin-top: 22px; border-top: 1px dashed #e3d5c2; padding-top: 12px; }
.stamp { color: var(--bad); font-style: normal; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 700; }
.is-cancelled { outline: 1px solid #e7c3c8; }

@media (max-width: 1100px) {
  .pulse { grid-template-columns: 1fr 1fr; }
  .pulse-main { grid-column: 1 / -1; }
  .counter, .split { grid-template-columns: 1fr; }
  .slip { position: static; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .side-nav { flex-direction: row; overflow: auto; }
  .side-meta { margin-top: 12px; }
  .main { padding: 18px 14px 48px; }
  h1 { font-size: 34px; }
  .page-head, .sheet-head { flex-direction: column; align-items: flex-start; }
  .form-grid, .span-2 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .login-shell { grid-template-columns: 1fr; }
  .login-story, .login-panel { padding: 24px; }
  .figure { font-size: 46px; }
  .sheet { padding: 22px 16px; }
}
@media print {
  body.bill-body { background: white; }
  .noprint { display: none !important; }
  .sheet { box-shadow: none; margin: 0; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
