@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ─── DARK THEME (Default) ─── */
:root,
[data-theme="dark"] {
    --bg: #0f0f0f;
    --bg-card: #1a1a1a;
    --bg-input: #252525;
    --bg-sidebar: #141414;
    --border: #2a2a2a;
    --text: #e5e5e5;
    --text-muted: #888;
    --text-heading: #ffffff;
    --accent: #f59e0b;
    --accent-hover: #d97706;
    --accent-bg: rgba(245,158,11,0.1);
    --accent-text: #000000;
    --danger: #ef4444;
    --success: #10b981;
    --info: #3b82f6;
    --purple: #8b5cf6;
    --pink: #ec4899;
    --cyan: #06b6d4;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 25px 60px rgba(0,0,0,0.5);
    --table-hover: #1f1f1f;
    --badge-opacity: 22;
    --login-gradient-1: #1a1000;
    --login-gradient-2: #1a0f00;
    --login-box-top: #1e1e1e;
    --scrollbar-thumb: #333;
    --modal-overlay: rgba(0,0,0,0.7);
}

/* ─── LIGHT THEME ─── */
[data-theme="light"] {
    --bg: #f0f2f5;
    --bg-card: #ffffff;
    --bg-input: #f5f5f7;
    --bg-sidebar: #ffffff;
    --border: #e0e0e0;
    --text: #1a1a2e;
    --text-muted: #64748b;
    --text-heading: #0f172a;
    --accent: #d97706;
    --accent-hover: #b45309;
    --accent-bg: rgba(217,119,6,0.08);
    --accent-text: #ffffff;
    --danger: #dc2626;
    --success: #059669;
    --info: #2563eb;
    --purple: #7c3aed;
    --pink: #db2777;
    --cyan: #0891b2;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 20px 50px rgba(0,0,0,0.12);
    --table-hover: #f8f9fb;
    --badge-opacity: 18;
    --login-gradient-1: #fef3c7;
    --login-gradient-2: #fff7ed;
    --login-box-top: #ffffff;
    --scrollbar-thumb: #c4c4c4;
    --modal-overlay: rgba(0,0,0,0.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow: hidden;
    height: 100vh;
    transition: background 0.35s ease, color 0.35s ease;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── LOGIN ─── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--login-gradient-1) 0%, var(--bg) 40%, var(--bg) 60%, var(--login-gradient-2) 100%);
    padding: 20px;
    transition: background 0.35s ease;
}

