/* ==========================================================================
   Komponentet. Disa klasa (btn, field, input, badge, alert, state, progress)
   i leshojne komponentet e @shared; ketu marrin pamjen e re te adminit.
   ========================================================================== */

/* ------------------------------------------------------------------ butonat */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  height: 38px;
  padding: 0 var(--s-4);
  border: 1px solid transparent;
  border-radius: var(--r);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}

.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: 0 0 auto; }

.btn-sm { height: 32px; padding: 0 var(--s-3); font-size: var(--fs-xs); border-radius: var(--r-sm); }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { height: 46px; padding: 0 var(--s-6); font-size: var(--fs-md); border-radius: var(--r-md); }

.btn-primary {
  background: var(--brand-solid);
  color: #fff;
  box-shadow: 0 1px 2px rgba(17, 20, 39, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); color: #fff; }

.btn-secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
  box-shadow: var(--sh-1);
}
.btn-secondary:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--ink-3); color: var(--ink); }

.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--ink); }

.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--bad-ink); color: #fff; }

.btn-success { background: var(--ok); color: #fff; }
.btn-success:hover:not(:disabled) { background: var(--ok-ink); color: #fff; }

:root[data-theme="dark"] .btn-danger,
:root[data-theme="dark"] .btn-success { color: #0b0d14; }

.btn.is-loading { pointer-events: none; }

/* Buton vetem me ikone: gjithmone me aria-label dhe tooltip. */
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--r);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}

.icon-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--ink); }
.icon-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.is-sm { width: 30px; height: 30px; border-radius: var(--r-sm); }
.icon-btn.is-sm svg { width: 16px; height: 16px; }
.icon-btn.is-outline { border-color: var(--line); background: var(--surface); }
.icon-btn.is-danger:hover:not(:disabled) { background: var(--bad-soft); color: var(--bad); }
.icon-btn.is-active { background: var(--brand-soft); color: var(--brand); }

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex: 0 0 auto;
}
.spinner-lg { width: 28px; height: 28px; border-width: 3px; color: var(--brand); }

@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------- formularet */

.field { display: grid; gap: 6px; align-content: start; margin-bottom: var(--s-4); min-width: 0; }
.field:last-child { margin-bottom: 0; }
.form-grid .field, .form-row .field { margin-bottom: 0; }

.field-label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink); }
.field-label .req { color: var(--bad); }
.field-hint { font-size: var(--fs-xs); color: var(--ink-3); }
.field-error { font-size: var(--fs-xs); color: var(--bad); font-weight: 500; }

.input {
  width: 100%;
  min-height: 40px;
  padding: 9px var(--s-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-md);
  line-height: 1.4;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}

.input::placeholder { color: var(--ink-3); }
.input:hover:not(:disabled):not(:focus) { border-color: var(--ink-3); }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--focus-ring); }
.input.is-invalid, .field.has-error .input { border-color: var(--bad); }
.input.is-invalid:focus { box-shadow: 0 0 0 4px var(--bad-soft); }
.input:disabled { background: var(--surface-3); color: var(--ink-3); cursor: not-allowed; }

.textarea { min-height: 96px; resize: vertical; }
.textarea.is-code { font-family: var(--mono); font-size: var(--fs-sm); line-height: 1.6; }

.select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237c8299' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}

input[type="date"].input { min-width: 150px; }

.checkbox { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--fs-sm); cursor: pointer; color: var(--ink); }
.checkbox input { width: 17px; height: 17px; accent-color: var(--brand-solid); cursor: pointer; }

/* Celesi (switch) per vlerat po/jo. */
.switch { display: inline-flex; align-items: center; gap: var(--s-3); cursor: pointer; font-size: var(--fs-sm); color: var(--ink-2); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.switch-track {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: var(--r-full);
  background: var(--line-strong);
  transition: background var(--t) var(--ease);
  flex: 0 0 auto;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform var(--t) var(--ease-out);
}

.switch input:checked + .switch-track { background: var(--brand-solid); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 4px var(--focus-ring); }
.switch input:disabled + .switch-track { opacity: 0.5; }

/* Fusha me ikone ne fillim (kerkimi). */
.input-icon { position: relative; min-width: 0; }
.input-icon > svg { position: absolute; left: 12px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.input-icon > .input { padding-left: 38px; }

.input-icon .input-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
}

.form-grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-row { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); align-items: start; margin-bottom: var(--s-4); }

