/* ============================================================
   Inventory — the face.
   Every rule of the house lives on the server; this sheet is
   presentation only.

   SPACE ACCENT: each space carries its holder's own accent.
   To dress another space, override ONLY the --accent* and
   --frame variables below (for example from a [data-accent]
   block); every rule in this sheet reads them through the
   variables.
   Faith Recovery's face is black and gold: deep black framing
   with the house golds, #C9A227 and brighter #D8B23E.
   ============================================================ */
:root {
  /* — the space accent (Faith Recovery: black and gold) — */
  --accent: #c9a227;          /* the house gold */
  --accent-bright: #d8b23e;   /* the brighter gold */
  --accent-deep: #7c6114;     /* gold deepened for text on light ground */
  --accent-soft: #f3ead2;     /* pale gold wash */
  --accent-faint: #faf5e7;    /* faintest gold wash */
  --frame: #171512;           /* the black framing */
  --frame-ink: #f5efe0;       /* warm ivory text on the black */

  /* — warm neutral ground and ink — */
  --ground: #f6f3ec;
  --paper: #ffffff;
  --ink: #23201a;
  --dim: #6d675c;
  --line: #e3ddcd;
  --line-dark: #cfc6ab;

  /* — the one warm warning note (unrecorded losses) — */
  --warn-ink: #8a5a10;
  --warn-line: #d9a94f;
  --warn-wash: #fdf6e9;

  --serif: "Noto Serif Display", "Playfair Display", Georgia, "Times New Roman", serif;
  --script: "Alex Brush", "Segoe Script", "Brush Script MT", cursive;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow: 0 1px 2px rgba(23, 21, 18, 0.05), 0 4px 14px rgba(23, 21, 18, 0.06);
  --radius: 14px;
}

/* ---------------- the house's own hand ----------------
   The Faith Recovery logo is lettered in a flowing gold script,
   so the house's display lettering wears the same hand: Alex
   Brush, whose capital carries the logo's long sweeping top
   stroke and whose letters bounce and join like the logo's.
   The font is self-hosted beside this sheet — the house never
   depends on an outside font service. Script is for display
   lettering only: the doorway title, the space's name, and its
   section headings. Reading lines keep the clean type. */

@font-face {
  font-family: "Alex Brush";
  src: url("fonts/alex-brush-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Alex Brush";
  src: url("fonts/alex-brush-latin-ext.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--ground);
}

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 28px 18px 72px;
}

/* ---------------- type ---------------- */

h1, h2, h3 { font-family: var(--serif); font-weight: 600; color: var(--ink); }
h1 { margin: 0 0 10px; font-size: 34px; letter-spacing: 0.01em; }
h2 {
  position: relative;
  margin: 26px 0 14px;
  padding-bottom: 12px;
  font-size: 30px;
  border-bottom: 1px solid var(--line);
}
h2::after {
  content: "";
  position: absolute;
  left: 0; bottom: -1px;
  width: 72px; height: 3px;
  border-radius: 2px;
  background: var(--accent);
}
h3 {
  margin: 34px 0 10px;
  font-size: 21px;
  letter-spacing: 0.01em;
  color: var(--accent-deep);
}
h4 {
  margin: 24px 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--dim);
}

.dim { color: var(--dim); }

/* ---------------- the Faith face: the house's hand inside ----------------
   When the space standing on the board is the Faith Recovery
   house (its holder's mark is the Faith logo), its name and its
   section headings wear the same script as the logo, in the
   gold deepened for text on the light ground. The class is set
   by the face itself (app.js, from the space's own mark); any
   other space keeps the serif. The marks in their tiles are
   untouched — script here is lettering, never a mark. */

body.faith-face #space-name {
  font-family: var(--script);
  font-weight: 400;
  font-size: 46px;
  line-height: 1.15;
  letter-spacing: 0;
  color: var(--accent-deep);
}
body.faith-face .sec-head {
  font-family: var(--script);
  font-weight: 400;
  font-size: 33px;
  line-height: 1.1;
  letter-spacing: 0;
}

.msg {
  color: var(--warn-ink);
  font-size: 15px;
  min-height: 1.2em;
  margin: 14px 2px 0;
}
.msg:empty { min-height: 0; margin: 0; }

