:root {
  --bg: #101418;
  --bg-2: #161a1e;
  --card: #1b2026;
  --line: #2a3138;
  --white: #f4f7fa;
  --muted: #93a0ad;
  --gold: #e3b956;
  --gold-2: #c99f3e;
  --burgundy: #862633;
  --ok: #4fbf8b;
  --bad: #e2685f;
  --warn: #e3b956;
  --info: #6ea8d8;
  --radius: 12px;
  --shadow: 0 18px 40px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, #1d242b 0%, var(--bg) 55%);
  color: var(--white);
  font-family: Montserrat, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 12px; }
h1 { font-size: 22px; font-weight: 800; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
p { margin: 0 0 12px; }
small { color: var(--muted); }

/* ---------- auth ---------- */
.is-auth { display: grid; place-items: center; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); }
.auth-card {
  width: min(560px, 100%);
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px 26px;
  box-shadow: var(--shadow);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.auth-brand img { width: 44px; height: 44px; border-radius: 10px; }
.auth-brand span { font-weight: 800; letter-spacing: .18em; font-size: 15px; }
.auth-brand small { display: block; letter-spacing: .2em; text-transform: uppercase; font-size: 9px; color: var(--muted); }
.auth-sub { color: var(--muted); font-size: 13px; margin: 4px 0 20px; }
.auth-foot { margin-top: 18px; font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- forms ---------- */
label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
input, select, textarea {
  width: 100%;
  background: #12171c;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--white);
  padding: 12px 13px;
  font: inherit;
  font-size: 15px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(227,185,86,.45); outline-offset: 1px; border-color: var(--gold-2); }
input[type="file"] { padding: 10px; font-size: 13px; }
textarea { min-height: 84px; resize: vertical; }
.field { margin-bottom: 14px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid .full { grid-column: 1 / -1; }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 11px 18px;
  border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 700; font-size: 14px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--gold); color: #171a1d; }
.btn-primary:hover { background: #f0c968; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--white); }
.btn-ghost:hover { border-color: var(--gold-2); }
.btn-danger { background: rgba(134,38,51,.25); border-color: rgba(226,104,95,.55); color: #ffd9d6; }
.btn-sm { min-height: 38px; padding: 8px 12px; font-size: 13px; }
.btn-full { width: 100%; }
.inline { display: inline; }

.alert { padding: 11px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 16px; border: 1px solid; }
.alert-error { background: rgba(134,38,51,.2); border-color: rgba(226,104,95,.5); color: #ffd9d6; }
.alert-ok    { background: rgba(79,191,139,.12); border-color: rgba(79,191,139,.45); color: #c5f2dd; }
.alert-info  { background: rgba(110,168,216,.12); border-color: rgba(110,168,216,.45); color: #d6ebfa; }
.alert-warn  { background: rgba(227,185,86,.12); border-color: rgba(227,185,86,.45); color: #ffe9b8; }

/* ---------- app shell ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px clamp(14px, 3vw, 28px);
  background: rgba(16,20,24,.92);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(8px);
  padding-top: calc(12px + env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--white); font-weight: 800; letter-spacing: .18em; }
.brand img { width: 34px; height: 34px; border-radius: 8px; }
.brand small { display: block; font-size: 8.5px; letter-spacing: .22em; color: var(--muted); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.whoami { text-align: right; line-height: 1.2; }
.whoami strong { display: block; font-size: 13px; }
.whoami small { font-size: 11px; }
.pill { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px; border: 1px solid; }
.pill-admin { background: rgba(134,38,51,.25); border-color: rgba(227,185,86,.5); color: var(--gold); }
.pill-driver { background: rgba(110,168,216,.14); border-color: rgba(110,168,216,.5); color: var(--info); }
.bell {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 10px;
  background: transparent; cursor: pointer; font-size: 18px; line-height: 1;
  transition: background .2s, color .2s;
}
.bell:hover { background: rgba(255,255,255,.07); }
.bell:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.bell .bell-ico { display: inline-block; filter: grayscale(1); opacity: .5; transition: filter .2s, opacity .2s; }
.bell[aria-pressed="true"] .bell-ico { filter: none; opacity: 1; }
.bell[hidden] { display: none; }
.bell b { position: absolute; top: -6px; right: -10px; background: var(--burgundy); color: #fff; border-radius: 999px; font-size: 10px; padding: 1px 5px; }

.tabs {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 10px clamp(14px, 3vw, 28px);
  border-bottom: 1px solid var(--line);
  background: rgba(22,26,30,.6);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; padding: 9px 14px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted);
  font-size: 13px; font-weight: 600; text-decoration: none; min-height: 38px;
  display: inline-flex; align-items: center;
}
.tab:hover { color: var(--white); text-decoration: none; border-color: var(--gold-2); }
.tab.active { background: rgba(227,185,86,.14); border-color: rgba(227,185,86,.6); color: var(--gold); }
.tab b { margin-left: 6px; background: var(--burgundy); color: #fff; border-radius: 999px; padding: 1px 6px; font-size: 10.5px; }

.content { padding: clamp(16px, 3vw, 28px); max-width: 1180px; margin: 0 auto; padding-bottom: calc(40px + env(safe-area-inset-bottom)); }

/* ---------- cards & tables ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .n { font-size: 26px; font-weight: 800; color: var(--white); line-height: 1.1; }
.stat .l { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-top: 4px; }
.stat.warn .n { color: var(--warn); }
.stat.bad .n { color: var(--bad); }
.stat.ok .n { color: var(--ok); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }

.badge { display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; border: 1px solid; }
.badge-ok { background: rgba(79,191,139,.14); border-color: rgba(79,191,139,.45); color: #b8ecd5; }
.badge-warn { background: rgba(227,185,86,.14); border-color: rgba(227,185,86,.5); color: #ffe9b8; }
.badge-bad { background: rgba(226,104,95,.14); border-color: rgba(226,104,95,.5); color: #ffd9d6; }
.badge-muted { background: rgba(255,255,255,.06); border-color: var(--line); color: var(--muted); }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.empty { padding: 26px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* ---------- install banner / iOS hint ---------- */
.install-bar {
  display: none; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 0 16px; padding: 12px 14px;
  background: rgba(227,185,86,.1); border: 1px solid rgba(227,185,86,.45); border-radius: 12px;
  font-size: 13px; color: #ffe9b8;
}
.install-bar.show { display: flex; }
.install-bar .close { background: none; border: 0; color: inherit; font-size: 18px; cursor: pointer; }

/* ---------- print (invoices) ---------- */
@media print {
  body { background: #fff; color: #111; }
  .topbar, .tabs, .install-bar, .no-print, .btn { display: none !important; }
  .card { border: 0; box-shadow: none; padding: 0; }
  .invoice-head { color: #111; }
  table, th, td { color: #111; border-color: #ccc; }
}

/* ---------- mobile ---------- */
@media (max-width: 720px) {
  .hide-sm { display: none !important; }
  .whoami { display: none; }
  .topbar { padding-left: 14px; padding-right: 14px; }
  .brand small { display: none; }
  .tabs { padding: 9px 12px; }
  table { font-size: 12.5px; }
  th, td { padding: 9px 8px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

/* mobil: rolul se vede din conținut — scoatem pastila ca să respirе header-ul */
@media (max-width: 520px) {
  .topbar .pill { display: none; }
  .topbar { gap: 8px; }
  .brand { letter-spacing: .12em; }
  .brand small { display: none; }
}
/* taburi: margine blândă ca să nu pară tăiate la capete */
.tabs { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 10px, #000 calc(100% - 10px), transparent 100%);
        mask-image: linear-gradient(to right, transparent 0, #000 10px, #000 calc(100% - 10px), transparent 100%); }
