/* Quiet, editorial styling — inspired by The Row / Totême:
   ivory ground, near-black ink, hairlines, tracked-out uppercase, no ornament. */
:root {
  --bg: #faf9f7;
  --card: #ffffff;
  --ink: #141414;
  --muted: #6d6a63; /* meets WCAG AA (~5:1) for hints and labels on the ivory ground */
  --line: #e4e1dc;
  --soft: #f0eeea;
  --meta: #615e57;  /* slightly darker than --muted for small-caps meta lines */
  --danger: #8a4b3f;
  --btn-bg: #141414; /* the "black" fill on buttons and the user's chat bubble */
  --btn-fg: #ffffff; /* its text — flips with the theme so dark mode inverts cleanly */
}

/* Dark theme: the same quiet editorial look, inverted — warm near-black ground,
   off-white ink. Applied automatically by the device, or forced via the toggle
   (data-theme on <html>). The light block below re-forces light when chosen. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161512;
    --card: #201e1b;
    --ink: #ece9e2;
    --muted: #a7a29a;
    --line: #34312c;
    --soft: #262420;
    --meta: #b7b2a8;
    --danger: #db8f7f;
    --btn-bg: #ece9e2;
    --btn-fg: #161512;
  }
}
:root[data-theme="dark"] {
  --bg: #161512;
  --card: #201e1b;
  --ink: #ece9e2;
  --muted: #a7a29a;
  --line: #34312c;
  --soft: #262420;
  --meta: #b7b2a8;
  --danger: #db8f7f;
  --btn-bg: #ece9e2;
  --btn-fg: #161512;
}

* { box-sizing: border-box; }

/* The hidden attribute must always win, also over our own display rules. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  /* leave room for the fixed bottom nav */
  padding-bottom: 76px;
}

/* Tracked-out uppercase, used for headings, labels, buttons and nav */
.caps, h1, h2, label, summary, nav button, button {
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

/* Full-screen login (hosted mode) */
#login {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
#login form { width: min(320px, 80vw); text-align: center; }
#login h1 { font-size: 1.05rem; font-weight: 500; letter-spacing: 0.32em; margin-bottom: 30px; }
#login label { text-align: left; }

header {
  padding: 26px 20px 14px;
  text-align: center;
}
header h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.32em;
}
.weather {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  min-height: 1em;
}

.tab { display: none; padding: 10px 20px 20px; }
.tab.active { display: block; }

/* Cards & forms */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 20px;
  margin-bottom: 24px;
}
.card h2 {
  margin: 18px 0 4px;
  font-size: 0.78rem;
  font-weight: 500;
}
.card h2:first-child { margin-top: 0; }
.hint {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 6px 0 10px;
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.5;
}

details.card summary {
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 500;
  list-style: none;
}
details.card summary::-webkit-details-marker { display: none; }
details.card[open] summary { margin-bottom: 10px; }

label {
  display: block;
  font-size: 0.66rem;
  color: var(--muted);
  margin-top: 14px;
}
input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 0;
  font-size: 1rem;
  font-family: inherit;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-bottom-color: var(--ink);
}
textarea { resize: vertical; line-height: 1.5; }
.row { display: flex; gap: 20px; }
.row label { flex: 1; }

button { font-family: inherit; }

button[type="submit"] {
  margin-top: 22px;
  width: 100%;
  padding: 14px;
  font-size: 0.72rem;
  font-weight: 500;
  border: 1px solid var(--btn-bg);
  background: var(--btn-bg);
  color: var(--btn-fg);
  cursor: pointer;
}

button.secondary, button.scan {
  margin-top: 10px;
  width: 100%;
  padding: 13px;
  font-size: 0.72rem;
  font-weight: 500;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
button.scan:disabled { opacity: 0.5; cursor: wait; }

button.secondary.danger { color: var(--danger); border-color: var(--danger); opacity: 0.85; }
button.secondary.danger:hover { opacity: 1; }

/* Numbered onboarding steps inside a hint */
ol.steps { margin: 6px 0 10px; padding-left: 20px; }
ol.steps li { margin-bottom: 6px; }
ol.steps a { color: var(--ink); }

#wardrobe-stats { margin: 2px 0 8px; min-height: 0; }
#wardrobe-stats:empty { display: none; }

/* Item list — hairline rows, no boxes */
.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 0 2px;
  flex-wrap: wrap;
}
.list-header h2 { font-size: 0.78rem; font-weight: 500; margin: 0; }
.filters { display: flex; gap: 14px; }
.list-header select {
  width: auto;
  margin: 0;
  padding: 6px 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  border-bottom: none;
}
.count { color: var(--muted); font-weight: normal; }

