/* Cormorant Garamond, subset latin (cobre o português por inteiro), servida
   localmente para a app continuar igual offline. SIL Open Font License 1.1. */
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/cormorant-garamond-500-latin.woff2") format("woff2");
  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;
}

:root {
  --paper: #faf6ee;
  --paper-raised: #fefbf5;
  --ink: #291e14;
  --ink-soft: #5a4d40;
  --line: #dfd8cc;
  --thread: #004545;
  --thread-ink: #fbf8f2;
  /* 4.5:1 sobre as três superfícies claras. O brass é sempre texto pequeno —
     rótulos, tags de marca, "O CERTO PARA HOJE" — e a esse tamanho o tom
     anterior ficava por baixo do mínimo legível. */
  --brass: #8f6a24;
  --clay: #c53732;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(41, 30, 20, 0.04), 0 8px 24px rgba(41, 30, 20, 0.06);

  /* Cormorant é uma display face: hastes finas que só se aguentam em
     tamanho grande. Usar apenas acima de ~24px — abaixo disso, sans. */
  --font-display: "Cormorant Garamond", Georgia, "Iowan Old Style", serif;
  --font-sans: -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17130f;
    --paper-raised: #211b16;
    --ink: #f0e9dc;
    --ink-soft: #b3a493;
    --line: #372f27;
    --thread: #58b7b1;
    --thread-ink: #10201f;
    --brass: #d6a84d;
    --clay: #e2694a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.34), 0 8px 24px rgba(0, 0, 0, 0.36);
  }
}

* { box-sizing: border-box; }

/* Elements toggle visibility via the `hidden` attribute in JS; without this, any component
   that also sets its own `display` (grid, flex...) would override the browser's default
   [hidden] { display: none } and stay visible regardless of the attribute. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

button, input, select {
  font: inherit;
  color: inherit;
}

#app.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.boot {
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/* --- Auth --- */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 1.75rem;
}

.brand {
  font-family: var(--font-display);
  font-size: 1.6rem;
  letter-spacing: -0.01em;
}

.brand-link {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--ink);
  cursor: pointer;
}

.tagline {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin: 0.3rem 0 1.6rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

label {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* type="number" faltava nesta lista, e por isso os campos "Quantos dias?" do
   Plano e da Mala e o "Preço" do formulário de peça ficavam com o estilo cru do
   browser: sem padding, sem raio, e mais baixos que os vizinhos. Num formulário
   em linha alinhado pela base, um campo mais baixo empurra o próprio rótulo
   para baixo — era isso que fazia a linha parecer torta. */
input[type="email"], input[type="text"], input[type="search"], input[type="file"],
input[type="number"], select {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
  font-size: 1rem;
  width: 100%;
}

input:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--thread);
  outline-offset: 1px;
}

button {
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.8rem 1.1rem;
  font-size: 0.95rem;
  cursor: pointer;
}

.primary-btn {
  background: var(--thread);
  color: var(--thread-ink);
  font-weight: 600;
}
.primary-btn:disabled { opacity: 0.6; cursor: default; }

.ghost-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

@media (prefers-reduced-motion: no-preference) {
  button { transition: transform 0.1s ease, opacity 0.1s ease; }
  button:active:not(:disabled) { transform: scale(0.97); }
}

.auth-message {
  margin-top: 1.2rem;
  font-size: 0.9rem;
  color: var(--thread);
  text-align: center;
}

.code-form {
  margin-top: 1.4rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}

#login-code {
  text-align: center;
  font-size: 1.3rem;
  letter-spacing: 0.3em;
}

.code-hint {
  margin: 0.6rem 0 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-align: center;
}

/* --- Shell --- */

.shell { min-height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--paper);
  z-index: 30;
}

.menu-toggle {
  width: 2.2rem;
  height: 2.2rem;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  padding: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.user-email {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.app-body {
  display: flex;
  align-items: flex-start;
  max-width: 1180px;
  margin: 0 auto;
}

/* --- Sidebar ---
   Off-canvas drawer by default (phone), toggled by the hamburger button. Becomes a persistent
   column at the desktop breakpoint, see the @media block near the bottom. */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  background: var(--paper-raised);
  border-right: 1px solid var(--line);
  padding: 4.5rem 1.1rem 1.5rem;
  overflow-y: auto;
  z-index: 40;
  transform: translateX(-100%);
  transition: transform 0.2s ease;
}

.shell.sidebar-open .sidebar { transform: translateX(0); }

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, 0.4);
  z-index: 35;
}

.sidebar-section { margin-bottom: 1.1rem; }
.sidebar-section-tight { margin-bottom: 0.3rem; }

.sidebar-department {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
}
.dept-icon { flex: 0 0 auto; color: var(--brass); width: 14px; height: 14px; }

/* Group headings (the non-clickable department labels) read as quiet section labels, so the
   clickable items beneath them clearly belong to a group rather than competing with it. The
   clickable department buttons (Loja) keep the serif treatment above. */
.sidebar-department:not(.sidebar-department-btn) {
  font-family: var(--font-sans);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  /* Generous space above each group label separates it from the previous group's items, so it
     reads as a section divider rather than one more line in a long list. */
  margin: 1.5rem 0 0.7rem;
}
.sidebar-department:not(.sidebar-department-btn) .dept-icon {
  width: 13px;
  height: 13px;
  opacity: 0.9;
}

