:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-soft: #dbeafe;
  --plus: #16a34a;
  --minus: #dc2626;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #111a2e;
    --surface-2: #0f172a;
    --border: #1e293b;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --primary: #60a5fa;
    --primary-soft: #1e3a5f;
    --plus: #4ade80;
    --minus: #f87171;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1320px; margin: 0 auto; padding: 0 16px; }

/* Topbar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; }
.brand strong { color: var(--primary); }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  padding-top: 28px;
  padding-bottom: 28px;
  align-items: start;
}
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
}

h1 { font-size: 1.75rem; margin: 0 0 4px; letter-spacing: -.02em; }
h2 { font-size: 1.05rem; margin: 0; }
.lead { color: var(--muted); margin: 0 0 20px; }
.muted { color: var(--muted); font-size: .85rem; }
.hint { color: var(--muted); font-size: .8rem; margin: 10px 0 0; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; font-size: .8rem; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }

/* Inputs */
input[type="text"], input[type="number"], input[type="time"] {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input:disabled { opacity: .4; cursor: not-allowed; }
input[type="time"] { padding: 8px 8px; min-width: 0; }
@media (prefers-color-scheme: dark) { input[type="time"] { color-scheme: dark; } }

input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; margin: 0; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: .85rem; font-weight: 500; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

.inline { display: flex; align-items: center; gap: 10px; }
.inline input { max-width: 110px; }

/* Buttons */
.btn-ghost, .btn-link {
  font: inherit; cursor: pointer; border-radius: 10px;
}
.btn-ghost {
  background: transparent; border: 1px solid var(--border); color: var(--text);
  padding: 7px 14px; font-size: .875rem;
}
.btn-ghost:hover { border-color: var(--minus); color: var(--minus); }
.btn-link {
  background: var(--primary-soft); border: none; color: var(--primary);
  padding: 6px 12px; font-size: .8rem; font-weight: 600;
}
.btn-link:hover { filter: brightness(.95); }

/* Days table */
.col-inputs { container: inputs / inline-size; min-width: 0; }
.days-header, .day {
  display: grid;
  grid-template-columns: 92px repeat(2, minmax(0, 1fr)) 60px repeat(2, minmax(0, 1fr)) 48px 32px;
  gap: 6px;
  align-items: center;
}
.day input[type="time"] { padding: 7px 6px; font-size: .9rem; }
.day .cell { min-width: 0; }
.days-header { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; padding: 0 4px 8px; }
.days-header span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.days-header span:nth-child(4), .days-header span:last-child { text-align: center; }
.days { display: flex; flex-direction: column; gap: 6px; }
.day { padding: 6px 4px; border-radius: 10px; }
.day.off { opacity: .55; }
.day-name { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; user-select: none; }
.day .lunch-toggle { display: flex; justify-content: center; }
.day .total { text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; font-size: .9rem; }
.day .mlabel { display: none; }

/* Copiar / colar horário */
.row-act { display: flex; justify-content: center; }
.icon-btn {
  width: 30px; height: 30px; display: inline-grid; place-items: center;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); color: var(--muted); cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.icon-btn:hover:not(:disabled) { color: var(--primary); border-color: var(--primary); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.icon-btn.is-paste { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.icon-btn.is-src { color: var(--minus); border-color: var(--minus); }
.day.clip-src { background: var(--primary-soft); outline: 1.5px dashed var(--primary); outline-offset: -1px; }
.day.flash { animation: flash .7s ease-out; }
@keyframes flash { from { background: rgba(22, 163, 74, .28); } to { background: transparent; } }

.clip-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  margin: 0 0 10px; padding: 8px 12px; border-radius: 10px;
  background: var(--primary-soft); color: var(--text); font-size: .85rem;
}
.clip-actions { display: inline-flex; gap: 8px; }
.kbd-ico svg { vertical-align: -3px; color: var(--primary); }
.btn-ghost-sm {
  font: inherit; font-size: .8rem; cursor: pointer; border-radius: 8px;
  background: transparent; border: 1px solid var(--border); color: var(--text); padding: 5px 10px;
}
.tip { margin-top: 12px; }
kbd {
  font: inherit; font-size: .72rem; padding: 1px 5px; border-radius: 4px;
  border: 1px solid var(--border); background: var(--surface-2);
}

/* Coluna estreita (celular, tablet ou monitor menor): cada dia vira um cartão */
@container inputs (max-width: 640px) {
  .days-header { display: none; }
  .days { gap: 10px; }
  .day {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border: 1px solid var(--border);
    padding: 12px;
    gap: 10px;
  }
  .day-name { grid-column: 1 / 2; }
  .day .total { grid-column: 2 / 3; text-align: right; }
  .day .cell { display: flex; flex-direction: column; gap: 4px; }
  .day .lunch-toggle { grid-column: 1 / -1; justify-content: flex-start; gap: 8px; align-items: center; }
  .day .mlabel { display: inline; font-size: .75rem; color: var(--muted); }
  .day.off .cell, .day.off .lunch-toggle { display: none; }
  .day.no-lunch .c-ls, .day.no-lunch .c-le { display: none; }
  .day { position: relative; }
  .day .total { padding-right: 40px; }
  .row-act { position: absolute; top: 9px; right: 10px; }
  .day-name { order: 1; } .day .total { order: 2; }
  .day .c-in { order: 3; } .day .c-out { order: 4; }
  .day .lunch-toggle { order: 5; }
  .day .c-ls { order: 6; } .day .c-le { order: 7; }
}

.journey-summary {
  display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; align-items: flex-end;
  margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border);
}
.journey-summary strong { display: block; font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.journey-summary .hint { margin: 0; }

/* Summary */
.col-summary { position: sticky; top: 20px; }
@media (max-width: 960px) { .col-summary { position: static; } }

.summary h2 { margin-bottom: 12px; }
.rows { margin: 0; }
.row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-bottom: 1px dashed var(--border);
  font-variant-numeric: tabular-nums;
}
.row dt { color: var(--muted); font-size: .9rem; }
.row dt small { display: block; font-size: .75rem; opacity: .85; }
.row dd { margin: 0; font-weight: 600; white-space: nowrap; }
.row.sub dd { font-weight: 500; color: var(--muted); }
.row.plus dd { color: var(--plus); }
.row.minus dd { color: var(--minus); }
.row.total { border-bottom: 1px solid var(--border); }
.row.total dt { color: var(--text); font-weight: 600; }

/* Remover / restaurar valores do resumo da rescisão */
.row dd { display: flex; align-items: center; gap: 6px; }
.row-x {
  width: 22px; height: 22px; padding: 0; flex: none;
  display: inline-grid; place-items: center;
  border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: 1rem; line-height: 1; cursor: pointer;
  opacity: .55; transition: opacity .15s, background .15s, color .15s, border-color .15s;
}
.row:hover .row-x, .row-x:focus-visible { opacity: 1; }
.row-x:hover { background: var(--bg); border-color: var(--border); color: var(--minus); }
.row.removed dt, .row.removed .v { opacity: .5; }
.row.removed .v { text-decoration: line-through; }
.row.removed dt small { font-style: italic; }
.row.removed .row-x { opacity: 1; color: var(--primary); }
.row.removed .row-x:hover { color: var(--plus); }
.rows-hint { margin: -4px 0 6px; font-size: .78rem; }
.removed-note {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 10px; padding: 8px 10px; border-radius: 8px;
  background: var(--bg); border: 1px dashed var(--border);
  font-size: .8rem; color: var(--muted);
}
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); text-decoration: underline; cursor: pointer; }
.row-x-pad { width: 22px; flex: none; }
@media print { .row-x, .row-x-pad, .removed-note, .rows-hint { display: none !important; } }

