:root {
  --green: #116149;
  --green-light: #E4EFEA;
  --red: #BC3E45;
  --red-light: #F8E9EA;
  --sand: #F2EBDD;
  --holiday: #2F6FED;
  --sick: #7C5CBF;
  --dark: #1F2825;
  --bg: #F1F3F2;
  --card: #FFFFFF;
  --border: #DDE2DF;
  --text: #18201D;
  --text-dim: #66716C;
  --text-faint: #89938E;
  --accent: #CC2B2B;
  --brand: #CC2B2B;
  --brand-dark: #991F1F;
  --brand-light: #FCE7E7;
  --radius: 10px;
  --radius-sm: 7px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  color: var(--text);
  background: var(--bg);
  font-family: "Century Gothic", CenturyGothic, AppleGothic, Futura, "Questrial", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

button { cursor: pointer; border: none; background: none; font-family: inherit; transition: transform 0.08s ease, opacity 0.08s ease; }
button:active { transform: scale(0.96); opacity: 0.85; }
button:disabled { cursor: default; opacity: .48; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.icon { width: 20px; height: 20px; display: block; }

.view { animation: view-in 0.14s ease; padding: 0 14px 92px; }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.label { font-weight: 500; color: var(--text-dim); font-size: 13px; }

body { padding-bottom: env(safe-area-inset-bottom); position: relative; min-height: 100%; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  position: relative;
  min-height: 64px; padding: max(12px, env(safe-area-inset-top)) 14px 11px;
  background: var(--card); border-bottom: 1px solid var(--border); margin-bottom: 10px;
}
.header-controls { display: flex; align-items: center; gap: 2px; position: relative; z-index: 30; }
.header-controls[hidden] { display: none; }
.header-actions { position: relative; }
.settings-actions { position: static; }
.settings-actions > .settings-summary { display: none; }
.header-icon-btn { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--text-dim); cursor: pointer; }
.header-icon-btn:hover, .header-icon-btn:focus-visible { background: var(--bg); }
.header-icon-btn .icon { width: 19px; height: 19px; }
.header-actions summary { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: transparent; color: var(--text-dim); font-size: 16px; font-weight: 800; letter-spacing: 2px; cursor: pointer; list-style: none; }
.header-actions summary:hover, .header-actions[open] summary { background: var(--bg); }
.header-actions summary::-webkit-details-marker { display: none; }
.menu-dots { display: flex; align-items: center; justify-content: center; gap: 3px; width: 100%; height: 100%; }
.menu-dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.header-actions-panel { position: absolute; top: 44px; right: 0; width: 230px; display: grid; gap: 7px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); box-shadow: 0 12px 32px rgba(24, 32, 29, .16); }
.header-actions-panel[hidden] { display: none; }
.header-actions-panel { max-height: calc(100dvh - 150px); overflow-y: auto; }
.audit-row { padding: 12px 0; border-bottom: 1px solid var(--border); }
.audit-row:last-child { border: 0; }
.audit-row time { display: block; color: var(--text-dim); font-size: 12px; margin-bottom: 5px; }
.audit-row strong { font-size: 14px; }
.audit-row p { font-size: 13px; line-height: 1.5; margin: 6px 0 0; overflow-wrap: anywhere; }
.backup-panel p { line-height: 1.5; overflow-wrap: anywhere; }
.backup-error { color: var(--red); }
.header-actions-panel .btn { min-height: 40px; font-size: 12px; }
.menu-back-btn .icon { width: 17px; height: 17px; }
.menu-back-btn { display: flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 3px; border: 0; background: transparent; color: var(--text-dim); font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; }
.menu-section-label { margin: 5px 2px 0; padding-top: 9px; border-top: 1px solid var(--border); color: var(--text); font-size: 11px; font-weight: 750; }
.header-actions-panel .backup-status { margin: -3px 2px 1px; font-size: 10px; }
.brand { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 7px;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px;
}
.avatar .icon { width: 20px; height: 20px; stroke-width: 2.1; }
.brand-text { position: absolute; left: 50%; transform: translateX(-50%); width: calc(100% - 156px); display: flex; flex-direction: column; align-items: center; gap: 4px; line-height: 1.05; text-align: center; }
.greeting { display: flex; align-items: center; gap: 5px; font-size: 10px; color: var(--text-dim); }
.greeting::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.greeting.save-error { color: var(--red); }
.greeting.save-error::before { background: var(--red); }
.worker-info-btn:disabled { opacity: 1; }
.brand-text h1 { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; margin: 0; font-weight: 780; letter-spacing: -0.2px; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
}

