/* ==============================================
   CentralDev.az — İdarəetmə Paneli
   Professional Design System v2
   ============================================== */

:root {
    --primary: #1e3a5f;
    --primary-dark: #142943;
    --primary-light: #2d5586;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-soft: #eff6ff;

    --success: #16a34a;
    --success-soft: #f0fdf4;
    --warning: #d97706;
    --warning-soft: #fffbeb;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --neutral: #475569;

    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface-alt: #f8fafc;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    --text: #0f172a;
    --text-soft: #475569;
    --text-mute: #94a3b8;

    --r-sm: 6px;
    --r: 10px;
    --r-lg: 14px;
    --r-xl: 20px;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow: 0 2px 8px rgba(15, 23, 42, .07);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, .10);
    --shadow-lg: 0 20px 50px rgba(15, 23, 42, .18);

    --sidebar-w: 264px;
    --topbar-h: 58px;

    --t: .18s cubic-bezier(.4,0,.2,1);
}

/* === DARK MODE === */
[data-theme="dark"] {
    --primary: #93c5fd;
    --primary-dark: #0f172a;
    --primary-light: #60a5fa;
    --accent: #60a5fa;
    --accent-hover: #3b82f6;
    --accent-soft: rgba(59, 130, 246, .15);

    --success: #4ade80;
    --success-soft: rgba(74, 222, 128, .12);
    --warning: #fbbf24;
    --warning-soft: rgba(251, 191, 36, .12);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, .12);
    --neutral: #94a3b8;

    --bg: #0f172a;
    --surface: #1e293b;
    --surface-alt: #1a2332;
    --border: #334155;
    --border-strong: #475569;

    --text: #e2e8f0;
    --text-soft: #94a3b8;
    --text-mute: #64748b;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .2);
    --shadow: 0 2px 8px rgba(0, 0, 0, .3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, .4);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, .5);
}
[data-theme="dark"] .sidebar {
    background: #0b1526;
}
[data-theme="dark"] .login-showcase {
    background: radial-gradient(ellipse at top left, #0b1526 0%, #020617 70%);
}
[data-theme="dark"] .login-form-panel {
    background: #1e293b;
}
[data-theme="dark"] .login-form-box h2 { color: #e2e8f0; }
[data-theme="dark"] .login-form-sub { color: #94a3b8; }
[data-theme="dark"] .pm-amount { color: var(--success); }
[data-theme="dark"] .pm-summary { background: rgba(74, 222, 128, .1); color: #4ade80; }
[data-theme="dark"] .info-box { background: rgba(59, 130, 246, .1); border-left-color: var(--accent); }
[data-theme="dark"] .info-box h4 { color: #93c5fd; }
[data-theme="dark"] .info-box p { color: #94a3b8; }
[data-theme="dark"] .donut-center { background: var(--surface); }
[data-theme="dark"] .qalan.ok { color: #4ade80; background: rgba(74,222,128,.15); }
[data-theme="dark"] .qalan.warn { color: #fbbf24; background: rgba(251,191,36,.15); }
[data-theme="dark"] .qalan.expired { color: #f87171; background: rgba(248,113,113,.15); }

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* === BRAND MARK (paylaşılan) === */
.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: var(--r-sm);
    background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(37, 99, 235, .25);
}
.brand-mark-lg { width: 52px; height: 52px; font-size: 24px; border-radius: var(--r); }

/* ================================================
   LOGIN SƏHİFƏSI — Professional split layout
   ================================================ */
body.login-page {
    background: var(--primary-dark);
    min-height: 100vh;
    display: flex;
}
.login-shell {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sol panel — brendinq showcase */
.login-showcase {
    flex: 1.1;
    position: relative;
    background: radial-gradient(ellipse at top left, #1e3a5f 0%, #0b1526 70%);
    color: #fff;
    padding: 64px 64px;
    display: flex;
    align-items: center;
    overflow: hidden;
}
.login-showcase-content { position: relative; z-index: 2; max-width: 480px; }
.login-showcase-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 56px;
}
.login-showcase-name { font-size: 19px; font-weight: 800; letter-spacing: .2px; }
.login-showcase h1 {
    font-size: 38px;
    font-weight: 800;
    line-height: 1.2;
    margin: 0 0 18px;
    letter-spacing: -0.5px;
}
.login-showcase p {
    font-size: 15px;
    line-height: 1.65;
    color: #b8c4d9;
    margin: 0 0 40px;
}
.login-showcase-features { display: flex; flex-direction: column; gap: 16px; }
.login-showcase-feature {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
    color: #dbe4f3;
    font-weight: 500;
}
.login-showcase-feature i {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.1);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    color: #7ea6ff;
    flex-shrink: 0;
}
.login-showcase-glow {
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(37,99,235,.25) 0%, transparent 70%);
    top: -200px; right: -200px;
    border-radius: 50%;
    z-index: 1;
}

/* Sağ panel — form */
.login-form-panel {
    flex: 1;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
}
.login-form-box { width: 100%; max-width: 380px; }
.login-form-mobile-brand {
    display: none;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    font-weight: 800;
    font-size: 17px;
    color: var(--primary);
}
.login-form-box h2 {
    font-size: 26px;
    font-weight: 800;
    margin: 0 0 6px;
    color: var(--text);
    letter-spacing: -0.3px;
}
.login-form-sub { color: var(--text-soft); font-size: 14px; margin: 0 0 28px; }

.alert-error {
    background: var(--danger-soft);
    color: #991b1b;
    padding: 12px 14px;
    border-radius: var(--r-sm);
    margin-bottom: 20px;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid #fecaca;
}
.alert-error i { font-size: 16px; flex-shrink: 0; }

.login-form { display: flex; flex-direction: column; gap: 18px; }
.input-group label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 7px;
    color: var(--text);
}
.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}
.input-with-icon > i:first-child {
    position: absolute;
    left: 14px;
    color: var(--text-mute);
    font-size: 16px;
    pointer-events: none;
}
.input-with-icon input {
    width: 100%;
    padding: 13px 14px 13px 42px;
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    font-size: 14.5px;
    font-family: inherit;
    background: var(--surface-alt);
    transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
.input-with-icon input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .1);
}
.pw-toggle {
    position: absolute;
    right: 6px;
    background: none;
    border: none;
    color: var(--text-mute);
    cursor: pointer;
    padding: 8px;
    font-size: 16px;
    border-radius: 6px;
    display: flex;
}
.pw-toggle:hover { color: var(--text-soft); background: var(--border); }

.login-form-foot {
    margin-top: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-mute);
}

@media (max-width: 900px) {
    .login-showcase { display: none; }
    .login-form-mobile-brand { display: flex; }
    .login-form-panel { padding: 24px 20px; }
}

/* ================================================
   APP LAYOUT — Topbar + Burger Sidebar
   ================================================ */
body.app-body { display: flex; min-height: 100vh; }

/* Top bar — həmişə görünür */
.mobile-topbar {
    display: flex;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    align-items: center;
    padding: 0 16px;
    z-index: 60;
    box-shadow: var(--shadow-sm);
}
.hamburger-btn {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text);
    cursor: pointer;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    display: flex;
    transition: background var(--t);
}
.hamburger-btn:hover { background: var(--surface-alt); }
.mobile-topbar-brand {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 800;
    font-size: 15.5px;
    color: var(--primary);
}
.mobile-topbar-brand .brand-mark { width: 30px; height: 30px; font-size: 14px; }
.mobile-topbar-spacer { width: 40px; }

/* Overlay — sidebar açıldıqda arxa fon */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    backdrop-filter: blur(2px);
    z-index: 69;
    opacity: 0;
    transition: opacity var(--t);
}
.sidebar-overlay.open { display: block; opacity: 1; }

/* === SIDEBAR — default gizli, burger ilə açılır === */
.sidebar {
    width: 280px;
    max-width: 85vw;
    background: var(--primary-dark);
    color: #fff;
    height: 100vh;
    position: fixed;
    top: 0; left: 0;
    display: flex;
    flex-direction: column;
    z-index: 70;
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    transition: transform .22s cubic-bezier(.4,0,.2,1);
}
.sidebar.open { transform: translateX(0); }
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand-text { flex: 1; min-width: 0; }
.sidebar-brand-name { font-size: 15px; font-weight: 800; color: #fff; letter-spacing: .1px; }
.sidebar-brand-sub { font-size: 11px; color: #8ca0c2; margin-top: 1px; }
.sidebar-close-btn {
    display: flex;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--r-sm);
    transition: background var(--t), color var(--t);
}
.sidebar-close-btn:hover { background: rgba(255,255,255,.08); color: #fff; }

.sidebar-nav {
    flex: 1;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow-y: auto;
}
.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 11px 14px;
    border-radius: var(--r-sm);
    color: #b3c2dc;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background var(--t), color var(--t);
}
.sidebar-nav-item i { font-size: 17px; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav-item.active {
    background: linear-gradient(135deg, var(--accent) 0%, #1d4ed8 100%);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(37, 99, 235, .35);
}

.sidebar-foot {
    padding: 14px 12px;
    border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 6px 14px;
}
.sidebar-user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, var(--primary-light) 100%);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
    text-transform: uppercase;
}
.sidebar-user-info { min-width: 0; }
.sidebar-user-name { font-size: 13.5px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: #8ca0c2; margin-top: 1px; }
.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--r-sm);
    color: #fca5a5;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    background: rgba(220, 38, 38, .1);
    transition: background var(--t);
}
.sidebar-logout i { font-size: 16px; }
.sidebar-logout:hover { background: rgba(220, 38, 38, .2); }

/* === MAIN CONTENT === */
.main-content {
    margin-left: 0;
    padding: 32px;
    padding-top: calc(var(--topbar-h) + 28px);
    width: 100%;
    box-sizing: border-box;
    min-height: 100vh;
}

.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 14px;
}
.header-actions h2 {
    margin: 0;
    color: var(--text);
    font-size: 23px;
    font-weight: 800;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.header-actions h2 i { color: var(--accent); }
.header-btns { display: flex; gap: 10px; flex-wrap: wrap; }

/* === DÜYMƏLƏR === */
.btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 10px 18px;
    cursor: pointer;
    font-weight: 600;
    border-radius: var(--r-sm);
    font-size: 13.5px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all var(--t);
    text-decoration: none;
    font-family: inherit;
    box-shadow: var(--shadow-sm);
}
.btn i { font-size: 15px; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); filter: brightness(1.05); }
.btn:active { transform: translateY(0); }
.btn-success { background: var(--success); }
.btn-warning { background: var(--warning); }
.btn-danger  { background: var(--danger); }
.btn-neutral { background: var(--neutral); }
.btn-primary { background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%); }
.btn-block { width: 100%; justify-content: center; }
.btn-lg { padding: 13px 20px; font-size: 14.5px; }