/* ---------------- forms and buttons ---------------- */

label {
  display: block;
  margin: 14px 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--dim);
}
input, select, textarea {
  width: 100%;
  padding: 13px 14px;
  margin-top: 6px;
  border: 1px solid var(--line-dark);
  border-radius: 10px;
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  background: var(--paper);
  appearance: none;
  box-sizing: border-box;
}
textarea { resize: vertical; }
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--accent-deep) 50%),
                    linear-gradient(135deg, var(--accent-deep) 50%, transparent 50%);
  background-position: calc(100% - 22px) 55%, calc(100% - 16px) 55%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 42px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.28);
}

/* The maker's line, standing small where a maker's line belongs. */
.credit {
  text-align: center;
  color: var(--dim);
  font-size: 13px;
  letter-spacing: 0.04em;
  margin: 26px 0 6px;
}
.top-link {
  color: var(--accent-bright);
  margin-right: 10px;
  font-size: 15px;
}
#support-list li.unread { font-weight: bold; }
button {
  font: inherit;
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(201, 162, 39, 0.45);
  outline-offset: 2px;
}

/* primary action: black, gold letters */
button {
  min-height: 48px;
  padding: 12px 20px;
  border: 1px solid var(--frame);
  background: var(--frame);
  color: var(--accent-bright);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 4px 6px 4px 0;
}
button:hover { background: #26221b; border-color: #26221b; color: var(--accent-bright); }

/* quiet / secondary action */
li button {
  min-height: 40px;
  padding: 8px 14px;
  background: var(--paper);
  color: var(--accent-deep);
  border: 1px solid var(--line-dark);
  font-size: 14px;
  font-weight: 600;
}
li button:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }

/* ---------------- sign in: the black card, gold letters ---------------- */

.card {
  background: var(--frame);
  border: 1px solid var(--frame);
  border-top: 4px solid var(--accent);
  border-radius: 18px;
  box-shadow: 0 10px 34px rgba(23, 21, 18, 0.28);
  padding: 40px 38px 34px;
  max-width: 470px;
  margin: 7vh auto 0;
  color: var(--frame-ink);
}
.card h1 { color: var(--accent-bright); }
/* The Vetitum doorway's title wears the house's own hand, in
   the house gold — the letters match the logo above them. The
   class is set on that door alone (server.js); every other
   door's title keeps the serif. Script glyphs stand small for
   their size, so the size stands generous. */
.card h1.door-script {
  font-family: var(--script);
  font-weight: 400;
  font-size: 58px;
  line-height: 1.12;
  letter-spacing: 0;
}
.brand-mark {
  display: block;
  width: 72px; height: 72px;
  border-radius: 16px;
  margin-bottom: 20px;
}
.card p.dim { color: #b9b09a; font-size: 16px; margin: 0 0 6px; }
.card label { color: #b9b09a; }
.card input {
  background: #221f1a;
  border-color: #454032;
  color: var(--frame-ink);
}
.card input::placeholder { color: #7d7663; }
.card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.35);
}
.card button {
  width: 100%;
  margin: 10px 0 2px;
  min-height: 52px;
  background: var(--accent);
  border-color: var(--accent);
  color: #171512;
}
.card button:hover { background: var(--accent-bright); border-color: var(--accent-bright); color: #171512; }
.card .msg { color: var(--accent-bright); }
#f-code {
  text-align: center;
  font-size: 24px;
  letter-spacing: 0.35em;
  font-variant-numeric: tabular-nums;
}

/* ---------------- the house frame: the black bar ---------------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--frame);
  border: 1px solid var(--frame);
  border-bottom: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 18px;
  color: var(--frame-ink);
}
.topbar strong {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--frame-ink);
  margin-right: 10px;
}
#role {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #171512;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  vertical-align: 2px;
}
.topbar button {
  min-height: 40px;
  padding: 8px 14px;
  background: transparent;
  color: var(--accent-bright);
  border: 1px solid #57503c;
  font-size: 14px;
  font-weight: 600;
}
.topbar button:hover { background: var(--accent); border-color: var(--accent); color: #171512; }

.row {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
  margin-top: 18px;
}
.row label { flex: 1; min-width: 210px; margin: 0; }

/* ---------------- the board ---------------- */

.item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin: 10px 0;
}
.item > .item-label {
  flex: 1 1 240px;
  font-size: 16.5px;
  line-height: 1.45;
}

