/* ── Zanella Palette ─────────────────────────────────────── */
:root {
  --dark-navy:    #00081E;
  --navy:         #010E30;
  --navy-mid:     #1a2744;
  --navy-light:   #2d3a5c;
  --slate:        #767B9A;
  --slate-light:  #9da3b8;
  --slate-pale:   #c4c8d6;
  --gold:         #BEB998;
  --gold-dark:    #8a7d5a;
  --light:        #EDEDED;
  --white:        #F8F7F4;
  --red:          #f87171;

  /* Dark theme (default) */
  --bg:            var(--dark-navy);
  --surface:       var(--navy);
  --border:        rgba(190,185,152,0.18);
  --border-muted:  rgba(118,123,154,0.22);
  --border-accent: rgba(190,185,152,0.45);
  --text:          var(--light);
  --text-muted:    var(--slate);
  --accent:        var(--gold);
  --label:         var(--gold);
  --card-bg:       var(--dark-navy);
  --bar-bg:        rgba(118,123,154,0.18);
  --note-bg:       rgba(190,185,152,0.06);
  --tag-bg:        rgba(190,185,152,0.1);
  --input-bg:      var(--dark-navy);
}

body.light {
  --bg:            var(--white);
  --surface:       #FFFFFF;
  --border:        rgba(1,14,48,0.10);
  --border-muted:  rgba(118,123,154,0.18);
  --border-accent: rgba(1,14,48,0.25);
  --text:          var(--navy);
  --text-muted:    var(--slate);
  --accent:        var(--gold-dark);
  --label:         var(--gold-dark);
  --card-bg:       #FFFFFF;
  --bar-bg:        rgba(1,14,48,0.07);
  --note-bg:       rgba(1,14,48,0.03);
  --tag-bg:        rgba(1,14,48,0.05);
  --input-bg:      var(--white);
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Courier New', monospace;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 28px 20px 60px;
  transition: background 0.3s, color 0.3s;
}

input[type=range] {
  cursor: pointer;
  width: 100%;
  accent-color: var(--gold);
}

button { font-family: inherit; cursor: pointer; }

/* ── Layout ──────────────────────────────────────────────── */
.wrapper      { max-width: 1280px; margin: 0 auto; }
.grid         { display: grid; grid-template-columns: 310px 1fr; gap: 22px; margin-top: 22px; }
.col-left     { display: flex; flex-direction: column; gap: 14px; }
.col-right    { display: flex; flex-direction: column; gap: 18px; }

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

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  transition: background 0.3s, border-color 0.3s;
}
.card-accent { border-width: 2px; border-color: var(--gold); }
.card-faixa  { border-width: 2px; }

