/*
|--------------------------------------------------------------------------
| Mondo Digital Forms — design system
|--------------------------------------------------------------------------
| Tokens → bazat → layout → komponentët → kompatibiliteti me faqet e vjetra
|--------------------------------------------------------------------------
*/

@font-face { font-family: "Plex"; font-weight: 400; font-display: swap; src: url("../vendor/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215; }
@font-face { font-family: "Plex"; font-weight: 500; font-display: swap; src: url("../vendor/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215; }
@font-face { font-family: "Plex"; font-weight: 600; font-display: swap; src: url("../vendor/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215; }
@font-face { font-family: "Plex"; font-weight: 700; font-display: swap; src: url("../vendor/fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215; }
@font-face { font-family: "Plex"; font-weight: 400; font-display: swap; src: url("../vendor/fonts/ibm-plex-sans-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Plex"; font-weight: 500; font-display: swap; src: url("../vendor/fonts/ibm-plex-sans-latin-ext-500-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Plex"; font-weight: 600; font-display: swap; src: url("../vendor/fonts/ibm-plex-sans-latin-ext-600-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Plex"; font-weight: 700; font-display: swap; src: url("../vendor/fonts/ibm-plex-sans-latin-ext-700-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ---------------------------------------------------------------- tokens */

:root {
    --font: "Plex", "Segoe UI", system-ui, -apple-system, sans-serif;

    --ink: #1B2B2E;          /* tekst kryesor, sidebar */
    --ink-2: #24383C;
    --text-2: #3A4B4E;
    --muted: #5D6B6E;
    --muted-2: #8A9699;

    --paper: #F2F4F3;        /* sfondi i aplikacionit */
    --paper-2: #F7F9F8;
    --surface: #FFFFFF;
    --line: #D9E0DD;
    --line-soft: #E8EDEB;

    --brand: #0B6B5A;        /* veprimi kryesor */
    --brand-ink: #084E42;
    --brand-tint: #E2F1EC;

    --ok: #1E7F4F;   --ok-ink: #145C38;   --ok-tint: #E2F3EA;
    --bad: #B4322A;  --bad-ink: #8A231D;  --bad-tint: #FBE8E6;
    --warn: #A86A0C; --warn-ink: #7A4C06; --warn-tint: #FCF1DC;
    --info: #2A5D9E; --info-ink: #1F4677; --info-tint: #E6EEF8;
    --neutral-tint: #ECEFEE;

    --thead-bg: #F5F7F6;

    --r-lg: 12px;
    --r-md: 10px;
    --r-sm: 8px;

    --shadow: 0 1px 2px rgba(27, 43, 46, .06);
    --shadow-pop: 0 12px 32px rgba(27, 43, 46, .16);

    --sidebar-w: 248px;
    --topbar-h: 60px;

    /* Bootstrap */
    --bs-body-font-family: var(--font);
    --bs-body-font-size: .9375rem;
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--paper);
    --bs-border-color: var(--line);
    --bs-primary: var(--brand);
    --bs-primary-rgb: 11, 107, 90;
    --bs-link-color: var(--brand);
    --bs-link-color-rgb: 11, 107, 90;
    --bs-link-hover-color: var(--brand-ink);
    --bs-secondary-color: var(--muted);
    --bs-border-radius: var(--r-sm);
    --bs-border-radius-lg: var(--r-md);
    --bs-success: var(--ok);
    --bs-danger: var(--bad);
    --bs-warning: var(--warn);
}

/* ---------------------------------------------------------------- bazat */

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

body {
    font-family: var(--font);
    background: var(--paper);
    color: var(--ink);
    font-size: .9375rem;
    line-height: 1.5;
    margin: 0;
    font-feature-settings: "tnum" 0;
}

h1, h2, h3, h4, h5, h6 { color: var(--ink); font-weight: 600; letter-spacing: -.01em; }

.num, .tabular { font-variant-numeric: tabular-nums; }

a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-ink); }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.text-muted, .text-secondary { color: var(--muted) !important; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------------------------------------------------------------- layout */

.app-topbar {
    position: fixed;
    inset: 0 0 auto var(--sidebar-w);
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px;
    z-index: 1030;
}

.app-topbar .context {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: var(--muted);
    font-size: .875rem;
}

.app-topbar .context strong { color: var(--ink); font-weight: 600; }

.app-topbar .spacer { flex: 1; }

.icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.icon-btn:hover { background: var(--paper); color: var(--ink); }

.icon-btn .count {
    position: absolute;
    top: 3px;
    right: 1px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--bad);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 0;
    background: transparent;
    padding: 4px 6px 4px 4px;
    border-radius: var(--r-sm);
    color: var(--ink);
    text-align: left;
}

.user-chip:hover { background: var(--paper); }

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--brand-tint);
    color: var(--brand-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .8125rem;
    flex: none;
}

.user-chip .who { line-height: 1.2; }
.user-chip .who b { display: block; font-size: .875rem; font-weight: 600; }
.user-chip .who small { color: var(--muted); font-size: .75rem; }

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--ink);
    color: #C9D3D1;
    display: flex;
    flex-direction: column;
    z-index: 1040;
}

.app-sidebar .brand {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    text-decoration: none;
    color: #fff;
    flex: none;
}

.app-sidebar .brand img { height: 26px; width: auto; }
.app-sidebar .brand span { font-weight: 600; font-size: .9375rem; }
.app-sidebar .brand small { display: block; font-size: .6875rem; color: #8FA19E; font-weight: 400; }

.app-sidebar nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.15) transparent;
}

.nav-group + .nav-group { margin-top: 14px; }

.nav-group-title {
    font-size: .75rem;
    color: #7F918E;
    padding: 6px 12px;
    font-weight: 500;
}

.nav-link-app {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: var(--r-sm);
    color: #C9D3D1;
    text-decoration: none;
    font-size: .875rem;
    position: relative;
}

.nav-link-app i { width: 18px; text-align: center; font-size: .9375rem; color: #8FA19E; }
.nav-link-app:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-link-app:hover i { color: #fff; }

.nav-link-app.active { background: rgba(255, 255, 255, .1); color: #fff; font-weight: 500; }
.nav-link-app.active i { color: #7FD3BE; }
.nav-link-app.active::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #7FD3BE;
}

.nav-link-app .nav-count {
    margin-left: auto;
    min-width: 22px;
    padding: 0 7px;
    height: 20px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: .75rem;
    font-weight: 600;
    line-height: 20px;
    text-align: center;
}

.nav-link-app .nav-count.alert { background: var(--bad); }

.app-main {
    margin-left: var(--sidebar-w);
    padding: calc(var(--topbar-h) + 28px) 32px 48px;
    min-height: 100vh;
}

.app-main > .content-inner { max-width: 1320px; margin: 0 auto; }

.menu-btn { display: none; }

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(27, 43, 46, .45);
    z-index: 1035;
}

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-pop); }
    body.nav-open .app-sidebar { transform: none; }
    body.nav-open .sidebar-backdrop { display: block; }
    .app-topbar { left: 0; padding: 0 12px; }
    .menu-btn { display: inline-flex; }
    .app-main { margin-left: 0; padding: calc(var(--topbar-h) + 16px) 16px 40px; }
    .user-chip .who { display: none; }
}

/* ---------------------------------------------------------------- page head */

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.page-head h1 { font-size: 1.5rem; margin: 0; line-height: 1.25; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 68ch; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.crumb { font-size: .8125rem; color: var(--muted); margin-bottom: 6px; display: inline-flex; gap: 6px; align-items: center; text-decoration: none; }
.crumb:hover { color: var(--brand); }

@media (max-width: 575.98px) {
    .page-head h1 { font-size: 1.25rem; }
    .page-head .actions { width: 100%; }
    .page-head .actions .btn { flex: 1; }
}

/* ---------------------------------------------------------------- panels */

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
}

.panel + .panel { margin-top: 20px; }

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line-soft);
}

.panel-head h2 { font-size: 1rem; margin: 0; }
.panel-head .sub { color: var(--muted); font-size: .8125rem; }
.panel-body { padding: 20px; }
.panel-foot { padding: 12px 20px; border-top: 1px solid var(--line-soft); background: var(--paper-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* ---------------------------------------------------------------- stats */

.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    overflow: hidden;
    margin-bottom: 20px;
}

.stat {
    padding: 16px 20px;
    border-right: 1px solid var(--line-soft);
    text-decoration: none;
    color: inherit;
    display: block;
}

.stat:last-child { border-right: 0; }
a.stat:hover { background: var(--paper-2); color: inherit; }
.stat .label { color: var(--muted); font-size: .8125rem; }
.stat .value { font-size: 1.75rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 2px; }
.stat .hint { font-size: .75rem; color: var(--muted); }
.stat.is-bad .value { color: var(--bad); }
.stat.is-warn .value { color: var(--warn); }
.stat.is-ok .value { color: var(--ok); }

@media (max-width: 575.98px) {
    .stat-row { grid-template-columns: 1fr 1fr; }
    .stat { border-bottom: 1px solid var(--line-soft); }
    .stat .value { font-size: 1.4rem; }
}

/* ---------------------------------------------------------------- tags (statuset) */

.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 9px 2px 8px;
    border-radius: 6px;
    font-size: .75rem;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
    background: var(--neutral-tint);
    color: var(--text-2);
}

.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.tag-ok { background: var(--ok-tint); color: var(--ok-ink); }
.tag-bad { background: var(--bad-tint); color: var(--bad-ink); }
.tag-warn { background: var(--warn-tint); color: var(--warn-ink); }
.tag-info { background: var(--info-tint); color: var(--info-ink); }
.tag-neutral { background: var(--neutral-tint); color: var(--muted); }

/* ---------------------------------------------------------------- tabela */

.table { --bs-table-bg: transparent; --bs-table-color: var(--ink); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .75rem 1rem; border-bottom-color: var(--line-soft); }
.table thead th, .table thead td {
    background: var(--thead-bg) !important;
    color: var(--muted) !important;
    font-size: .8125rem;
    font-weight: 600;
    border-bottom: 1px solid var(--line) !important;
    white-space: nowrap;
}
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: var(--paper-2); }
.table-bordered > :not(caption) > * > * { border-color: var(--line-soft); }

.data-table td .primary { font-weight: 600; color: var(--ink); text-decoration: none; }
.data-table td .primary:hover { color: var(--brand); }
.data-table td .meta { display: block; color: var(--muted); font-size: .8125rem; }

/* Lista mobile: rreshtat e tabelës bëhen kartela */
@media (max-width: 767.98px) {
    .table-stack thead { display: none; }
    .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
    .table-stack tr { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
    .table-stack > :not(caption) > * > * { padding: 3px 0; border: 0; }
    .table-stack td[data-label]::before { content: attr(data-label); display: block; font-size: .75rem; color: var(--muted); }
    .table-stack td.actions-cell { padding-top: 10px; }
}

/* ---------------------------------------------------------------- forms */

.form-label { font-weight: 500; color: var(--text-2); font-size: .875rem; margin-bottom: 6px; }
.form-control, .form-select {
    background-color: var(--surface);
    border-radius: var(--r-sm);
    border-color: var(--line);
    min-height: 42px;
    font-size: .9375rem;
    color: var(--ink);
}
.form-control:focus, .form-select:focus { background-color: var(--surface); border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11, 107, 90, .15); }
.form-text { color: var(--muted); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.is-required-now { border-color: var(--bad) !important; box-shadow: 0 0 0 3px rgba(180, 50, 42, .12) !important; }

/* ---------------------------------------------------------------- buttons */

.btn { border-radius: var(--r-sm); font-weight: 500; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-sm { min-height: 32px; font-size: .8125rem; padding: .25rem .65rem; }
.btn-lg { min-height: 48px; }

.btn-primary, .btn-dark {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-ink);
    --bs-btn-hover-border-color: var(--brand-ink);
    --bs-btn-active-bg: var(--brand-ink);
    --bs-btn-active-border-color: var(--brand-ink);
    --bs-btn-disabled-bg: var(--brand);
    --bs-btn-disabled-border-color: var(--brand);
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
}

.btn-light, .btn-outline-dark, .btn-outline-secondary, .btn-secondary {
    --bs-btn-bg: var(--surface);
    --bs-btn-color: var(--ink);
    --bs-btn-border-color: var(--line);
    --bs-btn-hover-bg: var(--paper);
    --bs-btn-hover-color: var(--ink);
    --bs-btn-hover-border-color: #C3CDC9;
    --bs-btn-active-bg: var(--line-soft);
    --bs-btn-active-color: var(--ink);
    --bs-btn-active-border-color: #C3CDC9;
}

.btn-outline-danger { --bs-btn-color: var(--bad); --bs-btn-border-color: #E7B9B5; --bs-btn-hover-bg: var(--bad); --bs-btn-hover-border-color: var(--bad); }
.btn-danger { --bs-btn-bg: var(--bad); --bs-btn-border-color: var(--bad); --bs-btn-hover-bg: var(--bad-ink); --bs-btn-hover-border-color: var(--bad-ink); }
.btn-success { --bs-btn-bg: var(--ok); --bs-btn-border-color: var(--ok); --bs-btn-hover-bg: var(--ok-ink); --bs-btn-hover-border-color: var(--ok-ink); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); }
.btn-link { min-height: auto; padding: 0; color: var(--brand); text-decoration: none; font-weight: 500; }

/* ---------------------------------------------------------------- filter bar */

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line-soft);
}

.filter-bar .form-control, .filter-bar .form-select { min-height: 38px; font-size: .875rem; }
.filter-bar label { font-size: .75rem; color: var(--muted); margin-bottom: 4px; display: block; }

.segmented {
    display: inline-flex;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 3px;
    gap: 2px;
    flex-wrap: wrap;
}

.segmented a {
    padding: 5px 12px;
    border-radius: 6px;
    font-size: .8125rem;
    color: var(--text-2);
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
}

.segmented a.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(27,43,46,.12); }
.segmented a .n { color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 4px; }