.date-card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px; margin: 0 0 10px;
}
.date-selector { display: grid; grid-template-columns: 38px minmax(0, 1fr) 38px; align-items: center; gap: 8px; }
.date-nav {
  width: 38px; height: 38px; border-radius: 50%; background: var(--bg);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.date-nav .icon { width: 16px; height: 16px; }
.date-info { display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 0; }
.date-value { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; font-weight: 750; font-size: 14px; }
.date-today-btn { min-height: 41px; padding: 9px 8px; font-size: 13px; line-height: 1.2; }

.daily-tools {
  display: flex; flex-direction: column; gap: 0;
  margin: 0 0 12px; padding: 0; overflow: hidden;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: none;
  position: sticky; top: 6px; z-index: 12;
}
.worksite-field { display: flex; flex-direction: column; padding: 7px 10px; }
.daily-secondary-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; padding: 10px 12px 12px; border-top: 1px solid var(--border); }
.daily-secondary-actions[hidden] { display: none; }
.daily-secondary-actions .btn { min-height: 38px; padding: 8px 6px; font-size: 11px; white-space: normal; line-height: 1.2; }
.daily-secondary-actions .btn:disabled { cursor: not-allowed; color: var(--text-faint); background: var(--bg); border-color: var(--border); opacity: .72; }
.day-closed-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; background: var(--brand-light); color: var(--brand); border-bottom: 1px solid #f0cfcb; font-size: 11px; }
.day-closed-banner[hidden] { display: none; }
.day-closed-banner strong { font-size: 12px; }
.worksite-switcher {
  display: grid; grid-template-columns: 38px minmax(0, 1fr) 38px;
  align-items: center; gap: 8px; width: 100%; min-height: 64px; padding: 0;
}
.worksite-nav {
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--bg); border: 1px solid transparent; color: var(--text);
}
.worksite-nav:active { background: var(--brand-light); color: var(--brand); }
.worksite-nav .icon { width: 16px; height: 16px; }
.worksite-current { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.worksite-current .worksite-label { color: var(--text-dim); font-size: 13px; font-weight: 500; line-height: 1.1; }
.worksite-current strong {
  display: block; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text); font-size: 14px; line-height: 1.25; letter-spacing: -.1px;
}
.worksite-empty {
  grid-column: 1 / -1;
  width: 100%; min-height: 40px; display: flex; align-items: center;
  padding: 9px 11px; border: 1px dashed var(--border); border-radius: var(--radius-sm);
  color: var(--text-dim); font-size: 12.5px;
}
.btn.btn-compact { width: auto; flex-shrink: 0; padding: 10px 12px; font-size: 12px; white-space: nowrap; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; margin-bottom: 18px; }
.stat-grid.three { grid-template-columns: repeat(3, 1fr); background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.stat-card {
  background: var(--card); border: 0; border-right: 1px solid var(--border);
  border-radius: 0;
  padding: 10px 8px 11px; display: grid; grid-template-columns: 28px auto; grid-template-rows: auto 28px; justify-content: center; align-items: center; column-gap: 6px; row-gap: 8px;
}
.stat-card:last-child { border-right: 0; }
.stat-icon { width: 32px; height: 32px; border-radius: 12px; display: flex; align-items: center; justify-content: center; margin-bottom: 2px; }
.stat-card .stat-icon { grid-column: 1; grid-row: 2; width: 28px; height: 28px; border-radius: 7px; align-self: center; }
.stat-card .label { grid-column: 1 / -1; grid-row: 1; justify-self: center; font-size: 10.5px; line-height: 1.1; text-align: center; }
.stat-card .stat-value { grid-column: 2; grid-row: 2; justify-self: start; }
.stat-icon .icon { width: 16px; height: 16px; }
.income-chip { background: var(--green-light); color: var(--green); }
.expense-chip { background: var(--red-light); color: var(--red); }
.budget-chip { background: var(--sand); color: #8a6d1f; }
.stat-value { font-size: 18px; font-weight: 800; line-height: 1.1; }
.attendance-strip { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 0 0 14px; padding: 9px 10px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); color: var(--text-dim); font-size: 11px; }
.attendance-item { display: inline-flex; align-items: baseline; gap: 3px; white-space: nowrap; }
.attendance-item b { font-size: 15px; color: var(--text); }
.attendance-item.present b { color: var(--green); }
.attendance-item.absent b { color: var(--red); }
.attendance-item.pending b { color: #806620; }

.worksite-overview { display: flex; gap: 6px; overflow-x: auto; margin: -8px 0 16px; padding: 0 1px 4px; scrollbar-width: none; }
.worksite-overview::-webkit-scrollbar { display: none; }
.overview-row {
  flex: 0 0 auto; max-width: 190px; display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--text-dim); font-size: 11px;
}
.overview-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overview-row b { color: var(--text); }
.overview-row.active { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }
.overview-row.complete b::before { content: '✓ '; color: var(--green); }

.section-title { font-size: 14px; font-weight: 750; margin: 4px 0 10px; color: var(--text); text-transform: uppercase; letter-spacing: .45px; }
.section-head-row { display: flex; align-items: center; justify-content: flex-start; gap: 6px; margin-bottom: 10px; }
.section-head-row .section-title { margin: 0; }
.search-field { flex: 0 1 150px; }
.search-field input {
  width: 100%; padding: 8px 10px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font: inherit; font-size: 12px;
}
.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; }
.list-empty-message { margin: 0; padding: 24px 14px; text-align: center; color: var(--text-dim); font-size: 13px; }