.sidebar-department-btn {
  width: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.5rem;
  margin: 0 0 0.3rem -0.5rem;
  text-align: left;
}
.sidebar-department-btn:hover { background: var(--paper); }
.sidebar-department-btn.active { color: var(--thread); }
.sidebar-department-btn.active .dept-icon { color: var(--thread); }

.sidebar-categories {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

/* One nav-item look for everything in the sidebar — categories and section entries alike — so the
   menu reads as a single consistent list, never a mix of big and small type. Clean sans, one size,
   one weight; the editorial serif stays for content, not navigation. */
.sidebar-cat-btn,
.sidebar-smart {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.6rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.sidebar-cat-btn .cat-icon,
.sidebar-smart .cat-icon { width: 16px; height: 16px; }

.sidebar-cat-btn:hover,
.sidebar-smart:hover { background: var(--paper); color: var(--ink); }

/* Refined active state — a soft tint and thread-coloured text/icon, plus a slim accent bar. Much
   lighter than a solid fill repeated down the list, and consistent for every item. */
.sidebar-cat-btn.active,
.sidebar-smart.active {
  background: color-mix(in srgb, var(--thread) 13%, transparent);
  color: var(--thread);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--thread);
}

.sidebar-cat-label { flex: 1; }

.cat-icon { flex: 0 0 auto; opacity: 0.75; }
.sidebar-cat-btn.active .cat-icon,
.sidebar-smart.active .cat-icon { opacity: 1; color: var(--thread); }

.sidebar-count {
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

/* --- Collapsible group headers --- */
.sidebar-group-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.35rem 0.6rem;
  margin: 1.4rem 0 0.45rem;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: left;
  transition: color 0.12s ease;
}
.sidebar-group-toggle:hover { color: var(--ink); }
.sidebar-group-toggle .dept-icon { width: 13px; height: 13px; opacity: 0.9; }
.sidebar-group-toggle .group-label { flex: 1; }
.sidebar-group-toggle .chevron {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  opacity: 0.55;
  transition: transform 0.2s ease;
}
.sidebar-section.collapsed .sidebar-group-toggle .chevron { transform: rotate(-90deg); }

.sidebar-group-items {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.sidebar-section.collapsed .sidebar-group-items { display: none; }

/* A standalone group of leaf items (Loja / Acessos) with no header above — needs its own breathing
   room so it doesn't crowd the group before it. */
.sidebar-section-loose { margin-top: 1.4rem; }

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.3rem;
  height: 1.3rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--clay);
  color: white;
  font-size: 0.7rem;
  margin-left: 0.5rem;
}

.sidebar-future { padding-top: 0.4rem; border-top: 1px solid var(--line); }

.sidebar-disabled {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  opacity: 0.6;
}

.soon-tag {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15em 0.45em;
  border: 1px solid var(--line);
  border-radius: 999px;
}

/* --- Stale item callout --- */

.stale-callout {
  margin-top: 0.6rem;
  padding: 0.7rem;
  background: color-mix(in srgb, var(--clay) 12%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--clay) 35%, var(--line));
  border-radius: var(--radius-sm);
}

.stale-text {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--ink);
}

.stale-actions {
  display: flex;
  gap: 0.4rem;
}

.stale-keep-btn, .stale-remove-btn {
  flex: 1;
  font-size: 0.7rem;
  padding: 0.35rem 0.4rem;
}

/* --- History --- */

.diario-mes { margin-bottom: 2.2rem; }

.diario-mes-titulo {
  margin: 0 0 0.9rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
}

.diario-grelha {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 1.1rem;
}

.diario-dia { min-width: 0; }

/* O mosaico dá ao dia a forma de um conjunto e não de uma lista de peças. Uma
   grelha 2×2 fixa com a primeira foto a ocupar o que sobra: com uma peça enche
   o quadrado, com três a de cima fica larga. */
.diario-fotos {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--line);
}
.diario-fotos[data-n="1"] { grid-template-columns: 1fr; }
.diario-fotos[data-n="2"] { grid-template-rows: 1fr; }
.diario-fotos[data-n="3"] > img:first-child { grid-column: span 2; }

.diario-fotos img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: var(--paper);
}

.diario-sem-foto {
  display: grid;
  place-items: center;
  background: var(--paper-raised);
  color: var(--ink-soft);
  font-size: 0.7rem;
}

