/* ChefMeat ERP — Dizayn Sistemi (Baku Pain Clinic v3 bazasında)
   Yalnız LIGHT mode. Şriftlər: JetBrains Mono əsas, Inter ehtiyat.
   Korporativ rənglər: loqo qırmızısı #DF1C22 (əsas), qara #0D0D0D (sidebar). */

:root {
    --cm-blue:      #DF1C22;
    --cm-blue-dark: #B31419;
    --cm-blue-soft: #FDEAEB;
    --cm-red:       #B31419;
    --cm-red-soft:  #FBE4E5;
    --cm-ink:       #0F172A;
    --cm-muted:     #64748B;
    --cm-faint:     #94A3B8;
    --cm-bg:        #F7F6F4;
    --cm-card:      #FFFFFF;
    --cm-border:    #E7E3DE;
    --cm-green:     #16A34A;
    --cm-green-soft:#E9F7EE;
    --cm-amber:     #D97706;
    --cm-amber-soft:#FBF1E4;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(15,23,42,.05), 0 4px 14px rgba(15,23,42,.04);
    --shadow-lift: 0 4px 10px rgba(15,23,42,.08), 0 10px 30px rgba(15,23,42,.07);
    --font: 'JetBrains Mono', 'Cascadia Mono', Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

::selection { background: var(--cm-blue-soft); color: var(--cm-blue-dark); }

/* Şrift miqyası bp (Bakı Plaza) referansıdır: mətn/cədvəl .875rem, etiket/th/badge .75rem, h1 1.125rem */
body {
    font-family: var(--font);
    background: var(--cm-bg);
    color: var(--cm-ink);
    font-size: .875rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.num, .mono { font-family: var(--font); font-variant-numeric: tabular-nums; }

a { color: var(--cm-blue); text-decoration: none; transition: color .15s; }
a:hover { color: var(--cm-blue-dark); }

h1 { font-size: 1.125rem; line-height: 1.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .025em; }
h2 { font-size: 1rem; font-weight: 700; }
h3 { font-size: .75rem; line-height: 1rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--cm-muted); }
h4 { font-size: .875rem; font-weight: 700; }

/* ── Skrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 6px; border: 2px solid var(--cm-bg); }
::-webkit-scrollbar-thumb:hover { background: var(--cm-faint); }

/* ── Layout ────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 270px; flex-shrink: 0;
    background: var(--cm-card);
    border-right: 1px solid var(--cm-border);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
.sidebar .brand {
    padding: 14px 12px 12px; border-bottom: 1px solid var(--cm-border);
    display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.sidebar .brand a { display: block; transition: opacity .15s; }
.sidebar .brand a:hover { opacity: .8; }
/* Geniş loqo — inline stil YOX ki, mini rejimdə kaskad onu gizlədə bilsin */
.sidebar .brand .brand-full { height: auto; width: 100%; max-width: 190px; display: block; }
.sidebar .brand .brand-icon { display: none; border-radius: 8px; } /* yalnız mini rejimdə */
.sidebar .brand-sub {
    color: #7A7A7A; font-size: .5625rem; letter-spacing: .16em;
    font-weight: 700; text-align: center;
}
.sidebar nav { padding: 10px 10px 16px; flex: 1; overflow-y: auto; }
.sidebar nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; margin: 1px 0;
    border-radius: var(--radius-sm);
    color: var(--cm-ink); font-weight: 600;
    font-size: .875rem; line-height: 1.25rem;
    text-transform: uppercase; letter-spacing: .03em;
    border-left: 3px solid transparent;
    transition: background .12s, border-color .12s;
}
.sidebar nav a svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--cm-faint); transition: color .12s; }
.sidebar nav a:hover { background: var(--cm-bg); }
.sidebar nav a:hover svg { color: var(--cm-blue); }
.sidebar nav a.active {
    background: var(--cm-blue-soft); color: var(--cm-blue-dark);
    border-left-color: var(--cm-blue); font-weight: 700;
}
.sidebar nav a.active svg { color: var(--cm-blue); }
.sidebar nav .nav-section {
    font-size: .6875rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700;
    color: var(--cm-faint); padding: 16px 12px 5px;
}
/* ── Üst panel (bp naxışı: istifadəçi + çıxış yuxarı sağda) ─ */
.content-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.app-header {
    background: var(--cm-card);
    border-bottom: 1px solid var(--cm-border);
    position: sticky; top: 0; z-index: 50;
}
/* Başlıq məzmunu .main ilə EYNİ max-genişlik + padding — sağ kənar kartlarla düz gəlir */
.app-header .hdr-in {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 8px 28px; max-width: 1480px;
}
.hdr-right { display: flex; align-items: center; gap: 10px; }
/* Zəng ilə istifadəçi arasında dik ayırıcı cizgi */
.hdr-right .user-menu { border-left: 1px solid var(--cm-border); padding-left: 10px; }
/* İstifadəçi menyusu (bp naxışı: chip → açılan menyu) */
.user-menu { position: relative; }
.user-chip {
    display: flex; align-items: center; gap: 9px;
    background: none; border: none; cursor: pointer; font: inherit; color: inherit;
    padding: 4px 6px; border-radius: var(--radius-sm);
    transition: background .12s;
}
.user-chip:hover { background: var(--cm-bg); }
.avatar {
    width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, var(--cm-blue), var(--cm-blue-dark));
    color: #fff; font-weight: 700; font-size: .8125rem;
    display: flex; align-items: center; justify-content: center;
}
/* İstifadəçi qərarı (2026-08-03): avatar + açılma oxu — ad menyunun içindədir */
.user-chip .uname { display: none; }
.user-chip .chev { width: 14px; height: 14px; color: var(--cm-faint); transition: transform .15s; }
.user-menu.open .chev { transform: rotate(180deg); }

