/* ─────────────────────────────────────────────────────────
   Cozinha da Pê — Design System
   Tipografia: Fraunces (headings/brand) + DM Sans (body)
   Paleta: terracota quente sobre fundo creme
───────────────────────────────────────────────────────── */

/* ── Fontes locais ── */
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/static/fonts/dmsans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/static/fonts/dmsans-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;
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/static/fonts/fraunces-normal-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/static/fonts/fraunces-normal-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;
}
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/fraunces-italic-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/fraunces-italic-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;
}

/* ── Tokens ── */
:root {
  --bg:             #f8f4ef;
  --surface:        #ffffff;
  --surface-alt:    #f3ede6;
  --surface-hover:  #fdf9f5;

  --accent:         #c4622d;
  --accent-dark:    #9d4a1e;
  --accent-light:   #f5e4d8;
  --accent-faint:   #fdf1eb;

  --text:           #261a10;
  --text-2:         #7a6a5a;
  --text-3:         #b0a090;

  --border:         #e5dbd0;
  --border-strong:  #cfc0b0;

  --green:          #3a7a50;
  --green-bg:       #eef7f2;
  --amber:          #b5731e;
  --amber-bg:       #fef6e7;
  --red:            #b83232;
  --red-bg:         #fdecea;
  --blue:           #2563a8;
  --blue-bg:        #e8f1fc;

  --shadow-sm:      0 1px 3px rgba(38,26,16,.07);
  --shadow:         0 2px 8px rgba(38,26,16,.09), 0 1px 2px rgba(38,26,16,.05);
  --shadow-md:      0 4px 16px rgba(38,26,16,.11), 0 2px 4px rgba(38,26,16,.06);

  --radius-sm:      6px;
  --radius:         10px;
  --radius-lg:      14px;

  --font-brand:     'Fraunces', Georgia, serif;
  --font-body:      'DM Sans', system-ui, sans-serif;
  --font-mono:      'SF Mono', 'Menlo', 'Consolas', monospace;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base ── */
html { font-size: 15px; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navigation ── */
nav {
  background: var(--accent);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  box-shadow: 0 2px 8px rgba(38,26,16,.18);
  position: sticky;
  top: 0;
  z-index: 100;
}

nav .logo {
  font-family: var(--font-brand);
  font-optical-sizing: auto;
  font-weight: 600;
  font-size: 1.15rem;
  color: #fff;
  text-decoration: none;
  padding: 0.9rem 0;
  margin-right: 1.25rem;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

nav a {
  color: rgba(255,255,255,.82);
  text-decoration: none;
  padding: 0.9rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 450;
  letter-spacing: 0.01em;
  transition: color .15s, background .15s;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
nav a:hover { color: #fff; text-decoration: none; }
nav a.active { color: #fff; background: rgba(255,255,255,.15); }

.nav-logout {
  color: rgba(255,255,255,.65);
  background: none;
  border: none;
  padding: 0.9rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 450;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color .15s;
  margin-left: auto;
}
.nav-logout:hover { color: #fff; }

.nav-toggle-cb { display: none; }
/* Desktop */
.nav-hamburger {
    display: none;
}

/* ── Layout ── */
.container {
  max-width: 1040px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

/* ── Typography ── */
h1 {
  font-family: var(--font-brand);
  font-optical-sizing: auto;
  font-weight: 500;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}

h2 {
  font-family: var(--font-brand);
  font-optical-sizing: auto;
  font-weight: 500;
  font-size: 1.2rem;
  letter-spacing: -0.015em;
  color: var(--text);
}

h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.muted { color: var(--text-2); font-size: 0.875rem; }

.section-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin: 2rem 0 0.75rem;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow-sm);
}

.card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.card-link:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow), 0 0 0 3px var(--accent-light);
  transform: translateY(-1px);
  text-decoration: none;
}

.card-label {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
  color: var(--text);
}

.table-card { padding: 0; overflow: hidden; }

/* ── Page header ── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ── Grid layouts ── */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1.1rem;
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .1s;
  white-space: nowrap;
  line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.98); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  box-shadow: 0 2px 8px rgba(196,98,45,.35);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--surface-alt);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border-color: #f0c0c0;
}
.btn-danger:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.btn-lg { padding: 0.65rem 1.4rem; font-size: 0.95rem; }

/* ── Forms ── */
form { margin: 0; }

label {
  display: block;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 0.3rem;
  margin-top: 1rem;
  letter-spacing: 0.01em;
}
label:first-child { margin-top: 0; }

input[type=text],
input[type=number],
input[type=email],
input[type=search],
select,
textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
  -webkit-appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a6a5a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  padding-right: 2rem;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }

small.muted  { display: block; margin-top: 0.3rem; font-size: 0.78rem; line-height: 1.4; }

.label-optional {
  font-weight: 400;
  font-size: 0.76rem;
  color: var(--text-3);
  margin-left: 0.3rem;
}

.calc-preview {
  margin-top: 0.75rem;
  padding: 0.55rem 0.85rem;
  background: var(--accent-faint);
  border: 1px solid var(--accent-light);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--accent-dark);
}

/* ── Flash messages ── */
.flash {
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.875rem;
  font-weight: 450;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.flash::before { font-size: 1rem; }
.flash-success { background: var(--green-bg); color: var(--green); border: 1px solid #c0e2cc; }
.flash-success::before { content: '✓'; }
.flash-error   { background: var(--red-bg);   color: var(--red);   border: 1px solid #f0c0c0; }
.flash-error::before { content: '!'; font-weight: 700; }
.flash-info    { background: var(--blue-bg);  color: var(--blue);  border: 1px solid #c0d8f0; }
.flash-info::before { content: 'i'; font-weight: 700; font-style: italic; }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }

th {
  text-align: left;
  padding: 0.7rem 1rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-hover); }

tfoot td {
  border-top: 2px solid var(--border);
  border-bottom: none;
  background: var(--bg);
  font-size: 0.875rem;
  padding: 0.7rem 1rem;
}

.mono  { font-family: var(--font-mono); font-size: 0.83rem; }
.actions { white-space: nowrap; text-align: right; }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-pessoal  { background: var(--blue-bg);  color: var(--blue);  border: 1px solid #c0d8f0; }
.badge-producao { background: var(--green-bg); color: var(--green); border: 1px solid #c0e2cc; }
.badge-irma     { background: #fce4ec;         color: #c2185b;      border: 1px solid #f5b8cc; }

/* ── Home page cards ── */
.canal-flags {
  list-style: none;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 2;
}

/* ── Receita meta ── */
.receita-meta {
  display: flex;
  gap: 1.25rem;
  font-size: 0.875rem;
  color: var(--text-2);
  margin-bottom: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ── Table tfoot ── */
tfoot td strong { color: var(--accent-dark); }

/* ── Precificação ── */
.receita-selector {
  font-size: 0.9rem;
  min-width: 200px;
  max-width: 320px;
}

.canal-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 1.25rem;
}

.canal-titulo {
  font-family: var(--font-brand);
  font-optical-sizing: auto;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--accent-dark);
  margin-bottom: 0.9rem;
}

.custo-linhas {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.65rem;
  margin-bottom: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.custo-linha {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 0.1rem 0;
}
.custo-linha-on  { color: var(--text); }
.custo-linha-off { color: var(--border-strong); text-decoration: line-through; }

.canal-totais {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}

.total-linha {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--text-2);
}
.total-venda {
  padding-top: 0.3rem;
  margin-top: 0.1rem;
  border-top: 1px dashed var(--border);
}
.total-venda strong { font-size: 1.1rem; color: var(--accent-dark); }

.food-cost {
  margin-top: 0.5rem;
  font-size: 0.78rem;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.food-cost-ok   { background: var(--green-bg); color: var(--green);  border: 1px solid #c0e2cc; }
.food-cost-warn { background: var(--amber-bg); color: var(--amber); border: 1px solid #f0d8a0; }
.food-cost-ref  { opacity: 0.6; }

.canal-sep {
  border: none;
  border-top: 1px dashed var(--border);
  margin: 0.9rem 0 0.75rem;
}

.toggle-group { display: flex; flex-direction: column; }

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  padding: 0.22rem 0;
  cursor: pointer;
  color: var(--text);
  user-select: none;
}
.toggle-label input[type=checkbox] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}

/* ── Parâmetros globais ── */
.params-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.5rem 1rem;
}
.params-grid label { margin: 0; font-size: 0.85rem; }
.params-grid input { width: 110px; }

.margem-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.6rem;
}
.margem-row label { margin: 0; font-size: 0.83rem; color: var(--text-2); white-space: nowrap; }
.margem-row input { width: 72px; }


/* ── Cronograma — layout de cartões por dia ── */
.crono-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
}

/* 7 colunas fixas; o scroll cuida do mobile */
.crono-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 0.6rem;
  min-width: 720px;
}

/* Cabeçalho do dia */
.crono-day-col { display: flex; flex-direction: column; gap: 0.5rem; }

.crono-day-header {
  font-family: var(--font-brand);
  font-optical-sizing: auto;
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-2);
  text-align: center;
  padding: 0.35rem 0;
  border-bottom: 2px solid var(--border);
}

