/* =====================================================
   FLI Pontaj — Design System
   Tokens, layout primitives, componente
   ===================================================== */

:root {
  /* Neutrale */
  --c-bg: #f6f8fb;
  --c-surface: #ffffff;
  --c-surface-alt: #f8fafc;
  --c-border: #e6e9ef;
  --c-border-strong: #cbd5e1;
  --c-text: #0f172a;
  --c-text-secondary: #475569;
  --c-text-muted: #94a3b8;

  /* Brand (paleta FLI) */
  --c-primary: #1B9DD9;          /* albastru FLI */
  --c-primary-hover: #1583b8;
  --c-primary-soft: #e8f6fc;
  --c-primary-soft-text: #0e6a91;

  /* Semantic (derivate din paleta FLI, ajustate pentru contrast/text lizibil) */
  --c-success: #4d7d2b;          /* text/buton verde — derivat din verdele FLI #7AB648 */
  --c-success-soft: #eef7e3;
  --c-success-border: #cbe6ad;

  --c-warning: #b5650a;          /* text portocaliu — derivat din portocaliul FLI #F39019 */
  --c-warning-soft: #fff3e2;
  --c-warning-border: #fcd9a8;

  --c-danger: #d9242a;           /* rosu FLI */
  --c-danger-soft: #fdecec;
  --c-danger-border: #f6c2c4;

  --c-info: #0e6a91;
  --c-info-soft: #e8f6fc;
  --c-info-border: #b6e3f5;

  /* Spacing scale (4px base) */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;  --sp-10: 40px; --sp-12: 48px;

  /* Radii */
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px; --r-full: 9999px;

  /* Shadows (low elevation, business-feel) */
  --sh-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --sh-md: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --sh-lg: 0 10px 25px -8px rgba(15, 23, 42, 0.12), 0 4px 8px -4px rgba(15, 23, 42, 0.06);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

/* =====================================================
   Topbar
   ===================================================== */
.topbar {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: 0 var(--sp-6);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-weight: 700;
  font-size: 16px;
  color: var(--c-text);
  letter-spacing: -0.01em;
}
.topbar-logo {
  height: 56px;
  width: auto;
  display: block;
}
.brand-dot {
  width: 30px;
  height: 30px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--c-primary) 0%, #1583b8 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--sh-sm);
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.topbar-user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  line-height: 1.2;
}
.topbar-user-info .name {
  font-weight: 600;
  font-size: 13px;
  color: var(--c-text);
  white-space: nowrap;
}
.topbar-user-info .role {
  margin-top: 1px;
  color: var(--c-text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}
.topbar-divider {
  width: 1px;
  height: 28px;
  background: var(--c-border);
  flex-shrink: 0;
}
.btn-logout {
  background: var(--c-surface-alt);
  color: var(--c-text-secondary);
  border-color: var(--c-border-strong);
}
.btn-logout:hover {
  background: var(--c-danger-soft);
  border-color: var(--c-danger-border);
  color: var(--c-danger);
}
.btn-logout svg {
  width: 15px;
  height: 15px;
}

/* =====================================================
   Buttons
   ===================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 8px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.05s ease;
  white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--c-primary); color: white; }
.btn-primary:hover { background: var(--c-primary-hover); }

.btn-secondary { background: var(--c-surface); color: var(--c-text); border-color: var(--c-border-strong); }
.btn-secondary:hover { background: var(--c-surface-alt); border-color: var(--c-text-muted); }

.btn-ghost { background: transparent; color: var(--c-text-secondary); }
.btn-ghost:hover { background: var(--c-surface-alt); color: var(--c-text); }

.btn-success { background: var(--c-success); color: white; }
.btn-success:hover { filter: brightness(0.92); }

.btn-danger { background: var(--c-danger); color: white; }
.btn-danger:hover { filter: brightness(0.92); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 20px; font-size: 14px; font-weight: 600; }
.btn-block { width: 100%; }

/* =====================================================
   Forms
   ===================================================== */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--c-text-secondary);
}
.input, .select {
  width: 100%;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  background: var(--c-surface);
  color: var(--c-text);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus, .select:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(27, 157, 217, 0.18);
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8.5L2 4.5h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
input[type="date"].input {
  appearance: none;
}

/* =====================================================
   Cards
   ===================================================== */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}