/* ---------------- the picture marks ----------------
   One tile treatment everywhere a mark stands: the same box,
   the same pale gold wash, the same fine border, the mark large
   and centred inside it. An item with no photo of its own wears
   its section's mark in the very tile its photo would stand in
   (56px, matching .item-photo); a section heading wears its mark
   in the smaller tile; movement buttons and movement rows carry
   their marks inline beside the word. */

.item-visual {
  width: 56px; height: 56px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-size: 30px;
  line-height: 1;
  background: var(--accent-faint);
  border: 1px solid var(--line-dark);
  border-radius: 10px;
}
.sec-head {
  display: flex;
  align-items: center;
  gap: 11px;
}
.sec-ic {
  width: 42px; height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-size: 23px;
  line-height: 1;
  background: var(--accent-faint);
  border: 1px solid var(--line-dark);
  border-radius: 11px;
  box-shadow: var(--shadow);
}
.btn-ic { margin-right: 7px; font-size: 15.5px; }
.mv-ic { margin-right: 7px; }
.actions { display: flex; flex-wrap: wrap; gap: 2px; }
.actions button {
  min-height: 44px;
  padding: 10px 15px;
  margin: 3px;
  border-radius: 999px;
  background: var(--accent-faint);
  color: var(--accent-deep);
  border: 1px solid var(--line-dark);
  font-size: 14.5px;
  font-weight: 600;
}
.actions button:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.actions button:first-child {
  background: var(--frame);
  border-color: var(--frame);
  color: var(--accent-bright);
}
.actions button:first-child:hover { background: #26221b; color: var(--accent-bright); }

/* the board's own "New item" */
#board > button {
  width: 100%;
  min-height: 52px;
  margin: 18px 0 0;
  background: transparent;
  color: var(--accent-deep);
  border: 1.5px dashed var(--accent);
  border-radius: var(--radius);
  font-weight: 600;
}
#board > button:hover { background: var(--accent-faint); color: var(--ink); }

/* ---------------- the desk ---------------- */

#desk {
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 4px solid var(--frame);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 26px 26px 20px;
  margin-top: 42px;
}
#desk h3 {
  margin-top: 2px;
  font-size: 24px;
  color: var(--ink);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent);
}

ul { list-style: none; padding: 0; margin: 8px 0; }
li {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 7px 0;
  font-size: 15px;
  line-height: 1.45;
}
#items-needed li {
  background: var(--accent-faint);
  border-color: var(--line-dark);
}
#requests li button { margin-left: 8px; }
#requests li button:first-of-type {
  background: var(--frame);
  border-color: var(--frame);
  color: var(--accent-bright);
}
#requests li button:first-of-type:hover { background: #26221b; color: var(--accent-bright); }
#movements li {
  font-size: 13.5px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  padding: 9px 12px;
}
li.loss {
  border-color: var(--warn-line);
  background: var(--warn-wash);
  color: var(--warn-ink);
}

/* ---------------- the roads in and their drafts ---------------- */

#roads { margin-top: 34px; }
.road-btns { display: flex; flex-wrap: wrap; gap: 2px; margin: 6px 0 4px; }
#scan-preview {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line-dark);
  margin-top: 10px;
  background: var(--frame);
}
.item-photo {
  width: 56px; height: 56px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line-dark);
  flex: 0 0 auto;
}