.icon-btn {
    width: 32px; height: 32px;
    border: none;
    border-radius: var(--r-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all var(--t);
    margin-right: 4px;
}
.icon-btn:last-child { margin-right: 0; }
.icon-btn:hover { transform: translateY(-1px); }
.edit-btn { background: var(--warning-soft); color: var(--warning); }
.edit-btn:hover { background: var(--warning); color: #fff; }
.delete-btn-sm { background: var(--danger-soft); color: var(--danger); }
.delete-btn-sm:hover { background: var(--danger); color: #fff; }

.wa-btn {
    background: #25D366;
    color: #fff;
    padding: 3px 8px;
    text-decoration: none;
    border-radius: 5px;
    font-size: 10.5px;
    margin-left: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
}

/* === CƏDVƏL === */
.table-wrap {
    overflow-x: auto;
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    position: relative;
}
table {
    width: 100%;
    min-width: 900px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13.5px;
}
table th {
    background: var(--surface-alt);
    color: var(--text-soft);
    padding: 13px 12px;
    text-align: center;
    font-weight: 700;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .4px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    text-align: center;
    vertical-align: middle;
}
table tr:last-child td { border-bottom: none; }
table tr:hover td { background: var(--surface-alt); }
.txt-left { text-align: left !important; }
.small { font-size: 11.5px; color: var(--text-mute); }
.empty { padding: 48px !important; color: var(--text-mute); }
.empty i { display: block; font-size: 36px; margin-bottom: 10px; color: var(--border-strong); }

.table-logo {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    display: inline-block;
}
.table-logo-empty {
    background: var(--surface-alt);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: var(--text-mute);
    border: 2px dashed var(--border-strong);
}
.qalan { font-weight: 700; font-size: 12px; padding: 4px 10px; border-radius: 100px; display: inline-block; }
.qalan.ok { color: var(--success); background: var(--success-soft); }
.qalan.warn { color: var(--warning); background: var(--warning-soft); }
.qalan.expired { color: var(--danger); background: var(--danger-soft); }
.actions { white-space: nowrap; }

/* Sticky əməllər sütunu — həmişə görünsün */
th.sticky-right,
td.sticky-right {
    position: sticky;
    right: 0;
    z-index: 2;
}
th.sticky-right {
    background: var(--surface-alt);
    box-shadow: -4px 0 8px rgba(15, 23, 42, .06);
}
td.sticky-right {
    background: var(--surface);
    box-shadow: -4px 0 8px rgba(15, 23, 42, .06);
}
table tr:hover td.sticky-right { background: var(--surface-alt); }
[data-theme="dark"] th.sticky-right { box-shadow: -4px 0 8px rgba(0, 0, 0, .25); }
[data-theme="dark"] td.sticky-right { box-shadow: -4px 0 8px rgba(0, 0, 0, .25); }

.badge-super {
    background: var(--warning-soft);
    color: var(--warning);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 100px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* === MODAL === */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(2px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}
.modal.open { display: flex; }
.modal-content {
    background: var(--surface);
    padding: 26px;
    border-radius: var(--r-lg);
    width: 480px;
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn .2s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 14px;
    margin-bottom: 20px;
}
.modal-header h3 {
    margin: 0;
    color: var(--text);
    font-size: 17px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 9px;
}
.modal-header h3 i { color: var(--accent); }
.close-btn {
    cursor: pointer;
    color: var(--text-mute);
    font-weight: bold;
    font-size: 18px;
    line-height: 1;
    background: var(--surface-alt);
    border: none;
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.close-btn:hover { background: var(--danger-soft); color: var(--danger); }

/* === FORM === */
.form-group { margin-bottom: 15px; }
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text);
}
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid var(--border);
    box-sizing: border-box;
    border-radius: var(--r-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--surface-alt);
    transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .1);
}
.form-group input[type="file"] { padding: 8px; background: var(--surface); cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { margin-top: 20px; }
.hint { color: var(--text-mute); font-weight: normal; font-size: 11.5px; }
.error-msg {
    background: var(--danger-soft);
    color: #991b1b;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    margin-bottom: 14px;
    font-size: 13.5px;
}

/* === STATİSTİKA (dashboard.php) === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr) 2fr;
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
}
.stat-icon {
    width: 46px; height: 46px;
    border-radius: var(--r);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.stat-icon-primary { background: var(--accent-soft); color: var(--accent); }
.stat-icon-warn    { background: var(--warning-soft); color: var(--warning); }
.stat-icon-success { background: var(--success-soft); color: var(--success); }
.stat-icon-neutral { background: var(--surface-alt); color: var(--neutral); }
.stat-info { min-width: 0; }
.stat-value { font-size: 20px; font-weight: 800; color: var(--text); line-height: 1.2; white-space: nowrap; }
.stat-label { font-size: 11.5px; color: var(--text-mute); margin-top: 2px; }

.stat-card-chart { grid-column: span 2; gap: 18px; }
.donut-chart {
    width: 92px; height: 92px;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
}
.donut-center {
    position: absolute;
    inset: 13px;
    background: var(--surface);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.donut-center span { font-size: 19px; font-weight: 800; color: var(--text); line-height: 1; }
.donut-center small { font-size: 9.5px; color: var(--text-mute); margin-top: 3px; }
.donut-legend { display: flex; flex-direction: column; gap: 7px; font-size: 12px; color: var(--text-soft); }
.donut-legend div { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex-shrink: 0; }

@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-card-chart { grid-column: span 2; }
}
@media (max-width: 640px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-card-chart { grid-column: span 1; }
}

/* === AXTARIŞ / FILTER TOOLBAR === */
.table-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.table-search {
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
    gap: 9px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    padding: 9px 14px;
    transition: border-color var(--t), box-shadow var(--t);
}
.table-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(37, 99, 235, .1); }
.table-search i { color: var(--text-mute); font-size: 15px; }
.table-search input { border: none; outline: none; background: transparent; font-size: 13.5px; flex: 1; font-family: inherit; color: var(--text); }
.table-toolbar select {
    padding: 9px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    font-size: 13px;
    background: var(--surface);
    font-family: inherit;
    color: var(--text);
    cursor: pointer;
}
.table-result-count { font-size: 12.5px; color: var(--text-mute); white-space: nowrap; font-weight: 500; }
.table-result-count span { font-weight: 700; color: var(--text); }

/* Sıralana bilən sütun başlıqları */
table th[data-sort] { cursor: pointer; user-select: none; transition: color var(--t); }
table th[data-sort]:hover { color: var(--accent); }
.sort-icon { font-size: 10px; margin-left: 4px; opacity: .35; }
table th.sort-asc .sort-icon, table th.sort-desc .sort-icon { opacity: 1; color: var(--accent); }

/* === ÖDƏNİŞLƏR MODAL === */
.payments-btn { background: var(--success-soft); color: var(--success); }
.payments-btn:hover { background: var(--success); color: #fff; }

.pm-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}
.pm-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pm-form input {
    padding: 10px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    font-size: 13.5px;
    font-family: inherit;
    background: var(--surface-alt);
    transition: border-color var(--t), background var(--t);
}
.pm-form input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px rgba(37, 99, 235, .1); }