/* Quantas peças ficaram de fora do mosaico. */
.diario-mais {
  position: absolute;
  right: 0.35rem;
  bottom: 0.35rem;
  background: color-mix(in srgb, var(--ink) 82%, transparent);
  color: var(--paper);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

.diario-data {
  margin: 0.55rem 0 0;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: capitalize;
}

/* Os nomes das peças são contexto, não título: uma linha só, e o resto fica no
   title para quem quiser passar o rato. */
.diario-pecas {
  margin: 0.1rem 0 0;
  font-size: 0.72rem;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Shop --- */

.shop-lead {
  margin: -0.4rem 0 1.25rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.shop-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.shop-link {
  font-size: 0.75rem;
  padding: 0.35rem 0.7rem;
  white-space: nowrap;
}

/* --- Plan --- */

.plan-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  align-items: flex-end;
  margin-bottom: 1.5rem;
}

.plan-days-field { width: 110px; }

/* O campo de destino ancora a lista de correspondências. */
.pack-dest-field {
  position: relative;
  flex: 1;
  min-width: 180px;
}

.dest-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 20;
  margin: 0.3rem 0 0;
  padding: 0.25rem;
  list-style: none;
  max-height: 15rem;
  overflow-y: auto;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.dest-list li {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
}
.dest-list li:hover, .dest-list li:focus-visible { background: var(--paper); }
.dest-list li span {
  font-size: 0.76rem;
  color: var(--ink-soft);
}

/* Fora do fluxo, para a nota não mudar a altura do campo — num formulário
   alinhado pela base, um campo mais alto desalinha a linha toda. */
.dest-note {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin: 0.3rem 0 0;
  font-size: 0.74rem;
  line-height: 1.35;
  color: var(--ink-soft);
}
.dest-note-ok { color: var(--thread); }
.plan-context-field { flex: 1; min-width: 220px; }

.plan-results {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* --- Onboarding --- */

.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, 0.5);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.onboarding-card {
  max-width: 440px;
  width: 100%;
  background: var(--paper-raised);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.onboarding-lead {
  color: var(--ink-soft);
  margin: 0.4rem 0 1.3rem;
}

.onboarding-steps {
  list-style: none;
  margin: 0 0 1.6rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.onboarding-step {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
}
.onboarding-num {
  flex-shrink: 0;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--thread);
  color: var(--thread-ink);
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.onboarding-step-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--ink-soft);
}
.onboarding-step-body strong { color: var(--ink); font-size: 0.95rem; }
.onboarding-step-body em { color: var(--thread); font-style: normal; font-weight: 600; }

#onboarding-dismiss-btn { width: 100%; }

.content {
  flex: 1;
  min-width: 0;
  padding: 1.25rem;
}

/* --- Welcome hero --- */

/* Sem moldura própria: a .top-row já é uma superfície, e um cartão dentro de
   outro cartão só acrescenta altura e peso. O tempo é o hero — não precisa de
   estar dentro de uma caixa para se perceber que é o topo da página. */
.welcome-hero {
  margin-bottom: 1.75rem;
  padding: 0.35rem 0.25rem 0.5rem;
}

/* Saudação e frase na mesma linha, alinhadas pela base. Empilhadas custavam
   duas linhas para dizer o que cabe numa. */
.hero-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 0.6rem;
}

.greeting {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.65rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.hero-tagline {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.top-row {
  padding: 1.25rem 1.25rem 0.25rem;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 12% 15%, color-mix(in srgb, var(--brass) 10%, transparent), transparent 60%),
    radial-gradient(circle at 88% 80%, color-mix(in srgb, var(--thread) 9%, transparent), transparent 60%);
}

/* --- File input --- */

/* O seletor duplicado não é decorativo: `input[type="file"]` lá em cima é mais
   específico do que uma classe sozinha, e impunha `width: 100%` a estes campos
   que deviam ter 1px. Resultado: inputs invisíveis de ~1500px a esticar a
   página e a criar barra de scroll horizontal em todos os ecrãs. */
.file-input-hidden,
input[type="file"].file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.file-input-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.file-btn {
  display: inline-flex;
  align-items: center;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
}
.file-btn:hover { background: var(--paper); }

.file-name {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

/* A faixa do tempo é agora o único cartão do topo — o hero à volta perdeu a
   moldura precisamente para isto não ser uma caixa dentro de outra. */
.weather-widget {
  margin-top: 0.85rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-raised);
  box-shadow: var(--shadow);
}

.weather-main {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.weather-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--thread);
  color: var(--thread-ink);
  display: grid;
  place-items: center;
}
.weather-icon svg { width: 20px; height: 20px; }

.weather-id { flex: 1 1 auto; min-width: 0; }

.weather-desc {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.weather-place {
  margin: 0.1rem 0 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.weather-temp {
  flex: 0 0 auto;
  font-family: var(--font-display);
  font-size: 2.5rem;
  line-height: 1;
  color: var(--thread);
  font-variant-numeric: tabular-nums;
}

.weather-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.2rem;
  margin-top: 0.7rem;
  font-size: 0.76rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.weather-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.weather-stat svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  color: var(--thread);
}

/* O resto do dia, hora a hora. Sangra até às margens da faixa para a tira
   rolar de bordo a bordo e se perceber que há mais para o lado. */
.weather-hours {
  margin-top: 0.7rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
}

.weather-hours-title {
  margin: 0 0 0.2rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
}

.weather-hours-strip {
  display: flex;
  gap: 1.2rem;
  overflow-x: auto;
  margin: 0 -1.1rem;
  padding: 0.4rem 1.1rem 0.1rem;
  scrollbar-width: thin;
}

/* Crescem para ocupar a faixa toda quando há espaço, mas nunca encolhem abaixo
   de 3.4rem — em ecrã estreito voltam a rolar em vez de se esmagarem. */
.weather-hour {
  flex: 1 0 3.4rem;
  text-align: center;
}

.weather-hour-h {
  margin: 0;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.weather-hour-t {
  margin: 0.1rem 0 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.weather-hour-c {
  margin: 0.2rem 0 0;
  font-size: 0.62rem;
  line-height: 1.25;
  color: var(--ink-soft);
}

.weather-retry {
  margin-top: 0.8rem;
  font-size: 0.85rem;
}

.notify-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.notify-btn, .notify-test-btn {
  font-size: 0.85rem;
}

.notify-status {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

/* --- Outfit suggestions --- */

.suggest-section {
  margin-bottom: 1.75rem;
  padding: 1.5rem;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.section-heading {
  margin: 0 0 0.8rem;
  font-family: var(--font-display);
  font-size: 1.9rem;
  line-height: 1.15;
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* Exemplos por baixo da caixa: um toque preenche-a. Ficam mais leves do que a caixa em si —
   são uma sugestão, não um controlo principal. */
.prompt-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.prompt-example {
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.3;
}

.prompt-example:hover {
  border-style: solid;
  border-color: var(--thread);
  color: var(--ink);
}

.prompt-example:focus-visible {
  outline: 2px solid var(--thread);
  outline-offset: 2px;
}

.suggest-input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.8rem;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
}

.suggest-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.suggest-status {
  margin-top: 0.9rem;
  font-size: 0.88rem;
  color: var(--thread);
}

.suggest-results {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.suggest-refresh {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.suggest-cached-note {
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.suggest-refresh .ghost-btn {
  font-size: 0.8rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  margin-left: auto;
}

.suggest-option {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.suggest-option-heading {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 0.7rem;
}

/* The recommended look leads: raised surface, a touch more presence than the alternatives. */
.suggest-hero {
  background: var(--paper-raised);
  border-color: var(--thread);
  border-width: 1.5px;
}

/* Alternatives, once expanded, stack under the hero with the same rhythm as the rest of the board. */
.suggest-more {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}
.suggest-more-btn {
  display: block;
  width: 100%;
  margin-top: 0.9rem;
  font-size: 0.85rem;
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
}

/* Shown under the single day's look before the full set is revealed. */
.suggest-hint {
  margin-top: 0.7rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
  text-align: center;
}

/* "What's limiting your looks" note — an insight, not an alarm: soft brass accent, not an error red. */
.bottleneck {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brass);
  border-radius: var(--radius-sm);
  background: var(--paper-raised);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: flex-start;
}
.bottleneck-text {
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--ink);
  margin: 0;
}
.bottleneck-btn {
  font-size: 0.8rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
}

/* "Trocar peça" row: one pill per slot. A pill with alternatives is a button (⟳ cycles it);
   a piece you own only one of renders muted and inert, so the reason is obvious. */
.swap-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0.6rem 0 0.2rem;
}

/* Optional AI colour-refine — a light, opt-in action (it spends a credit), distinct from the free
   deterministic swap chips above it. */
.ai-refine-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  padding: 0.32rem 0.7rem;
  margin: 0 0 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--brass);
  background: transparent;
  color: var(--brass);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ai-refine-btn:hover:not(:disabled) {
  background: var(--brass);
  color: var(--paper-raised);
}
.ai-refine-btn:disabled {
  opacity: 0.7;
  cursor: default;
}

/* --- "Fica-me bem?" (provar uma peça de loja no armário) --- */
.tryon-controls { margin-bottom: 0.8rem; }
.tryon-controls .primary-btn { width: 100%; }
.tryon-detected {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  display: grid;
  gap: 1rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.tryon-detected-head { display: flex; gap: 0.9rem; align-items: center; }
.tryon-preview {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  border: 1px solid var(--line);
}
.tryon-detected-label { font-size: 0.85rem; color: var(--ink-soft); margin: 0; }
.tryon-detected .primary-btn { width: 100%; }
.tryon-verdict {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-left: 3px solid var(--thread);
  color: var(--ink);
  margin-bottom: 0.7rem;
}
.tryon-verdict-weak { border-left-color: var(--clay); }
.tryon-similar {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0 0 1rem;
  line-height: 1.45;
}
.swap-row-label {
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin-right: 0.15rem;
}
.swap-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper-raised);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.swap-chip:hover {
  border-color: var(--thread);
  background: var(--paper);
}
.swap-chip-icon {
  font-size: 0.9rem;
  color: var(--thread);
  line-height: 1;
}
.swap-chip-locked {
  cursor: default;
  color: var(--ink-soft);
  background: transparent;
  border-style: dashed;
}

/* --- Flat-lay (outfit composition) ---
   Photos we already have, arranged like real clothes laid out for a look instead of a strip
   of thumbnails: top piece upper-left, bottom piece lower-right, slight rotation for an
   editorial, "laid out by hand" feel instead of a rigid grid. */

.flatlay {
  position: relative;
  min-height: 200px;
  background: var(--paper);
  border-radius: var(--radius-sm);
  padding: 1.4rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.flatlay-piece {
  width: 62%;
  max-width: 170px;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 6px 14px rgba(20, 20, 20, 0.16);
  background: var(--paper-raised);
}
.flatlay-piece img,
.flatlay-piece .item-photo-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.flatlay-piece .item-photo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.flatlay-top {
  align-self: flex-start;
  margin-left: 4%;
  transform: rotate(-3deg);
  margin-bottom: -1.4rem;
  z-index: 2;
}
.flatlay-bottom {
  align-self: flex-end;
  margin-right: 4%;
  transform: rotate(3deg);
  z-index: 1;
}

/* Footwear: a proper, sizeable slot centred under the outfit — big enough to read the shoe,
   not the old 42px dot. Reuses .flatlay-piece (aspect/shadow/rounding); only size + placement here. */
.flatlay-shoe {
  align-self: center;
  margin-top: 0.6rem;
  width: 40%;
  max-width: 108px;
  transform: rotate(-2deg);
  z-index: 3;
}

.flatlay-extras {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.9rem;
  flex-wrap: wrap;
  justify-content: center;
}
.flatlay-extra-piece {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--paper-raised);
}
.flatlay-extra-piece img { width: 100%; height: 100%; object-fit: cover; display: block; }

.flatlay-fallback .flatlay-extras { margin-top: 0; }
.flatlay-extra-piece-lg {
  width: 84px;
  height: 84px;
  border-radius: 10px;
  box-shadow: 0 6px 14px rgba(20, 20, 20, 0.16);
  overflow: hidden;
  background: var(--paper-raised);
}
.flatlay-extra-piece-lg img { width: 100%; height: 100%; object-fit: cover; display: block; }

.flatlay-labels {
  margin: 0.8rem 0 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-align: center;
}

.suggest-reason {
  margin: 0.9rem 0 0;
  font-size: 0.9rem;
  color: var(--ink);
  line-height: 1.45;
}

/* --- Look actions (Vesti este / Guardar look), on suggestions, plan days and saved looks --- */

.look-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.look-action {
  flex: 1 1 auto;
  min-width: 110px;
  font-size: 0.8rem;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  text-align: center;
}
.look-action:disabled { opacity: 0.75; cursor: default; }

.look-action-primary {
  background: color-mix(in srgb, var(--thread) 9%, var(--paper-raised));
  border-color: color-mix(in srgb, var(--thread) 45%, var(--line));
  color: var(--thread);
  font-weight: 600;
}

/* The quietest action on the card — a plain text link, no border, so rejecting is available but
   never competes with wear/save. */
.dislike-btn {
  display: block;
  margin: 0.6rem auto 0;
  background: transparent;
  border: none;
  color: var(--ink-soft);
  font-size: 0.75rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0.2rem 0.4rem;
}
.dislike-btn:hover { color: var(--clay); }
.dislike-btn:disabled { opacity: 0.5; }
.look-action-primary:hover:not(:disabled) {
  background: var(--thread);
  border-color: var(--thread);
  color: var(--thread-ink);
}

.looks-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* --- Modo Mala (packing capsule) --- */

.pack-bag { margin-bottom: 1.2rem; }

.pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 0.7rem;
  margin-bottom: 0.2rem;
}

.pack-piece {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.pack-piece-photo {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--paper-raised);
  border: 1px solid var(--line);
}
.pack-piece-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.pack-piece-label {
  font-size: 0.7rem;
  color: var(--ink-soft);
  line-height: 1.2;
}

/* --- Broadcast (admin novidades) --- */

.broadcast-panel {
  margin-top: 2.4rem;
  padding: 1.5rem 1.5rem 1.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-raised);
  box-shadow: var(--shadow);
}
.broadcast-panel .help-card-title {
  margin: 0 0 0.5rem;
}
.broadcast-lead {
  margin: 0 0 1.3rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.55;
  max-width: 46ch;
}
.broadcast-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}
.broadcast-actions .ghost-btn,
.broadcast-actions .primary-btn {
  font-size: 0.85rem;
  padding: 0.6rem 1.1rem;
}
#broadcast-status {
  margin-top: 1rem;
}

/* --- Ajuda & melhorias --- */

.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.4rem;
}
@media (max-width: 620px) {
  .help-grid { grid-template-columns: 1fr; }
}

.help-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
}
.help-card-title {
  margin: 0 0 0.7rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
}
.help-list {
  margin: 0;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink);
}
.help-list li::marker { color: var(--brass); }
.help-list strong { color: var(--thread); font-weight: 600; }