.card-header {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-size: 14px; }
.card-subtitle { font-size: 13px; color: var(--c-text-muted); }
.card-body { padding: var(--sp-5); }

/* =====================================================
   Tables
   ===================================================== */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  /* `separate` + spatiere zero arata identic cu `collapse` (bordurile sunt
     doar pe latura de jos, deci nu se dubleaza), dar fara modelul de borduri
     fuzionate care producea decalaje de un pixel intre antet si coloane. */
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.table th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-text-muted);
  background: var(--c-surface-alt);
  padding: 10px var(--sp-4);
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}
.table td {
  padding: 12px var(--sp-4);
  border-bottom: 1px solid var(--c-border);
  vertical-align: top;
  color: var(--c-text);
}
.table tbody tr:nth-child(even) td { background: rgba(248, 250, 252, 0.55); }
.table tbody tr:hover td { background: var(--c-primary-soft); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr.row-suspect td { background: var(--c-warning-soft) !important; }
.table tbody tr.row-suspect:hover td { background: #ffe9cc !important; }
.table tbody tr.row-self td { background: var(--c-primary-soft) !important; }
.table tbody tr.row-self:hover td { background: #d4eefb !important; }

.stat { font-variant-numeric: tabular-nums; }
.thumb {
  width: 44px; height: 44px;
  object-fit: cover;
  border-radius: var(--r-sm);
  border: 1px solid var(--c-border);
  cursor: zoom-in;
  display: block;
}

/* =====================================================
   Badges
   ===================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: var(--r-full);
  white-space: nowrap;
}
.badge-primary { background: var(--c-primary-soft); color: var(--c-primary-soft-text); }
.badge-success, .badge-ok, .badge-in { background: var(--c-success-soft); color: var(--c-success); }
.badge-warn { background: var(--c-warning-soft); color: var(--c-warning); }
.badge-danger, .badge-out { background: var(--c-danger-soft); color: var(--c-danger); }
.badge-absent { background: var(--c-danger-soft); color: var(--c-danger); }
.badge-neutral { background: #f1f5f9; color: var(--c-text-secondary); }
.badge-pending { background: var(--c-warning-soft); color: var(--c-warning); }

/* =====================================================
   Tabs (orizontale, indicator clar pe activ)
   ===================================================== */
.tabs {
  display: flex;
  gap: var(--sp-1);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: 0 var(--sp-6);
  position: sticky;
  top: 64px;
  z-index: 15;
}
.tab {
  position: relative;
  padding: 14px var(--sp-4);
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  border: none;
  background: transparent;
}
.tab:hover { color: var(--c-text); text-decoration: none; }
.tab.active { color: var(--c-primary); font-weight: 600; }
.tab.active::after {
  content: '';
  position: absolute;
  left: var(--sp-4);
  right: var(--sp-4);
  bottom: -1px;
  height: 2px;
  background: var(--c-primary);
  border-radius: 2px 2px 0 0;
}
.tab-warning { color: var(--c-warning); font-weight: 700; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* =====================================================
   Container / Layout
   ===================================================== */
.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: var(--sp-6);
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: var(--sp-4);
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.section-title { font-size: 20px; }
.section-subtitle { margin-top: var(--sp-1); font-size: 13px; color: var(--c-text-muted); }

/* Grup de actiuni in dreapta unui section-header (buton refresh + selector data) */
.section-actions {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-3);
}

/* Buton rotund de reimprospatare (brand FLI) — feedback prin spin la incarcare */
.btn-refresh {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--c-surface);
  color: var(--c-primary);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-full);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.06s ease, box-shadow 0.15s ease;
}
.btn-refresh svg { width: 17px; height: 17px; display: block; }
.btn-refresh:hover {
  background: var(--c-primary);
  color: #fff;
  border-color: var(--c-primary);
  box-shadow: 0 4px 12px -4px rgba(27, 157, 217, 0.5);
}
.btn-refresh:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
.btn-refresh:active { transform: scale(0.9); }
.btn-refresh.is-spinning { color: var(--c-primary); pointer-events: none; }
.btn-refresh.is-spinning svg { animation: fli-spin 0.7s linear infinite; transform-origin: 50% 50%; }
@keyframes fli-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .btn-refresh.is-spinning svg { animation: none; }
}

