/*
 * Goreel CRM — Crystal Design System
 * Apple Notes / Things / Linear inspired
 * Glassmorphism + soft pastels + airy spacing
 * v3.0
 */

/* ============================================================
   1. DESIGN TOKENS
   ============================================================ */
:root {
    /* Arkaplan — soft pastel gradient */
    --color-bg: #f7f7fb;
    --color-bg-gradient: radial-gradient(ellipse at top, #fef7ff 0%, #f0f4ff 35%, #f7f7fb 100%);
    --color-bg-elevated: #ffffff;
    --color-bg-glass: rgba(255, 255, 255, 0.65);
    --color-bg-glass-strong: rgba(255, 255, 255, 0.85);
    --color-bg-secondary: #fafbfc;
    --color-bg-tertiary: #f4f5f9;

    /* Overlay */
    --color-overlay-hover: rgba(0, 0, 0, 0.03);
    --color-overlay-active: rgba(0, 0, 0, 0.06);

    /* Border — çok hafif */
    --color-border: rgba(0, 0, 0, 0.06);
    --color-border-strong: rgba(0, 0, 0, 0.1);
    --color-divider: rgba(0, 0, 0, 0.04);
    --color-border-glass: rgba(255, 255, 255, 0.5);

    /* Metin */
    --color-text-primary: #0f172a;
    --color-text-secondary: #475569;
    --color-text-tertiary: #64748b;
    --color-text-quaternary: #94a3b8;
    --color-text-on-accent: #ffffff;

    /* Accent — softer indigo/violet */
    --color-accent: #6366f1;
    --color-accent-hover: #4f46e5;
    --color-accent-bg: rgba(99, 102, 241, 0.08);
    --color-accent-soft: rgba(99, 102, 241, 0.12);

    /* Semantik — daha soft, pastel */
    --color-success: #10b981;
    --color-success-bg: rgba(16, 185, 129, 0.08);
    --color-success-soft: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    --color-success-text: #047857;

    --color-warning: #f59e0b;
    --color-warning-bg: rgba(245, 158, 11, 0.08);
    --color-warning-soft: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    --color-warning-text: #b45309;

    --color-danger: #ef4444;
    --color-danger-bg: rgba(239, 68, 68, 0.08);
    --color-danger-soft: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    --color-danger-text: #b91c1c;

    --color-info: #0ea5e9;
    --color-info-bg: rgba(14, 165, 233, 0.08);
    --color-info-soft: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    --color-info-text: #0369a1;

    /* Stat card gradient'leri — Apple Wallet kart hissi */
    --grad-blue: linear-gradient(135deg, #dbeafe 0%, #c7d2fe 100%);
    --grad-violet: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
    --grad-pink: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%);
    --grad-green: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    --grad-amber: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    --grad-rose: linear-gradient(135deg, #ffe4e6 0%, #fecdd3 100%);
    --grad-cyan: linear-gradient(135deg, #cffafe 0%, #a5f3fc 100%);
    --grad-slate: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);

    /* İş tipi pastel renkler */
    --color-job-project: #3b82f6;
    --color-job-project-bg: var(--grad-blue);
    --color-job-subscription: #10b981;
    --color-job-subscription-bg: var(--grad-green);
    --color-job-qrmenu: #8b5cf6;
    --color-job-qrmenu-bg: var(--grad-violet);
    --color-job-openaccount: #f59e0b;
    --color-job-openaccount-bg: var(--grad-amber);

    /* Spacing — daha generous */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 28px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Radius — daha yuvarlak, Apple-like */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-3xl: 28px;
    --radius-full: 9999px;

    /* Tipografi */
    --text-xs: 11px;
    --text-sm: 13px;
    --text-base: 14px;
    --text-md: 15px;
    --text-lg: 17px;
    --text-xl: 20px;
    --text-2xl: 26px;
    --text-3xl: 32px;
    --text-4xl: 40px;

    --font-regular: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;

    --leading-tight: 1.2;
    --leading-snug: 1.35;
    --leading-normal: 1.5;
    --leading-relaxed: 1.65;

    /* Gölgeler — crystal/glass hissi: yumuşak, geniş yayılan */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.04), 0 6px 16px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 2px 4px rgba(15, 23, 42, 0.04), 0 12px 28px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 4px 8px rgba(15, 23, 42, 0.04), 0 24px 48px rgba(15, 23, 42, 0.08);
    --shadow-xl: 0 8px 16px rgba(15, 23, 42, 0.06), 0 40px 80px rgba(15, 23, 42, 0.12);
    --shadow-glow: 0 0 0 1px rgba(255, 255, 255, 0.6) inset, 0 8px 30px rgba(99, 102, 241, 0.12);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Icon */
    --icon-sm: 16px;
    --icon-md: 20px;
    --icon-lg: 24px;
    --icon-xl: 32px;

    /* Blur */
    --blur-sm: blur(8px);
    --blur-md: blur(16px);
    --blur-lg: blur(24px);
    --blur-xl: blur(40px);
}

/* ============================================================
   2. RESET & BASE
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
}
* { margin: 0; padding: 0; }

html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    background: var(--color-bg);
    background-image: var(--color-bg-gradient);
    background-attachment: fixed;
    color: var(--color-text-primary);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    font-feature-settings: "cv11", "ss01", "ss03";
    letter-spacing: -0.011em;
    min-height: 100vh;
}

/* ============================================================
   3. TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-bold);
    color: var(--color-text-primary);
    line-height: var(--leading-tight);
    letter-spacing: -0.025em;
}

h1 { font-size: var(--text-3xl); letter-spacing: -0.03em; }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); letter-spacing: -0.02em; }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-md); }
h6 { font-size: var(--text-base); }

p { margin: 0; }

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color var(--transition-fast);
    font-weight: var(--font-medium);
}
a:hover { color: var(--color-accent-hover); }

small {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
}
strong { font-weight: var(--font-semibold); }

code {
    font-family: 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
    font-size: 0.9em;
    background: var(--color-bg-tertiary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
}

/* ============================================================
   4. ICONS — Material Symbols
   ============================================================ */
.material-symbols-rounded,
.material-symbols-outlined {
    font-variation-settings:
        'FILL' 0,
        'wght' 400,
        'GRAD' 0,
        'opsz' 24;
    vertical-align: middle;
    user-select: none;
    line-height: 1;
    font-size: var(--icon-md);
}
.material-symbols-rounded.filled,
.material-symbols-outlined.filled { font-variation-settings: 'FILL' 1; }
.material-symbols-rounded.bold,
.material-symbols-outlined.bold { font-variation-settings: 'wght' 600; }

.icon-sm { font-size: var(--icon-sm) !important; }
.icon-md { font-size: var(--icon-md) !important; }
.icon-lg { font-size: var(--icon-lg) !important; }
.icon-xl { font-size: var(--icon-xl) !important; }

/* ============================================================
   5. LAYOUT
   ============================================================ */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}
@media (max-width: 768px) {
    .container { padding: 0 var(--space-4); }
}
.main-content {
    min-height: calc(100vh - 140px);
    padding: var(--space-6) 0 var(--space-12);
}

/* ============================================================
   6. HEADER — Crystal/glass nav
   ============================================================ */
.header {
    background: var(--color-bg-glass);
    backdrop-filter: saturate(180%) var(--blur-lg);
    -webkit-backdrop-filter: saturate(180%) var(--blur-lg);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-3) 0;
    position: sticky;
    top: 0;
    z-index: 100;
    color: var(--color-text-primary);
    box-shadow: none;
}
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
}
.logo { display: flex; align-items: center; gap: var(--space-2); }
.logo h1 {
    font-size: var(--text-lg);
    font-weight: var(--font-bold);
    color: var(--color-text-primary);
    letter-spacing: -0.025em;
}
.logo img { height: 28px; width: auto; }
.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

/* ============================================================
   7. NAVIGATION — Glass pill nav
   ============================================================ */
.nav {
    background: var(--color-bg-glass);
    backdrop-filter: saturate(180%) var(--blur-md);
    -webkit-backdrop-filter: saturate(180%) var(--blur-md);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-2) 0;
    position: sticky;
    top: 65px;
    z-index: 99;
}
.nav-sidebar {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}
.nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: var(--space-1);
}
.nav ul li a {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    color: var(--color-text-tertiary);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
    border: none;
    background: transparent;
}
.nav ul li a:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-glass-strong);
}
.nav ul li.active a,
.nav ul li a.active {
    color: var(--color-text-primary);
    background: var(--color-bg-elevated);
    box-shadow: var(--shadow-sm);
}
.nav-close, .nav-overlay { display: none; }

