/* ==========================================================================
   opcionalidade.com.br — estilos globais
   ========================================================================== */

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e2e5ea;
  --text: #14181f;
  --text-muted: #5b6573;
  --accent: #1f6feb;
  --accent-soft: #e6efff;
  --positive: #1a7f37;
  --negative: #cf222e;
  --warning: #9a6700;

  /* planilha */
  --grid-line: #d9dde3;
  --head-bg: #eef0f3;
  --calc-bg: #f6f7f9;
  --na-bg: #eceef1;
  --sel-bg: rgba(31, 111, 235, .13);
  --zebra: rgba(16, 24, 40, .05);
  --buy-bg: #dbe8ff;
  --buy-text: #0b3d91;
  --sell-bg: #ffdfe0;
  --sell-text: #8a1020;

  --radius: 10px;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117;
    --surface: #161b22;
    --surface-2: #1f252e;
    --border: #2d333b;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --accent: #4c8dff;
    --accent-soft: #15233d;
    --positive: #3fb950;
    --negative: #f85149;
    --warning: #d29922;
    --grid-line: #2d333b;
    --head-bg: #1a2029;
    --calc-bg: #12171e;
    --na-bg: #0f1318;
    --sel-bg: rgba(76, 141, 255, .22);
    --zebra: rgba(255, 255, 255, .075);
    --buy-bg: #14325f;
    --buy-text: #cfe0ff;
    --sell-bg: #5a1a20;
    --sell-text: #ffd7d9;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #1f252e;
  --border: #2d333b;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #4c8dff;
  --accent-soft: #15233d;
  --positive: #3fb950;
  --negative: #f85149;
  --warning: #d29922;
  --grid-line: #2d333b;
  --head-bg: #1a2029;
  --calc-bg: #12171e;
  --na-bg: #0f1318;
  --sel-bg: rgba(76, 141, 255, .22);
  --zebra: rgba(255, 255, 255, .075);
  --buy-bg: #14325f;
  --buy-text: #cfe0ff;
  --sell-bg: #5a1a20;
  --sell-text: #ffd7d9;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1; display: flex; flex-direction: column; min-height: 0; }

a { color: var(--accent); text-decoration: none; }

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}

body.app .container { max-width: none; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  height: 52px;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}
.brand svg { width: 26px; height: 26px; flex-shrink: 0; }

.nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav a {
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: .92rem;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--text); font-weight: 600; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 16px; height: 16px; }

/* ---------- Configurações ---------- */

.settings { padding-top: 24px; padding-bottom: 48px; max-width: 720px; }
.settings-section h2 { font-size: 1.1rem; margin: 0 0 12px; }
.settings-section + .settings-section { margin-top: 36px; }
.settings-note { margin: -6px 0 12px; font-size: 13px; color: var(--text-muted); }

.const-table td:first-child { width: 90px; font-weight: 600; }
.const-table td:nth-child(2) { position: relative; width: 130px; padding: 0; }
.const-table td:nth-child(3) { color: var(--text-muted); font-size: 12.5px; }
/* Campo ocupa a célula inteira, como numa planilha */
.const-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0 10px;
  font: inherit;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: 0;
  outline: none;
}
.const-input:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.const-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; }

.holidays-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.holidays-count { font-size: 13px; color: var(--text-muted); }

.year-menu { min-width: 180px; }
.year-list {
  max-height: 320px;
  overflow-y: auto;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}
.year-item {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 10px;
  font-size: 13px;
  border-radius: 4px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.year-item:hover { background: var(--surface-2); }
.year-item input { margin: 0; accent-color: var(--accent); }

.list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  background: var(--surface);
}
.list-table th,
.list-table td {
  padding: 6px 10px;
  text-align: left;
  border: 1px solid var(--grid-line);
}
.list-table th { background: var(--head-bg); color: var(--text-muted); font-weight: 600; font-size: 12px; }
.list-table td:first-child { width: 110px; }
.list-table td:nth-child(2) { width: 100px; color: var(--text-muted); }
.list-table tr.weekend td { color: var(--text-muted); }

/* ---------- Em construção ---------- */

.construction {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1.05rem;
  letter-spacing: .02em;
}