/* =====================================================
   Alerts
   ===================================================== */
.alert {
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5);
  border: 1px solid;
  display: flex;
  gap: var(--sp-3);
  align-items: start;
  font-size: 13px;
}
.alert-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-full);
  font-size: 13px;
  font-weight: 700;
}
.alert-body { flex: 1; line-height: 1.55; }
.alert-title { font-weight: 600; margin-bottom: 2px; font-size: 13px; }
.alert-warning { background: var(--c-warning-soft); border-color: var(--c-warning-border); color: var(--c-warning); }
.alert-warning .alert-icon { background: var(--c-warning); color: white; }
.alert-danger { background: var(--c-danger-soft); border-color: var(--c-danger-border); color: var(--c-danger); }
.alert-danger .alert-icon { background: var(--c-danger); color: white; }
.alert-info { background: var(--c-info-soft); border-color: var(--c-info-border); color: var(--c-info); }

/* =====================================================
   Empty states
   ===================================================== */
.empty-state {
  padding: var(--sp-12) var(--sp-6);
  text-align: center;
  color: var(--c-text-muted);
}
.empty-state-icon {
  width: 44px; height: 44px;
  margin: 0 auto var(--sp-3);
  border-radius: var(--r-full);
  background: var(--c-surface-alt);
  border: 1px solid var(--c-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-muted);
  font-size: 18px;
  font-weight: 700;
}

/* =====================================================
   Inline forms / Vacation new
   ===================================================== */
.vacation-new { margin-bottom: var(--sp-5); }
.vacation-new summary {
  cursor: pointer;
  padding: 8px 14px;
  background: var(--c-primary-soft);
  color: var(--c-primary-soft-text);
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  list-style: none;
  display: inline-block;
  border: 1px solid transparent;
  transition: border-color 0.15s ease;
}
.vacation-new summary::-webkit-details-marker { display: none; }
.vacation-new[open] summary { border-color: var(--c-primary); }
.inline-form {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  align-items: end;
  margin-top: var(--sp-4);
  padding: var(--sp-4);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
}
.inline-form .field { min-width: 160px; }

/* =====================================================
   Debug (subtil, jos)
   ===================================================== */
.debug-section {
  margin-top: var(--sp-5);
}
.debug-section summary {
  cursor: pointer;
  display: inline-block;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  border: 1px dashed var(--c-border-strong);
  border-radius: var(--r-md);
  list-style: none;
}
.debug-section summary::-webkit-details-marker { display: none; }
.debug-section summary:hover {
  color: var(--c-text-secondary);
  border-color: var(--c-text-muted);
}
.debug-section pre {
  margin: var(--sp-3) 0 0;
  padding: var(--sp-4);
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--r-md);
  font-size: 11.5px;
  font-family: var(--font-mono);
  overflow-x: auto;
  max-height: 400px;
  line-height: 1.5;
}

/* =====================================================
   Login
   ===================================================== */
body.auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  background:
    radial-gradient(circle at 50% -10%, rgba(27, 157, 217, 0.13), transparent 55%),
    radial-gradient(circle at 0% 100%, rgba(27, 157, 217, 0.07), transparent 45%),
    linear-gradient(180deg, #eaf3f9 0%, #f4f7fb 60%, #eef2f7 100%);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 20px;
  padding: var(--sp-10) var(--sp-8) var(--sp-8);
  box-shadow:
    0 24px 50px -16px rgba(15, 23, 42, 0.20),
    0 8px 20px -10px rgba(27, 157, 217, 0.14);
}
.auth-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: var(--sp-6);
}
.auth-logo-img {
  width: 100%;
  max-width: 260px;
  height: auto;
  display: block;
}
.auth-card h1 { font-size: 22px; margin-bottom: var(--sp-1); text-align: center; }
.auth-sub { color: var(--c-text-muted); margin: 0 0 var(--sp-6); font-size: 14px; text-align: center; }
.auth-form { display: flex; flex-direction: column; gap: var(--sp-4); }
.auth-form .input { padding: 11px 14px; font-size: 15px; }
.auth-form .btn-lg { margin-top: var(--sp-2); }
.demo-accounts {
  margin-top: var(--sp-6);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--c-border);
}
.demo-accounts summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--c-text-secondary);
  font-weight: 500;
  list-style: none;
}
.demo-accounts summary::-webkit-details-marker { display: none; }
.demo-accounts summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 6px;
  transition: transform 0.15s;
  color: var(--c-text-muted);
}
.demo-accounts[open] summary::before { transform: rotate(90deg); }
.demo-accounts table { width: 100%; font-size: 12px; margin-top: var(--sp-3); border-collapse: collapse; }
.demo-accounts td { padding: 5px 8px; border-bottom: 1px solid var(--c-border); }
.demo-accounts tr:last-child td { border-bottom: none; }
.demo-accounts code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--c-surface-alt);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--c-border);
  color: var(--c-text);
}