/* ---------------------------------------------------------------- empty + alerts */

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--muted);
    max-width: 460px;
    margin: 0 auto;
}

.empty-state i { font-size: 1.75rem; color: var(--muted-2); margin-bottom: 12px; display: block; }
.empty-state h1, .empty-state h3 { font-size: 1.125rem; color: var(--ink); margin-bottom: 6px; }
.empty-state p { margin-bottom: 16px; }

.alert { border-radius: var(--r-md); border-width: 1px; }
.alert-success { background: var(--ok-tint); border-color: #BFE3CE; color: var(--ok-ink); }
.alert-danger { background: var(--bad-tint); border-color: #F0C7C3; color: var(--bad-ink); }
.alert-warning { background: var(--warn-tint); border-color: #F0D9A8; color: var(--warn-ink); }
.alert-info { background: var(--info-tint); border-color: #C9D9F0; color: var(--info-ink); }

.notice {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--r-md);
    background: var(--info-tint);
    color: var(--info-ink);
    font-size: .875rem;
    align-items: flex-start;
}
.notice i { margin-top: 3px; }
.notice.warn { background: var(--warn-tint); color: var(--warn-ink); }
.notice.bad { background: var(--bad-tint); color: var(--bad-ink); }
.notice.ok { background: var(--ok-tint); color: var(--ok-ink); }

.toast-stack { position: fixed; right: 16px; top: calc(var(--topbar-h) + 12px); z-index: 1090; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast-msg {
    background: var(--ink);
    color: #fff;
    padding: 12px 16px;
    border-radius: var(--r-md);
    box-shadow: var(--shadow-pop);
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: .875rem;
}
.toast-msg.success i { color: #7FD3BE; }
.toast-msg.error { background: var(--bad-ink); }
.toast-msg button { margin-left: auto; background: none; border: 0; color: rgba(255,255,255,.7); padding: 0 0 0 8px; }

/* ---------------------------------------------------------------- definition list */

.facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0;
    border: 1px solid var(--line-soft);
    border-radius: var(--r-md);
    overflow: hidden;
}

.facts > div { padding: 12px 16px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); margin: -1px -1px 0 0; }
.facts dt, .facts .k { font-size: .75rem; color: var(--muted); font-weight: 500; }
.facts dd, .facts .v { margin: 2px 0 0; font-weight: 600; }

/* ---------------------------------------------------------------- timeline */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 24px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: -4px; width: 2px; background: var(--line-soft); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 0; top: 5px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); }
.timeline li.ok::after { border-color: var(--ok); background: var(--ok); }
.timeline li.bad::after { border-color: var(--bad); }
.timeline li.warn::after { border-color: var(--warn); }
.timeline .when { font-size: .75rem; color: var(--muted); }
.timeline .what { font-weight: 600; }

/* ---------------------------------------------------------------- photo */

.thumb { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: var(--paper); }
.thumb-lg { width: 100%; max-width: 360px; max-height: 260px; object-fit: cover; border-radius: var(--r-md); border: 1px solid var(--line); }

/* ---------------------------------------------------------------- plani i sotëm */

.plan-list { list-style: none; margin: 0; padding: 0; }
.plan-list li {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--line-soft);
}
.plan-list li:last-child { border-bottom: 0; }
.plan-list .time { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-2); font-size: .875rem; }
.plan-list .time small { display: block; font-weight: 400; color: var(--muted); font-size: .6875rem; }
.plan-list .name { font-weight: 600; }
.plan-list .name small { display: block; color: var(--muted); font-weight: 400; font-size: .8125rem; }
.plan-list li.done .name { color: var(--muted); }
.plan-list li.late .time, .plan-list li.missed .time { color: var(--bad); }

