/* ============================================================
   SuperCantar — identitate vizuala (navy + galben brand)
   Fonturi auto-gazduite: Barlow Condensed (titluri), Exo 2 (text).
   ============================================================ */

/* TTF complete (includ diacriticele romanesti: ț ș ă â î). */
@font-face { font-family: 'Barlow Condensed'; font-weight: 600; font-display: swap; src: url('/fonts/barlow-600.ttf') format('truetype'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 700; font-display: swap; src: url('/fonts/barlow-700.ttf') format('truetype'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 800; font-display: swap; src: url('/fonts/barlow-800.ttf') format('truetype'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 900; font-display: swap; src: url('/fonts/barlow-900.ttf') format('truetype'); }
@font-face { font-family: 'Exo 2'; font-weight: 400; font-display: swap; src: url('/fonts/exo2-400.ttf') format('truetype'); }
@font-face { font-family: 'Exo 2'; font-weight: 500; font-display: swap; src: url('/fonts/exo2-500.ttf') format('truetype'); }
@font-face { font-family: 'Exo 2'; font-weight: 600; font-display: swap; src: url('/fonts/exo2-600.ttf') format('truetype'); }
@font-face { font-family: 'Exo 2'; font-weight: 700; font-display: swap; src: url('/fonts/exo2-700.ttf') format('truetype'); }
@font-face { font-family: 'Exo 2'; font-weight: 800; font-display: swap; src: url('/fonts/exo2-800.ttf') format('truetype'); }

:root {
  --bg: #f5f8fa;
  --surface: #ffffff;
  --surface-2: #f0f4f8;
  --border: #e8eef2;
  --border-strong: #e0e8ef;
  --text: #012e4d;          /* navy — text principal */
  --text-strong: #0d1b2a;   /* navy foarte inchis */
  --muted: #5a7a8a;         /* gri-albastru */
  --navy: #012e4d;
  --navy-dark: #0d1b2a;
  --primary: #ffcb08;       /* galben brand */
  --primary-hover: #e6b800;
  --primary-soft: #fffbe6;
  --danger: #dc3545;
  --danger-soft: #fdecec;
  --success: #1da851;       /* verde whatsapp */
  --success-soft: #e8f6ef;
  --radius: 12px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(1, 46, 77, .06), 0 1px 3px rgba(1, 46, 77, .05);
  --shadow: 0 4px 16px rgba(1, 46, 77, .10);
  --shadow-lg: 0 16px 48px rgba(1, 46, 77, .18);
  --font-body: 'Exo 2', 'Segoe UI', system-ui, sans-serif;
  --font-head: 'Barlow Condensed', 'Arial Narrow', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 800;
  color: var(--text);
  letter-spacing: .3px;
  text-transform: uppercase;
  line-height: 1.05;
}

/* ---------- Layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 20px;
  background: var(--navy);
  border-bottom: 3px solid var(--primary);
  padding: 0 24px; height: 64px;
}
.topbar .brand {
  display: flex; align-items: center; gap: 11px;
  font-family: var(--font-head); font-weight: 800; font-size: 21px;
  text-transform: uppercase; letter-spacing: .5px; color: #fff;
}
.topbar .brand img { height: 34px; border-radius: 4px; }
.topbar nav { display: flex; gap: 3px; margin-left: 14px; }
.topbar nav a {
  color: #b9cdda; font-weight: 600; padding: 8px 14px; border-radius: var(--radius-sm);
  text-decoration: none; font-size: 14px; letter-spacing: .2px;
}
.topbar nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.topbar nav a.active { background: var(--primary); color: var(--navy); font-weight: 700; }
.topbar .spacer { flex: 1; }
.topbar .user { display: flex; align-items: center; gap: 12px; color: #b9cdda; font-size: 13.5px; }
.topbar .user .name { color: #fff; font-weight: 600; }
.topbar .badge-role {
  font-family: var(--font-head); font-size: 12px; text-transform: uppercase;
  letter-spacing: .06em; background: var(--primary); color: var(--navy);
}

.container { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; }
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 30px; }
.page-head p { color: var(--muted); margin: 5px 0 0; font-size: 14.5px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px;
}
.card h2 { font-size: 19px; margin-bottom: 14px; }
.card h2.section { color: var(--muted); font-size: 14px; letter-spacing: .08em; }
/* Cardul "Model calculat" — centrat, sub coloane, scos in evidenta */
.model-card {
  max-width: 760px; margin: 26px auto 0;
  border: 1px solid var(--border); border-top: 5px solid var(--primary);
  box-shadow: var(--shadow);
}
.model-card h2 { font-size: 22px; color: var(--navy); text-align: center; margin-bottom: 18px; }
.model-card .model-big {
  font-family: var(--font-head); font-size: 22px; font-weight: 700;
  color: var(--navy); letter-spacing: .5px; text-align: center;
  background: var(--primary-soft); border-color: var(--primary);
}

.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 760px) { .stats { grid-template-columns: 1fr; } }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow-sm); border-left: 4px solid var(--primary);
}
/* Zona de actiuni rapide (dashboard): 1 sau 2 carduri, se aranjeaza singur. */
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
/* Spatiu intre randul de statistici si sectiunea de dedesubt (dashboard). */
.stats + .grid, .stats + .actions { margin-top: 52px !important; }
.stat .label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat .value { font-family: var(--font-head); font-size: 38px; font-weight: 800; margin-top: 4px; color: var(--navy); }
.stat .value.small { font-size: 24px; }