.worker-list, .team-list, .summary-list {
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: none;
}
#lista-equipa, #lista-obras { overflow: visible; }

.worker-row, .team-row, .summary-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 66px; padding: 9px 11px;
  border-bottom: 1px solid var(--border);
}
.worker-row.worker-row-compact { min-height: 54px; }
.worker-row:last-child, .team-row:last-child, .summary-row:last-child { border-bottom: none; }
.team-row.inactive { opacity: .55; }
.small-action-btn { padding: 7px 8px; border-radius: 7px; background: var(--bg); color: var(--text-dim); font-size: 11px; font-weight: 700; }
.small-action-btn.icon-only { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0; flex: 0 0 34px; }
.small-action-btn.icon-only .icon { width: 17px; height: 17px; }
.worker-actions { display: flex; align-items: center; gap: 3px; flex: 0 0 auto; }
.worker-more { position: relative; }
.worker-more summary { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 7px; background: var(--bg); color: var(--text-dim); cursor: pointer; list-style: none; }
.worker-more summary::-webkit-details-marker { display: none; }
.worker-more summary:hover, .worker-more[open] summary { background: var(--border); }
.worker-more-menu { position: absolute; top: 38px; right: 0; z-index: 35; min-width: 168px; padding: 6px; border: 1px solid var(--border); border-radius: 9px; background: var(--card); box-shadow: 0 10px 24px rgba(24, 32, 29, .14); }
.worker-more-menu.abre-para-cima { top: auto; bottom: 38px; }
.worker-menu-action, .worker-delete-btn { width: 100%; min-height: 34px; display: flex; align-items: center; gap: 7px; padding: 7px 8px; border: 0; border-radius: 6px; background: transparent; font: inherit; font-size: 11px; font-weight: 700; text-align: left; cursor: pointer; }
.worker-menu-action { color: var(--text); }
.worker-menu-action:hover { background: var(--bg); }
.worker-menu-action .icon { width: 15px; height: 15px; color: var(--text-dim); }
.worker-menu-divider { height: 1px; margin: 4px 2px; background: var(--border); }
.worker-delete-btn { color: var(--red); }
.worker-delete-btn:hover { background: var(--red-soft); }
.worker-delete-btn .icon { width: 15px; height: 15px; }
.worker-info, .tx-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; text-align: left; flex: 1; }
.worker-info-btn { padding: 4px 0; }
.worker-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.worker-obra { font-size: 11.5px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.quick-estados { display: flex; gap: 4px; flex-shrink: 0; }
.quick-btn {
  width: 30px; height: 32px; border-radius: 6px;
  background: var(--bg); border: 1px solid var(--border);
  font-size: 10px; font-weight: 800; color: var(--text-faint);
  display: flex; align-items: center; justify-content: center;
}
.quick-btn.presente.active { background: var(--green); border-color: var(--green); color: #fff; }
.quick-btn.falta-manha.active, .quick-btn.falta-tarde.active { background: var(--sand); border-color: var(--sand); color: #8a6d1f; }
.quick-btn.falta-dia.active { background: var(--red); border-color: var(--red); color: #fff; }
.quick-btn.ferias.active { background: var(--holiday); border-color: var(--holiday); color: #fff; }
.quick-btn.baixa.active { background: var(--sick); border-color: var(--sick); color: #fff; }

.quick-more > summary.quick-btn {
  width: 30px; height: 32px; border-radius: 6px;
  background: var(--bg); border: 1px solid var(--border);
  font-size: 10px; font-weight: 800; color: var(--text-faint);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; list-style: none;
}
.quick-more > summary.quick-btn::-webkit-details-marker { display: none; }
.quick-more .worker-more-menu { min-width: 152px; }
.worker-menu-action.active { color: var(--brand); font-weight: 800; }

.history-title { margin: 4px 0 14px; text-align: center; }
.history-eyebrow { display: block; margin-bottom: 3px; color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .55px; text-transform: uppercase; }
.history-title h2 { margin: 0; color: var(--text); font-size: 22px; line-height: 1.15; letter-spacing: -.45px; }
.closed-days-title { margin: 4px 0 14px; text-align: center; }
.closed-days-title > span { display: block; margin-bottom: 3px; color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .55px; text-transform: uppercase; }
.closed-days-title h2 { margin: 0; color: var(--text); font-size: 22px; line-height: 1.15; letter-spacing: -.45px; }
.closed-days-title p { margin: 7px auto 0; max-width: 270px; color: var(--text-dim); font-size: 12px; line-height: 1.4; }
.closed-days-list[hidden] { display: none; }
.closed-day-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 62px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.closed-day-row:last-child { border-bottom: 0; }
.closed-day-row strong { display: block; color: var(--text); font-size: 13px; line-height: 1.3; }
.closed-day-row span { display: block; margin-top: 3px; color: var(--text-dim); font-size: 11px; }
.closed-day-row .btn { min-height: 36px; padding: 8px 10px; font-size: 11px; white-space: nowrap; }
.history-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.history-filter { display: flex; flex-direction: column; gap: 5px; min-width: 0; color: var(--text-dim); font-size: 11px; font-weight: 700; }
.history-filter select { width: 100%; min-width: 0; padding: 10px 28px 10px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); color: var(--text); font: inherit; font-size: 12px; font-weight: 650; text-overflow: ellipsis; }
.panel-meta { color: var(--text-faint); font-size: 11px; font-weight: 650; }
.history-summary-panel .panel-head { margin-bottom: 10px; }
.history-summary-panel .summary-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 12px; min-height: 62px; padding: 10px 11px; }
.summary-row .worker-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.summary-stats { display: flex; align-items: stretch; gap: 5px; }
.summary-stat { min-width: 42px; display: flex; flex-direction: column; gap: 2px; padding: 5px 6px; border-radius: 7px; background: var(--bg); text-align: center; }
.summary-stat small { color: var(--text-dim); font-size: 9px; font-weight: 650; }
.summary-stat b { color: var(--text); font-size: 12px; line-height: 1; }
.summary-stat.absence b { color: var(--red); }
.summary-stat.extra b { color: #8a6d1f; }
.summary-stat.motivo-ferias b { color: var(--holiday); }
.summary-stat.motivo-baixa b { color: var(--sick); }
.summary-stat.motivo-justificada b, .summary-stat.motivo-injustificada b, .summary-stat.motivo-outro b { color: var(--red); }

.panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px;
}
.backup-status { margin: -4px 0 12px; color: var(--green); font-size: 12px; font-weight: 650; }
.backup-status.warning { color: #8a6d1f; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.budget-caption { font-size: 13px; color: var(--text-dim); margin: 0 0 12px; line-height: 1.4; }

.link-btn { color: var(--brand); font-weight: 700; font-size: 13px; }

.btn {
  padding: 11px 16px; border-radius: var(--radius-sm); font-weight: 700; font-size: 13px;
  width: 100%; text-align: center;
}
.btn[hidden] { display: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--red-light); color: var(--red); }
.file-btn { display: inline-flex; align-items: center; justify-content: center; }

.sheet-actions { display: flex; gap: 10px; margin-top: 6px; }
.sheet-actions .btn { flex: 1; }

.inline-form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.inline-form[hidden] { display: none; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-dim); font-weight: 500; }
.field[hidden] { display: none; }
.field input, .field select {
  padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--card); font-family: inherit; font-size: 15px; color: var(--text);
}

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-dim); }
.empty-state.small { padding: 24px 10px; }
.empty-icon {
  width: 46px; height: 46px; border-radius: 15px; background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 12px;
}
.empty-icon .icon { width: 20px; height: 20px; color: var(--text-faint); }
.empty-state p { font-size: 13px; margin: 0; line-height: 1.5; }

