:root {
  --bg: #f4f2ed;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --ink: #1c1a17;
  --muted: #6b655c;
  --faint: #9a948a;
  --line: #e6e1d6;
  --brand: #1f3a2e;
  --brand-2: #2c5442;
  --brand-ink: #ffffff;
  --accent: #b98226;
  --pos: #1d7348;
  --pos-bg: #e5f3eb;
  --neg: #b23a2f;
  --neg-bg: #fbe8e5;
  --warn: #9a6100;
  --warn-bg: #fcf0d8;
  --info: #2a5aa0;
  --info-bg: #e6edf9;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(28, 26, 23, .06), 0 4px 16px rgba(28, 26, 23, .05);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--info); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; background: var(--brand); color: var(--brand-ink);
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .2px; white-space: nowrap; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: var(--accent); color: #1c1a17; font-weight: 800; font-size: 15px;
}
.logo small { font-weight: 500; opacity: .7; }
.topbar .spacer { flex: 1; }
.month-nav { display: flex; align-items: center; gap: 4px; background: rgba(255,255,255,.1); border-radius: 8px; padding: 2px; }
.month-nav button { background: none; border: 0; color: inherit; padding: 4px 9px; border-radius: 6px; cursor: pointer; font-size: 16px; }
.month-nav button:hover:not(:disabled) { background: rgba(255,255,255,.15); }
.month-nav button:disabled { opacity: .35; cursor: default; }
.month-nav span { min-width: 118px; text-align: center; font-weight: 600; }
.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 4px; border-radius: 999px;
  background: rgba(255,255,255,.1); border: 0; color: inherit; cursor: pointer;
}
.user-chip:hover { background: rgba(255,255,255,.18); }
.user-chip .role { font-size: 11px; opacity: .7; }
.bell { position: relative; background: none; border: 0; color: inherit; cursor: pointer; padding: 6px; border-radius: 8px; }
.bell:hover { background: rgba(255,255,255,.12); }
.bell .dot {
  position: absolute; top: 0; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--accent); color: #1c1a17; font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.tabs { display: flex; gap: 2px; padding: 0 20px; background: var(--brand); overflow-x: auto; }
