/* ============================================
   Sales CRM — Production Design System
   Stripe-grade polish: precise typography,
   4px spacing grid, WCAG AA contrast,
   restrained motion, systematic color tokens
   ============================================ */

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

/* ===================================================
   DESIGN TOKENS
   =================================================== */
:root {
    /* ── Brand ── */
    --color-primary: #1e40af;
    --color-primary-hover: #1e3a8a;
    --color-primary-light: rgba(30, 64, 175, 0.06);
    --color-primary-ring: rgba(30, 64, 175, 0.25);

    /* ── Semantic ── */
    --color-success: #0ea371;
    --color-success-light: rgba(14, 163, 113, 0.06);
    --color-warning: #e5930e;
    --color-warning-light: rgba(229, 147, 14, 0.06);
    --color-danger: #df1b41;
    --color-danger-light: rgba(223, 27, 65, 0.06);
    --color-info: #0573e8;
    --color-info-light: rgba(5, 115, 232, 0.06);
    --color-violet: #7c5cfc;
    --color-violet-light: rgba(124, 92, 252, 0.06);
    --color-cyan: #0891b2;
    --color-cyan-light: rgba(8, 145, 178, 0.06);

    /* ── Surfaces ── */
    --color-bg: #f6f8fa;
    --color-bg-elevated: #ffffff;
    --color-bg-subtle: #f0f2f5;
    --color-bg-muted: #e3e5e8;
    --color-bg-sidebar: #0f172a;
    --color-bg-sidebar-hover: rgba(255, 255, 255, 0.07);
    --color-bg-sidebar-active: rgba(59, 130, 246, 0.18);

    /* ── Text (WCAG AA on white) ── */
    --color-text-primary: #1a1f36;
    --color-text-secondary: #525f7f;
    --color-text-tertiary: #8792a2;
    --color-text-white: #ffffff;
    --color-text-sidebar: rgba(255, 255, 255, 0.55);
    --color-text-sidebar-active: #ffffff;

    /* ── Borders ── */
    --color-border: #e3e8ee;
    --color-border-light: #f0f2f5;

    /* ── Shadows (Stripe-style: tight, low-opacity) ── */
    --shadow-xs: 0 1px 1px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 8px -2px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.08), 0 4px 8px -2px rgba(0, 0, 0, 0.03);
    --shadow-xl: 0 24px 48px -8px rgba(0, 0, 0, 0.10), 0 8px 16px -4px rgba(0, 0, 0, 0.04);
    --shadow-btn-primary: 0 1px 3px rgba(30, 64, 175, 0.25), 0 1px 2px rgba(0, 0, 0, 0.08);
    --shadow-btn-primary-hover: 0 4px 12px rgba(30, 64, 175, 0.30), 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-ring: 0 0 0 3px var(--color-primary-ring);

    /* ── Radii ── */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 9999px;

    /* ── Layout ── */
    --sidebar-width: 248px;
    --header-height: 56px;

    /* ── Motion ── */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --duration-fast: 0.12s;
    --duration: 0.18s;
    --duration-slow: 0.25s;

    /* ── Typography Scale (px) ── */
    --text-xs: 11px;
    --text-sm: 12px;
    --text-base: 13px;
    --text-md: 14px;
    --text-lg: 15px;
    --text-xl: 17px;
    --text-2xl: 20px;
    --text-3xl: 24px;
    --text-4xl: 32px;
}

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

html {
    font-size: var(--text-md);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, 'Segoe UI', sans-serif;
    background: var(--color-bg);
    color: var(--color-text-primary);
    line-height: 1.5;
}

a { text-decoration: none; color: inherit; }

::selection {
    background: rgba(30, 64, 175, 0.15);
    color: var(--color-text-primary);
}

/* ===================================================
   LAYOUT
   =================================================== */
.app-layout { display: flex; min-height: 100vh; }

/* ===================================================
   SIDEBAR
   =================================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-bg-sidebar);
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 3px; }

.sidebar-logo {
    padding: 20px 20px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo .logo-icon {
    width: 32px;
    height: 32px;
    background: var(--color-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-md);
    color: white;
    font-weight: 800;
    flex-shrink: 0;
}

.sidebar-logo .logo-text {
    color: var(--color-text-white);
    font-size: var(--text-lg);
    font-weight: 700;
    letter-spacing: -0.4px;
}

.sidebar-nav { padding: 8px; flex: 1; }

.sidebar-section { margin-bottom: 4px; }

.sidebar-section-title {
    padding: 20px 12px 6px;
    font-size: var(--text-xs);
    font-weight: 600;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--color-text-sidebar);
    font-size: var(--text-base);
    font-weight: 500;
    transition: background var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease);
    cursor: pointer;
    position: relative;
    margin-bottom: 1px;
}

.sidebar-item:hover {
    background: var(--color-bg-sidebar-hover);
    color: rgba(255, 255, 255, 0.9);
}

.sidebar-item.active {
    background: var(--color-bg-sidebar-active);
    color: var(--color-text-sidebar-active);
    font-weight: 600;
}

.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    background: var(--color-primary);
    border-radius: 0 2px 2px 0;
}

.sidebar-item .icon {
    font-size: var(--text-md);
    width: 20px;
    text-align: center;
    opacity: 0.55;
    flex-shrink: 0;
}

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

.sidebar-item .badge {
    margin-left: auto;
    background: var(--color-danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    min-width: 18px;
    text-align: center;
    line-height: 1.6;
}

.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: background var(--duration-fast) var(--ease);
}

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

.sidebar-user .avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--text-xs);
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-user .user-info { flex: 1; min-width: 0; }

.sidebar-user .user-name {
    color: rgba(255, 255, 255, 0.88);
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1.3;
}

.sidebar-user .user-role {
    color: rgba(255, 255, 255, 0.35);
    font-size: var(--text-xs);
    font-weight: 500;
}

/* ===================================================
   MAIN CONTENT
   =================================================== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
}

.main-header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.main-header .page-title {
    font-size: var(--text-lg);
    font-weight: 650;
    color: var(--color-text-primary);
    letter-spacing: -0.2px;
}

.main-header .header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.main-body {
    padding: 28px;
    max-width: 1280px;
}

/* ===================================================
   CARDS
   =================================================== */
.card {
    background: var(--color-bg-elevated);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
}

.card-header h3 {
    font-size: var(--text-md);
    font-weight: 650;
    color: var(--color-text-primary);
    letter-spacing: -0.15px;
}

.card-body { padding: 16px 20px; }

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--color-border-light);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ===================================================
   BENTO GRID
   =================================================== */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.bento-card {
    background: var(--color-bg-elevated);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 140px;
}

.bento-card:hover {
    border-color: var(--color-border);
    box-shadow: var(--shadow-sm);
}

.bento-card .bento-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-md);
    margin-bottom: 16px;
}

.bento-card .bento-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bento-card .bento-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.1;
    color: var(--color-text-primary);
    font-variant-numeric: tabular-nums;
}

.bento-card .bento-value .unit {
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--color-text-tertiary);
    margin-left: 1px;
    letter-spacing: 0;
}

.bento-card .bento-sub {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.bento-card .bento-sub .trend-up { color: var(--color-success); font-weight: 600; }
.bento-card .bento-sub .trend-down { color: var(--color-danger); font-weight: 600; }

/* Card themes */
.bento-card.theme-primary .bento-icon { background: var(--color-primary-light); color: var(--color-primary); }
.bento-card.theme-primary:hover { border-color: rgba(30, 64, 175, 0.20); }
.bento-card.theme-warning .bento-icon { background: var(--color-warning-light); color: var(--color-warning); }
.bento-card.theme-warning:hover { border-color: rgba(229, 147, 14, 0.20); }
.bento-card.theme-info .bento-icon { background: var(--color-info-light); color: var(--color-info); }
.bento-card.theme-info:hover { border-color: rgba(5, 115, 232, 0.20); }
.bento-card.theme-success .bento-icon { background: var(--color-success-light); color: var(--color-success); }
.bento-card.theme-success:hover { border-color: rgba(14, 163, 113, 0.20); }
.bento-card.theme-danger .bento-icon { background: var(--color-danger-light); color: var(--color-danger); }
.bento-card.theme-danger:hover { border-color: rgba(223, 27, 65, 0.20); }
.bento-card.theme-violet .bento-icon { background: var(--color-violet-light); color: var(--color-violet); }
.bento-card.theme-violet:hover { border-color: rgba(124, 92, 252, 0.20); }
.bento-card.theme-cyan .bento-icon { background: var(--color-cyan-light); color: var(--color-cyan); }
.bento-card.theme-cyan:hover { border-color: rgba(8, 145, 178, 0.20); }

/* Hero card (2 cols) */
.bento-card.bento-hero {
    grid-column: span 2;
    background: var(--color-primary);
    border: none;
    color: white;
    min-height: 152px;
}

.bento-card.bento-hero .bento-icon { background: rgba(255, 255, 255, 0.18); color: white; }
.bento-card.bento-hero .bento-label { color: rgba(255, 255, 255, 0.65); }
.bento-card.bento-hero .bento-value { color: white; font-size: var(--text-4xl); }
.bento-card.bento-hero .bento-value .unit { color: rgba(255, 255, 255, 0.55); }
.bento-card.bento-hero .bento-sub { color: rgba(255, 255, 255, 0.50); }
.bento-card.bento-hero:hover { box-shadow: 0 8px 24px rgba(30, 64, 175, 0.20); }

/* Wide card (2 cols) */
.bento-card.bento-wide { grid-column: span 2; }

/* ===================================================
   DASHBOARD GRID
   =================================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.dashboard-grid .full-width { grid-column: span 2; }

/* Section header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-title {
    font-size: var(--text-md);
    font-weight: 650;
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title .section-icon {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
}

/* Legacy stat cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--color-bg-elevated);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    border: 1px solid var(--color-border);
    transition: box-shadow var(--duration) var(--ease);
}

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

.stat-card .stat-label {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.stat-card .stat-value {
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.3px;
    font-variant-numeric: tabular-nums;
}

.stat-card .stat-value .unit {
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-left: 2px;
}

.stat-card.primary { border-left: 3px solid var(--color-primary); }
.stat-card.success { border-left: 3px solid var(--color-success); }
.stat-card.warning { border-left: 3px solid var(--color-warning); }
.stat-card.danger { border-left: 3px solid var(--color-danger); }
.stat-card.info { border-left: 3px solid var(--color-info); }

/* ===================================================
   BUTTONS
   =================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    font-weight: 600;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease), opacity var(--duration-fast) var(--ease);
    white-space: nowrap;
    line-height: 1.4;
    user-select: none;
}

.btn:active { opacity: 0.85; }

.btn-primary {
    background: var(--color-primary);
    color: white;
    box-shadow: var(--shadow-btn-primary);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    box-shadow: var(--shadow-btn-primary-hover);
}

.btn-secondary {
    background: var(--color-bg-elevated);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
    background: var(--color-bg-subtle);
}

.btn-success {
    background: var(--color-success);
    color: white;
    box-shadow: 0 1px 3px rgba(14, 163, 113, 0.25);
}

.btn-success:hover { background: #0c8c61; }

.btn-danger {
    background: var(--color-danger);
    color: white;
    box-shadow: 0 1px 3px rgba(223, 27, 65, 0.25);
}

.btn-danger:hover { background: #c4183c; }

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

.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
}

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

.btn-outline-primary {
    background: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-border);
}

.btn-outline-primary:hover {
    background: var(--color-primary-light);
    border-color: rgba(30, 64, 175, 0.25);
}

.btn-sm {
    padding: 4px 10px;
    font-size: var(--text-sm);
    border-radius: var(--radius-xs);
}

.btn-lg {
    padding: 10px 20px;
    font-size: var(--text-lg);
    border-radius: var(--radius-md);
}

.btn-icon { padding: 6px; width: 32px; height: 32px; }

/* ===================================================
   TABLES
   =================================================== */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    background: var(--color-bg-elevated);
}

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

thead th {
    background: var(--color-bg-subtle);
    padding: 8px 16px;
    text-align: left;
    font-size: var(--text-xs);
    font-weight: 650;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

tbody td {
    padding: 10px 16px;
    font-size: var(--text-base);
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-border-light);
    vertical-align: middle;
}

tbody tr { transition: background var(--duration-fast) var(--ease); }
tbody tr:hover { background: var(--color-bg-subtle); }
tbody tr:last-child td { border-bottom: none; }

/* ===================================================
   FORMS
   =================================================== */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--text-md);
    font-family: inherit;
    color: var(--color-text-primary);
    background: var(--color-bg-elevated);
    box-shadow: var(--shadow-xs);
    transition: border-color var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease);
    outline: none;
}

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

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

.form-textarea { min-height: 100px; resize: vertical; }

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

/* ===================================================
   BADGES
   =================================================== */
.badge-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 1.6;
}

.badge-new { background: var(--color-info-light); color: var(--color-info); }
.badge-redistribute { background: var(--color-warning-light); color: var(--color-warning); }
.badge-rejected { background: var(--color-danger-light); color: var(--color-danger); }
.badge-as_service { background: var(--color-violet-light); color: var(--color-violet); }
.badge-as { background: var(--color-violet-light); color: var(--color-violet); }
.badge-paid { background: var(--color-success-light); color: var(--color-success); }
.badge-none { background: var(--color-bg-subtle); color: var(--color-text-tertiary); }
.badge-consulted { background: var(--color-info-light); color: var(--color-info); }
.badge-absent { background: var(--color-warning-light); color: var(--color-warning); }
.badge-prospect { background: var(--color-success-light); color: var(--color-success); }
.badge-impossible { background: var(--color-danger-light); color: var(--color-danger); }

/* ===================================================
   ALERTS
   =================================================== */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-weight: 500;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
}

.alert i { font-size: var(--text-md); flex-shrink: 0; }

.alert-success { background: var(--color-success-light); color: #065f46; border-color: rgba(14, 163, 113, 0.12); }
.alert-error { background: var(--color-danger-light); color: #991b1b; border-color: rgba(223, 27, 65, 0.12); }
.alert-warning { background: var(--color-warning-light); color: #92400e; border-color: rgba(229, 147, 14, 0.12); }
.alert-info { background: var(--color-primary-light); color: #1e3a8a; border-color: rgba(30, 64, 175, 0.12); }

/* ===================================================
   PAGINATION
   =================================================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    margin-top: 20px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--color-text-secondary);
    transition: background var(--duration-fast) var(--ease);
}

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

/* ===================================================
   EMPTY STATE
   =================================================== */
.empty-state { text-align: center; padding: 40px 20px; }
.empty-state .empty-icon { font-size: 36px; margin-bottom: 8px; opacity: 0.2; }
.empty-state .empty-title { font-size: var(--text-md); font-weight: 600; color: var(--color-text-primary); margin-bottom: 4px; }
.empty-state .empty-desc { font-size: var(--text-base); color: var(--color-text-secondary); }

/* ===================================================
   LOGIN PAGE
   =================================================== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-sidebar);
    position: relative;
    overflow: hidden;
    padding: 20px;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    top: -40%;
    left: -20%;
    width: 70%;
    height: 100%;
    background: radial-gradient(ellipse, rgba(30, 64, 175, 0.08) 0%, transparent 65%);
    pointer-events: none;
}

.login-wrapper::after {
    content: '';
    position: absolute;
    bottom: -30%;
    right: -15%;
    width: 50%;
    height: 80%;
    background: radial-gradient(ellipse, rgba(124, 92, 252, 0.06) 0%, transparent 65%);
    pointer-events: none;
}

.login-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    padding: 40px 36px;
    width: 100%;
    max-width: 380px;
    backdrop-filter: blur(24px);
    position: relative;
    z-index: 1;
}

.login-card .login-logo { text-align: center; margin-bottom: 32px; }

.login-card .login-logo .logo-icon {
    width: 48px;
    height: 48px;
    background: var(--color-primary);
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-2xl);
    color: white;
    font-weight: 800;
    margin-bottom: 16px;
}

.login-card .login-logo h1 {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: white;
    letter-spacing: -0.3px;
}

.login-card .login-logo p {
    font-size: var(--text-base);
    color: rgba(255, 255, 255, 0.4);
    margin-top: 4px;
}

.login-card .form-group { margin-bottom: 14px; }

.login-card .form-label {
    color: rgba(255, 255, 255, 0.55);
    font-size: var(--text-sm);
}

.login-card .form-input {
    padding: 10px 12px;
    font-size: var(--text-md);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: white;
    box-shadow: none;
}

.login-card .form-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.2);
    background: rgba(255, 255, 255, 0.08);
}

.login-card .form-input::placeholder { color: rgba(255, 255, 255, 0.22); }

.login-card .btn-login {
    width: 100%;
    padding: 10px;
    font-size: var(--text-md);
    font-weight: 650;
    border-radius: var(--radius-md);
    margin-top: 8px;
    background: var(--color-primary);
    border: none;
    color: white;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease), box-shadow var(--duration) var(--ease);
    box-shadow: var(--shadow-btn-primary);
}

.login-card .btn-login:hover {
    background: var(--color-primary-hover);
    box-shadow: var(--shadow-btn-primary-hover);
}

/* ===================================================
   UPLOAD AREA
   =================================================== */
.upload-area {
    border: 1.5px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: 40px 24px;
    text-align: center;
    transition: border-color var(--duration) var(--ease), background var(--duration) var(--ease);
    cursor: pointer;
    background: var(--color-bg-subtle);
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.upload-area .upload-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.25; }
.upload-area .upload-text { font-size: var(--text-md); font-weight: 600; color: var(--color-text-primary); margin-bottom: 4px; }
.upload-area .upload-hint { font-size: var(--text-sm); color: var(--color-text-secondary); }

/* ===================================================
   DUPLICATE CHECK
   =================================================== */
.duplicate-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.duplicate-summary .summary-item {
    text-align: center;
    padding: 16px;
    border-radius: var(--radius-lg);
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border-light);
}

.duplicate-summary .summary-item .count {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.3px;
    font-variant-numeric: tabular-nums;
}

.duplicate-summary .summary-item .label {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    font-weight: 600;
    margin-top: 2px;
}

.duplicate-row { background: var(--color-warning-light) !important; }

/* ===================================================
   TOOLBAR
   =================================================== */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.toolbar .toolbar-left,
.toolbar .toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.search-box { position: relative; }

.search-box .form-input { padding-left: 34px; min-width: 220px; }

.search-box .search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-tertiary);
    font-size: var(--text-base);
}

/* ===================================================
   NOTICE
   =================================================== */
.notice-category {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-xs);
    font-size: var(--text-xs);
    font-weight: 600;
    background: var(--color-primary-light);
    color: var(--color-primary);
}

/* ===================================================
   TIMELINE
   =================================================== */
.timeline { position: relative; padding-left: 24px; }

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 4px;
    bottom: 4px;
    width: 1.5px;
    background: var(--color-border);
}

.timeline-item { position: relative; margin-bottom: 20px; }

.timeline-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-primary);
    border: 2px solid var(--color-bg-elevated);
    box-shadow: 0 0 0 2px var(--color-primary-light);
}

.timeline-item .timeline-date { font-size: var(--text-sm); color: var(--color-text-secondary); margin-bottom: 4px; }