#search {
  margin: 10px 0 2px;
  padding: 10px 0;
  font-size: 1rem;
  border-bottom: 1px solid var(--line);
}

.items { list-style: none; margin: 0; padding: 0; }
.items li {
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
/* min-width:0 lets this flex child shrink below its content, and the wrap keeps
   a long brand name from forcing the row (and the four action buttons) off-screen. */
.items .item-text { flex: 1; min-width: 0; }
.items .title, .items .meta { overflow-wrap: anywhere; }
.items .actions { flex-shrink: 0; }
.items .thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  flex-shrink: 0;
}
.items .title { font-weight: 500; font-size: 0.95rem; }
.items .meta {
  color: var(--meta); /* darker than --muted: small caps need the contrast */
  font-size: 0.72rem;
  margin-top: 5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.items .actions { display: flex; gap: 4px; }
.items .actions button, .memories .delete {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 1.05rem;
  cursor: pointer;
  padding: 12px 10px; /* comfortable tap target */
  letter-spacing: 0;
}
.items .actions button:hover, .memories .delete:hover { color: var(--ink); }
.empty {
  color: var(--muted);
  text-align: center;
  padding: 28px 0;
  font-size: 0.85rem;
  border-bottom: none !important;
  display: block !important;
}

/* Chat */
.chat {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 50vh;
}
.msg {
  max-width: 85%;
  padding: 12px 16px;
  font-size: 0.95rem;
  line-height: 1.55;
  white-space: pre-wrap;
}
.msg.user {
  align-self: flex-end;
  background: var(--btn-bg);
  color: var(--btn-fg);
}
.msg.assistant {
  align-self: flex-start;
  background: var(--soft);
}
.msg.thinking { color: var(--muted); font-style: italic; background: none; }
.msg img {
  display: block;
  max-width: 100%;
  max-height: 240px;
  margin-bottom: 8px;
}

/* Item photo preview inside the form */
#form-photo {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  margin-top: 12px;
}
#form-photo img { max-height: 90px; display: block; border: 1px solid var(--line); }
#form-photo button { border: none; background: none; color: var(--muted); cursor: pointer; padding: 2px 6px; }

/* Outfits */
.outfits { list-style: none; margin: 0 0 6px; padding: 0; }
.outfits li {
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.outfits .title { font-weight: 500; font-size: 0.92rem; }
.outfits .meta {
  color: var(--meta);
  font-size: 0.72rem;
  margin-top: 4px;
  text-transform: none;
  letter-spacing: 0.02em;
}
.outfits .actions { display: flex; gap: 4px; }
.outfits .actions button {
  border: none; background: none; color: var(--muted);
  font-size: 1.05rem; cursor: pointer; padding: 12px 10px; letter-spacing: 0;
}
#outfit-picker { margin-top: 14px; max-height: 40vh; overflow-y: auto; }
.pick {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.9rem;
  color: var(--ink);
  margin: 0;
}
.pick input[type="checkbox"] { width: auto; margin: 0; flex-shrink: 0; accent-color: var(--ink); }

/* Inline checkbox row (e.g. advisor-vision toggle) */
label.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.9rem;
  color: var(--ink);
  margin-top: 16px;
}
label.checkbox input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--ink);
}

/* Note that the advisor learned something */
.learned-note {
  align-self: flex-start;
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Example questions in an empty chat */
#chat-suggestions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
}
#chat-suggestions button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 0.7rem;
  padding: 10px 16px;
  cursor: pointer;
}
#chat-suggestions button:hover { border-color: var(--ink); }

/* Feedback under an advice */
.feedback {
  align-self: flex-start;
  display: flex;
  gap: 10px;
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.feedback button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.66rem;
  padding: 6px 12px;
  cursor: pointer;
}
.feedback button:hover { border-color: var(--ink); color: var(--ink); }

/* Photo waiting to be sent */
#photo-preview {
  position: fixed;
  bottom: 122px;
  left: 20px;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 6px;
}
#photo-preview img { max-height: 80px; display: block; }
#photo-preview button {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.95rem;
  padding: 2px;
}

