/* =============================================================
   FATI IM Pagat — design system (premium edition)
   ============================================================= */
@import url('https://rsms.me/inter/inter.css');

:root {
  /* Brand */
  --brand: #0f766e;             /* teal-700 (medical) */
  --brand-dark: #0a554f;
  --brand-light: #5eead4;       /* teal-300 */
  --accent: #b45309;            /* amber-700 (cta secondary) */

  /* Neutrals (slate — më premium se gray) */
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e6e8ec;
  --border-strong: #cfd3da;
  --text: #0f172a;              /* slate-900 */
  --text-muted: #64748b;        /* slate-500 — contrast 4.83:1 vs white (AA pass) */
  --text-soft: #6b7785;         /* slate-450 — contrast 4.7:1 vs white (AA pass)
                                   Para: #94a3b8 (2.85:1, FAIL AA) — i përdorur
                                   për hints/placeholders/small text. Bumped për
                                   të kaluar WCAG AA për lexueshmëri. */

  /* Status */
  --green: #047857;
  --green-bg: #d1fae5;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --amber: #92400e;
  --amber-bg: #fef3c7;
  --indigo: #4338ca;
  --indigo-bg: #e0e7ff;

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

  /* Radius */
  --r-sm: 4px; --r: 7px; --r-lg: 10px; --r-xl: 14px; --r-pill: 999px;

  /* Shadow — multi-layer, hairline + soft (Linear/Stripe style) */
  --shadow-sm: 0 1px 0 rgba(15,23,42,0.04), 0 1px 2px rgba(15,23,42,0.04);
  --shadow:    0 1px 0 rgba(15,23,42,0.04), 0 2px 6px rgba(15,23,42,0.06);
  --shadow-md: 0 1px 0 rgba(15,23,42,0.05), 0 4px 14px rgba(15,23,42,0.08);
  --shadow-lg: 0 10px 40px -10px rgba(15,23,42,0.18), 0 4px 12px rgba(15,23,42,0.06);
  --ring-brand: 0 0 0 3px rgba(15,118,110,0.18);

  /* Type */
  --font: "Inter var", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Consolas, Menlo, monospace;
  --font-feature-num: "tnum" 1, "cv11" 1, "ss01" 1;

  /* Animation */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 0.15s var(--ease);
  --t: 0.18s var(--ease);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: var(--font-feature-num);
  letter-spacing: -0.005em;
}

a { color: var(--brand); }
a:hover { color: var(--brand-dark); }

::selection { background: var(--brand-light); color: var(--brand-dark); }

/* =============================================================
   Skip to content (a11y) — i fshehur deri sa fokusohet me Tab
   ============================================================= */
.skip-to-content {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--brand-dark);
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  z-index: 1000;
  text-decoration: none;
}
.skip-to-content:focus,
.skip-to-content:focus-visible {
  left: 8px;
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Required field marker — për fushat me atribut required */
.req-mark {
  color: #dc2626;
  font-weight: 700;
  margin-left: 2px;
}

/* =============================================================
   Topbar / navigation
   ============================================================= */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, #0a554f 0%, #0f766e 100%);
  color: #fff;
  padding: 10px var(--sp-6);
  box-shadow: var(--shadow);
  border-bottom: 1px solid rgba(0,0,0,0.15);
  position: sticky; top: 0; z-index: 50;
}
.topbar a { color: #fff; text-decoration: none; transition: var(--t-fast); }
.topbar nav > a:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.topbar .brand { display: inline-flex; align-items: center; gap: 10px; }
.topbar .brand a {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.3px;
  display: inline-flex; align-items: center; gap: var(--sp-2);
}
.topbar .brand .brand-version {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.12);
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 0.3px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.topbar .brand a::before {
  content: "+";
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.18);
  border-radius: var(--r-sm);
  font-size: 18px;
  font-weight: 700;
}
.topbar nav { display: flex; gap: var(--sp-1); align-items: center; flex-wrap: wrap; }
.topbar nav > a {
  padding: 7px 14px;
  border-radius: var(--r);
  font-size: 16px;            /* 13px × 1.25 */
  font-weight: 500;
  transition: background 0.15s;
}
.topbar nav > a:hover { background: rgba(255, 255, 255, 0.12); }
.topbar .user {
  margin-left: var(--sp-4);
  padding-left: var(--sp-4);
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 16px;            /* 13px × 1.25 */
  display: inline-flex; align-items: center; gap: var(--sp-3);
}
.topbar .user .btn-link {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  padding: 5px 12px;
  border-radius: var(--r);
  font-size: 15px;            /* 12px × 1.25 */
  background: rgba(255, 255, 255, 0.1);
}
.topbar .user .btn-link:hover { background: rgba(255, 255, 255, 0.2); color: #fff; }

/* =============================================================
   Layout
   ============================================================= */
main { max-width: 1320px; margin: var(--sp-6) auto; padding: 0 var(--sp-6); }

h1 {
  margin: 0 0 var(--sp-4);
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.4px;
  color: var(--text);
}
h2 {
  margin: var(--sp-8) 0 var(--sp-3);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.1px;
  color: var(--text);
  display: flex; align-items: center; gap: var(--sp-2);
}
h2::before {
  content: ""; width: 3px; height: 16px; background: var(--brand);
  border-radius: var(--r-pill);
}

footer {
  text-align: center;
  color: var(--text-soft);
  padding: var(--sp-6);
  font-size: 12px;
  margin-top: var(--sp-8);
}

/* =============================================================
   Tables
   ============================================================= */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  /* HIQ overflow:hidden — që sticky thead të mos clip-ohet gjatë scroll-it.
     Border-radius rrumbullakohet te qelizat e para/të fundit më poshtë. */
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--sp-4);
}
/* Rrumbullako qoshet e tabelës te qelizat e para/fundit (zëvendëson overflow:hidden) */
table thead tr:first-child th:first-child { border-top-left-radius: 12px; }
table thead tr:first-child th:last-child { border-top-right-radius: 12px; }
table tbody tr:last-child td:first-child,
table tfoot tr:last-child th:first-child { border-bottom-left-radius: 12px; }
table tbody tr:last-child td:last-child,
table tfoot tr:last-child th:last-child { border-bottom-right-radius: 12px; }
th, td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
th {
  background: var(--surface-2);
  font-weight: 600;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}