.form-section { padding-top: var(--s-5); margin-top: var(--s-5); border-top: 1px solid var(--line); }
.form-section-title { display: flex; align-items: center; gap: var(--s-2); margin: 0 0 4px; font-size: var(--fs-lg); font-weight: 700; }
.form-section-hint { margin: 0 0 var(--s-4); font-size: var(--fs-sm); color: var(--ink-3); }

.step-num {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: var(--r-full);
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: var(--fs-xs);
  font-weight: 700;
}

/* Zgjedhje me karta (p.sh. lloji i organizates). */
.choice-grid { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }

.choice {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

.choice:hover { border-color: var(--ink-3); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice.is-on { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand); }
.choice:focus-within { box-shadow: 0 0 0 4px var(--focus-ring); }
.choice-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r); background: var(--surface-3); color: var(--ink-2); flex: 0 0 auto; }
.choice.is-on .choice-icon { background: var(--brand-solid); color: #fff; }
.choice-icon svg { width: 18px; height: 18px; }
.choice-title { display: block; font-weight: 700; font-size: var(--fs-md); color: var(--ink); }
.choice-text { display: block; margin-top: 2px; font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.45; }

/* ------------------------------------------------------ shenjat e statusit */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px 0 8px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  background: var(--neutral-soft);
  color: var(--neutral-ink);
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}

.badge svg { width: 12px; height: 12px; flex: 0 0 auto; }
.badge.no-dot { padding: 0 10px; }
.badge.no-dot::before { display: none; }

.badge-slate  { background: var(--neutral-soft); color: var(--neutral-ink); }
.badge-green  { background: var(--ok-soft);      color: var(--ok-ink); }
.badge-blue   { background: var(--info-soft);    color: var(--info-ink); }
.badge-amber  { background: var(--warn-soft);    color: var(--warn-ink); }
.badge-orange { background: var(--warn-soft);    color: var(--warn-ink); }
.badge-red    { background: var(--bad-soft);     color: var(--bad-ink); }
.badge-violet { background: var(--violet-soft);  color: var(--violet-ink); }
.badge-brand  { background: var(--brand-soft);   color: var(--brand-ink); }

/* Etikete e vogel katrore (kode, referenca, veprime auditimi). */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--surface-2);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: var(--fs-2xs);
  line-height: 1.6;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ panelet */

.panel, .card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  min-width: 0;
}

.panel-head, .card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--line);
  min-height: 60px;
}

.panel-head.is-plain { border-bottom: 0; padding-bottom: 0; min-height: 0; }
.panel-heading { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }

.panel-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: var(--brand-soft);
  color: var(--brand);
  flex: 0 0 auto;
}

.panel-icon svg { width: 17px; height: 17px; }
.panel-title, .card-title { margin: 0; font-size: var(--fs-md); font-weight: 700; letter-spacing: -0.01em; }
.panel-sub { margin: 2px 0 0; font-size: var(--fs-xs); color: var(--ink-3); }
.panel-actions { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.panel-body, .card-body { padding: var(--s-5); }
.panel-body.is-flush { padding: 0; }

.panel-foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-5);
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* ---------------------------------------------------------- koka e faqes */

/* Brenda .stack hapesiren e jep gap-i; pa kete koka do te kishte dyfishin. */
.stack > .page-head, .stack-sm > .page-head, .stack-lg > .page-head { margin-bottom: 0; }

/* Butonat brenda nje .stack (p.sh. "Me shume" i MoreFields) mbeten sa permbajtja. */
.stack > .btn, .stack-sm > .btn, .stack-lg > .btn { justify-self: start; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-4) var(--s-6);
  flex-wrap: wrap;
  margin-bottom: var(--s-6);
}

.page-head-main { display: flex; align-items: center; gap: var(--s-4); min-width: 0; }

.page-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
  background: linear-gradient(145deg, var(--brand-solid), #7c6cf0);
  color: #fff;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.28);
  flex: 0 0 auto;
}

.page-icon svg { width: 22px; height: 22px; }

.page-crumbs { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3); }
.page-crumbs a { color: var(--ink-3); }
.page-crumbs a:hover { color: var(--brand); }
.page-crumbs svg { width: 12px; height: 12px; }

.page-title { margin: 0; font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -0.03em; line-height: 1.2; }
.page-subtitle { margin: 4px 0 0; font-size: var(--fs-sm); color: var(--ink-2); }
.page-actions { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }

/* -------------------------------------------------------------- KPI-te */

.kpi-grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(4, minmax(0, 1fr)); }

.kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  min-width: 0;
  overflow: hidden;
}

.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.kpi-label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); }

.kpi-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r);
  background: var(--brand-soft);
  color: var(--brand);
  flex: 0 0 auto;
}

.kpi-icon svg { width: 18px; height: 18px; }
.kpi-green .kpi-icon  { background: var(--ok-soft);     color: var(--ok); }
.kpi-amber .kpi-icon  { background: var(--warn-soft);   color: var(--warn); }
.kpi-red .kpi-icon    { background: var(--bad-soft);    color: var(--bad); }
.kpi-blue .kpi-icon   { background: var(--info-soft);   color: var(--info); }
.kpi-violet .kpi-icon { background: var(--violet-soft); color: var(--violet); }

.kpi-value { font-size: var(--fs-3xl); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.kpi-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-3); min-height: 20px; }
.kpi-hint { font-size: var(--fs-xs); color: var(--ink-3); }
.kpi-spark { width: 96px; height: 32px; flex: 0 0 auto; }

/* Shirit me shifra te vogla, i ndare me vija. */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  overflow: hidden;
}

.stat-cell {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-right: 1px solid var(--line);
  min-width: 0;
}

.stat-cell:last-child { border-right: 0; }
.stat-cell-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r); background: var(--surface-3); color: var(--ink-2); flex: 0 0 auto; }
.stat-cell-icon svg { width: 17px; height: 17px; }
.stat-cell-value { display: block; font-size: var(--fs-xl); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.stat-cell-label { display: block; font-size: var(--fs-xs); color: var(--ink-3); font-weight: 500; }

button.stat-cell { border: 0; border-right: 1px solid var(--line); background: transparent; text-align: left; font: inherit; color: inherit; cursor: pointer; transition: background var(--t-fast) var(--ease); }
button.stat-cell:hover { background: var(--surface-hover); }
button.stat-cell.is-on { background: var(--brand-soft); }
button.stat-cell.is-on .stat-cell-icon { background: var(--brand-solid); color: #fff; }

/* ------------------------------------------------------------ filtrat */

.filters {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--line);
}

.filters .input-icon { flex: 1 1 260px; max-width: 420px; }
.filters .input { min-height: 36px; padding-top: 7px; padding-bottom: 7px; font-size: var(--fs-sm); }
.filters .select { width: auto; min-width: 150px; max-width: 220px; }
.filters-right { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; margin-left: auto; }
.filters-count { font-size: var(--fs-xs); color: var(--ink-3); white-space: nowrap; }

/* Butona filtri qe ndizen e fiken. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 var(--s-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}

.chip svg { width: 15px; height: 15px; }
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip.is-on { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand-ink); }

/* -------------------------------------------------- tabs si kontroll i segmentuar */

.seg, .tabs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-3);
  max-width: 100%;
  overflow-x: auto;
  margin-bottom: var(--s-5);
}

.seg.is-inline { margin-bottom: 0; }

.seg-btn, .tab {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  height: 34px;
  padding: 0 var(--s-4);
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

.seg-btn svg { width: 15px; height: 15px; }
.seg-btn:hover, .tab:hover { color: var(--ink); }
.seg-btn.is-active, .tab.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--sh-2); }
.seg.is-sm .seg-btn { height: 28px; padding: 0 var(--s-3); font-size: var(--fs-xs); }

.seg-count, .tab-count {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: var(--r-full);
  background: var(--line);
  color: var(--ink-2);
  font-size: var(--fs-2xs);
  font-weight: 700;
  text-align: center;
}

.seg-btn.is-active .seg-count, .tab.is-active .tab-count { background: var(--brand-soft-2); color: var(--brand-ink); }

/* ------------------------------------------------------------------ tabela */

.dt-wrap { overflow-x: auto; }

.dt { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }

.dt th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px var(--s-4);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  color: var(--ink-3);
  font-size: var(--fs-2xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}

.dt td {
  padding: 12px var(--s-4);
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
  color: var(--ink);
}

.dt tbody tr:last-child td { border-bottom: 0; }
.dt tbody tr { transition: background var(--t-fast) var(--ease); }
.dt tbody tr:hover td { background: var(--surface-hover); }
.dt tbody tr.is-clickable { cursor: pointer; }
.dt .text-right { text-align: right; }
.dt .text-center { text-align: center; }
.dt td.text-right { font-variant-numeric: tabular-nums; }
.dt th:first-child, .dt td:first-child { padding-left: var(--s-5); }
.dt th:last-child, .dt td:last-child { padding-right: var(--s-5); }

