/* ======================================================================
   Control Panel MSM Boulevard — visual "prancha de obra"
   Folha clara sobre concreto, grafite para a estrutura e laranja de cone só
   para o que pede ação. O cabeçalho de cada tela é o "carimbo" da prancha:
   título condensado e o dia de obra. (Camada final no fim deste arquivo.)
   ====================================================================== */
:root {
  --bg: #e8eae6;
  --surface: #fbfbf8;
  --surface-2: #f2f3ef;
  --border: #daded7;
  --border-strong: #c3c9c1;
  --text: #1a1f1d;
  --muted: #5f6a65;

  --pine: #1f2623;
  --pine-2: #2c3531;
  --pine-3: #2f6b5c;
  --side-text: #3d4743;

  --accent: #eb5b13;
  --accent-strong: #cc4a08;
  --accent-soft: #fde6d7;

  --green: #17805a;
  --green-bg: #d9f1e6;
  --red: #c23a2b;
  --red-bg: #fde6e2;
  --blue: #2a58cf;
  --blue-bg: #e1e9fb;
  --amber: #96590a;
  --amber-bg: #fdecc8;
  --gray-bg: #eceee9;

  --c-material: #f2641a;
  --c-mao: #2a58cf;
  --c-servico: #12a18a;

  --r-ctl: 8px;
  --r-panel: 14px;
  --font-display: 'Archivo', 'Arial Narrow', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --tick: rgba(14, 58, 51, .38);
  --safe-b: env(safe-area-inset-bottom, 0px);

  --input-bg: #fff;
  --hover-bg: #fff;
  --row-hover: #f6f7f3;
  --invalid-bg: #fffafa;
  --fora-bg: #eef0ec;
  --fora-txt: #8a9790;
  --sel-bg: #e7ece8;
  --label: #2a322e;
  --info-txt: #1f45a8;
  --gray-txt: #4c5b54;
  --tag-mat: #a8420a;
  --serv-bg: #d3f3ec;
  --serv-txt: #0b6b5b;
  --alert-border: #f3c6bf;
  --aviso-txt: #7a4a06;
  --seta: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235b6a63' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  color-scheme: light;
}