.login-box {
    width: 100%;
    max-width: 440px;
    background: linear-gradient(180deg, var(--login-box-top) 0%, var(--bg-card) 100%);
    border-radius: 20px;
    padding: 40px 36px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    animation: scaleIn 0.3s ease;
    transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

.login-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.login-logo .icon-box {
    background: var(--accent);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-logo span {
    font-size: 22px;
    font-weight: 800;
}

.login-logo .highlight { color: var(--accent); }

.login-tabs {
    display: flex;
    background: var(--bg-input);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 28px;
}

.login-tabs button {
    flex: 1;
    padding: 10px 0;
    border-radius: 8px;
    border: none;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    color: var(--text-muted);
}

.login-tabs button.active {
    background: var(--accent);
    color: #000;
}

/* ─── LAYOUT ─── */
.app-layout {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s ease, transform 0.3s ease, background 0.35s ease, border-color 0.35s ease;
    overflow: hidden;
    z-index: 50;
}

.sidebar.collapsed {
    width: 0;
}

.sidebar-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 260px;
}

.sidebar-logo {
    max-width: 150px;
    max-height: 40px;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Invert logo for dark theme */
[data-theme="dark"] .sidebar-logo {
    filter: brightness(0) invert(1);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
    min-width: 260px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 14px;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 2px;
    transition: all 0.2s;
    background: transparent;
    color: var(--text-muted);
    white-space: nowrap;
    text-decoration: none;
}

.nav-item:hover { background: var(--bg-input); }
.nav-item.active { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }

/* ─── Submenu ─── */
.nav-group { position: relative; }
.nav-parent { justify-content: flex-start; }
.nav-parent .submenu-chevron {
    margin-left: auto;
    width: 16px; height: 16px;
    transition: transform 0.25s ease;
}
.nav-parent .submenu-chevron.open { transform: rotate(180deg); }
.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.nav-submenu.open { max-height: 200px; }
.nav-child {
    padding-left: 46px !important;
    font-size: 13px;
    color: var(--text-muted);
}
.nav-child.active {
    background: var(--accent-bg);
    color: var(--accent);
    font-weight: 600;
}

.sidebar-footer {
    padding: 16px 14px;
    border-top: 1px solid var(--border);
    min-width: 260px;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--bg-input);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #000;
    font-size: 14px;
    flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-info .name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-info .role { font-size: 11px; color: var(--accent); font-weight: 600; }

/* Main content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-sidebar);
}

.top-bar .date {
    font-size: 13px;
    color: var(--text-muted);
    margin-left: auto;
}

.page-content {
    flex: 1;
    padding: 28px;
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
}

/* ─── COMPONENTS ─── */

/* Buttons */
.btn {
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-md { padding: 10px 18px; font-size: 14px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

.btn-primary { background: var(--accent); color: #000; }
.btn-danger { background: rgba(239,68,68,0.15); color: var(--danger); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-success { background: rgba(16,185,129,0.15); color: var(--success); }

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    transition: all 0.2s;
}

.btn-icon:hover { background: var(--bg-input); color: var(--text); }

/* Forms */
.form-field { margin-bottom: 16px; }
.form-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-muted);
}

input, select, textarea {
    font-family: inherit;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    width: 100%;
    transition: border-color 0.2s, background 0.35s ease, color 0.35s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
}

textarea { resize: vertical; min-height: 80px; }

select:not(.filter-select) {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

option { background: var(--bg-card); color: var(--text); }

.input-with-icon {
    position: relative;
}

.input-with-icon .icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.input-with-icon input { padding-left: 40px; }

.form-row {
    display: grid;
    gap: 12px;
}

.form-row-1 { grid-template-columns: 1fr; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h2 { font-size: 24px; font-weight: 800; color: var(--text-heading); }
.page-header p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

/* Search */
.search-bar {
    position: relative;
    margin-bottom: 20px;
    max-width: 360px;
}

.search-bar .icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-bar input { padding-left: 40px; }

/* Stat cards */
.stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 24px;
    border: 1px solid var(--border);
    flex: 1 1 200px;
    min-width: 180px;
    animation: fadeIn 0.3s ease;
    transition: background 0.35s ease, border-color 0.35s ease;
    box-shadow: var(--shadow);
}

.stat-card .stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 800;
}

.stat-card .stat-icon {
    padding: 10px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Data Table */
.table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 230px);
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: border-color 0.35s ease, box-shadow 0.35s ease;
    position: relative;
}

.data-table {
    width: 100%;
    min-width: max-content;
    border-collapse: collapse;
    background: var(--bg-card);
    transition: background 0.35s ease;
    table-layout: auto;
}

.data-table thead tr { background: var(--bg-input); }

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: var(--bg-input);
    z-index: 2;
    box-shadow: 0 1px 0 var(--border);
}

.data-table td {
    padding: 0;
    font-size: 13px;
    max-width: 160px;
}

.td-truncate {
    padding: 11px 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
    cursor: default;
}

/* Hover popup for truncated content */
.data-table td {
    padding: 0;
    font-size: 13px;
    max-width: 160px;
    position: relative;
}

.data-table td:hover .td-truncate {
    position: relative;
}

.data-table td:hover .td-truncate.is-overflowing::before {
    content: attr(title);
    position: absolute;
    left: 8px;
    bottom: calc(100% + 4px);
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    white-space: normal;
    max-width: 320px;
    min-width: 100px;
    word-break: break-word;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    z-index: 100;
    pointer-events: none;
    line-height: 1.5;
}

.data-table .actions-col { width: 100px; min-width: 100px; }

.data-table tbody tr {
    border-top: 1px solid var(--border);
    transition: background 0.15s;
}

.data-table tbody tr:hover { background: var(--table-hover); }

.data-table .actions {
    text-align: right;
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    padding: 8px 16px;
    white-space: nowrap;
}

.data-table .empty-row td {
    padding: 40px 16px;
    text-align: center;
    color: var(--text-muted);
    max-width: none;
}

/* Badge */
.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    display: inline-block;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--modal-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-overlay.hidden { display: none; }

.modal-box {
    background: var(--bg-card);
    border-radius: 16px;
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow: auto;
    border: 1px solid var(--border);
    animation: scaleIn 0.2s ease;
    box-shadow: var(--shadow-lg);
    transition: background 0.35s ease, border-color 0.35s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 18px; font-weight: 700; }

.modal-body { padding: 24px; }
.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Card */
.card {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: background 0.35s ease, border-color 0.35s ease;
}

.card h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-heading);
}