.dt-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }

/* Qelizat e pasura: avatar/foto + titull + nentitull. */
.cell { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.cell-text { min-width: 0; display: grid; gap: 1px; }
.cell-title { font-weight: 600; color: var(--ink); }
a.cell-title:hover { color: var(--brand); }
.cell-sub { font-size: var(--fs-xs); color: var(--ink-3); }

.cell-thumb {
  width: 56px;
  height: 42px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--surface-3);
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: var(--ink-3);
}

.cell-thumb svg { width: 18px; height: 18px; }

.cell-emoji {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r);
  background: var(--surface-3);
  font-size: 18px;
  flex: 0 0 auto;
}

/* Shirit i vogel brenda qelizes (p.sh. ecuria e ndertimit). */
.meter { display: grid; gap: 4px; min-width: 120px; }
.meter-track { height: 6px; border-radius: var(--r-full); background: var(--brand-soft-2); overflow: hidden; }
.meter-fill { height: 100%; border-radius: inherit; background: var(--series-1); }

.progress { height: 6px; border-radius: var(--r-full); background: var(--brand-soft-2); overflow: hidden; }
.progress-bar { height: 100%; border-radius: inherit; background: var(--series-1); transition: width var(--t-slow) var(--ease); }
.progress-success { background: var(--ok); }
.progress-warning { background: var(--warn); }
.progress-danger { background: var(--bad); }

/* --------------------------------------------------------------- faqosja */

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  flex-wrap: wrap;
  padding: var(--s-3) var(--s-5);
  border-top: 1px solid var(--line);
  font-size: var(--fs-xs);
  color: var(--ink-3);
}

.pager-pages { display: flex; align-items: center; gap: 4px; }
.pager-size { display: flex; align-items: center; gap: var(--s-2); }
.pager-size .select { min-height: 30px; padding: 4px 30px 4px 10px; font-size: var(--fs-xs); width: auto; background-position: right 6px center; }

.pager-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 var(--s-2);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.pager-btn svg { width: 15px; height: 15px; }
.pager-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--ink); }
.pager-btn.is-active { background: var(--brand-solid); color: #fff; }
.pager-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pager-gap { padding: 0 2px; }

/* ------------------------------------------------- dritaret: drawer dhe dialog */

.overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  background: var(--overlay);
  backdrop-filter: blur(3px);
  animation: fade-in var(--t) var(--ease);
}

.overlay.is-center { display: grid; place-items: center; padding: var(--s-4); }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(620px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--sh-4);
  animation: drawer-in var(--t-slow) var(--ease-out);
}

.drawer.is-lg { width: min(780px, 100vw); }
.drawer.is-sm { width: min(460px, 100vw); }

.dialog {
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-4);
  animation: dialog-in var(--t) var(--ease-out);
}

.dialog.is-lg { max-width: 720px; }

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-5) var(--s-6);
  border-bottom: 1px solid var(--line);
}

.sheet-head-main { display: flex; align-items: flex-start; gap: var(--s-3); min-width: 0; }

.sheet-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  background: var(--brand-soft);
  color: var(--brand);
  flex: 0 0 auto;
}

.sheet-icon svg { width: 20px; height: 20px; }
.sheet-icon.is-danger { background: var(--bad-soft); color: var(--bad); }
.sheet-icon.is-success { background: var(--ok-soft); color: var(--ok); }
.sheet-icon.is-warning { background: var(--warn-soft); color: var(--warn); }

.sheet-title { margin: 0; font-size: var(--fs-lg); font-weight: 800; letter-spacing: -0.02em; }
.sheet-sub { margin: 3px 0 0; font-size: var(--fs-sm); color: var(--ink-3); }
.sheet-body { flex: 1; padding: var(--s-6); overflow-y: auto; }

.sheet-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-2);
  padding: var(--s-4) var(--s-6);
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.dialog .sheet-foot { border-radius: 0 0 var(--r-xl) var(--r-xl); }

@keyframes fade-in { from { opacity: 0; } }
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0; } }
@keyframes dialog-in { from { transform: translateY(10px) scale(0.98); opacity: 0; } }

/* ---------------------------------------------------------------- toasts */