/* Slot individual */
.crono-slot {
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.65rem;
  display: flex;
  flex-direction: column;
  min-height: 80px;
  transition: border-color .15s, box-shadow .15s;
}

.crono-slot-empty {
  background: var(--surface);
  border: 1.5px dashed var(--border);
}

.crono-slot-filled {
  background: var(--accent-faint);
  border: 1.5px solid var(--accent-light);
  box-shadow: var(--shadow-sm);
}

/* Label almoço/jantar dentro do slot */
.crono-ref-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-bottom: 0.3rem;
}

.crono-slot-filled .crono-ref-label { color: var(--accent); opacity: 0.75; }

/* Nome da receita */
.crono-recipe-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-dark);
  line-height: 1.3;
  flex: 1;
}

/* Porções */
.crono-qty {
  font-size: 0.72rem;
  color: var(--text-2);
  margin-top: 0.2rem;
}

/* Placeholder vazio */
.crono-empty-hint {
  font-size: 1rem;
  color: var(--border-strong);
  text-align: center;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Botão remover */
.crono-remove {
  align-self: stretch;
  margin-top: 0.45rem;
  background: none;
  border: 1px solid var(--border);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-3);
  padding: 0.28rem 0;
  border-radius: var(--radius-sm);
  line-height: 1;
  text-align: center;
  letter-spacing: 0.02em;
  transition: color .15s, background .15s, border-color .15s;
}
.crono-remove:hover {
  color: var(--red);
  background: var(--red-bg);
  border-color: #f0c0c0;
}

/* ── Canal selector ── */
.crono-canal-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.crono-canal-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
}

.crono-canal-pills {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.crono-canal-pill {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 2rem;
  padding: 0.3rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}

.crono-canal-pill:hover {
  border-color: var(--accent-light);
  color: var(--accent-dark);
}

.crono-canal-pill-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Preço no slot ── */
.crono-preco {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-dark);
  margin-top: 0.15rem;
}

/* ── Slot interativo ── */
.crono-slot-empty  { cursor: pointer; }
.crono-slot-empty:hover { border-color: var(--accent-light); background: var(--accent-faint); }

.crono-slot-dragover {
  border-color: var(--accent) !important;
  background: var(--accent-faint) !important;
  box-shadow: 0 0 0 2px var(--accent-light);
}

/* ── Prateleira de receitas ── */
.crono-shelf-title {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.crono-shelf-hint {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-3);
  font-family: var(--font-body);
  text-transform: none;
  letter-spacing: 0;
}

.recipe-shelf {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.25rem 0 1rem;
}

.recipe-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-1);
  cursor: grab;
  user-select: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}

.recipe-card:active { cursor: grabbing; }

.recipe-card:hover {
  border-color: var(--accent-light);
  background: var(--accent-faint);
}

.recipe-card.dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.recipe-card.recipe-selected {
  border-color: var(--accent);
  background: var(--accent-faint);
  box-shadow: 0 0 0 2px var(--accent-light);
  color: var(--accent-dark);
}

/* ── Lista de compras (preparado para Etapa 6) ── */
.lista-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.25rem;
  background: var(--accent-faint);
  border: 1px solid var(--accent-light);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
}
.lista-total-label { font-size: 0.875rem; color: var(--text-2); }
.lista-total-valor { font-family: var(--font-brand); font-size: 1.4rem; color: var(--accent-dark); font-weight: 600; }