/* =====================================================
   Pontaj (mobile)
   ===================================================== */
body.punch { background: var(--c-bg); min-height: 100vh; }
.punch-main { max-width: 480px; margin: 0 auto; padding: var(--sp-5); }
.punch-hero { text-align: center; padding: var(--sp-6) 0 var(--sp-5); }
.punch-clock {
  font-size: 52px;
  font-weight: 700;
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1;
}
.punch-date { color: var(--c-text-muted); font-size: 14px; margin-top: var(--sp-2); }

.punch-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  box-shadow: var(--sh-md);
}
.punch-status {
  text-align: center;
  font-size: 13px;
  color: var(--c-text-muted);
  margin-bottom: var(--sp-4);
  min-height: 20px;
}
.punch-status.ok { color: var(--c-success); }
.punch-status.warn { color: var(--c-warning); }
.punch-status.err { color: var(--c-danger); }

.punch-buttons {
  display: flex;
  gap: var(--sp-3);
}
.punch-button {
  width: 100%;
  padding: 24px 16px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: none;
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.05s ease, box-shadow 0.2s ease;
  color: white;
}
.punch-button-half { flex: 1; }
.punch-button-label { display: block; }

.punch-instructions {
  background: var(--c-info-soft);
  border: 1px solid var(--c-info-border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--c-info);
  margin-bottom: var(--sp-4);
  line-height: 1.55;
}
.punch-instructions strong { color: var(--c-text); }
.punch-instructions em { font-style: normal; font-weight: 600; color: var(--c-text); background: white; padding: 1px 6px; border-radius: 4px; }

.punch-actions-row {
  display: flex;
  gap: var(--sp-3);
  justify-content: center;
  margin-top: var(--sp-4);
}
.punch-button[data-kind="in"] {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  box-shadow: 0 8px 20px -6px rgba(22, 163, 74, 0.45);
}
.punch-button[data-kind="out"] {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  box-shadow: 0 8px 20px -6px rgba(220, 38, 38, 0.45);
}
.punch-button:hover { filter: brightness(1.05); }
.punch-button:active { transform: translateY(1px); }
.punch-button:disabled { opacity: 0.55; cursor: not-allowed; filter: grayscale(0.3); }

#preview-wrap { margin-top: var(--sp-4); text-align: center; }
#preview {
  max-width: 180px; max-height: 180px;
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  box-shadow: var(--sh-sm);
}

.today-list {
  margin-top: var(--sp-6);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.today-list-title {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--c-border);
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text);
}
.today-list-empty {
  padding: var(--sp-6);
  text-align: center;
  color: var(--c-text-muted);
  font-size: 13px;
}
.today-list ul { list-style: none; padding: 0; margin: 0; }
.today-list li {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--c-border);
  font-size: 13px;
}
.today-list li:last-child { border-bottom: none; }
.today-list li.suspect { background: var(--c-warning-soft); }
.today-list .punch-ts { font-weight: 600; font-variant-numeric: tabular-nums; }

/* =====================================================
   Lista de perechi IN/OUT in condica
   ===================================================== */
.pairs-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pairs-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  white-space: nowrap;
}

/* =====================================================
   Condica — rezumatul zilei + tabel compact
   ===================================================== */