.toast-stack {
  position: fixed;
  top: calc(var(--top-h) + 12px);
  right: var(--s-6);
  z-index: var(--z-toast);
  display: grid;
  gap: var(--s-2);
  width: min(380px, calc(100vw - 32px));
}

.toast {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--sh-3);
  font-size: var(--fs-sm);
  color: var(--ink);
  overflow: hidden;
  animation: toast-in var(--t-slow) var(--ease-out);
}

.toast::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand); }
.toast-success::before { background: var(--ok); }
.toast-error::before { background: var(--bad); }
.toast-info::before { background: var(--info); }

.toast-icon { display: grid; place-items: center; width: 22px; height: 22px; flex: 0 0 auto; color: var(--brand); }
.toast-success .toast-icon { color: var(--ok); }
.toast-error .toast-icon { color: var(--bad); }
.toast-info .toast-icon { color: var(--info); }
.toast-icon svg { width: 20px; height: 20px; }
.toast-msg { flex: 1; padding-top: 1px; line-height: 1.45; }

@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* ---------------------------------------------------------------- alarme */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--info-soft);
  border-left-width: 4px;
  border-radius: var(--r);
  background: var(--info-soft);
  color: var(--info-ink);
  font-size: var(--fs-sm);
  margin-bottom: var(--s-4);
}

.alert-body { flex: 1; line-height: 1.5; }
.alert-body strong { display: block; margin-bottom: 2px; }
.alert-info    { background: var(--info-soft); border-color: var(--info); color: var(--info-ink); border-top-color: transparent; border-right-color: transparent; border-bottom-color: transparent; }
.alert-success { background: var(--ok-soft);   border-color: var(--ok);   color: var(--ok-ink);   border-top-color: transparent; border-right-color: transparent; border-bottom-color: transparent; }
.alert-warning { background: var(--warn-soft); border-color: var(--warn); color: var(--warn-ink); border-top-color: transparent; border-right-color: transparent; border-bottom-color: transparent; }
.alert-danger  { background: var(--bad-soft);  border-color: var(--bad);  color: var(--bad-ink);  border-top-color: transparent; border-right-color: transparent; border-bottom-color: transparent; }
.alert-close { border: 0; background: transparent; color: inherit; font-size: 20px; line-height: 1; opacity: 0.6; }
.alert-close:hover { opacity: 1; }

/* -------------------------------------------------------------- gjendjet */

.state {
  display: grid;
  justify-items: center;
  gap: var(--s-2);
  padding: var(--s-12) var(--s-6);
  text-align: center;
  color: var(--ink-2);
}

.state h3 { margin: 0; font-size: var(--fs-lg); font-weight: 700; color: var(--ink); }
.state p { margin: 0; font-size: var(--fs-sm); max-width: 48ch; color: var(--ink-3); }
.state .btn { margin-top: var(--s-2); }

.state-art {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: var(--s-2);
  border-radius: 20px;
  background: var(--surface-3);
  color: var(--ink-3);
}

.state-art svg { width: 28px; height: 28px; }
.state-error .state-art { background: var(--bad-soft); color: var(--bad); }
.state-error h3 { color: var(--ink); }

/* Protected/Loading nga @shared: ekrani i plote. */
body > #root > .state { min-height: 100vh; align-content: center; }

.skel-table { padding: var(--s-2) 0; }

.skel-row {
  display: grid;
  grid-template-columns: 2.4fr 1fr 1fr 1fr;
  gap: var(--s-6);
  align-items: center;
  padding: 14px var(--s-5);
  border-bottom: 1px solid var(--line-soft);
}

.skel {
  height: 12px;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--line-soft) 50%, var(--surface-3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}

.skel.is-block { height: 120px; border-radius: var(--r-lg); }

