:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1c2330;
  --muted: #5f6b7a;
  --border: #dde1e7;
  --primary: #1f4e79;
  --primary-hover: #173c5e;
  --accent-bg: #eef4fa;
  --ok: #1d7a46;
  --ok-bg: #e7f5ec;
  --warn: #8a5a00;
  --warn-bg: #fff5dc;
  --err: #a12a2a;
  --err-bg: #fdecec;
  --found: #fff8d6;
  --radius: 8px;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--primary); }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* antet */
.topbar { background: var(--primary); color: #fff; }
.topbar .inner { max-width: 1200px; margin: 0 auto; padding: .7rem 16px; display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.brand { font-weight: 700; color: #fff; text-decoration: none; margin-right: auto; }
.topbar nav { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.topbar nav a { color: #dce8f4; text-decoration: none; }
.topbar nav a:hover, .topbar nav a.activ { color: #fff; text-decoration: underline; }
.user-box { display: flex; gap: .6rem; align-items: center; font-size: .9rem; }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--accent-bg); color: var(--primary); }
.topbar .badge { background: rgba(255,255,255,.18); color: #fff; }
.link-btn { background: none; border: 0; color: #dce8f4; cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }

main { max-width: 1200px; margin: 0 auto; padding: 1.5rem 16px 3rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* butoane */
.btn { display: inline-block; padding: .5rem .95rem; border-radius: 6px; border: 1px solid var(--primary); background: var(--primary); color: #fff; text-decoration: none; cursor: pointer; font: inherit; font-weight: 600; }
.btn:hover { background: var(--primary-hover); }
.btn.secundar { background: #fff; color: var(--primary); }
.btn.secundar:hover { background: var(--accent-bg); }
.btn.pericol { background: #fff; color: var(--err); border-color: var(--err); }
.btn.mic { padding: .25rem .6rem; font-size: .85rem; }

/* tabele */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
tr:hover td { background: #fafbfc; }
.table-wrap { overflow-x: auto; }
.gol { text-align: center; color: var(--muted); padding: 2rem; }

/* formulare */
label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .25rem; }
input[type=text], input[type=password], input[type=date], input[type=number], input[type=search], input[type=email], select, textarea {
  width: 100%; padding: .45rem .6rem; border: 1px solid var(--border); border-radius: 6px; font: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc0e4; border-color: var(--primary); }
.campuri { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .9rem 1rem; }
.camp.lat { grid-column: 1 / -1; }
.camp.gasit input, .camp.gasit textarea { background: var(--found); }
.camp .help { font-size: .8rem; color: var(--muted); }
.errorlist { color: var(--err); margin: .2rem 0 0; padding: 0; list-style: none; font-size: .85rem; }
fieldset { border: 0; padding: 0; margin: 0 0 1.25rem; }
legend { font-weight: 700; font-size: 1rem; margin-bottom: .6rem; color: var(--primary); }
.checkbox-list { list-style: none; padding: 0; margin: 0; }
.checkbox-list li { padding: .25rem 0; }
.checkbox-list label, label.inline { display: inline; font-weight: normal; font-size: inherit; }

/* mesaje */
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li { padding: .65rem .9rem; border-radius: 6px; margin-bottom: .5rem; background: var(--accent-bg); }
.messages .success { background: var(--ok-bg); color: var(--ok); }
.messages .warning { background: var(--warn-bg); color: var(--warn); }
.messages .error { background: var(--err-bg); color: var(--err); }

/* text OCR */
.ocr-text { white-space: pre-wrap; font: 13px/1.45 ui-monospace, Menlo, Consolas, monospace; background: #fafbfc; border: 1px solid var(--border); border-radius: 6px; padding: .8rem; max-height: 70vh; overflow: auto; }
.legenda { display: inline-block; width: .9rem; height: .9rem; background: var(--found); border: 1px solid #e6d98a; vertical-align: middle; border-radius: 3px; }

/* date dosar */
dl.date { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
dl.date dt { color: var(--muted); font-size: .88rem; }
dl.date dd { margin: 0; }

/* mapare tipizat */
.mapare td.context { font-size: .88rem; }
.mapare .ph { background: var(--found); padding: 0 .2rem; border-radius: 3px; font-weight: 700; }
.mapare select { min-width: 220px; }
.mapare tr.nemapat td { background: #fcfcfd; }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 400px; }
.login-card h1 { color: var(--primary); }
.roluri { display: flex; gap: .4rem; flex-wrap: wrap; margin: .5rem 0 1.25rem; }
.stack > * + * { margin-top: .9rem; }

.tipizate-list label { font-weight: normal; font-size: inherit; display: flex; gap: .5rem; align-items: flex-start; padding: .35rem 0; border-bottom: 1px solid var(--border); }
.tipizate-list { max-height: 380px; overflow: auto; margin-bottom: 1rem; }
code { background: var(--accent-bg); padding: .05rem .3rem; border-radius: 4px; font-size: .88em; }

/* etape dosar */
.stare { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; background: #eef1f4; color: #3d4a57; }
.stare-nou { background: #fff1d6; color: #7a4d00; }
.stare-inregistrat { background: var(--accent-bg); color: var(--primary); }
.stare-incuviintare, .stare-incuviintat { background: #ece8fb; color: #4b3a99; }
.stare-executare { background: var(--ok-bg); color: var(--ok); }
.stare-suspendat { background: var(--err-bg); color: var(--err); }
.stare-incetat { background: #eceff1; color: #5f6b7a; }
.filtre { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.filtru { text-decoration: none; color: var(--text); border: 1px solid var(--border); background: #fff; padding: .3rem .7rem; border-radius: 999px; font-size: .88rem; }
.filtru span { color: var(--muted); margin-left: .2rem; }
.filtru.activ { background: var(--primary); border-color: var(--primary); color: #fff; }
.filtru.activ span { color: #dce8f4; }

/* jurnal */
.jurnal { list-style: none; padding: 0; margin: 0; }
.jurnal li { padding: .5rem 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 7.5rem 1fr; gap: .75rem; }
.jurnal li:last-child { border-bottom: 0; }
.jurnal .cand { color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
.jurnal .cine { color: var(--muted); font-size: .82rem; }
.tip-stare { font-weight: 600; }

/* import */
.rand-eroare td { background: var(--err-bg); }
.rand-avert td { background: var(--warn-bg); }
.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; }
.inline-form > div { flex: 1 1 180px; }

/* selecție și generare în masă */
.bara-selectie { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: .6rem .75rem; margin-bottom: .75rem; background: var(--accent-bg); border-radius: 6px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.optiuni { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .35rem 1rem; }
.optiuni label { font-weight: normal; font-size: inherit; display: flex; gap: .45rem; align-items: baseline; }
.optiuni .muted { font-size: .82rem; }
.pas { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--primary); margin-bottom: .35rem; }
.rezumat-masa { font-size: 1.05rem; padding: .75rem 1rem; background: var(--ok-bg); border-radius: 6px; }
.stare-de_trimis { background: #fff1d6; color: #7a4d00; }
.stare-trimis { background: var(--accent-bg); color: var(--primary); }
.stare-comunicat { background: var(--ok-bg); color: var(--ok); }
.stare-returnat { background: var(--err-bg); color: var(--err); }
details.actualizare summary { cursor: pointer; color: var(--primary); font-size: .88rem; }
details.actualizare form { margin-top: .5rem; display: grid; gap: .4rem; min-width: 220px; }
input[type=file] { font-size: .85rem; max-width: 100%; }

/* termene */
.alerta-termene { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; text-decoration: none; color: var(--text); background: #fff; border: 1px solid #f0c9c9; border-left: 4px solid var(--err); border-radius: 6px; padding: .6rem .9rem; margin-bottom: 1rem; }
.alerta-termene.liniste { border-color: var(--border); border-left-color: var(--primary); }
.grup-depasit { border-left: 4px solid var(--err); }
.grup-azi { border-left: 4px solid #d99a00; }
tr.termen-depasit td:first-child strong { color: var(--err); }
tr.termen-rezolvat td { color: var(--muted); text-decoration: line-through; }
tr.termen-rezolvat td:last-child { text-decoration: none; }
table.calendar { table-layout: fixed; min-width: 760px; }
table.calendar td { height: 6.5rem; vertical-align: top; padding: .3rem; border: 1px solid var(--border); }
table.calendar td.alta-luna { background: #fafbfc; color: #b0b8c1; }
table.calendar td.nelucratoare { background-image: repeating-linear-gradient(135deg, transparent 0 6px, #f1f3f5 6px 8px); }
table.calendar td.azi { outline: 2px solid var(--primary); outline-offset: -2px; }
.nr-zi { font-weight: 700; font-size: .85rem; margin-bottom: .2rem; }
.ev { display: block; font-size: .72rem; line-height: 1.25; padding: .12rem .3rem; margin-bottom: .15rem; border-radius: 3px; background: var(--accent-bg); color: var(--primary); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev.depasit { background: var(--err-bg); color: var(--err); }
.ev.rezolvat { background: #eef0f2; color: var(--muted); text-decoration: line-through; }

.carduri-import { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.card-link { text-decoration: none; color: var(--text); display: block; transition: border-color .15s; }
.card-link:hover { border-color: var(--primary); }
.card-link h2 { color: var(--primary); }

/* financiar */
.cifre { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }
.cifre > div { display: flex; flex-direction: column; min-width: 7rem; }
.cifre span { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.cifre strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.cifre .accent strong { color: var(--primary); }
.subtitlu { font-size: .95rem; margin: 1rem 0 .4rem; }
.imobil { border-top: 1px solid var(--border); padding: .6rem 0; }
.imobil:first-of-type { border-top: 0; }
.text-avert { color: var(--warn); font-weight: 600; }
.banner-cod { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; background: #fff1d6; border: 1px solid #f0d9a0; border-left: 4px solid #d99a00; border-radius: 6px; padding: .6rem .9rem; margin-bottom: 1rem; }
.qr { background: #fff; display: inline-block; padding: .5rem; border: 1px solid var(--border); border-radius: 6px; }
.qr svg { display: block; width: 220px; height: 220px; }
.cheie { word-break: break-all; letter-spacing: .05em; }
.coduri-rezerva { display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: .5rem; }
.coduri-rezerva code { font-size: 1.05rem; padding: .4rem .6rem; text-align: center; }
@media print { .topbar, .actions { display: none; } }
.linii-factura td { padding: .3rem; }
.linii-factura input { padding: .35rem .45rem; }

/* Ajutor */
.ajutor-text h2 { font-size: 1.1rem; margin: 1.4rem 0 .5rem; color: var(--primary); }
.ajutor-text h2:first-child { margin-top: 0; }
.ajutor-text p, .ajutor-text li { line-height: 1.6; }
.ajutor-text ul, .ajutor-text ol { padding-left: 1.2rem; }
.ajutor-text li { margin: .25rem 0; }
.ajutor-text table { margin: .6rem 0 1rem; }
.ajutor-text code { background: var(--accent-bg); padding: .05rem .3rem; border-radius: 4px; font-size: .9em; }
.ajutor-text .messages { margin: 1rem 0 0; }