.help-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.9rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid color-mix(in srgb, var(--brass) 35%, var(--line));
  background: color-mix(in srgb, var(--brass) 8%, var(--paper-raised));
  border-radius: var(--radius);
}
.help-cta-text {
  margin: 0;
  flex: 1 1 260px;
  font-size: 0.9rem;
  color: var(--ink);
}
.help-cta-btn {
  flex: 0 0 auto;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

/* --- Insights --- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
  margin-bottom: 1.1rem;
}

.stat-tile {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 0.8rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-value {
  font-family: var(--font-display);
  font-size: 1.9rem;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat-label {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: var(--ink-soft);
  line-height: 1.2;
}

.insights-note {
  margin: 0 0 1.4rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink);
}
.insights-note strong { color: var(--thread); }

.insights-heading {
  margin: 0 0 0.7rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
}
.insights-sub {
  margin: -0.4rem 0 0.8rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

/* Equilíbrio do armário: três barras comparáveis entre si. A proporção é a
   informação — ver 49 ao lado de 6 diz mais do que qualquer frase. */
.balance {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.balance-linha {
  display: grid;
  grid-template-columns: 5.5rem 1fr 2.2rem;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.82rem;
}

.balance-nome { color: var(--ink-soft); }

.balance-barra {
  height: 0.6rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 70%, transparent);
  overflow: hidden;
}
.balance-barra > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--thread);
}

