/* =========== Reset & Base =========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1f2937;
    background: #f5f7fb;
    -webkit-font-smoothing: antialiased;
}
a { color: #4f46e5; text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; border: 0; background: transparent; }
input, select, textarea { font-family: inherit; }

/* =========== Login Page =========== */
.login-wrapper {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #fff;
}
.login-hero {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #ec4899 100%);
    color: #fff;
    padding: 60px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.login-hero::before {
    content: '';
    position: absolute;
    top: -100px; right: -100px;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.15), transparent 70%);
    border-radius: 50%;
}
.login-hero::after {
    content: '';
    position: absolute;
    bottom: -150px; left: -100px;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(255,255,255,0.1), transparent 70%);
    border-radius: 50%;
}
.login-hero .content { position: relative; z-index: 1; }
.login-hero .brand {
    display: flex; align-items: center; gap: 14px;
    font-size: 22px; font-weight: 700;
}
.login-hero .brand .logo {
    width: 48px; height: 48px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    backdrop-filter: blur(10px);
}
.login-hero h1 {
    font-size: 38px; font-weight: 700;
    line-height: 1.2; margin: 60px 0 16px;
    letter-spacing: -0.02em;
}
.login-hero p { font-size: 16px; opacity: 0.9; max-width: 400px; line-height: 1.6; }
.login-hero .features { margin-top: 40px; display: grid; gap: 14px; }
.login-hero .feature { display: flex; align-items: center; gap: 12px; opacity: 0.95; font-size: 14px; }
.login-hero .feature .ico {
    width: 32px; height: 32px;
    background: rgba(255,255,255,0.2);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.login-hero .footer { position: relative; z-index: 1; font-size: 12px; opacity: 0.7; }

.login-form-side {
    display: flex; align-items: center; justify-content: center;
    padding: 40px;
}
.login-form { width: 100%; max-width: 400px; }
.login-form h2 { font-size: 26px; font-weight: 700; color: #0f172a; }
.login-form .subtitle { color: #6b7280; font-size: 14px; margin: 8px 0 32px; }
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block; font-size: 13px; font-weight: 500;
    color: #374151; margin-bottom: 6px;
}
.form-control {
    width: 100%; padding: 11px 14px;
    border: 1.5px solid #e5e7eb; border-radius: 8px;
    font-size: 14px; transition: all 0.15s ease;
    background: #fff;
}
.form-control:focus {
    outline: 0; border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.password-wrapper { position: relative; }
.password-wrapper .toggle-eye {
    position: absolute; top: 50%; right: 12px;
    transform: translateY(-50%);
    color: #9ca3af; padding: 4px;
    display: flex; align-items: center;
}
.password-wrapper .toggle-eye:hover { color: #4f46e5; }
.password-wrapper .form-control { padding-right: 44px; }

.form-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; font-size: 13px; }
.form-row label { display: flex; align-items: center; gap: 6px; cursor: pointer; color: #374151; }
.form-row input[type=checkbox] { accent-color: #4f46e5; width: 16px; height: 16px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 20px; border-radius: 8px;
    font-size: 14px; font-weight: 600;
    transition: all 0.15s ease;
    cursor: pointer; border: 0;
}
.btn-primary { background: #4f46e5; color: #fff; }
.btn-primary:hover { background: #4338ca; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3); }
.btn-block { width: 100%; }
.btn-secondary { background: #f3f4f6; color: #374151; }
.btn-secondary:hover { background: #e5e7eb; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.alert {
    padding: 12px 14px; border-radius: 8px;
    font-size: 13px; margin-bottom: 16px;
    display: flex; align-items: start; gap: 10px;
}
.alert-danger { background: #fee2e2; color: #991b1b; border-left: 3px solid #dc2626; }
.alert-info { background: #dbeafe; color: #1e40af; border-left: 3px solid #3b82f6; }
.alert-success { background: #d1fae5; color: #065f46; border-left: 3px solid #10b981; }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 3px solid #f59e0b; }

.test-creds {
    margin-top: 24px; padding: 14px;
    background: #f9fafb; border-radius: 8px;
    border: 1px dashed #d1d5db;
    font-size: 12px; color: #6b7280; line-height: 1.8;
}
.test-creds strong { color: #374151; display: block; margin-bottom: 6px; }
.test-creds code { background: #fff; padding: 2px 6px; border-radius: 4px; color: #4f46e5; font-size: 11px; }

@media (max-width: 900px) {
    .login-wrapper { grid-template-columns: 1fr; }
    .login-hero { padding: 40px 30px; min-height: 240px; }
    .login-hero h1 { font-size: 28px; margin-top: 30px; }
    .login-hero .features { display: none; }
}

/* =========== App Layout =========== */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: 260px; background: #fff;
    border-right: 1px solid #e5e7eb;
    position: fixed; top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    transition: transform 0.25s ease;
    z-index: 30;
}
.sidebar-brand {
    padding: 20px 22px;
    display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid #f1f5f9;
}
.sidebar-brand .logo {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 18px;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
}
.sidebar-brand .name { font-weight: 700; font-size: 15px; color: #0f172a; }
.sidebar-brand .sub { font-size: 11px; color: #94a3b8; }

.sidebar-nav { padding: 14px 0; }
.sidebar-section {
    padding: 0 22px; margin-top: 18px; margin-bottom: 6px;
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.05em;
    color: #94a3b8;
}
.sidebar-link {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 22px; margin: 1px 10px; border-radius: 8px;
    color: #475569; font-size: 13.5px; font-weight: 500;
    text-decoration: none; transition: all 0.12s ease;
}
.sidebar-link:hover { background: #f1f5f9; color: #1e293b; text-decoration: none; }
.sidebar-link.active { background: #eef2ff; color: #4f46e5; font-weight: 600; }
.sidebar-link.active .ico { color: #4f46e5; }
.sidebar-link .ico { width: 18px; height: 18px; flex-shrink: 0; color: #94a3b8; }
.sidebar-link .badge {
    margin-left: auto; padding: 2px 7px;
    background: #ef4444; color: #fff;
    border-radius: 10px; font-size: 10px; font-weight: 700;
}

/* Main */
.main { margin-left: 260px; flex: 1; min-width: 0; transition: margin-left 0.25s ease; }
.topbar {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 26px; height: 62px;
    display: flex; align-items: center; gap: 18px;
    position: sticky; top: 0; z-index: 20;
    backdrop-filter: blur(8px);
    background: rgba(255,255,255,0.95);
}
.topbar .menu-toggle {
    display: none; padding: 8px;
    color: #64748b; border-radius: 6px;
}
.topbar .menu-toggle:hover { background: #f1f5f9; }
.topbar .search {
    flex: 1; max-width: 420px; position: relative;
}
.topbar .search input {
    width: 100%; padding: 9px 14px 9px 38px;
    border: 1px solid #e5e7eb; border-radius: 8px;
    font-size: 13px; background: #f9fafb;
}
.topbar .search input:focus { outline: 0; border-color: #4f46e5; background: #fff; box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08); }
.topbar .search .ico { position: absolute; top: 50%; left: 12px; transform: translateY(-50%); color: #94a3b8; }

.topbar .clock {
    display: flex; flex-direction: column; align-items: flex-end;
    font-size: 12px; color: #64748b; line-height: 1.3;
}
.topbar .clock .time { font-weight: 700; color: #0f172a; font-size: 14px; font-variant-numeric: tabular-nums; }

.topbar .icon-btn {
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    color: #475569; border-radius: 8px;
    transition: all 0.15s ease;
    position: relative;
}
.topbar .icon-btn:hover { background: #f1f5f9; color: #4f46e5; }
.topbar .icon-btn .dot {
    position: absolute; top: 7px; right: 7px;
    width: 8px; height: 8px;
    background: #ef4444; border-radius: 50%;
    border: 2px solid #fff;
}
.topbar .icon-btn .count {
    position: absolute; top: 4px; right: 4px;
    min-width: 17px; height: 17px;
    background: #ef4444; color: #fff;
    border-radius: 9px; font-size: 10px;
    font-weight: 700; padding: 0 4px;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid #fff;
}

.user-menu {
    position: relative;
    display: flex; align-items: center; gap: 10px;
    padding: 6px 10px 6px 6px;
    border-radius: 24px; cursor: pointer;
    transition: background 0.15s ease;
}
.user-menu:hover { background: #f1f5f9; }
.user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
}
.user-info { line-height: 1.2; }
.user-info .name { font-weight: 600; font-size: 13px; color: #0f172a; }
.user-info .role { font-size: 11px; color: #94a3b8; }

.dropdown { position: relative; }
.dropdown-menu {
    position: absolute; top: calc(100% + 6px); right: 0;
    min-width: 240px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    padding: 6px; z-index: 50;
    display: none;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 6px;
    color: #475569; font-size: 13px;
    text-decoration: none;
}
.dropdown-item:hover { background: #f5f7fb; color: #1e293b; text-decoration: none; }
.dropdown-divider { height: 1px; background: #f1f5f9; margin: 6px 0; }
.dropdown-header { padding: 12px; border-bottom: 1px solid #f1f5f9; font-size: 13px; font-weight: 600; color: #0f172a; display: flex; justify-content: space-between; align-items: center; }
.dropdown-header .clear { font-size: 11px; color: #4f46e5; font-weight: 500; cursor: pointer; }

.notif-item {
    display: flex; gap: 12px; padding: 12px;
    border-bottom: 1px solid #f8fafc;
    cursor: pointer; transition: background 0.12s;
}
.notif-item:hover { background: #f9fafb; }
.notif-item .notif-ico {
    width: 36px; height: 36px; border-radius: 8px;
    flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    background: #fef3c7; color: #d97706;
}
.notif-item.danger .notif-ico { background: #fee2e2; color: #dc2626; }
.notif-item.success .notif-ico { background: #d1fae5; color: #059669; }
.notif-item .notif-body { flex: 1; min-width: 0; }
.notif-item .notif-title { font-size: 13px; font-weight: 600; color: #0f172a; }
.notif-item .notif-text { font-size: 12px; color: #64748b; margin-top: 2px; }
.notif-item .notif-time { font-size: 11px; color: #94a3b8; margin-top: 4px; }

.content { padding: 24px 28px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 22px; font-weight: 700; color: #0f172a; letter-spacing: -0.01em; }
.page-header .breadcrumb { font-size: 12px; color: #94a3b8; margin-top: 2px; }
.page-header .breadcrumb a { color: #64748b; }

/* Cards & Stats */
.card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    display: flex; align-items: center; justify-content: space-between;
}
.card-header h2 { font-size: 15px; font-weight: 600; color: #0f172a; }
.card-header .actions { display: flex; gap: 8px; }
.card-body { padding: 20px; }
.card + .card { margin-top: 20px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.stat-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 18px 20px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
    position: relative;
    overflow: hidden;
}
.stat-card .stat-ico {
    width: 44px; height: 44px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 14px;
}
.stat-card.indigo .stat-ico { background: #eef2ff; color: #4f46e5; }
.stat-card.green  .stat-ico { background: #d1fae5; color: #059669; }
.stat-card.amber  .stat-ico { background: #fef3c7; color: #d97706; }
.stat-card.rose   .stat-ico { background: #ffe4e6; color: #e11d48; }
.stat-card.blue   .stat-ico { background: #dbeafe; color: #2563eb; }
.stat-card.purple .stat-ico { background: #f3e8ff; color: #9333ea; }
.stat-card.gray   .stat-ico { background: #f1f5f9; color: #475569; }

.stat-card .label { font-size: 12px; color: #64748b; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-card .value { font-size: 26px; font-weight: 700; color: #0f172a; margin-top: 4px; letter-spacing: -0.02em; }
.stat-card .sub { font-size: 12px; color: #94a3b8; margin-top: 6px; line-height: 1.4; }
.stat-card .sub.danger { color: #dc2626; }
.stat-card .trend { font-size: 12px; margin-top: 6px; display: inline-flex; align-items: center; gap: 4px; }
.stat-card .trend.up { color: #059669; }
.stat-card .trend.down { color: #dc2626; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { background: #f9fafb; font-weight: 600; color: #475569; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
th, td { padding: 11px 16px; text-align: left; border-bottom: 1px solid #f1f5f9; font-size: 13.5px; }
tbody tr { transition: background 0.12s; }
tbody tr:hover td { background: #fafbff; }
td code { background: #f1f5f9; padding: 2px 7px; border-radius: 4px; font-size: 12px; color: #475569; font-family: 'SF Mono', Monaco, Consolas, monospace; }

.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 9px; border-radius: 12px;
    font-size: 11px; font-weight: 600;
}
.badge-green { background: #d1fae5; color: #065f46; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-rose { background: #ffe4e6; color: #9f1239; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-indigo { background: #eef2ff; color: #4338ca; }
.badge-blue { background: #dbeafe; color: #1e40af; }

.empty-state { text-align: center; padding: 50px 20px; color: #94a3b8; }
.empty-state .ico { font-size: 32px; margin-bottom: 8px; opacity: 0.5; }

.filters-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; padding: 16px 20px; border-bottom: 1px solid #f1f5f9; background: #fafbfd; border-radius: 12px 12px 0 0; }
.filter-field { display: flex; flex-direction: column; gap: 4px; }
.filter-field label { font-size: 11px; color: #64748b; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.filter-field input, .filter-field select { padding: 8px 12px; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 13px; background: #fff; min-width: 200px; }
.filter-field input:focus, .filter-field select:focus { outline: 0; border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08); }

.pagination { display: flex; gap: 4px; justify-content: center; padding: 16px; flex-wrap: wrap; }
.pagination span, .pagination a { padding: 6px 11px; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 12px; color: #475569; min-width: 32px; text-align: center; }
.pagination a:hover { border-color: #4f46e5; color: #4f46e5; text-decoration: none; }
.pagination .active span { background: #4f46e5; color: #fff; border-color: #4f46e5; }

/* Mobile */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); box-shadow: 4px 0 24px rgba(0,0,0,0.08); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .topbar .menu-toggle { display: flex; }
    .topbar .clock .date-text { display: none; }
    .user-info { display: none; }
}
.sidebar-overlay { display: none; }
@media (max-width: 1024px) {
    .sidebar.open + .main .sidebar-overlay,
    body.sidebar-open .sidebar-overlay {
        display: block; position: fixed; inset: 0;
        background: rgba(15, 23, 42, 0.4); z-index: 25;
    }
}