.pm-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--success-soft);
    border-radius: var(--r-sm);
    margin-bottom: 14px;
    font-size: 13.5px;
    color: #166534;
    font-weight: 600;
}
.pm-summary b { font-size: 17px; }

.payments-list { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.pm-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    background: var(--surface-alt);
    border-radius: var(--r-sm);
    font-size: 13px;
    border: 1px solid var(--border);
}
.pm-row-date { color: var(--text-soft); display: flex; align-items: center; gap: 6px; white-space: nowrap; font-weight: 500; }
.pm-row-amount { font-weight: 700; color: var(--success); white-space: nowrap; }
.pm-row-note { flex: 1; color: var(--text-mute); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pm-row-del { background: none; border: none; color: var(--danger); cursor: pointer; padding: 5px 8px; border-radius: 6px; flex-shrink: 0; transition: background var(--t); }
.pm-row-del:hover { background: var(--danger-soft); }
.pm-empty, .pm-loading { text-align: center; padding: 28px; color: var(--text-mute); font-size: 13px; }
.pm-empty i { display: block; font-size: 30px; margin-bottom: 8px; color: var(--border-strong); }

@media (max-width: 480px) {
    .pm-form-row { grid-template-columns: 1fr; }
    .pm-row { flex-wrap: wrap; }
    .pm-row-note { width: 100%; order: 3; white-space: normal; }
}

/* === SETTINGS === */
.settings-card {
    background: var(--surface);
    padding: 28px;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    max-width: 600px;
}
.settings-result {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: var(--r-sm);
    font-size: 13.5px;
    display: none;
    align-items: center;
    gap: 8px;
    white-space: pre-line;
    line-height: 1.5;
}
.settings-result.ok { background: var(--success-soft); color: #166534; display: flex; }
.settings-result.err { background: var(--danger-soft); color: #991b1b; display: flex; }
.info-box {
    background: var(--accent-soft);
    border-left: 4px solid var(--accent);
    padding: 16px 20px;
    border-radius: var(--r-sm);
    margin-top: 22px;
    max-width: 600px;
    display: flex;
    gap: 14px;
}
.info-box i { font-size: 20px; color: var(--accent); flex-shrink: 0; margin-top: 2px; }
.info-box h4 { margin: 0 0 6px; color: #1e40af; font-size: 14px; font-weight: 700; }
.info-box p { margin: 0; font-size: 13px; color: #1e3a8a; line-height: 1.55; }

/* === ÖDƏNİŞ TARİXÇƏSİ SƏHİFƏSİ (payments.php) === */
.pm-stats-grid { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1200px) { .pm-stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .pm-stats-grid { grid-template-columns: 1fr; } }

.pm-chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 22px 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}
.pm-chart-card h4 {
    margin: 0 0 18px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.pm-chart-card h4 i { color: var(--accent); }

.pm-chart {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    height: 160px;
    padding: 0 8px;
}
.pm-chart-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.pm-chart-value {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-soft);
    white-space: nowrap;
}
.pm-chart-bar-bg {
    width: 100%;
    max-width: 56px;
    height: 110px;
    background: var(--surface-alt);
    border-radius: var(--r-sm) var(--r-sm) 0 0;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    border-bottom: none;
    display: flex;
    align-items: flex-end;
}
.pm-chart-bar-fill {
    width: 100%;
    background: linear-gradient(180deg, var(--accent) 0%, #3b82f6 100%);
    border-radius: var(--r-sm) var(--r-sm) 0 0;
    transition: height .4s ease;
    min-height: 4px;
}
.pm-chart-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-mute);
    white-space: nowrap;
}

.pm-obyekt-cell {
    display: flex;
    align-items: center;
    gap: 9px;
}
.pm-mini-logo {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--border);
    flex-shrink: 0;
}
.pm-mini-logo-empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-alt);
    color: var(--text-mute);
    font-size: 12px;
    border: 1.5px dashed var(--border-strong);
}