.balance-n {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}

/* O lugar que limita os outros fica marcado — é o que se quer levar daqui. */
.balance-gargalo .balance-nome,
.balance-gargalo .balance-n { color: var(--clay); font-weight: 600; }
.balance-gargalo .balance-barra > span { background: var(--clay); }

/* Valor do armário: uma linha, não um tile. O número é a figura que se lê
   primeiro, e a cobertura da amostra vai logo por baixo do rótulo para não
   se poder ler o total sem saber de quantas peças ele sai. */
.wardrobe-value {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
  padding: 0.9rem 1.1rem;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.wardrobe-value-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
}

.wardrobe-value-sub {
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.wardrobe-value-amount {
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1;
  color: var(--thread);
  font-variant-numeric: tabular-nums;
}

.bar-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.6rem;
}

/* Palette + seasonality bars (Insights) */
.palette-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}
.palette-row {
  display: grid;
  grid-template-columns: minmax(0, 9rem) 1fr auto;
  align-items: center;
  gap: 0.7rem;
}
.palette-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.palette-bar {
  height: 0.55rem;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.palette-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--thread);
  min-width: 2px;
}
.palette-count {
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 8rem) 1fr auto;
  align-items: center;
  gap: 0.6rem;
}
.bar-label {
  font-size: 0.8rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Thin bar, baseline-anchored, 4px rounded data-end — single sequential hue for magnitude. */
.bar-track {
  height: 0.7rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--thread);
  border-radius: 999px;
}
.bar-value {
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

/* Cost-per-wear: two columns (best / worst), each a small ranked list. */
.cpw-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.4rem;
  margin-bottom: 1.6rem;
}
.cpw-col-title {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--line);
}
.cpw-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.cpw-label { font-size: 0.8rem; color: var(--ink); min-width: 0; }
.cpw-detail { display: block; font-size: 0.68rem; color: var(--ink-soft); }
.cpw-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--thread);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.cpw-unit { font-weight: 400; font-size: 0.7rem; color: var(--ink-soft); }

