/* =====================================================================
   Sistema de Contagem — estilos
   Menu lateral inspirado no layout de referência (branco, destaque vermelho)
   ===================================================================== */
:root {
    --red: #d91e2a;
    --red-dark: #b3141f;
    --red-soft: #fdeff0;
    --ink: #262a31;
    --ink-2: #4a505b;
    --muted: #8a909b;
    --line: #e7e8ec;
    --bg: #f5f6f8;
    --white: #fff;
    --ok: #1f8a4c;
    --ok-soft: #e6f5ec;
    --warn: #a86400;
    --warn-soft: #fff4de;
    --sidebar-w: 270px;
    --radius: 10px;
    --font: "Montserrat", "Segoe UI", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; color: var(--ink); background: var(--bg); line-height: 1.45; }
a { color: var(--red); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
small { font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.block { display: block; }
.pad { padding: 16px 20px; }
.mt { margin-top: 18px; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---------------------------------------------------------------- layout */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.content { padding: 24px 28px 110px; max-width: 1400px; width: 100%; }

/* ---------------------------------------------------------------- sidebar */
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
    background: var(--white); border-right: 1px solid var(--line);
    overflow-y: auto; z-index: 40; padding-bottom: 24px;
    transition: transform .25s ease;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 26px 22px 30px; text-decoration: none; color: var(--ink); }
.brand-mark {
    width: 38px; height: 38px; border-radius: 9px; background: var(--red); color: #fff;
    display: grid; place-items: center; font-size: 17px; transform: skewX(-8deg);
}
.brand-mark i { transform: skewX(8deg); }
.brand-text { font-weight: 800; font-style: italic; font-size: 21px; letter-spacing: -.5px; color: var(--red); line-height: 1; }
.brand-text small { display: block; font-style: normal; font-weight: 600; font-size: 10.5px; color: var(--muted); letter-spacing: .3px; margin-top: 4px; }

.menu-section {
    padding: 14px 22px 10px; font-size: 12.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.1px; color: var(--ink);
}
.menu-list, .submenu { list-style: none; margin: 0 0 8px; padding: 0; }
.menu-link {
    display: flex; align-items: center; gap: 14px; width: 100%;
    padding: 11px 22px; border: 0; background: none; cursor: pointer;
    font: 500 15px var(--font); color: var(--ink); text-decoration: none; text-align: left;
    border-right: 3px solid transparent; transition: background .15s;
}
.menu-link:hover { background: #fafafa; }
.menu-link.active { background: var(--red-soft); border-right-color: var(--red); font-weight: 600; }
.menu-link.has-active { font-weight: 600; }
.menu-icon { width: 18px; text-align: center; color: var(--ink-2); font-size: 14px; }
.menu-link.active .menu-icon, .menu-link.has-active .menu-icon { color: var(--red); }
.menu-chevron { margin-left: auto; font-size: 12px; color: var(--ink); transition: transform .2s; }
.menu-group.open > .menu-toggle .menu-chevron { transform: rotate(90deg); }
.submenu { display: none; margin: 0; padding: 2px 0 6px; }
.menu-group.open > .submenu { display: block; }
.submenu-link {
    display: block; padding: 8px 22px 8px 54px; font-size: 14px; color: var(--ink-2);
    text-decoration: none; border-right: 3px solid transparent; position: relative;
}
.submenu-link::before { content: ""; position: absolute; left: 30px; top: 50%; width: 5px; height: 5px; border-radius: 50%; background: #c9ccd3; transform: translateY(-50%); }
.submenu-link:hover { color: var(--ink); background: #fafafa; }
.submenu-link.active { color: var(--red); font-weight: 600; background: var(--red-soft); border-right-color: var(--red); }
.submenu-link.active::before { background: var(--red); }
.sidebar-backdrop { display: none; }

/* ---------------------------------------------------------------- topbar */
.topbar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
    height: 64px; padding: 0 28px; background: var(--white); border-bottom: 1px solid var(--line);
}
.page-title { font-size: 18px; font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-btn { display: none; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta strong { font-size: 13.5px; }
.user-meta small { color: var(--muted); }
.avatar {
    width: 36px; height: 36px; border-radius: 50%; background: var(--red-soft); color: var(--red);
    display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; vertical-align: middle; margin-right: 6px; }

/* ---------------------------------------------------------------- botões */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: 8px; border: 1px solid var(--red);
    background: var(--red); color: #fff; font: 600 14px var(--font); cursor: pointer;
    text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn-ghost { background: var(--white); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: #f4f4f6; border-color: #d6d8de; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.icon-btn {
    display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px;
    border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: #f1f2f5; color: var(--ink); }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red); }
.icon-btn.sm { width: 28px; height: 28px; font-size: 12px; }
form.inline { display: inline; margin: 0; }

/* ---------------------------------------------------------------- cards */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 20px; }
.card-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 15px; font-weight: 700; margin-right: auto; }
.card-head p { margin: 0; margin-right: auto; }
.form-card { padding: 20px; }
.form-card > .card-head { margin: -20px -20px 18px; }
.form-card > .card-head.mt { margin: 22px -20px 14px; border-top: 1px solid var(--line); }
.narrow { max-width: 760px; }
.push-right { margin-left: auto; }
.table-foot { padding: 10px 20px; margin: 0; border-top: 1px solid var(--line); }

/* ---------------------------------------------------------------- formulários */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
input[type=text], input[type=password], input[type=email], input[type=search], input[type=date], input:not([type]),
select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid #d9dbe1; border-radius: 8px;
    font: 400 14px var(--font); color: var(--ink); background: var(--white);
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(217, 30, 42, .12); }
textarea { resize: vertical; }
.search { max-width: 260px; }
.filters select, .filters .search { width: auto; min-width: 160px; }
.field-inline { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field-inline input { width: auto; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.sticky-actions {
    position: sticky; bottom: 0; z-index: 20; grid-column: 1 / -1;
    background: rgba(245, 246, 248, .94); backdrop-filter: blur(4px);
    padding: 14px 0; margin: 0; border-top: 1px solid var(--line);
}
.form-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 0 20px; align-items: start; }
.grid-side { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; }
.inline-form { display: flex; gap: 10px; padding: 16px 20px; flex-wrap: wrap; }
.inline-form select { max-width: 360px; }

/* switch (checkbox) */
.check-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 13.5px; user-select: none; }
.check-switch input { position: absolute; opacity: 0; pointer-events: none; }
.check-switch .track { width: 40px; height: 22px; border-radius: 22px; background: #cfd2d8; position: relative; transition: background .2s; flex-shrink: 0; }
.check-switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.check-switch input:checked + .track { background: var(--ok); }
.check-switch input:checked + .track::after { transform: translateX(18px); }
.check-switch input:focus-visible + .track { outline: 2px solid var(--red); outline-offset: 2px; }
.check-switch.big { align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: 8px; width: 100%; margin-bottom: 16px; }
.check-switch.big .track { margin-top: 2px; }

/* switch de status (botão ativo/inativo nas listagens) */
.switch { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; cursor: pointer; padding: 0; font: 600 12.5px var(--font); color: var(--muted); }
.switch::before { content: ""; }
.switch .switch-knob { width: 34px; height: 19px; border-radius: 19px; background: #cfd2d8; position: relative; transition: background .2s; }
.switch .switch-knob::after { content: ""; position: absolute; top: 2.5px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch.on { color: var(--ok); }
.switch.on .switch-knob { background: var(--ok); }
.switch.on .switch-knob::after { transform: translateX(14px); }

/* ---------------------------------------------------------------- tabelas */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--line); background: #fbfbfc; white-space: nowrap; }
.table td { padding: 11px 16px; border-bottom: 1px solid #f0f1f4; vertical-align: middle; }
.table tbody tr:hover td { background: #fcfcfd; }
.table tfoot th { font-size: 13.5px; color: var(--ink); background: #fbfbfc; border-top: 1px solid var(--line); }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; width: 1%; }
.row-muted td { color: var(--muted); }
tr:target td { background: var(--warn-soft) !important; }

/* ---------------------------------------------------------------- badges */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-off { background: #eff0f3; color: #6b717c; }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-red { background: var(--red-soft); color: var(--red); }

/* ---------------------------------------------------------------- alertas */
.alert { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; }
.alert-ok { background: var(--ok-soft); color: #14663a; }
.alert-erro { background: var(--red-soft); color: var(--red-dark); }
.alert-aviso { background: var(--warn-soft); color: var(--warn); }
.alert span { flex: 1; }
.alert-close { border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }

/* ---------------------------------------------------------------- home */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.hero h2 { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.hero p { margin: 4px 0 0; }
.hero-status { display: flex; align-items: center; gap: 14px; background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--red); border-radius: var(--radius); padding: 14px 18px; }
.hero-num { font-size: 34px; font-weight: 800; color: var(--red); line-height: 1; }
.hero-num.ok { color: var(--ok); font-size: 26px; }
.shortcuts { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.shortcut { display: flex; align-items: center; gap: 14px; padding: 18px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.shortcut:hover { border-color: var(--red); }
.shortcut > i { width: 42px; height: 42px; border-radius: 10px; background: var(--red-soft); color: var(--red); display: grid; place-items: center; font-size: 17px; flex-shrink: 0; }
.shortcut small { display: block; color: var(--muted); }

/* ---------------------------------------------------------------- dashboard */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat strong { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.stat strong small { font-size: 15px; color: var(--muted); font-weight: 600; }
.stat-foot { font-size: 11.5px; color: var(--muted); }
.stat-accent { background: var(--red); border-color: var(--red); color: #fff; }
.stat-accent .stat-label, .stat-accent .stat-foot { color: rgba(255,255,255,.8); }
.chart-box { height: 260px; padding: 16px 20px; }

/* ---------------------------------------------------------------- picker (múltipla escolha) */
.picker .search { max-width: none; margin-bottom: 10px; }
.picker-list { display: grid; grid-template-columns: 1fr; gap: 6px; max-height: 260px; overflow-y: auto; padding-right: 4px; }
.picker-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.picker-item small { display: block; color: var(--muted); }
.picker-item input { accent-color: var(--red); width: 16px; height: 16px; flex-shrink: 0; }
.picker-item:has(input:checked) { border-color: var(--red); background: var(--red-soft); }

/* ---------------------------------------------------------------- perfis */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 10px; }
.perm-grid > p { grid-column: 1 / -1; margin: 0; }
.perm-grid.disabled { opacity: .45; pointer-events: none; }
.perm-group { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px 12px; margin: 0; }
.perm-group legend { padding: 0 6px; font-weight: 700; font-size: 13px; }
.perm-group legend label, .perm-item { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.perm-item { padding: 5px 0; font-size: 13.5px; }
.perm-group input { accent-color: var(--red); width: 15px; height: 15px; }

/* ---------------------------------------------------------------- listas */
.days { display: flex; gap: 3px; }
.day { font-size: 10.5px; font-weight: 700; padding: 3px 5px; border-radius: 4px; background: #f0f1f4; color: #b0b4bc; }
.day.on { background: var(--red); color: #fff; }
.day-picker { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.day-check input { position: absolute; opacity: 0; pointer-events: none; }
.day-check span { display: inline-block; min-width: 50px; text-align: center; padding: 9px 10px; border: 1px solid #d9dbe1; border-radius: 8px; font-weight: 700; font-size: 13px; cursor: pointer; user-select: none; }
.day-check input:checked + span { background: var(--red); border-color: var(--red); color: #fff; }
.day-check input:focus-visible + span { outline: 2px solid var(--red); outline-offset: 2px; }

.lista-form { grid-template-columns: 1fr; }
.dual-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dual-col { display: flex; flex-direction: column; min-width: 0; position: relative; }
.dual-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.dual-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.dual-tools .search, .dual-tools select { flex: 1; min-width: 130px; max-width: none; }
.dual-list { list-style: none; margin: 0; padding: 6px; border: 1px dashed #d4d7dd; border-radius: 8px; height: 440px; overflow-y: auto; background: #fbfbfc; counter-reset: ordem; }
.dual-list.selected { border-color: var(--red); background: #fffafa; }
.dual-list.drag-over { background: var(--red-soft); }
.dual-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin-bottom: 5px; background: var(--white); border: 1px solid var(--line); border-radius: 7px; cursor: grab; }
.dual-item.dragging { opacity: .4; }
.dual-item .grip { color: #c4c7ce; }
.dual-name { flex: 1; min-width: 0; font-weight: 600; font-size: 13.5px; }
.dual-name small { display: block; font-weight: 400; color: var(--muted); }
.dual-list.selected .dual-item::before { counter-increment: ordem; content: counter(ordem); min-width: 22px; height: 22px; border-radius: 50%; background: var(--red-soft); color: var(--red); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.dual-order { display: none; }
.dual-list.selected .dual-order { display: inline-flex; }
.dual-move .ico-del { display: none; }
.dual-list.selected .dual-move .ico-add { display: none; }
.dual-list.selected .dual-move .ico-del { display: inline; }
.dual-list.selected .dual-move:hover { color: var(--red); background: var(--red-soft); }
.dual-empty { position: absolute; left: 0; right: 0; top: 55%; text-align: center; pointer-events: none; }

/* ---------------------------------------------------------------- contagens do dia */
.page-intro { margin-bottom: 18px; }
.page-intro h2 { font-size: 22px; font-weight: 800; }
.page-intro p { margin: 4px 0 0; }
.count-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; margin-bottom: 20px; }
.count-card { background: var(--white); border: 1px solid var(--line); border-top: 4px solid #c9ccd3; border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.count-card.status-em_andamento { border-top-color: #e3a008; }
.count-card.status-finalizada { border-top-color: var(--ok); }
.count-card.status-pendente { border-top-color: var(--red); }
.count-card header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.count-card h3 { font-size: 16px; }
.count-card dl { margin: 0; display: grid; gap: 6px; }
.count-card dl div { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.count-card dt { color: var(--muted); }
.count-card dd { margin: 0; font-weight: 600; text-align: right; }
.count-card footer { margin-top: auto; }
.progress { height: 7px; background: #eceef1; border-radius: 7px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--ok); border-radius: 7px; transition: width .2s; }
.empty-state { text-align: center; padding: 48px 20px; }
.empty-state > i { font-size: 34px; color: var(--red); margin-bottom: 12px; }
.empty-state h2 { font-size: 19px; margin-bottom: 6px; }
.empty-state p { color: var(--muted); margin: 0 0 16px; }

/* ---------------------------------------------------------------- tela de contagem */
.count-top { display: flex; align-items: center; gap: 20px; padding: 14px 20px; position: sticky; top: 64px; z-index: 15; flex-wrap: wrap; }
.count-top .count-progress { flex: 1; min-width: 180px; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.count-items { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.count-item { display: grid; grid-template-columns: minmax(200px, 1.1fr) 2fr 110px; gap: 16px; align-items: center; background: var(--white); border: 1px solid var(--line); border-left: 4px solid #d4d7dd; border-radius: var(--radius); padding: 14px 18px; }
.count-item.done { border-left-color: var(--ok); }
.count-info { display: flex; gap: 12px; align-items: flex-start; }
.count-seq { min-width: 26px; height: 26px; border-radius: 50%; background: #f0f1f4; color: var(--ink-2); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.count-item.done .count-seq { background: var(--ok-soft); color: var(--ok); }
.count-inputs { display: flex; gap: 10px; flex-wrap: wrap; }
.count-field { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 110px; max-width: 170px; }
.count-field span { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.count-field small { color: var(--muted); font-weight: 500; }
.count-field input { font-size: 17px; font-weight: 700; text-align: center; padding: 9px 8px; }
.count-total { text-align: right; display: flex; flex-direction: column; }
.count-total strong { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.count-total small { color: var(--muted); }

/* ---------------------------------------------------------------- ver contagem */
.summary { display: grid; grid-template-columns: 1fr auto; gap: 16px 24px; padding: 20px; }
.summary-main h2 { font-size: 20px; font-weight: 800; }
.summary-main p { margin: 4px 0 8px; }
.summary-data { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 0; padding-top: 16px; border-top: 1px solid var(--line); }
.summary-data dt { font-size: 12px; color: var(--muted); font-weight: 600; }
.summary-data dd { margin: 2px 0 0; font-weight: 700; font-size: 15px; }
.summary-actions { grid-column: 2; grid-row: 1; display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }
.summary-obs { grid-column: 1 / -1; margin: 0; padding: 10px 14px; background: var(--warn-soft); border-radius: 8px; color: #6b4a00; }

.modal { border: 0; border-radius: 12px; padding: 24px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(20, 22, 28, .25); }
.modal::backdrop { background: rgba(20, 22, 28, .45); }
.modal h3 { font-size: 17px; margin-bottom: 4px; }

/* ---------------------------------------------------------------- login */
.login-page { background: var(--white); }
.login-wrap { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.login-side { background: var(--red); color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.brand-light { padding: 0; }
.brand-light .brand-mark { background: #fff; color: var(--red); }
.brand-light .brand-text { color: #fff; }
.brand-light .brand-text small { color: rgba(255,255,255,.75); }
.login-pitch h2 { font-size: 40px; font-weight: 800; letter-spacing: -1.2px; line-height: 1.08; max-width: 12ch; }
.login-pitch p { font-size: 16px; max-width: 42ch; color: rgba(255,255,255,.88); }
.login-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; font-weight: 600; }
.login-steps i { width: 30px; height: 30px; border-radius: 8px; background: rgba(255,255,255,.16); display: inline-grid; place-items: center; margin-right: 10px; }
.login-form-side { display: grid; place-items: center; padding: 32px; }
.login-card { width: 100%; max-width: 360px; }
.login-card h1 { font-size: 28px; font-weight: 800; }
.login-card > p { margin: 6px 0 24px; }

/* ---------------------------------------------------------------- responsivo */
@media (max-width: 1100px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .grid-2, .form-grid { grid-template-columns: 1fr; }
    .summary-data { grid-template-columns: repeat(3, 1fr); }
    .count-item { grid-template-columns: 1fr; gap: 12px; }
    .count-total { flex-direction: row; align-items: baseline; gap: 6px; justify-content: flex-end; }
}
@media (max-width: 900px) {
    .main { margin-left: 0; }
    .sidebar { transform: translateX(-100%); box-shadow: none; }
    body.sidebar-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.2); }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(20,22,28,.4); z-index: 35; }
    .menu-btn { display: inline-grid; }
    .content { padding: 18px 16px 110px; }
    .topbar { padding: 0 12px; }
    .user-meta { display: none; }
    .grid-side { grid-template-columns: 1fr; }
    .dual-cols { grid-template-columns: 1fr; }
    .dual-list { height: 320px; }
    .login-wrap { grid-template-columns: 1fr; }
    .login-side { padding: 28px; gap: 20px; }
    .login-pitch h2 { font-size: 28px; }
    .login-steps { display: none; }
}
@media (max-width: 600px) {
    .row-2 { grid-template-columns: 1fr; }
    .stats { grid-template-columns: 1fr 1fr; }
    .stat strong { font-size: 20px; }
    .summary { grid-template-columns: 1fr; }
    .summary-actions { grid-column: 1; grid-row: auto; justify-content: flex-start; }
    .summary-data { grid-template-columns: 1fr 1fr; }
    .count-field { max-width: none; }
    .search, .filters select, .filters .search { max-width: none; width: 100%; }
    .field-inline { width: 100%; }
    .field-inline input { flex: 1; }
    .push-right { margin-left: 0; width: 100%; }
    .sticky-actions .btn { flex: 1; }
    .count-top { position: static; }
}
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* ---------------------------------------------------------------- WhatsApp */
:root { --wa: #1da851; --wa-dark: #168a42; --wa-soft: #e7f7ee; }
.btn-wa { background: var(--wa); border-color: var(--wa); text-align: left; }
.btn-wa:hover { background: var(--wa-dark); border-color: var(--wa-dark); }
.btn-wa i { font-size: 18px; }
.btn-wa small { display: block; font-weight: 500; font-size: 11.5px; opacity: .85; }
.icon-btn.wa { color: var(--wa); }
.icon-btn.wa:hover { background: var(--wa-soft); color: var(--wa-dark); }
.wa-card .card-head h3 i { color: var(--wa); margin-right: 4px; }
.wa-card.destaque { border-color: var(--wa); box-shadow: 0 0 0 3px var(--wa-soft); }
.wa-body { padding: 14px 20px 18px; }
.wa-body > p { margin: 0 0 12px; }
.wa-list { display: flex; flex-wrap: wrap; gap: 10px; }
.wa-log { margin-top: 14px; font-size: 13px; }
.wa-log summary { cursor: pointer; color: var(--ink-2); font-weight: 600; }
.wa-log ul { margin: 8px 0 0; padding-left: 18px; color: var(--ink-2); }
.wa-log li { margin-bottom: 4px; }
.radio-row { display: flex; gap: 18px; flex-wrap: wrap; }
.radio { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.radio input { accent-color: var(--red); width: 16px; height: 16px; }
[data-wa-listas].oculto { display: none; }
@media (max-width: 600px) { .wa-list .btn { width: 100%; justify-content: flex-start; } }

/* ---------------------------------------------------------------- fase 1: contagens atrasadas / adiantar */
.count-card.status-atrasada { border-top-color: var(--red); background: linear-gradient(0deg, var(--white) 70%, var(--red-soft)); }
.atrasadas-card { border-color: #f3c3c6; margin-bottom: 22px; }
.atrasadas-card .card-head h3 i { color: var(--red); margin-right: 4px; }
.atrasadas-card .count-cards { padding: 4px 20px 20px; }
.adiantar-card { margin-top: 22px; }
.adiantar-card > summary { cursor: pointer; list-style: none; flex-wrap: wrap; }
.adiantar-card > summary::-webkit-details-marker { display: none; }
.adiantar-card > summary h3::after { content: " ▸"; color: var(--muted); }
.adiantar-card[open] > summary h3::after { content: " ▾"; }
.adiantar-card > summary h3 i { color: var(--red); margin-right: 4px; }
.count-top .badge { margin-top: 6px; }
.summary-main .badge + .badge { margin-left: 6px; }

/* ---------------------------------------------------------------- produtos: estoque ideal */
.ideal-box { background: var(--bg); border: 1px dashed var(--line); border-radius: var(--radius); padding: 12px 14px; }
.ideal-conv { margin: 2px 0 8px; font-weight: 700; color: var(--ink-2); min-height: 1em; }
.ideal-rec p { margin: 6px 0 0; }
.ideal-rec .btn { margin-left: 6px; }
.txt-red { color: var(--red); font-weight: 700; }

/* ---------------------------------------------------------------- compras */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 10px 0 4px; }
.table th.chk, .table td.chk { width: 38px; text-align: center; }
.table input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--red); }
.aviso-orc { margin-bottom: 18px; }
.aviso-orc p, .aviso-orc details { margin: 4px 0; }
.aviso-orc summary { cursor: pointer; }
.price-stock { margin-top: 4px; color: var(--ink-2); }
.price-stock strong { color: var(--red); }
.price-item .count-field { max-width: 190px; }
.price-readonly { display: block; font-size: 16px; padding: 9px 0; text-align: center; }
.price-item .count-total strong { font-size: 18px; }
body.portal .brand-mark { background: var(--ink); }

/* ---------------------------------------------------------------- fase 1b: orçamento (marca, em falta, observação) */
.price-fields { display: flex; flex-direction: column; gap: 8px; }
.price-obs { margin-top: 4px; color: var(--warn); background: var(--warn-soft); border-radius: 6px; padding: 4px 8px; }
.field-marca { max-width: 200px; }
.field-marca input { font-size: 14px; font-weight: 600; text-align: left; }
.falta-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; width: fit-content; }
.falta-check input { width: 17px; height: 17px; accent-color: var(--red); }
.price-item.em-falta { border-left-color: var(--red); background: #fffafa; }
.price-item.em-falta .count-field input[data-fator] { opacity: .45; }
.price-item.em-falta [data-best] { color: var(--red); font-size: 16px; }

/* ---------------------------------------------------------------- fase 2: pedidos */
.status-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.status-tabs a { text-decoration: none; color: var(--ink-2); background: var(--white); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 13px; }
.status-tabs a b { background: var(--bg); border-radius: 999px; padding: 1px 8px; margin-left: 4px; }
.status-tabs a.on { background: var(--red); border-color: var(--red); color: #fff; }
.status-tabs a.on b { background: rgba(255,255,255,.25); }
.alt-ofertas { margin-top: 3px; color: var(--muted); }
.alt-ofertas span { display: inline-block; background: var(--bg); border-radius: 4px; padding: 1px 6px; margin: 2px 4px 0 0; }
.qtd-edit { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.qtd-edit input { width: 80px; text-align: right; font-weight: 700; padding: 6px 8px; }
.narrow-field { max-width: 260px; }
[data-pedido-item].row-muted td { text-decoration: line-through; }
[data-pedido-item].row-muted td.chk { text-decoration: none; }
.form-card .field > .day-picker { margin-top: 4px; }

/* ---------------------------------------------------------------- fase 2b: preço por unidade + embalagem de entrega */
.field-emb { max-width: 230px; min-width: 170px; }
.field-emb select { font-weight: 600; padding: 9px 8px; }
.arred { color: var(--warn); }

/* ---------------------------------------------------------------- fase 2c: correções de compras */
.modal-wide { width: min(620px, calc(100vw - 32px)); }
.tr-destinos { display: grid; gap: 8px; margin: 12px 0; }
.tr-destinos small { display: block; }
.cat-sit { display: block; margin-top: 3px; }
.cat-sit .badge { font-size: 11px; }
.price-var { margin-top: 4px; color: var(--ink-2); background: var(--bg); border-radius: 6px; padding: 4px 8px; }
.orcada-tag { display: inline-block; margin-top: 3px; }
.perto-list { max-height: 50vh; overflow: auto; margin: 10px 0; display: grid; gap: 6px; }
.perto-list small { display: block; }
.row-on td { background: var(--ok-soft); }
.av-qtd { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.av-qtd input { width: 90px; text-align: right; font-weight: 700; padding: 6px 8px; }
.av-qtd select { padding: 6px 8px; }
.hist-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 800px) { .hist-grid { grid-template-columns: 1fr 1fr; } }
.row-muted-soft td { color: var(--muted); }

/* fase 2c: quantidade do pedido alinhada, embalagem embaixo */
.qtd-edit { display: block; }
.qtd-emb { color: var(--ink-2); font-weight: 600; white-space: nowrap; margin-top: 3px; }

/* ---------------------------------------------------------------- fase 3: recebimento e ocorrências */
.input-chave { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 16px; letter-spacing: .5px; }
.txt-ok { color: var(--ok); }
.row-pendente td { background: #fffaf0; }
.row-div td { background: var(--red-soft); }
.row-ok td { background: var(--ok-soft); }
.sel-prod { max-width: 260px; }
.fator-edit { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.fator-edit input { width: 80px; text-align: right; font-weight: 700; padding: 6px 8px; }
.fis-qtd { display: inline-flex; align-items: center; gap: 4px; }
.fis-qtd input { width: 80px; text-align: right; font-weight: 700; padding: 6px 8px; }
.fis-div { min-width: 190px; }
.fis-div select, .fis-div input { width: 100%; padding: 6px 8px; margin-bottom: 4px; font-size: 13px; }
.pad-x { padding: 0 20px 16px; }
.cert-data { grid-template-columns: repeat(2, 1fr); border-top: 0; padding-top: 0; }
.wa-card.destaque { border-color: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