/* ---------- Forms ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span {
  display: block; font-size: 12.5px; color: var(--muted); font-weight: 700;
  margin-bottom: 5px; text-transform: uppercase; letter-spacing: .04em;
}
input, select, textarea {
  width: 100%; font-family: inherit; font-size: 14.5px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 9px 11px; outline: none; transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input:disabled, input[readonly] { background: var(--surface-2); color: var(--muted); }
.check { display: flex; align-items: center; gap: 9px; margin: 7px 0; font-size: 14.5px; cursor: pointer; }
.check input { width: auto; accent-color: var(--navy); }
.inline { display: flex; gap: 10px; }
.inline > * { flex: 1; }
.inline .btn { flex: 0 0 auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body); font-size: 14px; font-weight: 700; cursor: pointer;
  border: 1px solid transparent; border-radius: var(--radius-sm); padding: 9px 17px;
  text-transform: uppercase; letter-spacing: .4px;
  transition: background .12s, border-color .12s, opacity .12s; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: var(--navy); }
.btn-primary:hover { background: var(--primary-hover); text-decoration: none; }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--navy); }
.btn-ghost:hover { background: var(--surface-2); text-decoration: none; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-dark); text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .9; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
}
.badge.blue { background: var(--navy); color: #fff; }
.badge.green { background: var(--success-soft); color: var(--success); }
.badge.gray { background: var(--surface-2); color: var(--muted); }
.badge.yellow { background: var(--primary); color: var(--navy); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
table.data { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.data th {
  text-align: left; color: var(--muted); font-weight: 700; font-size: 12px;
  text-transform: uppercase; letter-spacing: .05em; padding: 12px 16px;
  border-bottom: 2px solid var(--border-strong); background: var(--surface-2);
}
table.data td { padding: 12px 16px; border-bottom: 1px solid var(--border); }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { cursor: pointer; transition: background .1s; }
table.data tbody tr:hover { background: var(--primary-soft); }
.mono { font-family: 'Consolas', 'SF Mono', monospace; font-size: 13px; }

/* ---------- Spec table ---------- */
table.spec { border-collapse: collapse; width: 100%; }
table.spec td, table.spec th { border: 1px solid var(--border-strong); padding: 7px 10px; text-align: center; font-size: 13.5px; }
table.spec th { background: var(--surface-2); color: var(--muted); text-transform: uppercase; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-dark) 60%, #071018 100%);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border);
  border-top: 4px solid var(--primary); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 34px 32px;
}
.login-card .logo { text-align: center; margin-bottom: 6px; }
.login-card .logo img { height: 54px; }
.login-card h1 { text-align: center; font-size: 28px; margin: 12px 0 2px; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 13.5px; margin-bottom: 24px; }

/* ---------- Toast ---------- */
#toasts { position: fixed; top: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--muted);
  box-shadow: var(--shadow); border-radius: var(--radius-sm); padding: 12px 16px; min-width: 260px; max-width: 380px;
  font-size: 14px; animation: slideIn .18s ease;
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }
.toast .t-title { font-weight: 700; margin-bottom: 2px; }
.toast .t-msg { color: var(--muted); font-size: 13px; }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Datepicker ---------- */
.dp-pop {
  position: fixed; z-index: 200; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 12px; width: 268px;
  font-family: var(--font-body);
}
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dp-title {
  font-family: var(--font-head); font-weight: 800; text-transform: uppercase;
  font-size: 16px; color: var(--navy); letter-spacing: .3px;
}
.dp-nav {
  width: 30px; height: 30px; border: 1px solid var(--border-strong); background: var(--surface);
  border-radius: var(--radius-sm); color: var(--navy); font-size: 18px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.dp-nav:hover { background: var(--surface-2); }
.dp-dow { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 4px; }
.dp-dow span { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-empty { height: 32px; }
.dp-day {
  height: 32px; border: none; background: transparent; border-radius: var(--radius-sm);
  color: var(--text); font-size: 13.5px; font-weight: 600; cursor: pointer; padding: 0;
}
.dp-day:hover { background: var(--primary-soft); }
.dp-day.today { box-shadow: inset 0 0 0 1.5px var(--navy); }
.dp-day.sel { background: var(--primary); color: var(--navy); font-weight: 800; }
.dp-foot { margin-top: 8px; text-align: center; }
.dp-today {
  border: none; background: var(--surface-2); color: var(--navy); font-weight: 700;
  font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 6px 14px;
  border-radius: var(--radius-sm); cursor: pointer;
}
.dp-today:hover { background: var(--primary-soft); }

.muted { color: var(--muted); }
.error-text { color: var(--danger); font-size: 13px; margin-top: 6px; min-height: 18px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.hidden { display: none !important; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 4px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; border: none; }

/* ── ERP Registrul cantarelor ── */
.badge.amber { background: #fff3d6; color: #9a6b00; }
.badge.red   { background: #fbe4e2; color: #c0392b; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.mini-row { padding: 8px 0; border-bottom: 1px solid var(--border, #e5eaf0); font-size: 13px; }
.mini-row:last-child { border-bottom: 0; }
summary.btn { display: inline-block; list-style: none; cursor: pointer; }
summary.btn::-webkit-details-marker { display: none; }