.user-menu .dropdown {
    display: none; position: absolute; right: 0; top: calc(100% + 8px);
    min-width: 230px; background: var(--cm-card);
    border: 1px solid var(--cm-border); border-radius: var(--radius);
    box-shadow: var(--shadow-lift); padding: 6px; z-index: 100;
}
.user-menu.open .dropdown { display: block; }

/* ── Bildiriş zəngi (bp naxışı: bell + qırmızı say + açılan siyahı) ──────── */
.notif-menu { position: relative; }
.notif-btn {
    position: relative; display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; background: none; border: none; cursor: pointer;
    border-radius: var(--radius-sm); color: var(--cm-muted); transition: background .12s, color .12s;
}
.notif-btn:hover { background: var(--cm-bg); color: var(--cm-ink); }
.notif-btn svg { width: 19px; height: 19px; }
.notif-badge {
    position: absolute; top: 2px; right: 1px; min-width: 17px; height: 17px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 4px; border-radius: 999px; background: var(--cm-red); color: #fff;
    font-size: 10px; font-weight: 700; line-height: 1; border: 2px solid var(--cm-card);
}
.notif-menu .dropdown {
    display: none; position: absolute; right: 0; top: calc(100% + 8px);
    width: 320px; max-width: 90vw; background: var(--cm-card);
    border: 1px solid var(--cm-border); border-radius: var(--radius);
    box-shadow: var(--shadow-lift); padding: 6px; z-index: 100;
    max-height: 420px; overflow-y: auto;
}
.notif-menu.open .dropdown { display: block; }
.notif-dd .nd-item {
    display: block; padding: 8px 10px; border-radius: var(--radius-sm);
    color: var(--cm-ink); border-left: 3px solid transparent;
}
.notif-dd .nd-item:hover { background: var(--cm-bg); }
.notif-dd .nd-item.nd-new { background: var(--cm-blue-soft); border-left-color: var(--cm-blue); }
.notif-dd .nd-item + .nd-item { margin-top: 3px; }
.notif-dd .nd-title { display: block; font-size: 12.5px; font-weight: 700; }
.notif-dd .nd-body { display: block; font-size: 11.5px; color: var(--cm-muted); margin-top: 1px; }
.notif-dd .nd-time { display: block; font-size: 10.5px; color: var(--cm-faint); margin-top: 2px; }
.notif-dd .nd-empty { padding: 16px 12px; color: var(--cm-muted); font-size: 12.5px; text-align: center; }
.notif-dd .nd-all {
    display: block; text-align: center; padding: 8px; margin-top: 4px;
    border-top: 1px solid var(--cm-border); font-size: 12px; font-weight: 700; color: var(--cm-blue);
}
.notif-dd .nd-readall {
    background: none; border: none; cursor: pointer; font: inherit;
    font-size: 11px; font-weight: 700; color: var(--cm-blue); padding: 2px 4px;
}
.notif-dd .nd-readall:hover { text-decoration: underline; }