.skeleton-list { display: grid; gap: var(--s-3); padding: var(--s-4); }
.skeleton-row { height: 44px; border-radius: var(--r); background: linear-gradient(90deg, var(--surface-3) 25%, var(--line-soft) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.3s ease-in-out infinite; }

@keyframes shimmer { to { background-position: -200% 0; } }

/* --------------------------------------------------------------- avataret */

.avatar {
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex: 0 0 auto;
  object-fit: cover;
  color: #fff;
  background: var(--brand-solid);
  user-select: none;
}

.avatar.is-square { border-radius: 28%; }

/* Tete ngjyra te qeta; zgjidhen nga emri, ndaj i njejti emer ka gjithmone te njejten. */
.av-0 { background: #4f46e5; }
.av-1 { background: #0e7490; }
.av-2 { background: #b45309; }
.av-3 { background: #047857; }
.av-4 { background: #be185d; }
.av-5 { background: #6d28d9; }
.av-6 { background: #1d4ed8; }
.av-7 { background: #9f1239; }

/* ---------------------------------------------------- cifte celes-vlere */

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: var(--s-4) var(--s-6); }
.kv-item { display: grid; gap: 3px; min-width: 0; }
.kv-key { font-size: var(--fs-2xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.kv-val { font-size: var(--fs-md); color: var(--ink); word-break: break-word; font-weight: 500; }

.dl { display: grid; }

.dl-row {
  display: grid;
  grid-template-columns: minmax(120px, 38%) 1fr;
  gap: var(--s-4);
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: var(--fs-sm);
}

.dl-row:first-child { padding-top: 0; }
.dl-row:last-child { border-bottom: 0; padding-bottom: 0; }
.dl-row dt { color: var(--ink-3); font-weight: 500; }
.dl-row dd { margin: 0; color: var(--ink); font-weight: 600; word-break: break-word; }

/* ----------------------------------------------------------- blloku JSON */

.json-view {
  margin: 0;
  padding: var(--s-4);
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: var(--fs-xs);
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
}

/* --------------------------------------------------------------- tooltip */

[data-tip] { position: relative; }

[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: var(--z-pop);
  padding: 5px 9px;
  border-radius: var(--r-sm);
  background: #111427;
  color: #fff;
  font-size: var(--fs-2xs);
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}

[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
[data-tip-side="right"]::after { bottom: auto; left: calc(100% + 10px); top: 50%; transform: translate(-4px, -50%); }
[data-tip-side="right"]:hover::after, [data-tip-side="right"]:focus-visible::after { transform: translate(0, -50%); }
[data-tip-side="left"]::after { left: auto; right: 0; transform: translate(0, 4px); }
[data-tip-side="left"]:hover::after, [data-tip-side="left"]:focus-visible::after { transform: translate(0, 0); }

/* ------------------------------------------------------------ menuja pop */

.menu {
  position: absolute;
  z-index: var(--z-pop);
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--sh-3);
  animation: dialog-in var(--t-fast) var(--ease-out);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.menu-item svg { width: 16px; height: 16px; color: var(--ink-3); }
.menu-item:hover { background: var(--surface-3); color: var(--ink); }
.menu-item.is-danger { color: var(--bad); }
.menu-item.is-danger svg { color: var(--bad); }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--line); }
.menu-label { padding: 8px 10px 4px; font-size: var(--fs-2xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }

/* ------------------------------------------------------------ responsive */

@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
  .kpi { padding: var(--s-4); }
  .kpi-value { font-size: var(--fs-2xl); }
  .kpi-spark { display: none; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .page-head { align-items: stretch; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .sheet-head, .sheet-body, .sheet-foot { padding-left: var(--s-4); padding-right: var(--s-4); }
  .filters .input-icon { max-width: none; flex-basis: 100%; }
  .filters .select { flex: 1 1 140px; max-width: none; }
  .filters-right { margin-left: 0; width: 100%; }
  .stat-cell { border-right: 0; border-bottom: 1px solid var(--line); }
  .stat-cell:last-child { border-bottom: 0; }

  /* Tabela behet liste kartash: cdo qelize me etiketen e kolones. */
  .dt.is-stacked thead { display: none; }
  .dt.is-stacked, .dt.is-stacked tbody, .dt.is-stacked tr, .dt.is-stacked td { display: block; width: 100%; }
  .dt.is-stacked tr { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); }
  .dt.is-stacked tbody tr:last-child { border-bottom: 0; }
  .dt.is-stacked td { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: 6px 0 !important; border: 0; text-align: right; }
  .dt.is-stacked td::before { content: attr(data-label); font-size: var(--fs-2xs); font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); text-align: left; flex: 0 0 auto; }
  .dt.is-stacked td.is-main { display: block; text-align: left; padding-bottom: 8px !important; }
  .dt.is-stacked td.is-main::before, .dt.is-stacked td[data-label=""]::before { display: none; }
  .dt.is-stacked tbody tr:hover td { background: transparent; }
  .dt.is-stacked .dt-actions { justify-content: flex-end; width: 100%; }
  .dt.is-stacked .hide-sm { display: none; }
}