.card .row-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.card .row-item .label { color: var(--text-muted); }
.card .row-item .value { font-weight: 700; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Alert */
.alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
}

.alert-error { background: rgba(239,68,68,0.1); color: var(--danger); }
.alert-success { background: rgba(16,185,129,0.1); color: var(--success); }

/* Full-width login button */
.btn-login {
    width: 100%;
    padding: 14px 0;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-login:hover { background: var(--accent-hover); }
.btn-login:disabled { opacity: 0.7; cursor: wait; }

/* Forgot password */
.forgot-link {
    font-size: 13px;
    color: var(--accent);
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--text-muted);
}

.copyright {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 28px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Toast / Notification */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    animation: slideIn 0.3s ease;
    min-width: 280px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast-info { background: var(--info); color: #fff; }

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--text-muted);
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 12px;
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Pagination ─── */
/* ─── Pagination Premium ─── */
.pagination-wrapper {
    margin-top: 20px;
    animation: fadeIn 0.3s ease;
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
    gap: 16px;
    transition: background 0.35s, border-color 0.35s;
}

.pagination-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.pagination-summary {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
}

.pagination-highlight {
    color: var(--accent);
    font-size: 18px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.pagination-sep {
    color: var(--text-muted);
    opacity: 0.4;
    font-weight: 400;
}

.pagination-total {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 13px;
}

.pagination-progress {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-progress-track {
    width: 80px;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
}

.pagination-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #fb923c);
    border-radius: 3px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.pagination-percent {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    min-width: 32px;
}

.pagination-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pg-numbers {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px;
    background: var(--bg-input);
    border-radius: 10px;
}

.pg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pg-num {
    min-width: 36px;
    height: 34px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.pg-num:hover:not(.pg-active) {
    background: var(--bg-card);
    color: var(--accent);
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.pg-active {
    background: var(--accent) !important;
    color: #000 !important;
    font-weight: 800;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
    transform: scale(1.05);
}

[data-theme="light"] .pg-active {
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.3);
}

.pg-nav {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
}

.pg-nav:hover:not(.pg-disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-bg);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}

.pg-nav:active:not(.pg-disabled) {
    transform: scale(0.93);
}

.pg-disabled {
    opacity: 0.25;
    cursor: not-allowed;
    pointer-events: none;
}

.pg-dots {
    padding: 0 4px;
    color: var(--text-muted);
    font-size: 12px;
    letter-spacing: 2px;
    user-select: none;
    opacity: 0.5;
}

@media (max-width: 640px) {
    .pagination-bar { flex-direction: column; align-items: stretch; }
    .pagination-left { justify-content: center; }
    .pagination-right { justify-content: center; }
    .pagination-progress-track { width: 60px; }
}

/* ─── Filter Bar ─── */
.filter-bar {
    margin-bottom: 16px;
}

.filter-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    padding: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.filter-field {
    flex: 1 1 0;
    min-width: 80px;
}

.filter-field label {
    display: block;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    color: var(--accent);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-select {
    width: 100%;
    padding: 5px 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: inherit;
    font-size: 11px;
    cursor: pointer;
    transition: border-color 0.2s;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    background-color: var(--bg-input) !important;
    background-image: none !important;
    background-repeat: no-repeat !important;
    background-position: initial !important;
    background-size: initial !important;
    padding-right: 6px !important;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}
.filter-select::-ms-expand { display: none; }
[data-theme="light"] .filter-select {
    background-image: none !important;
}
.filter-select:focus {
    outline: none;
    border-color: var(--accent);
}
.filter-combo {
    cursor: text;
}
.filter-combo::placeholder {
    color: var(--text-muted);
    font-size: 10px;
}

.filter-bar-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.filter-clear-btn {
    padding: 7px 16px;
    border: none;
    border-radius: 8px;
    background: var(--danger);
    color: #fff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}
.filter-clear-btn:hover { opacity: 0.85; }

@media (max-width: 768px) {
    .filter-field { min-width: 60px; }
    .filter-field label { font-size: 8px; }
    .filter-select { font-size: 10px; padding: 4px 5px; }
}
@media (max-width: 480px) {
    .filter-grid { gap: 4px; padding: 8px; }
    .filter-field { min-width: 50px; }
}

/* ─── Customer Order Cart ─── */
.order-cart-summary {
    background: var(--bg-card);
    border: 2px solid var(--accent);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.cart-qty-input {
    width: 65px;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    text-align: center;
}
.cart-qty-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* ─── My Orders (Customer) ─── */
.my-order-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.my-order-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.my-order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.my-order-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.my-order-no {
    font-weight: 700;
    font-size: 15px;
    color: var(--accent);
}
.my-order-date {
    font-size: 12px;
    color: var(--text-muted);
}
.my-order-details {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px 16px;
    margin-bottom: 14px;
}
.my-order-detail {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.my-order-detail .label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
}
.my-order-detail .value {
    font-size: 13px;
    color: var(--text);
}
.my-order-shipment {
    background: var(--bg-input);
    border-radius: 8px;
    padding: 12px;
}
.my-order-ship-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.my-order-progress {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.my-order-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}
.my-order-ship-list {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.my-order-ship-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    padding: 6px 8px;
    background: var(--bg-card);
    border-radius: 6px;
    border: 1px solid var(--border);
}
.my-order-ship-item .ship-no {
    font-weight: 600;
    color: var(--accent);
}
.my-order-ship-item .ship-date {
    color: var(--text-muted);
}
.my-order-ship-item .ship-qty {
    font-weight: 600;
}
.my-order-ship-item .ship-track {
    color: var(--text-muted);
    font-size: 11px;
}
@media (max-width: 768px) {
    .my-order-details { grid-template-columns: repeat(2, 1fr); }
    .my-order-ship-item { flex-wrap: wrap; }
}

/* ─── Orders Grouped View ─── */
.ord-group-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow 0.2s;
}
.ord-group-card.new-order {
    border: 2px solid rgba(245,158,11,0.6);
    animation: newOrderPulse 2s ease-in-out infinite;
}
@keyframes newOrderPulse {
    0%   { border-color: rgba(245,158,11,0.3); box-shadow: 0 0 0 0 rgba(245,158,11,0); }
    50%  { border-color: rgba(245,158,11,0.8); box-shadow: 0 0 12px 2px rgba(245,158,11,0.15); }
    100% { border-color: rgba(245,158,11,0.3); box-shadow: 0 0 0 0 rgba(245,158,11,0); }
}
/* Bildirim popup */
.notif-overlay { position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.5);z-index:10000;display:flex;align-items:center;justify-content:center;animation:fadeIn 0.2s }
.notif-box { background:var(--bg-card);border-radius:16px;padding:32px;max-width:420px;width:90%;box-shadow:0 20px 60px rgba(0,0,0,0.3);text-align:center;animation:slideUp 0.3s }
.notif-box .notif-icon { width:56px;height:56px;border-radius:50%;background:rgba(245,158,11,0.12);display:inline-flex;align-items:center;justify-content:center;margin-bottom:16px }
.notif-box h3 { margin:0 0 8px;font-size:18px;color:var(--text) }
.notif-box p { margin:0 0 24px;color:var(--text-muted);font-size:14px;line-height:1.5 }
.notif-box .notif-actions { display:flex;gap:10px;justify-content:center }
.notif-box .notif-btn { padding:10px 24px;border-radius:10px;border:none;font-size:14px;font-weight:600;cursor:pointer;transition:all 0.2s }
.notif-box .notif-btn-primary { background:var(--accent);color:#fff }
.notif-box .notif-btn-primary:hover { filter:brightness(1.1) }
.notif-box .notif-btn-ghost { background:transparent;color:var(--text-muted);border:1px solid var(--border) }
.notif-box .notif-btn-ghost:hover { background:var(--bg-hover) }
@keyframes fadeIn { from{opacity:0}to{opacity:1} }
@keyframes slideUp { from{transform:translateY(20px);opacity:0}to{transform:translateY(0);opacity:1} }
.ord-group-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.ord-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.ord-group-header:hover {
    background: var(--bg-hover);
}
.ord-group-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.ord-group-chevron {
    color: var(--text-muted);
    transition: transform 0.25s ease;
    flex-shrink: 0;
}
.ord-group-chevron.expanded {
    transform: rotate(90deg);
}
.ord-group-no {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
}
.ord-group-customer {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-heading);
}
.ord-group-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}
.ord-group-right {
    display: flex;
    align-items: center;
    gap: 14px;
}
.ord-group-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.ord-group-count {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}
.ord-group-total {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-heading);
}
.ord-group-body {
    border-top: 1px solid var(--border);
    padding: 0;
}
.ord-group-body .table-wrapper {
    margin: 0;
    border-radius: 0;
}
.ord-group-body .data-table th,
.ord-group-body .data-table td {
    font-size: 12px;
}
.ord-group-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 18px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg-hover);
}
@media (max-width: 768px) {
    .ord-group-right { gap: 8px; }
    .ord-group-total { font-size: 12px; }
    .ord-group-header { padding: 10px 12px; }
}

