/* ============ TOKENS (identice cu aplicația de bază, pentru continuitate vizuală) ============ */
:root {
  --font-display: 'Archivo', 'Arial Narrow', sans-serif;
  --font-body: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

  --bg: #f3f6f8;
  --surface: #ffffff;
  --surface-2: #eaeff3;
  --surface-3: #dde5eb;
  --border: #d2dbe2;
  --text: #17212c;
  --text-muted: #5c6b78;
  --text-faint: #8b98a4;

  --accent: #1d5c8a;
  --accent-strong: #103f5e;
  --accent-soft: #e2edf5;
  --on-accent: #ffffff;

  --highlight: #c1650f;
  --highlight-soft: #fbe9d9;

  --success: #2c8a57;
  --success-soft: #e1f3e7;
  --warning: #a6690a;
  --warning-soft: #fbedd6;
  --danger: #b0392b;
  --danger-soft: #fae4e1;
  --info: #3a6ea8;
  --info-soft: #e5eef7;

  --shadow-sm: 0 1px 2px rgba(15,25,35,.07);
  --shadow-md: 0 6px 20px rgba(15,25,35,.10);

  --sidebar-bg: #12233a;
  --sidebar-bg-2: #16304b;
  --sidebar-text: #b9cadb;
  --sidebar-text-dim: #7e93a8;
  --sidebar-text-active: #ffffff;
  --sidebar-accent: #d9822b;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1620; --surface: #16202c; --surface-2: #1c2836; --surface-3: #263344;
    --border: #2d3c4c; --text: #e7edf2; --text-muted: #9fb0be; --text-faint: #71828f;
    --accent: #5b9bd0; --accent-strong: #7fb2de; --accent-soft: #1c2f42; --on-accent: #07141f;
    --highlight: #e0913f; --highlight-soft: #33261a;
    --success: #4fbf85; --success-soft: #163625; --warning: #dba956; --warning-soft: #392b14;
    --danger: #e0776a; --danger-soft: #3a1e1a; --info: #7cb0e0; --info-soft: #17293b;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow-md: 0 8px 24px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 14.5px; line-height: 1.5; }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---- Layout ---- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 230px; flex: none; background: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; padding: 1.3rem 0; }
.brand { padding: 0 1.3rem 1.1rem; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: .8rem; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; color: #fff; }
.brand-name span { color: var(--sidebar-accent); }
.brand-sub { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--sidebar-text-dim); margin-top: .15rem; }
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-item { display: flex; align-items: center; gap: .65rem; padding: .65rem 1.3rem; color: var(--sidebar-text); font-weight: 500; font-size: .9rem; }
.nav-item:hover { background: rgba(255,255,255,.05); text-decoration: none; }
.nav-item.active { background: var(--sidebar-bg-2); color: var(--sidebar-text-active); border-right: 3px solid var(--sidebar-accent); }
.nav-ico { width: 22px; height: 22px; border-radius: 6px; background: rgba(255,255,255,.08); display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: .78rem; font-weight: 600; flex: none; }
.sidebar-foot { margin-top: auto; padding: 1rem 1.3rem 0; border-top: 1px solid rgba(255,255,255,.08); }
.user-chip { margin-bottom: .6rem; }
.user-name { color: #fff; font-weight: 600; font-size: .88rem; }
.user-role { color: var(--sidebar-text-dim); font-size: .76rem; }
.sidebar-link { display: block; font-size: .82rem; color: var(--sidebar-text); padding: .3rem 0; }
.sidebar-link:hover { color: #fff; }

.content { flex: 1; min-width: 0; padding: 1.6rem 2rem 3rem; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.3rem; gap: 1rem; flex-wrap: wrap; }
.page-header h1 { font-size: 1.5rem; font-weight: 800; }
.page-sub { color: var(--text-muted); margin: .2rem 0 0; font-size: .88rem; }
.page-actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; gap: .4rem; border-radius: var(--radius-sm); padding: .55rem .95rem; font-size: .86rem; font-weight: 600; font-family: var(--font-body); border: 1px solid transparent; cursor: pointer; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-strong); text-decoration: none; }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--surface-2); text-decoration: none; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: .38rem .7rem; font-size: .8rem; }

/* ---- Cards / tables ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 1.3rem; }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; overflow-x: auto; box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--border); font-size: .88rem; }
th { background: var(--surface-2); font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
.empty-state { padding: 2.3rem; text-align: center; color: var(--text-faint); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .9rem; margin-bottom: 1.3rem; }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: .95rem 1.05rem; box-shadow: var(--shadow-sm); }
.stat-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; margin-bottom: .3rem; }
.stat-value { font-family: var(--font-mono); font-size: 1.35rem; font-weight: 600; }

.pill { display: inline-block; padding: .2rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 600; }
.pill-neutral { background: var(--surface-3); color: var(--text-muted); }
.pill-success { background: var(--success-soft); color: var(--success); }
.pill-warning { background: var(--warning-soft); color: var(--warning); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-info { background: var(--info-soft); color: var(--info); }

/* ---- Forms ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; margin-bottom: 1rem; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field.span2 { grid-column: span 2; }
label { font-size: .8rem; font-weight: 600; color: var(--text-muted); }
input, select, textarea { font-family: var(--font-body); font-size: .9rem; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---- Toasts / errors ---- */
.toast { padding: .7rem 1rem; border-radius: var(--radius-md); margin-bottom: 1rem; font-size: .88rem; font-weight: 500; }
.toast-success { background: var(--success-soft); color: var(--success); }
.toast-danger { background: var(--danger-soft); color: var(--danger); }
.toast-info { background: var(--info-soft); color: var(--info); }

/* ---- Login page ---- */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 2rem; }
.auth-brand { text-align: center; margin-bottom: 1.4rem; }
.auth-brand .brand-name { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; color: var(--accent-strong); }
.auth-card .field { margin-bottom: .9rem; }
.auth-card .btn { width: 100%; justify-content: center; }

.faint { color: var(--text-faint); }
.muted { color: var(--text-muted); }
.row-actions { display: flex; gap: .4rem; }
.icon-btn { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

@media (max-width: 780px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; overflow-x: auto; align-items: center; padding: .7rem; }
  .brand, .sidebar-foot { display: none; }
  .nav-list { display: flex; }
  .content { padding: 1.2rem; }
  .form-grid { grid-template-columns: 1fr; }
  .field.span2 { grid-column: span 1; }
}