.condica-summary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
}
.summary-card {
  flex: 1;
  min-width: 130px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-left: 3px solid var(--c-border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  padding: var(--sp-3) var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.summary-num {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.summary-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-text-muted);
}
.summary-total   { border-left-color: var(--c-primary); }
.summary-total   .summary-num { color: var(--c-primary); }
.summary-present { border-left-color: var(--c-success); }
.summary-present .summary-num { color: var(--c-success); }
.summary-absent  { border-left-color: var(--c-danger); }
.summary-absent  .summary-num { color: var(--c-danger); }
.summary-leave   { border-left-color: var(--c-warning); }
.summary-leave   .summary-num { color: var(--c-warning); }

/* Randuri mai compacte doar pe tabelul condicii (restul tabelelor raman la fel) */
.table-compact th { padding-top: 8px; padding-bottom: 8px; }
.table-compact td { padding-top: 7px; padding-bottom: 7px; }

/* =====================================================
   Cod credentiale (afisare username/parola dupa creare)
   ===================================================== */
.creds-code {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  background: var(--c-surface);
  color: var(--c-text);
  padding: 4px 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--c-info-border);
  display: inline-block;
}
.user-username {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--c-text-secondary);
  background: var(--c-surface-alt);
  padding: 2px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--c-border);
}

/* =====================================================
   Modal (overlay + dialog)
   ===================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
}
.modal-backdrop.is-open { display: flex; }
.modal {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 2 * var(--sp-4));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal-header {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}
.modal-title { font-size: 15px; font-weight: 600; color: var(--c-text); }
.modal-close {
  background: transparent;
  border: none;
  color: var(--c-text-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--r-sm);
}
.modal-close:hover { background: var(--c-surface-alt); color: var(--c-text); }
.modal-body {
  padding: var(--sp-5);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}
.modal-actions {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--c-border);
  background: var(--c-surface-alt);
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
}
.modal-hint {
  font-size: 12px;
  color: var(--c-text-muted);
  line-height: 1.5;
}

/* =====================================================
   Utilities
   ===================================================== */