/* ── Home — hero + stats ── */
.home-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.home-title {
  font-family: var(--font-brand);
  font-optical-sizing: auto;
  font-weight: 500;
  font-size: 2rem;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.15;
  margin-bottom: 0.3rem;
}

.home-stats {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  align-items: center;
}

.stat-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.9rem;
  min-width: 68px;
  box-shadow: var(--shadow-sm);
}

.stat-val {
  font-family: var(--font-brand);
  font-optical-sizing: auto;
  font-weight: 600;
  font-size: 1.45rem;
  color: var(--accent);
  line-height: 1.1;
}

.stat-label {
  font-size: 0.68rem;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-align: center;
  margin-top: 0.1rem;
}

/* "editar →" inline link within .section-title */
.section-link {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  text-transform: none;
  letter-spacing: 0;
  margin-left: 0.5rem;
  opacity: 0.75;
  transition: opacity .15s;
}
.section-link:hover { opacity: 1; text-decoration: none; }

/* Snapshot variant of the week grid — more compact columns */
.crono-week-snapshot {
  grid-template-columns: repeat(7, minmax(96px, 1fr));
}

/* Smaller slots for the home snapshot */
.crono-slot-sm {
  min-height: 58px;
  padding: 0.4rem 0.5rem;
}
.crono-slot-sm .crono-ref-label  { font-size: 0.58rem; margin-bottom: 0.18rem; }
.crono-slot-sm .crono-recipe-name { font-size: 0.73rem; }
.crono-slot-sm .crono-qty         { font-size: 0.62rem; }

/* ── Home — module cards ── */
.home-modules {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 0.7rem;
  margin-top: 0.25rem;
}

.module-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.module-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow), 0 0 0 3px var(--accent-light);
  transform: translateY(-2px);
  text-decoration: none;
}

.module-icon {
  font-size: 1.45rem;
  line-height: 1;
  margin-bottom: 0.55rem;
}

.module-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.module-desc {
  font-size: 0.76rem;
  color: var(--text-2);
  line-height: 1.4;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  html { font-size: 14px; }

  /* Nav hamburger */
  nav { gap: 0; padding: 0 1rem; flex-wrap: wrap; }
  nav .logo { order: 1; }
  .nav-hamburger {
    display: flex;
    align-items: center;
    order: 2;
    margin-left: auto;
    color: rgba(255,255,255,.9);
    font-size: 1.35rem;
    padding: 0.8rem 0.5rem;
    cursor: pointer;
    user-select: none;
    line-height: 1;
  }
  nav a:not(.logo) {
    display: none;
    order: 3;
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0;
    border-top: 1px solid rgba(255,255,255,.12);
    font-size: 0.875rem;
  }
  .nav-toggle-cb:checked ~ a:not(.logo) { display: block; }

  .nav-logout {
    display: none;
    order: 3;
    width: 100%;
    text-align: left;
    margin-left: 0;
    padding: 0.75rem 1rem;
    border-radius: 0;
    border-top: 1px solid rgba(255,255,255,.12);
    font-size: 0.875rem;
  }
  .nav-toggle-cb:checked ~ form .nav-logout { display: block; }

  .container { padding: 0 1rem; margin: 1.25rem auto; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  h1 { font-size: 1.35rem; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .canal-card { min-width: 0; }
  .params-grid { grid-template-columns: 1fr; }
  .params-grid input { width: 100%; }
  .home-modules { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .home-hero { flex-direction: column; gap: 0.75rem; }
  .home-title { font-size: 1.65rem; }

  /* Tabelas — scroll horizontal */
  .table-card { overflow-x: auto; }

  /* Botões — alvos de toque maiores */
  .btn-sm { padding: 0.5rem 0.9rem; min-height: 36px; }

  /* Margem row — empilha vertical */
  .margem-row { flex-wrap: wrap; }
  .margem-row input { width: 100%; }
}

/* ── Abas (tabs) ── */
.tabs-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
}
.tab-btn {
  padding: 0.55rem 1.2rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.tab-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.tab-pane { display: none; }
.tab-pane.tab-active { display: block; }

.badge-sug {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-size: 0.72rem;
  font-weight: 500;
  margin-top: 0.15rem;
}

.import-ou {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.import-ou::before,
.import-ou::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.hidden { display: none !important; }
