/* =============================================
   APPLE DESIGN SYSTEM — ERP Custom Framework
   No Bootstrap. Pure Apple-style CSS.
   ============================================= */

/* --- Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Colors */
    --color-primary: #007AFF;
    --color-primary-hover: #0056CC;
    --color-primary-light: rgba(0, 122, 255, 0.1);
    --color-success: #34C759;
    --color-success-light: rgba(52, 199, 89, 0.1);
    --color-warning: #FF9500;
    --color-warning-light: rgba(255, 149, 0, 0.1);
    --color-danger: #FF3B30;
    --color-danger-light: rgba(255, 59, 48, 0.1);
    --color-info: #5AC8FA;
    --color-info-light: rgba(90, 200, 250, 0.1);

    /* Text */
    --text-primary: #1D1D1F;
    --text-secondary: #86868B;
    --text-tertiary: #AEAEB2;
    --text-white: #FFFFFF;

    /* Backgrounds */
    --bg-page: #F5F5F7;
    --bg-card: #FFFFFF;
    --bg-sidebar: rgba(255, 255, 255, 0.72);
    --bg-hover: rgba(0, 0, 0, 0.03);
    --bg-active: rgba(0, 122, 255, 0.08);
    --bg-input: #FFFFFF;
    --bg-overlay: rgba(0, 0, 0, 0.4);
    --bg-primary: #F5F5F7;
    --bg-secondary: #F0F0F2;
    --bg-tertiary: #E8E8ED;
    --color-bg-secondary: #F0F0F2;

    /* Borders */
    --border-color: rgba(0, 0, 0, 0.08);
    --border-primary: rgba(0, 0, 0, 0.08);
    --border-secondary: rgba(0, 0, 0, 0.05);
    --color-border: rgba(0, 0, 0, 0.08);
    --border-color-focus: rgba(0, 122, 255, 0.4);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 12px 48px rgba(0, 0, 0, 0.15);
    --shadow-modal: 0 8px 40px rgba(0, 0, 0, 0.12);
    --shadow-dropdown: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-focus: 0 0 0 4px rgba(0, 122, 255, 0.2);

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-pill: 980px;

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

    /* Layout */
    --sidebar-width: 280px;
    --sidebar-collapsed: 72px;
    --topbar-height: 64px;

    /* Transitions */
    --transition: 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
    --transition-fast: 0.15s cubic-bezier(0.25, 0.1, 0.25, 1);
    --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Typography */
    --text-sm: 0.875rem;

    /* Font */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
}

/* --- Dark Mode --- */
[data-theme="dark"] {
    --text-primary: #F5F5F7;
    --text-secondary: #98989D;
    --text-tertiary: #636366;
    --bg-page: #000000;
    --bg-card: #1C1C1E;
    --bg-sidebar: rgba(28, 28, 30, 0.82);
    --bg-hover: rgba(255, 255, 255, 0.05);
    --bg-active: rgba(0, 122, 255, 0.15);
    --bg-input: #2C2C2E;
    --bg-overlay: rgba(0, 0, 0, 0.6);
    --bg-primary: #000000;
    --bg-secondary: #2C2C2E;
    --bg-tertiary: #3A3A3C;
    --color-bg-secondary: #2C2C2E;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-primary: rgba(255, 255, 255, 0.08);
    --border-secondary: rgba(255, 255, 255, 0.05);
    --color-border: rgba(255, 255, 255, 0.08);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.25);
    --shadow-xl: 0 12px 48px rgba(0, 0, 0, 0.35);
    --shadow-modal: 0 8px 40px rgba(0, 0, 0, 0.4);
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
    /* Sayfa içeriği uzayıp kısalsa bile scrollbar yer ayrılır,
       layout kaymaz (menü oynamaz). */
    scrollbar-gutter: stable;
    overflow-y: scroll; /* Eski tarayıcılar için fallback */
}

body {
    font-family: var(--font-family);
    color: var(--text-primary);
    background: var(--bg-page);
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100vh;
}

a { color: var(--color-primary); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--color-primary-hover); }

img { max-width: 100%; height: auto; }

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.2;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-danger { color: var(--color-danger); }
.text-primary-color { color: var(--color-primary); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

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

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding-top: var(--topbar-height);
    transition: margin-left var(--transition);
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100vw;
}