/* Sticky table headers — qëndrojnë nën filter-bar gjatë scroll-it */
table thead th {
  position: sticky;
  top: var(--filter-bar-offset, 140px);
  z-index: 20;
  background: var(--surface-2);
  /* Box-shadow simulon border-bottom (border-bottom thyhet me sticky) */
  box-shadow: inset 0 -1px 0 var(--border);
}
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr { transition: background var(--t-fast); }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }

/* Sortable headers */
.sort-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
  white-space: nowrap;
  padding: 2px 4px;
  margin: -2px -4px;
  border-radius: var(--r-sm);
  transition: all 0.15s;
}
.sort-link:hover { background: rgba(15, 118, 110, 0.08); color: var(--brand); }
.sort-active { color: var(--brand) !important; font-weight: 700; }
.sort-active:hover { background: rgba(15, 118, 110, 0.12); }
th .sort-link { font-size: inherit; }

/* Totals row — definicioni i unifikuar te line ~1555 (.totals-row me surface-2)
   Përpara kishte një blok i dyfishtë me gradient të ngjyrosur që mbulohej nga
   blloku më poshtë; është hequr për të pastruar dead code. */

/* Edit row callout — clearly stand-out so user knows which row is in edit mode */
.edit-row td {
  padding: var(--sp-4) var(--sp-5);
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
  border-top: 3px solid var(--accent);
  border-bottom: 3px solid var(--accent);
  box-shadow: inset 4px 0 0 var(--accent), 0 4px 8px rgba(180, 83, 9, 0.15);
}
.entry-edit-form { font-size: 13px; }
.edit-row-header {
  display: flex; align-items: center; gap: var(--sp-2);
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-2);
  border-bottom: 1px dashed rgba(180, 83, 9, 0.3);
}
.edit-row-icon { font-size: 18px; }
.edit-row-header strong {
  font-size: 15px;
  color: var(--text);
  font-weight: 700;
}
.edit-row-meta {
  color: var(--amber);
  font-size: 12px;
  margin-left: auto;
  font-style: italic;
}

/* Compact edit form — 2-column grid, dense rows */
.edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  margin: var(--sp-2) 0;
}
.edit-col {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(180, 83, 9, 0.2);
  border-radius: var(--r);
  padding: 8px 10px 6px;
}
.edit-col h4 {
  margin: 0 0 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--amber);
  font-weight: 700;
  padding-bottom: 4px;
  border-bottom: 1px dashed rgba(180, 83, 9, 0.25);
  display: flex; justify-content: space-between;
}
.edit-col h4::after {
  content: "Bruto · Neto";
  font-weight: 500;
  color: var(--text-soft);
  letter-spacing: 0.3px;
}
.edit-row-item {
  display: grid;
  grid-template-columns: 1fr 90px 90px;
  gap: 6px;
  align-items: center;
  padding: 3px 0;
}
.edit-row-item > span:first-child {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.edit-row-item > span:first-child small {
  font-weight: 400;
  color: var(--text-soft);
  font-size: 10px;
  margin-left: 2px;
}
.edit-row-item input[type="number"] {
  width: 100%;
  padding: 4px 6px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.edit-row-item input[type="number"]:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.15);
}
.edit-row-item input.net-mirror {
  background: #f0fdfa;
  border-color: #5eead4;
  color: var(--brand-dark);
  font-weight: 600;
}
.edit-row-item input.net-mirror:focus { background: #fff; border-color: var(--brand); }
.edit-row-item em { color: var(--text-soft); font-style: normal; }
.edit-advance > span:first-child {
  color: var(--accent);
}

.edit-totals {
  display: flex;
  gap: var(--sp-3);
  justify-content: flex-end;
  align-items: center;
  margin: var(--sp-2) 0 var(--sp-3);
  padding: 8px var(--sp-4);
  background: linear-gradient(180deg, #f0fdfa 0%, #ccfbf1 100%);
  border-radius: var(--r);
  border: 1px solid var(--brand-light);
}
.edit-totals > div {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}
.edit-totals > div strong {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0;
  text-transform: none;
}
.edit-totals-net {
  padding-left: var(--sp-3);
  border-left: 2px solid var(--brand);
}
.edit-totals-net strong { color: var(--brand-dark) !important; font-size: 18px !important; }

.edit-comment {
  margin: var(--sp-2) 0;
}
.edit-comment textarea {
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 12px;
  resize: vertical;
  background: #fff;
}
.edit-comment textarea::placeholder { color: var(--text-soft); }

@media (max-width: 768px) {
  .edit-grid { grid-template-columns: 1fr; }
  .edit-row-item { grid-template-columns: 1fr 80px 80px; }
}
.entry-edit-form .grid-cols {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--sp-2); margin: var(--sp-3) 0;
}
.entry-edit-form label {
  display: flex; flex-direction: column; gap: 2px;
  font-size: 11px; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.4px; font-weight: 600;
}
.entry-edit-form input, .entry-edit-form textarea, .entry-edit-form select {
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  font: inherit;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.entry-edit-form input:focus, .entry-edit-form textarea:focus, .entry-edit-form select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

/* =============================================================
   KPI cards (dashboard)
   ============================================================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-3);
  margin: var(--sp-4) 0 var(--sp-6);
}
.kpi {
  background: var(--surface);
  padding: var(--sp-5);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
  position: relative;
}
.kpi::before {
  content: ""; display: block;
  width: 28px; height: 2px;
  background: var(--brand);
  border-radius: 2px;
  margin-bottom: 10px;
}
.kpi:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.kpi-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
}
.kpi-value {
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-top: var(--sp-1);
  font-variant-numeric: tabular-nums;
}

/* =============================================================
   Period cards (active period highlights)
   ============================================================= */
.period-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}
.period-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: all 0.15s;
}
.period-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-left-color: var(--brand-dark);
}
.period-card-active {
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
  border-left-color: var(--accent);
}
.period-card-active:hover { border-left-color: #92400e; }
.period-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-2);
}
.period-card-label {
  font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -0.3px;
}
.period-card-desc {
  font-size: 14px; color: var(--text-muted); margin-bottom: var(--sp-3);
  font-weight: 500;
}
.period-card-stats {
  display: flex; flex-wrap: wrap; gap: var(--sp-3);
  padding: var(--sp-2) 0;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
  margin-bottom: var(--sp-2);
  font-size: 13px;
}
.period-card-stats span { color: var(--text-muted); }
.period-card-stats strong { color: var(--text); font-variant-numeric: tabular-nums; }
.period-card-foot { font-size: 12px; color: var(--text-muted); }