/* ─── Order Tracking ─── */
.tracking-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
}
.tracking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.tracking-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.tracking-customer {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-heading);
}
.tracking-summary {
    font-size: 12px;
    color: var(--text-muted);
}
.tracking-header-right {
    text-align: right;
}
.tracking-pct {
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
}
.tracking-balance {
    font-size: 12px;
    font-weight: 600;
    margin-top: 2px;
}

/* ─── Clickable Rows ─── */
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: var(--accent-bg) !important; }

/* ─── WhatsApp Button ─── */
.whatsapp-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 8px;
    background: #25D366;
    color: #fff !important;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s;
}
.whatsapp-btn:hover {
    background: #1DA851;
    transform: scale(1.03);
    box-shadow: 0 2px 8px rgba(37,211,102,0.35);
}
.whatsapp-btn svg { flex-shrink: 0; }

/* ─── Detail Popup ─── */
.detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(6px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
    padding: 20px;
}
.detail-overlay.visible { opacity: 1; }

.detail-popup {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0,0,0,0.4);
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.detail-overlay.visible .detail-popup {
    transform: scale(1) translateY(0);
}

.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.detail-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}
.detail-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-input);
    color: var(--text-muted);
    border-radius: 10px;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.detail-close:hover { background: var(--danger); color: #fff; }

.detail-body {
    display: flex;
    gap: 24px;
    padding: 24px;
}

.detail-image-section {
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.detail-img {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: 12px;
    border: 2px solid var(--border);
    cursor: zoom-in;
    transition: transform 0.2s, box-shadow 0.2s;
}
.detail-img:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 24px rgba(245,158,11,0.2);
    border-color: var(--accent);
}

.detail-img-placeholder {
    width: 200px;
    height: 200px;
    border-radius: 12px;
    border: 2px dashed var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 13px;
    background: var(--bg-input);
}

.detail-info-section {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    align-content: start;
}

.detail-field {
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--bg-input);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.detail-field:last-child,
.detail-field:nth-last-child(2):nth-child(odd) {
    grid-column: span 1;
}

.detail-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
}
.detail-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    word-break: break-word;
}

.detail-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ─── Image Fullscreen ─── */
.image-fullscreen {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}
.image-fullscreen img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
}
.image-full-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 28px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─── Image Upload in Modal ─── */
.image-upload-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.image-upload-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
}
.image-upload-area {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}
#image-preview {
    min-width: 120px;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.image-upload-empty {
    width: 120px;
    height: 90px;
    border-radius: 8px;
    border: 2px dashed var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 11px;
    background: var(--bg-input);
}
.image-upload-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 4px;
}

/* ─── Detail Responsive ─── */
@media (max-width: 640px) {
    .detail-body { flex-direction: column; }
    .detail-image-section { flex: none; align-self: center; }
    .detail-info-section { grid-template-columns: 1fr; }
    .detail-popup { max-width: 100%; margin: 10px; }
}

/* ─── Theme Toggle ─── */
.theme-toggle {
    position: relative;
    width: 52px;
    height: 28px;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.35s ease, box-shadow 0.35s ease;
    flex-shrink: 0;
}

[data-theme="dark"] .theme-toggle {
    background: #2a2a3a;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.4);
}

[data-theme="light"] .theme-toggle {
    background: #dbeafe;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.theme-toggle .toggle-track {
    position: absolute;
    inset: 0;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
}

.theme-toggle .toggle-thumb {
    position: absolute;
    top: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: left 0.35s cubic-bezier(0.68, -0.15, 0.265, 1.35), background 0.35s ease, box-shadow 0.35s ease;
}

[data-theme="dark"] .theme-toggle .toggle-thumb {
    left: 3px;
    background: #1e1b4b;
    box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

[data-theme="light"] .theme-toggle .toggle-thumb {
    left: 27px;
    background: #f59e0b;
    box-shadow: 0 1px 4px rgba(245,158,11,0.4);
}

.theme-toggle .toggle-icon {
    width: 14px;
    height: 14px;
}

[data-theme="dark"] .theme-toggle .sun-icon { display: none; }
[data-theme="dark"] .theme-toggle .moon-icon { display: block; color: #a5b4fc; }
[data-theme="light"] .theme-toggle .sun-icon { display: block; color: #ffffff; }
[data-theme="light"] .theme-toggle .moon-icon { display: none; }

/* Login theme toggle */
.login-theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
}

/* Light theme specific overrides for better readability */
[data-theme="light"] .login-logo span { color: var(--text-heading); }
[data-theme="light"] h1 { color: var(--text-heading); }
[data-theme="light"] .user-info .name { color: var(--text-heading); }
[data-theme="light"] .stat-card .stat-label { color: var(--text-muted); }
[data-theme="light"] .nav-item { color: #475569; }
[data-theme="light"] .nav-item.active { color: var(--accent); }
[data-theme="light"] .data-table th { color: #475569; background: var(--bg-input); }
[data-theme="light"] .data-table td { color: var(--text); }
[data-theme="light"] .btn-ghost { border-color: var(--border); color: #475569; }
[data-theme="light"] .btn-ghost:hover { background: var(--bg-input); color: var(--text-heading); }
[data-theme="light"] .btn-primary { background: var(--accent); color: #fff; }
[data-theme="light"] .btn-login { color: #fff; }
[data-theme="light"] .login-tabs button { color: #475569; }
[data-theme="light"] .login-tabs button.active { background: var(--accent); color: #fff; }
[data-theme="light"] .form-field label { color: #475569; }
[data-theme="light"] input::placeholder { color: #94a3b8; }
[data-theme="light"] textarea::placeholder { color: #94a3b8; }
[data-theme="light"] .user-avatar { background: var(--accent); color: #fff; }
[data-theme="light"] .modal-header h3 { color: var(--text-heading); }
[data-theme="light"] .copyright { color: #94a3b8; }
[data-theme="light"] .top-bar { background: var(--bg-card); border-bottom: 1px solid var(--border); }
[data-theme="light"] .sidebar-header { border-bottom: 1px solid var(--border); }
[data-theme="light"] .sidebar-footer { border-top: 1px solid var(--border); }
[data-theme="light"] .user-card { background: var(--bg-input); }
[data-theme="light"] .toast-success { background: var(--success); }
[data-theme="light"] .toast-error { background: var(--danger); }
[data-theme="light"] .card .row-item .label { color: #475569; }
[data-theme="light"] .card .row-item .value { color: var(--text-heading); }
[data-theme="light"] .remember-me { color: #475569; }
[data-theme="light"] .forgot-link { color: var(--accent); }
[data-theme="light"] .alert-error { background: rgba(220,38,38,0.08); color: var(--danger); }
[data-theme="light"] .alert-success { background: rgba(5,150,105,0.08); color: var(--success); }
[data-theme="light"] .td-truncate.is-overflowing:hover::before { box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
[data-theme="light"] select:not(.filter-select) {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23475569' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar { position: fixed; left: 0; top: 0; z-index: 100; }
    .sidebar.collapsed { transform: translateX(-100%); width: 260px; }
    .form-row-1, .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .stats-grid { flex-direction: column; }
    .page-content { padding: 16px; }
}