@media (max-width: 460px) {
  .cpw-block { grid-template-columns: 1fr; gap: 1.2rem; }
}

/* --- Toolbar (add button + search) --- */

.toolbar-section {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-bottom: 1.4rem;
}
.toolbar-section .primary-btn,
.toolbar-section .ghost-btn { width: 100%; }

.toolbar-section .primary-btn,
.toolbar-section .ghost-btn,
.search-wrap {
  height: 3rem;
  box-sizing: border-box;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 1rem;
  color: var(--ink-soft);
  pointer-events: none;
}

/* --- Add form --- */

.add-section { margin-bottom: 1.75rem; }

/* --- Multi-piece review (one photo → several items) --- */
.multi-review {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: grid;
  gap: 1rem;
  box-shadow: var(--shadow);
}
.multi-review-head {
  display: flex;
  gap: 0.9rem;
  align-items: center;
}
.multi-photo-preview {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  border: 1px solid var(--line);
}
.multi-list {
  display: grid;
  gap: 0.8rem;
}
.multi-row {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.8rem;
  background: var(--paper);
}
.multi-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}
.multi-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.multi-row-num {
  margin-right: auto;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brass);
}
.multi-remove {
  border: none;
  background: none;
  color: var(--clay);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0.2rem 0.3rem;
  text-decoration: underline;
}
.multi-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.6rem;
}
.multi-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.multi-field span {
  font-size: 0.72rem;
  color: var(--ink-soft);
}
.multi-field input,
.multi-field select {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper-raised);
  color: var(--ink);
  font-size: 0.85rem;
}
.multi-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.multi-actions .primary-btn,
.multi-actions .ghost-btn { flex: 1; min-width: 120px; }

.add-form {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: grid;
  gap: 0.9rem;
  box-shadow: var(--shadow);
}

.field { display: flex; flex-direction: column; gap: 0.3rem; }

.classify-status {
  margin: 0.3rem 0 0;
  font-size: 0.8rem;
  color: var(--thread);
}

.form-mode-label {
  margin: -0.3rem 0 0;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brass);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.4rem;
}

/* --- Items grid --- */

/* input[type="search"] in the base input rule above has specificity (0,1,1); a plain .search-input
   class rule is (0,1,0) and loses the padding-left override. Tie it at (0,1,1) with a type
   selector so this — the later rule — wins as intended. */
input.search-input {
  height: 100%;
  width: 100%;
  padding-left: 2.6rem;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.items-grid {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

.type-heading {
  margin: 0 0 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
}

.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.9rem;
}

.item-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* A foto recua para dentro do cartão em vez de sangrar até à borda, alinhada
   com o padding lateral do corpo. Dá ar à peça e faz o cartão ler como uma
   moldura, em vez de a foto ser o próprio cartão. */
.item-photo {
  flex: 0 0 auto;
  aspect-ratio: 1;
  margin: 0.8rem 0.8rem 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--paper);
}
.item-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.item-photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.item-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.8rem 0.8rem 0.85rem;
}

.item-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.color-swatch {
  display: inline-block;
  width: 0.72em;
  height: 0.72em;
  border-radius: 50%;
  margin-right: 0.25em;
  vertical-align: baseline;
  border: 1px solid color-mix(in srgb, var(--ink) 22%, transparent);
}