.pm-amount {
    font-weight: 700;
    color: var(--success);
}

.pm-page-total {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding: 14px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    font-size: 14px;
    color: var(--text-soft);
    box-shadow: var(--shadow-sm);
}
.pm-page-total b {
    font-size: 18px;
    color: var(--success);
}

/* === GECİKMİŞ ÖDƏNİŞLƏR (overdue.php) === */
.overdue-empty {
    text-align: center;
    padding: 56px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
}
.overdue-empty h3 { margin: 0 0 6px; font-size: 18px; font-weight: 700; color: var(--text); }
.overdue-empty p { margin: 0; color: var(--text-mute); font-size: 14px; }

/* === ƏMƏLİYYAT JURNALI (audit.php) === */
.audit-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
}
.audit-badge i { font-size: 12px; }

/* === MÜQAVİLƏ DÜYMƏSİ (dashboard.php) === */
.contract-btn { background: var(--accent-soft); color: var(--accent); }
.contract-btn:hover { background: var(--accent); color: #fff; }

/* === ANALİTİKA — Horizontal bars (analytics.php) === */
.horizontal-bars { display: flex; flex-direction: column; gap: 12px; }
.h-bar-row { display: flex; align-items: center; gap: 14px; }
.h-bar-label { width: 140px; font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.h-bar-track { flex: 1; height: 24px; background: var(--surface-alt); border-radius: 100px; overflow: hidden; border: 1px solid var(--border); }
.h-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent) 0%, #3b82f6 100%); border-radius: 100px; transition: width .4s ease; min-width: 8px; }
.h-bar-value { font-size: 12.5px; font-weight: 700; color: var(--success); white-space: nowrap; min-width: 80px; text-align: right; }

/* === BİLDİRİŞ BANNERİ (dashboard.php) === */
.notif-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 20px;
    border-radius: var(--r);
    margin-bottom: 20px;
    animation: slideDown .3s ease;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.notif-danger {
    background: var(--danger-soft);
    border: 1px solid rgba(220, 38, 38, .2);
}
.notif-banner-body {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--danger);
}
.notif-banner-body i { font-size: 18px; }
.notif-banner-actions { display: flex; align-items: center; gap: 8px; }
.notif-close {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--r-sm);
    font-size: 16px;
    display: flex;
    opacity: .6;
}
.notif-close:hover { opacity: 1; background: rgba(220, 38, 38, .1); }