.tab {
  background: none; border: 0; color: rgba(255,255,255,.72); padding: 10px 14px; cursor: pointer;
  border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 500;
}
.tab:hover { color: #fff; }
.tab.on { color: #fff; border-bottom-color: var(--accent); }
.tab .count { margin-left: 6px; background: var(--accent); color: #1c1a17; border-radius: 9px; padding: 0 6px; font-size: 11px; font-weight: 700; }
main { max-width: 1180px; margin: 0 auto; padding: 22px 20px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 22px; letter-spacing: -.2px; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
.back { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; margin-bottom: 6px; }
.back:hover { color: var(--ink); }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card h2 { margin: 0 0 12px; font-size: 15px; }
.card h2 .sub { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 6px; }
.grid { display: grid; gap: 14px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { padding: 14px 16px; }
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .4px; }
.kpi .value { font-size: 24px; font-weight: 700; margin-top: 4px; letter-spacing: -.3px; }
.kpi .hint { color: var(--muted); font-size: 12px; margin-top: 2px; }
.hero {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 0; overflow: hidden; margin-bottom: 14px;
}
.hero-main { padding: 22px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.hero-main .label { opacity: .75; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.hero-main .big { font-size: 44px; font-weight: 700; letter-spacing: -1px; margin: 4px 0 2px; }
.hero-main .breakdown { font-size: 13px; opacity: .85; }
.hero-main .breakdown div { display: flex; justify-content: space-between; max-width: 300px; padding: 2px 0; }
.hero-side { padding: 18px 22px; display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.hero-side p { margin: 0; color: var(--muted); font-size: 13px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.hero-main .pos, .hero-main .neg { color: #fff; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 14px;
  border-radius: 9px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600;
  white-space: nowrap;
}
.btn:hover { border-color: #cfc8ba; background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #1c1a17; }
.btn.accent:hover { filter: brightness(1.05); }
.btn.ok { background: var(--pos); border-color: var(--pos); color: #fff; }
.btn.danger { color: var(--neg); }
.btn.ghost { background: none; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip.ok { background: var(--pos-bg); color: var(--pos); }
.chip.bad { background: var(--neg-bg); color: var(--neg); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.info { background: var(--info-bg); color: var(--info); }
.chip.mute { background: #eeebe4; color: var(--muted); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.filters button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-weight: 500; }
.filters button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
tr.muted td { color: var(--faint); }
tr.weekend td { background: #fbfaf7; }
td.r, th.r { text-align: right; }
.punches { display: flex; gap: 4px; flex-wrap: wrap; }
.punch { font-variant-numeric: tabular-nums; background: #f0ede6; border-radius: 5px; padding: 1px 6px; font-size: 12.5px; }
.punch.added { background: var(--info-bg); color: var(--info); }
.punch.missing { background: var(--neg-bg); color: var(--neg); }
.daycell { white-space: nowrap; }
.daycell b { display: inline-block; width: 22px; }
.daycell span { color: var(--muted); font-size: 12px; }
.flags { color: var(--muted); font-size: 12px; margin-top: 2px; }
.person { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: #e9e3d6; color: var(--brand); font-weight: 700; font-size: 12px;
}
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.person .meta { color: var(--muted); font-size: 12px; }

/* ---------- requests ---------- */
.req { padding: 16px 18px; display: grid; grid-template-columns: 1fr auto; gap: 14px; }
.req + .req { border-top: 1px solid var(--line); }
.req-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.req-desc { margin: 8px 0 6px; white-space: pre-wrap; }
.req-meta { color: var(--muted); font-size: 12.5px; display: flex; gap: 14px; flex-wrap: wrap; }
.req-amount { font-size: 22px; font-weight: 700; text-align: right; }
.req-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; min-width: 170px; }
.timeline { margin: 10px 0 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--muted); }
.timeline li { position: relative; padding-left: 16px; margin: 3px 0; }
.timeline li::before { content: ""; position: absolute; left: 3px; top: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.timeline li.ok::before { background: var(--pos); }
.timeline li.bad::before { background: var(--neg); }
.timeline li.info::before { background: var(--info); }
.timeline b { color: var(--ink); font-weight: 600; }
.attach { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty .big { font-size: 28px; margin-bottom: 6px; }

/* ---------- alerts ---------- */
.alert { border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; display: flex; gap: 14px; align-items: flex-start; }
.alert.warn { background: var(--warn-bg); color: #5c3c00; border: 1px solid #f0dcae; }
.alert.info { background: var(--info-bg); color: #1d3f72; border: 1px solid #cddbf3; }
.alert h3 { margin: 0 0 4px; font-size: 14px; }
.alert ul { margin: 6px 0 0; padding: 0; list-style: none; }
.alert li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0; flex-wrap: wrap; }

/* ---------- chart ---------- */
.chart { width: 100%; height: 120px; display: block; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12px; margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ---------- forms ---------- */
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=number], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(185,130,38,.35); border-color: var(--accent); }
textarea { min-height: 84px; resize: vertical; }
.f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.f-row.three { grid-template-columns: 1fr 1fr 1fr; }
.types { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-bottom: 14px; }
.type-opt { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; display: flex; gap: 10px; align-items: flex-start; background: #fff; }
.type-opt:hover { border-color: #cfc8ba; }
.type-opt.on { border-color: var(--accent); background: #fffaf0; box-shadow: 0 0 0 1px var(--accent) inset; }
.type-opt input { margin-top: 3px; accent-color: var(--accent); }
.type-opt b { display: block; font-size: 13.5px; }
.type-opt small { color: var(--muted); }
.calc { background: var(--surface-2); border: 1px dashed var(--line); border-radius: 9px; padding: 10px 12px; margin-bottom: 12px; font-size: 13px; }
.hint { color: var(--muted); font-size: 12.5px; }
.dropzone { border: 2px dashed #d6cfbf; border-radius: var(--radius); padding: 34px 20px; text-align: center; background: var(--surface-2); cursor: pointer; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: #fffaf0; }
.dropzone .big { font-size: 30px; }

/* ---------- modal / popover / toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20, 18, 15, .45); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal { width: min(640px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }
.x { background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.x:hover { background: var(--surface-2); }
.popover { position: absolute; right: 20px; top: 54px; width: min(380px, calc(100vw - 32px)); z-index: 40; max-height: 70vh; overflow: auto; color: var(--ink); }
.notif { padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: #fffaf0; }
.notif small { color: var(--muted); display: block; margin-top: 2px; }
#toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

/* ---------- login ---------- */
.login { max-width: 880px; margin: 0 auto; padding: 48px 20px; }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.login-brand .logo-mark { width: 46px; height: 46px; font-size: 22px; border-radius: 12px; }
.login h1 { margin: 0; font-size: 28px; letter-spacing: -.4px; }
.login .lead { color: var(--muted); margin: 0 0 28px; max-width: 620px; }
.login h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 24px 0 10px; }
.profiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.profile { display: flex; align-items: center; gap: 10px; padding: 12px; text-align: left; cursor: pointer; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); }
.profile:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.profile.mgr { background: var(--brand); color: #fff; border-color: var(--brand); }
.profile.mgr .avatar { background: var(--accent); color: #1c1a17; }
.profile.mgr .meta { color: rgba(255,255,255,.7); }
.proto-note { margin-top: 30px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }

/* ---------- painel ---------- */
.click { cursor: pointer; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dash-grid.three { grid-template-columns: 1fr 1fr 1fr; }
.alerts { max-height: 380px; overflow: auto; }
.alert-row { display: flex; gap: 10px; align-items: center; padding: 9px 18px; border-top: 1px solid var(--line); }
.alert-row:hover { background: var(--surface-2); }
.hb { display: flex; flex-direction: column; gap: 2px; }
.hb-row { display: grid; grid-template-columns: 96px 1fr 62px; align-items: center; gap: 10px; padding: 3px 4px; border-radius: 6px; }
.hb-row.click:hover { background: var(--surface-2); }
.dash-grid.three .hb-row { grid-template-columns: 78px 1fr 52px; gap: 6px; }
.hb-label { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hb-track { position: relative; height: 14px; }
.hb-mid { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--line); }
.hb-bar { position: absolute; top: 2px; height: 10px; border-radius: 4px; min-width: 2px; }
.hb-val { text-align: right; font-size: 13px; font-weight: 600; }

/* ---------- agenda ---------- */
table.agenda { border-collapse: separate; border-spacing: 0; }
table.agenda th, table.agenda td { padding: 3px 1px; text-align: center; border-bottom: 1px solid var(--line); min-width: 26px; }
table.agenda th { font-size: 11px; text-transform: none; letter-spacing: 0; padding: 8px 1px; }
table.agenda th span { color: var(--faint); font-weight: 500; }
table.agenda .ag-name { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; padding: 6px 12px; min-width: 130px; border-right: 1px solid var(--line); }
table.agenda .ag-name .meta { color: var(--muted); font-size: 11px; }
table.agenda th.ag-wk, table.agenda tfoot td { color: var(--faint); }
table.agenda tfoot td { font-size: 11px; padding: 5px 1px; }
table.agenda tfoot td.ag-name { color: var(--muted); font-weight: 600; }
table.agenda .ag-today { background: #fff6e3; }
.ag { width: 22px; height: 22px; border-radius: 5px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; vertical-align: middle; }
.ag-o { background: #e4ece6; color: var(--brand); }
.ag-plan { background: #f3f1ec; color: var(--brand); }
.ag-h { background: var(--info-bg); color: var(--info); }
.ag-h.strong, .ag-plan.strong { box-shadow: 0 0 0 2px var(--info) inset; }
.ag-f { background: #ece5f6; color: #5b3d98; }
.ag-b { background: var(--warn-bg); color: var(--warn); }
.ag-a { background: #e2f1f1; color: #1f6b6b; }
.ag-x { background: var(--neg-bg); color: var(--neg); }
.ag-q { background: var(--warn-bg); color: var(--warn); }
.ag-hol { background: #ebe8e1; color: var(--muted); }
.ag-off { background: transparent; }
.ag.pend { outline: 2px dashed var(--accent); outline-offset: -2px; }
.ag-legend { flex-wrap: wrap; border-top: 1px solid var(--line); }
.ag-legend > span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px 16px; background: linear-gradient(180deg, var(--brand) 0, var(--brand) 40%, var(--bg) 40%); }
.auth-card { width: min(400px, 100%); padding: 28px 24px; }
.auth-card h1 { font-size: 24px; }
pre.cred { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; white-space: pre-wrap; word-break: break-all; font: 13px/1.5 ui-monospace, Consolas, monospace; user-select: all; }

/* ---------- config ---------- */
.cfg-sched td input, .cfg-sched td select { padding: 6px 8px; }
.cfg-sched td { padding: 6px 8px; }
.section-gap { margin-top: 14px; }

@media (max-width: 760px) {
  .topbar { padding: 10px 14px; flex-wrap: wrap; }
  .logo small { display: none; }
  .user-chip .nm { display: none; }
  .tabs { padding: 0 8px; }
  main { padding: 16px 14px 60px; }
  .hero { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi .value { font-size: 20px; }
  .page-head .row .btn { flex: 1 1 auto; }
  .hero-main .big { font-size: 38px; }
  .req { grid-template-columns: 1fr; }
  .req-amount { text-align: left; }
  .req-actions { flex-direction: row; flex-wrap: wrap; min-width: 0; }
  .f-row, .f-row.three { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .dash-grid, .dash-grid.three { grid-template-columns: 1fr; }
  th, td { padding: 8px 8px; }
  .month-nav span { min-width: 96px; }
}