.item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.worn-note {
  margin-top: 0.6rem;
  font-size: 0.7rem;
  color: var(--ink-soft);
}
.worn-note-today { color: var(--thread); font-weight: 600; }

/* One shared action zone pinned to the card's bottom edge (margin-top:auto), so every card in a
   row ends at the same line no matter how many tags or notes sit above it. */
.card-footer {
  margin-top: auto;
  padding-top: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.worn-btn {
  width: 100%;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.72rem;
  padding: 0.4rem 0.5rem;
  border-radius: 999px;
}
.worn-btn:hover { border-color: var(--ink-soft); color: var(--ink); }

/* The aspirational action — subtly tinted so it reads as the card's primary CTA without a loud
   solid fill repeating down a whole grid of cards. */
.anchor-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: color-mix(in srgb, var(--thread) 9%, var(--paper-raised));
  border: 1px solid color-mix(in srgb, var(--thread) 45%, var(--line));
  color: var(--thread);
  font-weight: 600;
  font-size: 0.72rem;
  padding: 0.45rem 0.5rem;
  border-radius: 999px;
}
.anchor-btn:hover {
  background: var(--thread);
  border-color: var(--thread);
  color: var(--thread-ink);
}
.anchor-icon { flex: 0 0 auto; }

.tag {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.3em 0.6em;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-soft);
}

.cost-line {
  margin-top: 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--thread);
  font-variant-numeric: tabular-nums;
}
.cost-line .cost-sub { font-weight: 400; color: var(--ink-soft); }
.cost-line-idle { color: var(--clay); font-weight: 400; }

/* "Na lavandaria": the card dims and gets a corner badge; suggestions skip it until it's back. */
.item-unavailable .item-photo img { filter: grayscale(0.7) opacity(0.55); }
.wash-badge {
  position: absolute;
  left: 0.5rem;
  bottom: 0.5rem;
  background: var(--ink);
  color: var(--paper-raised);
  font-size: 0.66rem;
  letter-spacing: 0.03em;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}
.item-photo { position: relative; }
.wash-toggle {
  width: 100%;
  margin-top: 0.4rem;
  background: transparent;
  border: none;
  color: var(--ink-soft);
  font-size: 0.72rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0.25rem;
}
.wash-toggle:hover { color: var(--ink); }

.tag-brand {
  background: color-mix(in srgb, var(--brass) 20%, var(--paper));
  color: var(--ink);
}

/* Ancorados ao cartão, não à foto — por isso a distância inclui a margem da
   foto (0.8rem), senão os botões ficavam a meio da moldura. */
.item-actions {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  display: flex;
  gap: 0.4rem;
}

.icon-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  color: white;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.edit-btn {
  background: var(--thread);
  font-size: 1rem;
}

.delete-btn {
  background: var(--clay);
  font-size: 1.2rem;
}

.favorite-btn {
  background: rgba(0, 0, 0, 0.45);
  font-size: 1.15rem;
}
.favorite-btn.is-favorite {
  background: var(--brass);
}

.tag-size {
  text-transform: uppercase;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.4rem;
  padding: 2.75rem 1.5rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--ink-soft);
}

.empty-icon {
  color: var(--brass);
  opacity: 0.85;
  margin-bottom: 0.3rem;
}

.empty-title {
  margin: 0;
  font-weight: 600;
  color: var(--ink);
  font-size: 0.95rem;
}

.empty-sub {
  margin: 0;
  font-size: 0.85rem;
  max-width: 280px;
}

@media (prefers-reduced-motion: no-preference) {
  .item-card { transition: transform 0.15s ease; }
}

/* --- Desktop layout ---
   Below this width the app is a single stacked column, tuned for the phone it's used on
   day-to-day. Above it, there's room to stop stretching that column and actually use the
   screen: boas-vindas and sugestão side by side, the toolbar as one row, and a wider,
   denser photo grid. */

@media (min-width: 900px) {
  .menu-toggle { display: none; }
  .sidebar-backdrop { display: none !important; }

  .sidebar {
    position: sticky;
    top: 73px;
    width: 210px;
    flex: 0 0 210px;
    align-self: flex-start;
    max-height: calc(100vh - 73px);
    overflow-y: auto;
    /* The base rule parks the sidebar off-canvas as a mobile drawer (translateX(-100%)). Here it is
       a real column, so the transform has to be undone — left in place it shifts the whole menu
       210px left of where it belongs, which on any window narrower than ~1500px (i.e. most laptops)
       pushes the labels off-screen and leaves only the column of counts showing. */
    transform: none;
  }

  /* Coluna única, mesmo em ecrã largo. O tempo em duas colunas ficava espremido
     — a condição partia em duas linhas e a tira das horas mostrava três de seis.
     Em largura inteira lê-se de uma vez, e a página passa a contar uma história
     por ordem: que tempo faz, o que se pede, que looks saem daí. */
  .top-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 1.75rem;
  }
  .top-row .welcome-hero,
  .top-row .suggest-section {
    margin-bottom: 0;
  }

  .toolbar-section {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  .toolbar-section .primary-btn,
  .toolbar-section .ghost-btn {
    width: auto;
    flex: 0 0 auto;
    padding-left: 1.75rem;
    padding-right: 1.75rem;
  }
  .search-wrap {
    flex: 1;
  }
  #bulk-status {
    flex: 1 1 100%;
  }

  .add-form {
    max-width: 480px;
  }

  .type-grid {
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  }
}