/* === QEYDLƏR (dashboard.php notes modal) === */
.notes-btn { background: #f0f4ff; color: #4338ca; }
.notes-btn:hover { background: #4338ca; color: #fff; }

.notes-list { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; margin-top: 14px; }
.note-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 13px;
    background: var(--surface-alt);
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    font-size: 13px;
    transition: opacity var(--t);
}
.note-row.done { opacity: .5; }
.note-row.done .note-text { text-decoration: line-through; }
.note-check {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-strong);
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--surface);
    color: transparent;
    font-size: 12px;
    transition: all var(--t);
    margin-top: 1px;
}
.note-check:hover { border-color: var(--accent); }
.note-row.done .note-check { background: var(--success); border-color: var(--success); color: #fff; }
.note-body { flex: 1; min-width: 0; }
.note-text { line-height: 1.45; color: var(--text); word-break: break-word; }
.note-meta { font-size: 11px; color: var(--text-mute); margin-top: 4px; display: flex; gap: 8px; }
.note-del { background: none; border: none; color: var(--danger); cursor: pointer; padding: 4px 6px; border-radius: 4px; flex-shrink: 0; font-size: 13px; opacity: .5; }
.note-del:hover { opacity: 1; background: var(--danger-soft); }

/* === PROFİL (profile.php) === */
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .profile-grid { grid-template-columns: 1fr; } }
.profile-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.profile-section-title i { color: var(--accent); }
.profile-alert {
    padding: 12px 16px;
    border-radius: var(--r-sm);
    margin-bottom: 20px;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}
.profile-alert-ok { background: var(--success-soft); color: #166534; border: 1px solid rgba(22,163,74,.2); }
.profile-alert-err { background: var(--danger-soft); color: #991b1b; border: 1px solid rgba(220,38,38,.2); }

/* === SIDEBAR THEME TOGGLE + PROFİL LİNK === */
.sidebar-theme-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    border-radius: var(--r-sm);
    color: #b3c2dc;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.06);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    margin-bottom: 10px;
    transition: background var(--t);
    width: 100%;
    text-align: left;
}
.sidebar-theme-toggle i { font-size: 16px; }
.sidebar-theme-toggle:hover { background: rgba(255,255,255,.08); color: #fff; }

.sidebar-profile-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 6px 14px;
    text-decoration: none;
    border-radius: var(--r-sm);
    transition: background var(--t);
}
.sidebar-profile-link:hover { background: rgba(255,255,255,.06); }

/* === EXPORT DROPDOWN (analytics.php) === */
.export-dropdown { position: relative; }
.export-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--shadow-md);
    min-width: 200px;
    z-index: 50;
    overflow: hidden;
}
.export-menu.open { display: block; }
.export-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    transition: background var(--t);
}
.export-item i { font-size: 16px; color: var(--accent); }
.export-item:hover { background: var(--surface-alt); }

/* ================================================
   RESPONSIVE — Tablet (≤900px)
   ================================================ */
@media (max-width: 900px) {
    .main-content { padding: 20px 16px; padding-top: calc(var(--topbar-h) + 20px); }

    .header-actions { flex-direction: column; align-items: stretch; }
    .header-actions h2 { font-size: 19px; }
    .header-btns { width: 100%; }
    .header-btns .btn { flex: 1; justify-content: center; }

    .form-row { grid-template-columns: 1fr; }
    table { font-size: 12.5px; }
    table th, table td { padding: 9px 8px; }

    /* Bildiriş banneri — mobil */
    .notif-banner { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 14px; }
    .notif-banner-body { font-size: 12.5px; }
    .notif-banner-actions { justify-content: space-between; }

    /* Statistika kartları — mobil */
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .stat-card-chart { grid-column: span 2; }

    /* Analitika horizontal bars — mobil */
    .h-bar-row { flex-wrap: wrap; gap: 6px; }
    .h-bar-label { width: 100%; font-size: 12.5px; }
    .h-bar-track { height: 20px; }
    .h-bar-value { min-width: auto; }

    /* Audit filters — mobil */
    .table-toolbar form { flex-direction: column; }
    .table-toolbar select,
    .table-toolbar input[type="date"] { width: 100%; }

    /* Cədvəl kaydırma — mobil */
    .table-wrap { -webkit-overflow-scrolling: touch; }

    /* Profil — mobil */
    .profile-grid { grid-template-columns: 1fr; }
    .settings-card { max-width: 100%; }

    /* Ödəniş total — mobil */
    .pm-page-total { flex-direction: column; gap: 4px; text-align: center; }

    /* Chart — mobil */
    .pm-chart { gap: 8px; overflow-x: auto; min-width: 0; }
    .pm-chart-bar-group { min-width: 44px; }
    .pm-chart-value { font-size: 9.5px; }
    .pm-chart-label { font-size: 9.5px; }

    /* Export dropdown — mobil */
    .export-dropdown { position: static; }
    .export-menu { position: fixed; top: auto; bottom: 0; left: 0; right: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; z-index: 100; margin-top: 0; }
}