#drafts-wrap { margin-top: 34px; }
.draft {
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin: 12px 0;
}
.draft-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.draft-head strong { font-family: var(--serif); font-size: 18px; }
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--line-dark);
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.draft-media { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
.draft-media img {
  width: 84px; height: 84px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line-dark);
}
.draft-line {
  display: flex;
  gap: 8px;
  align-items: end;
  flex-wrap: wrap;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.draft-line input[type="text"] { flex: 2 1 170px; width: auto; margin-top: 0; }
.draft-line input[type="number"] { flex: 0 1 92px; width: auto; margin-top: 0; }
.draft-line select { flex: 1 1 140px; width: auto; margin-top: 0; }
.draft-line .raw { flex: 1 1 100%; font-size: 13px; }
.draft-line button {
  min-height: 40px;
  padding: 8px 14px;
  background: var(--paper);
  color: var(--accent-deep);
  border: 1px solid var(--line-dark);
  font-size: 14px;
  font-weight: 600;
}
.draft-line button:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.draft .actions { margin-top: 10px; }

/* ---------------- paper: the buttons on screen ---------------- */

.paper-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 12px 0 4px;
}
.paper-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--dim);
  margin-right: 2px;
}
.paper-btn {
  min-height: 40px;
  padding: 8px 14px;
  background: var(--paper);
  color: var(--accent-deep);
  border: 1px solid var(--line-dark);
  font-size: 14px;
  font-weight: 600;
}
.paper-btn:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.range-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.range-label select { width: auto; margin-top: 0; padding: 9px 38px 9px 12px; }

/* ---------------- paper: the sheet itself ----------------
   One dress for the sheet, worn by the browser print flow here.
   The paper copy PDF wears the same dress in the page's own hand:
   white ground, black ink, the space's golds for the rules and
   the title, a serif for the house's name. Ink stays honest and
   light: color lives in rules and headings, never in fields of
   fill. */

#print-area { display: none; }

.sheet {
  font-family: var(--sans);
  color: #1c1a16;
  font-size: 12.5pt;
  line-height: 1.45;
}
.sheet-head {
  border-top: 3px solid #171512;
  border-bottom: 1.5px solid #c9a227;
  padding: 10px 0 9px;
  margin-bottom: 16px;
}
.sheet-space {
  font-family: var(--serif);
  font-size: 21pt;
  font-weight: 600;
  color: #171512;
  line-height: 1.2;
}
.sheet-title {
  font-family: var(--serif);
  font-size: 14.5pt;
  color: #7c6114;
  margin-top: 3px;
}
.sheet-sub, .sheet-date { font-size: 9.5pt; color: #5c564a; margin-top: 2px; }
.sheet-section {
  font-family: var(--serif);
  font-size: 13pt;
  font-weight: 700;
  color: #171512;
  border-bottom: 1px solid #c9a227;
  padding-bottom: 3px;
  margin: 18px 0 6px;
  break-after: avoid;
}
.sheet-table { width: 100%; border-collapse: collapse; font-size: 11pt; }
.sheet-table th {
  text-align: left;
  font-size: 8.5pt;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #5c564a;
  border-bottom: 2px solid #171512;
  padding: 4px 6px;
}
.sheet-table td {
  border-bottom: 1px solid #e3ddcd;
  padding: 5px 6px;
  vertical-align: top;
}
.sheet-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.sheet-table tr { break-inside: avoid; }
.need-list { list-style: none; margin: 0; padding: 0; }
.need-line {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 7px 2px;
  border-bottom: 1px solid #e3ddcd;
  break-inside: avoid;
  font-size: 12pt;
}
.tick {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  border: 1.6px solid #171512;
  border-radius: 3px;
  margin-top: 3px;
}
.sheet-empty { color: #5c564a; font-style: italic; }

/* ---------------- paper: the print flow ---------------- */

@page { size: letter; margin: 13mm 12mm; }

@media print {
  body { background: #fff; }
  #app { display: none !important; }
  #print-area { display: block; }
}

/* ---------------- small screens: one hand, in a kitchen ---------------- */

@media (max-width: 560px) {
  main { padding: 18px 12px 56px; }
  .card { padding: 30px 22px 26px; margin-top: 4vh; }
  h1 { font-size: 29px; }
  .card h1.door-script { font-size: 47px; }
  h2 { font-size: 25px; }
  body.faith-face #space-name { font-size: 38px; }
  body.faith-face .sec-head { font-size: 28px; }
  .item { flex-direction: column; align-items: stretch; }
  .actions button { flex: 1 1 30%; }
  #desk { padding: 20px 16px 14px; }
  .topbar { padding: 12px 14px; }
}