.chat-toolbar { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.chat-toolbar button {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 6px 0;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.chat-toolbar button:hover { color: var(--ink); border-bottom-color: var(--ink); }

.chat-input {
  position: fixed;
  bottom: 60px;
  left: 0;
  right: 0;
  display: flex;
  /* the field grows upward, so keep the buttons on the bottom line */
  align-items: flex-end;
  gap: 10px;
  padding: 12px 20px;
  background: var(--bg);
}
/* Grows with what you type (WhatsApp-style) instead of scrolling your own
   words out of sight; past a few lines it scrolls inside itself. */
.chat-input textarea {
  flex: 1;
  margin: 0;
  padding: 12px 0;
  border-bottom: 1px solid var(--ink);
  resize: none;
  overflow-y: auto;
  max-height: 10.5em; /* ~7 lines, then it scrolls inside itself */
  line-height: 1.45;
  font-size: 1rem;
}
.chat-input button {
  border: 1px solid var(--btn-bg);
  background: var(--btn-bg);
  color: var(--btn-fg);
  width: 46px;
  font-size: 1rem;
  cursor: pointer;
  letter-spacing: 0;
}
#photo-btn { background: transparent; color: var(--ink); }
#tab-adviseur { padding-bottom: 140px; }

/* Advisor memory list */
.memories { list-style: none; margin: 0; padding: 0; }
.memories li {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  font-size: 0.88rem;
  line-height: 1.5;
}
.memories li:last-child { border-bottom: none; }

/* Bottom navigation */
nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--bg);
  border-top: 1px solid var(--line);
}
nav button {
  flex: 1;
  padding: 16px 0 18px;
  border: none;
  background: none;
  font-size: 0.66rem;
  color: var(--muted);
  cursor: pointer;
}
nav button.active { color: var(--ink); font-weight: 500; }

/* Slightly wider screens (tablet/laptop): center the app like a phone */
@media (min-width: 700px) {
  header, .tab, nav, .chat-input { max-width: 640px; margin-left: auto; margin-right: auto; }
  nav, .chat-input { left: 50%; transform: translateX(-50%); width: 100%; }
}

/* --- Photo wall: browse the kast as pictures instead of lines of text --- */
.view-toggle {
  width: auto;
  margin: 0;
  padding: 6px 0;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.view-toggle[aria-pressed='true'] { color: var(--ink); border-bottom-color: var(--ink); }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
  margin: 4px 0 8px;
}
.photo-grid .tile {
  width: 100%;
  margin: 0;
  padding: 0;
  aspect-ratio: 3 / 4; /* clothing reads better tall than square */
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--card);
  cursor: pointer;
}
.photo-grid .tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-grid .tile-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 8px;
  font-size: 0.7rem;
  line-height: 1.35;
  /* Buttons are tracked-out uppercase here; far too wide for a name in a tile. */
  text-transform: none;
  letter-spacing: 0;
  overflow-wrap: anywhere; /* a long description must not spill out of the tile */
  color: var(--muted);
  text-align: center;
}

/* Tap a tile to see the photo big */
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  background: rgba(20, 20, 20, 0.94);
}
#lightbox img { max-width: 100%; max-height: 78vh; object-fit: contain; }
#lightbox-caption {
  margin: 0;
  color: #faf9f7;
  font-size: 0.8rem;
  text-align: center;
}
#lightbox-close { /* overlay is always dark */
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  font-size: 1.1rem;
  color: #faf9f7;
  background: none;
  border: 0;
  cursor: pointer;
}

/* --- Section headings when the kast is grouped by category --- */
.filters { flex-wrap: wrap; row-gap: 6px; } /* four controls must not overflow a phone */
.group-head {
  margin: 10px 0 0;
  padding: 0;
  border-bottom: 1px solid var(--line);
  list-style: none;
}
/* The whole heading is the fold control, so it's an easy target on a phone. */
.group-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  text-align: left;
  cursor: pointer;
}
.group-toggle:hover { color: var(--ink); }
.group-toggle[aria-expanded='true'] { color: var(--ink); }
.group-name { flex: 1; }
.group-count { letter-spacing: 0.06em; opacity: 0.75; }
.group-sign {
  width: 1.1em;
  text-align: center;
  font-size: 1.05rem;
  letter-spacing: 0;
}
.items .group-head:first-child,
.photo-grid .grid-head:first-child { margin-top: 6px; }
.photo-grid .grid-head { grid-column: 1 / -1; } /* a heading spans the whole row */