.empty-state {
  text-align: center; padding: var(--sp-8) var(--sp-4);
  background: var(--surface); border-radius: var(--r-lg);
  border: 2px dashed var(--border-strong);
  margin-bottom: var(--sp-4);
}
.empty-state p { font-size: 16px; color: var(--text-muted); margin: 0 0 var(--sp-3); }

/* =============================================================
   Info bar (period header summary)
   ============================================================= */
.info-bar {
  display: flex;
  gap: var(--sp-5);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border-radius: var(--r-lg);
  margin-bottom: var(--sp-3);
  font-size: 13px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.info-bar span { color: var(--text-muted); }
.info-bar strong { color: var(--text); }

/* =============================================================
   Buttons
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px;
  background: linear-gradient(180deg, #0f766e 0%, #0d6961 100%);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 550;
  letter-spacing: -0.01em;
  border: 0;
  cursor: pointer;
  transition: all var(--t);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.12) inset,
    0 1px 2px rgba(15,23,42,0.10);
}
.btn:hover {
  background: linear-gradient(180deg, #0d6961 0%, #0a554f 100%);
  color: #fff;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.12) inset,
    0 4px 12px rgba(15,118,110,0.25);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0); }
.btn:focus-visible {
  outline: none;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.12) inset,
    var(--ring-brand);
}
.btn-warning {
  background: linear-gradient(180deg, #b45309 0%, #92400e 100%);
}
.btn-warning:hover {
  background: linear-gradient(180deg, #92400e 0%, #78350f 100%);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.12) inset,
    0 4px 12px rgba(180,83,9,0.25);
}
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: 0 1px 0 rgba(15,23,42,0.04), 0 1px 2px rgba(15,23,42,0.06);
}
.btn-secondary:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--text-soft);
}
.btn-danger {
  background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%);
}
.btn-danger:hover {
  background: linear-gradient(180deg, #b91c1c 0%, #991b1b 100%);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.12) inset,
    0 4px 12px rgba(185,28,28,0.25);
}
.btn-sm {
  padding: 7px 12px; font-size: 12px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 7px; cursor: pointer; color: var(--text);
  transition: all var(--t-fast);
  font-weight: 550;
  letter-spacing: -0.01em;
  display: inline-flex; align-items: center; gap: 4px;
  white-space: nowrap;
  min-height: 32px;
  min-width: 32px;
  justify-content: center;
  box-shadow: 0 1px 0 rgba(15,23,42,0.04);
}
/* Touch target ≥ 44px në mobile (WCAG 2.5.5) */
@media (max-width: 768px) {
  .btn-sm { min-height: 40px; min-width: 40px; padding: 9px 14px; }
}
.btn-sm:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-sm:hover { background: var(--surface-2); color: var(--brand); border-color: var(--brand); box-shadow: var(--shadow-sm); }
.btn-sm:active { transform: translateY(1px); }
.btn-sm:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.25); border-color: var(--brand); }
.btn-edit { background: #f0fdfa; border-color: #5eead4; color: var(--brand-dark); }
.btn-edit:hover { background: var(--brand); color: #fff; border-color: var(--brand-dark); }
.btn-edit-net { background: #fef3c7; border-color: #fcd34d; color: var(--amber); }
.btn-edit-net:hover { background: var(--accent); color: #fff; border-color: #92400e; }

/* Butoni kryesor "Dërgo Pagat në Pro-Data" — gjithmonë i gjelbërt me
   breathing-pulse: shkallë + shkëlqim që rritet e zbutet butësisht,
   si frymëmarrje e qetë. Tërheq syrin pa qenë agresiv. */
.btn-success-pulse {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 52%, #15803d 100%);
  border: 1px solid #15803d;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.2px;
  border-radius: 8px;
  animation: breathe-success 3.4s ease-in-out infinite;
  box-shadow: 0 2px 10px rgba(22, 163, 74, 0.32),
              0 0 0 0 rgba(34, 197, 94, 0.42);
  transition: transform 0.15s ease, box-shadow 0.25s ease, background 0.25s ease;
}
.btn-success-pulse:hover {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 60%, #14532d 100%);
  border-color: #14532d;
  color: #fff;
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 6px 22px rgba(22, 163, 74, 0.5);
  animation-play-state: paused;   /* ndal frymëmarrjen në hover — fokus i qartë për klik */
}
.btn-success-pulse:active {
  transform: translateY(0) scale(0.99);
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.4);
}
@keyframes breathe-success {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 2px 10px rgba(22, 163, 74, 0.30),
                0 0 0 0 rgba(34, 197, 94, 0.40);
  }
  50% {
    transform: scale(1.035);
    box-shadow: 0 5px 22px rgba(22, 163, 74, 0.55),
                0 0 0 7px rgba(34, 197, 94, 0);
  }
}
/* Aksesueshmëri: respekto përdoruesit që çaktivizojnë animacionet */
@media (prefers-reduced-motion: reduce) {
  .btn-success-pulse { animation: none; }
}

/* Row actions cell — buttons clearly separated from adjacent rows */
.row-actions {
  white-space: nowrap;
  padding: 10px var(--sp-3);
  text-align: right;
  min-width: 100px;
}
.row-actions .btn-sm { display: inline-flex; vertical-align: middle; }
.row-actions .btn-sm + .btn-sm { margin-left: 8px; }
table thead th:last-child { min-width: 100px; }

/* Highlight current row on hover so user knows which row their click affects */
tbody tr:not(.edit-row):hover {
  background: linear-gradient(90deg, transparent 0%, rgba(15, 118, 110, 0.05) 50%, rgba(15, 118, 110, 0.08) 100%);
}
tbody tr:not(.edit-row):hover .btn-sm {
  border-color: var(--brand);
}

/* HTMX request feedback */
.htmx-request { opacity: 0.6; pointer-events: none; }
.htmx-request.btn-sm::after, button.htmx-request::after {
  content: "⏳"; margin-left: 4px;
}
.btn-link {
  color: var(--text-muted); text-decoration: none;
  padding: 6px 10px; font-size: 13px;
  border-radius: var(--r);
  transition: color 0.15s;
}
.btn-link:hover { color: var(--brand); }

.actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin: var(--sp-3) 0 var(--sp-5);
  align-items: center;
}

/* =============================================================
   Status badges
   ============================================================= */
.status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  vertical-align: middle;
}
.status-draft    { background: var(--amber-bg); color: var(--amber); }
.status-locked   { background: var(--indigo-bg); color: var(--indigo); }
.status-exported { background: var(--green-bg); color: var(--green); }
.status-archived { background: var(--border); color: var(--text-muted); }

