:root {
  --ink: #14211c;
  --muted: #4a5c54;
  --paper: #f3f6f2;
  --panel: rgba(255, 255, 255, 0.82);
  --line: rgba(20, 33, 28, 0.12);
  --accent: #0f6b5c;
  --accent-2: #c45c26;
  --accent-soft: #d7efe8;
  --danger: #9b2c2c;
  --shadow: 0 18px 50px rgba(20, 33, 28, 0.08);
  --radius: 18px;
  --font-display: "Literata", Georgia, serif;
  --font-body: "Manrope", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.45;
}

.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 8% -10%, #b9e4d7 0%, transparent 55%),
    radial-gradient(700px 420px at 100% 0%, #f0d2bf 0%, transparent 50%),
    linear-gradient(160deg, #eef4ef 0%, #f7f3ee 45%, #e8f0ec 100%);
}

a { color: var(--accent); }

.brand-name {
  color: inherit;
  text-decoration: none;
}
.brand-name:hover,
.brand-name:focus-visible {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.notes .ssr-note {
  margin: 0.55rem 0;
}

.top {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem 1rem;
  display: grid;
  gap: 0.4rem;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  font-family: var(--font-display);
}

.brand-mark {
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent);
}

.brand-name {
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  font-weight: 500;
  letter-spacing: -0.03em;
}

.tagline {
  margin: 0;
  color: var(--muted);
  max-width: 42rem;
  font-size: 1.05rem;
}

.meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.layout {
  max-width: 1280px;
  margin: 0 auto 2rem;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 1.25rem;
  align-items: start;
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.15rem 1.25rem;
  min-height: 70vh;
}

.search-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.search-row {
  display: flex;
  gap: 0.4rem;
}

#q {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  font: inherit;
  background: #fff;
  outline: none;
}

#q:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.ghost {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  width: 2.5rem;
  font-size: 1.4rem;
  color: var(--muted);
  cursor: pointer;
}

.results, .tree {
  list-style: none;
  margin: 0.85rem 0 0;
  padding: 0;
}

.results {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.results button, .results a, .tree button, .enfants button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.7rem 0.85rem;
  font: inherit;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  box-sizing: border-box;
}

.results button:hover, .results a:hover, .tree button:hover, .enfants button:hover,
.tree button.active {
  background: var(--accent-soft);
}

.results .code, .tree .code {
  font-weight: 700;
  color: var(--accent);
  margin-right: 0.4rem;
}

.tree-head {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tree-head h2, .chart-wrap h2, .table-wrap h2, .enfants h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.crumbs button {
  border: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.tree {
  max-height: calc(70vh - 220px);
  overflow: auto;
  border-top: 1px solid var(--line);
}

.tree li:last-child button { border-bottom: 0; }

[hidden] { display: none !important; }

.empty {
  display: grid;
  place-content: center;
  min-height: 55vh;
  text-align: center;
  color: var(--muted);
  padding: 2rem;
}

.empty[hidden] {
  display: none !important;
}

.empty h2 {
  font-family: var(--font-display);
  color: var(--ink);
  margin: 0 0 0.5rem;
}

.acte-head .code {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-transform: uppercase;
}

.acte-head h1 {
  margin: 0.25rem 0 0.35rem;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2.5vw, 2rem);
  line-height: 1.2;
  font-weight: 700;
}

.synonyme {
  margin: 0;
  color: var(--muted);
  font-style: italic;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 1rem 0 1.25rem;
}

.chip {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.modificateurs {
  margin: 0 0 1.25rem;
}

.modificateurs h2 {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
}

.modificateurs ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.modificateurs li {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  font-size: 0.92rem;
}

.modificateurs .mod-label {
  font-weight: 600;
  color: var(--accent);
}

.modificateurs .mod-lib {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.supplement-dom {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.85rem;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent-2);
  border-radius: 0 12px 12px 0;
  font-weight: 600;
  color: var(--accent);
  font-size: 0.92rem;
}

.tarif-controls {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.tarif-controls label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.tarif-controls select {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem 0.65rem;
  background: #fff;
  min-width: 7rem;
}

.chart-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1rem 0.5rem;
  margin-bottom: 1.25rem;
}

.chart-help {
  margin: 0.2rem 0 0.8rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.no-tarif {
  color: var(--danger);
  font-size: 0.9rem;
}

.table-wrap {
  overflow: auto;
  margin-bottom: 1.25rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th, td {
  text-align: left;
  padding: 0.55rem 0.4rem;
  border-bottom: 1px solid var(--line);
}

th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

th.amount,
td.amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

td.amount {
  font-weight: 600;
}

.notes {
  display: grid;
  gap: 0.75rem;
}

.nb-dents {
  margin: 0.85rem 0 0;
  font-size: 0.95rem;
  color: var(--ink);
  font-weight: 600;
}

.exoneration-tm {
  margin: 0.85rem 0 0;
  font-size: 0.95rem;
  color: var(--ink);
  font-weight: 600;
}

.note-block {
  background: #fff;
  border-left: 3px solid var(--accent-2);
  padding: 0.75rem 0.9rem;
  border-radius: 0 10px 10px 0;
  font-size: 0.92rem;
  line-height: 1.45;
}

.note-block > strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.note-section {
  margin: 0 0 0.85rem;
}

.note-section:last-child {
  margin-bottom: 0;
}

.note-label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 700;
  color: var(--accent);
  font-size: 0.95rem;
}

.note-p {
  margin: 0.15rem 0 0;
}

.note-list {
  margin: 0.15rem 0 0;
  padding-left: 1.25rem;
}

.note-list li {
  margin: 0.28rem 0;
}

.note-acte-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.note-acte-link:hover {
  color: var(--ink);
}

.enfants ul {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.voir-aussi {
  margin-top: 1.5rem;
}

.voir-aussi h2 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.voir-aussi ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.voir-aussi-link {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}

.voir-aussi li:last-child .voir-aussi-link {
  border-bottom: 0;
}

.voir-aussi-link:hover {
  background: var(--accent-soft);
}

.voir-aussi-link .code {
  flex: 0 0 auto;
  font-weight: 700;
  color: var(--accent);
}

.voir-aussi-lib {
  font-size: 0.92rem;
}

.foot {
  max-width: 1280px;
  margin: 0 auto 2rem;
  padding: 0 1.5rem;
  font-size: 0.82rem;
  color: var(--muted);
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .panel { min-height: auto; }
  .tree { max-height: 320px; }
  .empty { min-height: 220px; }
}
