/* ============================================================
   Redantec ERP — Design System
   Minimalista, moderno, tons neutros + verde esmeralda
   ============================================================ */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e6e8ef;
  --border-strong: #d8dbe3;
  --text: #0f172a;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --accent: #0f9d6f;
  --accent-strong: #0b7f58;
  --accent-soft: #e6f6ef;
  --danger: #e11d48;
  --danger-soft: #fdeef2;
  --warning: #d97706;
  --warning-soft: #fdf3e3;
  --info: #2563eb;
  --info-soft: #eaf1fe;
  --violet: #7c3aed;
  --violet-soft: #f1eafe;
  --sidebar: #0e1524;
  --sidebar-hover: #182035;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .05);
  --shadow-lg: 0 20px 50px -12px rgba(15, 23, 42, .25);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "Consolas", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

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

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

::selection { background: var(--accent-soft); }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--sidebar);
  color: #cbd5e1;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 10px 22px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  margin-bottom: 14px;
}
.brand-icon {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #34d399);
  display: grid; place-items: center;
  color: #fff; flex-shrink: 0;
  box-shadow: 0 6px 18px -6px rgba(15,157,111,.7);
}
.brand-name { font-weight: 700; color: #fff; font-size: 15px; letter-spacing: .2px; line-height: 1.2; }
.brand-sub { font-size: 11px; color: #64748b; }

.nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em;
  color: #526079; margin: 18px 12px 6px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: #a8b3c9; font-weight: 500; font-size: 13.5px;
  cursor: pointer; border: none; background: none; width: 100%; text-align: left;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--sidebar-hover); color: #e2e8f0; text-decoration: none; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(15,157,111,.28), rgba(15,157,111,.10));
  color: #fff;
}
.nav-item.active svg { color: #34d399; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; color: #64748b; transition: color .15s; }

.sidebar-foot {
  margin-top: auto; padding: 14px 12px 4px;
  border-top: 1px solid rgba(255,255,255,.07);
  font-size: 11px; color: #526079; line-height: 1.5;
}

/* ---------- Main ---------- */
.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(244,245,247,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 18px 32px;
}
.topbar .grow { flex: 1; }
.page-title { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.page-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.page-sub strong { color: var(--text); }

/* seletor de empresa ativa no topo */
.empresa-switch select {
  width: auto; min-width: 230px; max-width: 300px;
  font-weight: 600; border-radius: 999px;
  padding: 8px 36px 8px 14px;
  border-color: var(--border-strong);
  background-color: var(--surface);
}
@media (max-width: 860px) { .empresa-switch { display: none !important; } }

.container { padding: 26px 32px 60px; max-width: 1280px; }
.container.narrow { max-width: 1080px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; transition: all .15s;
  font-family: inherit; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 14px -4px rgba(15,157,111,.55); }
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: #c3c8d4; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.alert-box { display: flex; align-items: flex-start; gap: 8px; padding: 12px 14px; border-radius: 12px; font-size: 13px; line-height: 1.5; }
.alert-box svg { flex-shrink: 0; margin-top: 1px; }
.alert-box.warn { background: #fff7e6; color: #7a3d00; border: 1px solid #f3d9a9; }
.btn-danger:hover:not(:disabled) { background: #fbdbe4; }
.btn-mini { padding: 5px 10px; font-size: 12px; border-radius: 8px; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 9px;
  display: inline-grid; place-items: center; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  transition: all .15s;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }
.icon-btn.danger:hover { color: var(--danger); border-color: #f6c6d2; background: var(--danger-soft); }
.icon-btn.emerald:hover { color: var(--accent); border-color: #bce7d6; background: var(--accent-soft); }

.btn-group { display: flex; gap: 8px; align-items: center; }

/* ---------- Cards & KPIs ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px 24px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 14.5px; font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.card-head .sub { font-size: 12px; color: var(--muted); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi-click { cursor: pointer; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; }
.kpi-icon svg { width: 19px; height: 19px; }
.kpi-value { font-size: 23px; font-weight: 800; letter-spacing: -.03em; }
.kpi-value small { font-size: 13px; font-weight: 600; color: var(--muted); }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi-sub .up { color: var(--accent); font-weight: 700; }
.kpi-sub .down { color: var(--danger); font-weight: 700; }
.kpi-sub .warn { color: var(--warning); font-weight: 700; }

.tint-emerald { background: var(--accent-soft); color: var(--accent); }
.tint-rose { background: var(--danger-soft); color: var(--danger); }
.tint-amber { background: var(--warning-soft); color: var(--warning); }
.tint-blue { background: var(--info-soft); color: var(--info); }
.tint-violet { background: var(--violet-soft); color: var(--violet); }

.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
.grid-2-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--surface-2); white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table th.num { text-align: right; }
.table .mono { font-family: var(--mono); font-size: 12.5px; }
.cell-strong { font-weight: 700; }
.cell-soft { color: var(--muted); font-size: 12.5px; }

.empty {
  text-align: center; padding: 56px 20px; color: var(--muted);
}
.empty svg { width: 38px; height: 38px; color: var(--muted-2); margin-bottom: 12px; }
.empty h4 { font-weight: 700; color: var(--text); margin-bottom: 4px; font-size: 15px; }
.empty p { font-size: 13px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  letter-spacing: .02em; white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-emerald { background: var(--accent-soft); color: var(--accent); }
.badge-rose { background: var(--danger-soft); color: var(--danger); }
.badge-amber { background: var(--warning-soft); color: var(--warning); }
.badge-blue { background: var(--info-soft); color: var(--info); }
.badge-violet { background: var(--violet-soft); color: var(--violet); }
.badge-zinc { background: #eef0f4; color: #475569; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; font-weight: 700; color: #334155; }
.field .hint { font-size: 11.5px; color: var(--muted); font-weight: 400; }
.hint { font-size: 11.5px; color: var(--muted); font-weight: 400; }
.field-label-row { display: flex; align-items: center; justify-content: space-between; }
.field-label-row .mini-btn { font-size: 11.5px; color: var(--accent); cursor: pointer; font-weight: 700; border: none; background: none; }
.field-label-row .mini-btn:hover { text-decoration: underline; }

/* campo com busca de sugestões (typeahead) */
.field-ta { position: relative; }
.ta-list {
  position: absolute; left: 0; right: 0; top: calc(100% - 8px); z-index: 30;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  max-height: 232px; overflow-y: auto; overflow-x: hidden;
}
.ta-item {
  display: flex; flex-direction: column; gap: 1px; width: 100%;
  padding: 9px 12px; border: none; border-bottom: 1px solid var(--border);
  background: none; text-align: left; font: inherit; cursor: pointer;
}
.ta-item:last-child { border-bottom: none; }
.ta-item:hover, .ta-item:focus { background: var(--accent-soft); outline: none; }
.ta-nome { font-size: 13px; font-weight: 600; color: var(--text); }
.ta-sub { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ta-empty { padding: 12px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }

input, select, textarea {
  font-family: inherit; font-size: 13.5px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 9px 12px; outline: none;
  transition: border-color .15s, box-shadow .15s; width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15,157,111,.14);
}
select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px;
}
textarea { resize: vertical; min-height: 74px; }
.input-row { display: flex; gap: 10px; align-items: center; }
.input-row > * { min-width: 0; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }

/* search */
.searchbox { position: relative; }
.searchbox svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted-2); pointer-events: none; }
.searchbox input { padding-left: 36px; width: 250px; border-radius: 999px; background: var(--surface); }

.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .searchbox { margin-right: auto; }

/* ---------- Modal ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 15, 28, .45); backdrop-filter: blur(4px);
  display: none; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto;
}
.overlay.open { display: flex; }
.modal {
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg);
  width: 100%; animation: pop .18s ease;
  max-height: calc(100vh - 80px); display: flex; flex-direction: column;
}
.modal.sm { max-width: 460px; }
.modal.md { max-width: 640px; }
.modal.lg { max-width: 880px; }
.modal.xl { max-width: 1080px; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

/* hidden deve sempre funcionar, mesmo em elementos com display próprio (.field etc.) */
[hidden] { display: none !important; }

/* ---------- Seções do lançamento de compra ---------- */
.csec { margin-bottom: 20px; }
.csec:last-child { margin-bottom: 0; }
.csec-tt {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: .09em; color: #94a3b8; margin-bottom: 10px;
}
.csec-tt svg { color: var(--accent); }
.csec-tt::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.it-count {
  background: #eef0f4; color: #475569; border-radius: 999px;
  padding: 1px 9px; font-size: 11px; font-weight: 700; margin-left: 4px;
}

.csec .editor-wrap { max-height: 320px; min-height: 96px; }
.csec .editor-row { padding: 6px 10px; }
.csec .editor-row.head { padding: 6px 10px; }
.csec .editor-row input { padding: 6px 8px; font-size: 12.5px; }
.csec .sum-row {
  border-top: 1px dashed var(--border-strong); padding-top: 10px; margin-top: 14px !important;
}
.csec .sum-row .val { color: var(--accent); font-size: 20px; }

.form-grid.fg3 { grid-template-columns: repeat(3, 1fr); }

.pay-toggle { display: flex; gap: 8px; }
.pay-opt {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border: 1px solid var(--border-strong); border-radius: 999px;
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted);
  background: var(--surface); transition: all .15s;
}
.pay-opt input { width: auto; margin: 0; }
.pay-opt:has(input:checked) {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent);
}
.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; }
.modal-head .close { margin-left: auto; }
.modal-body { padding: 20px 24px; flex: 1; min-height: 0; overflow: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 24px; border-top: 1px solid var(--border); background: var(--surface-2);
  border-radius: 0 0 18px 18px;
}