@media (max-width: 575.98px) {
    .plan-list li { grid-template-columns: 44px 1fr; padding: 12px 16px; }
    .plan-list li > :last-child { grid-column: 2; justify-self: start; }
}

.progress-line { height: 6px; background: var(--line-soft); border-radius: 3px; overflow: hidden; }
.progress-line > span { display: block; height: 100%; background: var(--ok); border-radius: 3px; }

/* ---------------------------------------------------------------- plotësimi i checklist-ës */

.check-sheet { list-style: none; margin: 0; padding: 0; }

.check-group-title {
    padding: 14px 20px 8px;
    font-weight: 600;
    color: var(--text-2);
    font-size: .875rem;
    background: var(--paper-2);
    border-bottom: 1px solid var(--line-soft);
}

.check-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--line-soft);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 20px;
    align-items: center;
    scroll-margin-top: calc(var(--topbar-h) + 80px);
}

.check-item .q { font-weight: 500; font-size: 1rem; }
.check-item .q small { display: block; color: var(--muted); font-size: .75rem; font-weight: 400; }
.check-item.unanswered-flag { background: #FFFBF2; }

/* Butonat e përgjigjes: elementi kryesor i ndërfaqes së punëtorit */
.answer { display: inline-flex; gap: 6px; }
.answer input { position: absolute; opacity: 0; pointer-events: none; }
.answer label {
    min-width: 92px;
    height: 46px;
    padding: 0 14px;
    border: 1.5px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    font-size: .875rem;
    color: var(--text-2);
    cursor: pointer;
    user-select: none;
    transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}
.answer label:hover { border-color: #B9C5C1; }
.answer input:focus-visible + label { outline: 2px solid var(--brand); outline-offset: 2px; }
.answer .a-ok input:checked + label { background: var(--ok); border-color: var(--ok); color: #fff; }
.answer .a-bad input:checked + label { background: var(--bad); border-color: var(--bad); color: #fff; }
.answer .a-na input:checked + label { background: var(--muted); border-color: var(--muted); color: #fff; }
.answer .a-na label { min-width: 64px; }

.check-detail {
    grid-column: 1 / -1;
    display: none;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    padding: 12px;
    background: var(--bad-tint);
    border-radius: var(--r-md);
}
.check-item.is-problem .check-detail { display: grid; }
.check-item.show-note .check-detail { display: grid; background: var(--paper-2); }
.check-detail textarea { min-height: 44px; }
.photo-pick {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 14px;
    border: 1px dashed #B9C5C1;
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--text-2);
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}
.photo-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-pick.has-file { border-style: solid; border-color: var(--ok); color: var(--ok-ink); }
.photo-pick img { width: 30px; height: 30px; object-fit: cover; border-radius: 4px; }

.note-toggle { display: block; font-size: .8125rem; color: var(--muted); background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 2px; }

.sheet-bar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    background: var(--surface);
    border-top: 1px solid var(--line);
    border-radius: 0 0 var(--r-lg) var(--r-lg);
    box-shadow: 0 -6px 16px rgba(27, 43, 46, .06);
}
.sheet-bar .tally { font-size: .875rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.sheet-bar .tally b { color: var(--ink); }
.sheet-bar .tally .bad { color: var(--bad); font-weight: 600; }
.sheet-bar .grow { flex: 1; }

@media (max-width: 767.98px) {
    .check-item { grid-template-columns: 1fr; padding: 16px; }
    .answer { display: grid; grid-template-columns: 1fr 1fr 70px; width: 100%; }
    .answer label { width: 100%; min-width: 0; height: 50px; }
    .check-detail { grid-template-columns: 1fr; }
    .sheet-bar { padding: 12px 16px; flex-wrap: wrap; border-radius: 0; margin: 0 -1px; }
    .sheet-bar .btn { width: 100%; }
}

/* ---------------------------------------------------------------- login */

.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 520px);
    background: var(--surface);
}

.auth-side {
    background: var(--ink);
    color: #C9D3D1;
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.auth-side img { height: 34px; width: auto; align-self: flex-start; }
.auth-side h2 { color: #fff; font-size: 2rem; font-weight: 600; line-height: 1.2; max-width: 16ch; margin: 0 0 14px; }
.auth-side p { max-width: 46ch; margin: 0; }

.auth-form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-form { width: 100%; max-width: 360px; }
.auth-form h1 { font-size: 1.5rem; margin-bottom: 6px; }
.auth-form .lead-muted { color: var(--muted); margin-bottom: 28px; }
.auth-form .form-control { min-height: 48px; }
.auth-form .btn { width: 100%; min-height: 48px; }

@media (max-width: 860px) {
    .auth-page { grid-template-columns: 1fr; }
    .auth-side { padding: 18px 24px; flex-direction: row; align-items: center; }
    .auth-side .pitch, .auth-side > small { display: none; }
    .auth-form-wrap { align-items: flex-start; padding-top: 32px; }
}

/* ---------------------------------------------------------------- dropdown, sweetalert */

.dropdown-menu { border-color: var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-pop); padding: 6px; font-size: .875rem; }
.dropdown-item { border-radius: 6px; padding: 8px 12px; }
.dropdown-item:active { background: var(--brand); }

.swal2-popup { font-family: var(--font) !important; border-radius: var(--r-lg) !important; }
.swal2-styled.swal2-confirm { background: var(--brand) !important; border-radius: var(--r-sm) !important; }
.swal2-styled.swal2-cancel { background: var(--surface) !important; color: var(--ink) !important; border: 1px solid var(--line) !important; border-radius: var(--r-sm) !important; }

/* ---------------------------------------------------------------- kompatibiliteti me faqet e vjetra */
/* Kokat e faqeve të vjetra (slab i errët) bëhen koka të lehta. */

.legacy .card,
.legacy .main-card {
    border: 1px solid var(--line) !important;
    border-radius: var(--r-lg) !important;
    box-shadow: var(--shadow) !important;
    background: var(--surface);
}

.legacy .page-wrapper { padding: 0 !important; min-height: 0 !important; }

.legacy .card-header-custom,
.legacy .module-header,
.legacy .detail-header,
.legacy .review-header,
.legacy .report-header,
.legacy .notify-header,
.legacy .card-header {
    background: var(--surface) !important;
    color: var(--ink) !important;
    border-bottom: 1px solid var(--line-soft) !important;
}

.legacy .page-header,
.legacy .dashboard-header {
    background: transparent !important;
    color: var(--ink) !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-top: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.legacy .card-header-custom h4,
.legacy .module-header h4,
.legacy .page-header h3,
.legacy .page-header h4 { color: var(--ink) !important; font-weight: 600; }

.legacy .card-header-custom small,
.legacy .module-header small,
.legacy .page-header small,
.legacy .detail-header small,
.legacy .dashboard-header small,
.legacy .dashboard-header p { color: var(--muted) !important; }

.legacy .card-header-custom h4 > i:first-child,
.legacy .module-header h4 > i:first-child,
.legacy .page-header h3 > i:first-child { color: var(--brand); }

.legacy .table thead,
.legacy .permission-table thead { background: var(--thead-bg) !important; color: var(--muted) !important; }

.legacy .badge { font-weight: 600; border-radius: 6px; }

/* ---------------------------------------------------------------- feed i vëmendjes */

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { border-bottom: 1px solid var(--line-soft); }
.feed li:last-child { border-bottom: 0; }
.feed a {
    display: grid;
    grid-template-columns: 4px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 12px 20px 12px 16px;
    color: inherit;
    text-decoration: none;
}
.feed a:hover { background: var(--paper-2); }
.feed .bar { align-self: stretch; border-radius: 2px; background: var(--line); }
.feed .bad .bar { background: var(--bad); }
.feed .warn .bar { background: var(--warn); }
.feed .info .bar { background: var(--info); }
.feed .kind { font-size: .75rem; color: var(--muted); font-weight: 500; }
.feed .bad .kind { color: var(--bad); }
.feed .warn .kind { color: var(--warn-ink); }
.feed .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.feed .meta { font-size: .8125rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .go { color: var(--muted-2); }

/* ---------------------------------------------------------------- grafikë të vegjël */

.bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; align-items: end; height: 140px; padding-top: 8px; }
.bars .b { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; min-width: 0; }
.bars .col { width: 100%; max-width: 34px; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; }
.bars .col.bad { background: var(--bad); }
.bars .col.warn { background: var(--warn); }
.bars .col.empty { background: var(--line-soft); }
.bars .v { font-size: .75rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.bars .d { font-size: .6875rem; color: var(--muted); white-space: nowrap; }

.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.quick-actions a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
    font-weight: 500;
}
.quick-actions a:hover { border-color: var(--brand); color: var(--brand-ink); }
.quick-actions i { width: 32px; height: 32px; border-radius: 8px; background: var(--brand-tint); color: var(--brand-ink); display: inline-flex; align-items: center; justify-content: center; flex: none; }

.greet h1 { font-size: 1.625rem; }

.legacy [class*="-header"] small,
.legacy [class*="-header"] p { color: var(--muted) !important; }

.btn-warning {
    --bs-btn-bg: var(--warn-tint);
    --bs-btn-color: var(--warn-ink);
    --bs-btn-border-color: #F0D9A8;
    --bs-btn-hover-bg: #F8E4BC;
    --bs-btn-hover-color: var(--warn-ink);
    --bs-btn-hover-border-color: #E8C886;
}

@media print {
    .app-sidebar, .app-topbar, .sidebar-backdrop, .toast-stack, .page-head .actions, .print-btn, .filter-bar form { display: none !important; }
    .app-main { margin: 0 !important; padding: 0 !important; }
    body { background: #fff; }
    .panel { box-shadow: none; break-inside: avoid; }
}

@media (max-width: 767.98px) {
    .table-stack td { text-align: left !important; }
}

/* ---------------------------------------------------------------- detyrat rutinore */

.routine-list { list-style: none; margin: 0; padding: 0; }
.routine-list > li { border-bottom: 1px solid var(--line-soft); }
.routine-list > li:last-child { border-bottom: 0; }
.routine-main { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 20px; }
.routine-when { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-2); font-size: .875rem; }
.routine-when small { display: block; font-weight: 400; color: var(--muted); font-size: .6875rem; }
.routine-list li.late .routine-when { color: var(--bad); }
.routine-list li.done .routine-what .primary { color: var(--muted); }
.routine-what .meta { display: block; color: var(--muted); font-size: .8125rem; }
.routine-what .trace { display: block; margin-top: 4px; font-size: .8125rem; color: var(--ok-ink); }
.routine-act { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.routine-done { padding: 0 20px 16px 98px; }

@media (max-width: 575.98px) {
    .routine-main { grid-template-columns: 48px minmax(0, 1fr); padding: 12px 16px; }
    .routine-act { grid-column: 2; justify-content: flex-start; }
    .routine-done { padding: 0 16px 16px; }
    .routine-done .btn { width: 100%; }
}

/* Gjurmët: rrjeta e ditëve */
.trace-wrap { overflow-x: auto; padding-bottom: 4px; }
.trace-grid { display: grid; grid-template-columns: 130px repeat(var(--cols), minmax(12px, 1fr)); gap: 3px; min-width: calc(130px + var(--cols) * 15px); align-items: center; overflow-x: auto; }
.trace-grid .loc { font-size: .8125rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trace-grid .day-h { font-size: .625rem; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.trace-grid .cell { height: 20px; border-radius: 4px; background: var(--line-soft); display: block; }
.trace-grid .cell.done { background: var(--ok); }
.trace-grid .cell.done.late { background: #7DBF97; }
.trace-grid .cell.missed { background: var(--bad); }
.trace-grid .cell.pending, .trace-grid .cell.late:not(.done) { background: var(--warn-tint); outline: 1px dashed var(--warn); outline-offset: -1px; }
.trace-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .75rem; color: var(--muted); margin-top: 12px; }
.trace-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
@media (max-width: 575.98px) { .trace-grid { grid-template-columns: 90px repeat(var(--cols), 14px); min-width: 0; } }

.routine-what .primary { font-weight: 600; text-decoration: none; color: var(--ink); }
.routine-what .primary:hover { color: var(--brand); }