/* ============================================================
   8. CARD — Crystal/glass card
   ============================================================ */
.card {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all var(--transition-base);
}
.card:hover {
    box-shadow: var(--shadow-md);
}
.card-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--color-divider);
    background: transparent;
}
.card-header h1,
.card-header h2,
.card-header h3,
.card-header h4 {
    font-size: var(--text-md);
    font-weight: var(--font-semibold);
    color: var(--color-text-primary);
    margin: 0;
    line-height: var(--leading-snug);
}
.card-body {
    padding: var(--space-6);
}
@media (max-width: 768px) {
    .card-header { padding: var(--space-4); }
    .card-body { padding: var(--space-4); }
}

/* Glass card varyantı */
.card-glass {
    background: var(--color-bg-glass);
    backdrop-filter: saturate(180%) var(--blur-md);
    -webkit-backdrop-filter: saturate(180%) var(--blur-md);
    border: 1px solid var(--color-border-glass);
}

/* ============================================================
   9. BUTTONS — Apple-style pill
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
    user-select: none;
    min-height: 36px;
    box-shadow: var(--shadow-xs);
    letter-spacing: -0.01em;
}
.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-xs);
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
}
.btn-primary:hover {
    background: var(--color-accent-hover);
    color: white;
    border-color: var(--color-accent-hover);
}

.btn-secondary {
    background: var(--color-bg-elevated);
    color: var(--color-text-primary);
    border-color: var(--color-border);
}
.btn-secondary:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

.btn-success {
    background: var(--color-success);
    color: white;
    border-color: var(--color-success);
}
.btn-success:hover { background: #059669; color: white; border-color: #059669; }

.btn-warning {
    background: var(--color-warning);
    color: white;
    border-color: var(--color-warning);
}
.btn-warning:hover { background: #d97706; color: white; border-color: #d97706; }

.btn-danger {
    background: var(--color-danger);
    color: white;
    border-color: var(--color-danger);
}
.btn-danger:hover { background: #dc2626; color: white; border-color: #dc2626; }

.btn-info {
    background: var(--color-info);
    color: white;
    border-color: var(--color-info);
}
.btn-info:hover { background: #0284c7; color: white; border-color: #0284c7; }

.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    min-height: 28px;
}
.btn-lg {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-md);
    min-height: 48px;
}
.btn-icon {
    padding: var(--space-2);
    min-width: 36px;
}
.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
    border-color: transparent;
    box-shadow: none;
}
.btn-ghost:hover {
    background: var(--color-overlay-hover);
    color: var(--color-text-primary);
    box-shadow: none;
    transform: none;
}

/* ============================================================
   10. FORM ELEMENTS
   ============================================================ */
.form-group { margin-bottom: var(--space-4); }
.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-2);
    letter-spacing: -0.01em;
}
.form-control {
    display: block;
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
    font-family: inherit;
    color: var(--color-text-primary);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    line-height: var(--leading-snug);
    min-height: 42px;
    box-shadow: var(--shadow-xs);
}
.form-control:hover { border-color: var(--color-border-strong); }
.form-control:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 4px var(--color-accent-soft);
}
.form-control::placeholder { color: var(--color-text-quaternary); }

textarea.form-control {
    min-height: 88px;
    resize: vertical;
    line-height: var(--leading-relaxed);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%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%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right var(--space-3) center;
    background-size: 16px;
    padding-right: var(--space-10);
}

/* ============================================================
   11. TABLE — Soft, list-like
   ============================================================ */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--text-sm);
}
.table thead tr { background: transparent; }
.table thead th {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}
.table tbody td {
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-divider);
    color: var(--color-text-primary);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--transition-fast); }
.table tbody tr:hover { background: var(--color-bg-tertiary); }