.page-content {
    padding: var(--space-7);
    overflow-x: hidden;
    max-width: 1440px;
}

/* --- Sidebar --- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-right: 1px solid var(--border-color);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: all var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar::-webkit-scrollbar { width: 0; }

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-5) var(--space-5);
    height: var(--topbar-height);
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo .logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--color-primary), #5856D6);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar-logo .logo-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-3) var(--space-3);
}

.nav-section {
    margin-bottom: var(--space-3);
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    padding: var(--space-3) var(--space-3) var(--space-1);
    white-space: nowrap;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 2px;
    white-space: nowrap;
    user-select: none;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--bg-active);
    color: var(--color-primary);
}

.nav-item .nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item.active .nav-icon { opacity: 1; }

.nav-item .nav-badge {
    margin-left: auto;
    background: var(--color-danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: var(--radius-pill);
    min-width: 18px;
    text-align: center;
}

/* --- Topbar --- */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-7);
    z-index: 90;
    transition: left var(--transition);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.topbar-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.breadcrumb,
.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.86rem;
    color: var(--text-tertiary);
    font-weight: 500;
}

.breadcrumb a,
.topbar-breadcrumb a { color: var(--text-secondary); transition: color .2s; }
.breadcrumb a:hover,
.topbar-breadcrumb a:hover { color: var(--color-primary); }
.breadcrumb .separator,
.topbar-breadcrumb .separator { color: var(--text-tertiary); }
.topbar-breadcrumb span:not(.separator) { color: var(--text-primary); font-weight: 600; }

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.topbar-search {
    position: relative;
}

.topbar-search input {
    width: 240px;
    height: 36px;
    background: var(--bg-hover);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 0 var(--space-4) 0 36px;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    font-family: var(--font-family);
}

.topbar-search input:focus {
    outline: none;
    background: var(--bg-input);
    border-color: var(--border-color-focus);
    box-shadow: var(--shadow-focus);
    width: 300px;
}

.topbar-search .search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
}

.topbar-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    position: relative;
}

.topbar-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.topbar-btn .badge-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--color-danger);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.user-menu:hover { background: var(--bg-hover); }

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), #5856D6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
}

.user-info { line-height: 1.2; }
.user-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.user-role { font-size: 0.7rem; color: var(--text-tertiary); }

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: var(--space-6);
    transition: all var(--transition);
}

.card:hover { box-shadow: var(--shadow-modal); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-5);
}

.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* --- Stat Cards --- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-7);
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-card);
    transition: all var(--transition);
    cursor: default;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-modal);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-4);
}

.stat-icon.blue { background: var(--color-primary-light); color: var(--color-primary); }
.stat-icon.green { background: var(--color-success-light); color: var(--color-success); }
.stat-icon.orange { background: var(--color-warning-light); color: var(--color-warning); }
.stat-icon.red { background: var(--color-danger-light); color: var(--color-danger); }
.stat-icon.purple { background: rgba(175, 82, 222, 0.1); color: #AF52DE; }

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: var(--space-1);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: var(--space-2);
    padding: 2px 8px;
    border-radius: var(--radius-pill);
}

.stat-change.up { background: var(--color-success-light); color: var(--color-success); }
.stat-change.down { background: var(--color-danger-light); color: var(--color-danger); }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    height: 40px;
    padding: 0 var(--space-5);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
    user-select: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--color-primary);
    color: white;
    border-radius: var(--radius-pill);
}
.btn-primary:hover { background: var(--color-primary-hover); transform: scale(1.02); color: white; }

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.btn-secondary:hover { background: rgba(0, 0, 0, 0.06); }