.muted { color: var(--c-text-muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.flex { display: flex; }
.flex-gap-2 { gap: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }
.ml-auto { margin-left: auto; }

/* =====================================================
   ===================================================== 
   EXTENSII — tema intunecata, harta, paleta de comenzi,
   notificari, lightbox, filtre. Adaugate peste sistemul
   existent: nicio regula de mai sus nu e modificata.
   =====================================================
   ===================================================== */

/* =====================================================
   Tema intunecata
   Doar token-urile se schimba; componentele le folosesc deja.
   ===================================================== */
[data-theme="dark"] {
  --c-bg: #0b1220;
  --c-surface: #131c2e;
  --c-surface-alt: #1a2438;
  --c-border: #24304a;
  --c-border-strong: #35446a;
  --c-text: #e8edf7;
  --c-text-secondary: #a8b4cc;
  --c-text-muted: #6b7a99;

  --c-primary: #38b6ec;
  --c-primary-hover: #5cc6f2;
  --c-primary-soft: #10293a;
  --c-primary-soft-text: #7fd3f5;

  --c-success: #7cc054;
  --c-success-soft: #16240f;
  --c-success-border: #2f4a1d;

  --c-warning: #f0a93c;
  --c-warning-soft: #2b1d08;
  --c-warning-border: #4d3712;

  --c-danger: #f4696e;
  --c-danger-soft: #2c1113;
  --c-danger-border: #522023;

  --c-info: #5cc6f2;
  --c-info-soft: #10293a;
  --c-info-border: #1d4055;

  --sh-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.35);
  --sh-md: 0 1px 3px 0 rgba(0, 0, 0, 0.45), 0 1px 2px -1px rgba(0, 0, 0, 0.35);
  --sh-lg: 0 10px 25px -8px rgba(0, 0, 0, 0.65), 0 4px 8px -4px rgba(0, 0, 0, 0.45);

  color-scheme: dark;
}

/* Cele cateva culori scrise direct in reguli, rescrise pentru tema intunecata. */
[data-theme="dark"] .table tbody tr.row-suspect:hover td { background: #3a2a10 !important; }
[data-theme="dark"] .table tbody tr.row-self:hover td { background: #14324a !important; }
[data-theme="dark"] .badge-neutral { background: #1e2a41; color: var(--c-text-secondary); }
[data-theme="dark"] body.auth,
body.auth[data-theme="dark"] {
  background:
    radial-gradient(circle at 50% -10%, rgba(56, 182, 236, 0.14), transparent 55%),
    linear-gradient(180deg, #0b1220 0%, #101a2c 60%, #0b1220 100%);
}
[data-theme="dark"] .topbar-logo { filter: brightness(0) invert(1) opacity(0.92); }
/* Placile hartii sunt facute pentru fundal deschis: le temperam, nu le inversam,
   ca strazile sa ramana lizibile. */
[data-theme="dark"] .leaflet-tile { filter: brightness(0.72) contrast(1.08) saturate(0.85); }

/* Comutatorul de tema din bara de sus */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--c-border); border-radius: var(--r-md);
  background: var(--c-surface); color: var(--c-text-secondary);
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.theme-toggle:hover { background: var(--c-surface-alt); color: var(--c-text); border-color: var(--c-border-strong); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* =====================================================
   Bara de instrumente (navigare data, cautare, actiuni)
   ===================================================== */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.toolbar .spacer { flex: 1 1 auto; }

.date-nav { display: inline-flex; align-items: center; gap: 2px; }
.date-nav button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 34px; padding: 0;
  border: 1px solid var(--c-border); background: var(--c-surface);
  color: var(--c-text-secondary); cursor: pointer;
}
.date-nav button:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
.date-nav button:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
.date-nav button:hover { background: var(--c-surface-alt); color: var(--c-text); }
.date-nav button svg { width: 15px; height: 15px; }
.date-nav .date-today {
  width: auto; padding: 0 var(--sp-3); font-size: 12.5px; font-weight: 600;
  border-radius: 0; border-left: 0; border-right: 0;
}

/* Camp de filtrare instant peste tabele */
.filter-box { position: relative; display: inline-flex; align-items: center; }
.filter-box svg {
  position: absolute; left: 10px; width: 15px; height: 15px;
  color: var(--c-text-muted); pointer-events: none;
}
.filter-box input {
  height: 34px; padding: 0 var(--sp-3) 0 30px; min-width: 210px;
  border: 1px solid var(--c-border); border-radius: var(--r-md);
  background: var(--c-surface); color: var(--c-text);
  font-family: inherit; font-size: 13px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.filter-box input:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-soft);
}
.filter-box input::placeholder { color: var(--c-text-muted); }
.filter-count {
  font-size: 12px; color: var(--c-text-muted); margin-left: var(--sp-2);
  white-space: nowrap;
}
tr.is-filtered-out { display: none; }

/* Antetul si randurile trebuie sa foloseasca exact aceeasi grila de coloane.
   Fiind acelasi element <table>, browserul garanteaza asta singur — cu o
   conditie: sa nu scoatem celulele de antet din fluxul normal al tabelului.
   O incercare anterioara de antet lipit (`position: sticky` pe <th>) facea
   exact asta si, combinata cu `border-collapse: collapse`, producea celule de
   antet pictate decalat fata de coloanele lor. Nu o reintroduce fara sa
   rezolvi intai containerul de derulare (`.table-wrap` deruleaza pe ambele
   axe, deci `top` s-ar masura fata de el, nu fata de pagina).

   `border-collapse: separate` + `border-spacing: 0` da acelasi aspect ca
   `collapse` (bordurile sunt doar jos, deci nu se dubleaza), dar elimina
   modelul de borduri fuzionate care era sursa decalajelor de un pixel. */
.table-wrap { position: relative; }

/* Antetul si celulele impart aceeasi caseta orizontala: acelasi padding
   stanga/dreapta si aceeasi latime de bordura. Orice diferenta aici mutase
   inceputul coloanei fata de titlul ei. */
.table th,
.table td {
  padding-left: var(--sp-4);
  padding-right: var(--sp-4);
  box-sizing: border-box;
}

/* Coloane sortabile */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--c-text); }
th.sortable::after {
  content: "⇅"; font-size: 10px; opacity: .35; margin-left: 5px;
}
th.sortable.sort-asc::after  { content: "↑"; opacity: 1; color: var(--c-primary); }
th.sortable.sort-desc::after { content: "↓"; opacity: 1; color: var(--c-primary); }

/* =====================================================
   Calitate GPS
   ===================================================== */
.gps-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; padding: 2px 7px;
  border-radius: var(--r-full); white-space: nowrap;
}
.gps-chip::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
.gps-buna  { background: var(--c-success-soft); color: var(--c-success); }
.gps-medie { background: var(--c-warning-soft); color: var(--c-warning); }
.gps-slaba { background: var(--c-danger-soft); color: var(--c-danger); }
.gps-lipsa { background: var(--c-surface-alt); color: var(--c-text-muted); }

/* =====================================================
   Harta
   ===================================================== */
.map-shell {
  position: relative;
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--c-surface);
  box-shadow: var(--sh-md);
}
#fli-map { height: min(68vh, 720px); width: 100%; background: var(--c-surface-alt); }
.map-legend {
  display: flex; flex-wrap: wrap; gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--c-border);
  background: var(--c-surface);
  font-size: 12.5px; color: var(--c-text-secondary);
}
.map-legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend-dot {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--c-surface); box-shadow: 0 0 0 1px var(--c-border-strong);
}
.legend-in     { background: #16a34a; }
.legend-out    { background: #dc2626; }
.legend-susp   { background: #f59e0b; }
.legend-work   { background: #1B9DD9; }

.map-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: var(--sp-2); text-align: center;
  background: var(--c-surface); color: var(--c-text-muted); z-index: 50; padding: var(--sp-6);
}
.map-empty-icon { font-size: 30px; opacity: .5; }

/* Marcatori proprii — cercuri cu initiale, mai lizibili decat pinii impliciti */
.map-pin {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  border: 2.5px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.4);
  color: #fff; font-size: 10px; font-weight: 700; font-family: var(--font-sans);
}
.map-pin-in   { background: #16a34a; }
.map-pin-out  { background: #dc2626; }
.map-pin-susp { background: #f59e0b; }
.map-pin-work { background: #1B9DD9; border-radius: var(--r-sm); }

.leaflet-popup-content-wrapper {
  border-radius: var(--r-md); background: var(--c-surface); color: var(--c-text);
}
.leaflet-popup-tip { background: var(--c-surface); }
.leaflet-popup-content { margin: 12px 14px; font-family: var(--font-sans); font-size: 13px; }
.map-popup-title { font-weight: 600; margin-bottom: 4px; }
.map-popup-row { color: var(--c-text-secondary); font-size: 12px; margin-top: 2px; }
.map-popup img { width: 100%; border-radius: var(--r-sm); margin-top: 8px; display: block; }
[data-theme="dark"] .leaflet-container { background: #0b1220; }

/* =====================================================
   Paleta de comenzi (Ctrl+K)
   ===================================================== */
.cmdk-backdrop {
  position: fixed; inset: 0; z-index: 9000; display: none;
  align-items: flex-start; justify-content: center;
  padding-top: 12vh; background: rgba(8, 14, 26, 0.55);
  backdrop-filter: blur(3px);
}
.cmdk-backdrop.is-open { display: flex; }
.cmdk {
  width: min(560px, 92vw);
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-xl); box-shadow: var(--sh-lg); overflow: hidden;
}
.cmdk-input-wrap { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4); border-bottom: 1px solid var(--c-border); }
.cmdk-input-wrap svg { width: 18px; height: 18px; color: var(--c-text-muted); flex-shrink: 0; }
.cmdk input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font-family: inherit; font-size: 15px; color: var(--c-text);
}
.cmdk input::placeholder { color: var(--c-text-muted); }
.cmdk-list { max-height: 340px; overflow-y: auto; padding: var(--sp-2); }
.cmdk-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 10px var(--sp-3); border-radius: var(--r-md);
  cursor: pointer; color: var(--c-text);
}
.cmdk-item.is-active { background: var(--c-primary-soft); color: var(--c-primary-soft-text); }
.cmdk-item-icon { width: 20px; text-align: center; opacity: .7; flex-shrink: 0; }
.cmdk-item-label { flex: 1; font-size: 13.5px; }
.cmdk-item-hint { font-size: 11px; color: var(--c-text-muted); }
.cmdk-empty { padding: var(--sp-6); text-align: center; color: var(--c-text-muted); font-size: 13px; }
.cmdk-footer {
  display: flex; gap: var(--sp-4); padding: var(--sp-2) var(--sp-4);
  border-top: 1px solid var(--c-border); background: var(--c-surface-alt);
  font-size: 11px; color: var(--c-text-muted);
}
kbd {
  font-family: var(--font-mono); font-size: 10.5px;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; color: var(--c-text-secondary);
}

/* =====================================================
   Notificari (toast)
   ===================================================== */
.toast-stack {
  position: fixed; bottom: var(--sp-5); right: var(--sp-5); z-index: 9500;
  display: flex; flex-direction: column; gap: var(--sp-2);
  max-width: min(380px, calc(100vw - 40px));
}
.toast {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--c-surface); color: var(--c-text);
  border: 1px solid var(--c-border); border-left: 3px solid var(--c-primary);
  border-radius: var(--r-md); box-shadow: var(--sh-lg);
  font-size: 13px; animation: toast-in .22s ease-out;
}
.toast.is-leaving { animation: toast-out .18s ease-in forwards; }
.toast-ok   { border-left-color: var(--c-success); }
.toast-warn { border-left-color: var(--c-warning); }
.toast-err  { border-left-color: var(--c-danger); }
.toast-body { flex: 1; }
.toast-title { font-weight: 600; margin-bottom: 2px; }
.toast-close {
  background: none; border: 0; cursor: pointer; color: var(--c-text-muted);
  font-size: 17px; line-height: 1; padding: 0 2px;
}
@keyframes toast-in  { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

/* =====================================================
   Lightbox pentru pozele de pontaj
   ===================================================== */
.lightbox {
  position: fixed; inset: 0; z-index: 9200; display: none;
  align-items: center; justify-content: center;
  background: rgba(6, 10, 20, 0.88); padding: var(--sp-6);
}
.lightbox.is-open { display: flex; }
.lightbox img {
  max-width: 92vw; max-height: 82vh; border-radius: var(--r-md);
  box-shadow: 0 20px 60px rgba(0,0,0,.6); object-fit: contain;
}
.lightbox-caption {
  position: absolute; bottom: var(--sp-6); left: 50%; transform: translateX(-50%);
  color: #e8edf7; font-size: 13px; text-align: center;
  background: rgba(0,0,0,.55); padding: var(--sp-2) var(--sp-4); border-radius: var(--r-full);
  max-width: 88vw;
}
.lightbox-close {
  position: absolute; top: var(--sp-5); right: var(--sp-6);
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.12); color: #fff; border: 0;
  font-size: 22px; cursor: pointer; line-height: 1;
}
.lightbox-close:hover { background: rgba(255,255,255,.22); }
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255,255,255,.12); color: #fff; border: 0;
  font-size: 24px; cursor: pointer; line-height: 1;
}
.lightbox-nav:hover { background: rgba(255,255,255,.22); }
.lightbox-prev { left: var(--sp-5); }
.lightbox-next { right: var(--sp-5); }
.thumb { cursor: zoom-in; }

/* =====================================================
   Bara de stare (jos) — folosita mai ales in clientul desktop
   ===================================================== */
.statusbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 90;
  display: flex; align-items: center; gap: var(--sp-4);
  height: 26px; padding: 0 var(--sp-4);
  background: var(--c-surface); border-top: 1px solid var(--c-border);
  font-size: 11.5px; color: var(--c-text-muted);
}
.statusbar .spacer { flex: 1; }
.statusbar-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c-success); }
.statusbar-dot.is-offline { background: var(--c-danger); }
.statusbar-dot.is-stale { background: var(--c-warning); }
body.has-statusbar { padding-bottom: 26px; }

/* Indicator de reincarcare in curs, subtire, sus de tot */
.load-bar {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: var(--c-primary); z-index: 9600;
  transition: width .25s ease-out, opacity .3s;
}

@media print {
  .topbar, .tabs, .toolbar, .statusbar, .btn-refresh, .section-actions,
  .cmdk-backdrop, .toast-stack, .load-bar { display: none !important; }
  .tab-pane { display: none !important; }
  .tab-pane.active { display: block !important; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ccc; }
}