/* ============================================================
   12. BADGE — Pill style, soft pastel
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    line-height: 1.4;
    letter-spacing: 0.01em;
}
.badge-primary { background: var(--color-accent-bg); color: var(--color-accent); }
.badge-success { background: var(--color-success-bg); color: var(--color-success-text); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning-text); }
.badge-danger { background: var(--color-danger-bg); color: var(--color-danger-text); }
.badge-info { background: var(--color-info-bg); color: var(--color-info-text); }
.badge-secondary { background: var(--color-bg-tertiary); color: var(--color-text-tertiary); }

/* ============================================================
   13. ALERT — Soft pastel
   ============================================================ */
.alert {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
    font-size: var(--text-sm);
    border: 1px solid transparent;
}
.alert-success {
    background: var(--color-success-bg);
    color: var(--color-success-text);
    border-color: rgba(16, 185, 129, 0.15);
}
.alert-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
    border-color: rgba(245, 158, 11, 0.15);
}
.alert-danger {
    background: var(--color-danger-bg);
    color: var(--color-danger-text);
    border-color: rgba(239, 68, 68, 0.15);
}
.alert-info {
    background: var(--color-info-bg);
    color: var(--color-info-text);
    border-color: rgba(14, 165, 233, 0.15);
}

/* ============================================================
   14. STAT CARD — Crystal/Gradient (Apple Wallet hissi)
   ============================================================ */
.stat-card {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-2xl);
    padding: var(--space-6);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 50%);
    pointer-events: none;
}
.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Renkli stat card varyantları (gradient arkaplan) */
.stat-card.stat-blue    { background: var(--grad-blue); border: none; }
.stat-card.stat-violet  { background: var(--grad-violet); border: none; }
.stat-card.stat-pink    { background: var(--grad-pink); border: none; }
.stat-card.stat-green   { background: var(--grad-green); border: none; }
.stat-card.stat-amber   { background: var(--grad-amber); border: none; }
.stat-card.stat-rose    { background: var(--grad-rose); border: none; }
.stat-card.stat-cyan    { background: var(--grad-cyan); border: none; }
.stat-card.stat-slate   { background: var(--grad-slate); border: none; }

.stat-card .stat-icon {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.55);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.7), 0 1px 2px rgba(15, 23, 42, 0.06);
    color: rgba(15, 23, 42, 0.7);
    z-index: 1;
}
.stat-card .stat-icon .material-symbols-rounded { font-size: 20px; }
.stat-card .stat-label {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: rgba(15, 23, 42, 0.5);
    font-weight: var(--font-semibold);
    line-height: 1.3;
    margin: 0 0 var(--space-2);
    padding-right: 42px;
    min-height: 2.2em;
    position: relative;
    z-index: 1;
}
.stat-card .stat-number {
    font-size: 23px;
    font-weight: var(--font-bold);
    color: var(--color-text-primary);
    letter-spacing: -0.03em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    display: block;
    position: relative;
    z-index: 1;
}

/* ============================================================
   15. PAGE HEADER
   ============================================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: var(--space-6);
    gap: var(--space-4);
    flex-wrap: wrap;
}
.page-header h1 {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    letter-spacing: -0.03em;
    margin: 0;
}
.page-header .subtitle {
    color: var(--color-text-tertiary);
    margin-top: var(--space-1);
    font-size: var(--text-sm);
}
.page-header-actions {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    flex-wrap: wrap;
}

/* ============================================================
   16. UTILITIES
   ============================================================ */
.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-accent { color: var(--color-accent); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-danger { color: var(--color-danger); }

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-md { font-size: var(--text-md); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }

.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

.nowrap { white-space: nowrap; }
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

/* Scroll bar — minimal */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--color-border-strong);
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-quaternary);
    background-clip: padding-box;
    border: 2px solid transparent;
}

/* Selection */
::selection {
    background: var(--color-accent-soft);
    color: var(--color-accent-hover);
}

/* ============================================================
   20. MOBİL — Native uygulama deneyimi
   Bottom tab bar, açılır menü, dokunmatik hedefler, filtre paneli
   ============================================================ */