/* ---------- Modo escuro: mesma identidade (pinheiro + laranja), superfícies grafite esverdeadas ---------- */
:root[data-theme="dark"] {
  --bg: #0f1211;
  --surface: #171b19;
  --surface-2: #1c211f;
  --border: #29302c;
  --border-strong: #3a423e;
  --text: #e6eae7;
  --muted: #98a29d;
  --pine: #0b0e0d;
  --pine-2: #202623;
  --pine-3: #5aa58f;
  --side-text: #b7c1bc;
  --accent: #f06a22;
  --accent-strong: #ff7f3d;
  --accent-soft: #3b2214;
  --green: #45c48f;
  --green-bg: #12352a;
  --red: #ff7d6b;
  --red-bg: #3a1a15;
  --blue: #86a8ff;
  --blue-bg: #18233f;
  --amber: #f1b65c;
  --amber-bg: #392a12;
  --gray-bg: #222826;
  --tick: rgba(185, 214, 203, .35);
  --input-bg: #101917;
  --hover-bg: #1f2c28;
  --row-hover: #1d2220;
  --invalid-bg: #2a1512;
  --fora-bg: #111a17;
  --fora-txt: #5f7068;
  --sel-bg: #232a27;
  --label: #cfd6d2;
  --info-txt: #a9c0ff;
  --gray-txt: #b3c2bb;
  --tag-mat: #ffab7d;
  --serv-bg: #10342d;
  --serv-txt: #63d6bd;
  --alert-border: #5a2a22;
  --aviso-txt: #f5cd8a;
  --seta: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2395a69e' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  color-scheme: dark;
}
:root[data-theme="dark"] .modal { box-shadow: 0 28px 70px rgba(0, 0, 0, .7); }
:root[data-theme="dark"] .cal-chip { color: color-mix(in srgb, var(--c) 80%, #fff); }
:root[data-theme="dark"] img.anexo-img, :root[data-theme="dark"] .anexo img { filter: none; }
:root[data-theme="dark"] .bar-track::after { opacity: .25; }
:root[data-theme="dark"] .auth-card { box-shadow: 0 30px 80px rgba(0, 0, 0, .7); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  display: flex;
  -webkit-font-smoothing: antialiased;
}
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3, p { margin: 0; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.num, td.num, th.num { font-variant-numeric: tabular-nums; }

/* ---------- Menu lateral ---------- */
.sidebar {
  width: 244px; flex: 0 0 244px;
  background: var(--pine); color: var(--side-text);
  display: flex; flex-direction: column;
  padding: 22px 14px 16px;
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
  background-image: linear-gradient(180deg, rgba(255,255,255,.04), transparent 220px);
}
.brand { display: flex; gap: 12px; align-items: center; padding: 2px 8px 24px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 6px; flex: none;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  clip-path: polygon(0 0, 100% 0, 100% 78%, 78% 100%, 0 100%);
}
.brand-name { font-family: var(--font-display); font-weight: 800; font-stretch: 78%; font-size: 21px; letter-spacing: .02em; line-height: 1; color: #fff; }
.brand-sub { font-size: 12.5px; color: #8fa89e; margin-top: 3px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; min-height: 44px;
  padding: 10px 12px; border-radius: var(--r-ctl);
  color: var(--side-text); text-decoration: none; font-weight: 500;
  transition: background .15s, color .15s;
  position: relative;
}
.nav a svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active { background: rgba(255,255,255,.11); color: #fff; font-weight: 600; }
.nav a.active::before { content: ''; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 5px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav a.active svg { color: var(--accent); opacity: 1; }
.sidebar-foot { margin-top: auto; padding-top: 18px; display: flex; flex-direction: column; gap: 10px; font-size: 12.5px; }
.sidebar-foot .nav { padding-top: 12px; border-top: 1px solid rgba(255,255,255,.12); }
.sidebar-foot .nav a { min-height: 38px; padding: 7px 12px; font-size: 13.5px; }
.user-box { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 4px 2px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--pine-3); color: #fff; font-family: var(--font-display); font-weight: 700; text-transform: uppercase;
}
.user-info { min-width: 0; }
.user-name { color: #fff; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-email { color: #8fa89e; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .btn.ghost { background: transparent; border-color: rgba(255,255,255,.22); color: #e3ece8; width: 100%; justify-content: center; }
.sidebar-foot .btn.ghost:hover { background: rgba(255,255,255,.08); }
.sidebar-foot .foot-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------- Área principal ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: relative;
  display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap;
  padding: 28px 36px 26px;
}
/* a régua: marcas a cada 8 px e uma maior a cada 40 px, começando no "zero" laranja */
.topbar::after {
  content: ''; position: absolute; left: 36px; right: 36px; bottom: 8px; height: 12px;
  background-image:
    linear-gradient(var(--accent), var(--accent)),
    repeating-linear-gradient(90deg, var(--tick) 0 1.5px, transparent 1.5px 40px),
    repeating-linear-gradient(90deg, var(--tick) 0 1px, transparent 1px 8px);
  background-size: 64px 4px, 100% 12px, 100% 6px;
  background-position: left bottom, left bottom, left bottom;
  background-repeat: no-repeat;
  pointer-events: none;
}
.topbar h1 { font-family: var(--font-display); font-weight: 800; font-stretch: 86%; font-size: 30px; letter-spacing: -.012em; line-height: 1.05; }
.topbar #pageSub { font-size: 14px; margin-top: 5px; max-width: 60ch; }
.topbar-actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.icon-btn.menu-btn { display: none; }
.view { padding: 4px 36px 56px; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 14px; line-height: 1.2;
  min-height: 40px; padding: 8px 16px; border-radius: var(--r-ctl); border: 1px solid transparent;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s, transform .06s;
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 1px 0 rgba(0,0,0,.12), inset 0 -2px 0 rgba(0,0,0,.14); }
.btn.primary:hover { background: var(--accent-strong); }
.btn.ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn.ghost:hover { background: var(--hover-bg); border-color: var(--pine-3); }
.btn.danger { background: var(--red); color: #fff; }
.btn.danger:hover { background: #a32f23; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; min-height: 46px; font-size: 15px; }
.btn.small { min-height: 34px; padding: 5px 12px; font-size: 13px; }
.icon-btn {
  position: relative;
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border-radius: var(--r-ctl); border: 1px solid transparent; background: transparent;
  color: var(--muted); cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover { background: var(--gray-bg); color: var(--text); }
.icon-btn.danger:hover { background: var(--red-bg); color: var(--red); }
.icon-btn.ok:hover { background: var(--green-bg); color: var(--green); }
.icon-btn.accent:hover { background: var(--accent-soft); color: var(--accent-strong); }

/* ---------- Painéis ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-panel); }
.card-pad { padding: 20px 22px; }
.card-title { font-family: var(--font-display); font-weight: 700; font-stretch: 90%; font-size: 17px; letter-spacing: -.005em; }
.card-sub { font-size: 13px; color: var(--muted); margin: 3px 0 16px; max-width: 70ch; }

/* painel de indicadores do Painel */
.kpi-wrap { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; margin-bottom: 16px; }
.hero {
  background: var(--pine); color: #fff; border-radius: var(--r-panel); padding: 24px 26px 22px;
  background-image: radial-gradient(520px 220px at 100% 0%, rgba(242,100,26,.22), transparent 70%);
  display: flex; flex-direction: column;
}
.hero-label { font-size: 14px; color: #a9c2b8; font-weight: 500; }
.hero-value { font-family: var(--font-display); font-weight: 800; font-stretch: 80%; font-size: clamp(40px, 5vw, 58px); line-height: 1; letter-spacing: -.02em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.hero-hint { font-size: 13px; color: #a9c2b8; margin-top: 8px; }
.split { position: relative; display: flex; height: 22px; margin: 22px 0 14px; border-radius: 4px; overflow: hidden; background: rgba(255,255,255,.12); }
.split i { display: block; height: 100%; min-width: 0; }
.split::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: repeating-linear-gradient(90deg, rgba(14,58,51,.55) 0 1px, transparent 1px 8px);
  background-size: 100% 40%; background-repeat: no-repeat; background-position: bottom;
}
.hero-legend { display: grid; gap: 8px; margin-top: auto; }
.hero-legend > div { display: grid; grid-template-columns: 12px 1fr auto auto; align-items: center; gap: 10px; font-size: 13.5px; }
.hero-legend i { width: 12px; height: 12px; border-radius: 2px; display: block; }
.hero-legend b { font-variant-numeric: tabular-nums; font-weight: 600; }
.hero-legend span.pc { color: #a9c2b8; min-width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.kpi { padding: 18px 20px; display: flex; flex-direction: column; justify-content: space-between; min-height: 112px; }
.kpi .label { font-size: 13.5px; font-weight: 500; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.kpi .label::before { content: ''; width: 9px; height: 9px; border-radius: 2px; background: var(--kc, var(--pine-3)); flex: none; }
.kpi .value { font-family: var(--font-display); font-weight: 800; font-stretch: 84%; font-size: 30px; letter-spacing: -.015em; margin-top: 10px; font-variant-numeric: tabular-nums; line-height: 1.05; }
.kpi .hint { font-size: 13px; color: var(--muted); margin-top: 6px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.chart-box { position: relative; height: 290px; }
.chart-box.tall { height: 320px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

.alert-list { display: flex; flex-direction: column; gap: 8px; }
.alert-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px; background: var(--red-bg); border: 1px solid var(--alert-border); }
.alert-row .dot { width: 9px; height: 9px; border-radius: 2px; background: var(--red); flex: none; }
.alert-row .grow { flex: 1; min-width: 0; }
.alert-row .name { font-weight: 600; }
.alert-row .meta { font-size: 12.5px; color: var(--muted); }
.alert-row .qty { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.empty-ok { display: flex; align-items: center; gap: 10px; color: var(--green); background: var(--green-bg); padding: 13px 15px; border-radius: 10px; font-weight: 500; }

.pills { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat-pill { padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.stat-pill b { display: block; font-family: var(--font-display); font-weight: 800; font-stretch: 86%; font-size: 24px; letter-spacing: -.01em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-pill span { font-size: 12.5px; color: var(--muted); }
.stat-pill.warn b { color: var(--red); }

/* ---------- Filtros ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.search { flex: 1 1 260px; max-width: 380px; position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 38px; }
input, select, textarea {
  font: inherit; color: var(--text);
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: var(--r-ctl);
  border: 1px solid var(--border-strong); background: var(--input-bg);
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 78px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(242, 100, 26, .22); }
input[type=checkbox] { width: auto; min-height: 0; }
.toolbar select { width: auto; min-width: 160px; }
.segmented { display: inline-flex; background: var(--gray-bg); padding: 3px; border-radius: 10px; gap: 2px; border: 1px solid var(--border); }
.segmented button {
  font: inherit; font-weight: 600; font-size: 13.5px; color: var(--muted); min-height: 36px;
  border: 0; background: transparent; padding: 6px 16px; border-radius: 7px; cursor: pointer; transition: background .15s, color .15s;
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--pine); color: #fff; }

/* ---------- Tabelas ---------- */
.table-card { overflow: hidden; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-panel); }
.table-card .table-wrap { border: 0; border-radius: 0; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 13px; font-weight: 600; color: var(--muted);
  background: var(--surface-2); padding: 12px 10px; border-bottom: 2px solid var(--border-strong); white-space: nowrap;
}
td { padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
td.num { white-space: nowrap; }
td.num .sub { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--row-hover); }
td.num, th.num { text-align: right; }
td.strong { font-weight: 600; }
td .sub { display: block; font-size: 12.5px; color: var(--muted); font-weight: 400; margin-top: 2px; }
td.actions { white-space: nowrap; text-align: right; }
.table-foot { display: flex; justify-content: space-between; gap: 6px 14px; flex-wrap: wrap; padding: 13px 16px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: 13.5px; color: var(--muted); }
.table-foot b { color: var(--text); }
.empty { text-align: center; padding: 52px 20px; color: var(--muted); }
.empty svg { width: 42px; height: 42px; opacity: .45; margin-bottom: 8px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 2px; background: currentColor; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.blue { background: var(--blue-bg); color: var(--blue); }
.badge.gray { background: var(--gray-bg); color: var(--gray-txt); }
.tag { display: inline-block; white-space: nowrap; font-size: 12.5px; font-weight: 600; padding: 2px 9px; border-radius: 6px; background: var(--gray-bg); color: var(--gray-txt); }
.tag.material { background: var(--accent-soft); color: var(--tag-mat); }
.tag.mao { background: var(--blue-bg); color: var(--info-txt); }
.tag.servico { background: var(--serv-bg); color: var(--serv-txt); }
.tag.in { background: var(--green-bg); color: var(--green); }
.tag.out { background: var(--red-bg); color: var(--red); }

.stock-bar { width: 96px; height: 6px; background: var(--gray-bg); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.stock-bar i { display: block; height: 100%; background: var(--green); }
.stock-bar.low i { background: var(--red); }

/* ---------- Janelas ---------- */
.modal {
  border: 0; padding: 0; border-radius: 16px; width: min(680px, calc(100vw - 24px));
  max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  box-shadow: 0 28px 70px rgba(7, 28, 24, .45); color: var(--text); background: var(--surface);
}
.modal.small { width: min(430px, calc(100vw - 24px)); }
.modal[open] { display: flex; flex-direction: column; animation: sobe .18s ease-out; }
.modal::backdrop { background: rgba(7, 28, 24, .6); backdrop-filter: blur(3px); }
.modal form { display: flex; flex-direction: column; min-height: 0; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-family: var(--font-display); font-weight: 800; font-stretch: 88%; font-size: 20px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 16px 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field.full { grid-column: 1 / -1; }
.field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; color: var(--label); }
.field label .req { color: var(--red); }
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--red); background: var(--invalid-bg); }
.field .err { color: var(--red); font-size: 13px; margin-top: 5px; font-weight: 500; }
.form-error { margin: 0 22px 14px; padding: 11px 14px; border-radius: 9px; background: var(--red-bg); color: var(--red); font-weight: 500; }
.info-box { grid-column: 1 / -1; padding: 11px 14px; border-radius: 9px; background: var(--blue-bg); color: var(--info-txt); font-size: 13.5px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--muted); font-size: 12.5px; white-space: nowrap; min-width: 112px; }

/* ---------- Avisos ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 6000; }
.toast {
  background: var(--pine); color: #fff; padding: 13px 16px; border-radius: 10px; min-width: 250px; max-width: 400px;
  box-shadow: 0 12px 32px rgba(7, 28, 24, .3); border-left: 5px solid #3ccf91; animation: sobe .2s ease-out;
}
.toast.error { border-left-color: #ff7a66; background: #4a1710; }
@keyframes sobe { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.loading { display: grid; place-items: center; height: 240px; color: var(--muted); }
.spinner { width: 30px; height: 30px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }

/* ---------- Entrada (login) ---------- */
body.locked .sidebar, body.locked .main, body.locked .tabbar { display: none; }
.auth {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; overflow-y: auto;
  background-color: var(--pine);
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px),
    radial-gradient(900px 500px at 15% -10%, rgba(242,100,26,.22), transparent 60%);
  background-size: 32px 32px, 32px 32px, 100% 100%;
}
.auth-card { position: relative; width: min(420px, 100%); background: var(--surface); border-radius: 16px; padding: 34px 28px 26px; box-shadow: 0 30px 80px rgba(0, 0, 0, .45); overflow: hidden; }
.auth-card::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 12px;
  background-image: repeating-linear-gradient(90deg, var(--tick) 0 1.5px, transparent 1.5px 40px), repeating-linear-gradient(90deg, var(--tick) 0 1px, transparent 1px 8px);
  background-size: 100% 12px, 100% 6px; background-repeat: no-repeat;
}
.auth-brand { padding: 0 0 22px; }
.auth-brand .brand-name { color: var(--pine) !important; }
.auth-brand .brand-sub { color: var(--muted); }
.auth .field { margin-bottom: 14px; }
.auth .form-error { margin: 0 0 14px; }
.auth-note { margin-top: 14px; text-align: center; font-size: 13px; }

/* ---------- Seleção em lote ---------- */
.chk { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; vertical-align: middle; }
th.chk-col, td.chk-col { width: 36px; padding-right: 0; padding-left: 14px; }
.bulkbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; padding: 10px 14px; background: var(--pine); color: #fff; border-radius: 12px; }
.bulkbar[hidden] { display: none; }
.bulkbar b { margin-right: 6px; }
.bulkbar .btn { min-height: 36px; padding: 6px 13px; font-size: 13.5px; }
.bulkbar .btn.ghost { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); color: #fff; }
.bulkbar .btn.ghost:hover { background: rgba(255,255,255,.18); }
.bulk-result { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--gray-txt); }
.date-range { display: inline-flex; align-items: center; gap: 6px; }
.date-range input { width: auto; }
.live-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); margin: 0 0 10px; }
.live-bar .switch { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text); font-weight: 500; min-height: 36px; }
.live-bar .switch input { width: 18px; height: 18px; accent-color: var(--pine-3); }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); flex: none; }
.live-dot.on { background: var(--green); animation: pulso 2s ease-out infinite; }
.live-dot.busy { background: var(--accent); }
.live-dot.erro { background: var(--red); }
@keyframes pulso { 0% { box-shadow: 0 0 0 0 rgba(23,128,90,.45); } 70%, 100% { box-shadow: 0 0 0 8px rgba(23,128,90,0); } }
.btn.girando svg { animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
.dot-on, .dot-off { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.dot-on { background: var(--green); box-shadow: 0 0 0 3px rgba(23,128,90,.2); }
.dot-off { background: var(--border-strong); }
.info-card { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 14px; }
.info-card .stat-pill b { font-size: 20px; }
.note { font-size: 13.5px; color: var(--muted); margin: 0 0 14px; line-height: 1.55; max-width: 80ch; }

/* ---------- Listas de seleção (combobox) ---------- */
select {
  appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 38px;
  background: var(--input-bg) var(--seta) no-repeat right 12px center;
}
.combo { position: relative; }
.combo select.combo-native { display: none; }
.combo-input { padding: 11px 38px 11px 14px; font-size: 15px; min-height: 46px; }
.combo:not(.text) .combo-input { cursor: pointer; font-weight: 500;
  background: var(--input-bg) var(--seta) no-repeat right 12px center; }
.combo.text .combo-input { padding-right: 14px; }
.combo-input[readonly]:not(:disabled) { cursor: pointer; }
.field.invalid .combo-input { border-color: var(--red); background-color: var(--invalid-bg); }
.combo-list {
  position: fixed; z-index: 5000; margin: 0; padding: 6px; list-style: none; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(7, 28, 24, .28);
}
.combo-list li { padding: 12px 12px; border-radius: 8px; font-size: 15px; line-height: 1.3; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.combo-list li + li { margin-top: 2px; }
.combo-list li:hover, .combo-list li.active { background: var(--accent-soft); }
.combo-list li.selected { font-weight: 700; color: var(--accent-strong); }
.combo-list li.selected::after { content: "✓"; font-weight: 800; }
.combo-list li mark { background: transparent; color: var(--accent-strong); font-weight: 800; text-decoration: underline; }
.combo-list li.combo-empty { color: var(--muted); font-size: 14px; cursor: default; }
.combo-list li.combo-empty:hover { background: transparent; }

/* ---------- Relatórios ---------- */
.rel-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.rel-sum { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.rel-sum .stat-pill { background: var(--surface); padding: 14px 16px; }
.rel-sum .stat-pill b { font-size: 28px; }
.rel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.rel-grid .wide { grid-column: 1 / -1; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.panel-head .card-sub { margin-bottom: 14px; }
.bars { display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: grid; gap: 6px; }
.bar-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.bar-name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; display: flex; align-items: center; gap: 8px; }
.bar-val { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.bar-val small { color: var(--muted); font-weight: 500; font-size: 12.5px; margin-left: 6px; }
.bar-track { position: relative; height: 12px; background: var(--gray-bg); border-radius: 3px; overflow: hidden; }
.bar-track i { display: block; height: 100%; background: var(--accent); border-radius: 3px 0 0 3px; }
.bar-track.pine i { background: var(--pine-3); }
.bar-track.blue i { background: var(--blue); }
.bar-track.low i { background: var(--red); }
.bar-track::after { content: ''; position: absolute; inset: 0; pointer-events: none; background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.7) 0 1px, transparent 1px 8px); background-size: 100% 45%; background-repeat: no-repeat; background-position: bottom; }
.bar-meta { font-size: 12.5px; color: var(--muted); }
.classe { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 5px; font-family: var(--font-display); font-weight: 800; font-size: 13px; background: var(--gray-bg); color: var(--gray-txt); flex: none; }
.classe.A { background: var(--accent); color: #fff; }
.classe.B { background: var(--pine-3); color: #fff; }
.compra-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 12px 0; border-top: 1px solid var(--border); }
.compra-row:first-child { border-top: 0; padding-top: 0; }
.compra-row .cr-buy { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.compra-row .cr-buy small { display: block; color: var(--muted); font-weight: 500; font-size: 12.5px; }
.compra-row .bar-track { grid-column: 1 / -1; height: 8px; }

/* ---------- Anexos e fotos ---------- */
.icon-btn .cnt { position: absolute; top: 1px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: #fff; font: 700 10.5px/16px var(--font-body); font-style: normal; text-align: center; }
.foto-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.foto-pick .btn { cursor: pointer; }
.foto-prev { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 8px 10px; border: 1px dashed var(--border-strong); border-radius: 10px; background: var(--surface-2); }
.foto-prev img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex: none; }
.foto-prev[hidden] { display: none; }
.foto-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.foto-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.foto-info span { font-size: 12.5px; color: var(--muted); }
.anexos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.anexos-grid > .empty { grid-column: 1 / -1; padding: 28px 8px; }
.anexo { position: relative; margin: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.anexo-thumb { display: block; width: 100%; aspect-ratio: 4 / 3; padding: 0; border: 0; background: var(--gray-bg); cursor: pointer; }
.anexo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.anexo-pdf { width: 100%; height: 100%; display: grid; place-content: center; justify-items: center; gap: 4px; color: var(--accent-strong); }
.anexo-pdf svg { width: 34px; height: 34px; }
.anexo-pdf b { font-family: var(--font-display); font-weight: 800; font-size: 13px; }
.anexo-pdf.sm { width: 56px; height: 56px; background: var(--accent-soft); border-radius: 8px; flex: none; }
.anexo figcaption { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px 10px; font-size: 12.5px; color: var(--muted); }
.anexo figcaption b { color: var(--text); font-size: 13.5px; overflow-wrap: anywhere; }
.anexo > .icon-btn.danger { position: absolute; top: 6px; right: 6px; background: rgba(255,255,255,.94); box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.anexo-add { padding-top: 14px; border-top: 1px solid var(--border); }
.anexo-add .field { margin-bottom: 12px; }

/* ---------- Barra inferior (celular) ---------- */
.tabbar { display: none; }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .grid-2, .grid-3, .kpi-wrap, .rel-grid { grid-template-columns: 1fr; }
  .rel-grid .wide { grid-column: auto; }
}
@media (max-width: 900px) {
  body { display: block; }
  .sidebar { position: fixed; z-index: 150; left: 0; top: 0; transform: translateX(-100%); transition: transform .22s; width: 280px; }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(7, 28, 24, .55); }
  .icon-btn.menu-btn { display: inline-grid; align-self: center; }
  .topbar { padding: 20px 20px 24px; }
  .topbar::after { left: 20px; right: 20px; }
  .view { padding: 4px 20px 56px; }
  .topbar-actions { width: 100%; margin-left: 0; }
}
@media (max-width: 720px) {
  body { font-size: 15px; }
  .icon-btn.menu-btn { display: none; }
  .topbar { padding: 16px 16px 22px; gap: 10px; }
  .topbar::after { left: 16px; right: 16px; background-size: 48px 4px, 100% 12px, 100% 6px; }
  .topbar h1 { font-size: 25px; }
  .topbar #pageSub { font-size: 13.5px; }
  .view { padding: 2px 16px calc(96px + var(--safe-b)); }
  .topbar-actions .btn, .topbar-actions select { flex: 1 1 140px; }
  .topbar-actions select { min-width: 0; }
  .date-range { width: 100%; }
  .date-range input { flex: 1; min-width: 0; }

  .card-pad { padding: 16px; }
  .hero { padding: 20px 18px; }
  .kpi-grid { gap: 10px; }
  .kpi { padding: 14px; min-height: 100px; }
  .kpi .value { font-size: 24px; }
  .chart-box, .chart-box.tall { height: 240px; }
  .rel-sum { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .rel-sum .stat-pill { padding: 10px; }
  .rel-sum .stat-pill b { font-size: 21px; }
  .rel-sum .stat-pill span { font-size: 12px; line-height: 1.25; display: block; }

  .toolbar { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .toolbar .search { grid-column: 1 / -1; max-width: none; }
  .toolbar select, .toolbar .segmented { width: 100%; min-width: 0; }
  .toolbar .segmented { display: flex; }
  .toolbar .segmented button { flex: 1; }
  .toolbar .date-range { grid-column: 1 / -1; }
  input, select, textarea, .combo-input { font-size: 16px; } /* evita o zoom automático do iPhone */

  /* tabelas viram cartões: o rótulo de cada coluna vem do atributo data-label */
  .table-wrap { border: 0; background: transparent; overflow: visible; }
  .table-card .table-wrap { border-radius: 0; }
  table, tbody { display: block; }
  thead { display: none; }
  tbody tr {
    position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px;
    padding: 14px 14px 12px; margin-bottom: 10px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  }
  .table-card tbody tr { border-radius: 0; margin-bottom: 0; border-width: 0 0 1px; }
  tbody tr:hover { background: var(--surface); }
  td { display: flex; flex-direction: column; gap: 2px; padding: 0; border: 0; min-width: 0; font-size: 14.5px; overflow-wrap: anywhere; }
  td:empty { display: none; }
  td::before { content: attr(data-label); font-size: 12px; color: var(--muted); font-weight: 500; }
  td.num { text-align: left; align-items: flex-start; white-space: normal; }
  td.num .sub { text-align: left; }
  td.t-main { order: -1; grid-column: 1 / -1; font-size: 16.5px; font-weight: 700; padding-right: 34px; }
  td.t-main::before { display: none; }
  td.chk-col { position: absolute; top: 12px; right: 12px; width: auto; padding: 0; }
  td.chk-col::before { display: none; }
  td.actions { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; gap: 2px; padding-top: 6px; border-top: 1px dashed var(--border); white-space: normal; flex-wrap: wrap; }
  td.actions::before, td[data-label=""]::before { display: none; }
  td.actions .icon-btn { width: 44px; height: 44px; }
  .table-foot { border-radius: 12px; border: 1px solid var(--border); }
  .table-card .table-foot { border-radius: 0; border: 0; border-top: 1px solid var(--border); }
  .table-card { background: transparent; border: 0; overflow: visible; }
  .bulkbar { position: sticky; top: 8px; z-index: 20; }

  /* janelas viram folhas que sobem de baixo */
  .modal { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 18px 18px 0 0; max-height: 92dvh; }
  .modal form { max-height: 92dvh; }
  .modal.small { width: 100vw; }
  .modal[open] { animation: folha .22s ease-out; }
  .modal-foot { border-radius: 0; padding-bottom: calc(14px + var(--safe-b)); }
  .modal-foot .btn { flex: 1; min-height: 46px; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-head { padding: 16px 18px; }
  .modal-body { padding: 18px; }
  @keyframes folha { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }

  .toasts { left: 12px; right: 12px; bottom: calc(80px + var(--safe-b)); }
  .toast { max-width: none; min-width: 0; }
  .rel-grid { gap: 12px; }
  .compra-row { grid-template-columns: 1fr; }
  .anexos-grid { grid-template-columns: 1fr 1fr; }
  .foto-pick .btn { flex: 1 1 140px; min-height: 46px; }
  .compra-row .cr-buy { text-align: left; }

  .tabbar {
    display: grid; grid-template-columns: repeat(6, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 120;
    background: var(--pine); padding: 6px 6px calc(6px + var(--safe-b));
    box-shadow: 0 -6px 24px rgba(7, 28, 24, .25);
  }
  .tabbar a, .tabbar button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 54px; border: 0; background: transparent; color: #a9c2b8; border-radius: 10px;
    font: inherit; font-size: 10.5px; font-weight: 500; text-decoration: none; cursor: pointer; position: relative; min-width: 0;
  }
  .tabbar svg { width: 22px; height: 22px; }
  .tabbar a.active { color: #fff; font-weight: 600; background: rgba(255,255,255,.1); }
  .tabbar a.active svg { color: var(--accent); }
  .tabbar a.active::before { content: ''; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
}

/* ===== Calendário da obra ===== */
.cal-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-mes { font-family: var(--font-display); font-stretch: 100%; font-weight: 800; font-size: 24px; letter-spacing: -.01em; min-width: 11ch; text-align: center; }
.cal-filtro select { min-height: 38px; border: 1px solid var(--border-strong); border-radius: var(--r-ctl); background: var(--surface); padding: 0 12px; font: inherit; color: var(--text); }
.cal-resumo { font-size: 13.5px; color: var(--muted); margin: 0 0 12px; }
.cal-resumo b { color: var(--text); }
.st-txt.st-CONCLUIDA { color: var(--green); } .st-txt.st-EM_ANDAMENTO { color: var(--amber); } .st-txt.st-PLANEJADA { color: var(--blue); } .st-txt.st-IMPEDIDA { color: var(--red); }
.cal-card { padding: 0; overflow: hidden; transition: opacity .15s; }
.cal-card.loading-soft { opacity: .55; pointer-events: none; }
.cal-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--pine); color: #cfe0d8; font-size: 12.5px; font-weight: 600; }
.cal-head span { padding: 9px 10px; text-align: left; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-cell { appearance: none; border: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface); text-align: left; font: inherit; color: var(--text); padding: 7px 8px 8px; min-height: 118px; display: flex; flex-direction: column; gap: 5px; cursor: pointer; min-width: 0; position: relative; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.fds { background: var(--surface-2); }
.cal-cell.fora { background: var(--fora-bg); color: var(--fora-txt); }
.cal-cell.fora .cal-chip { opacity: .65; }
.cal-cell:hover { background: var(--hover-bg); box-shadow: inset 0 0 0 2px var(--pine-3); z-index: 1; }
.cal-cell:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; z-index: 2; }
.cal-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.cal-num { font-family: var(--font-display); font-weight: 800; font-size: 15px; min-width: 26px; height: 26px; display: inline-grid; place-items: center; border-radius: 7px; }
.cal-cell.hoje .cal-num { background: var(--accent); color: #fff; }
.cal-ind { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.cal-ind svg { width: 14px; height: 14px; vertical-align: -2px; }
.cal-clip { display: inline-flex; align-items: center; gap: 2px; color: var(--accent-strong); }
.cal-chips { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-chip { display: block; font-size: 11.5px; line-height: 1.3; padding: 2px 6px; border-radius: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-left: 3px solid currentColor; }
.cal-chip b { font-weight: 700; }
.cal-chip.st-PLANEJADA, .tarefa.st-PLANEJADA, .cal-legenda i.st-PLANEJADA, .cal-dots i.st-PLANEJADA { --c: var(--blue); --cb: var(--blue-bg); }
.cal-chip.st-EM_ANDAMENTO, .tarefa.st-EM_ANDAMENTO, .cal-legenda i.st-EM_ANDAMENTO, .cal-dots i.st-EM_ANDAMENTO { --c: var(--amber); --cb: var(--amber-bg); }
.cal-chip.st-CONCLUIDA, .tarefa.st-CONCLUIDA, .cal-legenda i.st-CONCLUIDA, .cal-dots i.st-CONCLUIDA { --c: var(--green); --cb: var(--green-bg); }
.cal-chip.st-IMPEDIDA, .tarefa.st-IMPEDIDA, .cal-legenda i.st-IMPEDIDA, .cal-dots i.st-IMPEDIDA { --c: var(--red); --cb: var(--red-bg); }
.cal-chip { color: var(--c); background: var(--cb); }
.cal-chip { color: color-mix(in srgb, var(--c) 85%, #000); }
.cal-mais { font-size: 11.5px; font-weight: 600; color: var(--muted); padding-left: 4px; }
.cal-dots { display: none; }
.cal-legenda { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.cal-legenda span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legenda svg { width: 14px; height: 14px; color: var(--accent-strong); }
.cal-legenda i { width: 12px; height: 12px; border-radius: 3px; background: var(--c); }

/* janela do dia */
.dia-sec { padding: 0 0 18px; margin: 0 0 18px; border-bottom: 1px solid var(--border); }
.dia-sec:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.dia-sec-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.dia-sec-h h3 { font-family: var(--font-display); font-weight: 800; font-size: 16px; }
.dia-sec-h .btn svg { width: 16px; height: 16px; }
.tarefas { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tarefa { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center; padding: 10px 10px 10px 14px; border: 1px solid var(--border); border-left: 5px solid var(--c); border-radius: 10px; background: var(--surface); }
.t-corpo { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.t-corpo b { font-weight: 600; overflow-wrap: anywhere; }
.t-meta { font-size: 12.5px; color: var(--muted); }
.t-obs { font-size: 12.5px; color: var(--muted); font-style: italic; }
.t-status { min-height: 36px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--cb); color: var(--c); font: inherit; font-size: 13px; font-weight: 600; padding: 0 8px; max-width: 150px; }
.tarefa.st-CONCLUIDA .t-corpo b { text-decoration: line-through; text-decoration-color: rgba(23,128,90,.5); }
.dia-sec .form-grid { gap: 12px; }
.dia-sec select, .dia-sec textarea { width: 100%; font: inherit; border: 1px solid var(--border-strong); border-radius: var(--r-ctl); background: var(--surface); padding: 9px 12px; color: var(--text); }
.dia-sec select { min-height: 42px; }

@media (max-width: 720px) {
  .cal-mes { font-size: 20px; min-width: 0; flex: 1; }
  .cal-nav { width: 100%; }
  .cal-filtro { width: 100%; } .cal-filtro select { width: 100%; }
  .cal-head span { padding: 8px 2px; text-align: center; font-size: 11px; }
  .cal-cell { min-height: 62px; padding: 5px 3px 6px; align-items: center; gap: 4px; }
  .cal-top { flex-direction: column; gap: 2px; }
  .cal-ind { font-size: 10px; gap: 3px; }
  .cal-chips { display: none; }
  .cal-dots { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; max-width: 100%; }
  .cal-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
  .cal-dots em { font-size: 10px; font-style: normal; line-height: 7px; color: var(--muted); }
  .tarefa { grid-template-columns: 1fr auto auto; }
  .tarefa .t-corpo { grid-column: 1 / -1; }
  .tarefa .t-status { grid-column: 1; max-width: none; }
}

/* ===== E-mails ===== */
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; }
.mail { display: grid; grid-template-columns: 236px 360px minmax(0, 1fr); gap: 14px; height: calc(100vh - 200px); min-height: 520px; }
.mail > .card { padding: 0; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.mail-pastas { padding: 10px 8px !important; overflow-y: auto !important; display: block !important; }
.mail-pasta { appearance: none; width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; font: inherit; color: var(--text); padding: 9px 10px; border-radius: 9px; cursor: pointer; text-align: left; min-height: 40px; }
.mail-pasta svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.mail-pasta:hover { background: var(--surface-2); }
.mail-pasta.ativa { background: var(--pine); color: #fff; font-weight: 600; }
.mail-pasta.ativa svg { color: #fff; }
.mail-pasta-nome { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-cont { font-size: 11.5px; background: var(--accent); color: #fff; border-radius: 10px; padding: 1px 7px; }
.mail-tools { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.mail-pasta-sel { display: none; }
.mail-busca input, .mail-pasta-sel { width: 100%; min-height: 40px; border: 1px solid var(--border-strong); border-radius: var(--r-ctl); background: var(--surface); font: inherit; padding: 0 12px; color: var(--text); }
.mail-so-nao-lidas { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); min-height: 28px; cursor: pointer; }
.mail-so-nao-lidas input { width: 16px; height: 16px; accent-color: var(--pine-3); }
.mail-itens { flex: 1; overflow-y: auto; min-height: 0; }
.mail-item { appearance: none; width: 100%; display: flex; gap: 10px; text-align: left; border: 0; border-bottom: 1px solid var(--border); background: var(--surface); font: inherit; color: var(--text); padding: 11px 12px; cursor: pointer; position: relative; }
.mail-item:hover { background: var(--surface-2); }
.mail-item.ativa { background: var(--sel-bg); box-shadow: inset 4px 0 0 var(--accent); }
.mail-item.nao-lida::after { content: ''; position: absolute; right: 12px; bottom: 14px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.mail-item:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.mail-avatar { width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--pine); color: #fff; display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; }
.mail-avatar.grande { width: 42px; height: 42px; }
.mail-item-corpo { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.mail-item-topo { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.mail-quem { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-item.nao-lida .mail-quem, .mail-item.nao-lida .mail-assunto { font-weight: 700; }
.mail-item time { font-size: 12px; color: var(--muted); flex: none; }
.mail-assunto { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-item.nao-lida .mail-assunto { color: var(--text); }
.mail-marcas { display: flex; gap: 6px; color: var(--muted); }
.mail-marcas svg { width: 14px; height: 14px; }
.mail-marcas .estrela { color: #d9951a; }
.mail-mais { padding: 12px; text-align: center; border-top: 1px solid var(--border); }
.mail-mais:empty { display: none; }
.mail-fim { font-size: 12.5px; color: var(--muted); }
.mail-carregando, .mail-erro { padding: 28px 16px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 12px; align-items: center; }
.mail-erro { color: var(--red); }
.mail-vazio { margin: auto; text-align: center; color: var(--muted); padding: 24px; }
.mail-vazio svg { width: 48px; height: 48px; opacity: .45; }
.mail-leitor { overflow-y: auto !important; display: block !important; }
.leitor-topo { display: flex; align-items: flex-start; gap: 8px; padding: 16px 18px 6px; }
.leitor-topo .voltar { display: none; }
.leitor-assunto { font-family: var(--font-display); font-size: 21px; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.leitor-acoes { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 18px 12px; border-bottom: 1px solid var(--border); }
.leitor-acoes .btn svg { width: 16px; height: 16px; }
.mail-mover { min-height: 36px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); font: inherit; font-size: 13px; padding: 0 8px; color: var(--text); }
.leitor-meta { display: flex; gap: 12px; padding: 14px 18px; align-items: flex-start; }
.leitor-meta-txt { flex: 1; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.leitor-para { color: var(--muted); font-size: 13px; }
.mail-end { color: var(--muted); font-weight: 400; }
.leitor-data { font-size: 12.5px; color: var(--muted); flex: none; }
.leitor-anexos { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 12px; }
.chip-anexo { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); background: var(--surface-2); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--text); max-width: 100%; }
.chip-anexo svg { width: 15px; height: 15px; color: var(--accent-strong); flex: none; }
.chip-anexo span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.chip-anexo small { color: var(--muted); }
.chip-x { border: 0; background: transparent; font-size: 18px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 2px; }
.chip-x:hover { color: var(--red); }
.leitor-aviso { margin: 0 18px 10px; padding: 9px 12px; border-radius: 9px; background: var(--amber-bg); color: var(--aviso-txt); font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.leitor-corpo { display: block; width: 100%; border: 0; min-height: 160px; padding: 0 18px 18px; box-sizing: border-box; background: transparent; }
.mail-config { max-width: 760px; padding: 26px 28px; }
.leitor-acoes .mail-mover { width: auto; max-width: 170px; flex: 0 1 auto; }
.leitor-acoes .icon-btn { flex: none; }
.mail-config h2 { font-family: var(--font-display); font-size: 22px; margin-bottom: 6px; }
.mail-config .form-grid { margin-top: 14px; }
.mail-aviso { margin-top: 8px; padding: 10px 12px; border-radius: 9px; background: var(--amber-bg); color: var(--aviso-txt); font-size: 13px; }
.mail-avancado summary { cursor: pointer; font-weight: 600; min-height: 36px; display: flex; align-items: center; }
.mail-porta { display: grid; grid-template-columns: 1fr 130px; gap: 8px; }
.mail-porta input, .mail-porta select, .mail-config select, .mail-config input, .mail-config textarea { width: 100%; font: inherit; border: 1px solid var(--border-strong); border-radius: var(--r-ctl); background: var(--surface); padding: 9px 12px; min-height: 42px; color: var(--text); box-sizing: border-box; }
.mail-check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; cursor: pointer; }
.mail-check input { width: 18px !important; min-height: 18px !important; margin-top: 2px; flex: none; accent-color: var(--pine-3); }
.mail-resultado { font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.mail-resultado:empty { display: none; }
.mail-resultado.ok { color: var(--green); } .mail-resultado.falha { color: var(--red); }
.mail-config-acoes { display: flex; flex-wrap: wrap; gap: 10px; }
.btn.danger-ghost { background: transparent; color: var(--red); border: 1px solid var(--red); margin-left: auto; }
.btn.danger-ghost:hover { background: var(--red-bg); }
.mail-link { appearance: none; border: 0; background: transparent; color: var(--blue); font: inherit; font-size: 13px; cursor: pointer; padding: 6px 0 0; text-align: left; }
.mail-anexar .btn { margin-top: 6px; }
.mail-arqs { display: flex; flex-wrap: wrap; gap: 8px; }
.mail-arqs:empty { display: none; }
#f_corpo { font-family: inherit; line-height: 1.5; }

@media (max-width: 1100px) { .mail { grid-template-columns: 200px 300px minmax(0, 1fr); } }
@media (max-width: 860px) {
  .mail-config { padding: 18px 16px; }
  .mail { display: block; height: auto; min-height: 0; }
  .mail-pastas { display: none !important; }
  .mail-pasta-sel { display: block; }
  .mail .mail-itens { max-height: none; overflow: visible; }
  .mail > .card { overflow: visible; }
  .mail[data-vista="lista"] .mail-leitor { display: none !important; }
  .mail[data-vista="leitor"] .mail-lista { display: none; }
  .leitor-topo .voltar { display: inline-grid; flex: none; }
  .leitor-assunto { font-size: 18px; }
  .leitor-meta { flex-wrap: wrap; }
  .leitor-data { width: 100%; padding-left: 54px; }
  .leitor-acoes, .leitor-topo, .leitor-meta, .leitor-anexos { padding-left: 14px; padding-right: 14px; }
  .leitor-aviso { margin-left: 14px; margin-right: 14px; }
  .leitor-corpo { padding: 0 14px 18px; }
  .mail-porta { grid-template-columns: 1fr 120px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Compras com vários itens ---------- */
.modal.wide { width: min(940px, calc(100vw - 24px)); }
@media (max-width: 760px) { .modal.wide { width: 100vw; } }
.form-sec { grid-column: 1 / -1; font-size: 13.5px; font-weight: 700; color: var(--text-soft, #4c5b54); letter-spacing: .01em;
  margin: 6px 0 -4px; padding-top: 14px; border-top: 1px solid var(--border); }
.form-grid > .form-sec:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
.link-btn:hover { text-decoration-color: currentColor; }
.itens-ed { border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); padding: 10px; }
.itens-list { display: flex; flex-direction: column; gap: 8px; }
.item-row { display: grid; grid-template-columns: minmax(0, 2.6fr) minmax(0, .8fr) minmax(0, .8fr) minmax(0, 1.1fr) minmax(0, 1.1fr) 36px; gap: 8px; align-items: end;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.item-row .ic { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.item-row .ic span { font-size: 12px; font-weight: 600; color: var(--muted, #5b6a63); }
.item-row input { width: 100%; min-width: 0; }
.item-row .item-rm { align-self: end; margin-bottom: 2px; }
.item-note { grid-column: 1 / -1; font-size: 12.5px; color: var(--amber); }
.itens-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.itens-tot { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13.5px; color: var(--muted, #5b6a63); }
.itens-tot b, .iv-tot b { color: var(--text); }
.itens-total { font-size: 15px; }
@media (max-width: 760px) {
  .item-row { grid-template-columns: 1fr 1fr; }
  .item-row .ic-desc { grid-column: 1 / -1; }
  .item-row .item-rm { grid-column: 1 / -1; justify-self: end; width: auto; }
}
.iv-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; font-size: 14px; }
.iv-head span { color: var(--muted, #5b6a63); font-size: 13px; }
.iv-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.iv-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.iv-row:last-child { border-bottom: 0; }
.iv-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.iv-main span { font-size: 13px; color: var(--muted, #5b6a63); }
.iv-est { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.iv-est small { font-size: 12px; color: var(--muted, #5b6a63); }
.iv-tot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 18px; margin-top: 12px; font-size: 14px; color: var(--muted, #5b6a63); }
@media (max-width: 760px) { .iv-row { grid-template-columns: 1fr auto; } .iv-row > button { grid-column: 1 / -1; } }

/* ---------- Prazos no calendário ---------- */
.cal-filtro { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cal-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.cal-toggle input { width: 16px; height: 16px; accent-color: var(--pine-3); }
.cal-chip.pz { --c: var(--pc); --cb: var(--surface); color: var(--pc); background: var(--surface); border: 1px solid color-mix(in srgb, var(--pc) 35%, transparent); border-left: 3px solid var(--pc); padding: 1px 5px; }
.cal-chip.pz.pz-ATRASADO { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.cal-chip.pz.pz-CONCLUIDO { color: var(--muted); border-color: var(--border); text-decoration: line-through; opacity: .85; }
.cal-cell.pz-atraso .cal-num { box-shadow: 0 0 0 2px var(--red); }
.cal-legenda i.pz-leg { background: var(--surface); border: 2px solid var(--pc); border-radius: 3px; width: 12px; height: 12px; }
.cal-dots i.pz-dot { background: transparent; border: 2px solid var(--pc); border-radius: 2px; width: 7px; height: 7px; box-sizing: border-box; }
.cal-dots i.pz-dot.pz-ATRASADO { background: var(--red); border-color: var(--red); }
.cal-agenda { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 12px; padding: 12px 14px; margin: 0 0 12px; }
.cal-agenda[hidden] { display: none; }
.ag-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; font-size: 14px; margin-bottom: 8px; }
.ag-head span { font-size: 13px; color: var(--muted); }
.ag-atraso { color: var(--red); font-style: normal; font-weight: 700; }
.ag-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 6px 10px; }
.ag-item { appearance: none; width: 100%; display: flex; gap: 10px; align-items: baseline; text-align: left; font: inherit; font-size: 13.5px; color: var(--text); background: var(--surface-2); border: 0; border-left: 3px solid var(--pc); border-radius: 7px; padding: 7px 10px; cursor: pointer; min-width: 0; }
.ag-item:hover { background: var(--hover-bg); box-shadow: 0 0 0 1px var(--border-strong); }
.ag-item.pz-ATRASADO { background: var(--red-bg); }
.ag-quando { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.ag-quando small { font-weight: 500; color: var(--muted); }
.ag-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-mais { margin-top: 8px; font-size: 13px; color: var(--pine-3); }
.prazos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.prazo { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-left: 5px solid var(--pc); border-radius: 10px; background: var(--surface); }
.prazo-tag { font-size: 12px; font-weight: 700; color: var(--pc); min-width: 56px; }
.prazo-sit { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.prazo.pz-ATRASADO { background: var(--red-bg); } .prazo.pz-ATRASADO .prazo-sit { color: var(--red); }
.prazo.pz-CONCLUIDO .t-corpo b { text-decoration: line-through; text-decoration-color: var(--border-strong); }
@media (max-width: 720px) {
  .cal-filtro { width: 100%; justify-content: space-between; }
  .prazo { grid-template-columns: auto 1fr; } .prazo .btn { grid-column: 1 / -1; } .prazo-sit { grid-column: 2; }
  .ag-list { grid-template-columns: 1fr; }
}
.field.invalid .itens-ed { border-color: var(--red); }
.field.invalid .itens-ed .item-row input { border-color: var(--border-strong); box-shadow: none; background: var(--surface); }

/* ---------- Janela do dia no formato do RDO ---------- */
.dia-rdo-info { margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.dia-rdo-info b { color: var(--pine-3); }
.lin-list { display: flex; flex-direction: column; gap: 8px; }
.lin-list:empty { display: none; }
.lin-row { display: grid; gap: 8px; align-items: end; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 9px 10px; }
.ef-row { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.2fr) minmax(0, 2fr) 64px auto 36px; }
.vi-row { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.1fr) minmax(0, 2.2fr) 110px 36px; }
.lin-row .ic { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.lin-row .ic span { font-size: 12px; font-weight: 600; color: var(--muted); }
.lin-row input:not([type=checkbox]) { width: 100%; min-width: 0; min-height: 38px; border: 1px solid var(--border-strong); border-radius: var(--r-ctl); background: var(--surface); padding: 0 10px; font: inherit; color: var(--text); }
.ic-chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); min-height: 38px; white-space: nowrap; cursor: pointer; }
.ic-chk input { width: 16px; height: 16px; accent-color: var(--pine-3); }
.lin-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.lin-tot { font-size: 13.5px; color: var(--muted); } .lin-tot b { color: var(--text); }
.sst { display: grid; grid-template-columns: minmax(0, 1.2fr) 110px minmax(0, 2fr); gap: 8px 10px; align-items: center; }
.sst label { font-size: 14px; font-weight: 500; }
.sst select, .sst input { width: 100%; min-height: 40px; font: inherit; border: 1px solid var(--border-strong); border-radius: var(--r-ctl); background: var(--surface); padding: 0 10px; color: var(--text); }
.dia-sec input:not([type=checkbox]):not([type=file]) { width: 100%; min-height: 42px; font: inherit; border: 1px solid var(--border-strong); border-radius: var(--r-ctl); background: var(--surface); padding: 0 12px; color: var(--text); }
@media (max-width: 760px) {
  .ef-row, .vi-row { grid-template-columns: 1fr 1fr; }
  .lin-row .ic-larga { grid-column: 1 / -1; }
  .ef-row .ic-chk { justify-self: start; }
  .lin-row [data-linrm] { justify-self: end; }
  .sst { grid-template-columns: 1fr 110px; }
  .sst input { grid-column: 1 / -1; margin-bottom: 6px; }
}


/* ---------- Ferramentas do menu: tema e recolher ---------- */
.side-tools { display: flex; flex-direction: column; gap: 2px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.12); }
.side-tool { appearance: none; display: flex; align-items: center; gap: 12px; min-height: 38px; padding: 7px 12px; border: 0; border-radius: var(--r-ctl);
  background: transparent; color: var(--side-text); font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; text-align: left; width: 100%; }
.side-tool:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-tool svg { width: 18px; height: 18px; flex: none; }
.side-tool .ic-sol { display: none; }
:root[data-theme="dark"] .side-tool .ic-sol { display: block; }
:root[data-theme="dark"] .side-tool .ic-lua { display: none; }
.sidebar { transition: width .2s ease, flex-basis .2s ease, padding .2s ease; }

@media (min-width: 901px) {
  .side-mini .sidebar { width: 76px; flex-basis: 76px; padding: 22px 10px 16px; overflow-x: hidden; }
  .side-mini .brand { justify-content: center; padding: 2px 0 24px; }
  .side-mini .brand > div:not(.brand-mark) { display: none; }
  .side-mini .nav a { font-size: 0; justify-content: center; padding: 10px 0; gap: 0; }
  .side-mini .nav a svg { width: 21px; height: 21px; }
  .side-mini .nav a.active::before { left: -10px; }
  .side-mini .nav-badge { position: absolute; top: 4px; right: 6px; min-width: 18px; height: 18px; font-size: 10.5px; padding: 0 5px; margin: 0; }
  .side-mini .user-box { justify-content: center; }
  .side-mini .user-info { display: none; }
  .side-mini .side-tool { justify-content: center; padding: 9px 0; }
  .side-mini .side-tool span { display: none; }
  .side-mini #miniBtn svg { transform: scaleX(-1); }
  .side-mini .foot-btns { grid-template-columns: 1fr; }
  .side-mini .sidebar-foot .btn.ghost { font-size: 12px; padding: 6px 0; min-height: 32px; }
}
@media (max-width: 900px) { .so-desktop { display: none; } }
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* ---------- Câmera ---------- */
.cam-box { width: min(760px, calc(100vw - 24px)); }
.cam-area { position: relative; background: #000; aspect-ratio: 16 / 10; display: grid; place-items: center; overflow: hidden; }
.cam-area video, .cam-area img { width: 100%; height: 100%; object-fit: contain; display: block; }
.cam-msg { position: absolute; inset: auto 16px 16px; padding: 10px 14px; border-radius: 10px; background: rgba(0,0,0,.7); color: #fff; font-size: 14px; text-align: center; }
.cam-foot { flex-wrap: wrap; align-items: center; }
.cam-esp { flex: 1; }
.cam-disparo svg { width: 18px; height: 18px; }
.anexo-desc { color: var(--text) !important; font-weight: 500; }

/* ---------- Lançar pela nota ---------- */
.nota-opcoes { display: flex; flex-direction: column; gap: 12px; }
.nota-op { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; }
label.nota-op:hover { border-color: var(--pine-3); background: var(--hover-bg); }
div.nota-op { cursor: default; }
.nota-op.desativada { opacity: .7; }
.nota-ic { flex: none; width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); }
.nota-ic svg { width: 20px; height: 20px; }
.nota-txt { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.nota-txt b { font-size: 15px; }
.nota-txt small { color: var(--muted); font-size: 13px; line-height: 1.45; }
.nota-pick { margin-top: 8px; }
.nota-status { padding: 10px 14px; border-radius: 10px; background: var(--blue-bg); color: var(--info-txt); font-weight: 500; }

/* ---------- Importar planilha ---------- */
.imp { display: flex; flex-direction: column; gap: 14px; }
.imp-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 24px 16px; border: 2px dashed var(--border-strong); border-radius: 14px; cursor: pointer; color: var(--muted); background: var(--surface-2); }
.imp-drop:hover, .imp-drop.sobre { border-color: var(--accent); background: var(--hover-bg); }
.imp-drop svg { width: 26px; height: 26px; color: var(--accent-strong); }
.imp-drop b { color: var(--text); font-size: 15px; }
.imp-drop span { font-size: 13px; max-width: 520px; }
.imp-modelo { align-self: flex-start; font-size: 13px; color: var(--pine-3); }
.imp-arq { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; }
.imp-arq svg { width: 16px; height: 16px; color: var(--accent-strong); }
.imp-arq span { color: var(--muted); }
.imp-h { font-size: 14px; margin: 6px 0 0; }
.imp-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.imp-campo { display: flex; flex-direction: column; gap: 4px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.imp-campo.ok { border-color: color-mix(in srgb, var(--green) 45%, var(--border)); }
.imp-campo.obrig:not(.ok) { border-color: var(--red); background: var(--invalid-bg); }
.imp-nome { font-size: 13px; font-weight: 600; }
.imp-campo select { min-height: 38px; font-size: 13.5px; }
.imp-campo small { color: var(--muted); font-size: 12px; min-height: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-chk { display: flex; gap: 8px; align-items: center; font-size: 13.5px; }
.imp-chk input { width: 16px; height: 16px; accent-color: var(--pine-3); }
.imp-resumo { padding: 10px 14px; border-radius: 10px; background: var(--green-bg); color: var(--text); font-size: 14px; }
.imp-resumo.tem-erro { background: var(--amber-bg); }
.imp-erros { margin: 0; padding-left: 20px; font-size: 13px; color: var(--red); display: flex; flex-direction: column; gap: 2px; }
.imp-prev { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.imp-prev table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.imp-prev th, .imp-prev td { padding: 7px 9px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.imp-prev th { background: var(--surface-2); font-weight: 600; }

/* ---------- Solicitações de compra ---------- */
.sol-row { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1.7fr) minmax(0, .7fr) minmax(0, .7fr) 36px; }
@media (max-width: 760px) { .sol-row .ic-esp { grid-column: 1 / -1; } }
.sol-cab { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.sol-cab-l { display: flex; flex-wrap: wrap; gap: 6px; }
.sol-dados { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px 16px; margin: 0; }
.sol-dados div { min-width: 0; }
.sol-dados .larga { grid-column: 1 / -1; }
.sol-dados dt { font-size: 12px; color: var(--muted); font-weight: 600; }
.sol-dados dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.sol-decisao { padding: 10px 14px; border-radius: 10px; background: var(--green-bg); font-size: 13.5px; }
.sol-decisao.neg { background: var(--red-bg); }
.sol-botoes { display: flex; flex-wrap: wrap; gap: 8px; }
.sol-botoes .btn svg { width: 16px; height: 16px; }
.mapa-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.mapa { width: 100%; border-collapse: collapse; font-size: 13px; }
.mapa th, .mapa td { padding: 9px 11px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.mapa thead th { background: var(--surface-2); font-weight: 700; white-space: nowrap; }
.mapa td small, .mapa th small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 400; }
.mapa td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mapa .mc-melhor { background: var(--green-bg); color: var(--green); font-weight: 700; }
.mapa tfoot th { text-align: right; font-weight: 600; color: var(--muted); background: var(--surface-2); }
.mapa tfoot td { background: var(--surface-2); }
.mapa .mc-tot td, .mapa .mc-tot th { color: var(--text); font-size: 14px; }
.mc-total-melhor { color: var(--green); }
.mc-total-melhor::after { content: ' ✓'; }
.mc-forn { min-width: 150px; }
.mc-acoes { display: inline-flex; gap: 2px; margin-left: 6px; vertical-align: middle; }
.mc-acoes .icon-btn { width: 28px; height: 28px; }
.mc-acoes .icon-btn svg { width: 15px; height: 15px; }
.mc-economia { margin: 10px 0 0; padding: 10px 14px; border-radius: 10px; background: var(--green-bg); font-size: 13.5px; }
.cot-lista, .gc-lista { display: flex; flex-direction: column; gap: 8px; }
.cot-row, .gc-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(90px, .6fr); gap: 10px; align-items: end; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.gc-row { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.3fr) minmax(96px, .55fr); }
.gc-row .gc-outro { grid-column: 2 / -1; }
.gc-enc { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--aviso-txt); cursor: pointer; }
.gc-enc[hidden] { display: none; }
.gc-row .gc-enc input { width: 16px; height: 16px; min-width: 16px; accent-color: var(--pine-3); flex: none; margin: 0; }
.gc-compras { display: flex; flex-direction: column; gap: 12px; }
.gc-card { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
.gc-card-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 10px 14px; background: var(--gray-bg); border-bottom: 1px solid var(--border); }
.gc-card-h b { font-size: 14.5px; }
.gc-tot { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.gc-tot b { color: var(--text); }
.gc-campos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; padding: 12px 14px 14px; }
.gc-c { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.gc-c[hidden] { display: none; }
.gc-c span { font-size: 12px; font-weight: 600; color: var(--muted); }
.gc-c input, .gc-c select, .gc-c textarea { width: 100%; min-width: 0; }
.gc-c textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--r-ctl); background: var(--input-bg); color: var(--text); resize: vertical; }
.gc-c.larga { grid-column: 1 / -1; }
.cot-item { display: flex; flex-direction: column; gap: 2px; min-width: 0; align-self: center; }
.cot-item small { color: var(--muted); font-size: 12.5px; }
.cot-row .ic, .gc-row .ic { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cot-row .ic span, .gc-row .ic span { font-size: 12px; font-weight: 600; color: var(--muted); }
.cot-row input, .gc-row input, .gc-row select { width: 100%; min-width: 0; }
.cot-sub { align-self: center; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.cot-total { margin-top: 10px; justify-content: flex-end; }
.gc-outro { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gc-outro[hidden] { display: none; }
.gc-resumo { margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: var(--blue-bg); color: var(--text); font-size: 13.5px; }
.gc-resumo ul { margin: 6px 0 0; padding-left: 18px; }
.msg-cot { width: 100%; font: inherit; font-size: 13.5px; line-height: 1.5; padding: 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--input-bg); color: var(--text); resize: vertical; }
@media (max-width: 760px) {
  .cot-row, .gc-row { grid-template-columns: 1fr; }
  .cot-sub { text-align: left; }
  .gc-outro { grid-template-columns: 1fr; }
  .gc-row .gc-outro { grid-column: auto; }
  .gc-campos { grid-template-columns: 1fr 1fr; }
}

/* ===== Tipo dos documentos anexados (nota fiscal, boleto, comprovante...) ===== */
.anexo-grupo { margin-bottom: 6px; }
.anexo-grupo h4 { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px; font: 700 14px/1.2 var(--font-display); color: var(--text); }
.anexo-grupo h4 span { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--gray-bg); color: var(--gray-txt); font: 600 12px/1.5 var(--font-body); text-align: center; }
.anexo-grupo.sem-tipo h4 { color: var(--aviso-txt); }
.anexo-grupo.sem-tipo h4 span { background: var(--amber-bg); color: var(--amber); }
.anexo-grupo.sem-tipo > .note { margin: -4px 0 10px; }
.anexo.sem-tipo { border-color: var(--amber); border-style: dashed; }
.anexo-tipo { width: 100%; margin: 0 0 6px; padding: 5px 26px 5px 8px; min-height: 32px; font-size: 12.5px; font-weight: 600; color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--input-bg) var(--seta) no-repeat right 6px center / 14px; appearance: none; -webkit-appearance: none; cursor: pointer; }
.anexo.sem-tipo .anexo-tipo { border-color: var(--amber); color: var(--aviso-txt); }
.anexo-tipo:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.doc-tipos { border: 0; margin: 0 0 12px; padding: 0; min-width: 0; }
.doc-tipos legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--label); }
.doc-tipos-op { display: flex; flex-wrap: wrap; gap: 6px; }
.doc-op { position: relative; cursor: pointer; }
.doc-op input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.doc-op span { display: inline-block; padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 999px; font-size: 13px; color: var(--text); background: var(--surface); transition: background .12s, border-color .12s; }
.doc-op:hover span { background: var(--hover-bg); border-color: var(--pine-3); }
.doc-op input:checked + span { background: var(--pine-2); border-color: var(--pine-2); color: #fff; font-weight: 600; }
.doc-op input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.doc-chips { display: flex; flex-wrap: wrap; gap: 4px; min-width: 112px; }
.doc-chip { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 999px; border: 1px solid transparent;
  font: 600 11.5px/1.6 var(--font-body); cursor: pointer; white-space: nowrap; background: none; }
.doc-chip svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.doc-chip.ok { background: var(--green-bg); color: var(--green); }
.doc-chip.falta { border-color: var(--amber); border-style: dashed; color: var(--aviso-txt); background: var(--amber-bg); }
.doc-chip.dispensado { border-color: var(--border-strong); border-style: dashed; color: var(--muted); }
.doc-chip.semtipo { background: var(--gray-bg); color: var(--gray-txt); }
.doc-chip:hover { filter: brightness(.96); }
.doc-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (max-width: 760px) { .doc-chip { padding: 4px 10px; font-size: 12.5px; } }
:root[data-theme="dark"] .doc-op input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ===== Perfis de acesso: resumo e matriz de permissões ===== */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.perm-chips { display: flex; flex-wrap: wrap; gap: 4px; max-width: 560px; }
.perm-chip { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--gray-bg); color: var(--gray-txt); font-size: 12px; line-height: 1.6; }
.perm-chip b { font-weight: 600; color: var(--text); }
.perm-chip.full { background: var(--green-bg); color: var(--green); }
.pm-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.pm-tab { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 620px; }
.pm-tab th, .pm-tab td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: center; vertical-align: middle; background: none; }
.pm-tab thead th:first-child { text-align: left; }
.pm-tab thead th { background: var(--gray-bg) !important; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.pm-tab tbody th { text-align: left; font-weight: 600; white-space: nowrap; }
.pm-tab tbody tr:last-child th, .pm-tab tbody tr:last-child td { border-bottom: 0; }
.pm-tab tbody tr:hover { background: var(--hover-bg); }
.pm-na { color: var(--border-strong); }
.pm-tudo { border-left: 1px solid var(--border); }
.pm-cel { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 32px; cursor: pointer; vertical-align: middle; margin: 0; }
.pm-cel input { width: 18px; height: 18px; accent-color: var(--pine-3); cursor: pointer; }
.pm-cel input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pm-legenda { margin: 12px 0 0; padding-left: 18px; columns: 2; column-gap: 28px; font-size: 12.5px; color: var(--muted); }
.pm-legenda li { break-inside: avoid; margin-bottom: 4px; }
.pm-legenda b { color: var(--text); font-weight: 600; }
@media (max-width: 760px) { .pm-legenda { columns: 1; } }


/* ======================================================================
   Prancha de obra — camada de identidade (sobrepõe o visual anterior)
   ====================================================================== */
body { font-size: 14.5px; letter-spacing: .002em; }

/* ---------- Menu: folha clara presa ao concreto, sem "bloco escuro" ---------- */
.sidebar { background: var(--surface); background-image: none; color: var(--side-text); border-right: 1px solid var(--border); padding: 22px 12px 14px; }
.brand { padding: 2px 8px 26px; gap: 11px; }
.brand-mark { width: 38px; height: 38px; border-radius: 4px; clip-path: none; box-shadow: inset 0 -3px 0 rgba(0,0,0,.16); }
.brand-name { color: var(--text); font-stretch: 72%; font-size: 22px; letter-spacing: .01em; }
.brand-sub { color: var(--muted); font-size: 12px; }
.nav { gap: 1px; }
.nav a { min-height: 40px; padding: 8px 12px; color: var(--side-text); border-radius: 6px; font-weight: 500; }
.nav a svg { width: 18px; height: 18px; opacity: .75; }
.nav a:hover { background: var(--gray-bg); color: var(--text); }
.nav a.active { background: var(--pine); color: #fff; font-weight: 600; }
.nav a.active::before { display: none; }
.nav a.active svg { color: var(--accent); opacity: 1; }
.sidebar-foot .nav { border-top: 1px solid var(--border); }
.side-tools { border-top: 1px solid var(--border); }
.side-tool { color: var(--side-text); }
.side-tool:hover { background: var(--gray-bg); color: var(--text); }
.user-avatar { background: var(--pine); color: #fff; border-radius: 6px; }
.user-name { color: var(--text); }
.user-email { color: var(--muted); }
.sidebar-foot .btn.ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.sidebar-foot .btn.ghost:hover { background: var(--gray-bg); }
:root[data-theme="dark"] .nav a.active { background: #e6eae7; color: #121614; }
:root[data-theme="dark"] .user-avatar { background: #2c3431; }

/* ---------- Cabeçalho = carimbo da prancha ---------- */
.topbar {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "titulo carimbo" "acoes acoes";
  align-items: end; gap: 14px 18px; padding: 30px 36px 20px;
}
.topbar::after { display: none; }
.topbar > .menu-btn { grid-area: menu; }
.topbar > div:not(.topbar-actions):not(.carimbo) { grid-area: titulo; min-width: 0; }
.topbar h1 { font-stretch: 68%; font-weight: 800; font-size: 44px; line-height: .95; letter-spacing: -.01em; }
.topbar #pageSub { font-size: 14px; margin-top: 8px; }
.topbar-actions { grid-area: acoes; margin-left: 0; justify-content: flex-end; }
.carimbo { grid-area: carimbo; display: grid; grid-auto-flow: column; border: 1px solid var(--text); border-radius: 3px; background: var(--surface); align-self: start; }
.carimbo > div { display: flex; flex-direction: column; justify-content: center; padding: 7px 14px 8px; min-width: 92px; }
.carimbo > div + div { border-left: 1px solid var(--text); }
.carimbo span { font-size: 11.5px; color: var(--muted); line-height: 1.2; }
.carimbo b { font-family: var(--font-display); font-stretch: 72%; font-weight: 800; font-size: 22px; line-height: 1.05; font-variant-numeric: tabular-nums; white-space: nowrap; }
.carimbo .car-dia b { color: var(--accent); }
.view { padding: 6px 36px 56px; }

.btn-filtros { display: none; }

/* ---------- Superfícies mais calmas ---------- */
.card, .table-wrap { border-color: var(--border); border-radius: 10px; box-shadow: 0 1px 0 rgba(26, 31, 29, .04); }
:root { --r-panel: 10px; --r-ctl: 6px; }
th { background: transparent; border-bottom: 1px solid var(--text); font-size: 12.5px; color: var(--muted); padding: 14px 10px 10px; }
:root[data-theme="dark"] th { border-bottom-color: var(--border-strong); }
td { border-bottom-color: var(--border); padding: 13px 10px; }
.table-foot { background: transparent; }
.badge { border-radius: 4px; font-weight: 600; }
.badge::before { border-radius: 50%; width: 6px; height: 6px; }
.btn { border-radius: 6px; }
.btn.primary { box-shadow: inset 0 -2px 0 rgba(0,0,0,.16); }
.btn.ghost { background: var(--surface); border-color: var(--border-strong); }
.btn.ghost:hover { border-color: var(--text); background: var(--surface); }
.segmented { background: var(--surface-2); border-radius: 8px; }
.segmented button { border-radius: 5px; }
.stat-pill { background: var(--surface); border-radius: 8px; }
.kpi .label::before { border-radius: 50%; }
.hero { border-radius: 10px; background-image: radial-gradient(480px 200px at 100% 0%, rgba(235, 91, 19, .26), transparent 70%); }
.split::after { display: none; }
.modal { border-radius: 12px; }
.modal-head h2 { font-stretch: 74%; font-size: 24px; letter-spacing: -.005em; }
.modal-foot { background: var(--surface); border-radius: 0 0 12px 12px; }
.modal::backdrop { background: rgba(16, 20, 18, .55); }
input, select, textarea { border-radius: 6px; }
input:focus, select:focus, textarea:focus { border-color: var(--text); box-shadow: 0 0 0 3px rgba(235, 91, 19, .18); }

/* ---------- Entrada (login) ---------- */
.auth { background-color: var(--bg); background-image: none; }
.auth-card { border: 1px solid var(--border); box-shadow: 0 24px 60px rgba(26, 31, 29, .14); border-radius: 12px; }
.auth-card::before { display: none; }
.auth-brand .brand-name { color: var(--text) !important; }

/* ---------- Tablet e celular ---------- */
@media (max-width: 900px) {
  .sidebar { box-shadow: none; }
  .sidebar.open { box-shadow: 0 0 0 100vmax rgba(16, 20, 18, .5); }
  .topbar { padding: 20px 20px 16px; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "menu titulo carimbo" "acoes acoes acoes"; }
  .view { padding: 4px 20px 56px; }
}
@media (max-width: 720px) {
  .topbar { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "titulo carimbo" "acoes acoes"; padding: 18px 16px 14px; gap: 12px; }
  .topbar h1 { font-size: 34px; }
  .topbar #pageSub { font-size: 13px; margin-top: 6px; }
  .topbar-actions { justify-content: stretch; }
  .carimbo .car-hoje { display: none; }
  .carimbo > div { min-width: 0; padding: 6px 10px 7px; }
  .carimbo b { font-size: 20px; }
  .view { padding: 2px 16px calc(96px + var(--safe-b)); }
  .kpi .value { font-size: clamp(18px, 5.4vw, 24px); letter-spacing: -.02em; }
  /* filtros recolhidos atrás do botão "Filtros" */
  .toolbar.tem-filtros { grid-template-columns: minmax(0, 1fr) auto; }
  .toolbar.tem-filtros .search { grid-column: auto; }
  .toolbar.tem-filtros > :not(.search):not(.btn-filtros) { grid-column: 1 / -1; }
  .toolbar.tem-filtros:not(.aberto) > select { display: none; }
  .btn-filtros { display: inline-flex; min-height: 42px; padding: 8px 14px; }
  .btn-filtros[aria-expanded="true"] { border-color: var(--text); }
  .filtros-n { font-style: normal; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; }
  /* ações da tela: secundárias lado a lado, a principal em destaque embaixo */
  .topbar-actions .btn.ghost { flex: 1 1 0; min-width: 0; padding: 8px 8px; font-size: 13px; min-height: 42px; }
  .topbar-actions .btn.ghost svg { display: none; }
  .topbar-actions .btn.ghost { white-space: nowrap; }
  .topbar-actions .btn.primary { flex: 1 1 100%; min-height: 46px; }
  .topbar-actions select { flex: 1 1 100%; }
  .tabbar { background: var(--surface); border-top: 1px solid var(--border); box-shadow: none; padding: 4px 4px calc(4px + var(--safe-b)); }
  .tabbar a, .tabbar button { color: var(--muted); min-height: 54px; border-radius: 8px; }
  .tabbar a.active { color: var(--text); background: transparent; }
  .tabbar a.active svg { color: var(--accent); }
  .tabbar a.active::before { left: 32%; right: 32%; height: 3px; background: var(--accent); }
}

/* ---------- Central de relatórios ---------- */
.rc { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: start; }
.rc-cat { position: sticky; top: 16px; display: grid; gap: 18px; max-height: calc(100vh - 32px); overflow: auto; padding-right: 4px; }
.rc-grupo h3 { font-family: var(--font-display); font-stretch: 80%; font-weight: 800; font-size: 15px; margin: 0 0 6px; padding-bottom: 6px; border-bottom: 1px solid var(--text); }
.rc-item { display: grid; gap: 2px; width: 100%; text-align: left; padding: 9px 10px 9px 12px; border: 0; border-left: 3px solid transparent; background: transparent; color: var(--text); cursor: pointer; border-radius: 0 6px 6px 0; font: inherit; }
.rc-item b { font-size: 14.5px; font-weight: 600; }
.rc-item span { font-size: 12.5px; color: var(--muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rc-item:hover { background: var(--surface); }
.rc-item.active { border-left-color: var(--accent); background: var(--surface); }
.rc-item.active b { font-weight: 700; }
.rc-item.loading { opacity: .55; cursor: progress; }
.rc-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.rc-main { min-width: 0; display: grid; gap: 14px; }
.rc-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 20px; align-items: end; }
.rc-voltar { display: none; justify-self: start; }
.rc-voltar svg { width: 16px; height: 16px; }
.rc-area { font-size: 12.5px; color: var(--accent); font-weight: 600; }
.rc-tit h2 { font-family: var(--font-display); font-stretch: 74%; font-weight: 800; font-size: 30px; line-height: 1; margin: 2px 0 6px; letter-spacing: -.005em; }
.rc-tit p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; max-width: 70ch; }
.rc-acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.rc-filtros { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.rc-data { display: grid; gap: 3px; font-size: 12.5px; color: var(--muted); }
.rc-data input { min-height: 38px; }
.rc-per { margin: -4px 0 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rc-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.rc-sum .stat-pill b { font-size: 24px; overflow-wrap: anywhere; }
.rc-graf .card-title { margin-bottom: 14px; }
.rc-graf .bars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 28px; }
.rc-graf .bar-name { display: inline-flex; gap: 8px; align-items: center; min-width: 0; }
.rc-tab th { padding: 0; white-space: nowrap; }
.rc-tab th button { all: unset; box-sizing: border-box; display: block; width: 100%; padding: 14px 10px 10px; cursor: pointer; font: inherit; color: inherit; }
.rc-tab th.num button { text-align: right; }
.rc-tab th button:hover { color: var(--text); }
.rc-tab th button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.rc-tab td { font-size: 13.5px; vertical-align: top; padding: 11px 8px; }
.rc-tab th button { padding-left: 8px; padding-right: 8px; }
.rc-tab td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rc-tab td.larga { min-width: 240px; }
.rc-tab tfoot td { font-weight: 700; border-top: 1px solid var(--text); border-bottom: 0; background: var(--surface-2); padding: 12px 10px; }
.rc-vazio { color: var(--muted); }
.rc-sobe { color: var(--red); font-weight: 600; }
.rc-desce { color: var(--green); font-weight: 600; }
.rc-nota { margin: 0; }
.rc-print-head { display: none; }

@media (max-width: 1100px) {
  .rc { grid-template-columns: 240px minmax(0, 1fr); gap: 20px; }
  .rc-graf .bars { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .rc { grid-template-columns: 1fr; }
  .rc-cat { position: static; max-height: none; overflow: visible; padding: 0; }
  .rc[data-vista="cat"] .rc-main { display: none; }
  .rc[data-vista="rep"] .rc-cat { display: none; }
  .rc-item { padding: 12px 12px 12px 14px; background: var(--surface); border: 1px solid var(--border); border-left-width: 3px; border-radius: 0 8px 8px 0; margin-bottom: 8px; }
  .rc-item span { -webkit-line-clamp: 3; }
  .rc-item.active { border-left-color: var(--border); }
  .rc-head { grid-template-columns: 1fr; align-items: start; }
  .rc-voltar { display: inline-flex; }
  .rc-acts { justify-content: stretch; }
  .rc-acts .btn { flex: 1 1 0; min-height: 44px; justify-content: center; }
}
@media (max-width: 720px) {
  .rc-tit h2 { font-size: 26px; }
  .rc-filtros .segmented { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
  .rc-data { flex: 1 1 40%; }
  .rc-sum { grid-template-columns: 1fr 1fr; gap: 8px; }
  .rc-sum .stat-pill { padding: 10px 12px; }
  .rc-sum .stat-pill b { font-size: 19px; }
  .rc-acts .btn.primary { flex-basis: 100%; }
  .rc-tab td { padding: 0; font-size: 14px; }
  .rc-tab tbody tr { gap: 8px 14px; padding: 12px 14px; }
  .rc-tab td.num { white-space: normal; }
  .rc-tab td.larga { min-width: 0; }
  .rc-tab tfoot { display: block; }
  .rc-tab tfoot tr { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; padding: 14px; background: var(--surface-2); border-top: 1px solid var(--text); }
  .rc-tab tfoot td { background: transparent; border: 0; padding: 0; }
  .rc-tab tfoot td.t-main { font-size: 16px; }
}

/* ---------- Impressão / PDF dos relatórios ---------- */
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body { background: #fff !important; }
  .sidebar, .tabbar, .topbar, .rc-cat, .rc-acts, .rc-filtros, .rc-voltar, .toast, #toasts { display: none !important; }
  .app, .main, .view { padding: 0 !important; margin: 0 !important; display: block !important; }
  .rc { display: block; }
  .rc[data-vista] .rc-main { display: grid !important; gap: 10px; }
  .rc-print-head { display: flex; justify-content: space-between; gap: 16px; font-size: 11px; color: #333; border-bottom: 1px solid #000; padding-bottom: 6px; }
  .rc-tit h2 { font-size: 22px; }
  .rc-tit p, .rc-area { display: none; }
  .card, .stat-pill { box-shadow: none !important; break-inside: avoid; }
  .rc-sum { grid-template-columns: repeat(4, 1fr); }
  .rc-graf { display: none; }
  .table-wrap { overflow: visible !important; }
  .rc-tab { font-size: 10px; width: 100%; }
  .rc-tab th button { padding: 6px 4px; }
  .rc-tab td { padding: 5px 4px; font-size: 10px; }
  .rc-tab tr { break-inside: avoid; }
  .rc-tab thead { display: table-header-group; }
  .badge { padding: 0; background: none !important; }
  .badge::before { display: none; }
}

/* ---------- Compras: visões, painel de filtros, resumo e agrupamento ---------- */
.cf-visoes { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.cf-visoes::-webkit-scrollbar { display: none; }
.cf-vis { flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.cf-vis i { font-style: normal; font-size: 12px; font-weight: 700; min-width: 20px; padding: 1px 6px; border-radius: 10px; background: var(--gray-bg); color: var(--gray-txt); text-align: center; font-variant-numeric: tabular-nums; }
.cf-vis:hover { border-color: var(--border-strong); }
.cf-vis.red i { background: var(--red-bg); color: var(--red); }
.cf-vis.amber i { background: var(--amber-bg); color: var(--amber); }
.cf-vis.active { background: var(--text); border-color: var(--text); color: var(--surface); }
.cf-vis.active i { background: var(--accent); color: #fff; }
.cf-vis:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cf-bar .search { flex: 1 1 320px; }
.cf-btn { display: inline-flex; }
.cf-btn.on { border-color: var(--text); }
.cf-btn svg { width: 16px; height: 16px; }
.cf-sel { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.cf-sel select { min-width: 150px; }
.cf-painel { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 16px; padding: 16px; margin-bottom: 12px; }
.cf-painel[hidden] { display: none; }
.cf-campo { display: grid; align-content: start; gap: 5px; font-size: 13px; color: var(--muted); min-width: 0; }
.cf-campo select, .cf-campo input { width: 100%; min-width: 0; }
.cf-periodo, .cf-valor { grid-column: span 2; }
.cf-datas { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center; }
.cf-atalhos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.chip-btn { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 12.5px; cursor: pointer; }
.chip-btn:hover { border-color: var(--border-strong); background: var(--hover-bg); }
.cf-painel-pe { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); padding-top: 12px; }
.cf-ativos { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.cf-ativos:empty { display: none; }
.cf-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 999px; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--text); font: inherit; font-size: 12.5px; cursor: pointer; max-width: 100%; }
.cf-chip span { font-size: 15px; line-height: 1; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; }
.cf-chip:hover span { background: rgba(0, 0, 0, .08); }
.cf-ativos .link-btn { font-size: 12.5px; margin-left: 4px; }
.cf-resumo { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--r-panel); background: var(--surface); margin-bottom: 12px; overflow: hidden; }
.cf-resumo div { padding: 10px 14px; display: grid; gap: 2px; border-left: 1px solid var(--border); min-width: 0; }
.cf-resumo div:first-child { border-left: 0; }
.cf-resumo span { font-size: 12px; color: var(--muted); }
.cf-resumo b { font-size: 17px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cf-resumo .alerta b { color: var(--red); }
.cf-grupo + .cf-grupo { border-top: 1px solid var(--border-strong); }
.cf-grupo-head { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--surface-2); cursor: pointer; font-size: 14px; }
.cf-grupo-head svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; transition: transform .15s; flex: none; }
.cf-grupo-head[aria-expanded="true"] svg { transform: rotate(90deg); }
.cf-grupo-head > span { color: var(--muted); font-size: 13px; }
.cf-grupo-head .cf-grupo-val { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; text-align: right; }
.cf-grupo-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cf-grupo-head:hover { background: var(--row-hover); }
@media (prefers-reduced-motion: reduce) { .cf-grupo-head svg { transition: none; } }
@media (max-width: 1100px) {
  .cf-painel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .toolbar.cf-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .cf-bar .search { grid-column: 1 / -1; }
  .cf-bar .cf-btn { grid-column: 1 / -1; justify-content: center; min-height: 42px; }
  .cf-sel { display: grid; gap: 3px; font-size: 12px; }
  .cf-sel select { min-width: 0; width: 100%; }
  .cf-resumo { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cf-resumo div { border-left: 0; border-top: 1px solid var(--border); }
  .cf-resumo div:first-child { grid-column: 1 / -1; border-top: 0; display: flex; justify-content: space-between; align-items: baseline; }
  .cf-resumo div:nth-child(odd):not(:first-child) { border-left: 1px solid var(--border); }
}
@media (max-width: 720px) {
  .cf-painel { grid-template-columns: 1fr; padding: 14px; }
  .cf-periodo, .cf-valor { grid-column: auto; }
  .cf-painel-pe .btn { flex: 1; justify-content: center; min-height: 42px; }
  .cf-grupo-head { flex-wrap: wrap; gap: 4px 10px; }
  .cf-grupo-head .cf-grupo-val { margin-left: 26px; width: 100%; text-align: left; }
}

/* sem dia de obra cadastrado, o carimbo do celular (que esconde a data) some inteiro */
@media (max-width: 720px) { .carimbo.so-hoje { display: none; } }

/* ---------- Ordenar pelas colunas (todas as listas) ---------- */
th.th-ordem { padding: 0; }
th.th-ordem button {
  all: unset; box-sizing: border-box; display: block; width: 100%; padding: 14px 10px 10px; cursor: pointer;
  font: inherit; color: inherit; white-space: nowrap; text-align: left;
}
th.th-ordem.num button { text-align: right; }
th.th-ordem button:hover { color: var(--text); }
th.th-ordem button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
th.th-ordem[aria-sort="ascending"], th.th-ordem[aria-sort="descending"] { color: var(--text); }
th.th-ordem .seta { font-size: 11px; }
.t-ordem { display: none; }
@media (max-width: 720px) {
  .t-ordem { display: block; padding: 12px 14px 4px; }
  .t-ordem label { display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); }
  .t-ordem select { width: 100%; }
  .cf-bar ~ #host .t-ordem { display: none; } /* Compras já tem "Ordenar" na barra de filtros */
}