/* =============================================================
   Messages / alerts
   ============================================================= */
.messages { margin: var(--sp-3) auto 0; max-width: 1320px; padding: 0 var(--sp-6); }
.msg {
  padding: 10px var(--sp-4);
  border-radius: var(--r);
  margin: var(--sp-2) 0;
  font-size: 13px;
  display: flex; align-items: center; gap: var(--sp-2);
  border-left: 3px solid currentColor;
}
.msg-success { background: var(--green-bg); color: var(--green); }
.msg-error   { background: var(--red-bg);   color: var(--red); }
.msg-warning { background: var(--amber-bg); color: var(--amber); }
.msg-info    { background: var(--indigo-bg); color: var(--indigo); }

/* =============================================================
   Filter bar — sticky nën topbar (që user e sheh gjithnjë gjatë scroll-it)
   ============================================================= */
.filter-bar {
  background: var(--surface);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  margin-bottom: var(--sp-3);
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  align-items: flex-end;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  position: sticky;
  top: var(--topbar-h, 56px);
  z-index: 30;
}
/* Shadow më prominent kur është "stuck" për të treguar separim vizual */
.filter-bar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -8px; height: 8px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,0.08) 0%, rgba(0,0,0,0) 100%);
  opacity: 0;
  transition: opacity 0.18s;
}
.filter-bar.is-stuck::after { opacity: 1; }
.filter-bar label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.filter-bar label.grow { flex: 1; min-width: 220px; }
.filter-bar input, .filter-bar select {
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  font: inherit;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 140px;
}
.filter-bar input[type="search"] { padding-left: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 9px center; }
.filter-bar input[type="number"] { min-width: auto; }
.filter-bar input:focus, .filter-bar select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

/* =============================================================
   Form card (period create, etc.)
   ============================================================= */
.form-card {
  max-width: 600px;
  background: var(--surface);
  padding: var(--sp-6);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.form-card label {
  display: block; margin-bottom: var(--sp-3);
  font-size: 12px; font-weight: 600; color: var(--text);
}
.form-card .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.form-card input, .form-card select, .form-card textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  font: inherit;
  background: #fff;
  margin-top: 4px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-card input:focus, .form-card select:focus, .form-card textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}
.form-card small { display: block; color: var(--text-soft); font-size: 11px; margin-top: 2px; font-weight: 400; }
.form-actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-4); align-items: center; }