/* Sidebar say nişanı (məs. Vizitlər: açıq + gözləyən) */
.sidebar nav a .nav-count {
    margin-left: auto; min-width: 18px; height: 18px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 5px; border-radius: 999px; background: var(--cm-red); color: #fff;
    font-size: 10px; font-weight: 700; letter-spacing: 0;
}
body.nav-mini .sidebar nav a .nav-count { display: none; } /* mini rejimdə yer yoxdur */
.dropdown .dd-head { padding: 9px 12px 10px; border-bottom: 1px solid var(--cm-border); margin-bottom: 5px; }
.dropdown .dd-name { font-weight: 700; font-size: .875rem; }
.dropdown .dd-sub { color: var(--cm-muted); font-size: .75rem; margin-top: 1px; }
.dropdown a, .dropdown .dd-logout {
    display: flex; align-items: center; gap: 9px; width: 100%;
    padding: 8px 12px; border-radius: var(--radius-sm);
    font: inherit; font-size: .875rem; font-weight: 600; color: var(--cm-ink);
    background: none; border: none; cursor: pointer; text-align: left;
    transition: background .12s;
}
.dropdown a:hover, .dropdown .dd-logout:hover { background: var(--cm-bg); }
.dropdown a svg, .dropdown .dd-logout svg { width: 16px; height: 16px; color: var(--cm-faint); }
.dropdown .dd-logout { color: var(--cm-red); }
.dropdown .dd-logout svg { color: var(--cm-red); }
.dropdown .dd-logout:hover { background: var(--cm-red-soft); }

.main { flex: 1; padding: 22px 28px 40px; max-width: 1480px; min-width: 0; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }

/* ── Kartlar ───────────────────────────────────────────── */
.card {
    background: var(--cm-card); border: 1px solid var(--cm-border);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px;
}
.card > h3 { margin-bottom: 12px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(172px, 1fr)); gap: 14px; }
.stat { position: relative; overflow: hidden; }
.stat .label { color: var(--cm-muted); font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 1.5rem; font-weight: 700; margin-top: 2px; letter-spacing: -.02em; }
.stat .sub { color: var(--cm-faint); font-size: .75rem; margin-top: 2px; }
.stat .value.blue { color: var(--cm-blue); }
.stat .value.red  { color: var(--cm-red); }
.stat .value.green{ color: var(--cm-green); }
.stat .value.amber{ color: var(--cm-amber); }

/* Kliklənən plitə (sürətli əməliyyat / iş siyahısı) */
a.tile { display: block; color: inherit; }
a.tile:hover { box-shadow: var(--shadow-lift); border-color: var(--cm-blue); transform: translateY(-1px); }
.tile { transition: box-shadow .15s, border-color .15s, transform .15s; }