/* --- Suggestions while typing ---
   Our own list instead of <datalist>: that one is unreliable on iOS, which is
   exactly the phone this app is used on. */
#item-form label { position: relative; }
.suggest {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 5;
  margin: 0;
  padding: 0;
  max-height: 216px;
  overflow-y: auto;
  list-style: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: none;
  box-shadow: 0 6px 16px rgba(20, 20, 20, 0.08);
}
.suggest li {
  padding: 12px;
  font-size: 0.9rem;
  /* labels are tracked-out uppercase; a suggestion should read as plain text */
  text-transform: none;
  letter-spacing: normal;
  color: var(--ink);
  cursor: pointer;
}
.suggest li + li { border-top: 1px solid var(--line); }
.suggest li:hover,
.suggest li.active { background: var(--soft); }

/* --- Choosing which item fields to fill in --- */
.field-presets { display: flex; gap: 10px; margin-bottom: 4px; }
.field-presets button { margin-top: 10px; }
#field-toggles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 2px 16px;
  margin-top: 12px;
}
#field-toggles .checkbox { margin-top: 0; padding: 9px 0; }

/* --- Feedback row under a piece of advice --- */
.feedback { flex-wrap: wrap; align-items: center; }
/* The thumb you gave stays visible after a reload, and can still be changed. */
.feedback button.chosen {
  border-color: var(--ink);
  color: var(--ink);
  background: var(--soft);
}
.feedback button.keep-outfit { border-style: dashed; }
.feedback-note {
  font-size: 0.66rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}

/* --- Draft listing for selling an item second-hand --- */
#listing {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 24px 16px 60px;
  background: rgba(20, 20, 20, 0.5);
}
.listing-card {
  position: relative;
  width: min(560px, 100%);
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--line);
}
.listing-card h2 { margin: 0 0 4px; font-size: 0.78rem; font-weight: 500; }
.listing-card #listing-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
}
.listing-card textarea { line-height: 1.5; }
ul.check { margin: 4px 0 0; padding-left: 20px; }
ul.check li { margin-bottom: 4px; }

/* Continue from the enlarged photo to the item itself */
#lightbox img { cursor: pointer; }
#lightbox-open-item {
  padding: 11px 18px;
  border: 1px solid rgba(250, 249, 247, 0.5);
  background: none;
  color: #faf9f7;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 500;
  cursor: pointer;
}
#lightbox-open-item:hover { border-color: #faf9f7; }

/* --- What's new + feedback --- */
.change-title {
  margin: 16px 0 2px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}
#changelog-list .change-title:first-child,
#whats-new-body .change-title:first-child { margin-top: 0; }
ul.change-items { margin: 4px 0 0; padding-left: 20px; }
ul.change-items li { margin-bottom: 6px; }
#feedback-status:empty, #fields-saved:empty { display: none; }

/* --- What the wardrobe is worth --- */
.value-rows { list-style: none; margin: 6px 0 0; padding: 0; }
.value-rows li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}
.value-rows li:last-child { border-bottom: none; }
.value-rows li span:last-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
.value-head {
  margin: 18px 0 0;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* The "sell" button nods to Vinted: their teal (#007782) and a rounded sans.
   Their actual wordmark typeface is proprietary, so this approximates the look
   with fonts already on the device instead of shipping someone else's font. */
.items .actions button.sell {
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", "Helvetica Neue", sans-serif;
  font-weight: 700;
  color: #007782;
}
.items .actions button.sell:hover { color: #00565e; }

/* --- Agenda: what you wore --- */
.today-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--card);
  cursor: pointer;
  text-align: left;
  letter-spacing: normal;
  text-transform: none;
}
.today-label {
  font-size: 0.66rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  flex-shrink: 0;
}
.today-ask { font-size: 0.85rem; color: var(--ink); }

.worn-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.worn-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--line);
  background: var(--bg);
  font-size: 0.76rem;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink);
}
.worn-chip img { width: 24px; height: 24px; object-fit: cover; display: block; }
.worn-chip:has(> :not(img):first-child) { padding-left: 10px; }



#daypick {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 24px 16px 60px;
  background: rgba(20, 20, 20, 0.5);
}
#daypick-list { margin-top: 10px; max-height: 55vh; overflow-y: auto; }