/* =============================================================
   Login page
   ============================================================= */
/* ========== Login (premium glass) ========== */
.login-stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a554f 0%, #0f766e 35%, #14b8a6 70%, #5eead4 100%);
  overflow: hidden;
  padding: 1.5rem;
  z-index: 0;
}
.login-bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  animation: blob-float 14s ease-in-out infinite;
}
.login-bg-blob-1 {
  width: 420px; height: 420px;
  background: radial-gradient(circle, #5eead4, transparent 70%);
  top: -100px; left: -100px;
}
.login-bg-blob-2 {
  width: 360px; height: 360px;
  background: radial-gradient(circle, #fef3c7, transparent 70%);
  bottom: -80px; right: -80px;
  animation-delay: -5s;
}
.login-bg-blob-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #fff, transparent 70%);
  top: 40%; right: 20%;
  animation-delay: -9s;
  opacity: 0.3;
}
@keyframes blob-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(40px, -30px) scale(1.05); }
  66%      { transform: translate(-30px, 40px) scale(0.95); }
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 410px;
  padding: 2.25rem 2rem 1.5rem;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  box-shadow:
    0 25px 60px rgba(15, 23, 42, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.3) inset;
  animation: card-in 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}
.login-logo-mark {
  width: 64px; height: 64px;
  margin: 0 auto 0.75rem;
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  box-shadow:
    0 10px 30px rgba(15, 118, 110, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  position: relative;
}
.login-logo-mark::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 22px;
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  opacity: 0.3;
  filter: blur(10px);
  z-index: -1;
}
.login-logo-plus {
  font-size: 36px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}
.login-brand {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.5px;
  margin-bottom: 0.2rem;
}
.login-tagline {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 500;
}

.login-error {
  margin: 0 0 1.25rem;
  padding: 0.7rem 0.9rem;
  background: rgba(254, 226, 226, 0.7);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 10px;
  color: #991b1b;
  font-size: 13px;
  display: flex; align-items: center; gap: 0.5rem;
  animation: shake 0.4s;
}
.login-error-icon { font-size: 16px; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}

.login-form { display: flex; flex-direction: column; gap: 0.9rem; }
.login-field { display: flex; flex-direction: column; gap: 0.35rem; }
.login-field label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-left: 4px;
}
.login-input-wrap {
  position: relative;
  display: flex; align-items: center;
  background: rgba(249, 250, 251, 0.9);
  border: 1.5px solid rgba(209, 213, 219, 0.6);
  border-radius: 12px;
  transition: all 0.2s;
}
.login-input-wrap:focus-within {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}
.login-input-icon {
  padding: 0 0.5rem 0 0.85rem;
  font-size: 16px;
  opacity: 0.5;
}
.login-input-wrap input {
  flex: 1;
  padding: 0.75rem 0.85rem 0.75rem 0;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 14.5px;
  color: var(--text);
  outline: none;
}
.login-input-wrap input::placeholder { color: #9ca3af; }

.login-submit {
  margin-top: 0.5rem;
  padding: 0.85rem 1.2rem;
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  letter-spacing: 0.5px;
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.3);
  transition: all 0.2s;
}
.login-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(15, 118, 110, 0.45);
}
.login-submit:hover .login-submit-arrow { transform: translateX(4px); }
.login-submit:active { transform: translateY(0); }
.login-submit-arrow { transition: transform 0.2s; font-size: 18px; }

.login-foot {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.4px;
}

/* Fshih topbar/footer ekzistuese kur jemi te login (që të mbushet faqja me gradient) */
body:has(.login-stage) > .topbar,
body:has(.login-stage) > footer,
body:has(.login-stage) > .messages { display: none !important; }
body:has(.login-stage) > main {
  max-width: none; margin: 0; padding: 0;
}

/* ========== Period card DRAFT — premium glass + pulse ========== */
.period-card-active {
  position: relative;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(220, 252, 231, 0.9)) !important;
  border: 1.5px solid transparent !important;
  background-clip: padding-box !important;
  box-shadow:
    0 8px 24px rgba(16, 185, 129, 0.18),
    0 0 0 0 rgba(16, 185, 129, 0.45);
  animation: draft-pulse 2.4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  backdrop-filter: blur(8px);
  overflow: hidden;
}
.period-card-active::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: linear-gradient(135deg, #10b981, #14b8a6, #5eead4, #10b981);
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  background-size: 200% 200%;
  animation: gradient-shift 4s ease infinite;
}
/* Stilizohet vetë statusi "DRAFT" te card aktiv si badge pulsues —
   shmang mbivendosjen me ::after të një badge tjetër. */
.period-card-active .status-draft {
  background: linear-gradient(135deg, #10b981, #14b8a6) !important;
  color: #fff !important;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 999px;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.4);
  animation: badge-pulse 1.6s ease-in-out infinite;
  text-transform: uppercase;
  border: none !important;
}
.period-card-active .status-draft::before {
  content: "● ";
}
@keyframes draft-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(16, 185, 129, 0.18), 0 0 0 0 rgba(16, 185, 129, 0.45); }
  50%      { box-shadow: 0 12px 32px rgba(16, 185, 129, 0.28), 0 0 0 12px rgba(16, 185, 129, 0); }
}
@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}
@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
.period-card-active:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow:
    0 16px 36px rgba(16, 185, 129, 0.3),
    0 0 0 4px rgba(16, 185, 129, 0.15);
}

/* =============================================================
   Info grid (employee detail, etc.)
   ============================================================= */