/* ---- Acessos (admin) ---- */

.admin-form {
  display: grid;
  gap: 14px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
}

@media (min-width: 700px) {
  .admin-form {
    grid-template-columns: 1fr 1fr auto;
    align-items: end;
  }
}

.admin-list {
  display: grid;
  gap: 10px;
}

.admin-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

/* Grows to claim the leftover width so the actions column is pushed to the right edge. Without
   this the block shrinks to its text and a short element — the admin badge — nestles up against
   the email instead of lining up with the buttons on every other row. */
.admin-row-main {
  flex: 1 1 220px;
  min-width: 0;
}

.admin-row-name {
  font-weight: 600;
  color: var(--ink);
}

.admin-row-email {
  font-size: 0.85rem;
  color: var(--ink-soft);
  /* Long addresses must not force the card to scroll sideways. */
  overflow-wrap: anywhere;
}

.admin-row-status { margin-top: 6px; }

.admin-row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-tag {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 45%, transparent);
  color: var(--ink-soft);
}

.admin-tag-in {
  background: color-mix(in srgb, var(--thread) 16%, transparent);
  color: var(--thread);
}

.admin-tag-warn {
  background: color-mix(in srgb, var(--clay) 16%, transparent);
  color: var(--clay);
}

.admin-tag-owner {
  background: color-mix(in srgb, var(--brass) 18%, transparent);
  color: var(--brass);
}

.admin-mini {
  font-size: 0.8rem;
  padding: 7px 12px;
}

.admin-danger { color: var(--clay); }

.admin-danger:hover:not(:disabled) {
  border-color: var(--clay);
  background: color-mix(in srgb, var(--clay) 10%, transparent);
}

.suggest-status.is-error { color: var(--clay); }

/* "Peça esquecida": a quiet nudge under the day's look, not a second suggestion competing with it —
   same card language as .bottleneck, with the piece's own photo so it is recognised at a glance. */
.forgotten {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brass);
  border-radius: var(--radius-sm);
  background: var(--paper-raised);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.forgotten-body {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.forgotten-photo {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.forgotten-text {
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--ink);
  margin: 0;
}
.forgotten-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.forgotten-actions .ghost-btn {
  font-size: 0.8rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
}

/* The discovery pick sits beside the safe recommendation on open. It needs to read as a different
   KIND of suggestion, not a lesser one — so it gets the same weight as the hero card with a dashed
   edge, the visual shorthand for "worth a try" rather than "this is the answer". */
.suggest-discovery {
  background: var(--paper-raised);
  border-style: dashed;
  border-color: var(--brass);
}
.suggest-discovery .suggest-option-heading {
  color: var(--brass);
}

/* --- Estrela automática ---
   Uma peça pode ficar favorita sem ninguém lhe tocar, por ser das que mais se
   vestem. Isso tem de se distinguir da estrela posta à mão, senão parece que a
   app decidiu sozinha e não se percebe que o toque a tira. O preenchimento fica
   para a manual; a automática é contorno sobre o mesmo brass. */
.favorite-btn.is-auto {
  background: rgba(0, 0, 0, 0.45);
  box-shadow: inset 0 0 0 1.5px var(--brass);
  color: var(--brass);
}

/* --- Preços em falta --- */

.prices-progress {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.prices-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

/* A linha inteira é um <label>: tocar na foto ou no nome põe o cursor no campo,
   que num telemóvel é a diferença entre acertar e falhar o alvo. */
.preco-linha {
  display: grid;
  grid-template-columns: 44px 1fr 7.5rem;
  align-items: center;
  gap: 0.75rem;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  cursor: text;
}

.preco-foto {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--paper);
}

.preco-foto img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preco-sem-foto {
  display: block;
  width: 100%;
  height: 100%;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
}

.preco-nome {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  font-size: 0.95rem;
}

.preco-detalhe {
  color: var(--ink-soft);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Os números alinham à direita para se lerem uns contra os outros ao descer a
   lista, e as setas do spinner saem: numa lista longa são alvos a mais. */
.preco-input {
  text-align: right;
  font-variant-numeric: tabular-nums;
  padding: 0.55rem 0.6rem;
}

.preco-input::-webkit-outer-spin-button,
.preco-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.preco-input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.prices-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  position: sticky;
  bottom: 0;
  /* Com 60 linhas o botão ficava a um scroll inteiro de distância do campo que se
     acabou de escrever. Colado em baixo, guardar está sempre à mão. */
  background: linear-gradient(to top, var(--paper) 70%, transparent);
  padding: 0.75rem 0 0.5rem;
}

/* O aviso que ocupa o lugar do custo por uso quando não há preços nenhuns. */
.precos-aviso {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.85rem;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
}

.precos-aviso-texto {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.5;
}

.precos-aviso-leve {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.insights-inline-btn {
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
}

@media (max-width: 460px) {
  .preco-linha {
    grid-template-columns: 40px 1fr 5.5rem;
    gap: 0.55rem;
  }
  .preco-foto { width: 40px; height: 40px; }
}
