/* Valutera.ro - stil de bază (paleta și structura din macheta valutera-demo.html) */
:root {
  --bg: #F4F7FC;
  --ink: #0B1B3F;
  --wine: #0F3B8C;
  --wine2: #1F55B5;
  --gold: #F5B82E;
  --goldd: #9A6A0A;
  --cream: #EEF3FF;
  --line: #DAE4F5;
  --mut: #55647F;
  --up: #1B7F3B;
  --down: #B42318;
  --header-h: 76px;
  --radius: 20px;
  --font: Poppins, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
body { font-family: var(--font); background: var(--bg); color: var(--ink); line-height: 1.6; padding-top: var(--header-h); overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--gold); color: var(--ink); padding: 8px 14px; border-radius: 10px; z-index: 100; }
.skip:focus { left: 8px; }

/* ---------- Header fix ---------- */
.site-header { position: fixed; top: 0; left: 0; right: 0; height: var(--header-h); background: #fff; border-bottom: 1px solid var(--line); z-index: 50; }
.site-header .wrap { display: flex; align-items: center; gap: 28px; height: 100%; }
.brand { display: flex; align-items: center; flex: none; line-height: 1; }
.brand .logo { display: block; height: 36px; width: auto; }
.site-nav { display: flex; gap: 28px; margin: 0 auto; font-size: 15px; font-weight: 600; color: var(--ink); }
.site-nav a { padding: 8px 0; border-bottom: 2px solid transparent; transition: color .15s, border-color .15s; }
.site-nav a:hover { color: var(--wine2); border-color: var(--wine2); }
.site-nav a.on { border-color: var(--wine); }
.site-nav a.cta { background: var(--gold); color: var(--ink); box-shadow: 0 4px 0 var(--goldd); }
.site-nav a.cta:hover { background: #FFC94D; color: var(--ink); }
.search { position: relative; display: flex; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 3px 3px 3px 14px; width: 250px; flex: none; }
.search:focus-within { border-color: var(--wine2); box-shadow: 0 0 0 3px rgba(31,85,181,.12); }
.search input { flex: 1; min-width: 0; border: 0; background: none; padding: 8px 0; outline: 0; font: inherit; font-size: 14px; color: var(--ink); width: auto; }
.search button { position: static; transform: none; background: var(--gold); color: var(--ink); border: 0; border-radius: 9px; width: 38px; height: 38px; cursor: pointer; display: grid; place-items: center;  flex: none; }
.search button:hover { filter: brightness(1.07); }
.search-results { position: absolute; top: calc(100% + 8px); left: -2px; right: -2px; list-style: none; padding: 6px; margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px rgba(15,59,140,.15); max-height: 320px; overflow: auto; z-index: 60; }
.search-results[hidden] { display: none; }
.search-results li a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; font-size: 14px; }
.search-results li a:hover, .search-results li a.active { background: var(--cream); }
.search-results .name { color: var(--mut); }

/* ---------- Hero ---------- */
.hero { background: var(--wine); color: var(--cream); padding: 64px 0 120px; }
.hero .wrap { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
.hero .wrap > * { min-width: 0; }
.hero-small { padding: 40px 0 96px; }
.hero-small .wrap { display: block; }
.tag { display: inline-block; background: rgba(245,184,46,.16); color: var(--gold); font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: 99px; margin-bottom: 20px; letter-spacing: .3px; }
.hero h1 { font-size: 46px; line-height: 1.15; letter-spacing: -1px; margin-bottom: 18px; color: #fff; }
.hero h1 em { font-style: normal; color: var(--gold); }
.hero p { color: #CFDDF7; font-size: 17px; max-width: 480px; }
.hero p a { color: var(--gold); text-decoration: underline; }
.hero time { color: inherit; }
.main-rates { list-style: none; padding: 0; margin: 24px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; max-width: 520px; }
.main-rate a { display: block; padding: 12px 14px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); border-radius: 14px; }
.main-rate a:hover { background: rgba(255,255,255,.12); }
.main-rate .code { display: block; color: var(--gold); font-weight: 700; font-size: 13px; letter-spacing: .5px; }
.main-rate .value { display: block; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; color: #fff; }
.main-rate .change { font-size: 12.5px; }
.hero .change-up { color: #7FE0A1; }
.hero .change-down { color: #FFA394; }
.hero .change-flat { color: #CFDDF7; }
.current-rate { font-size: 17px; }
.current-rate .value { font-size: 40px; font-weight: 700; color: #fff; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.current-rate .unit { color: #CFDDF7; margin-right: 10px; }
.mode-switch { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.mode-switch a { font-size: 14px; padding: 8px 14px; border-radius: 99px; border: 1px solid rgba(255,255,255,.25); color: #CFDDF7; }
.hero .mode-switch a { text-decoration: none; }
.mode-switch a.on { background: var(--gold); color: var(--ink); border-color: var(--gold); font-weight: 600; }

/* ---------- Convertor (card în hero) ---------- */
.conv { background: #fff; color: var(--ink); border-radius: var(--radius); padding: 28px; box-shadow: 0 24px 60px rgba(0,0,0,.28); }
.conv h2 { font-size: 18px; margin-bottom: 16px; }
.conv .row { display: grid; grid-template-columns: 1fr 110px; gap: 10px; margin-bottom: 12px; }
input, select, output { font: inherit; padding: 13px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); width: 100%; display: block; }
output { min-height: 50px; font-variant-numeric: tabular-nums; font-weight: 600; }
input:focus, select:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
.swap { display: flex; justify-content: center; margin: 2px 0 10px; }
.swap button { background: var(--cream); border: 1.5px solid var(--line); border-radius: 99px; width: 40px; height: 40px; cursor: pointer; color: var(--wine); font-size: 18px; }
.res { background: var(--cream); border-radius: 14px; padding: 16px 18px; margin-top: 6px; }
.res small { color: var(--mut); display: block; font-size: 13px; }
.res strong { font-size: 26px; color: var(--wine); letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.conv-submit { display: block; width: 100%; margin-top: 14px; }
.conv-submit:hover { background: var(--wine2); }

/* ---------- Butoane ---------- */
.button { display: inline-block; padding: 13px 20px; border: 0; border-radius: 12px; background: var(--wine); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-align: center; }
.button:hover { background: var(--wine2); }

/* ---------- Card-uri ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); position: relative; box-shadow: 0 12px 40px rgba(15,59,140,.08); overflow: hidden; margin-bottom: 28px; }
.hero + .wrap > .card:first-child { margin-top: -72px; }
.chead { display: flex; justify-content: space-between; align-items: center; padding: 22px 28px; border-bottom: 1px solid var(--line); flex-wrap: wrap; gap: 10px; }
.chead h2 { font-size: 21px; }
.chead > span { font-size: 13px; color: var(--goldd); background: var(--cream); padding: 6px 12px; border-radius: 99px; font-weight: 600; }
.note { padding: 14px 28px; font-size: 13px; color: var(--mut); border-top: 1px solid var(--line); }
.note a { color: var(--wine); text-decoration: underline; }

/* ---------- Tabele ---------- */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--mut); padding: 14px 28px; background: var(--bg); font-weight: 600; }
td { padding: 16px 28px; border-top: 1px solid var(--line); }
th.num, td.num { text-align: right; }
.code { display: inline-block; background: var(--wine); color: var(--gold); font-weight: 700; font-size: 13px; padding: 4px 10px; border-radius: 8px; letter-spacing: .5px; }
.val { font-weight: 700; color: var(--wine); }
tbody tr:hover { background: var(--cream); }
.change-up { color: var(--up); }
.change-down { color: var(--down); }
.change-flat { color: var(--mut); }
.change small { font-size: 12px; }

/* ---------- Pagina de valută ---------- */
.period-switch, .day-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.period-switch a, .day-nav a { font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 99px; border: 1px solid var(--line); color: var(--mut); }
.period-switch a.on { background: var(--wine); color: #fff; border-color: var(--wine); }
.period-switch a:hover, .day-nav a:hover { color: var(--wine); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0; margin: 0; }
.stats div { padding: 18px 28px; border-right: 1px solid var(--line); }
.stats div:last-child { border-right: 0; }
.stats dt { color: var(--mut); font-size: 12px; text-transform: uppercase; letter-spacing: .8px; }
.stats dd { margin: 0; font-size: 22px; font-weight: 700; color: var(--wine); font-variant-numeric: tabular-nums; }
.chart { padding: 8px 28px 0; }
.chart svg { width: 100%; height: auto; display: block; color: var(--wine); }
.chart .area { fill: rgba(15,59,140,.08); }
.chart .axis { font-size: 11px; fill: var(--mut); }
.other-currencies { margin: 8px 0 40px; }
.other-currencies h2 { font-size: 20px; margin-bottom: 12px; }
.other-currencies ul { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.other-currencies li a { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.other-currencies li a:hover { background: var(--cream); }
.other-currencies small { color: var(--mut); }

/* ---------- Convertor (pagină) ---------- */
.converter { padding: 28px; }
.converter-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.field label { display: block; font-size: 13px; color: var(--mut); margin-bottom: 6px; font-weight: 500; }
.converter-result { margin-top: 20px; }
.converter-result strong { display: block; }
.converter .note { padding: 16px 0 0; border: 0; }

/* ---------- Reclame ---------- */
.ad-slot { margin: 28px 0; min-height: 90px; }
.ad-slot ins { display: block; }

/* ---------- Secțiuni prima pagină ---------- */
.feat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 48px 0; }
.feat div { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 26px; }
.feat i { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--wine); color: var(--gold); font-style: normal; font-weight: 700; margin-bottom: 14px; }
.feat h3 { font-size: 17px; margin-bottom: 6px; }
.feat p { font-size: 14.5px; color: var(--mut); }
.archive { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 26px; margin-bottom: 48px; }
.archive h2 { font-size: 20px; margin-bottom: 12px; }
.date-picker { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.date-picker label { flex-basis: 100%; font-size: 13px; color: var(--mut); font-weight: 500; }
.date-picker input { width: auto; }
.archive .links { margin-top: 14px; font-size: 14px; color: var(--mut); }
.archive .links a { color: var(--wine); text-decoration: underline; }

/* ---------- Documentație / pagini de text ---------- */
.prose { padding: 10px 28px 28px; }
.prose h2 { font-size: 18px; margin: 22px 0 8px; }
.prose p { margin-bottom: 10px; color: #2B3A5C; }
.prose a { color: var(--wine); text-decoration: underline; }
.endpoints { padding: 10px 28px 20px; }
.endpoints dt { margin-top: 16px; }
.endpoints dd { margin: 4px 0 0; color: var(--mut); font-size: 14.5px; }
pre { overflow: auto; margin: 20px 28px; padding: 16px; background: var(--ink); color: var(--cream); border-radius: 14px; font-family: var(--mono); font-size: 13px; line-height: 1.5; }
code { font-family: var(--mono); font-size: .92em; }
.endpoints code, .note-list code { background: var(--cream); padding: 2px 6px; border-radius: 6px; color: var(--wine); }
.note-list { margin: 0 28px 24px; padding-left: 20px; color: var(--mut); font-size: 14.5px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #B6C6E3; padding: 48px 0 28px; font-size: 14.5px; margin-top: 24px; }
.site-footer .cols { display: grid; grid-template-columns: 1.1fr 1fr 1.3fr 1fr; gap: 32px; }
.site-footer .brand { margin-bottom: 18px; }
.site-footer .brand .logo { height: 30px; }
.site-footer nav ul, .badges { list-style: none; padding: 0; margin: 0; }
.site-footer nav li { margin-bottom: 10px; }
.site-footer nav a:hover { color: #fff; text-decoration: underline; }
.site-footer h2 { font-size: 16px; color: #fff; display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.site-footer h2 svg { color: var(--gold); flex: none; }
.site-footer .f-info p { font-size: 14px; line-height: 1.65; }
.badges li { margin-bottom: 8px; }
.badges img { display: block; width: 200px; height: auto; }
.copyright { border-top: 1px solid rgba(255,255,255,.12); margin-top: 36px; padding-top: 20px; font-size: 14px; }

/* ---------- Buton „sus” ---------- */
.to-top { position: fixed; right: 20px; bottom: 20px; width: 46px; height: 46px; border-radius: 14px; background: var(--wine); color: var(--gold); display: grid; place-items: center; box-shadow: 0 12px 30px rgba(15,59,140,.3); z-index: 40; opacity: 0; transform: translateY(12px); transition: opacity .2s, transform .2s; }
.to-top[hidden] { display: grid; pointer-events: none; }
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }

/* ---------- Meniu burger (doar pe mobil, doar cu JavaScript) ---------- */
.nav-toggle { display: none; }
/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .brand .logo { height: 32px; }
  .site-header .wrap { gap: 20px; }
  .site-nav { gap: 18px; }
  .search { width: 210px; }
}
@media (max-width: 920px) {
  .hero .wrap, .feat { grid-template-columns: 1fr; }
  .hero h1 { font-size: 34px; }
  .site-footer .cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  :root { --header-h: 120px; }
  .wrap { padding: 0 16px; }
  .site-header .wrap { flex-wrap: wrap; gap: 6px 10px; align-content: center; }
  .brand .logo { height: 22px; }
  .site-nav { gap: 22px; font-size: 14px; margin: 0; order: 3; width: 100%; overflow-x: auto; white-space: nowrap; }
  .site-nav a { padding: 4px 0; }
  .search { flex: 1 1 110px; width: auto; min-width: 0; margin-left: auto; padding: 2px 2px 2px 10px; }
  .search button { width: 34px; height: 34px; }
  .hero h1 { font-size: 30px; }
  .hero { padding-top: 32px; }
  .main-rates { grid-template-columns: 1fr 1fr; }
  .conv { padding: 20px; }
  th, td, .chead, .note, .stats div, .chart, .endpoints, .prose { padding-left: 16px; padding-right: 16px; }
  pre, .note-list { margin-left: 16px; margin-right: 16px; }
  .site-footer .cols { grid-template-columns: 1fr; }
  .hero { padding-bottom: 96px; }
  .rates-table th:nth-child(3), .rates-table td:nth-child(3) { display: none; }
}

/* ---------- Mobil îngust: tabele, formulare, text ---------- */
.prose { overflow-wrap: break-word; }
.prose table { margin: 8px 0 16px; font-size: 14.5px; }
.prose th, .prose td { padding: 10px 14px; vertical-align: top; }
.prose h3 { font-size: 16px; margin: 18px 0 6px; }
.site-footer .f-info p, .copyright { overflow-wrap: break-word; }
.badges img { max-width: 100%; }
@media (max-width: 720px) {
  .prose th, .prose td { padding-left: 10px; padding-right: 10px; }
}
@media (max-width: 640px) {
  /* Tabelele din paginile legale devin fișe: eticheta coloanei vine din data-label. */
  .stack-table, .stack-table tbody, .stack-table tr, .stack-table td { display: block; width: 100%; }
  .stack-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .stack-table tr { border: 1px solid var(--line); border-radius: 14px; padding: 6px 0; margin-bottom: 12px; background: #fff; }
  .stack-table tbody tr:hover { background: #fff; }
  .stack-table td { border: 0; padding: 6px 14px; }
  .stack-table td::before { content: attr(data-label); display: block; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; color: var(--mut); }
  .stack-table td:first-child { font-weight: 600; color: var(--ink); }
}
@media (max-width: 560px) {
  /* Tabelul de cursuri devine o listă: cod | denumire | curs + variație. */
  .rates-table, .rates-table tbody { display: block; width: 100%; }
  .rates-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .rates-table tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "code name rate" "code name change"; column-gap: 12px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); }
  .rates-table td { display: block; padding: 0; border: 0; }
  .rates-table td:nth-child(1) { grid-area: code; }
  .rates-table td:nth-child(2) { grid-area: name; font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
  .rates-table td:nth-child(3) { display: none; }
  .rates-table td:nth-child(4) { grid-area: rate; align-self: end; }
  .rates-table td:nth-child(5) { grid-area: change; align-self: start; font-size: 12.5px; line-height: 1.3; }
  .rates-table .change small { display: block; }
  /* Istoricul pe 3 coloane: mai puțin spațiu orizontal. */
  .history-table th, .history-table td { padding-left: 12px; padding-right: 12px; }
  .history-table th { letter-spacing: .4px; font-size: 11px; }
  .stats div { padding: 14px 16px; }
  .stats dd { font-size: 19px; }
  .chead h2 { font-size: 18px; }
  .current-rate .value { font-size: 32px; }
  .hero h1 { font-size: 26px; overflow-wrap: break-word; }
  .converter { padding: 20px 16px; }
  .converter-form { grid-template-columns: 1fr; }
  .res strong { font-size: 21px; overflow-wrap: anywhere; }
  .archive { padding: 20px 16px; }
  .date-picker input { flex: 1 1 150px; min-width: 0; }
  .feat div { padding: 20px; }
}
@media (max-width: 360px) {
  .brand .logo { height: 18px; }
  .search input { font-size: 13px; }
  .site-nav { gap: 18px; }
  .conv { padding: 16px; }
  .conv .row { grid-template-columns: minmax(0, 1fr) 92px; }
  .main-rate a { padding: 10px; }
  .main-rate .value { font-size: 19px; }
  .history-table th, .history-table td { padding-left: 8px; padding-right: 8px; }
}

/* Burger pe mobil: logo, căutare și buton pe un rând; linkurile într-un panou sub header. Fără JS rămâne meniul pe rândul al doilea. */
@media (max-width: 720px) {
  :root.js { --header-h: 64px; }
  .js .site-header .wrap { flex-wrap: nowrap; gap: 10px; }
  .js .search { order: 2; }
  .js .nav-toggle { order: 3; display: grid; place-items: center; flex: none; width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); cursor: pointer; }
  .js .nav-toggle span, .js .nav-toggle span::before, .js .nav-toggle span::after { display: block; width: 18px; height: 2px; border-radius: 2px; background: currentColor; transition: transform .2s, opacity .2s; }
  .js .nav-toggle span { position: relative; }
  .js .nav-toggle span::before, .js .nav-toggle span::after { content: ""; position: absolute; left: 0; }
  .js .nav-toggle span::before { top: -6px; }
  .js .nav-toggle span::after { top: 6px; }
  .js .nav-open .nav-toggle span { background: transparent; }
  .js .nav-open .nav-toggle span::before { transform: translateY(6px) rotate(45deg); }
  .js .nav-open .nav-toggle span::after { transform: translateY(-6px) rotate(-45deg); }
  .js .site-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 0; width: auto; margin: 0; padding: 4px 16px 12px; background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 16px 32px rgba(11,27,63,.10); font-size: 16px; overflow: visible; white-space: normal; }
  .js .nav-open .site-nav { display: flex; }
  .js .site-nav a { padding: 14px 4px; border-bottom: 1px solid var(--line); }
  .js .site-nav a:last-child { border-bottom: 0; }
  .js .site-nav a.on { color: var(--wine); border-color: var(--line); box-shadow: inset 3px 0 0 var(--wine); padding-left: 12px; }
  .js .site-nav a:hover { border-color: var(--line); }
}