.info-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 8px var(--sp-4);
  background: var(--surface);
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.info-grid dt {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.info-grid dd { margin: 0; color: var(--text); }

/* =============================================================
   Pagination
   ============================================================= */
.pagination {
  margin-top: var(--sp-3);
  display: flex; gap: var(--sp-2); align-items: center;
  font-size: 13px; color: var(--text-muted);
}
.pagination a {
  text-decoration: none; color: var(--brand);
  padding: 4px 10px; border-radius: var(--r);
  border: 1px solid var(--border-strong);
}
.pagination a:hover { background: var(--surface-2); border-color: var(--brand); }

/* =============================================================
   Code blocks
   ============================================================= */
pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: var(--sp-4);
  border-radius: var(--r);
  overflow-x: auto;
  font-size: 12px;
  font-family: var(--font-mono);
  line-height: 1.5;
  border-left: 3px solid var(--brand);
}
code {
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--brand-dark);
  border: 1px solid var(--border);
}
pre code { background: transparent; border: 0; padding: 0; color: inherit; }

/* =============================================================
   Hint / help text
   ============================================================= */
.hint { color: var(--text-muted); font-size: 12px; margin: 4px 0; line-height: 1.5; }

/* =============================================================
   Responsive
   ============================================================= */
@media (max-width: 900px) {
  main { padding: 0 var(--sp-3); }
  .topbar { padding: var(--sp-3); flex-direction: column; align-items: flex-start; gap: var(--sp-2); }
  .topbar nav { width: 100%; overflow-x: auto; }
  .topbar .user { margin-left: 0; padding-left: 0; border-left: 0; }
  th { position: static; }
  .info-grid { grid-template-columns: 1fr; }
  .info-grid dt { margin-top: var(--sp-2); }
  .form-card .form-row { grid-template-columns: 1fr; }
  /* Tabela të gjera marrin scroll horizontal në vend që të shtypen */
  table {
    font-size: 12px;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  th, td { padding: 8px; }
  .kpi-value { font-size: 18px; }
  .actions { gap: 6px; }
  .btn { padding: 8px 10px; font-size: 12px; }
}

@media (max-width: 600px) {
  h1 { font-size: 20px; }
  .filter-bar { padding: var(--sp-3); }
  .filter-bar label.grow { min-width: 100%; }
}

/* =============================================================
   Print
   ============================================================= */
@media print {
  .topbar, .actions, .filter-bar, footer, .btn, .btn-sm, .btn-link { display: none !important; }
  body { background: #fff; }
  table { box-shadow: none; }
  th { position: static; }
}

/* ==== Sync me Pro-Data ==== */
#sync-panel:empty { display: none; }

/* Overlay që mbulon ekranin gjatë sync-ut në progres (PENDING/RUNNING) */
.sync-overlay { /* default: pa styling, vetëm wrapper */ }
.sync-overlay:has(.sync-status-active):not(.sync-overlay-dismissed) {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: sync-fade-in 0.2s ease-out;
}
.sync-overlay:has(.sync-status-active):not(.sync-overlay-dismissed) .sync-overlay-dialog {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  max-width: 620px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: sync-pop-in 0.25s ease-out;
}
.sync-overlay:has(.sync-status-active):not(.sync-overlay-dismissed) .sync-status {
  margin: 0;
  border-left: none;
  border-top: 4px solid #3b82f6;
  border-radius: 10px 10px 0 0;
}
@keyframes sync-fade-in { from { opacity: 0 } to { opacity: 1 } }
@keyframes sync-pop-in {
  from { transform: scale(0.94); opacity: 0 }
  to   { transform: scale(1);    opacity: 1 }
}

.sync-progress {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  margin-top: 0.5rem;
  border-top: 1px dashed #ddd;
}
.sync-progress-spinner {
  width: 36px; height: 36px;
  border: 3px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: sync-spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes sync-spin { to { transform: rotate(360deg) } }
.sync-progress-text { flex: 1; font-size: 0.95rem; color: #1f2937; }
.sync-progress-sub  { color: #6b7280; font-size: 0.82rem; margin-top: 0.25rem; }
.sync-cancel-btn:not([disabled]) { background: #6b7280; color: #fff; border-color: #6b7280; }

/* Butoni "Sinkronizo me Pro-Data" — gjendje */
.btn-sync-update {
  background: #e5e7eb;
  color: #9ca3af;
  border-color: #d1d5db;
  cursor: not-allowed;
  opacity: 0.7;
  transition: all 0.2s ease;
}
.btn-sync-update.btn-sync-ready {
  background: linear-gradient(135deg, #dc2626 0%, #ea580c 100%);
  color: #fff;
  border-color: #b91c1c;
  cursor: pointer;
  opacity: 1;
  font-weight: 700;
  box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.6);
  animation: sync-pulse 1.6s ease-out infinite;
}
.btn-sync-update.btn-sync-ready:hover {
  background: linear-gradient(135deg, #b91c1c 0%, #c2410c 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}
@keyframes sync-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(220, 38, 38, 0.55); }
  60%  { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0   rgba(220, 38, 38, 0); }
}

/* Toast i shkurtër kur Sinkronizo (disabled) klikohet — auto-trigger Kontroll */
.sync-auto-check-note {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 10000;
  background: #1e293b;
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  font-size: 0.92rem;
  animation: sync-toast 0.3s ease-out, sync-toast-out 0.3s ease-in 3.2s forwards;
}
@keyframes sync-toast {
  from { transform: translateY(20px); opacity: 0 }
  to   { transform: translateY(0);    opacity: 1 }
}
@keyframes sync-toast-out {
  from { opacity: 1 }
  to   { opacity: 0; transform: translateY(20px) }
}
.sync-status {
  margin: 1rem 0; padding: 0.75rem 1rem; border-radius: 6px;
  border-left: 4px solid #999; background: #f9fafb; font-size: 0.93rem;
}
.sync-status-pending { border-left-color: #f59e0b; background: #fffbeb; }
.sync-status-running { border-left-color: #3b82f6; background: #eff6ff; }
.sync-status-done    { border-left-color: #10b981; background: #ecfdf5; }
.sync-status-failed  { border-left-color: #ef4444; background: #fef2f2; }
.sync-status-warning { border-left-color: #f59e0b !important; background: #fffbeb !important; }
.sync-status-header { display: flex; gap: 0.75rem; align-items: center; margin-bottom: 0.4rem; }
.sync-status-body   { display: flex; gap: 1rem; flex-wrap: wrap; color: #555; font-size: 0.85rem; }
.sync-status-result { margin-top: 0.5rem; padding-top: 0.4rem; border-top: 1px dashed #ddd; }
.sync-status-result .error { color: #b91c1c; }
.sync-status .muted { color: #888; font-size: 0.85rem; }

.sync-status-warning-box {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid #f59e0b;
  border-radius: 6px;
}
.sync-warning-title { color: #b45309; margin-bottom: 0.5rem; font-size: 0.95rem; }
.sync-warning-message {
  margin: 0.4rem 0;
  padding: 0.6rem 0.8rem;
  background: #fef3c7;
  border-radius: 4px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow-y: auto;
  color: #1f2937;
}
.sync-warning-action {
  margin-top: 0.5rem;
  font-size: 0.88rem;
  color: #4b5563;
  font-style: italic;
}

/* =============================================================
   Premium polish — additions for v1.000027+
   ============================================================= */

/* Smooth transitions globally on interactive elements */
.btn, .btn-sm, .btn-link, .kpi, .period-card, .pagination a,
.filter-bar input, .filter-bar select, .filter-bar button {
  transition: all var(--t);
}

/* Logout form/button — replaces inline styles in base.html */
.logout-form { display: inline; margin: 0; padding: 0; }
.logout-btn {
  background: none; border: 0; cursor: pointer;
  color: inherit; font: inherit; padding: 0;
  text-decoration: underline;
}

/* Back-link helper (← Kthehu te ...) */
.back-link {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--t-fast);
}
.back-link:hover { color: var(--brand); }

/* Title count badge (e.g. "(197)" pas Punëtorët) */
.title-count {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
  margin-left: 8px;
}

/* Yes/No tick marks me ngjyrë */
.bool-yes { color: var(--green); font-weight: 700; }
.bool-no  { color: var(--red);   font-weight: 700; }

/* Layout helpers */
.ml-auto { margin-left: auto; }
.input-narrow { width: 90px; }

/* Form polish */
.form-card-wide { max-width: 760px; }
.form-card-danger {
  border-color: #fecaca;
  background: linear-gradient(180deg, #fff 0%, #fef2f2 100%);
}
.form-card-danger h2 { color: var(--red); }
.form-errors { margin: 4px 0 0; padding-left: 18px; }
.form-errors li { padding: 2px 0; }

/* Section wrapper (collapsible content blocks) */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--sp-5) var(--sp-6);
  margin-bottom: var(--sp-5);
  box-shadow: var(--shadow-sm);
}
.section-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: var(--sp-3);
}
.section-title { font-size: 14px; font-weight: 600; color: var(--text); }
.section-meta { font-size: 12px; color: var(--text-muted); }

/* Chip — small inline metadata pill */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 11px; font-weight: 500; color: var(--text-muted);
}
.chip-brand { background: #f0fdfa; border-color: #99f6e4; color: var(--brand-dark); }
.chip-warn  { background: var(--amber-bg); border-color: #fcd34d; color: var(--amber); }

/* Empty state polish (hero card) */
.empty-state {
  padding: var(--sp-10) var(--sp-6);
  text-align: center;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #fff 0%, var(--surface-2) 100%);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

/* =============================================================
   Action Modal (3-phase: confirm → loading → success)
   Përdoret për veprime të rëndësishme si Mbyll/Hap periudhë.
   ============================================================= */
.action-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-out;
}
.action-modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}
.action-modal {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0,0,0,0.05);
  padding: 26px 28px;
  max-width: 460px;
  width: calc(100% - 32px);
  text-align: center;
  transform: translateY(8px) scale(0.98);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.action-modal-backdrop.show .action-modal {
  transform: translateY(0) scale(1);
}
.action-modal-icon {
  font-size: 44px;
  margin-bottom: 10px;
  display: block;
  line-height: 1;
}
.action-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
}
.action-modal-message {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0 0 20px;
  line-height: 1.5;
}
.action-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.action-modal-actions .btn,
.action-modal-actions .btn-link {
  min-width: 110px;
}

/* Loading state — animated spinner */
.action-modal-spinner {
  width: 56px;
  height: 56px;
  border: 4px solid #e2e8f0;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: action-modal-spin 0.8s linear infinite;
  margin: 0 auto 14px;
}
@keyframes action-modal-spin {
  to { transform: rotate(360deg); }
}

/* Success state — animated checkmark */
.action-modal-success-icon {
  width: 64px; height: 64px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: #d1fae5;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  animation: action-modal-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.action-modal-success-icon::after {
  content: "";
  width: 24px; height: 12px;
  border-left: 4px solid #059669;
  border-bottom: 4px solid #059669;
  transform: rotate(-45deg) translate(2px, -3px);
}
@keyframes action-modal-pop {
  0% { transform: scale(0.5); opacity: 0; }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

/* Variant me ngjyrë sipas tipit të veprimit */
.action-modal-warning .action-modal-icon { color: #f59e0b; }
.action-modal-danger  .action-modal-icon { color: #dc2626; }
.action-modal-info    .action-modal-icon { color: var(--brand); }
.empty-state-icon {
  width: 48px; height: 48px; margin: 0 auto var(--sp-3);
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 14px; font-size: 22px;
}
.empty-state p { font-size: 15px; margin: 0 0 var(--sp-4); color: var(--text); }
.empty-state .hint { color: var(--text-soft); font-size: 13px; }

/* Kicker (small uppercase label above headings) */
.kicker {
  font-size: 11px; font-weight: 600; letter-spacing: 0.6px;
  text-transform: uppercase; color: var(--text-muted);
  margin-bottom: 6px;
}
.divider { height: 1px; background: var(--border); margin: var(--sp-6) 0; border: 0; }

/* Login hero polish */
body:has(.login-box) {
  background: radial-gradient(1200px 600px at 50% -10%, #ccfbf1 0%, transparent 60%), var(--bg);
}
.login-box {
  padding: 40px 36px;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.login-box::before { font-size: 22px; letter-spacing: 4px; }
.login-box button { padding: 12px; font-weight: 600; letter-spacing: 0.2px; }

/* Skeleton/loading shimmer (HTMX requests) */
.htmx-request { opacity: 0.7; }
.htmx-request.btn::after, .htmx-request.btn-sm::after {
  content: ""; width: 12px; height: 12px; margin-left: 6px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%;
  display: inline-block; vertical-align: -2px;
  animation: sync-spin 0.7s linear infinite;
}

/* Focus visibility on rows */
tbody tr:focus-within {
  box-shadow: inset 0 0 0 2px var(--brand-light);
}

/* Softened totals row (less loud than gradient) */
.totals-row, .totals-row th, .totals-row td {
  background: var(--surface-2);
  border-top: 1px solid var(--border-strong);
  color: var(--text);
}
.totals-row td.num strong, .totals-row th.num { color: var(--brand-dark); font-weight: 700; }

/* Status pills consolidated style (when used as bare .status badges) */
.status, .status-badge, .sync-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 600; letter-spacing: 0.2px;
  border: 1px solid transparent;
}

/* =============================================================
   Workflow toolbar (period detail) — moved from period_detail.html
   ============================================================= */
.workflow-add-employee {
  margin: 12px 0 8px;
}
.workflow-add-employee .btn,
.workflow-add-employee .btn-edit {
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
}
.workflow-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 8px 0 12px;
  padding: 12px 16px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  align-items: stretch;
}
.workflow-step {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  flex: 0 0 auto;
}
.workflow-step-final {
  /* Mos përdor margin-left:auto sepse lë hapësirë të zbrazët kur wrap-on në rresht të dytë */
  border-color: #fecaca;
  background: linear-gradient(180deg, var(--surface) 0%, #fef2f2 100%);
}
.workflow-step-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.workflow-step-num {
  background: var(--brand);
  color: #fff;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}
.workflow-step-final .workflow-step-num { background: #dc2626; }
.workflow-step-actions {
  display: flex; gap: 10px; flex-wrap: nowrap;
  align-items: stretch;
}
/* Të GJITHË butonat e workflow-toolbar — gjerësi minimale e barabartë
   (simetri vizuale + tekste që nuk dalin jashtë kufijve) */
.workflow-step .btn,
.workflow-step .btn-edit,
.workflow-step .btn-warning,
.workflow-step .btn-danger,
.workflow-step-actions > form > .btn,
.workflow-step-actions > form > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 170px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.3;
  text-align: center;
  box-sizing: border-box;
}

/* =============================================================
   Sync history section
   ============================================================= */
.sync-history-section {
  margin: 10px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 16px;
  box-shadow: var(--shadow-sm);
}
.sync-history-section summary {
  cursor: pointer;
  padding: 4px 0;
  list-style: revert;
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
}
.sync-history-section[open] summary {
  margin-bottom: 8px;
}
.sync-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
}
.sync-badge-ok {
  background: #d1fae5; color: #065f46; border-color: #34d399;
}
.sync-badge-warn {
  background: #fef3c7; color: #854d0e; border-color: #fcd34d;
}
.sync-history-table {
  width: 100%;
  margin-top: 12px;
  font-size: 12px;
}
.sync-history-table th {
  background: var(--surface-2);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 6px 8px;
}
.sync-history-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #f3f4f6;
}
.status-badge {
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  border: 1px solid transparent;
}
.status-badge.status-ok { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.status-badge.status-warn { background: #fef3c7; color: #854d0e; border-color: #fcd34d; }
.status-badge.status-err { background: #fee2e2; color: #7f1d1d; border-color: #fca5a5; }
.status-badge.status-pending { background: #e0e7ff; color: #3730a3; border-color: #a5b4fc; }
.sync-history-row.sync-history-failed { background: #fef2f2; }

/* h2 inline (when used inline within other elements) */
.h2-inline {
  display: inline-block;
  margin: 0;
  font-size: 15px;
}
.h2-inline::before { display: none; }

