/* Salgados da Lê - componentes. Sem sombras pesadas nem animações: leve para computadores fracos. */

/* Cartões e títulos de página */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head h1 { margin-bottom: .25rem; }
.lead { color: var(--muted); margin: 0; }
.lead-sm { margin-bottom: .75rem; }
.eyebrow { color: var(--accent); font-weight: 650; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; margin: 0 0 .25rem; }
.back { display: inline-block; margin-bottom: .35rem; font-size: .9rem; text-decoration: none; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.empty { text-align: center; padding: 2rem 1.25rem; }
.empty p { color: var(--muted); }

/* Botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 42px; padding: .5rem 1rem;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--text);
  font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.2;
}
.btn:hover { background: var(--bg); color: var(--text); }
.btn:focus-visible { box-shadow: var(--focus); outline: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: #8f1e18; color: #fff; }
.btn-sm { min-height: 34px; padding: .25rem .65rem; font-size: .9rem; }
.btn-lg { min-height: 48px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; margin: .75rem 0; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0;
  background: transparent; border: 0; border-radius: var(--radius); color: var(--muted); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--bg); color: var(--accent); }
.icon-btn.danger:hover { color: var(--bad); background: var(--bad-soft); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font-size: inherit; }

/* Formulários */
.field { margin-bottom: 1rem; }
.field label, .field legend { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .95rem; padding: 0; }
fieldset.field { border: 0; padding: 0; margin: 0 0 1rem; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], input:not([type]), input[inputmode], select, textarea {
  width: 100%; min-height: 42px; padding: .5rem .7rem; background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
input[aria-invalid=true], select[aria-invalid=true] { border-color: var(--bad); }
.hint { color: var(--muted); font-size: .85rem; margin-top: .25rem; }
.error { color: var(--bad); font-size: .875rem; margin-top: .25rem; min-height: 0; }
.error:empty { display: none; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.field-row.three { grid-template-columns: repeat(3, 1fr); }
.field-row-tight { gap: 0 .5rem; }
.form-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; flex-wrap: wrap; }
.inline-form { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin: 1rem 0 .5rem; }
.inline-form select { width: auto; min-width: 12rem; }
.inline select { width: auto; display: inline-block; margin-left: .35rem; }
.choice-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.choice { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .85rem; border: 1px solid var(--line-strong); border-radius: var(--radius); cursor: pointer; font-weight: 500; min-height: 42px; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.check { display: inline-flex; align-items: center; gap: .35rem; font-size: .9rem; white-space: nowrap; }
.chips { display: inline-flex; gap: .35rem; flex-wrap: wrap; }
.chip { padding: .15rem .65rem; border: 1px solid var(--line-strong); background: #fff; border-radius: 999px; cursor: pointer; font-size: .85rem; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.input-suffix { display: flex; align-items: center; gap: .35rem; }
.input-suffix span { color: var(--muted); font-size: .9rem; min-width: 2rem; }
.preview { background: var(--accent-soft); border-radius: var(--radius); padding: .5rem .8rem; margin-bottom: 1rem; color: var(--accent-dark); }
.preview:empty { display: none; }
.preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem 1rem; }
.preview-grid span { display: block; font-size: .8rem; color: var(--muted); }
.preview-grid .full { grid-column: 1 / -1; margin: 0; }

/* Tabelas */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; margin-bottom: 1rem; }
.card .table-wrap { border: 0; margin-bottom: .5rem; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .7rem .85rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #FAFBFC; font-weight: 650; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #FAFBFC; }
.row-actions { white-space: nowrap; text-align: right; }
.table.compare th[scope=row] { text-transform: none; font-size: 1rem; color: var(--text); background: transparent; letter-spacing: 0; font-weight: 500; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; flex-wrap: wrap; }
.search { position: relative; flex: 1; max-width: 360px; }
.search .icon { position: absolute; left: .7rem; top: 11px; color: var(--muted); }
.search input { padding-left: 2.3rem; }

/* Selos, avisos e alertas */
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.notice { display: flex; gap: .6rem; align-items: flex-start; padding: .7rem .9rem; border-radius: var(--radius); margin-bottom: 1rem; background: var(--accent-soft); color: var(--accent-dark); }
.notice p { margin: 0; }
.notice-warn { background: var(--warn-soft); color: #6f4700; }
.notice-bad { background: var(--bad-soft); color: var(--bad); }
.notice-info { background: var(--accent-soft); color: var(--accent-dark); }
.alert-list { list-style: none; margin: .5rem 0 0; padding: 0; }
.alert { display: flex; align-items: center; gap: .6rem; padding: .55rem 0; border-top: 1px solid var(--line); }
.alert:first-child { border-top: 0; }
.alert a { color: var(--text); text-decoration: none; }
.alert a:hover { text-decoration: underline; }
.alert-warn .icon { color: var(--warn); } .alert-danger .icon { color: var(--bad); } .alert-info .icon { color: var(--accent); }
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: .85rem; font-weight: 600; padding: 0 .4rem; border-radius: 999px; }
.delta .icon { width: 14px; height: 14px; }
.delta-up { color: var(--bad); background: var(--bad-soft); } .delta-down { color: var(--ok); background: var(--ok-soft); }
.delta-note { color: var(--muted); min-height: 1.1em; }

/* Início */
.action-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .85rem; margin-bottom: 1rem; }
.action {
  display: flex; flex-direction: column; gap: .25rem; padding: 1.1rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); text-decoration: none; color: var(--text);
}
.action .icon { width: 28px; height: 28px; color: var(--accent); margin-bottom: .35rem; }
.action span { color: var(--muted); font-size: .875rem; }
.action:hover { border-color: var(--accent); color: var(--text); }
.action-main { background: var(--accent); border-color: var(--accent); color: #fff; }
.action-main .icon, .action-main span { color: #fff; }
.action-main:hover { background: var(--accent-dark); color: #fff; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .85rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.1rem; text-decoration: none; color: var(--text); }
.stat:hover { border-color: var(--accent); color: var(--text); }
.stat-n { display: block; font-size: 1.8rem; font-weight: 700; color: var(--accent); line-height: 1.1; }
.stat-l { color: var(--muted); font-size: .9rem; }
.sync-line { color: var(--muted); font-size: .9rem; display: flex; align-items: center; gap: .4rem; }
.steps { margin: .5rem 0 0; padding-left: 1.25rem; } .steps li { margin-bottom: .35rem; }

/* Indicador de sincronização */
.sync-chip {
  display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .75rem; border-radius: 999px; font-size: .85rem; font-weight: 600;
  border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; min-height: 34px;
}
.sync-chip .icon { width: 16px; height: 16px; }
.chip-ok { color: var(--ok); } .chip-busy { color: var(--accent); } .chip-warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.chip-bad { color: var(--bad); background: var(--bad-soft); border-color: transparent; } .chip-idle { color: var(--muted); }
.spinning .icon { animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinning .icon { animation: none; } }

/* Editor de receita */
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
.editor-side { position: sticky; top: 72px; }
.side-actions { display: flex; flex-direction: column; gap: .6rem; }
.lines { display: flex; flex-direction: column; gap: .5rem; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) 110px 90px 90px 36px; gap: .5rem; align-items: center; padding-bottom: .5rem; border-bottom: 1px dashed var(--line); }
.line:last-child { border-bottom: 0; }
.line-extra { grid-template-columns: 170px 110px 110px 90px auto 36px; }
.line-extra .line-wide { grid-column: span 2; }
.line-cost { text-align: right; font-weight: 600; white-space: nowrap; }
.line .error { grid-column: 1 / -1; margin: 0; }
.summary h2 { margin-bottom: .75rem; }
.summary-list, .result-list { margin: 0 0 .75rem; }
.summary-list div, .result-list div { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem 0; border-bottom: 1px solid var(--line); }
.summary-list dt, .result-list dt { color: var(--muted); } .summary-list dd, .result-list dd { margin: 0; font-weight: 600; text-align: right; }
.sum-total { font-size: 1.05rem; } .sum-total dt { color: var(--text); }
.big-result { background: var(--accent-soft); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: .75rem; }
.big-result span { display: block; color: var(--accent-dark); font-size: .9rem; }
.big-result strong { font-size: 1.9rem; color: var(--accent); line-height: 1.2; }
.result-list .hl { background: var(--accent-soft); margin: 0 -.5rem; padding: .5rem; border-radius: var(--radius); border: 0; }
.result-list .hl dd { color: var(--accent); font-size: 1.3rem; }
.result-list .good dd { color: var(--ok); font-size: 1.2rem; } .result-list .bad dd { color: var(--bad); font-size: 1.2rem; }
.mini-table { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: .5rem; margin: .75rem 0; }
.mini-table > div { background: var(--bg); border-radius: var(--radius); padding: .5rem .7rem; }
.mini-table span { display: block; font-size: .8rem; color: var(--muted); } .mini-table strong { font-size: 1.05rem; }
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.calc-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

/* Histórico, abas, listas */
.history { list-style: none; margin: .5rem 0 0; padding: 0; }
.history li { display: flex; align-items: center; gap: .75rem; padding: .45rem 0; border-top: 1px solid var(--line); }
.h-date { color: var(--muted); min-width: 6.5rem; font-variant-numeric: tabular-nums; }
.chart { width: 100%; height: auto; background: var(--bg); border-radius: var(--radius); margin-bottom: .5rem; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tab { padding: .6rem .9rem; background: none; border: 0; border-bottom: 3px solid transparent; cursor: pointer; font-weight: 600; color: var(--muted); white-space: nowrap; margin-bottom: -1px; }
.tab:hover { color: var(--text); } .tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.list-rows { list-style: none; margin: 0 0 1rem; padding: 0; }
.list-rows li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.list-rows .btn-row { margin: 0; }
.log { white-space: pre-wrap; font-size: .8rem; background: var(--bg); padding: .75rem; border-radius: var(--radius); max-height: 14rem; overflow: auto; }
details > summary { cursor: pointer; font-weight: 600; }

/* Janelas */
.modal-open { overflow: hidden; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(20, 26, 38, .5); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 1rem; overflow-y: auto; z-index: 80; }
.modal { background: var(--surface); border-radius: 10px; width: 100%; max-width: 520px; border: 1px solid var(--line); }
.modal-wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; }
.modal-body { padding: 1.25rem; }
.confirm-text { margin-bottom: .5rem; }

/* Avisos rápidos e carregamento */
.toast-root { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 120; max-width: min(420px, calc(100vw - 2rem)); }
.toast { background: var(--text); color: #fff; padding: .7rem 1rem; border-radius: var(--radius); border-left: 4px solid var(--accent); }
.toast-success { border-left-color: #4CAF72; } .toast-error { background: #7A1912; border-left-color: #FF8A80; }
.loading-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; background: var(--accent); z-index: 130; }