/* ---------- Toasts ---------- */
.toasts { position: fixed; top: 18px; right: 18px; z-index: 300; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast {
  background: #0e1524; color: #e2e8f0; border-radius: 12px; padding: 13px 16px;
  box-shadow: var(--shadow-lg); font-size: 13px; display: flex; gap: 10px; align-items: flex-start;
  animation: slidein .2s ease;
}
.toast.success { border-left: 3px solid #34d399; }
.toast.error { border-left: 3px solid #f43f5e; }
.toast.info { border-left: 3px solid #60a5fa; }
.toast svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.toast.success svg { color: #34d399; }
.toast.error svg { color: #f43f5e; }
.toast.info svg { color: #60a5fa; }
.toast.out { opacity: 0; transform: translateX(20px); transition: all .25s; }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ---------- Chip filter ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  padding: 7px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted);
  transition: all .15s; display: inline-flex; align-items: center; gap: 7px;
}
.chip .num { background: #eef0f4; border-radius: 999px; padding: 0 7px; font-size: 11px; color: #475569; font-weight: 700; }
.chip:hover { border-color: #c3c8d4; color: var(--text); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.active .num { background: rgba(255,255,255,.25); color: #fff; }
.chip.active.rose { background: var(--danger); border-color: var(--danger); }
.chip.active.amber { background: var(--warning); border-color: var(--warning); }

/* ---------- Item editor (compras/saídas) ---------- */
.editor-wrap { border: 1px solid var(--border); border-radius: 12px; max-height: 420px; overflow: auto; }
.editor-wrap .editor-row.head { position: sticky; top: 0; z-index: 2; }
.editor-row { display: grid; grid-template-columns: 1fr 100px 130px 130px 34px; gap: 10px; padding: 10px 12px; align-items: center; border-bottom: 1px solid var(--border); background: var(--surface); }
.editor-row.head { grid-template-columns: 1fr 100px 130px 130px 34px; background: var(--surface-2); }
.editor-row.head span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 0; }
.editor-row:last-child { border-bottom: none; }
.editor-row .tot { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

.add-line { margin-top: 10px; width: 100%; border-style: dashed; }

/* ---- seletor de material com busca (item editor) ---- */
.picker { position: relative; margin-bottom: 10px; }
.picker-input input { border-radius: 12px; background: var(--surface-2); padding: 12px 14px 12px 40px; font-size: 13.5px; border-color: var(--border-strong); }
.picker-input:focus-within input { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15,157,111,.14); background: var(--surface); }
.picker-results {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); max-height: 260px; overflow-y: auto; padding: 6px;
}
.picker-item {
  display: flex; flex-direction: column; gap: 1px; width: 100%;
  padding: 9px 12px; border-radius: 9px; border: none; background: none; cursor: pointer;
  text-align: left; font-family: inherit;
}
.picker-item:hover, .picker-item.active { background: var(--accent-soft); }
.picker-item .mat-name { font-weight: 600; font-size: 13.5px; color: var(--text); }
.picker-item .mat-meta { font-size: 11.5px; color: var(--muted); }
.picker-empty { padding: 14px; text-align: center; font-size: 12.5px; color: var(--muted); }

/* associador de material (importação NF-e) */
.assoc.searchbox { margin: 0; width: 100%; min-width: 0; }
.assoc.searchbox input { width: 100%; padding-left: 34px; border-radius: 9px; background: var(--surface); font-size: 12.5px; }
.picker-results.assoc-results { top: calc(100% + 2px); min-width: 260px; }
.assoc-status { font-size: 11.5px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.assoc-status b { color: var(--accent); font-weight: 700; }

.mat-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mat-info { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.mat-info .mat-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mat-info .mat-meta { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mat-switch { width: 28px; height: 28px; flex-shrink: 0; }

/* ---- parcelas ---- */
.parcela-editor .editor-row { grid-template-columns: 96px 1fr 1fr 26px; gap: 8px; padding: 5px 10px; }
.parcela-editor .editor-row.head { grid-template-columns: 96px 1fr 1fr 26px; padding: 6px 10px; }
.parcela-editor .editor-row.head span { font-size: 9.5px; white-space: nowrap; overflow: hidden; }
.parcela-editor input { padding: 5px 8px; font-size: 12px; border-radius: 8px; min-width: 0; width: 100%; }
.parcela-num { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.parcela-actions { display: flex; gap: 8px; margin-top: 8px; }
.parcela-actions .add-line { margin-top: 0; flex: 1; padding: 6px; font-size: 12px; }

/* ---- lista minimalista (compras / contas) ---- */
.list-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 16px; align-items: center; padding: 16px 22px;
  border-bottom: 1px solid var(--border); transition: background .1s;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: #f8fafc; }
.list-left { min-width: 0; }
.list-title {
  font-weight: 700; font-size: 14.5px; letter-spacing: -.01em;
  display: flex; align-items: center; gap: 8px; overflow: hidden;
}
.list-title .mono { font-family: var(--mono); font-size: 13px; font-weight: 600; }
.list-title .sep { color: var(--muted-2); font-weight: 400; }
.list-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-sub strong { color: #475569; }
.list-sub .link, .link { color: var(--accent); font-weight: 600; text-decoration: none; cursor: pointer; }
.list-sub .link:hover, .link:hover { text-decoration: underline; }
.conta-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.conta-meta .meta-item {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  background: #f1f5f9; border: 1px solid #e2e8f0; color: #334155;
  font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; line-height: 1.6;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.conta-meta .meta-item svg { color: #64748b; flex-shrink: 0; }
.conta-meta .meta-item a { color: inherit; text-decoration: none; }
.conta-meta .meta-item a:hover { text-decoration: underline; }
.conta-meta .meta-item.violet { background: var(--violet-soft); border-color: #ddd6fe; color: var(--violet); }
.conta-meta .meta-item.violet svg { color: var(--violet); }
.conta-meta .meta-item.blue { background: var(--info-soft); border-color: #bfdbfe; color: var(--info); }
.conta-meta .meta-item.blue svg { color: var(--info); }
.conta-meta .meta-item.rose { background: #fff1f2; border-color: #fecdd3; color: #be123c; }
.conta-meta .meta-item.rose svg { color: #be123c; }
.conta-meta .meta-item.emerald { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.conta-meta .meta-item.emerald svg { color: #047857; }
.conta-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 16px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.conta-sub svg { color: #94a3b8; vertical-align: -2px; }
.conta-sub .obs { font-style: italic; }
.list-val { font-weight: 800; font-size: 15.5px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; text-align: right; white-space: nowrap; }
.list-val.muted { color: var(--muted-2); }
.list-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; white-space: nowrap; }
.list-badge { white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot.aberta { background: var(--info); }
.dot.paga { background: var(--accent); }
.dot.atrasada { background: var(--danger); }
.dot.cancelada { background: #cbd2de; }

@media (max-width: 760px) {
  .list-row { grid-template-columns: 1fr auto; row-gap: 8px; }
  .list-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .cpt-row { grid-template-columns: auto minmax(0, 1fr); row-gap: 10px; }
  .cpt-right { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
  .cpr-row { grid-template-columns: auto minmax(0, 1fr); row-gap: 10px; }
  .cpr-right { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
}

/* ---- módulos (cadastros) ---- */
.module-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.module-card {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 20px; cursor: pointer; display: flex; flex-direction: column; gap: 10px;
  transition: all .15s; box-shadow: var(--shadow-sm);
}
.module-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #b9e2d2; }
.module-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15,157,111,.12), var(--shadow); }
.module-card-top { display: flex; align-items: center; justify-content: space-between; }
.module-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; }
.module-ico svg { width: 20px; height: 20px; }
.module-count { font-size: 24px; font-weight: 800; letter-spacing: -.03em; }
.module-card h3 { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; }
.module-card p { font-size: 12px; color: var(--muted); line-height: 1.45; }
.module-arrow { margin-left: auto; color: var(--muted-2); transition: all .15s; }
.module-card.active .module-arrow, .module-card:hover .module-arrow { color: var(--accent); transform: translateX(3px); }
.section-head { display: flex; align-items: center; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.grow2 { flex: 1; }
.section-head .grow2 { flex: 1; }
.section-head h3 { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; }
.section-head .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: 12px;
  padding: 26px; text-align: center; color: var(--muted); cursor: pointer;
  transition: all .15s; background: var(--surface-2);
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dropzone svg { width: 30px; height: 30px; margin-bottom: 8px; }
.dropzone strong { display: block; color: var(--text); font-size: 14px; margin-bottom: 2px; }
.dropzone .file-name { display: block; color: var(--accent); font-weight: 600; font-size: 12.5px; margin-top: 4px; }

/* ---------- Progress ---------- */
.progress { height: 7px; background: #eef0f4; border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.progress > i.warn { background: var(--warning); }
.progress > i.danger { background: var(--danger); }

/* ---------- Obras cards ---------- */
.obra-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.obra-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm); cursor: pointer;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  display: flex; flex-direction: column; gap: 14px;
}
.obra-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #cfe9df; }
.obra-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.obra-card h3 { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; }
.obra-card .meta { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.obra-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.obra-kpi { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.obra-kpi .v { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.obra-kpi .l { font-size: 11px; color: var(--muted); font-weight: 600; }

/* -------- Visão da obra (modal repaginado) -------- */
.modal.obra-view { max-width: 1160px; max-height: calc(100vh - 56px); border-radius: 20px; overflow: hidden; }
.obra-hero {
  background: linear-gradient(135deg, #065f46 0%, #059669 52%, #10b981 100%);
  padding: 22px 28px 0; color: #fff; position: relative; overflow: hidden;
}
.obra-hero::after {
  content: ""; position: absolute; top: -140px; right: -90px;
  width: 360px; height: 360px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.22), transparent 62%);
  pointer-events: none;
}
.obra-hero > * { position: relative; z-index: 1; }
.obra-hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.obra-hero-id { font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; color: rgba(255,255,255,.8); }
.obra-hero .icon-btn.close { background: rgba(255,255,255,.14); color: #fff; }
.obra-hero .icon-btn.close:hover { background: rgba(255,255,255,.28); }
.obra-hero-title { font-size: 25px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin-top: 10px; }
.obra-hero-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; font-size: 12.5px; color: rgba(255,255,255,.86); }
.obra-hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.obra-hero-meta svg { width: 13px; height: 13px; opacity: .85; }
.obra-hero .badge { background: rgba(255,255,255,.15) !important; color: #fff !important; border: 1px solid rgba(255,255,255,.24) !important; }
.obra-hero-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 20px; padding-bottom: 24px; }
.ohk {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.16);
  border-radius: 14px; padding: 14px 16px; backdrop-filter: blur(3px);
}
.ohk-l { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: rgba(255,255,255,.75); }
.ohk-v { font-size: 21px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.ohk-bar { height: 6px; background: rgba(255,255,255,.26); border-radius: 999px; margin-top: 10px; overflow: hidden; }
.ohk-bar i { display: block; height: 100%; border-radius: 999px; background: #fff; }
.ohk-sub { font-size: 11px; color: rgba(255,255,255,.78); margin-top: 6px; }
.obra-body { padding: 22px 28px 28px; }
.obra-tools { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.obra-search { position: relative; flex: 1; display: flex; align-items: center; min-width: 220px; }
.obra-search svg { position: absolute; left: 13px; width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.obra-search input {
  width: 100%; height: 40px; border: 1px solid var(--border); border-radius: 10px;
  padding: 0 12px 0 38px; font-size: 13.5px; font-family: inherit;
  background: var(--surface-2); color: var(--text);
}
.obra-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: #fff; }
.obra-select {
  height: 40px; border: 1px solid var(--border); border-radius: 10px; padding: 0 12px;
  font-size: 13px; font-family: inherit; color: var(--text); cursor: pointer; background: var(--surface-2);
}
.obra-mats { display: flex; flex-direction: column; gap: 10px; }
.oma { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.oma:hover { border-color: #cfe9df; }
.oma.open { border-color: #bfe3d5; box-shadow: var(--shadow-sm); }
.oma-head { display: flex; align-items: center; gap: 14px; padding: 14px 16px; cursor: pointer; }
.oma-ava { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex-shrink: 0; }
.oma-ava svg { width: 19px; height: 19px; }
.oma-main { flex: 1; min-width: 0; }
.oma-title { font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.oma-uni { font-size: 10.5px; font-weight: 800; background: #eef0f4; color: #64748b; border-radius: 999px; padding: 2px 8px; text-transform: uppercase; letter-spacing: .05em; }
.oma-meta { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.oma-meta b { color: var(--text); font-weight: 700; }
.oma-right { text-align: right; flex-shrink: 0; min-width: 148px; }
.oma-val { font-size: 15px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.oma-pct-wrap { height: 5px; background: #eef0f4; border-radius: 999px; overflow: hidden; margin-top: 7px; }
.oma-pct { height: 100%; background: linear-gradient(90deg, var(--accent), #34d399); border-radius: 999px; }
.oma-pct-txt { font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.oma-chev { color: #94a3b8; flex-shrink: 0; display: grid; place-items: center; transition: transform .2s; transform: rotate(90deg); }
.oma.open .oma-chev { transform: rotate(-90deg); }
.oma-details { display: none; border-top: 1px dashed var(--border-strong); background: var(--surface-2); padding: 8px 14px 14px; overflow-x: auto; }
.oma.open .oma-details { display: block; }
.oma-details .table { margin-top: 8px; min-width: 640px; }
@media (max-width: 900px) { .obra-hero-kpis { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) {
  .obra-tools { flex-direction: column; align-items: stretch; }
  .obra-select { width: 100%; }
  .oma-head { flex-wrap: wrap; }
  .oma-right { min-width: 120px; }
}

/* -------- Despesas manuais da obra -------- */
.obra-despesas { margin-top: 18px; }
.od-head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.od-head h4 { font-size: 13.5px; font-weight: 800; margin: 0; }
.od-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.obra-despesas .table { margin-top: 0; }
.od-empty {
  border: 1px dashed var(--border-strong); border-radius: 10px;
  padding: 16px 18px; font-size: 12.5px; color: var(--muted); background: var(--surface-2);
}

/* ---------- Misc ---------- */
.text-right { text-align: right; }
.text-danger { color: var(--danger); }
.text-muted { color: var(--muted); }
.text-strong { font-weight: 700; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; }
.w-100 { width: 100%; }

.detail-list { display: flex; flex-direction: column; gap: 0; }
.detail-item { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.detail-item:last-child { border-bottom: none; }
.detail-item .k { color: var(--muted); }

.pill-stock { font-weight: 800; font-variant-numeric: tabular-nums; }
.pill-stock.ok { color: var(--accent); }
.pill-stock.warn { color: var(--warning); }
.pill-stock.danger { color: var(--danger); }

.sticky-hint {
  background: var(--info-soft); color: #1d4ed8; border: 1px solid #d3e3fd;
  border-radius: 12px; padding: 12px 16px; font-size: 12.5px; display: flex; gap: 10px; align-items: center; margin-bottom: 18px;
}
.sticky-hint svg { width: 17px; height: 17px; flex-shrink: 0; }

.avatar {
  width: 34px; height: 34px; border-radius: 10px; display: inline-grid; place-items: center;
  background: var(--violet-soft); color: var(--violet); font-weight: 800; font-size: 13px; flex-shrink: 0;
}

.sum-row { display: flex; align-items: baseline; gap: 8px; }
.sum-row .lbl { font-size: 12px; color: var(--muted); font-weight: 600; }
.sum-row .val { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }

.login-pill { font-size: 13px; font-weight: 800; }

.menu-toggle { display: none; }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 90; width: 250px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .menu-toggle { display: grid; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .module-grid { grid-template-columns: 1fr; }
}

/* ---- relatório de contas a pagar ---- */
.report-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 16px; }
.report-filters .field { min-width: 150px; }
.report { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: #fff; }
.report-head { padding: 20px 22px; border-bottom: 3px solid var(--accent); background: #f8fafc; }
.report-head .row1 { display: flex; align-items: center; gap: 12px; }
.report-head .row1 .logo { color: var(--accent); }
.report-head h2 { font-size: 19px; letter-spacing: -.01em; margin: 0; }
.report-head .org { font-size: 12px; color: var(--muted); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.report-head .meta { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 12.5px; color: #475569; }
.report-head .meta b { color: #0f172a; }
.report table { width: 100%; border-collapse: collapse; }
.report th { background: #f1f5f9; color: #475569; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 9px 12px; text-align: left; border-bottom: 1px solid #e2e8f0; }
.report td { padding: 9px 12px; border-bottom: 1px solid #eef2f7; font-size: 13px; color: #0f172a; vertical-align: middle; }
.report tr:nth-child(even) td { background: #fafbfd; }
.report .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.report tfoot td { background: #f8fafc; border-top: 2px solid #cbd5e1; font-weight: 800; font-size: 14px; }
.report .cbx { display: inline-block; width: 17px; height: 17px; border: 1.6px solid #334155; border-radius: 4px; background: #fff; }
.report .col-pagar { text-align: center; }
.report-foot { padding: 70px 22px 12px; }
.report-foot .ass-block { display: flex; justify-content: center; gap: 70px; }
.report-foot .ass-col { text-align: center; min-width: 220px; }
.report-foot .ass-line { border-top: 1.5px solid #475569; height: 22px; }
.report-foot .ass-label { margin-top: 6px; font-size: 12px; font-weight: 700; color: #475569; letter-spacing: .03em; }

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cbd2de; border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Modal gerenciar lista (formas, autorizadores etc.) ---------- */
.ger-add { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.ger-add input { flex: 1; min-width: 160px; }
.ger-list { display: flex; flex-direction: column; gap: 8px; }
.ger-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 12px;
}
.ger-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ger-info strong { font-size: 13.5px; }
.ger-info .cell-soft { font-size: 12px; }
.ger-actions { display: flex; gap: 6px; flex: 0 0 auto; }

/* ---------- Visualização da compra ---------- */
.cp-hero {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 24px;
  background: linear-gradient(135deg, #0e1524 0%, #123a2f 52%, #0f9d6f 135%);
  border-radius: var(--radius); padding: 26px 28px; color: #fff;
  margin-bottom: 22px;
}
.cp-hero-main { display: flex; flex-direction: column; gap: 14px; justify-content: center; }
.cp-hero-label {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: #7fe3bf; background: rgba(127, 227, 191, .1); border: 1px solid rgba(127, 227, 191, .25);
  padding: 5px 12px; border-radius: 999px;
}
.cp-hero-total {
  font-size: 42px; font-weight: 700; font-variant-numeric: tabular-nums;
  letter-spacing: -.02em; line-height: 1; text-shadow: 0 2px 18px rgba(0,0,0,.25);
}
.cp-hero-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.cp-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600;
  padding: 5px 11px; border-radius: 999px;
  background: rgba(255,255,255,.1); color: rgba(255,255,255,.92);
  border: 1px solid rgba(255,255,255,.16);
}
.cp-hero-chips .badge { background: rgba(255,255,255,.1) !important; color: rgba(255,255,255,.94) !important; border: 1px solid rgba(255,255,255,.18); }
.cp-hero-chips .badge svg { color: inherit !important; }
.cp-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-content: start; }
.cp-fact {
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.13); border-radius: 13px;
  padding: 11px 13px; display: flex; gap: 10px; align-items: flex-start; min-width: 0;
}
.cp-fact.span2 { grid-column: span 2; }
.cp-fact-ic { color: #7fe3bf; display: flex; margin-top: 2px; flex-shrink: 0; }
.cp-fact-tx { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cp-fact-tx .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: rgba(255,255,255,.55); font-weight: 700; }
.cp-fact-tx strong { font-size: 12.5px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-fact.span2 .cp-fact-tx strong { white-space: normal; }
.cp-mat { display: flex; align-items: center; gap: 11px; }
.cp-mat-ic {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
}
.cp-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.cp-sec-head .cp-prog {
  font-size: 11.5px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 6px;
}
.cp-prog-bar { width: 78px; height: 6px; border-radius: 99px; background: var(--border); overflow: hidden; }
.cp-prog-bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.cp-card-table {
  border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.cp-fo { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cp-totalrow td { background: var(--surface-2); border-top: 1px solid var(--border-strong); font-weight: 700; }
.cp-totalrow .num { color: var(--accent); font-size: 15px; }

/* ---- contas a pagar (listagem) ---- */
.cpt-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px; align-items: center; padding: 16px 20px;
  border-bottom: 1px solid var(--border); transition: background .12s;
}
.cpt-row:last-child { border-bottom: none; }
.cpt-row:hover { background: #f8fafc; }
.cpt-row.aberta { box-shadow: inset 3px 0 0 var(--info); }
.cpt-row.atrasada { box-shadow: inset 3px 0 0 var(--danger); }
.cpt-row.paga { box-shadow: inset 3px 0 0 var(--accent); }
.cpt-row.cancelada { box-shadow: inset 3px 0 0 #cbd2de; }

.cpt-av {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 800; font-size: 15px; flex-shrink: 0;
}
.cpt-av.aberta { background: var(--info-soft); color: var(--info); }
.cpt-av.atrasada { background: #fff1f2; color: var(--danger); }
.cpt-av.paga { background: #ecfdf5; color: var(--accent); }
.cpt-av.cancelada { background: #f1f5f9; color: #64748b; }

.cpt-main { min-width: 0; }
.cpt-title {
  font-weight: 700; font-size: 14.5px; letter-spacing: -.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cpt-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.cpt-tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--border); color: #64748b; white-space: nowrap;
}
.cpt-tag svg { vertical-align: -1px; }
.cpt-tag.violet { background: var(--violet-soft); border-color: #ddd6fe; color: var(--violet); }
.cpt-tag.blue { background: var(--info-soft); border-color: #bfdbfe; color: var(--info); }
.cpt-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 14px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.cpt-meta .meta-item { display: inline-flex; align-items: center; gap: 4px; }
.cpt-meta .meta-item svg { color: #94a3b8; }
.cpt-meta .obs { font-style: italic; }
.cpt-days {
  display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 11.5px;
  padding: 2px 9px; border-radius: 999px; white-space: nowrap;
}
.cpt-days svg { vertical-align: -1px; }
.cpt-days.rose { background: #fff1f2; color: #be123c; }
.cpt-days.amber { background: #fffbeb; color: #b45309; }
.cpt-days.blue { background: #eff6ff; color: #1d4ed8; }
.cpt-days.emerald { background: #ecfdf5; color: #047857; }

.cpt-right { display: flex; flex-direction: column; align-items: flex-end; gap: 9px; }
.cpt-valrow { display: flex; align-items: center; gap: 10px; }
.cpt-val {
  font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums;
  letter-spacing: -.02em; white-space: nowrap;
}
.cpt-val.muted { color: var(--muted-2); }
.cpt-val.rose { color: var(--danger); }

.ct-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ct-fact {
  background: var(--surface); border: 1px solid var(--border); border-radius: 13px;
  padding: 11px 14px; display: flex; gap: 10px; align-items: flex-start;
  box-shadow: var(--shadow-sm); min-width: 0;
}
.ct-fact.span2 { grid-column: span 2; }
.ct-fact-ic { color: var(--accent); display: flex; margin-top: 2px; flex-shrink: 0; }
.ct-fact .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.ct-fact strong { display: block; margin-top: 3px; font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-fact.span2 strong { white-space: normal; line-height: 1.5; }

/* ---- estoque (listagem) ---- */
.stk-mat { display: flex; align-items: center; gap: 11px; min-width: 0; }
.stk-av {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  font-weight: 800; font-size: 14px; flex-shrink: 0;
}
.stk-av.ok { background: #ecfdf5; color: var(--accent); }
.stk-av.warn { background: #fffbeb; color: var(--warning); }
.stk-av.danger { background: #fff1f2; color: var(--danger); }
.stk-cat {
  display: inline-block; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 2px 9px; font-size: 11px; font-weight: 600; color: #475569; white-space: nowrap;
}
.stk-saldo { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 15px; margin-right: 5px; }
.stk-saldo.ok { color: var(--accent); }
.stk-saldo.warn { color: var(--warning); }
.stk-saldo.danger { color: var(--danger); }
.stk-bar {
  display: block; width: 84px; height: 5px; border-radius: 99px;
  background: var(--border); overflow: hidden; margin: 6px 0 0 auto;
}
.stk-bar i { display: block; height: 100%; border-radius: 99px; }
.stk-bar.ok i { background: var(--accent); }
.stk-bar.warn i { background: var(--warning); }
.stk-bar.danger i { background: var(--danger); }

/* ---- compras (listagem) ---- */
.cpr-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px; align-items: center; padding: 16px 20px;
  border-bottom: 1px solid var(--border); transition: background .12s;
}
.cpr-row:last-child { border-bottom: none; }
.cpr-row:hover { background: #f8fafc; }

.cpr-av {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 800; font-size: 15px; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent);
}

.cpr-main { min-width: 0; }
.cpr-title {
  font-weight: 700; font-size: 14.5px; letter-spacing: -.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cpr-title .mono { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--info); }
.cpr-title .sep { color: var(--muted-2); margin: 0 8px; }
.cpr-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; align-items: center; }
.cpr-right { display: flex; flex-direction: column; align-items: flex-end; gap: 9px; }
.cpr-val {
  font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums;
  letter-spacing: -.02em; white-space: nowrap;
}

/* ---------- Login ---------- */
.login-root {
  position: fixed; inset: 0; z-index: 60; overflow: hidden;
  display: grid; place-items: center; padding: 24px;
  background-color: #10b981;
  background-image:
    radial-gradient(110% 80% at 50% -12%, rgba(4,120,87,.98) 0%, rgba(5,150,105,.55) 40%, transparent 72%),
    radial-gradient(90% 65% at -10% 10%, rgba(6,95,70,.92) 0%, rgba(5,150,105,.35) 55%, transparent 75%),
    radial-gradient(90% 65% at 110% 6%, rgba(5,150,105,.8) 0%, rgba(16,185,129,.30) 55%, transparent 75%),
    linear-gradient(180deg, #047857 0%, #059669 24%, #10b981 55%, #6ee7b7 82%, #d1fae5 100%);
}
.login-root::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.05) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 1px, transparent 1px 44px);
  -webkit-mask-image: radial-gradient(80% 60% at 50% 45%, #000 25%, transparent 72%);
  mask-image: radial-gradient(80% 60% at 50% 45%, #000 25%, transparent 72%);
}
.login-root::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(620px 420px at 50% 44%, rgba(255,255,255,.26), transparent 70%);
}
.login-root[hidden], .layout[hidden] { display: none; }
.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 400px;
  background: #ffffff;
  border: 1px solid rgba(255,255,255,.6);
  border-radius: 22px;
  padding: 44px 38px 36px; text-align: center;
  box-shadow: 0 34px 70px -22px rgba(4,120,87,.5), 0 10px 26px -8px rgba(6,95,70,.28);
}
.login-ico {
  width: 74px; height: 74px; margin: 0 auto 20px;
  border-radius: 50%; display: grid; place-items: center;
  background: rgba(4,120,87,.09);
  border: 1px solid rgba(4,120,87,.12);
  color: rgba(4,120,87,.55);
  overflow: hidden;
}
.login-ico.tem-foto { background: #ffffff; border: 2px solid #065f46; }
.login-ico img { width: 100%; height: 100%; object-fit: cover; display: block; }
.login-ico svg { width: 32px; height: 32px; }
.login-title { font-size: 22px; font-weight: 800; color: #064e3b; letter-spacing: -.02em; }
.login-form { margin-top: 30px; display: flex; flex-direction: column; gap: 14px; text-align: left; }
.login-field { position: relative; display: flex; align-items: center; }
.login-field svg {
  position: absolute; left: 15px; width: 17px; height: 17px;
  color: rgba(4,120,87,.45); pointer-events: none;
}
.login-field input {
  width: 100%; height: 50px; padding: 0 16px 0 44px;
  background: #ffffff; border: 1px solid #a7c8b6; border-radius: 12px;
  font-size: 14px; color: #134e4a; font-family: inherit;
  box-shadow: 0 2px 8px -2px rgba(4,120,87,.16);
  transition: border-color .15s, box-shadow .15s;
}
.login-field input::placeholder { color: #7aa28d; }
.login-field input:focus { outline: none; border-color: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,.18), 0 2px 8px -2px rgba(4,120,87,.16); }
.login-error {
  font-size: 12.5px; color: #b91c1c; background: #fef2f2;
  border: 1px solid #fecaca; border-radius: 10px; padding: 9px 12px;
}
.login-btn {
  width: 100%; height: 50px; margin-top: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; border-radius: 12px; cursor: pointer;
  background: linear-gradient(120deg, #059669, #10b981);
  color: #ffffff; font-size: 13.5px; font-weight: 800;
  letter-spacing: .18em; text-transform: uppercase; font-family: inherit;
  box-shadow: 0 16px 30px -10px rgba(4,120,87,.6);
  transition: transform .15s, filter .15s, box-shadow .15s;
}
.login-btn:hover:not(:disabled) { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 20px 34px -10px rgba(4,120,87,.66); }
.login-btn:active:not(:disabled) { transform: translateY(0); }
.login-btn:disabled { opacity: .7; cursor: wait; }

/* ---------- Usuário na sidebar ---------- */
.user-area {
  margin-top: auto; padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.user-card { display: flex; align-items: center; gap: 11px; padding: 10px; border-radius: 12px; cursor: pointer; }
.user-card:hover { background: rgba(255,255,255,.04); }
.user-ava {
  width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
  background: linear-gradient(135deg, var(--accent), #34d399); color: #fff;
  border: 2px solid transparent; overflow: hidden;
}
.user-ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
.user-ava.tem-foto { border-color: #065f46; }
.cfg-row { display: flex; align-items: center; gap: 14px; }
.cfg-ava {
  width: 56px; height: 56px; border-radius: 16px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 800; font-size: 18px;
  background: linear-gradient(135deg, var(--accent), #34d399); color: #fff;
  border: 2px solid transparent; overflow: hidden;
}
.cfg-ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cfg-ava.tem-foto { border-color: #065f46; }
.cfg-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cfg-info strong { font-size: 14.5px; }
.user-ava {
  width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
  background: linear-gradient(135deg, var(--accent), #34d399); color: #fff;
}
.user-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.user-name { color: #e2e8f0; font-weight: 600; font-size: 13px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-out {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
  border: none; background: none; cursor: pointer;
  font-size: 12px; font-weight: 600; color: #64748b; padding: 1px 0;
  font-family: inherit; transition: color .15s;
}
.user-out:hover { color: #e2e8f0; }

@media (max-width: 420px) {
  .login-card { padding: 32px 24px 28px; }
}