/* Closing Time — paper, ink, and yard-sign red.
   Tokens */
:root {
  --paper: #F5F1E8;
  --paper-2: #EDE7DA;
  --ink: #21262E;
  --ink-soft: #5B6068;
  --sign-red: #9E2B25;
  --brass: #8A6D2F;
  --pine: #3E5C4B;
  --line: #C9C1AF;
  --card: #FBF9F3;
  --shadow: 0 1px 0 #d8d1c0, 0 6px 18px rgba(33,38,46,.08);
  --display: "Zilla Slab", "Rockwell", serif;
  --body: "Public Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 15px/1.5 var(--body); }
body::before { /* subtle ledger rule down the left, ambient not loud */
  content: ""; position: fixed; inset: 0 auto 0 0; width: 4px;
  background: repeating-linear-gradient(var(--sign-red) 0 10px, transparent 10px 16px);
  opacity: .25; pointer-events: none;
}

/* Topbar as brokerage letterhead */
.topbar { display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 14px 22px; border-bottom: 3px double var(--ink); background: var(--card); }
.letterhead .lh-name { font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: .06em; }
.letterhead .lh-sub { display: block; font-size: 12px; color: var(--ink-soft); letter-spacing: .04em; }
.statgrid { display: flex; gap: 20px; flex-wrap: wrap; margin-left: auto; }
.stat { display: flex; flex-direction: column; }
.stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-soft); }
.stat-val { font-family: var(--mono); font-weight: 600; font-size: 14px; }
.stat-val .season { font-style: normal; color: var(--brass); font-size: 11px; }
.stat-val.money { color: var(--brass); }
.stat-val.slots { color: var(--sign-red); letter-spacing: .15em; }
.dim { color: var(--ink-soft); font-weight: 500; }

.frame { display: grid; grid-template-columns: 168px 1fr; min-height: calc(100vh - 130px); }
.nav { border-right: 1px solid var(--line); padding: 18px 0; background: var(--paper-2); }
.nav-item { display: block; width: 100%; text-align: left; padding: 10px 18px; border: 0; background: none;
  font: 600 14px var(--body); color: var(--ink-soft); cursor: pointer; border-left: 3px solid transparent; }
