:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #667085;
  --line: #d8e0ea;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --accent: #123a6f;
  --gold: #b58a2a;
  --shadow: 0 12px 32px rgba(16, 24, 40, 0.08);
}

* { box-sizing: border-box; }
html { overflow-x: hidden; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 4px 20px rgba(16, 24, 40, 0.04);
  gap: 18px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(181, 138, 42, .25);
}
.brand span { display: grid; line-height: 1.15; }
.brand strong { font-size: 17px; color: #0f2f5f; }
.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.main-nav {
  display: flex;
  gap: 14px;
  align-items: center;
  white-space: nowrap;
}
.topbar nav a {
  color: #123a6f;
  font-weight: 700;
}
.nav-search {
  display: flex;
  flex: 1;
  max-width: 430px;
  gap: 8px;
  margin-left: auto;
}
.nav-search input {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  font: inherit;
  background: #f8fafc;
}
.nav-search button {
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  padding: 0 15px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}
.page { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0 56px; }
.hero { padding: 34px 0 28px; }
.hero h1 { font-size: clamp(36px, 7vw, 64px); line-height: 1; margin: 0 0 14px; }
.hero p { color: var(--muted); font-size: 19px; margin: 0 0 24px; max-width: 760px; }
.searchbox { display: flex; gap: 10px; max-width: 820px; }
.searchbox input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px 16px;
  font-size: 17px;
  background: white;
}
.searchbox button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  padding: 0 22px;
  min-width: 104px;
}
.compact { margin-bottom: 24px; }
.examples { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.examples a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  background: white;
}
.domain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}
.domain-card {
  display: grid;
  gap: 8px;
  min-height: 128px;
  padding: 18px;
  border: 1px solid rgba(216, 224, 234, .9);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.domain-card:hover { text-decoration: none; border-color: #a9bfd9; }
.domain-card strong { color: #123a6f; font-size: 18px; }
.domain-card span { color: var(--muted); font-size: 14px; }
.domain-hero {
  display: grid;
  gap: 16px;
  max-width: 900px;
  padding: 22px 0 14px;
}
.domain-hero h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1.05;
}
.domain-hero p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
}
.eyebrow {
  color: var(--gold) !important;
  font-size: 13px !important;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.hub-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
  align-items: start;
}
.hub-main {
  display: grid;
  gap: 22px;
  min-width: 0;
}
.filter-bar,
.alert-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 0 0 20px;
}
.filter-bar input,
.filter-bar select,
.alert-form input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  background: #fff;
  font: inherit;
}
.filter-bar button,
.alert-form button {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  padding: 0 14px;
  background: var(--accent);
  color: white;
  font-weight: 800;
}
mark {
  border-radius: 4px;
  background: #fff0a6;
  color: inherit;
  padding: 0 2px;
}
.success {
  border: 1px solid #8acb9b;
  color: #245b32;
  background: #eefaf1;
  border-radius: 8px;
  padding: 12px 14px;
}
.ad-slot {
  display: none;
  border: 1px dashed #c7d7ea;
  border-radius: 14px;
  padding: 14px;
  color: var(--muted);
  background: rgba(255,255,255,.66);
  font-size: 13px;
}
.ads-preview .ad-slot { display: grid; }
.ad-slot span {
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 800;
}
.compact-notes {
  display: grid;
  gap: 10px;
}
.compact-notes p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
h1, h2, h3 { letter-spacing: 0; }
h2 { margin-top: 32px; }
.list { display: grid; gap: 12px; }
.result {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
}
.result h2, .result h3 { margin: 0 0 8px; font-size: 19px; }
.meta { color: var(--muted); font-size: 14px; margin: 0 0 8px; }
.details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.details div { min-width: 0; }
.details dt { color: var(--muted); font-size: 13px; }
.details dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.version-list, .modifier-list {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 18px 14px 34px;
}
.version-list code { font-size: 12px; overflow-wrap: anywhere; }
.modifier-list span { color: var(--muted); font-size: 13px; }
.article {
  border-top: 1px solid var(--line);
  padding: 16px 0;
}
.article h3 { margin: 0 0 8px; font-size: 17px; }
.article p { margin: 0; }
.article-card, .paragraph, .note, .info-card { overflow-wrap: anywhere; }
.paragraphs { display: grid; gap: 12px; }
.paragraph {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: start;
}
.paragraph .note { grid-column: 2; }
.paragraph-number {
  color: var(--muted);
  font-weight: 700;
  min-width: 36px;
}
.toc {
  columns: 2;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px 16px 38px;
}
.toc li { break-inside: avoid; margin-bottom: 5px; }
.toc span { color: var(--muted); font-size: 13px; }
.structure {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 4px !important;
}
.note {
  margin-top: 12px;
  border: 1px solid #d7dde6;
  border-radius: 8px;
  background: #f1f3f6;
  color: #46515f;
  padding: 10px 12px;
  font-size: 14px;
}
.note p { margin-top: 6px; }
.note.modificat { border-color: #f1c94c; background: #fff8d8; color: #695200; }
.note.completat { border-color: #8acb9b; background: #eefaf1; color: #245b32; }
.note.abrogat { border-color: #ee9a9a; background: #fff0f0; color: #8a1c16; }
.note.republicat { border-color: #9fc0ee; background: #edf5ff; color: #184d83; }
.note.informare { border-color: #d7dde6; background: #f1f3f6; color: #46515f; }
.timeline {
  display: grid;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
}
.timeline-item {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}
.timeline-item:last-child { border-bottom: 0; padding-bottom: 0; }
.timeline-item h3 { margin: 0 0 4px; font-size: 16px; }
.timeline-item p { margin: 0; color: var(--muted); }
.annex {
  margin-top: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.annex h3 { margin-top: 0; }
.annex-article h3 { margin: 0 0 8px; font-size: 16px; }
.error {
  border: 1px solid #f2b8b5;
  color: #8a1c16;
  background: #fff2f1;
  border-radius: 8px;
  padding: 12px 14px;
}
.footer {
  border-top: 1px solid var(--line);
  padding: 20px 24px;
  color: var(--muted);
  background: var(--panel);
  font-size: 14px;
}
.footer p { margin: 3px 0; }

.document-premium {
  display: grid;
  gap: 20px;
}
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
}
.breadcrumb strong { color: var(--ink); font-weight: 600; }
.doc-hero {
  max-width: 920px;
  padding: 8px 0 2px;
}
.doc-hero-content {
  display: grid;
  gap: 12px;
}
.doc-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 2px;
}
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.badge-type {
  background: #eef4fb;
  color: #123a6f;
  border: 1px solid #c7d7ea;
  box-shadow: inset 3px 0 0 var(--gold);
}
.status-vigoare {
  background: #eaf8ef;
  color: #17613a;
  border: 1px solid #a8dfba;
}
.status-abrogat {
  background: #fff0f0;
  color: #9b1c1c;
  border: 1px solid #f2aaaa;
}
.status-necunoscut {
  background: #f1f3f6;
  color: #46515f;
  border: 1px solid #d7dde6;
}
.doc-hero h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.08;
  letter-spacing: 0;
  color: #101828;
}
.doc-subtitle {
  max-width: 860px;
  margin: 0;
  color: #475467;
  font-size: clamp(16px, 1.8vw, 20px);
  line-height: 1.45;
}
.doc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
  align-items: start;
}
.doc-main {
  display: grid;
  gap: 22px;
  min-width: 0;
}
.info-card,
.article-card,
.sidebar-card {
  background: var(--panel);
  border: 1px solid rgba(216, 224, 234, .9);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.info-card { padding: 24px; }
.metadata-card {
  display: grid;
  gap: 16px;
  border-top: 4px solid rgba(181, 138, 42, .72);
}
.metadata-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.metadata-grid div {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid #edf1f6;
  border-radius: 12px;
  background: #fbfcfe;
}
.metadata-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.metadata-grid strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 15px;
  overflow-wrap: anywhere;
}
.official-button {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  padding: 11px 14px;
}
.official-button:hover { color: #fff; text-decoration: none; background: #0f2f5f; }
.document-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.secondary-button,
.download-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 800;
}
.secondary-button {
  border: 1px solid #c7d7ea;
  background: #f8fafc;
  color: #123a6f;
}
.download-button {
  border: 1px solid rgba(181, 138, 42, .45);
  background: #fff8e6;
  color: #6f5318;
}
.secondary-button:hover,
.download-button:hover {
  text-decoration: none;
  filter: brightness(.98);
}
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 16px;
}
.section-head h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}
.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.premium-list {
  margin: 0;
  padding-left: 22px;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.premium-list li { margin: 8px 0; }
.toc-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
}
.toc-pills a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid #d8e0ea;
  border-radius: 999px;
  background: #f8fafc;
  padding: 6px 11px;
  color: #344054;
  font-size: 14px;
  font-weight: 700;
}
.toc-pills a:hover {
  text-decoration: none;
  border-color: #9cc7f4;
  background: #eef6ff;
  color: #084f96;
}
.article-stack {
  display: grid;
  gap: 18px;
}
.articles-title {
  margin: 4px 0 0;
}
.article-card {
  padding: 26px;
  scroll-margin-top: 84px;
  border-left: 4px solid #dbe8f5;
}
.article-card h3 {
  margin: 0 0 16px;
  font-size: 21px;
  line-height: 1.25;
  color: #123a6f;
}
.article-card p {
  font-size: 16px;
  line-height: 1.72;
}
.doc-sidebar {
  position: sticky;
  top: 86px;
  display: grid;
  gap: 14px;
}
.sidebar-card {
  padding: 16px;
}
.sidebar-card label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.sidebar-card input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}
.sidebar-nav {
  display: grid;
  gap: 6px;
}
.sidebar-nav a {
  border-radius: 10px;
  padding: 9px 10px;
  color: #344054;
  font-weight: 700;
}
.sidebar-nav a:hover {
  background: #eef6ff;
  text-decoration: none;
}
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: #ffffff;
  color: var(--accent);
  box-shadow: 0 14px 34px rgba(16, 24, 40, .18);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(.96);
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease, box-shadow .2s ease;
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.back-to-top:hover {
  box-shadow: 0 18px 42px rgba(16, 24, 40, .22);
}
.back-to-top:focus-visible {
  outline: 3px solid rgba(181, 138, 42, .45);
  outline-offset: 4px;
}
.back-to-top-progress {
  position: absolute;
  inset: 0;
  width: 56px;
  height: 56px;
  transform: rotate(-90deg);
}
.back-to-top-track,
.back-to-top-ring {
  fill: none;
  stroke-width: 3.5;
}
.back-to-top-track { stroke: #e7edf5; }
.back-to-top-ring {
  stroke: var(--gold);
  stroke-linecap: round;
  stroke-dasharray: 144.51;
  stroke-dashoffset: 144.51;
  transition: stroke-dashoffset .08s linear;
}
.back-to-top-icon {
  position: relative;
  width: 23px;
  height: 23px;
  fill: currentColor;
}

@media (max-width: 640px) {
  .searchbox { flex-direction: column; }
  .searchbox button { min-height: 46px; }
  .topbar {
    display: grid;
    grid-template-columns: 1fr auto;
    padding: 12px 16px;
  }
  .brand img { width: 36px; height: 36px; }
  .brand small { display: none; }
  .brand strong { font-size: 16px; }
  .topbar nav { justify-self: end; }
  .main-nav a:not(:first-child) { display: none; }
  .nav-search {
    grid-column: 1 / -1;
    order: 3;
    max-width: none;
    width: 100%;
    margin: 0;
  }
  .nav-search input,
  .nav-search button {
    min-height: 46px;
  }
  .toc { columns: 1; }
}
@media (max-width: 900px) {
  .doc-layout, .hub-layout { grid-template-columns: 1fr; }
  .doc-sidebar {
    position: static;
    order: 2;
  }
  .metadata-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .page { width: min(100% - 24px, 1180px); padding-top: 22px; }
  .doc-hero h1 { font-size: 30px; }
  .doc-subtitle { font-size: 16px; }
  .metadata-grid { grid-template-columns: 1fr; }
  .section-head { display: block; }
  .section-head p { margin-top: 6px; }
  .article-card, .info-card { padding: 18px; border-radius: 14px; }
  .toc-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    max-height: none;
    padding-bottom: 4px;
  }
  .toc-pills a {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 8px 13px;
  }
  .paragraph { grid-template-columns: 1fr; }
  .paragraph .note { grid-column: 1; }
  .back-to-top {
    right: 16px;
    bottom: 16px;
    width: 48px;
    height: 48px;
  }
  .back-to-top-progress {
    width: 48px;
    height: 48px;
  }
  .back-to-top-icon {
    width: 20px;
    height: 20px;
  }
}