.resumo-texto-wrap { margin-top: 12px; }
.history-export-btn { margin-top: 8px; }
.history-calendar-details { margin: 2px 0 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.history-calendar-details summary { display: flex; align-items: center; min-height: 46px; padding: 0 14px; color: var(--text); font-size: 13px; font-weight: 750; cursor: pointer; list-style: none; }
.history-calendar-details summary::after { content: '+'; margin-left: auto; color: var(--text-dim); font-size: 17px; font-weight: 400; }
.history-calendar-details[open] summary { border-bottom: 1px solid var(--border); }
.history-calendar-details[open] summary::after { content: '−'; }
.history-calendar-details summary::-webkit-details-marker { display: none; }
.calendar-wrap { width: 100%; padding: 12px 14px 14px; }
.calendar-empty { margin: 0; padding: 8px 6px 4px; color: var(--text-dim); font-size: 12px; line-height: 1.45; text-align: center; }
.calendar-person-head { display: flex; flex-direction: column; gap: 3px; margin: 0 0 12px; }
.calendar-person-head strong { color: var(--text); font-size: 14px; }
.calendar-person-head span { color: var(--text-dim); font-size: 10px; line-height: 1.35; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.calendar-weekdays { margin-bottom: 5px; }
.calendar-weekdays span { color: var(--text-faint); font-size: 9px; font-weight: 750; text-align: center; text-transform: uppercase; }
.calendar-day, .calendar-blank { aspect-ratio: 1 / 1; min-height: 38px; border-radius: 8px; }
.calendar-day { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 1px solid var(--border); background: var(--bg); color: var(--text-faint); font-size: 9px; }
.calendar-day strong { color: inherit; font-size: 11px; line-height: 1; }
.calendar-day.presente { background: var(--green-light); border-color: #c9ddd4; color: var(--green); }
.calendar-day.falta-manha, .calendar-day.falta-tarde { background: var(--sand); border-color: #e8d9b6; color: #795f18; }
.calendar-day.falta-dia { background: var(--red-light); border-color: #f0caca; color: var(--red); }
.history-export { margin: 2px 0 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.history-export summary { display: flex; align-items: center; min-height: 46px; padding: 0 14px; color: var(--text); font-size: 13px; font-weight: 750; cursor: pointer; list-style: none; }
.history-export summary::after { content: '+'; margin-left: auto; color: var(--text-dim); font-size: 18px; font-weight: 400; }
.history-export[open] summary { border-bottom: 1px solid var(--border); }
.history-export[open] summary::after { content: '−'; }
.history-export summary::-webkit-details-marker { display: none; }
.history-export-content { padding: 12px 14px 14px; }
.resumo-texto {
  width: 100%; min-height: 220px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg); font-family: inherit; font-size: 13px; color: var(--text);
  padding: 12px 14px; resize: vertical; margin-bottom: 10px; white-space: pre-wrap;
}

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-around;
  padding: 7px 10px max(7px, env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--border);
  z-index: 20;
}
.nav-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--text-faint); font-size: 10.5px; padding: 4px 18px; border-radius: 8px; }
.nav-btn.active { color: var(--brand); }
.nav-icon .icon { width: 22px; height: 22px; }

.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(23,33,29,0.4);
  display: flex; align-items: flex-end; z-index: 40;
}
.sheet-backdrop[hidden] { display: none; }
.sheet {
  width: 100%; background: var(--card);
  border-radius: 26px 26px 0 0; padding: 10px 18px max(20px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px;
  max-height: 88vh; overflow-y: auto;
}
.sheet-handle { width: 36px; height: 4px; border-radius: 3px; background: var(--border); margin: 6px auto 0; }
.sheet h2 { margin: 0; font-size: 17px; font-weight: 700; }

.type-toggle { display: flex; gap: 6px; background: var(--bg); padding: 4px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.type-toggle.four { flex-wrap: wrap; }
.type-btn {
  flex: 1; min-width: 40%; padding: 10px 8px; border-radius: 10px; font-weight: 700; font-size: 12px;
  color: var(--text-dim); text-align: center;
}
.type-btn.active { background: var(--brand); color: #fff; }

@media (min-width: 640px) {
  main, .topbar { width: 100%; max-width: 480px; margin-inline: auto; }
  .bottom-nav { left: 50%; right: auto; width: 100%; max-width: 480px; transform: translateX(-50%); }
}