/* ================================================
   RESPONSIVE — Mobil kiçik (≤480px)
   ================================================ */
@media (max-width: 480px) {
    .main-content { padding: 16px 12px; padding-top: calc(var(--topbar-h) + 16px); }
    .modal { padding: 12px; }
    .modal-content { padding: 18px 14px; }

    .stats-grid { grid-template-columns: 1fr !important; }
    .stat-card-chart { grid-column: span 1; }
    .stat-card { padding: 14px; gap: 10px; }
    .stat-value { font-size: 17px; }
    .stat-icon { width: 40px; height: 40px; font-size: 17px; }

    .header-actions h2 { font-size: 17px; gap: 8px; }
    .header-actions h2 i { font-size: 18px; }

    table { font-size: 11.5px; }
    table th, table td { padding: 8px 6px; }
    table th { font-size: 10px; }
    .table-logo { width: 30px; height: 30px; }
    .icon-btn { width: 28px; height: 28px; font-size: 12px; margin-right: 2px; }
    .wa-btn { display: none; }

    .pm-form-row { grid-template-columns: 1fr; }
    .pm-row { flex-wrap: wrap; }
    .pm-row-note { width: 100%; order: 3; white-space: normal; }

    .pm-chart { height: 130px !important; }
    .pm-chart-bar-bg { height: 90px !important; }

    .pm-obyekt-cell { gap: 6px; }
    .pm-mini-logo { width: 24px; height: 24px; }

    /* Qeydlər modal — mobil */
    .notes-list { max-height: 240px; }
    .note-meta { flex-direction: column; gap: 2px; }

    /* Profil — mobil */
    .profile-section-title { font-size: 14px; }

    /* Bildiriş banneri — mobil kiçik */
    .notif-banner-body span b { display: block; font-size: 16px; }
    .notif-banner-body { flex-direction: column; gap: 4px; text-align: center; }
    .notif-banner-actions { justify-content: center; }

    /* Donut chart — mobil */
    .donut-chart { width: 72px; height: 72px; }
    .donut-center span { font-size: 15px; }
    .donut-center small { font-size: 8px; }
    .donut-legend { font-size: 11px; }

    /* Info box — mobil */
    .info-box { flex-direction: column; gap: 8px; padding: 14px 16px; }
}

/* ================================================
   MOBİL CƏDVƏL → KART REJİMİ (≤768px)
   13 sütunlu cədvəl telefonda oxunmur; hər sətir
   ayrıca karta çevrilir, başlıqlar data-label-dən gəlir.
   Sətirlər <tr> olaraq qalır — axtarış/sıralama JS-i işləməyə davam edir.
   ================================================ */
@media (max-width: 768px) {
    .table-wrap {
        overflow: visible;
        background: transparent;
        border: 0;
        box-shadow: none;
        border-radius: 0;
    }
    table {
        display: block;
        width: 100%;
        min-width: 0;          /* 900px məcburiyyətini ləğv et */
        font-size: 13px;
    }
    table thead { display: none; }
    table tbody { display: block; }

    table tr {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--r-lg);
        box-shadow: var(--shadow-sm);
        margin-bottom: 12px;
        padding: 13px 14px;
    }
    table tr:last-child { margin-bottom: 0; }
    table tr:hover td { background: transparent; }

    /* Adi sətir: solda etiket, sağda dəyər */
    table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        width: 100%;
        order: 5;
        padding: 9px 0;
        text-align: right;
        border-bottom: none;
        border-top: 1px dashed var(--border);
    }
    table td::before {
        content: attr(data-label);
        flex: 0 0 40%;
        text-align: left;
        font-size: 10.5px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .4px;
        color: var(--text-mute);
        line-height: 1.35;
    }
    table td[data-label=""]::before { content: none; }

    /* === Kart başlığı: № + logo + ad bir sətirdə === */
    table td.cell-no,
    table td.cell-logo,
    table td.cell-title {
        width: auto;
        padding: 0;
        border-top: none;
        text-align: left !important;
    }
    table td.cell-no::before,
    table td.cell-logo::before,
    table td.cell-title::before { content: none; }

    table td.cell-no {
        order: 1;
        flex: 0 0 auto;
        margin-right: 9px;
        font-size: 11px;
        font-weight: 700;
        color: var(--text-mute);
    }
    table td.cell-logo { order: 2; flex: 0 0 auto; margin-right: 10px; }
    table td.cell-title {
        order: 3;
        flex: 1 1 auto;
        min-width: 0;
        font-size: 14.5px;
        font-weight: 700;
        line-height: 1.3;
    }
    table td.cell-title b { font-weight: 700; }

    /* "Qalan" xanası masaüstündə pill-dir; kartda sətri tam doldurmasın —
       yalnız mətn rəngi qalsın, fon/radius götürülsün */
    table td.qalan {
        background: transparent !important;
        border-radius: 0;
        padding: 9px 0;
        font-weight: 700;
        font-size: 13px;
    }

    /* Uzun mətn (audit "Məlumat") — inline style-ı üstələyir */
    table td.cell-wide {
        white-space: normal !important;
        max-width: none !important;
        text-overflow: clip !important;
        align-items: flex-start;
    }
    table td.cell-wide::before { padding-top: 1px; }

    /* Əməllər — kartın altında tam en */
    table td.actions {
        order: 90;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 8px;
        white-space: normal;
        padding: 12px 0 0;
        margin-top: 4px;
        border-top: 1px solid var(--border);
    }
    table td.actions::before { content: none; }
    table td.actions .icon-btn { width: 38px; height: 38px; font-size: 15px; margin: 0; }
    table td.actions .btn { flex: 1; justify-content: center; }

    /* Sticky sütun kart rejimində lazım deyil */
    th.sticky-right, td.sticky-right {
        position: static;
        box-shadow: none;
        background: transparent;
    }

    /* Boş vəziyyət */
    table tr:has(td.empty) { display: block; padding: 0; }
    td.empty {
        display: block;
        width: 100%;
        text-align: center;
        border: none;
        padding: 40px 16px !important;
    }
    td.empty::before { content: none; }

    /* WhatsApp düyməsi kart rejimində yer tapır */
    .wa-btn { display: inline-flex !important; }

    /* === Mobil sıralama paneli === */
    .table-toolbar .mobile-sort { display: flex; }
}

