:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111827;
  background: #f3f4f6;
  font-synthesis: none;
  --surface: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #111827;
  --positive: #047857;
  --negative: #b91c1c;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #f3f4f6; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { max-width: 720px; margin: 0 auto; min-height: 100vh; padding: 0 16px 96px; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 24px 2px 18px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 1.35rem; margin-bottom: 0; }
h2 { font-size: clamp(1.6rem, 6vw, 2.15rem); margin-bottom: 0; }
h3 { margin-bottom: 0; font-size: 1.05rem; }
.eyebrow { display: block; font-size: .72rem; letter-spacing: .08em; font-weight: 800; color: var(--muted); text-transform: uppercase; margin-bottom: 4px; }
.version { font-size: .74rem; color: var(--muted); background: #e5e7eb; border-radius: 999px; padding: 6px 10px; }
.hero-card, .card, .metric-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }
.hero-card { padding: 22px; background: #111827; color: white; margin-bottom: 14px; }
.hero-card .eyebrow { color: #9ca3af; }
.hero-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 24px; }
.metric { min-width: 0; }
.metric span, .metric-card span { display: block; color: #9ca3af; font-size: .76rem; margin-bottom: 5px; }
.metric strong { font-size: 1rem; }
.card { padding: 18px; margin-bottom: 14px; }
.card.compact p { margin-bottom: 0; color: var(--muted); }
.section-title-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.timeline { border-top: 1px solid var(--line); margin-bottom: 16px; }
.timeline-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.timeline-row strong, .timeline-row small { display: block; }
.timeline-row small { color: var(--muted); margin-top: 3px; max-width: 300px; }
.timeline-actions { display: flex; align-items: center; gap: 10px; }
.clock { font-variant-numeric: tabular-nums; font-weight: 800; }
.primary-button, .secondary-button, .nav-button, .link-button, .icon-button { border: 0; }
.primary-button { background: var(--accent); color: white; padding: 14px 18px; border-radius: 14px; font-weight: 800; }
.secondary-button { background: #eef0f3; color: var(--ink); padding: 9px 12px; border-radius: 11px; font-weight: 700; }
.link-button { background: transparent; color: #374151; text-decoration: underline; padding: 4px; font-size: .82rem; }
.icon-button { background: transparent; font-size: 1.8rem; line-height: 1; padding: 0 4px; }
.full { width: 100%; }
.success-banner, .audit-note { background: #ecfdf5; color: #065f46; border-radius: 12px; padding: 12px; font-size: .88rem; }
.positive { color: #34d399 !important; }
.metric-card .positive, .day-row .positive { color: var(--positive) !important; }
.negative { color: #fca5a5 !important; }
.metric-card .negative, .day-row .negative { color: var(--negative) !important; }
.bottom-nav { position: fixed; bottom: max(10px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(calc(100% - 24px), 690px); display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 6px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.94); backdrop-filter: blur(14px); box-shadow: 0 10px 35px rgba(17,24,39,.12); }
.nav-button { background: transparent; color: var(--muted); padding: 12px; border-radius: 12px; font-weight: 800; }
.nav-button.active { background: #111827; color: white; }
.page-heading { padding: 8px 2px 16px; }
.page-heading p { color: var(--muted); max-width: 570px; margin-top: 10px; margin-bottom: 0; }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.metric-card { padding: 16px; }
.metric-card strong { font-size: 1.3rem; }
.day-list { display: grid; }
.day-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; background: transparent; border: 0; border-top: 1px solid var(--line); padding: 14px 0; text-align: left; }
.day-row small { display: block; color: var(--muted); margin-top: 3px; }
.day-row-values { text-align: right; }
.day-row-values span, .day-row-values strong { display: block; }
.day-row-values span { color: var(--muted); font-size: .84rem; }
.muted { color: var(--muted); }
.settings-form { display: grid; gap: 6px; }
.field-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.duration-inputs { display: flex; align-items: center; gap: 6px; }
.duration-inputs input { width: 58px; text-align: center; }
input, select, textarea { border: 1px solid #d1d5db; border-radius: 11px; background: white; padding: 10px 12px; color: var(--ink); }
.field { display: grid; gap: 7px; margin-bottom: 14px; }
.field > span { font-weight: 700; font-size: .86rem; }
.field textarea, .field input, .field select { width: 100%; }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; }
.file-button { display: inline-flex; align-items: center; cursor: pointer; }
.dialog { border: 0; border-radius: 20px; width: min(calc(100% - 28px), 520px); padding: 20px; box-shadow: 0 20px 70px rgba(0,0,0,.25); }
.dialog::backdrop { background: rgba(17,24,39,.55); }
.toast { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 999; background: #111827; color: white; padding: 12px 16px; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.18); max-width: calc(100% - 32px); }
.toast.error { background: #991b1b; }
.fatal { max-width: 680px; margin: 80px auto; padding: 24px; }
@media (max-width: 440px) {
  .hero-card { padding: 18px; }
  .hero-metrics { gap: 6px; }
  .metric strong { font-size: .9rem; }
  .timeline-row { align-items: flex-start; }
  .timeline-actions { flex-direction: column; align-items: flex-end; gap: 2px; }
  .field-row { align-items: flex-start; }
}


.mini-summary { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 16px; }
.mini-metric { background: #f9fafb; border: 1px solid var(--line); border-radius: 14px; padding: 12px; min-width: 0; }
.mini-metric span { display: block; color: var(--muted); font-size: .72rem; margin-bottom: 4px; }
.mini-metric strong { font-size: .96rem; font-variant-numeric: tabular-nums; }
.classification-list, .category-list, .bank-list { border-top: 1px solid var(--line); margin-top: 10px; }
.classification-row, .category-row, .bank-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.classification-row small, .category-row small, .bank-row small { display: block; color: var(--muted); margin-top: 3px; }
.classification-actions { display: flex; align-items: flex-end; gap: 4px; flex-direction: column; text-align: right; }
.classification-actions strong { font-variant-numeric: tabular-nums; }
.danger-link { color: #991b1b; }
.warning-banner { background: #fffbeb; color: #92400e; border-radius: 12px; padding: 12px; font-size: .88rem; margin-top: 12px; }
.bank-row { width: 100%; background: transparent; border-left: 0; border-right: 0; border-top: 0; text-align: left; }
.bank-row > strong { font-variant-numeric: tabular-nums; }
.category-row.inactive { opacity: .56; }
.button-row.tight { gap: 2px; justify-content: flex-end; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.check-row input { width: 18px; height: 18px; }
.duration-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.duration-editor label { display: flex; align-items: center; gap: 7px; }
.duration-editor input { width: 100%; }

@media (max-width: 440px) {
  .bottom-nav { gap: 3px; }
  .nav-button { padding: 11px 6px; font-size: .8rem; }
  .mini-summary { grid-template-columns: 1fr; }
  .classification-row, .category-row { align-items: flex-start; }
  .category-row { flex-direction: column; }
  .button-row.tight { justify-content: flex-start; }
}

/* v0.3 — remuneração */
.money-note { color: var(--muted); font-size: .75rem; font-weight: 700; }
.pay-list, .salary-list { border-top: 1px solid var(--line); }
.pay-row, .salary-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.pay-row small, .salary-row small { display: block; color: var(--muted); margin-top: 3px; }
.pay-row > strong, .salary-row > strong { font-variant-numeric: tabular-nums; }
.warning-banner.standalone { margin: 0 0 14px; }

@media (min-width: 441px) {
  .bottom-nav { grid-template-columns: repeat(5, 1fr); }
}

@media (max-width: 440px) {
  .bottom-nav { grid-template-columns: repeat(5, 1fr); }
  .nav-button { font-size: .72rem; padding: 11px 3px; }
  .salary-row, .pay-row { align-items: flex-start; }
}


/* v0.4 — rubricas e folha prevista */
.earning-list { border-top: 1px solid var(--line); }
.earning-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.earning-row small { display: block; color: var(--muted); margin-top: 3px; }
.earning-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.earning-actions strong { font-variant-numeric: tabular-nums; }
.positive-text { color: var(--positive); }
.negative-text { color: var(--negative); }

@media (max-width: 440px) {
  .earning-row { align-items: flex-start; }
}


/* v0.4.2 — regras reais do espelho de ponto */
.hero-rule {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.info-banner {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #eef6ff;
  color: #24405f;
  line-height: 1.45;
}

.mini-summary.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.schedule-period-row {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.schedule-period-row:last-child {
  border-bottom: 0;
}

.schedule-period-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.schedule-period-head small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.schedule-summary-days {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.schedule-global-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.inline-number {
  display: flex;
  align-items: center;
  gap: 8px;
}

.schedule-table {
  margin: 16px 0;
  overflow-x: auto;
}

.schedule-table-head,
.schedule-table-row {
  min-width: 650px;
  display: grid;
  grid-template-columns: 1.2fr repeat(4, 1fr);
  gap: 8px;
  align-items: center;
}

.schedule-table-head {
  padding: 0 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.schedule-table-row {
  padding: 7px 0;
  border-top: 1px solid var(--line);
}

.schedule-table-row input {
  width: 100%;
}

.wide-dialog {
  width: min(920px, calc(100vw - 24px));
  max-width: 920px;
}

.history-components {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-variant-numeric: tabular-nums;
}

.legacy-card {
  opacity: 0.88;
}

@media (max-width: 720px) {
  .mini-summary.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .schedule-global-grid {
    grid-template-columns: 1fr;
  }

  .schedule-period-head {
    flex-direction: column;
  }
}

/* v0.5.0 — Regras da Empresa */
.settings-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 16px;
}

.settings-tab {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
  padding: 10px 12px;
}

.settings-tab.active {
  background: #101828;
  color: #fff;
  border-color: #101828;
}

.rule-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
}

.rule-notes {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
  color: var(--muted);
}

.rule-notes p {
  margin: 0;
}

.rule-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.rule-chip-row span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f5f7fa;
  color: #475467;
  font-size: .78rem;
  font-weight: 650;
}

.rule-form-section {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.rule-form-section:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.rule-form-section h4 {
  margin: 0 0 12px;
  font-size: .98rem;
}

@media (max-width: 640px) {
  .settings-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rule-chip-row {
    display: grid;
  }

  .rule-chip-row span {
    border-radius: 10px;
  }
}

.time-pair {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
}

.metric small,
.metric-card small {
  display: block;
  color: #9ca3af;
  font-size: .76rem;
  margin-bottom: 5px;
}

.hero-card .hero-rule {
  color: #d1d5db;
}

.summary-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.history-list {
  border-top: 1px solid var(--line);
}

.history-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.history-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

@media (max-width: 520px) {
  .summary-grid.three {
    grid-template-columns: 1fr 1fr;
  }
}


/* v0.5.1 — conciliação manual do banco de horas */
.bank-sync-card .section-title-row {
  align-items: center;
}

.bank-adjustment-row {
  cursor: default;
  border-left: 3px solid var(--accent, #566173);
}

.bank-adjustment-row:hover {
  background: inherit;
}
