/* Capelanie penitenciare – stil sobru, lizibil pe telefon și pe ecran mare. Fără dependențe externe. */
:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --ink: #1f2328;
  --ink-2: #4b5160;
  --muted: #6b7280;
  --line: #e3e1db;
  --accent: #6b1f2a;       /* vișiniu bisericesc */
  --accent-2: #8a2a37;
  --accent-ink: #ffffff;
  --gold: #a07a2c;
  --ok: #15803d;
  --warn: #b45309;
  --bad: #b91c1c;
  --info: #1d4ed8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: .2rem 0 1rem; letter-spacing: -.01em; }
h2 { font-size: 1.12rem; margin: 0 0 .7rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
small, .muted { color: var(--muted); }
.wrap { max-width: 1240px; margin: 0 auto; padding: 18px 16px 60px; }

/* antet */
.top { position: sticky; top: 0; z-index: 1000; display: flex; align-items: center; gap: 16px;
  background: var(--accent); color: var(--accent-ink); padding: 8px 16px; box-shadow: 0 1px 0 rgba(0,0,0,.15); }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 650; line-height: 1.05; }
.brand small { font-weight: 450; opacity: .8; font-size: .78rem; }
.cross { font-size: 1.6rem; color: #f0d48a; }
.nav { display: flex; align-items: center; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a { color: rgba(255,255,255,.88); text-decoration: none; padding: 7px 10px; border-radius: 8px; font-size: .94rem; }
.nav a:hover, .nav a.on { background: rgba(255,255,255,.14); color: #fff; }
.nav a.muted { color: rgba(255,255,255,.7); }
.nav-sep { flex: 1; }
.nav-toggle, .nav-burger { display: none; }
.banner-warn { background: #fef3c7; color: #78350f; padding: 6px 16px; font-size: .9rem; text-align: center; border-bottom: 1px solid #fcd34d; }
@media (max-width: 860px) {
  .nav-burger { display: flex; flex-direction: column; gap: 4px; margin-left: auto; cursor: pointer; padding: 8px; }
  .nav-burger span { width: 22px; height: 2px; background: #fff; display: block; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--accent); flex-direction: column; align-items: stretch; padding: 8px 12px 14px; }
  .nav-toggle:checked ~ .nav { display: flex; }
  .nav a { padding: 11px 10px; }
  .nav-sep { display: none; }
}

/* mesaje */
.msgs { margin-bottom: 14px; display: grid; gap: 8px; }
.msg { padding: 10px 14px; border-radius: var(--radius); border: 1px solid; background: #fff; }
.msg-success { border-color: #bbf7d0; background: #f0fdf4; color: #14532d; }
.msg-error { border-color: #fecaca; background: #fef2f2; color: #7f1d1d; }
.msg-warning { border-color: #fde68a; background: #fffbeb; color: #78350f; font-weight: 600; }
.msg-info { border-color: #bfdbfe; background: #eff6ff; color: #1e3a8a; }

/* carduri, grile */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.grid > .card + .card { margin-top: 0; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g2 { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .g3, .g4 { grid-template-columns: 1fr; } }
.kpi { padding: 14px 16px; }
.kpi .v { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.kpi .l { color: var(--muted); font-size: .88rem; }
.kpi.bad .v { color: var(--bad); }
.kpi.warn .v { color: var(--warn); }
.kpi.ok .v { color: var(--ok); }
.head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.head-row h1 { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* tabele */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th { text-align: left; font-weight: 600; color: var(--ink-2); background: #faf9f6; border-bottom: 1px solid var(--line); padding: 8px 10px; white-space: nowrap; }
.tbl td { border-bottom: 1px solid var(--line); padding: 8px 10px; vertical-align: top; }
.tbl tr:hover td { background: #fcfbf8; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
dl.kv { display: grid; grid-template-columns: minmax(130px, 34%) 1fr; gap: 6px 14px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }

/* butoane și formulare */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff;
  padding: 8px 14px; border-radius: 8px; font: 600 .92rem var(--font); cursor: pointer; text-decoration: none; min-height: 38px; }
.btn:hover { background: var(--accent-2); }
.btn-ghost { background: transparent; color: var(--accent); }
.top .btn-ghost { color: #fff; border-color: rgba(255,255,255,.5); }
.btn-ghost:hover { background: rgba(107,31,42,.07); }
.btn-warn { background: #f59e0b; border-color: #f59e0b; color: #1f2328; }
.btn-sm { padding: 4px 10px; min-height: 30px; font-size: .85rem; }
.btn-lg { padding: 12px 18px; font-size: 1.02rem; min-height: 48px; }
form.inline { display: inline; margin: 0; }
.form p, .field { margin: 0 0 12px; }
label { display: block; font-weight: 600; margin-bottom: 4px; font-size: .92rem; }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=url], input[type=password],
input[type=search], select, textarea, input:not([type]) {
  width: 100%; max-width: 640px; padding: 9px 11px; border: 1px solid #cfccc4; border-radius: 8px; background: #fff;
  font: inherit; color: inherit; min-height: 40px; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(107,31,42,.35); outline-offset: 1px; border-color: var(--accent); }
input[type=checkbox] { width: 18px; height: 18px; vertical-align: middle; accent-color: var(--accent); }
.helptext, .help { display: block; color: var(--muted); font-size: .84rem; font-weight: 400; margin-top: 3px; }
.errorlist { color: var(--bad); margin: 4px 0; padding-left: 18px; font-size: .88rem; }
ul.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
ul.checks label { font-weight: 450; display: flex; gap: 8px; align-items: center; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.filters > * { flex: 0 1 190px; }
.filters input, .filters select { min-height: 36px; padding: 6px 9px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
@media (max-width: 760px) { .form-grid { grid-template-columns: 1fr; } }

/* etichete stare */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: .82rem;
  font-weight: 600; background: #f3f4f6; color: var(--ink-2); white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.pill.bad { background: #fee2e2; color: #991b1b; }
.pill.warn { background: #fef3c7; color: #92400e; }
.pill.ok { background: #dcfce7; color: #166534; }

/* hartă */
.map-layout { display: grid; grid-template-columns: 290px 1fr; gap: 14px; }
#harta { height: calc(100vh - 150px); min-height: 460px; border-radius: var(--radius); border: 1px solid var(--line); }
.legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: .9rem; }
.legend li { display: flex; align-items: center; gap: 8px; }
@media (max-width: 860px) { .map-layout { grid-template-columns: 1fr; } #harta { height: 70vh; } }

/* mobil (capelani) */
.big-list { display: grid; gap: 10px; }
.big-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.big-item strong { display: block; }
.warn-box { border: 1px solid #fcd34d; background: #fffbeb; color: #78350f; border-radius: var(--radius); padding: 12px 14px; font-size: .92rem; }
.num-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
@media (max-width: 520px) { .num-grid { grid-template-columns: 1fr; } }
.num-grid .field { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0;
  padding: 6px 0; border-bottom: 1px dashed var(--line); }
.num-grid label { font-weight: 450; margin: 0; }
.num-grid input { width: 92px; flex: none; text-align: right; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 14px; background: #fff; }
legend { font-weight: 700; padding: 0 6px; }
.sticky-save { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }

/* autentificare */
body.auth { background: linear-gradient(160deg, #6b1f2a 0%, #3b0f17 100%); min-height: 100vh; }
.auth-card { background: #fff; border-radius: 14px; padding: 26px 24px; width: calc(100% - 32px); max-width: 460px;
  margin: 8vh auto 40px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.auth-brand { font-weight: 700; color: var(--accent); margin-bottom: 14px; display: flex; gap: 8px; align-items: center; font-size: 1.05rem; }
.auth-brand .cross { color: var(--gold); }
.auth-card h1 { font-size: 1.3rem; }
.auth-card button, .auth-card [type=submit] { display: inline-flex; border: 1px solid var(--accent); background: var(--accent); color: #fff;
  padding: 10px 16px; border-radius: 8px; font: 600 .95rem var(--font); cursor: pointer; margin-top: 6px; }
.auth-card a { color: var(--accent); }
.auth-card ul { padding-left: 18px; }
.auth-card img { max-width: 100%; height: auto; }
.auth-card hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

.mt { margin-top: 14px; } .mb0 { margin-bottom: 0; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.pagination { display: flex; gap: 6px; align-items: center; margin-top: 12px; }
.report-preview { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.report-preview svg { max-width: 100%; height: auto; }

/* previzualizarea raportului în aplicație */
.report-preview h2 { color: var(--accent); border-bottom: 1px solid var(--line); padding-bottom: 4px; margin-top: 6px; }
.report-preview .r-sec { margin-bottom: 22px; overflow-x: auto; }
.report-preview .r-two { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; }
@media (max-width: 860px) { .report-preview .r-two { grid-template-columns: 1fr; } }
.report-preview table.r-tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.report-preview .r-tbl th { text-align: left; background: #faf9f6; border-bottom: 1px solid var(--line); padding: 6px 8px; font-weight: 600; color: var(--ink-2); }
.report-preview .r-tbl td { border-bottom: 1px solid var(--line); padding: 6px 8px; vertical-align: top; }
.report-preview .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.report-preview .r-nota { color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); padding-top: 8px; }

.report-preview .r-prov { border: 1px solid #f59e0b; background: #fffbeb; color: #78350f; padding: 8px 12px; border-radius: 8px; margin-bottom: 14px; }
/* registru evenimente autorizații */
.tbl tr.sub > td { background: transparent; padding-top: 0; }
.tbl-mic { font-size: .85em; margin: .4rem 0; }
.tbl tr.anulat td { text-decoration: line-through; color: var(--muted, #888); }
.tbl tr.anulat td small, .tbl tr.anulat .pill { text-decoration: none; }
summary.link { cursor: pointer; color: var(--accent, #7a1f2b); }
.tbl tr.corectura td { background: rgba(200, 150, 0, .07); }
form.inline { display: inline; }
.info-box { border: 1px solid #93c5fd; background: #eff6ff; color: #1e3a8a; border-radius: var(--radius); padding: 12px 14px; font-size: .92rem; margin-top: 10px; }