/* Mobil sıralama paneli — yalnız kart rejimində görünür */
.mobile-sort { display: none; align-items: center; gap: 8px; width: 100%; }
.mobile-sort select {
    flex: 1;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    font-size: 13px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
}
.mobile-sort-dir {
    flex: 0 0 auto;
    width: 40px; height: 38px;
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--text-soft);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}
.mobile-sort-dir:hover { background: var(--surface-alt); }

/* ================================================
   KİÇİK TELEFON — statistika 2 sütun (uzun scroll olmasın)
   ================================================ */
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
    .stat-card { flex-direction: column; align-items: flex-start; gap: 8px; padding: 13px 12px; }
    .stat-card-chart { grid-column: span 2; flex-direction: row; align-items: center; }
    .stat-value { font-size: 15.5px; line-height: 1.2; word-break: break-word; }
    .stat-label { font-size: 11px; line-height: 1.3; }
    .stat-icon { width: 34px; height: 34px; font-size: 15px; }
}

/* ================================================
   XƏRCLƏR BÖLMƏSİ
   ================================================ */
/* Bu ay: gəlir − xərc = qalıq */
.xerc-balance {
    display: flex;
    align-items: stretch;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    padding: 16px 20px;
    margin-bottom: 22px;
}
.xerc-balance-item { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.xerc-balance-label { font-size: 12px; color: var(--text-mute); display: flex; align-items: center; gap: 6px; }
.xerc-balance-item b { font-size: 19px; letter-spacing: -.3px; }
.xerc-balance-sep {
    display: flex; align-items: center;
    font-size: 19px; font-weight: 700; color: var(--text-mute);
    flex: 0 0 auto;
}

/* Qoşa sütunlu qrafik (gəlir + xərc) */
/* Qoşa sütun: .pm-chart-bar-bg width:100% olduğu üçün valideynə en lazımdır,
   yoxsa sütunlar nazik xəttə yığılır */
.xerc-bar-pair {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    width: 100%;
    max-width: 72px;
}
.xerc-bar-pair > .pm-chart-bar-bg { flex: 1 1 0; width: auto; max-width: none; min-width: 0; }
.xerc-fill { background: linear-gradient(180deg, #f87171 0%, var(--danger) 100%) !important; }
.xerc-legend {
    display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
    margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border);
    font-size: 12px; color: var(--text-soft);
}
.xerc-legend span { display: inline-flex; align-items: center; gap: 6px; }
.xerc-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* Kateqoriya çipləri */
.xerc-kat-list { display: flex; flex-wrap: wrap; gap: 9px; }
.xerc-kat-chip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 7px 8px 7px 12px;
    border-radius: 100px;
    background: var(--surface-alt);
    border: 1.5px solid var(--kat-reng, var(--border));
    font-size: 13px; font-weight: 600;
    max-width: 100%;
}
.xerc-kat-chip > i:first-child { color: var(--kat-reng, var(--accent)); font-size: 14px; }
.xerc-kat-ad { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xerc-kat-say {
    background: var(--kat-reng, var(--accent)); color: #fff;
    font-size: 11px; font-weight: 700;
    min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 100px; display: inline-flex; align-items: center; justify-content: center;
}
.xerc-kat-btn {
    background: none; border: none; cursor: pointer;
    color: var(--text-mute); padding: 4px 5px; border-radius: 6px;
    font-size: 12px; display: inline-flex; align-items: center;
}
.xerc-kat-btn:hover { background: var(--surface); color: var(--text); }
.xerc-kat-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.xerc-kat-empty { color: var(--text-mute); font-size: 13px; margin: 0; }
.xerc-kat-add { padding: 6px 12px !important; font-size: 12px !important; margin-left: auto; }
.pm-chart-title { display: flex; align-items: center; gap: 8px; }

/* Cədvəldə kateqoriya nöqtəsi */
.xerc-kat-dot {
    width: 30px; height: 30px; border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-size: 14px;
}
.xerc-kat-name { display: none; }

/* Təkrar növü nişanı */
.xerc-tekrar {
    font-size: 11.5px; font-weight: 700;
    padding: 4px 10px; border-radius: 100px;
    display: inline-block; white-space: nowrap;
}
.xerc-tekrar-aylik      { background: var(--accent-soft);  color: var(--accent); }
.xerc-tekrar-illik      { background: var(--warning-soft); color: var(--warning); }
.xerc-tekrar-birdefelik { background: var(--surface-alt);  color: var(--text-soft); }

/* Dayandırılmış xərc sətri */
.xerc-passiv { opacity: .55; }
.xerc-passiv .cell-title b { text-decoration: line-through; }

/* Rəng / ikon seçiciləri */
.xerc-reng-list, .xerc-icon-list { display: flex; flex-wrap: wrap; gap: 8px; }
.xerc-reng {
    width: 30px; height: 30px; border-radius: 50%;
    border: 3px solid transparent; cursor: pointer; padding: 0;
    transition: transform .12s, border-color .12s;
}
.xerc-reng:hover { transform: scale(1.1); }
.xerc-reng.selected { border-color: var(--text); transform: scale(1.1); }
.xerc-icon {
    width: 36px; height: 36px; border-radius: var(--r-sm);
    border: 1.5px solid var(--border); background: var(--surface-alt);
    cursor: pointer; color: var(--text-soft); font-size: 15px;
    display: inline-flex; align-items: center; justify-content: center;
    transition: all .12s;
}
.xerc-icon:hover { border-color: var(--accent); color: var(--accent); }
.xerc-icon.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.xerc-aktiv-row { margin-top: 4px; }
.xerc-switch { display: flex !important; align-items: center; gap: 9px; cursor: pointer; font-weight: 500 !important; font-size: 13px !important; }
.xerc-switch input { width: 17px; height: 17px; cursor: pointer; accent-color: var(--accent); }

/* ================================================
   ƏMƏLLƏR — 3 NÖQTƏLİ MENYU
   Masaüstü: düymələr sırada (⋮ gizli).
   Mobil:    ⋮ görünür, düymələr açılan menyuda.
   ================================================ */
.act-trigger { display: none; }
.act-menu { display: inline-flex; align-items: center; }
.act-label { display: none; }

@media (max-width: 768px) {
    /* Kart rejimində əməllər sətri yox — kartın sağ yuxarısında ⋮ */
    table tr { position: relative; }
    table td.actions {
        position: absolute;
        top: 9px; right: 10px;
        width: auto;
        padding: 0;
        margin: 0;
        border: none;
        z-index: 5;
    }
    /* Başlıq ⋮ düyməsinin altına girməsin */
    table td.cell-title { padding-right: 38px; }

    .act-trigger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 34px; height: 34px;
        border: 1px solid var(--border);
        border-radius: 9px;
        background: var(--surface-alt);
        color: var(--text-soft);
        cursor: pointer;
        font-size: 16px;
    }
    .act-trigger:hover, td.actions.act-open .act-trigger {
        background: var(--accent-soft);
        color: var(--accent);
        border-color: var(--accent);
    }

    .act-menu {
        display: none;
        position: absolute;
        top: calc(100% + 6px);
        right: 0;
        min-width: 190px;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding: 6px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--r-lg);
        box-shadow: var(--shadow-lg);
        z-index: 40;
    }
    td.actions.act-open .act-menu { display: flex; }
    .act-menu.act-menu-up { top: auto; bottom: calc(100% + 6px); }

    /* Menyu içindəki düymələr — ikon + mətn, tam en */
    .act-menu .icon-btn,
    .act-menu .btn {
        width: 100% !important;
        height: auto !important;
        justify-content: flex-start !important;
        gap: 10px;
        margin: 0 !important;
        padding: 10px 12px !important;
        border-radius: var(--r-sm);
        font-size: 13.5px !important;
        font-weight: 600;
        background: transparent !important;
        flex: none !important;
    }
    .act-menu .icon-btn:hover, .act-menu .btn:hover {
        background: var(--surface-alt) !important;
        transform: none;
    }
    .act-menu .icon-btn i, .act-menu .btn i { font-size: 15px; width: 18px; text-align: center; flex: 0 0 auto; }
    .act-menu .delete-btn-sm { color: var(--danger) !important; }
    .act-menu .delete-btn-sm:hover { background: var(--danger-soft) !important; }
    .act-label { display: inline; white-space: nowrap; }

    /* Xərclər — mobil */
    .xerc-balance { flex-direction: column; gap: 8px; padding: 14px 16px; }
    .xerc-balance-sep { display: none; }
    .xerc-balance-item {
        flex-direction: row; align-items: center; justify-content: space-between;
        padding: 7px 0; border-bottom: 1px dashed var(--border);
    }
    .xerc-balance-item:last-child { border-bottom: none; }
    .xerc-balance-item b { font-size: 16px; }
    .xerc-kat-add { margin-left: 0; }
    .pm-chart-title { flex-wrap: wrap; }
    /* Kart rejimində kateqoriya adı da görünsün */
    table td.cell-logo .xerc-kat-name { display: inline; font-size: 13px; font-weight: 600; margin-left: 8px; }
    .xerc-bar-pair { gap: 2px; }
}

/* Növbəti ödəniş xanası */
.xerc-novbeti { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.xerc-novbeti-tarix { font-weight: 600; white-space: nowrap; }
@media (max-width: 768px) {
    .xerc-novbeti { justify-content: flex-end; }
    table td[data-label="Növbəti ödəniş"] { flex-wrap: wrap; text-align: right; }
    table td[data-label="Növbəti ödəniş"] .small { width: 100%; text-align: right; margin-top: 2px; }
}

/* === Bildiriş kanalları (settings.php) === */
.bot-channel-card { margin-bottom: 18px; }
.bot-channel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.bot-channel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15.5px;
    font-weight: 700;
    color: var(--text);
}
.bot-channel-title i { font-size: 19px; }
@media (max-width: 480px) {
    .bot-channel-head { flex-wrap: wrap; }
}