.timeline-item .timeline-content {
    background: var(--color-bg-subtle);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    border: 1px solid var(--color-border-light);
}

.timeline-item .timeline-result { margin-top: 4px; }

/* ===================================================
   CHECKBOX & SELECT
   =================================================== */
input[type="checkbox"] {
    width: 15px;
    height: 15px;
    border-radius: 3px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23525f7f' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 11px;
    padding-right: 32px;
}

/* ===================================================
   NOTIFICATION BELL
   =================================================== */
.notification-bell { position: relative; cursor: pointer; }

.notification-bell .bell-count {
    position: absolute;
    top: -3px;
    right: -3px;
    background: var(--color-danger);
    color: white;
    font-size: 9px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

/* ===================================================
   MODAL
   =================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration) var(--ease), visibility var(--duration) var(--ease);
}

.modal-backdrop.show { opacity: 1; visibility: visible; }

.modal {
    background: var(--color-bg-elevated);
    border-radius: var(--radius-xl);
    padding: 24px;
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: translateY(12px) scale(0.98);
    transition: transform var(--duration-slow) var(--ease);
}

.modal-backdrop.show .modal { transform: translateY(0) scale(1); }

.modal-title { font-size: var(--text-xl); font-weight: 700; margin-bottom: 16px; letter-spacing: -0.2px; }

/* ===================================================
   QUICK ACTIONS (Dashboard)
   =================================================== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 8px;
    border-radius: var(--radius-md);
    background: var(--color-bg-subtle);
    border: 1px solid transparent;
    transition: background var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease);
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    color: inherit;
}

.quick-action:hover {
    background: var(--color-bg-elevated);
    border-color: var(--color-border);
}

.quick-action .qa-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-base);
}

.quick-action .qa-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text-primary);
}

/* ===================================================
   STAFF ROW (Dashboard)
   =================================================== */
.staff-row {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border-light);
    gap: 10px;
}

.staff-row:last-child { border-bottom: none; }

.staff-row .staff-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.staff-row .staff-info { flex: 1; min-width: 0; }
.staff-row .staff-name { font-size: var(--text-base); font-weight: 600; color: var(--color-text-primary); line-height: 1.3; }
.staff-row .staff-id { font-size: var(--text-xs); color: var(--color-text-tertiary); }

.staff-row .staff-count {
    font-size: var(--text-md);
    font-weight: 700;
    color: var(--color-primary);
    font-variant-numeric: tabular-nums;
}

.staff-row .staff-count-label {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    margin-left: 2px;
}

.progress-bar {
    width: 100%;
    height: 3px;
    background: var(--color-bg-subtle);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}

.progress-bar .progress-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--color-primary);
    transition: width 0.4s var(--ease);
}

/* ===================================================
   RESPONSIVE
   =================================================== */
@media (max-width: 1200px) {
    .bento-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .bento-grid { grid-template-columns: 1fr; }
    .bento-card.bento-hero,
    .bento-card.bento-wide { grid-column: span 1; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .dashboard-grid .full-width { grid-column: span 1; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .quick-actions { grid-template-columns: repeat(2, 1fr); }
    .main-body { padding: 16px; }
    .main-header { padding: 0 16px; }
    .duplicate-summary { grid-template-columns: 1fr; }
}

/* ===================================================
   UTILITIES
   =================================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--color-primary) !important; }
.text-success { color: var(--color-success) !important; }
.text-danger { color: var(--color-danger) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-info { color: var(--color-info) !important; }
.text-secondary { color: var(--color-text-secondary) !important; }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

.divider {
    width: 100%;
    height: 1px;
    background: var(--color-border-light);
    margin: 12px 0;
}

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

.skeleton {
    background: linear-gradient(90deg, var(--color-bg-subtle) 25%, var(--color-bg-muted) 50%, var(--color-bg-subtle) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

/* Smooth page-load fade-in */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.main-body { animation: fadeIn 0.3s var(--ease); }