/* ── Formlar ───────────────────────────────────────────── */
label { display: block; font-weight: 700; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--cm-muted); margin-bottom: 5px; }
input, select, textarea {
    width: 100%; padding: 8px 11px; font: inherit; font-size: .875rem;
    border: 1px solid var(--cm-border); border-radius: var(--radius-sm);
    background: #fff; color: var(--cm-ink);
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible {
    outline: none; border-color: var(--cm-blue);
    box-shadow: 0 0 0 3px rgba(223,28,34,.16);
}
input[readonly], input[disabled], select[disabled] { background: var(--cm-bg); color: var(--cm-muted); }
.field { margin-bottom: 13px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 760px) { .form-grid { grid-template-columns: 1fr; } }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 8px 15px; border: 1px solid transparent; border-radius: var(--radius-sm);
    font: inherit; font-size: .875rem; font-weight: 700; cursor: pointer;
    background: var(--cm-blue); color: #fff; white-space: nowrap;
    transition: background .15s, box-shadow .15s, transform .1s;
}
.btn:hover { background: var(--cm-blue-dark); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--cm-card); color: var(--cm-ink); border-color: var(--cm-border); }
.btn.secondary:hover { background: var(--cm-bg); border-color: var(--cm-faint); }
.btn.danger { background: var(--cm-red); }
.btn.danger:hover { background: #8E1014; }
/* <a class="btn"> linklərində qlobal a:hover mətni tünd maviyə çevirib "əritməsin" */
a.btn, a.btn:hover, a.btn:focus { color: #fff; }
a.btn.secondary, a.btn.secondary:hover, a.btn.secondary:focus { color: var(--cm-ink); }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
/* Excel ixrac düyməsi — bp (Bakı Plaza) yaşıl naxışı */
.btn.excel { background: rgba(16,185,129,.1); color: #047857; border: 1px solid rgba(16,185,129,.25); }
.btn.excel:hover { background: rgba(16,185,129,.18); }
a.btn.excel, a.btn.excel:hover, a.btn.excel:focus { color: #047857; }
/* PDF düyməsi — qırmızıya çalan neytral */
.btn.pdf { background: var(--cm-red-soft); color: var(--cm-red); border: 1px solid #EFCDD0; }
.btn.pdf:hover { background: #F3D9DC; }
a.btn.pdf, a.btn.pdf:hover, a.btn.pdf:focus { color: var(--cm-red); }
.btn.block { width: 100%; }
.btn.sm { padding: 4px 10px; font-size: .75rem; }

/* ── Cədvəllər ─────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th {
    text-align: left; font-size: .75rem; line-height: 1rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--cm-muted); font-weight: 700;
    padding: 9px 12px; border-bottom: 2px solid var(--cm-border);
    background: var(--cm-card); white-space: nowrap;
}
td { padding: 10px 12px; border-bottom: 1px solid var(--cm-border); vertical-align: middle; }
tbody tr:hover td, tr:hover > td { background: #FCF9F9; }
td.num, th.num { text-align: right; }
tr:last-child td { border-bottom: none; }

/* Boş vəziyyət */
.empty {
    text-align: center; color: var(--cm-faint); padding: 26px 12px; font-size: .875rem;
}
.empty::before { content: '—'; display: block; font-size: 22px; margin-bottom: 4px; }

/* ── Nişanlar (badge) ──────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 2px 9px; border-radius: 999px;
    font-size: .75rem; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.badge.blue   { background: var(--cm-blue-soft);  color: var(--cm-blue-dark); }
.badge.red    { background: var(--cm-red-soft);   color: var(--cm-red); }
.badge.green  { background: var(--cm-green-soft); color: var(--cm-green); }
.badge.amber  { background: var(--cm-amber-soft); color: var(--cm-amber); }
.badge.gray   { background: #F1F5F9; color: var(--cm-muted); }
.badge.plain::before { display: none; }

/* ── Flash mesajlar ────────────────────────────────────── */
.flash {
    padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 14px;
    font-weight: 600; font-size: .875rem; border: 1px solid transparent;
    display: flex; align-items: center; gap: 8px;
}
.flash.error   { background: var(--cm-red-soft);   color: var(--cm-red);   border-color: #EFCDD0; }
.flash.success { background: var(--cm-green-soft); color: var(--cm-green); border-color: #C9EBD5; }
.flash.warning { background: var(--cm-amber-soft); color: var(--cm-amber); border-color: #F3DFC4; }

/* ── Zolaq qrafiklər (Chart.js-siz dinamika) ───────────── */
.bar-row { display: flex; align-items: center; gap: 10px; margin: 5px 0; font-size: .75rem; }
.bar-row .bar-label { width: 64px; color: var(--cm-muted); flex-shrink: 0; }
.bar-row .bar-track { flex: 1; background: var(--cm-bg); border-radius: 4px; height: 16px; overflow: hidden; }
.bar-row .bar-fill { height: 100%; background: var(--cm-blue); border-radius: 4px; min-width: 2px; transition: width .3s; }
.bar-row .bar-fill.green { background: var(--cm-green); }
.bar-row .bar-val { width: 76px; text-align: right; font-weight: 700; flex-shrink: 0; }

/* ── Kompakt siyahı (iş siyahıları, fəaliyyət) ─────────── */
.list-compact { list-style: none; }
.list-compact li {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 8px 4px; border-bottom: 1px solid var(--cm-border); font-size: .875rem;
}
.list-compact li:last-child { border-bottom: none; }
.list-compact .meta { color: var(--cm-faint); font-size: .75rem; white-space: nowrap; }

/* Addım zənciri (prosedur təhlükəsizliyi) */
.chain { display: flex; gap: 6px; flex-wrap: wrap; }
.chain .step {
    flex: 1; min-width: 120px; text-align: center; padding: 8px 6px;
    border-radius: var(--radius-sm); font-size: .75rem; font-weight: 700;
    background: var(--cm-bg); color: var(--cm-faint); border: 1px solid var(--cm-border);
}
.chain .step.done    { background: var(--cm-green-soft); color: var(--cm-green); border-color: #C9EBD5; }
.chain .step.current { background: var(--cm-blue-soft); color: var(--cm-blue-dark); border-color: var(--cm-blue); }

/* ── Auth səhifəsi ─────────────────────────────────────── */
.auth-wrap {
    min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 14px;
    background: linear-gradient(160deg, var(--cm-bg) 55%, var(--cm-blue-soft));
    padding: 20px;
}
.auth-card {
    width: 100%; max-width: 390px; background: var(--cm-card);
    border: 1px solid var(--cm-border); border-radius: 16px;
    box-shadow: var(--shadow-lift); padding: 34px;
}
.auth-card .logo { text-align: center; margin-bottom: 22px; }
.auth-card .logo img { height: 84px; }

/* ── Xəta səhifələri ───────────────────────────────────── */
.error-page {
    min-height: 100vh; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 20px;
}
.error-page .code { font-size: 58px; font-weight: 800; color: var(--cm-blue); }

/* ── Responsiv ─────────────────────────────────────────── */
@media (max-width: 1100px) {
    .sidebar { width: 232px; }
    .main { padding: 16px 16px 32px; }
}
@media print {
    .sidebar, .app-header, .topbar .btn, .topbar form, .no-print { display: none !important; }
    .main { padding: 0; }
    body { background: #fff; }
    .card { box-shadow: none; border: none; padding: 0; }
    table { font-size: 11px; }
    th, td { border-bottom: 1px solid #bbb; }
    .badge { border: 1px solid #999; background: #fff !important; color: #000 !important; }
    .badge::before { display: none; }
    a { color: #000; }
}

/* ═══════════════ v3 — peşəkar UI paketi (istifadəçi təsdiqi ilə) ═══════════════ */

/* (15) Kontrast: amber AA səviyyəsinə tündləşdirildi */
:root { --cm-amber: #A16207; }

/* (16) Tünd (navy) sidebar — bütövlükdə #0D0D0D; loqo ağ variantdır (istifadəçi), lövhəsiz */
.sidebar { background: #0D0D0D; border-right-color: #000000; }
.sidebar .brand { background: #0D0D0D; border-bottom: none; }
.sidebar nav a { color: #CFCFCF; }
.sidebar nav a svg { color: #7A7A7A; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); }
.sidebar nav a:hover svg { color: #F2A3A6; }
.sidebar nav a.active {
    background: rgba(223,28,34,.34); color: #fff; border-left-color: #DF1C22;
}
.sidebar nav a.active svg { color: #FFB3B6; }
.sidebar nav .nav-section { color: #6E6E6E; }
.sidebar ::-webkit-scrollbar-thumb { background: #2E2E2E; border-color: #0D0D0D; }

/* (1) Yığılan sidebar bölmələri */
.nav-group .nav-section {
    width: 100%; background: none; border: none; cursor: pointer; font-family: inherit;
    display: flex; align-items: center; justify-content: space-between; text-align: left;
}
.nav-group .nav-section .chev {
    width: 12px; height: 12px; color: #6E6E6E; transition: transform .15s;
}
.nav-group.closed .nav-section .chev { transform: rotate(-90deg); }
.nav-group.closed .nav-items { display: none; }

/* (2) Qlobal xəstə axtarışı (Ctrl+K) */
.global-search { position: relative; flex: 1; max-width: 430px; }
.global-search input { padding-left: 32px; background: var(--cm-bg); }
.global-search .gs-icon {
    position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
    width: 15px; height: 15px; color: var(--cm-faint); pointer-events: none;
}
.global-search kbd {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    font-family: inherit; font-size: .6875rem; color: var(--cm-faint);
    border: 1px solid var(--cm-border); border-radius: 5px; padding: 1px 5px; background: #fff;
    pointer-events: none;
}
.gs-results {
    display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0;
    background: var(--cm-card); border: 1px solid var(--cm-border);
    border-radius: 10px; box-shadow: var(--shadow-lift); z-index: 150; overflow: hidden;
}
.gs-results.open { display: block; }
.gs-results a {
    display: block; padding: 9px 12px; font-size: .875rem; color: var(--cm-ink);
    border-bottom: 1px solid var(--cm-border);
}
.gs-results a:last-child { border-bottom: none; }
.gs-results a:hover, .gs-results a.sel { background: var(--cm-bg); }
.gs-results .gs-empty { padding: 10px 12px; color: var(--cm-faint); font-size: .75rem; }

/* (9) Breadcrumb */
.crumbs { display: flex; align-items: center; gap: 6px; font-size: .75rem; color: var(--cm-faint); white-space: nowrap; min-width: 0; }
.crumbs a { color: var(--cm-muted); font-weight: 600; }
.crumbs a:hover { color: var(--cm-blue); }
.crumbs .sep { opacity: .45; }
.crumbs .cur { color: var(--cm-ink); font-weight: 700; overflow: hidden; text-overflow: ellipsis; }

/* (3) Toast bildirişlər */
.toast-stack {
    position: fixed; top: 14px; right: 16px; z-index: 260;
    display: flex; flex-direction: column; gap: 8px; max-width: 380px;
}
.toast-stack .flash { margin: 0; box-shadow: var(--shadow-lift); animation: toast-in .25s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.toast-stack .flash.hide { opacity: 0; transform: translateX(14px); transition: all .35s; }

/* (4) Submit spinner */
.btn.loading { pointer-events: none; opacity: .8; }
.btn.loading::after {
    content: ''; width: 13px; height: 13px; flex-shrink: 0;
    border: 2px solid rgba(255,255,255,.45); border-top-color: #fff;
    border-radius: 50%; animation: spin .7s linear infinite;
}
.btn.secondary.loading::after, .btn.excel.loading::after, .btn.pdf.loading::after {
    border-color: rgba(15,23,42,.25); border-top-color: currentColor;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* (10) Sticky başlıqlı hündür cədvəllər */
.table-wrap.tall { max-height: 65vh; overflow-y: auto; }
.table-wrap.tall th { position: sticky; top: 0; z-index: 2; box-shadow: 0 2px 0 var(--cm-border); }

/* (6) Sıralana bilən başlıqlar */
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--cm-blue); }
th.sorted-asc::after  { content: ' ▲'; font-size: 8px; }
th.sorted-desc::after { content: ' ▼'; font-size: 8px; }

/* (13) Kateqoriya çipləri */
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip {
    padding: 4px 12px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--cm-border); background: var(--cm-card);
    font: inherit; font-size: .75rem; font-weight: 700; color: var(--cm-muted);
    transition: all .12s;
}
.chip:hover { border-color: var(--cm-blue); color: var(--cm-blue); }
.chip.active { background: var(--cm-blue-soft); color: var(--cm-blue-dark); border-color: var(--cm-blue); }

/* (14) Stat kartlarında sparkline */
.stat .spark { margin-top: 7px; }
.stat .spark svg { display: block; width: 100%; height: 26px; }

/* (17) Skip-to-content */
.skip-link {
    position: absolute; left: -9999px; top: 0; z-index: 300;
    background: var(--cm-blue); color: #fff; padding: 8px 14px; border-radius: 0 0 8px 0;
    font-weight: 700;
}
.skip-link:focus { left: 0; }

/* (18) Login incəliyi */
.auth-wrap {
    background:
        radial-gradient(circle at 85% 15%, rgba(27,116,184,.07), transparent 45%),
        radial-gradient(circle at 10% 90%, rgba(168,35,46,.05), transparent 40%),
        linear-gradient(160deg, var(--cm-bg) 55%, var(--cm-blue-soft));
}
.auth-tag { text-align: center; color: var(--cm-faint); font-size: .6875rem; margin-top: 18px; letter-spacing: .04em; }

/* (8) Mobil / planşet: gizlənən sidebar + hamburger */
.nav-toggle {
    display: none; background: var(--cm-card); border: 1px solid var(--cm-border);
    border-radius: 8px; padding: 6px 9px; cursor: pointer; color: var(--cm-ink);
}
.nav-toggle svg { width: 17px; height: 17px; display: block; }
.nav-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 170; }
@media (max-width: 900px) {
    .nav-toggle { display: inline-flex; }
    .sidebar {
        position: fixed; left: -290px; top: 0; height: 100vh; z-index: 180;
        transition: left .22s ease; width: 270px;
    }
    body.nav-open .sidebar { left: 0; box-shadow: var(--shadow-lift); }
    body.nav-open .nav-backdrop { display: block; }
    .crumbs { display: none; }
    .global-search { max-width: none; }
    .global-search kbd { display: none; }            /* toxunuşlu cihazda mənasızdır */
    .app-header .hdr-in { padding: 8px 12px; gap: 8px; }
    /* İnline 2+ sütunlu bloklar telefonda tək sütuna yığılır (dashboard, kassa, kartlar, filter formaları) */
    .main [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
    .stat-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
    .stat .value { font-size: 1.25rem; }
    .topbar { gap: 8px; }
    .topbar h1 { font-size: 1rem; }
    /* Sığmayan bölmə səhifəni yox, yalnız özünü sürüşdürməlidir */
    .main { overflow-x: clip; }
    /* Topbar düymə sıraları telefonda sığmasa alt sətrə keçsin, kəsilməsin */
    .topbar div[style*="display:flex"] { flex-wrap: wrap; }
}

/* ── Grid-blowout qoruması: grid xanası məzmunundan dar sıxıla bilsin ────── */
/* (bunsuz .table-wrap içindəki geniş cədvəl bütün səhifəni dartıb üfüqi scroll yaradır) */
.card { min-width: 0; }
.main [style*="grid-template-columns"] > * { min-width: 0; }
.main img { max-width: 100%; }
.table-wrap { -webkit-overflow-scrolling: touch; }

/* ── AZ tarix sahələri (azdate.js) — GG.AA.İİİİ + öz təqvimimiz ──────────── */
.azdate {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px 14px;
    padding-right: 32px;
    cursor: pointer;
}
.azdate:invalid { border-color: var(--cm-red); }

#azdate-pop {
    position: absolute;
    z-index: 1200;
    width: 256px;
    background: var(--cm-card);
    border: 1px solid var(--cm-border);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(2, 27, 74, .18);
    padding: 10px;
    display: none;
}
#azdate-pop .azp-head { display: flex; gap: 4px; align-items: center; margin-bottom: 8px; }
#azdate-pop .azp-nav {
    flex: 0 0 auto; width: 26px; height: 26px;
    border: 1px solid var(--cm-border); border-radius: 6px;
    background: var(--cm-card); color: var(--cm-muted);
    font-size: 14px; line-height: 1; cursor: pointer;
}
#azdate-pop .azp-nav:hover { background: var(--cm-bg); color: var(--cm-ink); }
#azdate-pop .azp-head select { flex: 1; min-width: 0; padding: 4px 6px; font-size: .75rem; }
#azdate-pop .azp-wdays {
    display: grid; grid-template-columns: repeat(7, 1fr);
    text-align: center; font-size: .625rem; font-weight: 700;
    color: var(--cm-faint); text-transform: uppercase; margin-bottom: 4px;
}
#azdate-pop .azp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
#azdate-pop .azp-day {
    height: 28px; border: none; border-radius: 6px; background: none;
    font: inherit; font-size: .8125rem; color: var(--cm-ink); cursor: pointer;
}
#azdate-pop .azp-day:hover { background: var(--cm-bg); }
#azdate-pop .azp-day.today { outline: 1px solid var(--cm-blue); outline-offset: -1px; }
#azdate-pop .azp-day.sel { background: var(--cm-blue); color: #fff; font-weight: 700; }
#azdate-pop .azp-day:disabled { color: #C8D0DC; cursor: default; background: none; }
#azdate-pop .azp-foot {
    display: flex; justify-content: space-between; align-items: center;
    gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--cm-border);
}
#azdate-pop .azp-time-wrap { display: flex; align-items: center; gap: 6px; font-size: .75rem; color: var(--cm-muted); }
#azdate-pop .azp-time { width: 64px; padding: 4px 6px; font-size: .8125rem; text-align: center; }
#azdate-pop .azp-today {
    border: none; background: none; color: var(--cm-blue);
    font-weight: 700; font-size: .75rem; cursor: pointer; padding: 4px 6px;
}
#azdate-pop .azp-today:hover { text-decoration: underline; }

/* ── Yığılan sidebar (mini rejim) — yalnız masaüstü ──────────────────────── */
.nav-collapse {
    position: fixed; z-index: 210; top: 30px; left: 257px;
    width: 26px; height: 26px; border-radius: 50%;
    border: 1px solid var(--cm-border); background: var(--cm-card);
    color: var(--cm-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow); transition: left .18s ease;
}
.nav-collapse svg { width: 13px; height: 13px; transition: transform .18s; }
.nav-collapse:hover { color: var(--cm-blue); border-color: var(--cm-blue); }

@media (min-width: 901px) {
    body.nav-mini .nav-collapse { left: 59px; }
    body.nav-mini .nav-collapse svg { transform: rotate(180deg); }
    body.nav-mini .sidebar { width: 72px; }
    /* Mini rejim: YALNIZ ikon qalır — geniş loqo və alt yazı gizlənir */
    body.nav-mini .sidebar .brand { min-height: 44px; padding: 12px 8px; gap: 0; }
    body.nav-mini .sidebar .brand .brand-full { display: none; }
    body.nav-mini .sidebar .brand .brand-sub { display: none; }
    body.nav-mini .sidebar .brand .brand-icon { display: block; height: 36px; width: 36px; object-fit: contain; }
    body.nav-mini .sidebar nav a {
        justify-content: center; gap: 0; padding: 10px 0;
        font-size: 0; letter-spacing: 0; border-left-width: 0;
    }
    body.nav-mini .sidebar nav a svg { width: 19px; height: 19px; }
    body.nav-mini .sidebar nav .nav-section {
        font-size: 0; padding: 8px 12px 2px; margin-top: 6px;
        border-top: 1px solid rgba(255, 255, 255, .08);
    }
    body.nav-mini .nav-group .nav-section .chev { display: none; }
    body.nav-mini .nav-group.closed .nav-items { display: block; } /* mini-də qruplar həmişə açıq */
}
@media (max-width: 900px) {
    .nav-collapse { display: none; } /* mobildə hamburger var */
}

/* ── Modal (qəbz önizləmə və s.) ─────────────────────────────────────────── */
.modal-backdrop {
    display: none; position: fixed; inset: 0; z-index: 400;
    background: rgba(15, 23, 42, .5);
    align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal-box {
    background: var(--cm-card); border-radius: 12px;
    width: min(860px, 100%); max-height: 92vh;
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 24px 64px rgba(2, 27, 74, .35);
}
.modal-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; border-bottom: 1px solid var(--cm-border);
}
.modal-head h3 { margin: 0; }
.modal-close {
    border: none; background: none; font-size: 20px; line-height: 1;
    cursor: pointer; color: var(--cm-muted); padding: 4px 8px;
}
.modal-close:hover { color: var(--cm-ink); }
.modal-body { flex: 1; overflow: auto; }
.modal-body iframe { display: block; width: 100%; height: 70vh; border: none; background: #fff; }
.modal-foot {
    display: flex; gap: 10px; justify-content: flex-end;
    padding: 12px 16px; border-top: 1px solid var(--cm-border);
}

/* ── AI Analiz paneli (kartoteka/vizit — istifadəçi istəyi 2026-08-06) ──────── */
/* AI düyməsi — canlı animasiyalı rəngarəng gradient (istifadəçi istəyi 2026-08-06) */
.ai-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: linear-gradient(120deg, #DF1C22, #6d28d9, #c026d3, #ec4899, #6d28d9, #DF1C22);
    background-size: 260% 100%;
    animation: ai-shimmer 5s ease-in-out infinite;
    color: #fff; border: none; font-weight: 700;
    box-shadow: 0 2px 10px rgba(124, 58, 237, .30);
    transition: filter .15s, transform .05s, box-shadow .15s;
}
@keyframes ai-shimmer {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.ai-btn:hover { filter: brightness(1.1) saturate(1.15); box-shadow: 0 4px 16px rgba(124, 58, 237, .42); color: #fff; }
.ai-btn:active { transform: translateY(1px); }
.ai-btn svg { width: 15px; height: 15px; color: #fff; }
.ai-btn:disabled { opacity: .75; cursor: wait; }
/* Hərəkət azaldılması seçimi olanlara animasiya söndürülür */
@media (prefers-reduced-motion: reduce) { .ai-btn { animation: none; } }
.ai-panel {
    margin-top: 10px; border: 1px solid var(--cm-blue);
    background: var(--cm-blue-soft); border-radius: 8px; padding: 12px 14px;
}
.ai-panel .ai-head {
    display: flex; justify-content: space-between; align-items: center;
    gap: 8px; flex-wrap: wrap; margin-bottom: 8px;
}
.ai-panel .ai-badge { font-size: 11.5px; font-weight: 700; color: var(--cm-blue-dark); }
.ai-panel .ai-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ai-panel .ai-loading { color: var(--cm-muted); font-size: 12.5px; }
.ai-panel .ai-err { color: var(--cm-red); font-size: 12.5px; font-weight: 600; }
.ai-md { font-size: 13px; line-height: 1.55; }
.ai-md > :first-child { margin-top: 0; }
.ai-md > :last-child { margin-bottom: 0; }
.ai-md h4 { font-size: 14px; font-weight: 700; margin: 13px 0 5px; color: var(--cm-blue-dark); }
.ai-md h5 { font-size: 12.5px; font-weight: 700; margin: 11px 0 4px; color: var(--cm-ink); }
.ai-md p { margin: 6px 0; }
.ai-md ul { margin: 6px 0; padding-left: 20px; }
.ai-md li { margin: 3px 0; }
.ai-md hr { border: none; border-top: 1px solid var(--cm-border); margin: 12px 0; }
.ai-md strong { font-weight: 700; color: var(--cm-ink); }

/* ── Kliklənən cədvəl sətri + açılan panel (ChefMeat əlavəsi) ──────────── */
tr.row-link { cursor: pointer; }
.collapse-box { display: none; }
.collapse-box.open { display: block; }
tr.collapse-box.open { display: table-row; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--cm-border);
        background: var(--cm-card); color: var(--cm-ink); font-size: .75rem; font-weight: 700; }
.chip:hover { border-color: var(--cm-blue); color: var(--cm-blue); }
.chip.active { background: var(--cm-blue); border-color: var(--cm-blue); color: #fff; }
.ok-text { color: var(--cm-green); font-weight: 700; }
.warn-text { color: var(--cm-red); font-weight: 700; }
.pager { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
/* Checkbox/radio qlobal input eninə tabe olmasın */
input[type="checkbox"], input[type="radio"] {
    width: 15px; height: 15px; padding: 0; margin: 0 6px 0 0;
    vertical-align: middle; accent-color: var(--cm-blue); display: inline-block;
}
input[type="file"] { padding: 6px 9px; }