/* Dokunmatik temel iyileştirmeler */
* { -webkit-tap-highlight-color: transparent; }
body { -webkit-overflow-scrolling: touch; }

/* Alt tab bar — varsayılan gizli, mobilde görünür */
.bottom-nav { display: none; }
.mobile-sheet-overlay { display: none; }
.menu-toggle-btn { display: none; }

@media (max-width: 768px) {
    /* ---- Üst header: kompakt ---- */
    .header { padding: var(--space-2) 0; }
    .header .user-info .text-sm { display: none; }   /* "Hoşgeldiniz" metnini gizle, ikon kalsın */
    .logo img { height: 26px; }

    /* ---- Masaüstü pill nav'ı mobilde gizle ---- */
    .nav { display: none; }

    /* ---- İçerik alanı: alt bar için pay bırak ---- */
    .main-content {
        padding: var(--space-4) 0 calc(72px + env(safe-area-inset-bottom, 0px) + var(--space-4));
        min-height: calc(100vh - 90px);
    }

    /* ---- ALT TAB BAR ---- */
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        z-index: 200;
        background: var(--color-bg-glass-strong);
        backdrop-filter: saturate(180%) var(--blur-lg);
        -webkit-backdrop-filter: saturate(180%) var(--blur-lg);
        border-top: 1px solid var(--color-border);
        padding: var(--space-1) var(--space-1) calc(var(--space-1) + env(safe-area-inset-bottom, 0px));
        box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.06);
    }
    .bottom-nav a, .bottom-nav button {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: var(--space-2) 0 var(--space-1);
        min-height: 56px;
        background: none;
        border: none;
        cursor: pointer;
        text-decoration: none;
        color: var(--color-text-quaternary);
        font-size: 10px;
        font-weight: var(--font-medium);
        letter-spacing: -0.01em;
        transition: color var(--transition-fast);
        -webkit-tap-highlight-color: transparent;
    }
    .bottom-nav a .material-symbols-rounded,
    .bottom-nav button .material-symbols-rounded {
        font-size: 24px;
        transition: transform var(--transition-fast);
    }
    .bottom-nav a.active {
        color: var(--color-accent);
    }
    .bottom-nav a.active .material-symbols-rounded {
        font-variation-settings: 'FILL' 1;
        transform: translateY(-1px);
    }
    .bottom-nav a:active .material-symbols-rounded,
    .bottom-nav button:active .material-symbols-rounded {
        transform: scale(0.88);
    }

    /* ---- AÇILIR MENÜ SHEET (kalan navigasyon öğeleri) ---- */
    .mobile-sheet-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 250;
        background: rgba(15, 23, 42, 0.4);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        opacity: 0;
        visibility: hidden;
        transition: opacity var(--transition-base), visibility var(--transition-base);
    }
    .mobile-sheet-overlay.open { opacity: 1; visibility: visible; }
    .mobile-sheet {
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 251;
        background: var(--color-bg-elevated);
        border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
        padding: var(--space-3) var(--space-4) calc(var(--space-6) + env(safe-area-inset-bottom, 0px));
        transform: translateY(100%);
        transition: transform var(--transition-base);
        box-shadow: 0 -8px 40px rgba(15, 23, 42, 0.18);
    }
    .mobile-sheet-overlay.open .mobile-sheet { transform: translateY(0); }
    .mobile-sheet-handle {
        width: 38px; height: 4px;
        background: var(--color-border-strong);
        border-radius: var(--radius-full);
        margin: 0 auto var(--space-4);
    }
    .mobile-sheet-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-2);
    }
    .mobile-sheet-grid a {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: var(--space-2);
        padding: var(--space-4) var(--space-2);
        border-radius: var(--radius-lg);
        text-decoration: none;
        color: var(--color-text-secondary);
        font-size: var(--text-xs);
        font-weight: var(--font-medium);
        text-align: center;
        background: var(--color-bg-tertiary);
        transition: all var(--transition-fast);
    }
    .mobile-sheet-grid a .material-symbols-rounded { font-size: 26px; color: var(--color-accent); }
    .mobile-sheet-grid a:active { transform: scale(0.95); background: var(--color-accent-bg); }
    .mobile-sheet-grid a.active { background: var(--color-accent-bg); color: var(--color-accent); }

    /* ---- page-header: dikey yığ, aksiyonlar tam genişlik ---- */
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-3);
    }
    .page-header h1 { font-size: var(--text-2xl); }
    .page-header-actions {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-2);
    }
    .page-header-actions .btn { flex: 1 1 auto; min-height: 44px; }

    /* ---- Butonlar: dokunmatik hedef ---- */
    .btn { min-height: 44px; }
    .btn-sm { min-height: 36px; }

    /* ---- Analiz tabloları: yatay kaydırma + sabit ilk sütun ---- */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
    .table-responsive .table { min-width: max-content; }
    .table-responsive .table th,
    .table-responsive .table td { white-space: nowrap; }
    /* İlk sütun (kategori/etiket) sabit kalsın — sağdaki rakamlar kaydırılırken */
    .table-responsive .table thead th:first-child,
    .table-responsive .table tbody td:first-child,
    .table-responsive .table tfoot td:first-child {
        position: sticky;
        left: 0;
        z-index: 1;
        background: var(--color-bg-elevated);
        box-shadow: 1px 0 0 var(--color-border);
    }
    .table-responsive .table tbody tr:hover td:first-child { background: var(--color-bg-tertiary); }
    .table-responsive .table tfoot td:first-child { background: var(--color-bg-tertiary); }

    /* ---- Stat kartları: mobilde 2 sütun (app-vari yoğunluk) ---- */
    div:has(> .stat-card) {
        grid-template-columns: 1fr 1fr !important;
        gap: var(--space-3) !important;
    }
    .stat-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
    .stat-card { padding: var(--space-4); }
    .stat-card .stat-icon { top: var(--space-3); right: var(--space-3); width: 32px; height: 32px; }
    .stat-card .stat-icon .material-symbols-rounded { font-size: 18px; }
    .stat-card .stat-label { padding-right: 36px; }
    .stat-card .stat-number { font-size: 20px; }

    /* ---- Sabit çok sütunlu satır içi grid'ler: mobil güvenlik ağı ---- */
    /* 2 panelli içerik (yan yana kartlar/paneller) → tek sütuna yığ */
    [style*="grid-template-columns: 1fr 1fr"]:not([style*="1fr 1fr 1fr"]),
    [style*="grid-template-columns:1fr 1fr"]:not([style*="1fr 1fr 1fr"]),
    [style*="grid-template-columns: 2fr 1fr"]:not([style*="1fr 1fr 1fr"]),
    [style*="repeat(2, 1fr)"], [style*="repeat(2,1fr)"] {
        grid-template-columns: 1fr !important;
    }
    /* 3-4 sütunlu metrik kutuları → 2 sütun */
    [style*="repeat(4, 1fr)"], [style*="repeat(4,1fr)"],
    [style*="repeat(3, 1fr)"], [style*="repeat(3,1fr)"],
    [style*="grid-template-columns: 1fr 1fr 1fr"] {
        grid-template-columns: 1fr 1fr !important;
    }

    /* ---- Form alanları: iOS zoom engelle (16px taban) ---- */
    .form-control, input, select, textarea { font-size: 16px; }

    /* ---- Modal: alttan tam genişlik sheet hissi ---- */
    .modal-overlay { padding: 0; align-items: flex-end; }
    .modal-dialog {
        max-width: 100%;
        width: 100%;
        border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
        max-height: 92vh;
    }
}

/* ============================================================
   21. FİLTRE PANELİ — mobilde 'Filtrele' butonu arkasına gizlenir
   ============================================================ */
.filter-toggle { display: none; }

@media (max-width: 768px) {
    .filter-toggle {
        display: inline-flex;
        align-items: center;
        gap: var(--space-2);
        width: 100%;
        justify-content: center;
        margin-bottom: var(--space-3);
    }
    /* .filters-card: filtre formunu saran kart — mobilde gizli, .open ile açılır */
    .filters-card { display: none; }
    .filters-card.open { display: block; }
    /* İçindeki grid filtre formlarını tek sütuna indir (inline grid'i ezmek için !important) */
    .filters-card form[style*="grid"] {
        grid-template-columns: 1fr !important;
        gap: var(--space-3) !important;
    }
}

/* ============================================================
   22. PREMIUM BİLEŞENLER — hero, section-card, list-item, dash-table
   Hem masaüstü hem mobilde çalışır; mobil ince ayarlar §20 içinde.
   ============================================================ */

/* ---- Hero welcome (dashboard) ---- */
.welcome-header {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #6366f1 0%, #7c3aed 55%, #a855f7 100%);
    border-radius: var(--radius-2xl);
    padding: var(--space-6);
    color: #fff;
    box-shadow: 0 12px 32px -8px rgba(99, 102, 241, 0.45);
    margin-bottom: var(--space-5);
}
.welcome-header::after {
    content: ""; position: absolute; top: -40px; right: -30px;
    width: 170px; height: 170px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
}
.welcome-header::before {
    content: ""; position: absolute; bottom: -60px; right: 50px;
    width: 130px; height: 130px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
}
.welcome-header h1 { color: #fff; font-size: var(--text-2xl); font-weight: var(--font-bold); letter-spacing: -0.02em; margin: 0 0 2px; }
.welcome-header p { color: rgba(255, 255, 255, 0.82); font-size: var(--text-sm); margin: 0; }
.welcome-clock { text-align: right; position: relative; z-index: 1; }
.welcome-clock .t { font-size: var(--text-2xl); font-weight: var(--font-bold); letter-spacing: -0.02em; }
.welcome-clock .s { font-size: var(--text-xs); opacity: 0.85; display: inline-flex; align-items: center; gap: 5px; }
.welcome-clock .s .dot-live { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.25); }