/* ── Typography ──────────────────────────────────────────── */
.label-section {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 2px;
}
.label-sub {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.label-sm {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Slider Row ──────────────────────────────────────────── */
.slider-row          { margin-bottom: 16px; }
.slider-row:last-child { margin-bottom: 0; }
.row-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 3px;
}
.row-val {
  font-family: Georgia, serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

/* ── Status Panel ────────────────────────────────────────── */
.status-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 4px;
  border-bottom: 1px solid var(--border-muted);
}
.status-row:last-child { border-bottom: none; }
.status-row.bold {
  background: rgba(0,0,0,0.12);
  border-radius: 5px;
  margin: 2px 0;
}
body.light .status-row.bold { background: rgba(1,14,48,0.05); }
.s-label { font-size: 11px; color: var(--text-muted); }
.status-row.bold .s-label { font-size: 12px; color: var(--text); font-weight: 700; }
.s-val { font-family: Georgia, serif; font-size: 12px; font-weight: 700; }
.status-row.bold .s-val { font-size: 13px; }

/* ── Alíquota Efetiva ────────────────────────────────────── */
.aliq-box {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 2px solid var(--border-muted);
}

/* ── Allocation Card ─────────────────────────────────────── */
.alloc-card {
  background: var(--card-bg);
  border: 1px solid var(--border-muted);
  border-radius: 12px;
  padding: 14px 18px;
  border-left-width: 3px;
  transition: opacity 0.2s, border-color 0.3s;
}
.alloc-card.zero { opacity: 0.5; }
.alloc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.alloc-info   { display: flex; align-items: center; gap: 8px; }
.alloc-dot    { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.alloc-label  { font-size: 12px; font-weight: 700; color: var(--text); }
.alloc-group  { font-size: 10px; margin-top: 1px; }
.alloc-right  { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.alloc-pct    { font-family: Georgia, serif; font-size: 16px; font-weight: 700; text-align: right; }
.alloc-val-r  { font-size: 11px; color: var(--text-muted); text-align: right; }
.alloc-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 8px;
}

/* ── Metric Box ──────────────────────────────────────────── */
.metric-box   { background: var(--bg); border-radius: 6px; padding: 5px 8px; text-align: center; }
.metric-label { font-size: 9px; color: var(--text-muted); text-transform: uppercase; margin-bottom: 2px; }
.metric-val   { font-family: Georgia, serif; font-size: 11px; font-weight: 700; }

/* ── Rate Input Button ───────────────────────────────────── */
.rate-btn {
  border-radius: 6px;
  padding: 3px 9px;
  font-family: Georgia, serif;
  font-size: 12px;
  font-weight: 700;
  min-width: 68px;
  text-align: right;
  border: 1px solid;
  transition: opacity 0.15s;
}
.rate-btn:hover { opacity: 0.8; }
.rate-input-field {
  width: 72px;
  padding: 3px 6px;
  border-radius: 6px;
  font-family: Georgia, serif;
  font-size: 12px;
  font-weight: 700;
  text-align: right;
  outline: none;
  background: var(--input-bg);
  color: var(--text);
  border: 1.5px solid;
}

/* ── Composition Bar ─────────────────────────────────────── */
.comp-bar {
  height: 10px;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  margin-bottom: 6px;
}
.comp-bar-bg  { flex: 1; background: var(--bar-bg); }
.comp-legend  { display: flex; gap: 10px; flex-wrap: wrap; font-size: 10px; color: var(--text-muted); }
.comp-dot     { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

/* ── KPI Grid ────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.kpi-box {
  background: var(--bg);
  border-radius: 10px;
  padding: 12px 10px;
  text-align: center;
}
.kpi-label { font-size: 9px; color: var(--text-muted); text-transform: uppercase; margin-bottom: 5px; }
.kpi-val   { font-family: Georgia, serif; font-size: 18px; font-weight: 700; }

/* ── Equivalência Table ──────────────────────────────────── */
.equiv-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.equiv-table th {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-muted);
}
.equiv-table th:first-child  { text-align: left; }
.equiv-table th:not(:first-child) { text-align: right; }
.equiv-table td {
  padding: 8px 8px;
  border-bottom: 1px solid var(--border-muted);
  font-family: 'Courier New', monospace;
}
.equiv-table td:first-child       { font-weight: 700; }
.equiv-table td:not(:first-child) { text-align: right; }
.equiv-table tr.ref-row           { background: rgba(190,185,152,0.08); }

/* ── Directive Card ──────────────────────────────────────── */
.directive {
  border-radius: 12px;
  padding: 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 4px;
}
.directive-icon  { font-size: 22px; line-height: 1; flex-shrink: 0; }
.directive-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.directive-body  {
  font-family: Georgia, serif;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
}
.directive-detail {
  background: var(--bg);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 12px;
}
.directive-detail .d-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}
.directive-detail .d-row:last-child { margin-bottom: 0; }

/* ── Info Tag ────────────────────────────────────────────── */
.tag {
  background: var(--tag-bg);
  border: 1px solid var(--border-muted);
  border-radius: 7px;
  padding: 7px 11px;
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ── Header ──────────────────────────────────────────────── */
.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0;
}
.header-left  { display: flex; align-items: center; gap: 14px; }
.header-bar   { width: 3px; height: 52px; background: var(--gold); border-radius: 2px; }
.header-brand {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}
.header-title {
  font-family: Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  margin: 4px 0 2px;
  color: var(--text);
}
.header-sub { font-size: 11px; color: var(--text-muted); }
.theme-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 7px 16px;
  color: var(--text);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  transition: background 0.3s;
}

/* ── Section helpers ─────────────────────────────────────── */
.section-divider {
  width: 2px;
  height: 12px;
  background: var(--gold);
  border-radius: 1px;
  flex-shrink: 0;
}
.section-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  margin-top: 14px;
}
.section-row:first-child { margin-top: 0; }
.section-border-top {
  border-top: 1px solid var(--border-muted);
  padding-top: 14px;
  margin-top: 0;
}

/* ── Misc ────────────────────────────────────────────────── */
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-muted);
  border-radius: 6px;
  padding: 2px 8px;
  color: var(--text-muted);
  font-size: 10px;
}
.footer {
  text-align: right;
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.4;
  margin-top: 20px;
}

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-muted); border-radius: 3px; }