.net {
  margin-top: 16px; padding: 16px; border-radius: 12px;
  background: var(--primary); color: #fff;
  display: flex; flex-direction: column; gap: 2px;
}
@media (prefers-color-scheme: dark) { .net { color: #0b1120; } }
.net span { font-size: .85rem; opacity: .9; }
.net strong { font-size: 1.9rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.disclaimer { color: var(--muted); font-size: .75rem; margin: 14px 0 0; }

.footer { color: var(--muted); font-size: .8rem; padding-top: 8px; padding-bottom: 32px; }

/* Print button */
.btn-primary {
  width: 100%; margin-top: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: .95rem;
  background: var(--surface); color: var(--primary);
  border: 1.5px solid var(--primary); border-radius: 12px;
  padding: 11px 16px; cursor: pointer; transition: background .15s;
}
.btn-primary:hover { background: var(--primary-soft); }
input.invalid { border-color: var(--minus); box-shadow: 0 0 0 3px rgba(220, 38, 38, .2); }

/* ---------- Print report ---------- */
.print-report { display: none; }

@page { size: A4; margin: 14mm 14mm 12mm; }

@media print {
  html, body { background: #fff !important; color: #0f172a !important; }
  .topbar, .layout, .footer, .sidenav { display: none !important; }
  .print-report { display: block; font-size: 10.5pt; color: #0f172a; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.print-report h2 {
  font-size: 10pt; text-transform: uppercase; letter-spacing: .06em;
  color: #2563eb; margin: 18px 0 6px;
}

.pr-head {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 12px; border-bottom: 3px solid #2563eb;
}
.pr-brand { display: flex; align-items: center; gap: 10px; }
.pr-brand div { display: flex; flex-direction: column; line-height: 1.25; }
.pr-brand strong { font-size: 12pt; }
.pr-brand span { font-size: 8.5pt; color: #64748b; }
.pr-title { text-align: right; }
.pr-title h1 { font-size: 16pt; margin: 0; letter-spacing: -.01em; }
.pr-title span { font-size: 9pt; color: #64748b; }

.pr-info {
  display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px;
  margin-top: 14px; padding: 10px 14px;
  background: #f1f5f9; border-radius: 8px;
}
.pr-info div, .pr-totals div { display: flex; flex-direction: column; }
.pr-info span, .pr-totals span { font-size: 8pt; color: #64748b; text-transform: uppercase; letter-spacing: .04em; }
.pr-info strong { font-size: 11.5pt; }

.pr-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.pr-table th, .pr-table td { padding: 5px 8px; text-align: left; border-bottom: 1px solid #e2e8f0; }
.pr-table th { font-size: 8pt; text-transform: uppercase; letter-spacing: .04em; color: #64748b; background: #f8fafc; border-bottom: 1.5px solid #cbd5e1; }
.pr-table td:last-child, .pr-table th:last-child { text-align: right; }
.pr-table .c { text-align: center; }
.pr-table .n { text-align: right; }
.pr-table tr.off td { color: #94a3b8; }
.pr-table tfoot td { font-weight: 700; border-top: 1.5px solid #cbd5e1; border-bottom: none; background: #f8fafc; }
.pr-calc td:nth-child(3) { color: #15803d; }
.pr-calc td:nth-child(4) { color: #b91c1c; }
.pr-calc tfoot td:nth-child(1) { color: #0f172a; }
.pr-calc tfoot td:nth-child(2) { color: #15803d; }
.pr-calc tfoot td:nth-child(3) { color: #b91c1c; }

.pr-totals {
  display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 10px; margin-top: 16px;
  break-inside: avoid;
}
.pr-totals div { padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 8px; }
.pr-totals strong { font-size: 13pt; font-variant-numeric: tabular-nums; }
.pr-totals .pr-net { background: #2563eb; border-color: #2563eb; color: #fff; }
.pr-totals .pr-net span { color: #dbeafe; }
.pr-totals .pr-net strong { font-size: 16pt; }

.pr-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 56px; break-inside: avoid; }
.pr-sign div { text-align: center; font-size: 9pt; color: #64748b; }
.pr-sign span { display: block; border-top: 1px solid #0f172a; margin-bottom: 4px; }

.pr-foot { margin-top: 24px; font-size: 8pt; color: #94a3b8; text-align: center; }

/* ---------- Shell + sidebar ---------- */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.views { min-width: 0; }
.sidenav {
  position: sticky; top: 20px; margin-top: 28px;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px;
}
.sidenav-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 4px 10px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--text); text-decoration: none; font-weight: 500; font-size: .92rem;
  transition: background .15s, color .15s;
}
.nav-item svg { flex-shrink: 0; color: var(--muted); }
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item.active svg { color: var(--primary); }

@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .col-summary { position: static; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .sidenav { position: static; flex-direction: row; margin-top: 16px; padding: 6px; overflow-x: auto; }
  .sidenav-title { display: none; }
  .nav-item { flex: 1; justify-content: center; white-space: nowrap; padding: 9px 10px; font-size: .85rem; }
  .layout { padding-top: 20px; }
}

/* ---------- Rescisão ---------- */
.span-2 { grid-column: 1 / -1; }
.field small, .field span small { color: var(--muted); font-weight: 400; }

select {
  width: 100%; font: inherit; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; outline: none; cursor: pointer;
}
select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
@media (prefers-color-scheme: dark) { select, input[type="date"], input[type="month"] { color-scheme: dark; } }
input[type="date"], input[type="month"] {
  width: 100%; font: inherit; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; outline: none;
}

.tenure {
  margin-top: 14px; padding: 10px 14px; border-radius: 10px;
  background: var(--surface-2); border: 1px dashed var(--border);
  color: var(--muted); font-size: .9rem;
}
.tenure strong { color: var(--text); }

.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 560px) { .choices { grid-template-columns: minmax(0, 1fr); } }
.choice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 12px;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.choice:hover { border-color: var(--primary); }
.choice input { margin-top: 3px; accent-color: var(--primary); width: 16px; height: 16px; flex-shrink: 0; }
.choice span { display: flex; flex-direction: column; }
.choice strong { font-size: .92rem; font-weight: 600; }
.choice small { color: var(--muted); font-size: .8rem; }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }

.notice-field { margin-top: 16px; }

.alert {
  padding: 10px 12px; border-radius: 10px; margin-bottom: 10px; font-size: .88rem;
  background: rgba(220, 38, 38, .1); color: var(--minus); border: 1px solid rgba(220, 38, 38, .3);
}
.row.group dt { color: var(--text); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; padding-top: 6px; }
.row.group { border-bottom: none; padding-bottom: 0; }

.fgts-box {
  margin-top: 16px; padding: 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2);
}
.fgts-box h3 { margin: 0 0 4px; font-size: .95rem; }
.fgts-box .row { padding: 7px 0; }
.fgts-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 10px; }
.fgts-total span { font-size: .88rem; font-weight: 600; }
.fgts-total strong { font-size: 1.15rem; color: var(--plus); font-variant-numeric: tabular-nums; }
.badge { margin: 10px 0 0; font-size: .8rem; padding: 6px 10px; border-radius: 8px; display: inline-block; }
.badge.yes { background: rgba(22, 163, 74, .12); color: var(--plus); }
.badge.no { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }

.pr-info.cols-3 { grid-template-columns: 2fr 1fr 1fr; row-gap: 12px; }
.pr-fgts { margin-top: 12px; }

/* ---------- Dias alternados ---------- */
.day-name > span { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.alt-tag { display: none; font-size: .66rem; font-weight: 600; color: var(--primary); text-transform: uppercase; letter-spacing: .03em; }
.day.alt .alt-tag { display: block; }

.alt-days {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  margin-top: 14px; padding: 12px 14px; border-radius: 10px;
  border: 1px dashed var(--border); background: var(--surface-2);
}
.alt-days > div:first-child { display: flex; flex-direction: column; gap: 2px; flex: 1 1 260px; font-size: .9rem; }
.alt-days .muted { font-size: .8rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer;
  min-width: 44px; padding: 6px 10px; border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--muted);
  transition: all .15s;
}
.chip:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
@media (prefers-color-scheme: dark) { .chip.on { color: #0b1120; } }
.chip:disabled { opacity: .35; cursor: not-allowed; }

.pr-alt { display: block; font-size: 7.5pt; color: #2563eb; }