/* --- Balance: distribution bars --- */
.bars { list-style: none; margin: 6px 0 0; padding: 0; }
.bars li {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) 2fr auto;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  font-size: 0.82rem;
}
.bars .bar {
  height: 6px;
  background: var(--soft);
  display: block;
}
.bars .bar i {
  display: block;
  height: 100%;
  background: var(--ink);
  opacity: 0.55;
}
.bars .bar-count {
  font-size: 0.76rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 1.6em;
  text-align: right;
}

/* --- Packing lists --- */
.packing { margin-bottom: 20px; }
.packing:last-child { margin-bottom: 0; }
.packing-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.packing-name { flex: 1; font-size: 0.9rem; font-weight: 500; }
.packing-count {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.packing-delete {
  border: 0; background: none; color: var(--muted);
  cursor: pointer; padding: 6px 4px; letter-spacing: 0; font-size: 0.95rem;
}
.packing-delete:hover { color: var(--ink); }

/* Four tabs fit on a normal phone, but on a narrow one (SE-sized) the
   tracked-out capitals would crowd — give them a little room back. */
@media (max-width: 360px) {
  nav button { letter-spacing: 0.06em; font-size: 0.62rem; padding-left: 2px; padding-right: 2px; }
}

/* --- Month calendar --- */
.cal-head { display: flex; align-items: center; gap: 8px; }
.cal-head h2 { flex: 1; text-align: center; margin: 0; }
.cal-head button {
  width: 44px; height: 44px; padding: 0;
  border: 0; background: none; color: var(--muted);
  font-size: 1.3rem; line-height: 1; cursor: pointer; letter-spacing: 0;
}
.cal-head button:hover { color: var(--ink); }

.cal-weekdays, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-weekdays {
  margin-top: 10px;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-align: center;
}
.cal-weekdays span { padding: 6px 0; }

.cal-grid { gap: 2px; margin-bottom: 6px; }
.cal-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid transparent;
  background: none;
  color: var(--ink);
  font-size: 0.82rem;
  letter-spacing: 0;
  cursor: pointer;
}
.cal-day .cal-dot { font-size: 0.75rem; line-height: 0.6; color: var(--ink); min-height: 0.6em; }
.cal-day.other-month { color: var(--line); }
.cal-day.other-month .cal-dot { color: var(--line); }
.cal-day.is-today { border-color: var(--line); font-weight: 600; }
.cal-day.is-selected { background: var(--btn-bg); color: var(--btn-fg); border-color: var(--btn-bg); }
.cal-day.is-selected .cal-dot { color: var(--btn-fg); }
.cal-day.is-future { color: var(--muted); }
/* An open marker means planned, a filled one means actually worn. */
.cal-day .cal-dot { font-weight: 600; }

.cal-day-title {
  margin: 14px 0 6px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

/* Planned vs worn in the day detail */
.planned-label {
  margin-bottom: 4px;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
#cal-day .hint:empty { display: none; }
#cal-day .worn-chips { margin-bottom: 10px; }

/* --- AI credit estimate --- */
.usage-box { margin: 6px 0 4px; }
.usage-reset-wrap { display: flex; align-items: flex-end; }
.usage-reset-wrap button { margin-top: 6px; }
.usage-low, .usage-low span { color: var(--danger); }

/* --- AI credit thermometer (advisor screen) --- */
.credit-bar {
  display: block;
  /* Sticky, or the chat's auto-scroll-to-bottom pushes it out of sight. */
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 0 12px;
  padding: 10px 0 8px;
  background: var(--bg);
  text-decoration: none;
  color: var(--muted);
  cursor: pointer;
}
.credit-track {
  height: 8px;
  width: 100%;
  background: var(--soft);
  border: 1px solid var(--line);
  overflow: hidden;
}
.credit-fill {
  height: 100%;
  width: 100%;
  background: #3f8f5f;
  transition: width 0.4s ease, background 0.4s ease;
}
.credit-label {
  display: block;
  margin-top: 5px;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* --- Morning suggestion card + surprise chip --- */
.morning-card .morning-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.morning-card button[type="button"]:not(.secondary) {
  margin-top: 4px;
  padding: 12px 16px;
  font-size: 0.72rem;
  font-weight: 500;
  border: 1px solid var(--btn-bg);
  background: var(--btn-bg);
  color: var(--btn-fg);
  cursor: pointer;
  flex: 1;
}
.morning-card button.secondary { margin-top: 4px; width: auto; flex: 1; }
#chat-suggestions button[data-prompt] { border-color: var(--ink); color: var(--ink); }