/* ---- Metric tabs — yatay kaydırmalı pill ---- */
.metric-tabs {
    display: flex; gap: var(--space-1); margin-bottom: var(--space-4);
    background: var(--color-bg-glass-strong);
    backdrop-filter: saturate(180%) var(--blur-md);
    -webkit-backdrop-filter: saturate(180%) var(--blur-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full); padding: var(--space-1);
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.metric-tabs::-webkit-scrollbar { display: none; }
.metric-tab {
    padding: var(--space-2) var(--space-4); border: none; background: transparent;
    color: var(--color-text-tertiary); font-size: var(--text-sm); font-weight: var(--font-semibold);
    border-radius: var(--radius-full); cursor: pointer; white-space: nowrap; flex: 0 0 auto;
    transition: all var(--transition-fast);
}
.metric-tab.active { background: var(--color-accent); color: #fff; box-shadow: var(--shadow-sm); }

/* ---- Section card (liste sarmalı) ---- */
.section-card {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: var(--space-5);
}
.section-head {
    display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3);
    padding: var(--space-4) var(--space-5) var(--space-3);
}
.section-head h3 { margin: 0; font-size: var(--text-md); font-weight: var(--font-bold); letter-spacing: -0.01em; display: flex; align-items: center; gap: var(--space-2); }
.section-head .sub { font-size: var(--text-xs); color: var(--color-text-tertiary); margin-top: 3px; }
.section-list { display: flex; flex-direction: column; }

/* ---- List item (müşteri / iş / genel satır) ---- */
.list-item {
    display: grid; grid-template-columns: auto 1fr auto; gap: var(--space-4);
    align-items: center; padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--color-divider); text-decoration: none; color: inherit;
    transition: background var(--transition-fast);
}
.list-item:first-child { border-top: none; }
.list-item:active { background: var(--color-overlay-hover); }
.li-avatar {
    width: 46px; height: 46px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: var(--font-bold); font-size: 16px; letter-spacing: -0.02em;
    box-shadow: 0 4px 12px -2px rgba(99, 102, 241, 0.35); flex-shrink: 0;
}
.li-avatar .material-symbols-rounded { font-size: 24px; }
.av-violet { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.av-blue   { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.av-green  { background: linear-gradient(135deg, #34d399, #059669); }
.av-amber  { background: linear-gradient(135deg, #fbbf24, #d97706); }
.av-rose   { background: linear-gradient(135deg, #fb7185, #e11d48); }
.av-slate  { background: linear-gradient(135deg, #94a3b8, #475569); }
.li-body { min-width: 0; }
.li-title { font-size: var(--text-md); font-weight: var(--font-semibold); letter-spacing: -0.01em; color: var(--color-text-primary); margin: 0 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-meta { display: flex; align-items: center; gap: var(--space-2); font-size: 12.5px; color: var(--color-text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--color-text-quaternary); flex-shrink: 0; }
.li-trail { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.li-amount { font-size: var(--text-md); font-weight: var(--font-bold); letter-spacing: -0.02em; color: var(--color-text-primary); white-space: nowrap; }
.li-chip { padding: 3px 10px; border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: var(--font-semibold); white-space: nowrap; }
.chip-green { background: var(--color-success-bg); color: var(--color-success-text); }
.chip-amber { background: var(--color-warning-bg); color: var(--color-warning-text); }
.chip-rose  { background: var(--color-danger-bg); color: var(--color-danger-text); }
.chip-slate { background: var(--color-bg-tertiary); color: var(--color-text-tertiary); }
.li-actions { display: flex; gap: var(--space-2); }
.icon-btn {
    width: 34px; height: 34px; border-radius: 11px; border: 1px solid var(--color-border);
    background: var(--color-bg-elevated); display: flex; align-items: center; justify-content: center;
    color: var(--color-text-tertiary); text-decoration: none; transition: all var(--transition-fast); cursor: pointer;
}
.icon-btn:hover { border-color: var(--color-accent); background: var(--color-accent-bg); color: var(--color-accent); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn.danger:hover { border-color: var(--color-danger); background: var(--color-danger-bg); color: var(--color-danger); }

/* ---- Dashboard tablo → mobil satır-kart ---- */
.dash-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.dash-table thead tr { background: var(--color-bg-tertiary); }
.dash-table th { padding: 9px 12px; text-align: left; font-size: var(--text-xs); color: var(--color-text-tertiary); text-transform: uppercase; letter-spacing: 0.04em; font-weight: var(--font-semibold); }
.dash-table td { padding: 10px 12px; }
.dash-table tbody tr:not(.sec) { border-bottom: 1px solid var(--color-divider); }
.dash-table tr.sec td { padding: 8px 12px; background: var(--color-bg-secondary); font-size: var(--text-xs); font-weight: var(--font-bold); text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-tertiary); }

@media (max-width: 768px) {
    .dash-table, .dash-table tbody, .dash-table tr, .dash-table td { display: block; width: auto; }
    .dash-table thead { display: none; }
    .dash-table tr.sec { padding: 14px 0 6px; background: transparent; }
    .dash-table tr.sec td { padding: 0; background: transparent; }
    .dash-table tr:not(.sec) { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: baseline; padding: 12px 0; }
    .dash-table td { padding: 0; }
    .dash-table td.c-cust { grid-column: 1; grid-row: 1; font-weight: var(--font-semibold); font-size: var(--text-base); }
    .dash-table td.c-serv { grid-column: 1; grid-row: 2; font-size: 12.5px; color: var(--color-text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .dash-table td.c-amt  { grid-column: 2; grid-row: 1; text-align: right; font-weight: var(--font-bold); font-size: var(--text-md); white-space: nowrap; }
    .dash-table td.c-stat { grid-column: 2; grid-row: 2; text-align: right; font-size: 12px; color: var(--color-text-tertiary); white-space: nowrap; }
    .dash-table td.c-vat, .dash-table td.c-date, .dash-table td.c-hide { display: none; }
}

/* ============================================================
   23. FİLTRE CHIP'LERİ — yatay kaydırmalı, tutarlı pill satırı
   ============================================================ */
.filter-chips {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 0;
}
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border);
    background: var(--color-bg-elevated);
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    text-decoration: none;
    white-space: nowrap;
    transition: all var(--transition-fast);
    cursor: pointer;
    box-shadow: var(--shadow-xs);
}
.filter-chip:hover { border-color: var(--color-border-strong); color: var(--color-text-primary); }
.filter-chip:active { transform: scale(0.96); }
.filter-chip.active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.filter-chip .chip-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.filter-chip.active .chip-dot { box-shadow: 0 0 0 2px rgba(255,255,255,0.5); }