.btn-success { background: var(--color-success); color: white; border-radius: var(--radius-pill); }
.btn-success:hover { background: #2DB84D; transform: scale(1.02); color: white; }

.btn-danger { background: var(--color-danger); color: white; border-radius: var(--radius-pill); }
.btn-danger:hover { background: #E8352B; transform: scale(1.02); color: white; }

.btn-warning { background: var(--color-warning); color: white; border-radius: var(--radius-pill); }

.btn-ghost {
    background: transparent;
    color: var(--color-primary);
}
.btn-ghost:hover { background: var(--color-primary-light); }

.btn-sm { height: 32px; padding: 0 var(--space-4); font-size: 0.8rem; }
.btn-lg { height: 48px; padding: 0 var(--space-7); font-size: 1rem; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }

/* --- Form Elements --- */
.form-group {
    margin-bottom: var(--space-5);
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    height: 44px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0 var(--space-4);
    font-size: 0.9rem;
    font-family: var(--font-family);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.form-textarea {
    height: auto;
    min-height: 100px;
    padding: var(--space-3) var(--space-4);
    resize: vertical;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-focus);
}

.form-input::placeholder { color: var(--text-tertiary); }

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2386868B' 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 14px center;
    padding-right: 40px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.form-error {
    font-size: 0.75rem;
    color: var(--color-danger);
    margin-top: var(--space-1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-5);
}

/* --- Toggle Switch --- */
.toggle {
    position: relative;
    width: 48px;
    height: 28px;
    cursor: pointer;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--text-tertiary);
    border-radius: 14px;
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle input:checked + .toggle-slider { background: var(--color-primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Small toggle for multi-select lists */
.toggle-sm {
    position: relative;
    display: inline-block;
    width: 38px;
    min-width: 38px;
    height: 22px;
    cursor: pointer;
}
.toggle-sm input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-sm .toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--text-tertiary);
    border-radius: 11px;
    transition: var(--transition);
}
.toggle-sm .toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-sm input:checked + .toggle-slider { background: var(--color-primary); }
.toggle-sm input:checked + .toggle-slider::before { transform: translateX(16px); }

/* Danger toggle for remove image etc */
.toggle-danger input:checked + .toggle-slider { background: var(--color-danger); }

/* Success toggle variant */
.toggle-success input:checked + .toggle-slider { background: var(--color-success); }

/* --- Tables --- */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    box-shadow: var(--shadow-card);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    padding: var(--space-4) var(--space-5);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    user-select: none;
}

.data-table tbody td {
    padding: var(--space-4) var(--space-5);
    font-size: 0.875rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table tbody tr { transition: background var(--transition-fast); }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr:nth-child(even) { background: rgba(0, 0, 0, 0.015); }
.data-table tbody tr:nth-child(even):hover { background: var(--bg-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }

.table-actions {
    display: flex;
    gap: var(--space-2);
}

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 var(--space-3);
    border-radius: var(--radius-pill);
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-primary { background: var(--color-primary-light); color: var(--color-primary); }
.badge-success { background: var(--color-success-light); color: var(--color-success); }
.badge-warning { background: var(--color-warning-light); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-light); color: var(--color-danger); }
.badge-info { background: var(--color-info-light); color: #0A84FF; }
.badge-secondary { background: var(--bg-hover); color: var(--text-secondary); }

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    padding: var(--space-4) 0;
}

.pagination a, .pagination span {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.pagination a:hover { background: var(--bg-hover); color: var(--text-primary); }
.pagination .active { background: var(--color-primary); color: white; }

/* --- Modals --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-modal);
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-spring);
}

.modal-overlay.active .modal { transform: scale(1) translateY(0); }

.modal-header {
    padding: var(--space-6) var(--space-6) 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body { padding: var(--space-6); }
.modal-footer {
    padding: 0 var(--space-6) var(--space-6);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

/* --- Alerts --- */
.alert {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    animation: slideDown 0.3s ease;
}

.alert-success { background: var(--color-success-light); color: #1E8338; }
.alert-danger { background: var(--color-danger-light); color: #C23025; }
.alert-warning { background: var(--color-warning-light); color: #B36B00; }
.alert-info { background: var(--color-info-light); color: #0A84FF; }

/* --- Grid Utilities --- */
.grid { display: grid; gap: var(--space-5); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

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

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }

.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.hidden { display: none; }

/* --- Skeleton Loading --- */
.skeleton {
    background: linear-gradient(90deg, var(--bg-hover) 25%, rgba(0,0,0,0.05) 50%, var(--bg-hover) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 24px; width: 60%; margin-bottom: 12px; }
.skeleton-avatar { width: 44px; height: 44px; border-radius: 50%; }

/* --- Dropdown --- */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 200px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-dropdown);
    border: 1px solid var(--border-color);
    padding: var(--space-2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition-fast);
    z-index: 200;
}

.dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.dropdown-item:hover { background: var(--bg-hover); }
.dropdown-divider { height: 1px; background: var(--border-color); margin: var(--space-2) 0; }

/* --- Page Header --- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-7);
    flex-wrap: wrap;
    gap: var(--space-4);
}

.page-header-left h1 {
    font-size: 1.6rem;
    margin-bottom: var(--space-1);
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: var(--space-10) var(--space-7);
}

.empty-state svg { width: 80px; height: 80px; color: var(--text-tertiary); margin-bottom: var(--space-5); }
.empty-state h3 { margin-bottom: var(--space-2); }
.empty-state p { color: var(--text-secondary); margin-bottom: var(--space-5); }

/* --- Toast Notifications --- */
.toast-container {
    position: fixed;
    top: var(--space-5);
    right: var(--space-5);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.toast {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-modal);
    padding: var(--space-4) var(--space-5);
    min-width: 300px;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    animation: slideInRight 0.4s var(--transition);
    border-left: 3px solid var(--color-primary);
}

.toast.success { border-left-color: var(--color-success); }
.toast.error { border-left-color: var(--color-danger); }
.toast.warning { border-left-color: var(--color-warning); }

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.animate-fade-in { animation: fadeIn 0.5s ease; }
.animate-slide-up { animation: slideUp 0.5s ease; }
.animate-scale-in { animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* Staggered animation children */
.stagger > * { animation: slideUp 0.5s ease both; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 60ms; }
.stagger > *:nth-child(3) { animation-delay: 120ms; }
.stagger > *:nth-child(4) { animation-delay: 180ms; }
.stagger > *:nth-child(5) { animation-delay: 240ms; }
.stagger > *:nth-child(6) { animation-delay: 300ms; }
.stagger > *:nth-child(7) { animation-delay: 360ms; }
.stagger > *:nth-child(8) { animation-delay: 420ms; }

/* --- Mobile Hamburger --- */
.mobile-toggle {
    display: none;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 6px;
    color: var(--text-primary);
}

/* --- Logo görseli (varsa) — geniş halde logo + şirket adı yan yana --- */
.sidebar .logo-img {
    max-height: 36px;
    max-width: 44px;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
    transition: opacity .22s;
}
.sidebar .logo-icon-compact { display: none; }

/* --- Sidebar smooth transition --- */
.sidebar,
.sidebar .logo-text,
.sidebar .logo-img,
.sidebar .nav-section-title,
.sidebar .nav-item span,
.sidebar .nav-badge {
    transition: width .28s cubic-bezier(.4,0,.2,1),
                opacity .2s ease,
                transform .28s cubic-bezier(.4,0,.2,1);
}
.main-content { transition: margin-left .28s cubic-bezier(.4,0,.2,1); }
.topbar { transition: left .28s cubic-bezier(.4,0,.2,1); }

/* --- Topbar'daki sidebar daralt/genişlet butonu --- */
.topbar-sidebar-toggle {
    width: 38px; height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all .2s;
    margin-right: 12px;
    flex-shrink: 0;
}
@media (min-width: 769px) {
    .topbar-sidebar-toggle { display: inline-flex; }
}
.topbar-sidebar-toggle:hover {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,122,255,.25);
}
.topbar-sidebar-toggle svg {
    transition: transform .25s ease;
}
body.sidebar-collapsed .topbar-sidebar-toggle svg {
    transform: rotate(180deg);
}

/* --- Masaüstünde manuel daraltma (icon-only mod) --- */
/* @media kullanmıyoruz; mobil tarafı kendi mantığı yönetiyor.
   Burada tüm masaüstü ekranlarda body.sidebar-collapsed varsa daraltır. */
body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed) !important;
}
body.sidebar-collapsed .sidebar .logo-text,
body.sidebar-collapsed .sidebar .logo-img,
body.sidebar-collapsed .sidebar .nav-section-title,
body.sidebar-collapsed .sidebar .nav-item span,
body.sidebar-collapsed .sidebar .nav-badge {
    opacity: 0 !important;
    visibility: hidden !important;
    width: 0 !important;
    max-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    white-space: nowrap;
}
body.sidebar-collapsed .sidebar .logo-icon-compact {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}
/* DARALMİŞ MODDA TÜM İKONLAR TEK HİZADA — 40x40 ortalı kart */
body.sidebar-collapsed .sidebar-logo {
    justify-content: center !important;
    padding: 12px 0 !important;
    height: auto !important;
    border-bottom: 1px solid var(--border-color);
}
body.sidebar-collapsed .sidebar-logo .logo-icon-compact {
    margin: 0 !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 10px !important;
    font-size: 1.1rem !important;
}
body.sidebar-collapsed .sidebar-nav {
    padding: 8px !important;
}
body.sidebar-collapsed .sidebar .nav-section {
    margin-bottom: 6px !important;
}
body.sidebar-collapsed .sidebar .nav-item {
    justify-content: center !important;
    padding: 0 !important;
    width: 40px !important;
    height: 40px !important;
    margin: 4px auto !important;
    border-radius: 10px !important;
}
body.sidebar-collapsed .sidebar .nav-item .nav-icon {
    width: 20px !important;
    height: 20px !important;
}
body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed) !important;
}
body.sidebar-collapsed .topbar {
    left: var(--sidebar-collapsed) !important;
}
/* Daralmış halde sidebar overflow görünür — tooltip'ler dışarı taşabilsin */
body.sidebar-collapsed .sidebar { overflow: visible !important; }
body.sidebar-collapsed .sidebar-nav { overflow-y: auto; overflow-x: visible; }


/* Tooltip — daralmış modda nav-item'in üzerine gelince ikonun yanında açılır */
body.sidebar-collapsed .sidebar .nav-item {
    position: relative;
}
body.sidebar-collapsed .sidebar .nav-item::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(-6px);
    background: var(--bg-card, #1f2937);
    color: var(--text-primary, #fff);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: .78rem;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 6px 20px rgba(0,0,0,.15);
    border: 1px solid var(--border-color);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .15s, transform .15s;
    z-index: 1000;
}
body.sidebar-collapsed .sidebar .nav-item:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}
/* Sadece data-label'i olan item'larda tooltip göster */
body.sidebar-collapsed .sidebar .nav-item:not([data-label])::after { display: none; }

/* Mobil (≤768) — sidebar-collapsed sınıfı yokmuş gibi davransın */
@media (max-width: 768px) {
    body.sidebar-collapsed .sidebar { width: var(--sidebar-width) !important; transform: translateX(-100%); }
    body.sidebar-collapsed .sidebar.open { transform: translateX(0); }
    body.sidebar-collapsed .main-content { margin-left: 0 !important; }
    body.sidebar-collapsed .topbar { left: 0 !important; }
}

/* --- Responsive --- */
@media (max-width: 1200px) {
    .sidebar {
        width: var(--sidebar-collapsed);
    }
    .sidebar .logo-text,
    .sidebar .logo-img,
    .sidebar .nav-section-title,
    .sidebar .nav-item span,
    .sidebar .nav-badge { display: none; }
    .sidebar .logo-icon-compact { display: flex; }
    .sidebar .nav-item { justify-content: center; padding: var(--space-3); }
    .sidebar:hover {
        width: var(--sidebar-width);
    }
    .sidebar:hover .logo-text,
    .sidebar:hover .nav-section-title,
    .sidebar:hover .nav-item span,
    .sidebar:hover .nav-badge { display: inline; }
    .sidebar:hover .logo-img { display: block; }
    .sidebar:hover .logo-icon-compact { display: none; }
    .sidebar:hover .nav-item { justify-content: flex-start; }
    .main-content { margin-left: var(--sidebar-collapsed); }
    .topbar { left: var(--sidebar-collapsed); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
        z-index: 200;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar .logo-text,
    .sidebar .nav-section-title,
    .sidebar .nav-item span,
    .sidebar .nav-badge { display: inline; }
    .sidebar .logo-img { display: block; }
    .sidebar .logo-icon-compact { display: none; }
    .sidebar .nav-item { justify-content: flex-start; }
    .main-content { margin-left: 0; }
    .topbar { left: 0; padding: 0 var(--space-3); }
    .mobile-toggle { display: flex; }
    .page-content { padding: var(--space-3); }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .topbar-search { display: none; }
    .user-info { display: none; }
    .page-header { flex-direction: column; align-items: flex-start; gap: var(--space-3); }
    .page-header .btn { width: 100%; justify-content: center; }
    .form-row { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .modal { width: 95%; border-radius: var(--radius-lg); }

    /* Table mobile improvements */
    .data-table thead th { padding: var(--space-2) var(--space-3); font-size: 0.7rem; }
    .data-table tbody td { padding: var(--space-2) var(--space-3); font-size: 0.8rem; }
    .table-wrapper { margin: 0 calc(-1 * var(--space-3)); border-radius: 0; }

    /* Card mobile */
    .card { border-radius: var(--radius-md); }
    .card-header { padding: var(--space-3) var(--space-4); }
    .card-header h3 { font-size: 0.95rem; }

    /* Stat cards mobile — compact app style */
    .stat-card { padding: var(--space-2) var(--space-3); }
    .stat-icon { width: 32px; height: 32px; margin-bottom: var(--space-1); }
    .stat-icon svg { width: 16px; height: 16px; }
    .stat-value { font-size: 1.1rem; }
    .stat-label { font-size: 0.7rem; }
    .stat-grid { gap: var(--space-2); }

    /* Hide redundant page header on mobile (topbar shows title) */
    .page-header-left p { display: none; }
    .page-header { margin-bottom: var(--space-2); }
    .page-header-left h1 { font-size: 1.3rem; }

    /* Button groups */
    .btn { font-size: 0.8rem; padding: 8px 14px; }
    .btn-sm { font-size: 0.75rem; padding: 5px 10px; }

    /* Forms */
    .form-label { font-size: 0.8rem; }
    .form-input, .form-select { font-size: 0.875rem; padding: 10px 12px; }

    /* Filter bars */
    form[style*="display:flex"][style*="gap"] { flex-wrap: wrap; }

    /* Action columns compact */
    td:last-child div[style*="display:flex"] { gap: 2px !important; }

    /* Product Picker modal mobile */
    .product-picker-modal .modal-content { width: 100%; height: 100%; max-height: 100vh; border-radius: 0; }

    /* Hide less critical table columns on mobile */
    .hide-mobile { display: none !important; }

    /* Dropdown overflow fix */
    .dropdown-menu { min-width: unset !important; width: calc(100vw - 24px); right: -8px !important; max-height: 60vh; }

    /* Alert messages */
    .alert { font-size: 0.85rem; padding: var(--space-2) var(--space-3); }
}

@media (max-width: 480px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-2); }
    .page-content { padding: var(--space-2); }
    .topbar { padding: 0 var(--space-2); }

    /* Even more compact tables */
    .data-table thead th { padding: var(--space-1) var(--space-2); font-size: 0.65rem; }
    .data-table tbody td { padding: var(--space-1) var(--space-2); font-size: 0.75rem; }

    /* Stack buttons vertically */
    .page-header-left h1 { font-size: 1.2rem; }
    .page-header-left p { font-size: 0.75rem; }

    /* Full-width buttons */
    .page-header > div:last-child { width: 100%; display: flex; flex-direction: column; gap: 6px; }
    .page-header > div:last-child .btn { width: 100%; justify-content: center; }

    /* Summary cards 2-column on small screens too */
    div[style*="grid-template-columns:repeat(auto-fit"],
    div[style*="grid-template-columns:repeat(3"] { grid-template-columns: repeat(2, 1fr) !important; }
}

/* --- Mobil Bottom Nav v2 --- */
.mob-nav { display: none; }
.mob-sheet { display: none; }
.mob-sheet-backdrop { display: none; }

@media (max-width: 768px) {
    .mob-nav {
        display: flex; align-items: center; justify-content: space-around;
        position: fixed; bottom: 0; left: 0; right: 0;
        background: var(--bg-sidebar);
        backdrop-filter: blur(22px) saturate(180%);
        -webkit-backdrop-filter: blur(22px) saturate(180%);
        border-top: 1px solid var(--border-color);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0)) 4px;
        z-index: 100;
        box-shadow: 0 -4px 18px -8px rgba(0,0,0,.12);
    }
    .mob-nav-btn {
        display: flex; flex-direction: column; align-items: center; gap: 3px;
        padding: 6px 10px; min-width: 56px;
        background: none; border: none; cursor: pointer;
        color: var(--text-secondary); font-size: 0.66rem; font-weight: 600;
        font-family: inherit;
        -webkit-tap-highlight-color: transparent;
        transition: all 0.18s ease;
        border-radius: 12px;
    }
    .mob-nav-btn svg { width: 22px; height: 22px; transition: transform .18s; }
    .mob-nav-btn.active { color: var(--color-primary); }
    .mob-nav-btn.active svg { transform: scale(1.08); }
    .mob-nav-btn.expanded {
        color: var(--color-primary); background: rgba(59,130,246,.08);
    }
    .mob-nav-btn.expanded svg { transform: translateY(-2px) scale(1.08); }
    .mob-nav-btn:active { transform: scale(.92); }

    /* Center FAB (+) hızlı işlemler */
    .mob-nav-fab {
        width: 56px; height: 56px; border-radius: 50%;
        background: linear-gradient(135deg, #3b82f6, #6366f1); color: #fff;
        border: 3px solid var(--bg-sidebar);
        cursor: pointer; flex-shrink: 0;
        display: flex; align-items: center; justify-content: center;
        margin-top: -22px;
        box-shadow: 0 6px 22px -4px rgba(59,130,246,.55), 0 2px 6px rgba(0,0,0,.12);
        transition: all 0.2s cubic-bezier(.2,.8,.2,1);
        -webkit-tap-highlight-color: transparent;
    }
    .mob-nav-fab svg { width: 26px; height: 26px; transition: transform .25s cubic-bezier(.2,.8,.2,1); }
    .mob-nav-fab:active { transform: scale(.92); }
    .mob-nav-fab.expanded { transform: rotate(45deg); }
    .mob-nav-fab.expanded svg { transform: scale(1.1); }

    /* Sheet backdrop */
    .mob-sheet-backdrop {
        display: block;
        position: fixed; inset: 0;
        background: rgba(15, 23, 42, 0.42);
        backdrop-filter: blur(6px);
        z-index: 99; opacity: 0; pointer-events: none;
        transition: opacity 0.22s ease;
    }
    .mob-sheet-backdrop.open { opacity: 1; pointer-events: auto; }

    /* Bottom action sheet */
    .mob-sheet {
        display: block;
        position: fixed; left: 0; right: 0;
        bottom: 0;
        background: var(--bg-card);
        border-top-left-radius: 22px; border-top-right-radius: 22px;
        padding: 8px 16px calc(24px + 70px + env(safe-area-inset-bottom, 0));
        z-index: 100;
        transform: translateY(110%);
        transition: transform 0.32s cubic-bezier(.2,.8,.2,1);
        box-shadow: 0 -10px 40px -10px rgba(0,0,0,.25);
        max-height: 75vh; overflow-y: auto;
    }
    .mob-sheet.open { transform: translateY(0); }

    .mob-sheet-grip {
        width: 38px; height: 4px; border-radius: 999px;
        background: var(--border-color);
        margin: 6px auto 14px;
    }
    .mob-sheet-title {
        font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em;
        margin-bottom: 14px; padding: 0 4px;
    }

    .mob-sheet-actions { display: grid; gap: 10px; }
    .mob-action {
        display: flex; align-items: center; gap: 14px;
        padding: 14px 16px;
        background: var(--bg-page);
        border: 1px solid var(--border-color);
        border-radius: 14px;
        text-decoration: none; color: var(--text-primary);
        transition: all 0.15s; -webkit-tap-highlight-color: transparent;
    }
    .mob-action:active { transform: scale(.97); }
    .mob-action.primary {
        background: linear-gradient(135deg, rgba(59,130,246,.08), rgba(99,102,241,.04));
        border-color: rgba(59,130,246,.2);
    }
    .mob-action-icon {
        flex-shrink: 0;
        width: 42px; height: 42px; border-radius: 11px;
        display: inline-flex; align-items: center; justify-content: center;
        font-size: 1.3rem;
        background: rgba(59,130,246,.10); color: #1d4ed8;
    }
    .mob-action-icon svg { width: 22px; height: 22px; }
    .mob-action.c-green .mob-action-icon { background: rgba(34,197,94,.12); color: #15803d; }
    .mob-action.c-amber .mob-action-icon { background: rgba(245,158,11,.12); color: #b45309; }
    .mob-action.c-red .mob-action-icon { background: rgba(239,68,68,.12); color: #991b1b; }
    .mob-action.c-purple .mob-action-icon { background: rgba(168,85,247,.12); color: #6b21a8; }
    .mob-action.c-teal .mob-action-icon { background: rgba(20,184,166,.12); color: #0f766e; }
    .mob-action.c-blue .mob-action-icon { background: rgba(59,130,246,.12); color: #1d4ed8; }
    .mob-action-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
    .mob-action-text strong { font-weight: 700; font-size: .95rem; letter-spacing: -0.01em; }
    .mob-action-text small { font-size: .76rem; color: var(--text-tertiary); }

    /* Sayfa içeriği bottom nav kadar yer bıraksın */
    .page-content { padding-bottom: 88px; }
}

/* Eski class adı geriye dönük uyumluluk için kalır */
.mobile-bottom-nav { display: none; }

/* --- Sidebar overlay for mobile --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: 150;
}

.sidebar-overlay.active { display: block; }

/* --- Tabs --- */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--space-6);
}

.tab-item {
    padding: var(--space-3) var(--space-5);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
    margin-bottom: -1px;
}

.tab-item:hover { color: var(--text-primary); }
.tab-item.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* --- Status Dots --- */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}
.status-dot.active { background: var(--color-success); }
.status-dot.inactive { background: var(--color-danger); }
.status-dot.pending { background: var(--color-warning); }

/* --- Column Picker --- */
.cpt { position: relative; display: flex; justify-content: flex-end; margin-bottom: 8px; }
.cpt-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px; border-radius: var(--radius-sm);
    background: var(--bg-card); border: 1px solid var(--border-primary);
    color: var(--text-secondary); font-size: 0.78rem; font-weight: 500;
    cursor: pointer; transition: all var(--transition-fast);
    font-family: var(--font-family); box-shadow: var(--shadow-sm);
}
.cpt-btn:hover, .cpt-btn.cpt-active { color: var(--color-primary); border-color: var(--color-primary); }
.cpt-chevron { transition: transform 0.2s; }
.cpt-btn.cpt-active .cpt-chevron { transform: rotate(180deg); }

.cpt-dropdown {
    display: none; position: absolute; top: calc(100% + 6px); right: 0;
    background: var(--bg-card); border: 1px solid var(--border-primary);
    border-radius: var(--radius-md); box-shadow: var(--shadow-dropdown);
    z-index: 80; min-width: 220px; overflow: hidden;
}
.cpt-dropdown.cpt-open { display: block; }

.cpt-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; border-bottom: 1px solid var(--border-primary);
    font-size: 0.72rem; font-weight: 600; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.04em;
}
.cpt-reset {
    background: none; border: none; color: var(--color-primary);
    font-size: 0.72rem; font-weight: 500; cursor: pointer;
    font-family: var(--font-family); padding: 2px 8px; border-radius: 4px;
}
.cpt-reset:hover { background: var(--color-primary-light); }

.cpt-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 14px; cursor: pointer; transition: background var(--transition-fast);
}
.cpt-row:hover { background: var(--bg-hover); }
.cpt-name { font-size: 0.82rem; font-weight: 500; color: var(--text-primary); transition: color 0.15s; }
.cpt-name.cpt-off { color: var(--text-tertiary); }

/* iOS-style toggle */
.cpt-toggle {
    width: 36px; height: 20px; border-radius: 10px; padding: 2px;
    background: var(--bg-tertiary); transition: background 0.2s; flex-shrink: 0;
}
.cpt-toggle.cpt-on { background: var(--color-primary); }
.cpt-knob {
    width: 16px; height: 16px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: transform 0.2s;
}
.cpt-toggle.cpt-on .cpt-knob { transform: translateX(16px); }

@media print { .cpt { display: none !important; } }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-tertiary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }
