:root {
  --espresso: #16264a;
  --espresso-2: #1e3560;
  --parchment: #cfe4f5;
  --paper: #ffffff;
  --ink: #16264a;
  --ink-soft: #5b6b85;
  --gold: #c89b3c;
  --gold-deep: #a67f2c;
  --sage: #5c7a5c;
  --sage-deep: #46603f;
  --rust: #b4482f;
  --line: #d8e8f5;
  --radius: 16px;
  --radius-sm: 10px;
  --tap: 48px;
}

body { background: linear-gradient(180deg, #dcedf9 0%, #cfe4f5 100%); }
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--parchment);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.display { font-family: "Fraunces", Georgia, "Times New Roman", serif; font-optical-sizing: auto; }
a { color: inherit; }
.app { max-width: 720px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; background: var(--parchment); }
header.topbar { background: var(--espresso); color: var(--parchment); padding: 18px 20px 16px; position: sticky; top: 0; z-index: 10; }
.topbar .brand { display: flex; align-items: center; gap: 10px; font-family: "Fraunces", Georgia, serif; font-size: 20px; font-weight: 600; letter-spacing: 0.01em; }
.steam { width: 18px; height: 18px; opacity: 0.85; }
.topbar .context { margin-top: 6px; font-size: 13px; color: #d8c9b3; display: flex; justify-content: space-between; align-items: center; }
.topbar .context a { color: var(--gold); text-decoration: none; font-weight: 600; }
main { flex: 1; padding: 18px 16px 90px; }
nav.tabbar { position: fixed; bottom: 0; left: 0; right: 0; max-width: 480px; margin: 0 auto; display: flex; background: var(--paper); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 20; }
nav.tabbar a { flex: 1; text-align: center; padding: 8px 4px 6px; text-decoration: none; color: var(--ink-soft); font-size: 12px; font-weight: 600; border-radius: var(--radius-sm); min-height: var(--tap); }
nav.tabbar a.active { color: var(--gold-deep); background: #fbf3e2; }
nav.tabbar .tabicon { display: block; font-size: 20px; margin-bottom: 2px; }
h1.page-title { font-family: "Fraunces", Georgia, serif; font-size: 24px; margin: 2px 0 4px; }
.subtitle { color: var(--ink-soft); font-size: 14px; margin: 0 0 18px; }
.section-label { text-transform: uppercase; letter-spacing: 0.08em; font-size: 11.5px; font-weight: 700; color: var(--sage-deep); margin: 22px 0 10px; }
.section-label:first-child { margin-top: 0; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.task-row { display: flex; align-items: flex-start; gap: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 8px; }
.task-row.done { background: #f2f5f0; border-color: #dbe5d6; }
.task-check { flex-shrink: 0; margin-top: 2px; }
.task-check input[type="checkbox"] { appearance: none; width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--sage); background: var(--paper); cursor: pointer; position: relative; }
.task-check input[type="checkbox"]:checked { background: var(--sage); }
.task-check input[type="checkbox"]:checked::after { content: ""; position: absolute; left: 7px; top: 3px; width: 5px; height: 10px; border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.task-body { flex: 1; }
.task-title { font-weight: 600; font-size: 15px; margin: 0 0 2px; }
.task-row.done .task-title { text-decoration: line-through; color: var(--ink-soft); }
.task-desc { font-size: 13px; color: var(--ink-soft); margin: 0; }
.task-meta { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.inv-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; }
.inv-row.low { border-color: #e3b7a8; background: #fdf3ef; }
.inv-name { font-weight: 600; font-size: 14.5px; }
.inv-unit { font-size: 12px; color: var(--ink-soft); }
.inv-flag { display: inline-block; font-size: 11px; font-weight: 700; color: var(--rust); margin-top: 3px; }
.inv-input { display: flex; align-items: center; gap: 6px; }
.inv-input input[type="number"] { width: 64px; padding: 8px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 15px; text-align: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 0 16px; border-radius: var(--radius-sm); border: none; font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; }
.btn-gold { background: var(--gold); color: var(--espresso); }
.btn-gold:active { background: var(--gold-deep); }
.btn-outline { background: transparent; border: 1.5px solid var(--espresso); color: var(--espresso); }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 13px; }
.doc-row { display: block; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 8px; text-decoration: none; color: var(--ink); }
.doc-title { font-weight: 600; font-size: 15px; }
.doc-meta { font-size: 12px; color: var(--ink-soft); margin-top: 3px; }
.doc-detail { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; line-height: 1.6; font-size: 15px; }
.doc-detail h1, .doc-detail h2, .doc-detail h3 { font-family: "Fraunces", Georgia, serif; }
.start-wrap { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 32px 24px; background: var(--espresso); color: var(--parchment); }
.start-wrap .display { font-size: 30px; margin-bottom: 4px; }
.start-wrap .lead { color: #d8c9b3; font-size: 14px; margin-bottom: 28px; }
.field-label { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #d8c9b3; margin-bottom: 6px; display: block; }
select, input[type="text"] { width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid #5a4636; background: #3a2a1f; color: var(--parchment); font-size: 15px; margin-bottom: 18px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--ink-soft); }
.empty-state .display { font-size: 18px; color: var(--ink); margin-bottom: 6px; }
@media print {
  nav.tabbar, header.topbar, .no-print { display: none !important; }
  .app { max-width: none; }
  main { padding: 0; }
  body { background: white; }
  .doc-detail { border: none; padding: 0; }
}

/* Shift Console — assistant */
.console-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.ring-row { display: flex; gap: 20px; }
.ring-stat { flex: 1; text-align: center; }
.ring-label { font-size: 12px; color: var(--ink-soft); margin: 6px 0 0; font-weight: 600; }
.thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.bubble { max-width: 85%; padding: 12px 15px; border-radius: 14px; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; }
.bubble-assistant { align-self: flex-start; background: var(--paper); border: 1px solid var(--line); border-radius: 14px 14px 14px 3px; }
.bubble-user { align-self: flex-end; background: var(--gold); color: var(--espresso); border-radius: 14px 14px 3px 14px; font-weight: 500; }
.chat-form { display: flex; gap: 8px; position: sticky; bottom: 66px; background: var(--parchment); padding-top: 6px; }
.chat-form input[type="text"] { flex: 1; background: var(--paper); border: 1px solid var(--line); color: var(--ink); padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14.5px; margin-bottom: 0; }
.note-resolved { opacity: 0.55; }

/* Landing intro — animated greeting before the console reveals */
.intro-screen { position: fixed; max-width: 720px; margin: 0 auto; left: 0; right: 0; inset: 0; background: var(--espresso); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px; text-align: center; z-index: 50; opacity: 1; transition: opacity 0.4s ease; cursor: pointer; }
.intro-screen.intro-hide { opacity: 0; }
.intro-steam { margin-bottom: 18px; opacity: 0.9; }
.intro-text { font-family: "Fraunces", Georgia, serif; font-size: 22px; color: var(--parchment); line-height: 1.5; max-width: 320px; min-height: 90px; }
.intro-continue { margin-top: 24px; background: transparent; border: none; color: var(--gold); font-size: 14px; font-weight: 600; opacity: 0; transition: opacity 0.5s ease; cursor: pointer; }
.intro-continue-visible { opacity: 1; }
.console-main { display: none; }

/* Pill segmented control */
.pill-row { display: flex; gap: 8px; margin-bottom: 16px; }
.pill { flex: 1; padding: 9px 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); color: var(--ink-soft); font-size: 13px; font-weight: 600; cursor: pointer; }
.pill.active { background: var(--espresso); color: var(--parchment); border-color: var(--espresso); }

/* Refined task rows with icon */
.task-row-v2 { display: flex; align-items: center; gap: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; }
.task-row-v2.done { background: #f2f5f0; border-color: #dbe5d6; }
.row-icon { flex-shrink: 0; width: 38px; height: 38px; border-radius: 10px; background: #f3ead6; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.task-row-v2 .task-check { margin-left: auto; }

/* Full-screen modal (note entry) */
.modal-screen { min-height: 100vh; background: var(--espresso); color: var(--parchment); padding: 20px 20px 40px; max-width: 480px; margin: 0 auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-back { color: var(--parchment); text-decoration: none; font-size: 20px; }
.modal-title { font-family: "Fraunces", Georgia, serif; font-size: 17px; font-weight: 600; }
.modal-textarea { width: 100%; background: #3a2a1f; border: 1px solid #5a4636; color: var(--parchment); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 15px; font-family: inherit; resize: vertical; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip { padding: 9px 16px; border-radius: 999px; border: 1px solid #5a4636; background: transparent; color: var(--parchment); font-size: 13px; font-weight: 600; cursor: pointer; }
.chip.active { background: var(--gold); color: var(--espresso); border-color: var(--gold); }
.btn-pill { border-radius: 999px; min-height: 52px; font-size: 15px; }

/* Inventory stepper */
.stepper-progress { text-align: center; font-size: 13px; color: var(--ink-soft); font-weight: 600; margin-bottom: 12px; }
.stepper-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 20px; text-align: center; }
.stepper-name { font-family: "Fraunces", Georgia, serif; font-size: 20px; margin: 0 0 4px; }
.stepper-unit { color: var(--ink-soft); font-size: 13px; margin: 0 0 20px; }
.stepper-controls { display: flex; align-items: center; justify-content: center; gap: 22px; }
.stepper-btn { width: 48px; height: 48px; border-radius: 50%; border: 1.5px solid var(--espresso); background: var(--paper); font-size: 22px; color: var(--espresso); cursor: pointer; }
.stepper-value { font-size: 32px; font-weight: 600; min-width: 70px; }

.fab-note { position: fixed; right: 18px; bottom: 82px; width: 52px; height: 52px; border-radius: 50%; background: var(--gold); color: var(--espresso); display: flex; align-items: center; justify-content: center; font-size: 22px; text-decoration: none; box-shadow: 0 3px 10px rgba(0,0,0,0.25); z-index: 15; }

.suggest-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 8px; }
.chip-sm { flex-shrink: 0; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); color: var(--ink-soft); font-size: 12.5px; font-weight: 600; white-space: nowrap; cursor: pointer; }

/* Progress dots + focus card (tablet console) */
.phase-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 6px; }
.phase-dots .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.phase-dots .dot-done { background: var(--sage); }
.phase-dots .dot-current { width: 22px; border-radius: 4px; background: var(--gold); }
.phase-label { text-align: center; font-size: 12.5px; color: var(--ink-soft); font-weight: 600; margin: 0 0 22px; }

.focus-card { background: var(--espresso); border-radius: 22px; padding: 34px 28px; text-align: center; color: var(--parchment); margin-bottom: 16px; }
.focus-icon { font-size: 34px; margin-bottom: 12px; }
.focus-text { font-family: "Fraunces", Georgia, serif; font-size: 19px; line-height: 1.5; margin: 0 0 22px; }
.focus-options { display: flex; flex-direction: column; gap: 9px; }
.focus-option { width: 100%; text-align: left; padding: 15px 18px; border-radius: 14px; border: 1.5px solid #5a4636; background: transparent; color: var(--parchment); font-size: 15px; font-weight: 600; cursor: pointer; }
.focus-option:active { background: var(--gold); border-color: var(--gold); color: var(--espresso); }
.focus-input-form { display: flex; gap: 8px; }
.focus-input-form input[type="text"] { flex: 1; background: #3a2a1f; border: 1px solid #5a4636; color: var(--parchment); padding: 13px 16px; border-radius: 12px; font-size: 15px; margin-bottom: 0; }
.focus-send { width: 48px; height: 48px; border-radius: 12px; border: none; background: var(--gold); color: var(--espresso); font-size: 18px; font-weight: 700; cursor: pointer; flex-shrink: 0; }

.thread-collapsed { opacity: 0.7; }
.thread-collapsed .bubble { font-size: 13px; padding: 9px 13px; }

/* "lets start" circle button — replaces the small text link */
.intro-continue-circle {
  width: 190px; height: 190px; border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  color: var(--parchment);
  font-family: "Fraunces", Georgia, serif;
  font-size: 17px; font-weight: 600;
  margin-top: 30px;
  opacity: 0; transform: scale(0.9);
  transition: opacity 0.5s ease, transform 0.5s ease;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 14px rgba(255,255,255,0.06), 0 0 0 28px rgba(255,255,255,0.03);
}
.intro-continue-circle.circle-visible { opacity: 1; transform: scale(1); }
