:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --card: #ffffff;
  --text: #1c2b24;
  --muted: #5f6f68;
  --border: #dbe3de;
  --primary: #1f8a4c;
  --primary-dark: #166b3a;
  --danger: #c0392b;
  --warn: #b8860b;
  --ok: #1f8a4c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

header.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: var(--primary);
  color: white;
  flex-wrap: wrap;
  gap: 10px;
}
header.topbar h1 { font-size: 18px; margin: 0; }
header.topbar nav a { color: white; margin-left: 16px; text-decoration: underline; cursor: pointer; }

.admin-nav {
  display: flex;
  gap: 6px;
  padding: 10px 20px;
  background: #eef2ef;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.admin-nav button {
  background: none;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  position: relative;
}
.admin-nav button.active { background: var(--primary); color: white; }
.admin-nav button .badge-count {
  display: inline-block;
  background: var(--danger);
  color: white;
  border-radius: 20px;
  padding: 1px 7px;
  font-size: 11px;
  margin-left: 6px;
}

main { max-width: 760px; margin: 24px auto; padding: 0 16px; }
main.wide { max-width: 1200px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
textarea { min-height: 70px; }

button {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
}
button.primary { background: var(--primary); color: white; }
button.primary:hover { background: var(--primary-dark); }
button.secondary { background: #e8ede9; color: var(--text); }
button.danger { background: var(--danger); color: white; }
button.link { background: none; color: var(--primary); text-decoration: underline; padding: 4px; }
button.small { padding: 4px 8px; font-size: 12px; }
button:disabled { opacity: .5; cursor: not-allowed; }

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 2px solid rgba(255,255,255,.5);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: -2px;
  animation: bc-spin .7s linear infinite;
}
@keyframes bc-spin { to { transform: rotate(360deg); } }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 120px; }

.msg { padding: 10px; border-radius: 6px; margin: 10px 0; font-size: 14px; }
.msg.error { background: #fdecea; color: var(--danger); }
.msg.ok { background: #e8f6ec; color: var(--ok); }

.badge { display: inline-block; padding: 3px 8px; border-radius: 20px; font-size: 12px; font-weight: 600; margin: 1px 3px 1px 0; }
.badge.verif { background: #fff4d6; color: var(--warn); }
.badge.ok { background: #e8f6ec; color: var(--ok); }
.badge.respins { background: #fdecea; color: var(--danger); }
.badge.contab { background: #e6eefc; color: #2a5db0; }
.badge.decontat { background: #e8f6ec; color: var(--ok); }
.badge.nesigur { background: #f1eafd; color: #6b3fa0; }
.badge.duplicat { background: #ffe8d1; color: #b05a00; }
.badge.eroare { background: #fdecea; color: var(--danger); }

.ocr-box { border: 1px solid var(--border); border-radius: 8px; padding: 14px; margin-top: 16px; background: #fbfdfc; }
.ocr-box h3 { margin: 0 0 8px; font-size: 15px; }
.ocr-compare-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.ocr-compare-table th, .ocr-compare-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.ocr-compare-table tr.diff td { background: #fdecea; }
.ocr-duplicate { background: #ffe8d1; border-radius: 6px; padding: 10px; margin: 8px 0; font-size: 13px; }
#modalOcrRaw { white-space: pre-wrap; font-size: 12px; max-height: 200px; overflow-y: auto; background: #f4f6f5; padding: 8px; border-radius: 6px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { background: #eef2ef; }
.table-wrap { overflow-x: auto; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #f5faf7; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; align-items: flex-end; }
.filters > div { min-width: 140px; }

.hidden { display: none !important; }
a.poza-link { color: var(--primary); font-weight: 600; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat-tile { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 18px; text-align: center; }
.stat-tile .num { font-size: 30px; font-weight: 700; color: var(--primary); }
.stat-tile .lbl { font-size: 13px; color: var(--muted); margin-top: 4px; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal-panel {
  background: var(--card); border-radius: 10px; max-width: 900px; width: 100%;
  max-height: 90vh; overflow-y: auto; padding: 22px;
}
.modal-panel h2 { margin-top: 0; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 700px) { .modal-grid { grid-template-columns: 1fr; } }
.modal-photo iframe { width: 100%; height: 420px; border: 1px solid var(--border); border-radius: 8px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