.nav-item:hover { color: var(--ink); }
.nav-item.active { color: var(--sign-red); border-left-color: var(--sign-red); background: var(--paper); }
.badge { background: var(--sign-red); color: #fff; border-radius: 9px; font-size: 11px; padding: 0 6px; font-family: var(--mono); }

.main { padding: 22px; max-width: 1180px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.col { display: flex; flex-direction: column; gap: 18px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 3px; padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card-title { font-family: var(--display); font-size: 17px; margin: 0 0 10px; letter-spacing: .02em;
  border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.subhead { font-family: var(--display); font-size: 15px; color: var(--ink-soft); margin: 22px 0 8px; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.btn { font: 600 13px var(--body); color: var(--ink); background: var(--paper);
  border: 1px solid var(--ink); border-radius: 2px; padding: 8px 14px; cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink); transition: transform .05s, box-shadow .05s; }
.btn:hover:not(:disabled) { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.btn:focus-visible { outline: 2px solid var(--sign-red); outline-offset: 2px; }
.btn:disabled { opacity: .4; cursor: default; box-shadow: none; }
.btn-red { background: var(--sign-red); color: #fff; border-color: #6d1d19; box-shadow: 2px 2px 0 #6d1d19; }
.btn-sm { padding: 5px 10px; font-size: 12px; box-shadow: 1px 1px 0 var(--ink); }
.cost { color: var(--sign-red); font-family: var(--mono); font-size: 11px; }

.muted { color: var(--ink-soft); }
.hint { color: var(--ink-soft); font-size: 13px; font-style: italic; }
.warn { color: var(--brass); }
.bad { color: var(--sign-red); }
.good { color: var(--pine); }

.tag { display: inline-block; font-size: 11px; font-family: var(--mono); background: var(--paper-2);
  border: 1px solid var(--line); border-radius: 2px; padding: 1px 6px; margin: 1px 2px 1px 0; }
.tag-ref { background: #EAE3D0; border-color: var(--brass); color: var(--brass); }

/* Rubber stamps — the signature element */
.stamp { display: inline-block; font-family: var(--display); font-weight: 700; font-size: 13px;
  letter-spacing: .14em; color: var(--sign-red); border: 2px solid var(--sign-red); border-radius: 2px;
  padding: 1px 8px; transform: rotate(-4deg); opacity: .85; mix-blend-mode: multiply;
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='60' height='24'><filter id='n'><feTurbulence baseFrequency='.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .6 .4'/></filter><rect width='60' height='24' fill='white' filter='url(%23n)'/></svg>"); }
.flyer > .stamp { position: absolute; top: 10px; right: 10px; }
.stamp-sm { font-size: 11px; padding: 0 6px; transform: rotate(-3deg); }

/* MLS flyers */
.filterbar { display: flex; gap: 18px; margin-bottom: 14px; align-items: center; }
.filterbar label { font-size: 13px; color: var(--ink-soft); display: flex; gap: 6px; align-items: center; }
.mls-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.flyer { position: relative; background: var(--card); border: 1px solid var(--line); padding: 16px;
  box-shadow: var(--shadow); border-top: 5px solid var(--ink); }
.flyer.locked { opacity: .55; border-top-color: var(--line); }
.flyer-price { font-family: var(--mono); font-weight: 600; font-size: 21px; color: var(--sign-red); }
.flyer-addr { font-family: var(--display); font-size: 17px; font-weight: 700; }
.flyer-nb { font-size: 12px; color: var(--ink-soft); font-family: var(--mono); margin-bottom: 6px; }
.flyer-blurb { font-size: 13px; margin: 6px 0; }
.flyer-agent { font-size: 11px; color: var(--ink-soft); margin-top: 6px; font-style: italic; }
.fitline { margin-top: 6px; font-size: 13px; border-top: 1px dashed var(--line); padding-top: 6px; }
.lock-note { font-size: 12px; color: var(--ink-soft); margin-top: 8px; font-style: italic; }

/* Clients */
.client-card { border-left: 4px solid var(--pine); }
.client-head { font-size: 15px; margin-bottom: 4px; }
.intro { font-size: 13px; font-style: italic; color: var(--ink-soft); margin: 4px 0; }
.facts { font-size: 13px; margin: 6px 0; }
.reveal-line { font-size: 13px; color: var(--brass); margin: 3px 0; }
.past-row { font-size: 13px; color: var(--ink-soft); padding: 4px 0; border-bottom: 1px dotted var(--line); }

/* Deals / schedule / ledger */
.deal-row, .sched-row { font-size: 13px; padding: 6px 0; border-bottom: 1px dotted var(--line); }
.sched-day { font-family: var(--mono); font-size: 11px; color: var(--sign-red); margin-right: 6px; }
.logpanel { max-height: 520px; overflow-y: auto; }
.log-row { font-size: 13px; padding: 4px 0; border-bottom: 1px dotted var(--line); }
.log-day { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); margin-right: 6px; }
.log-milestone { color: var(--pine); font-weight: 600; }
.log-money { color: var(--brass); }
.log-bad { color: var(--sign-red); }
.log-event { color: var(--sign-red); font-weight: 600; }
.log-reveal, .log-know { color: var(--brass); }
.log-deal { font-weight: 600; }
.log-xp, .log-rep { color: var(--pine); }

.issue { font-size: 13px; padding: 5px 8px; margin: 4px 0; border-left: 3px solid var(--line); background: var(--paper-2); }
.issue-moderate { border-left-color: var(--brass); }
.issue-dealbreaker { border-left-color: var(--sign-red); }
.npc-say { font-family: var(--display); font-size: 16px; }
.offer-row { margin-bottom: 10px; }
.ladder-row { padding: 6px 0; border-bottom: 1px dotted var(--line); font-size: 13px; color: var(--ink-soft); }
.ladder-row.current { color: var(--ink); border-left: 3px solid var(--sign-red); padding-left: 8px; }
.ladder-row.done { color: var(--pine); }
.know-row { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; }
.know-pips { font-family: var(--mono); color: var(--pine); letter-spacing: 2px; }

/* Modals */
.modal-back { position: fixed; inset: 0; background: rgba(33,38,46,.45); display: flex;
  align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal { background: var(--card); border: 1px solid var(--ink); border-top: 6px solid var(--sign-red);
  max-width: 560px; width: 100%; max-height: 86vh; overflow-y: auto; padding: 20px 22px;
  box-shadow: 6px 6px 0 rgba(33,38,46,.25); }
.modal-wide { max-width: 760px; }
.modal-title { font-family: var(--display); font-size: 19px; margin: 0 0 10px; }
.modal-actions { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; font-size: 13px; }
.field-label { text-transform: uppercase; letter-spacing: .1em; font-size: 10px; color: var(--ink-soft); }
input[type="number"], select { font: 600 14px var(--mono); padding: 7px 9px; border: 1px solid var(--ink);
  background: var(--paper); border-radius: 2px; max-width: 220px; }
.input-lg { font-size: 17px !important; }
.check { display: block; font-size: 13px; margin: 8px 0; }

.start-screen { text-align: center; }
.start-tag { font-family: var(--display); font-size: 16px; }
.start-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.start-choice { padding: 16px; text-align: left; line-height: 1.45; }

.foot { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 22px;
  border-top: 3px double var(--ink); font-size: 12px; color: var(--ink-soft); background: var(--card); }
.foot-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* The gvb-save bar, restyled to paper-and-ink from the host page. The module
   reads these four custom properties and nothing else. */
#save-bar {
  --gvb-btn-bg: var(--paper);
  --gvb-btn-fg: var(--ink);
  --gvb-btn-border: var(--ink);
  --gvb-btn-radius: 2px;
}
/* The module sizes its buttons at .8em, which off a 12px footer is 9.6px. */
#save-bar button { font-size: 12px; font-weight: 600; letter-spacing: .02em; padding: .35em .8em; }
#save-bar button:disabled { opacity: .4; cursor: default; }
#save-bar button:disabled:hover { filter: none; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 12px); background: var(--ink);
  color: var(--paper); padding: 10px 16px; font-size: 13px; border-radius: 2px; opacity: 0; transition: .25s; z-index: 99; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .frame { grid-template-columns: 1fr; }
  .nav { display: flex; overflow-x: auto; padding: 0; }
  .nav-item { border-left: 0; border-bottom: 3px solid transparent; white-space: nowrap; }
  .nav-item.active { border-bottom-color: var(--sign-red); }
  .cols, .start-choices { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  /* At 375 wide the save bar wraps onto its own line and the footer goes from
     67px to 128px — 7.5% of an iPhone viewport spent on two rarely-used
     buttons. The tagline is flavour and the buttons are not, so the tagline
     goes and everything fits on one row again. */
  .foot-tag { display: none; }
  .foot { justify-content: flex-end; }
}
@media (prefers-reduced-motion: reduce) {
  .btn, .toast { transition: none; }
}
