/* ===== CSS Variables / Design Tokens ===== */
:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: rgba(30, 30, 50, 0.7);
    --bg-column: rgba(22, 22, 40, 0.6);
    --bg-modal-overlay: rgba(0, 0, 0, 0.6);

    --text-primary: #e8e8f0;
    --text-secondary: #a0a0b8;
    --text-muted: #6a6a80;

    --accent-blue: #4f8cff;
    --accent-purple: #a855f7;
    --accent-green: #34d399;
    --accent-orange: #fb923c;
    --accent-red: #ef4444;
    --accent-cyan: #22d3ee;
    --accent-pink: #f472b6;

    --gradient-1: linear-gradient(135deg, #4f8cff, #a855f7);
    --gradient-2: linear-gradient(135deg, #a855f7, #f472b6);
    --gradient-3: linear-gradient(135deg, #34d399, #22d3ee);
    --gradient-4: linear-gradient(135deg, #fb923c, #ef4444);
    --gradient-head: linear-gradient(135deg, #38bdf8, #818cf8);
    --gradient-member: linear-gradient(135deg, #fb923c, #f472b6);

    --border-glass: 1px solid rgba(255, 255, 255, 0.06);

    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-drag: 0 12px 40px rgba(79, 140, 255, 0.25);
    --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.5);
    --shadow-glow-blue: 0 0 30px rgba(79, 140, 255, 0.15);
    --shadow-glow-purple: 0 0 30px rgba(168, 85, 247, 0.15);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Light Theme ===== */
:root[data-theme="light"] {
    /* Slightly deeper and cooler background to avoid being "too pale" */
    --bg-primary: #eff3f8;
    --bg-secondary: #ffffff;
    /* Cards are solid white to pop off the container background */
    --bg-card: #ffffff;
    /* Columns have a bit more weight */
    --bg-column: rgba(230, 236, 244, 0.9);
    --bg-modal-overlay: rgba(15, 23, 42, 0.5);

    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;

    /* Stronger borders for definition */
    --border-glass: 1px solid rgba(15, 23, 42, 0.12);

    /* Slightly more pronounced shadows for depth */
    --shadow-card: 0 4px 16px rgba(15, 23, 42, 0.08);
    --shadow-drag: 0 16px 40px rgba(79, 140, 255, 0.2);
    --shadow-modal: 0 24px 48px rgba(15, 23, 42, 0.15);
}

:root[data-theme="light"] body {
    /* Slightly stronger gradients to add character */
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(79, 140, 255, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(168, 85, 247, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(52, 211, 153, 0.04) 0%, transparent 50%);
}

:root[data-theme="light"] .login-page {
    background-image:
        radial-gradient(ellipse at 30% 40%, rgba(79, 140, 255, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 60%, rgba(168, 85, 247, 0.05) 0%, transparent 60%);
}

:root[data-theme="light"] .login-container {
    background: rgba(255, 255, 255, 0.9);
}

:root[data-theme="light"] .login-field select,
:root[data-theme="light"] .login-field input {
    background: rgba(15, 23, 42, 0.02);
}

:root[data-theme="light"] .header,
:root[data-theme="light"] .search-toolbar,
:root[data-theme="light"] .stats-bar {
    background: rgba(255, 255, 255, 0.85);
}

:root[data-theme="light"] .search-box input,
:root[data-theme="light"] .btn-icon-only,
:root[data-theme="light"] .btn-ghost,
:root[data-theme="light"] .user-badge,
:root[data-theme="light"] .login-role-preview,
:root[data-theme="light"] .sort-select {
    background: rgba(15, 23, 42, 0.04);
}

:root[data-theme="light"] .search-box input:focus {
    background: rgba(15, 23, 42, 0.06);
}

:root[data-theme="light"] .btn-icon-only:hover,
:root[data-theme="light"] .btn-ghost:hover,
:root[data-theme="light"] .dept-tab:hover {
    background: rgba(15, 23, 42, 0.08);
}

:root[data-theme="light"] .column-primary {
    background: rgba(248, 250, 252, 0.85);
    box-shadow: 0 0 24px rgba(168, 85, 247, 0.03), inset 0 1px 0 rgba(168, 85, 247, 0.05);
}

:root[data-theme="light"] .stat-dot {
    background: rgba(15, 23, 42, 0.1);
}

:root[data-theme="light"] .modal {
    background: rgba(255, 255, 255, 0.95);
}

:root[data-theme="light"] .form-input,
:root[data-theme="light"] .form-select,
:root[data-theme="light"] .form-textarea,
:root[data-theme="light"] #detail-comment-input {
    background: rgba(15, 23, 42, 0.02);
}

:root[data-theme="light"] .form-input:focus,
:root[data-theme="light"] .form-select:focus,
:root[data-theme="light"] .form-textarea:focus {
    background: rgba(15, 23, 42, 0.04);
}

:root[data-theme="light"] .card-progress-value,
:root[data-theme="light"] .progress-ring {
    color: var(--text-primary);
}

:root[data-theme="light"] .progress-bar-track {
    background: rgba(15, 23, 42, 0.08);
}

:root[data-theme="light"] .shortcuts-panel {
    background: rgba(255, 255, 255, 0.95);
}

:root[data-theme="light"] .shortcut-item {
    border-bottom-color: var(--border-glass);
}

:root[data-theme="light"] kbd {
    background: rgba(15, 23, 42, 0.05);
    border-color: rgba(15, 23, 42, 0.1);
}

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

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(79, 140, 255, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(168, 85, 247, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(52, 211, 153, 0.03) 0%, transparent 50%);
}

/* ===== Login Page ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 30% 40%, rgba(79, 140, 255, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 60%, rgba(168, 85, 247, 0.06) 0%, transparent 60%);
}

.login-page.hidden {
    display: none;
}

.login-container {
    width: 380px;
    background: rgba(26, 26, 46, 0.85);
    backdrop-filter: blur(24px);
    border: var(--border-glass);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-modal);
    padding: 40px 36px;
    animation: fadeUp 0.5s ease;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.login-logo-icon {
    width: 44px;
    height: 44px;
    background: var(--gradient-1);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 4px 20px rgba(79, 140, 255, 0.3);
}

.login-logo-text {
    font-size: 26px;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 32px;
}

.login-field {
    margin-bottom: 18px;
}

.login-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.login-field select,
.login-field input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-family);
    outline: none;
    transition: border-color var(--transition-fast);
}

.login-field select:focus,
.login-field input:focus {
    border-color: rgba(79, 140, 255, 0.4);
}

.login-field select option,
.login-field select optgroup {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.login-role-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    animation: fadeUp 0.2s ease;
}

.role-preview-badge {
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.role-preview-badge.admin {
    background: var(--gradient-4);
}

.role-preview-badge.dept_head {
    background: var(--gradient-head);
}

.role-preview-badge.member {
    background: var(--gradient-member);
}

.role-preview-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.login-btn {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--gradient-1);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 20px rgba(79, 140, 255, 0.25);
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 28px rgba(79, 140, 255, 0.35);
}

/* ===== App container ===== */
#app {
    display: none;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

#app.active {
    display: flex;
}

.app-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.06) transparent;
}

/* ===== Header ===== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: rgba(15, 15, 26, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: var(--border-glass);
    flex-shrink: 0;
    gap: 16px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.logo {
    width: 32px;
    height: 32px;
    background: var(--gradient-1);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 2px 12px rgba(79, 140, 255, 0.3);
}

.header-title {
    font-size: 18px;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-center {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Dept filter tabs */
.dept-tab {
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    font-family: var(--font-family);
}

.dept-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.dept-tab.active {
    color: var(--accent-blue);
    background: rgba(79, 140, 255, 0.1);
    border-color: rgba(79, 140, 255, 0.15);
}

/* User badge */
.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 6px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-full);
    border: var(--border-glass);
}

.user-badge-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

.user-badge-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-badge-role {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    color: #fff;
}

.user-badge-role.admin {
    background: var(--gradient-4);
}

.user-badge-role.dept_head {
    background: var(--gradient-head);
}

.user-badge-role.member {
    background: var(--gradient-member);
}

/* Notification badge */
.notification-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-full);
    cursor: default;
    animation: notifPulse 2s ease-in-out infinite;
}

.notification-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-red);
    animation: dotPulse 1.5s ease-in-out infinite;
}

@keyframes dotPulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

@keyframes notifPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }

    50% {
        box-shadow: 0 0 12px 2px rgba(239, 68, 68, 0.15);
    }
}

.notification-count {
    font-size: 12px;
    font-weight: 800;
    color: var(--accent-red);
}

.notification-label {
    font-size: 10px;
    font-weight: 600;
    color: rgba(239, 68, 68, 0.8);
}

/* Avatar color classes */
.avatar-a {
    background: var(--gradient-1);
}

.avatar-b {
    background: var(--gradient-2);
}

.avatar-c {
    background: var(--gradient-3);
}

.avatar-d {
    background: var(--gradient-4);
}

.avatar-e {
    background: var(--gradient-head);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient-1);
    color: #fff;
    box-shadow: 0 2px 10px rgba(79, 140, 255, 0.2);
}

.btn-primary:hover {
    box-shadow: 0 4px 18px rgba(79, 140, 255, 0.35);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

.btn-icon {
    font-size: 15px;
    line-height: 1;
}

.btn-icon-only {
    padding: 7px 10px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: var(--border-glass);
    color: var(--text-secondary);
}

.btn-icon-only:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

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

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-success {
    background: rgba(52, 211, 153, 0.15);
    color: var(--accent-green);
}

.btn-success:hover {
    background: rgba(52, 211, 153, 0.25);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-warn {
    background: rgba(251, 146, 60, 0.15);
    color: var(--accent-orange);
}

.btn-warn:hover {
    background: rgba(251, 146, 60, 0.25);
}

.btn-logout {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.12);
    color: var(--accent-red);
}

/* ===== Search Toolbar ===== */
.search-toolbar,
.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 28px;
    background: rgba(15, 15, 26, 0.4);
    border-bottom: var(--border-glass);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.search-input-group {
    flex: 1;
    min-width: 200px;
    max-width: 420px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-group .search-icon {
    position: absolute;
    left: 12px;
    font-size: 13px;
    opacity: 0.5;
    pointer-events: none;
}

.search-input-group .search-input {
    width: 100%;
    padding: 8px 14px 8px 36px;
    background: rgba(255, 255, 255, 0.04);
    border: var(--border-glass);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-family);
    outline: none;
    transition: all var(--transition-fast);
}

.search-input-group .search-input:focus {
    border-color: rgba(79, 140, 255, 0.3);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.06);
}

.search-input-group .search-input::placeholder {
    color: var(--text-muted);
}

.search-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-pills {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    max-width: 420px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    font-size: 13px;
    opacity: 0.5;
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 8px 32px 8px 36px;
    background: rgba(255, 255, 255, 0.04);
    border: var(--border-glass);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-family);
    outline: none;
    transition: all var(--transition-fast);
}

.search-box input:focus {
    border-color: rgba(79, 140, 255, 0.3);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.06);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-clear {
    position: absolute;
    right: 8px;
    width: 20px;
    height: 20px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.search-clear:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.sort-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.sort-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

.sort-select {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px;
    font-family: var(--font-family);
    outline: none;
    cursor: pointer;
}

.sort-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ===== Stats Bar ===== */
.stats-bar {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 8px 28px;
    background: rgba(15, 15, 26, 0.3);
    border-bottom: var(--border-glass);
    flex-shrink: 0;
    overflow-x: auto;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.stat-value {
    font-weight: 700;
    color: var(--text-primary);
}

.stat-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.stat-dot.draft {
    background: var(--text-muted);
}

.stat-dot.pending {
    background: var(--accent-orange);
}

.stat-dot.approved {
    background: var(--accent-blue);
}

.stat-dot.in_progress {
    background: var(--accent-purple);
}

.stat-dot.done {
    background: var(--accent-green);
}

.stat-dot.rejected {
    background: var(--accent-red);
}

/* ===== Board Container ===== */
.board-container {
    padding: 0 28px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.board-container::-webkit-scrollbar {
    width: 6px;
}

.board-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

/* ===== Flow Center (流程中心 — collapsible) ===== */
.flow-center {
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-lg);
    border: var(--border-glass);
    background: rgba(22, 22, 40, 0.3);
    transition: all var(--transition-normal);
}

.flow-center-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: var(--border-glass);
    user-select: none;
    flex-shrink: 0;
}

.flow-center-header:hover {
    background: rgba(255, 255, 255, 0.04);
}

.flow-center-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.flow-center-indicator {
    width: 4px;
    height: 18px;
    border-radius: 2px;
    background: var(--gradient-1);
}

.flow-center-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.flow-center-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    background: rgba(79, 140, 255, 0.12);
    border-radius: 11px;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-blue);
}

.btn-section-toggle {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-section-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

.flow-center-body {
    transition: opacity 0.3s ease;
    opacity: 1;
}

.flow-center-body.collapsed {
    display: none;
}

.flow-center-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    padding: 16px 16px 20px;
    align-items: start;
    align-content: start;
}

/* Flow center columns: default height with scroll */
.flow-center-grid .column {
    max-height: 480px;
}

.flow-center-grid .column .column-cards {
    flex: 1;
    overflow-y: auto;
    max-height: 380px;
}

/* ===== Column ===== */
.column {
    display: flex;
    flex-direction: column;
    background: var(--bg-column);
    backdrop-filter: blur(12px);
    border: var(--border-glass);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
    min-width: 0;
}

/* Primary column (In Progress) — pinned at top of flow center */
.column-primary {
    border-color: rgba(168, 85, 247, 0.2);
    box-shadow: 0 0 24px rgba(168, 85, 247, 0.06), inset 0 1px 0 rgba(168, 85, 247, 0.1);
    background: rgba(22, 22, 40, 0.75);
    margin: 16px 16px 0;
    border-radius: var(--radius-lg);
}

.column-primary .column-header {
    padding: 16px 20px 10px;
}

.column-primary .column-indicator {
    width: 5px;
    height: 22px;
}

.column-primary .column-title {
    font-size: 15px;
}

.column-primary .column-count {
    font-size: 12px;
    min-width: 24px;
    height: 24px;
    background: rgba(168, 85, 247, 0.15);
    color: var(--accent-purple);
}

/* Responsive grid for in-progress cards — min-height fits 2 card rows */
.column-primary .column-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    padding: 8px 14px 14px;
    gap: 12px;
    overflow-y: auto;
    flex: 1;
    min-height: 480px;
}

.column-expand-bar {
    display: flex;
    justify-content: center;
    padding: 6px 14px 10px;
}

.btn-expand {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    font-size: 11px;
    padding: 4px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-expand:hover {
    background: rgba(168, 85, 247, 0.1);
    border-color: rgba(168, 85, 247, 0.3);
    color: var(--accent-purple);
}

.column.drag-over {
    background: rgba(79, 140, 255, 0.08);
    border-color: rgba(79, 140, 255, 0.25);
    box-shadow: inset 0 0 30px rgba(79, 140, 255, 0.06), 0 0 20px rgba(79, 140, 255, 0.08);
}

/* Light theme overrides */
:root[data-theme="light"] .flow-center {
    background: rgba(230, 236, 244, 0.5);
}

:root[data-theme="light"] .flow-center-header {
    background: rgba(255, 255, 255, 0.6);
}

:root[data-theme="light"] .flow-center-header:hover {
    background: rgba(255, 255, 255, 0.8);
}

:root[data-theme="light"] .btn-section-toggle {
    background: rgba(15, 23, 42, 0.05);
}

:root[data-theme="light"] .btn-section-toggle:hover {
    background: rgba(15, 23, 42, 0.1);
}

.column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 10px;
    flex-shrink: 0;
}

.column-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.column-indicator {
    width: 4px;
    height: 18px;
    border-radius: 2px;
}

.column-indicator.draft {
    background: var(--text-muted);
}

.column-indicator.pending {
    background: var(--gradient-4);
}

.column-indicator.approved {
    background: var(--gradient-1);
}

.column-indicator.in_progress {
    background: var(--gradient-2);
}

.column-indicator.done {
    background: var(--gradient-3);
}

.column-indicator.rejected {
    background: var(--accent-red);
}

.column-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.column-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

.column-cards {
    flex: 1;
    overflow-y: auto;
    padding: 4px 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scrollbar-width: none;
}

.column-cards::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.column-cards:hover {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.06) transparent;
}

.column-cards:hover::-webkit-scrollbar {
    width: 4px;
}

.column-cards:hover::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
}

/* Flow center column cards: default height */
.flow-center-grid .column-cards {
    max-height: 380px;
}

/* Toggle view button */
.btn-view-toggle {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.btn-view-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

/* Column header actions group */
.column-header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

/* Column bottom-edge drag resize handle */
.column-resize-handle {
    height: 6px;
    cursor: row-resize;
    background: transparent;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    position: relative;
    flex-shrink: 0;
    transition: background var(--transition-fast);
}

.column-resize-handle::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 3px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.1);
    transition: all var(--transition-fast);
}

.column-resize-handle:hover {
    background: rgba(255, 255, 255, 0.04);
}

.column-resize-handle:hover::after {
    width: 60px;
    background: rgba(255, 255, 255, 0.25);
}

.column-resize-handle.dragging::after {
    width: 80px;
    background: var(--accent-primary);
}

/* Active resize state on body */
body.col-resizing {
    cursor: row-resize !important;
    user-select: none !important;
}

/* ==================== GANTT CHART ==================== */

.gantt-section {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
    position: relative;
}

.gantt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: var(--border-glass);
    background: rgba(255, 255, 255, 0.02);
}

.gantt-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gantt-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.gantt-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.btn-gantt-toggle {
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    cursor: pointer;
    font-size: 10px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-gantt-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

.gantt-body {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.gantt-body.collapsed {
    max-height: 0 !important;
}

.gantt-chart {
    padding: 16px 20px;
    overflow-x: auto;
}

.gantt-empty {
    text-align: center;
    padding: 32px 20px;
    color: var(--text-muted);
    font-size: 13px;
}

.gantt-empty-icon {
    font-size: 28px;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* Gantt timeline container */
.gantt-container {
    position: relative;
    min-width: 100%;
}

/* Gantt date headers */
.gantt-dates {
    display: flex;
    align-items: flex-end;
    margin-left: 160px;
    height: 36px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
}

.gantt-date-label {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    flex-shrink: 0;
    padding-bottom: 6px;
}

.gantt-date-label.today {
    color: var(--accent-primary);
    font-weight: 600;
}

.gantt-date-label.weekend {
    color: rgba(255, 255, 255, 0.2);
}

/* Gantt rows */
.gantt-row {
    display: flex;
    align-items: center;
    height: 36px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background var(--transition-fast);
}

.gantt-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

.gantt-row-label {
    width: 160px;
    min-width: 160px;
    padding: 0 12px;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    cursor: pointer;
}

.gantt-row-label:hover .gantt-label-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.gantt-label-tooltip {
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 100;
    min-width: 240px;
    max-width: 320px;
    padding: 10px 14px;
    background: rgba(20, 20, 40, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.2s ease;
    pointer-events: none;
    white-space: normal;
}

.gantt-row-label .gantt-priority-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.gantt-row-timeline {
    flex: 1;
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

/* Gantt bars */
.gantt-bar-wrapper {
    position: absolute;
    height: 20px;
    display: flex;
    align-items: center;
}

.gantt-bar {
    width: 100%;
    height: 100%;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: filter var(--transition-fast), transform var(--transition-fast);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.gantt-bar:hover {
    filter: brightness(1.2);
    transform: scaleY(1.3);
    z-index: 5;
}

.gantt-bar-bg {
    position: absolute;
    inset: 0;
    opacity: 0.25;
    border-radius: 4px;
}

.gantt-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.gantt-bar-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: white;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

/* Priority colors */
.gantt-bar.priority-urgent .gantt-bar-bg {
    background: var(--accent-red);
}

.gantt-bar.priority-urgent .gantt-bar-fill {
    background: var(--accent-red);
}

.gantt-bar.priority-high .gantt-bar-bg {
    background: var(--accent-orange);
}

.gantt-bar.priority-high .gantt-bar-fill {
    background: var(--accent-orange);
}

.gantt-bar.priority-normal .gantt-bar-bg {
    background: var(--accent-primary);
}

.gantt-bar.priority-normal .gantt-bar-fill {
    background: var(--accent-primary);
}

.gantt-bar.priority-low .gantt-bar-bg {
    background: var(--accent-green);
}

.gantt-bar.priority-low .gantt-bar-fill {
    background: var(--accent-green);
}

/* Today marker */
.gantt-today-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--accent-primary);
    opacity: 0.6;
    z-index: 3;
    pointer-events: none;
}

.gantt-today-line::before {
    content: '今天';
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    color: var(--accent-primary);
    font-weight: 600;
    white-space: nowrap;
}

/* Gantt tooltip */
.gantt-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-primary);
    border: var(--border-glass);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-primary);
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-fast);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.gantt-bar:hover .gantt-tooltip {
    opacity: 1;
}

.gantt-tooltip-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.gantt-tooltip-row {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.6;
}

/* Grid lines behind bars */
.gantt-grid-lines {
    position: absolute;
    inset: 0;
    display: flex;
    pointer-events: none;
}

.gantt-grid-line {
    flex-shrink: 0;
    height: 100%;
    border-right: 1px solid rgba(255, 255, 255, 0.03);
}

.gantt-grid-line.weekend {
    background: rgba(255, 255, 255, 0.01);
}

/* Compact card */
.card-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-card);
    border: var(--border-glass);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    cursor: default;
    min-height: 32px;
}

/* Enhanced compact card for in_progress */
.card-compact-full {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    background: var(--bg-card);
    border: var(--border-glass);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    cursor: default;
}

.card-compact-full:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(168, 85, 247, 0.2);
}

.card-compact-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-compact-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
    padding-left: 16px;
}

.card-compact-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-secondary);
    padding-left: 16px;
    flex-wrap: wrap;
}

.card-compact-dept {
    font-weight: 600;
}

.card-compact-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 16px;
}

.card-compact-progress .progress-bar-track {
    flex: 1;
}

.card-compact-prog-text {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 28px;
}

.card-compact:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
}

.priority-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.priority-dot.priority-urgent {
    background: var(--accent-red);
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

.priority-dot.priority-important {
    background: var(--accent-orange);
}

.priority-dot.priority-normal {
    background: var(--text-muted);
}

.card-compact-title {
    flex: 1;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.card-compact-title:hover {
    color: var(--accent-blue);
}

.card-compact-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.column-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
    opacity: 0.5;
}

.column-empty-icon {
    font-size: 28px;
    margin-bottom: 6px;
    opacity: 0.4;
}

/* ===== Card ===== */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border: var(--border-glass);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    cursor: grab;
    transition: all var(--transition-smooth);
    position: relative;
    animation: cardSlideIn 0.35s ease both;
    overflow: visible;
}

@keyframes cardSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.card:hover {
    background: rgba(35, 35, 60, 0.8);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: var(--shadow-card);
    transform: translateY(-2px);
}

.card.dragging {
    opacity: 0.4;
    transform: scale(0.95);
    box-shadow: none;
}

/* Card border accent by status */
.card.status-pending {
    border-left: 3px solid var(--accent-orange);
}

.card.status-approved {
    border-left: 3px solid var(--accent-blue);
}

.card.status-rejected {
    border-left: 3px solid var(--accent-red);
}

.card.status-in_progress {
    border-left: 3px solid var(--accent-purple);
}

.card.status-done {
    border-left: 3px solid var(--accent-green);
}

.card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    gap: 6px;
}

.priority-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.priority-urgent {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.priority-important {
    background: rgba(251, 146, 60, 0.15);
    color: var(--accent-orange);
}

.priority-normal {
    background: rgba(79, 140, 255, 0.12);
    color: var(--accent-blue);
}

.card-dept-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

.card-menu-btn {
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    opacity: 0;
    transition: all var(--transition-fast);
}

.card:hover .card-menu-btn {
    opacity: 1;
}

.card-menu-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.4;
}

.card-title.clickable {
    cursor: pointer;
    transition: color var(--transition-fast);
}

.card-title.clickable:hover {
    color: var(--accent-blue);
}

.card-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 10px;
}

/* ===== Approval Level Badge ===== */
.approval-level-badge {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 10px;
    margin: 6px 0;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.approval-level-badge.approval-step-dept {
    border-color: rgba(56, 189, 248, 0.2);
    background: rgba(56, 189, 248, 0.05);
}

.approval-level-badge.approval-step-admin {
    border-color: rgba(251, 146, 60, 0.2);
    background: rgba(251, 146, 60, 0.05);
}

.approval-steps {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
}

.approval-step {
    padding: 2px 8px;
    border-radius: var(--radius-full);
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.04);
    transition: all var(--transition-fast);
}

.approval-step.done {
    color: var(--accent-green);
    background: rgba(52, 211, 153, 0.12);
}

.approval-step.active {
    color: var(--accent-orange);
    background: rgba(251, 146, 60, 0.15);
    animation: stepPulse 2s ease-in-out infinite;
}

@keyframes stepPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(251, 146, 60, 0);
    }

    50% {
        box-shadow: 0 0 8px 2px rgba(251, 146, 60, 0.15);
    }
}

.approval-arrow {
    color: var(--text-muted);
    font-size: 10px;
}

.approval-current {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.card-assignee {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
}

.card-creator {
    font-size: 10px;
    color: var(--text-muted);
    font-style: italic;
}

.card-comment-badge {
    font-size: 10px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
}

/* Card action buttons */
.card-actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    flex-wrap: wrap;
}

/* ===== Context Menu ===== */
.card-context-menu {
    position: absolute;
    top: 34px;
    right: 8px;
    z-index: 50;
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    border: var(--border-glass);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-modal);
    min-width: 130px;
    padding: 4px;
    animation: menuAppear 0.15s ease;
}

@keyframes menuAppear {
    from {
        opacity: 0;
        transform: translateY(-4px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 12px;
    font-family: var(--font-family);
    cursor: pointer;
    border-radius: 6px;
    width: 100%;
    transition: all var(--transition-fast);
}

.context-menu-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.context-menu-item.danger {
    color: var(--accent-red);
}

.context-menu-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-modal-overlay);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--bg-secondary);
    border: var(--border-glass);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-modal);
    width: 90%;
    max-width: 480px;
    padding: 28px;
    transform: translateY(20px) scale(0.95);
    transition: transform var(--transition-smooth);
    max-height: 90vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.06) transparent;
}

.modal::-webkit-scrollbar {
    width: 4px;
}

.modal::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
}

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

.detail-modal-body {
    max-width: 600px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.modal-title {
    font-size: 17px;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-close {
    width: 30px;
    height: 30px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

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

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

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-family);
    transition: border-color var(--transition-fast);
    outline: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-color: rgba(79, 140, 255, 0.4);
    box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.08);
}

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

.form-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.form-row {
    display: flex;
    gap: 10px;
}

.form-row .form-group {
    flex: 1;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 22px;
}

/* Rejection area */
.rejection-area {
    margin-top: 12px;
}

.rejection-area textarea {
    width: 100%;
    padding: 10px;
    min-height: 60px;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-family);
    outline: none;
    resize: vertical;
}

/* ===== Detail Modal Sections ===== */
.detail-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: var(--border-glass);
}

.detail-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.detail-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.detail-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.detail-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.detail-field-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.detail-field span:not(.detail-field-label) {
    font-size: 13px;
    color: var(--text-primary);
}

.detail-desc {
    margin-top: 12px;
}

.detail-desc p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-top: 4px;
}

.detail-progress-wrap {
    margin-top: 12px;
}

.detail-rejection {
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(239, 68, 68, 0.06);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-red);
}

.detail-rejection p {
    font-size: 13px;
    color: var(--accent-red);
    margin-top: 4px;
}

/* Status tag in detail */
.detail-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.status-tag-draft {
    background: rgba(106, 106, 128, 0.15);
    color: var(--text-muted);
}

.status-tag-pending {
    background: rgba(251, 146, 60, 0.15);
    color: var(--accent-orange);
}

.status-tag-approved {
    background: rgba(79, 140, 255, 0.15);
    color: var(--accent-blue);
}

.status-tag-in_progress {
    background: rgba(168, 85, 247, 0.15);
    color: var(--accent-purple);
}

.status-tag-done {
    background: rgba(52, 211, 153, 0.15);
    color: var(--accent-green);
}

.status-tag-rejected {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

/* Timeline (Activity Log) */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: 240px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.06) transparent;
}

.timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-left: 2px solid rgba(255, 255, 255, 0.06);
    padding-left: 14px;
    margin-left: 8px;
    position: relative;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 12px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(79, 140, 255, 0.4);
    border: 2px solid var(--bg-secondary);
}

.timeline-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.timeline-content {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    font-size: 12px;
    line-height: 1.5;
}

.timeline-actor {
    font-weight: 600;
    color: var(--accent-blue);
}

.timeline-detail {
    color: var(--text-secondary);
}

.timeline-time {
    color: var(--text-muted);
    font-size: 11px;
}

/* Comments */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.06) transparent;
}

.comment-bubble {
    background: rgba(255, 255, 255, 0.03);
    border: var(--border-glass);
    border-radius: var(--radius-md);
    padding: 10px 12px;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.comment-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.comment-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.comment-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-left: auto;
}

.comment-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.comment-input-area {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    align-items: flex-end;
}

.comment-input-area textarea {
    flex: 1;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-family);
    outline: none;
    resize: none;
    min-height: 40px;
    transition: border-color var(--transition-fast);
}

.comment-input-area textarea:focus {
    border-color: rgba(79, 140, 255, 0.3);
}

.empty-hint {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 16px 0;
    opacity: 0.6;
}

/* ===== Keyboard Shortcuts Panel ===== */
.shortcuts-panel {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 2000;
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    border: var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-modal);
    padding: 16px;
    min-width: 220px;
    opacity: 0;
    transform: translateY(16px) scale(0.95);
    pointer-events: none;
    transition: all var(--transition-smooth);
}

.shortcuts-panel.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.shortcuts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

.shortcuts-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
}

.shortcut-item kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 22px;
    padding: 0 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-family);
    color: var(--text-primary);
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 10px 18px;
    background: var(--bg-secondary);
    border: var(--border-glass);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.5s forwards;
    display: flex;
    align-items: center;
    gap: 8px;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(40px);
    }
}

/* ===== Card Progress Bar ===== */
.card-progress {
    margin-top: 8px;
}

.card-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.card-progress-label {
    font-size: 10px;
    color: var(--text-muted);
}

.card-progress-value {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-blue);
}

.progress-bar-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--gradient-3);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar-fill.high {
    background: var(--gradient-3);
}

.progress-bar-fill.mid {
    background: var(--gradient-1);
}

.progress-bar-fill.low {
    background: var(--gradient-4);
}

/* Deadline badge */
.card-deadline {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 500;
    padding: 1px 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
}

/* Start date badge */
.card-start-date {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 500;
    padding: 1px 6px;
    border-radius: 6px;
    background: rgba(79, 140, 255, 0.08);
    color: var(--accent-blue);
}

.card-deadline.soon {
    background: rgba(251, 146, 60, 0.12);
    color: var(--accent-orange);
}

.card-deadline.overdue {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    animation: overduePulse 2s ease-in-out infinite;
}

@keyframes overduePulse {

    0%,
    100% {
        box-shadow: none;
    }

    50% {
        box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
    }
}

/* ===== Progress Overview Panel ===== */
.progress-panel {
    display: flex;
    align-items: stretch;
    gap: 16px;
    padding: 12px 28px;
    background: rgba(15, 15, 26, 0.5);
    border-bottom: var(--border-glass);
    flex-shrink: 0;
    overflow-x: auto;
}

.progress-card {
    flex: 1;
    min-width: 160px;
    padding: 14px 16px;
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border: var(--border-glass);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-card-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.progress-card-value {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
}

.progress-card-value.gradient {
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.progress-card-sub {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Donut ring */
.progress-ring-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-ring {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    color: var(--text-primary);
}

.progress-ring-label {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Overdue list */
.overdue-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 60px;
    overflow-y: auto;
}

.overdue-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--accent-red);
    padding: 2px 0;
}

.overdue-item .overdue-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent-red);
    flex-shrink: 0;
}

/* ===== Drag Placeholder ===== */
.drag-placeholder {
    border: 2px dashed rgba(79, 140, 255, 0.25);
    border-radius: var(--radius-md);
    background: rgba(79, 140, 255, 0.04);
    min-height: 50px;
}

/* ===== Responsive ===== */

/* --- Tablet landscape / small desktop --- */
@media (max-width: 1024px) {
    .header {
        padding: 10px 16px;
        gap: 10px;
    }

    .search-toolbar {
        padding: 6px 16px;
    }

    .stats-bar {
        padding: 6px 16px;
        gap: 12px;
    }

    .progress-panel {
        padding: 10px 16px;
        gap: 10px;
    }

    .board {
        padding: 14px 16px;
        gap: 12px;
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }

    .progress-card {
        min-width: 140px;
    }

    .column-primary .column-cards {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

/* --- Tablet portrait / large phone --- */
@media (max-width: 768px) {

    html,
    body {
        overflow: auto;
        height: auto;
    }

    #app {
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    #app.active {
        display: flex;
    }

    /* Header */
    .header {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
    }

    .header-left {
        order: 1;
    }

    .header-right {
        order: 2;
        flex-wrap: wrap;
        gap: 6px;
    }

    .header-center {
        order: 3;
        width: 100%;
        overflow-x: auto;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .dept-tab {
        padding: 5px 10px;
        font-size: 11px;
    }

    .user-badge-name {
        display: none;
    }

    /* Search */
    .search-toolbar {
        flex-wrap: wrap;
        padding: 8px 12px;
        gap: 8px;
    }

    .search-box {
        max-width: 100%;
        width: 100%;
    }

    .sort-group {
        width: 100%;
    }

    .sort-select {
        flex: 1;
    }

    /* Stats */
    .stats-bar {
        padding: 8px 12px;
        gap: 8px;
        flex-wrap: wrap;
    }

    .stat-item {
        font-size: 11px;
    }

    /* Progress panel */
    .progress-panel {
        flex-wrap: wrap;
        padding: 10px 12px;
        gap: 8px;
    }

    .progress-card {
        min-width: 0;
        flex: 1 1 calc(50% - 8px);
    }

    .progress-card-value {
        font-size: 22px;
    }

    /* Board: switch to single column stacking */
    .board {
        grid-template-columns: 1fr !important;
        padding: 12px;
        gap: 12px;
        overflow-y: auto !important;
    }

    .column {
        max-height: none;
    }

    .column-primary .column-cards {
        grid-template-columns: 1fr !important;
    }

    .column-cards {
        overflow-y: auto;
    }

    /* Modal */
    .modal {
        width: 95%;
        max-width: 95%;
        padding: 20px;
        border-radius: var(--radius-lg);
    }

    .detail-modal-body {
        max-width: 95%;
    }

    .detail-meta-grid {
        grid-template-columns: 1fr;
    }

    .modal-header {
        margin-bottom: 16px;
    }

    .modal-title {
        font-size: 15px;
    }

    /* Form */
    .form-row {
        flex-direction: column;
    }

    .form-actions {
        flex-direction: column;
        gap: 8px;
    }

    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* Toast */
    .toast-container {
        left: 12px;
        right: 12px;
        bottom: 12px;
    }

    .toast {
        font-size: 12px;
    }

    /* Login */
    .login-container {
        width: 90%;
        max-width: 380px;
        padding: 30px 24px;
    }

    /* Shortcuts panel */
    .shortcuts-panel {
        right: 8px;
        top: auto;
        bottom: 60px;
    }
}

/* --- Phone --- */
@media (max-width: 480px) {
    .header {
        padding: 8px 10px;
    }

    .header-title {
        font-size: 15px;
    }

    .logo {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .header-right {
        gap: 4px;
    }

    .header-right .btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    .header-right .btn-icon-only {
        padding: 6px 8px;
        font-size: 13px;
    }

    .user-badge {
        padding: 3px 8px 3px 4px;
        gap: 5px;
    }

    .user-badge-avatar {
        width: 22px;
        height: 22px;
        font-size: 10px;
    }

    .user-badge-role {
        font-size: 10px;
        padding: 1px 6px;
    }

    .notification-badge {
        padding: 2px 8px;
        gap: 4px;
    }

    .notification-count {
        font-size: 11px;
    }

    .notification-label {
        font-size: 9px;
    }

    /* Stats compact */
    .stats-bar {
        padding: 6px 10px;
        gap: 6px;
    }

    .stat-item {
        font-size: 10px;
    }

    /* Progress panel */
    .progress-panel {
        padding: 8px 10px;
    }

    .progress-card {
        flex: 1 1 100%;
        padding: 10px 12px;
    }

    .progress-card-value {
        font-size: 20px;
    }

    .progress-ring {
        width: 40px;
        height: 40px;
    }

    .progress-ring>div {
        width: 30px !important;
        height: 30px !important;
        font-size: 10px !important;
    }

    /* Board */
    .board {
        padding: 10px 8px;
        gap: 10px;
    }

    .column {
        border-radius: var(--radius-md);
    }

    .column-header {
        padding: 12px 12px 8px;
    }

    .column-primary .column-header {
        padding: 12px 12px 8px;
    }

    .column-title {
        font-size: 13px;
    }

    .column-cards {
        padding: 4px 8px 8px;
        gap: 6px;
    }

    /* Cards */
    .card {
        padding: 10px 12px;
    }

    .card-title {
        font-size: 13px;
    }

    .card-desc {
        font-size: 11px;
    }

    .card-footer {
        flex-wrap: wrap;
        gap: 4px;
    }

    .card-creator {
        font-size: 10px;
    }

    .card-actions {
        gap: 3px;
    }

    .card-actions .btn-sm {
        padding: 3px 8px;
        font-size: 10px;
    }

    /* Approval badge compact */
    .approval-level-badge {
        padding: 6px 8px;
        margin: 4px 0;
    }

    .approval-steps {
        font-size: 10px;
        gap: 4px;
    }

    .approval-step {
        padding: 1px 6px;
    }

    .approval-current {
        font-size: 9px;
    }

    /* Modal */
    .modal {
        width: 98%;
        max-width: 98%;
        padding: 16px;
        border-radius: var(--radius-md);
        max-height: 85vh;
    }

    .modal-title {
        font-size: 14px;
    }

    .modal-close {
        width: 26px;
        height: 26px;
        font-size: 13px;
    }

    .form-label {
        font-size: 12px;
    }

    .form-input,
    .form-select,
    .form-textarea {
        font-size: 13px;
        padding: 10px 12px;
    }

    /* Detail modal */
    .detail-section-title {
        font-size: 13px;
    }

    .timeline-item {
        gap: 8px;
    }

    .comment-bubble {
        padding: 8px 10px;
    }

    .comment-input-area textarea {
        font-size: 13px;
    }

    /* Login */
    .login-container {
        width: 95%;
        padding: 24px 20px;
    }

    .login-logo-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .login-logo-text {
        font-size: 22px;
    }

    .login-subtitle {
        font-size: 12px;
    }

    .login-btn {
        padding: 11px;
        font-size: 14px;
    }

    /* Toast */
    .toast {
        padding: 8px 14px;
        font-size: 11px;
    }

    /* Context menu */
    .card-context-menu {
        min-width: 110px;
    }

    .context-menu-item {
        padding: 6px 8px;
        font-size: 11px;
    }

    /* Shortcuts panel */
    .shortcuts-panel {
        width: 200px;
        right: 8px;
    }
}

/* --- Very small phone --- */
@media (max-width: 360px) {
    .header-title {
        font-size: 13px;
    }

    .logo {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

    .header-right .btn {
        padding: 5px 8px;
        font-size: 10px;
    }

    .dept-tab {
        padding: 4px 8px;
        font-size: 10px;
    }

    .column-cards {}

    .card {
        padding: 8px 10px;
    }

    .modal {
        padding: 14px;
    }

    .login-container {
        padding: 20px 16px;
    }
}

/* ==================== LIGHT THEME ==================== */
body.light-theme {
    /* TeamBoard root variable overrides */
    --bg-primary: #f0f2f8;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-column: rgba(230, 236, 244, 0.9);
    --bg-modal-overlay: rgba(15, 23, 42, 0.5);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-glass: 1px solid rgba(15, 23, 42, 0.1);
    --shadow-card: 0 1px 4px rgba(15, 23, 42, 0.06);
    --shadow-drag: 0 12px 40px rgba(79, 140, 255, 0.15);
    --shadow-modal: 0 24px 48px rgba(15, 23, 42, 0.12);
    --shadow-glow-blue: 0 0 20px rgba(79, 140, 255, 0.1);
    --shadow-glow-purple: 0 0 20px rgba(168, 85, 247, 0.08);
    /* TradeTracker variable overrides */
    --bg-tertiary: #e8ecf4;
    --bg-elevated: rgba(255, 255, 255, 0.9);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    --text-accent: #6366f1;
    --gradient-1: linear-gradient(135deg, #6366f1, #8b5cf6);
    background: #f0f2f8;
    color: #1e293b;
}

body.light-theme::before {
    background: radial-gradient(circle, rgba(99, 102, 241, 0.06) 0%, transparent 70%);
}

body.light-theme::after {
    background: radial-gradient(circle, rgba(139, 92, 246, 0.04) 0%, transparent 70%);
}

/* --- Hardcoded dark background overrides --- */
body.light-theme .search-bar {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
}

body.light-theme .stats-bar {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.light-theme .progress-panel {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
}

body.light-theme .column {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
}

body.light-theme .column-primary {
    background: #f8faff !important;
}

body.light-theme .trade-sidebar {
    background: #ffffff !important;
    border-right-color: #e2e8f0 !important;
}

body.light-theme .trade-sidebar .nav-item {
    color: #475569;
}

body.light-theme .trade-sidebar .nav-item:hover {
    color: #1e293b;
    background: #f1f5f9;
}

body.light-theme .trade-sidebar .nav-item.active {
    color: #6366f1;
    background: rgba(99, 102, 241, 0.08);
}

body.light-theme .trade-sidebar .sidebar-footer {
    border-color: #e2e8f0 !important;
}

body.light-theme .gantt-section {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
}

body.light-theme .gantt-header {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
}

body.light-theme .gantt-body {
    background: #ffffff;
}

body.light-theme .gantt-row {
    background: #ffffff;
    border-color: #f1f5f9;
}

body.light-theme .gantt-row:hover {
    background: #f8fafc;
}

body.light-theme .gantt-row-label {
    color: #475569;
}

body.light-theme .gantt-title {
    color: #1e293b;
}

body.light-theme .gantt-subtitle {
    color: #94a3b8;
}

body.light-theme .gantt-date-label {
    color: #64748b;
    border-color: #e2e8f0;
}

body.light-theme .gantt-grid-line {
    border-color: #f1f5f9;
}

body.light-theme .gantt-grid-line.weekend {
    background: rgba(0, 0, 0, 0.02);
}

body.light-theme .gantt-empty {
    color: #94a3b8;
}

body.light-theme .flow-center {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
}

body.light-theme .flow-center-header {
    background: #f8fafc !important;
    border-color: #e2e8f0 !important;
}

body.light-theme .flow-center-header:hover {
    background: #f1f5f9 !important;
}

body.light-theme .flow-center-body {
    background: #ffffff;
}

body.light-theme .flow-center-title {
    color: #1e293b;
}

body.light-theme .flow-center-count {
    color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
}

body.light-theme .flow-center-indicator {
    background: #6366f1;
}

/* --- Left Module Sidebar --- */
body.light-theme .module-sidebar {
    background: #ffffff;
    border-color: #e2e8f0;
}

body.light-theme .module-nav-item {
    color: #64748b;
}

body.light-theme .module-nav-item:hover {
    color: #1e293b;
    background: #f1f5f9;
}

body.light-theme .module-nav-item.active {
    color: #6366f1;
    background: rgba(99, 102, 241, 0.08);
}

/* --- TeamBoard Header --- */
body.light-theme .header {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.light-theme .header-title {
    color: #1e293b;
}

body.light-theme .header-left .logo {
    background: var(--gradient-1);
}

body.light-theme .user-badge {
    color: #475569;
}

body.light-theme .user-badge-name {
    color: #1e293b;
}

/* --- Module Panel --- */
body.light-theme .module-panel {
    background: #f0f2f8;
}

/* --- Dept Tabs --- */
body.light-theme .dept-tab {
    color: #475569;
    background: #ffffff;
    border-color: #e2e8f0;
}

body.light-theme .dept-tab:hover {
    background: #f8fafc;
    color: #1e293b;
}

body.light-theme .dept-tab.active {
    color: #fff;
    background: var(--gradient-1);
    border-color: #6366f1;
}

/* --- Search Bar --- */
body.light-theme .search-bar,
body.light-theme .search-input {
    background: #ffffff;
    border-color: #e2e8f0;
    color: #1e293b;
}

body.light-theme .search-input::placeholder {
    color: #94a3b8;
}

/* --- Stat Summary Bar --- */
body.light-theme .stat-summary {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.light-theme .stat-item {
    color: #475569;
}

body.light-theme .stat-item .stat-count {
    color: #1e293b;
}

body.light-theme .stat-item .stat-label {
    color: #64748b;
}

/* --- Board Columns --- */
body.light-theme .board-column {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.light-theme .column-header {
    border-color: #e2e8f0;
}

body.light-theme .column-header h2 {
    color: #1e293b;
}

body.light-theme .column-count {
    color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
}

/* --- Gantt Chart --- */
body.light-theme .gantt-section {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.light-theme .gantt-section h3 {
    color: #1e293b;
}

body.light-theme .gantt-header-cell {
    color: #64748b;
    border-color: #e2e8f0;
}

body.light-theme .gantt-row {
    border-color: #f1f5f9;
}

body.light-theme .gantt-task-label {
    color: #475569;
}

body.light-theme .gantt-empty {
    color: #94a3b8;
}

/* --- Flow Center & In Progress --- */
body.light-theme .flow-center {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.light-theme .flow-center-header,
body.light-theme .flow-center-header h3 {
    color: #1e293b;
}

body.light-theme .in-progress-section {
    background: #f8fafc;
    border-color: #e2e8f0;
}

body.light-theme .in-progress-header h3 {
    color: #1e293b;
}

/* --- Cards --- */
body.light-theme .card {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

body.light-theme .card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border-color: #cbd5e1;
}

body.light-theme .card-title {
    color: #1e293b;
}

body.light-theme .card-desc {
    color: #64748b;
}

body.light-theme .card-creator {
    color: #94a3b8;
}

body.light-theme .card-footer {
    border-color: #f1f5f9;
}

/* --- Buttons --- */
body.light-theme .btn-ghost {
    color: #475569;
}

body.light-theme .btn-ghost:hover {
    color: #1e293b;
    background: #f1f5f9;
}

body.light-theme .header-right .btn {
    color: #475569;
}

body.light-theme .header-right .btn:hover {
    color: #1e293b;
    background: #f1f5f9;
}

/* --- Modal --- */
body.light-theme .modal-overlay {
    background: rgba(15, 23, 42, 0.4);
}

body.light-theme .modal {
    background: #ffffff;
    border-color: #e2e8f0;
    color: #1e293b;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

body.light-theme .modal-title {
    color: #1e293b;
}

body.light-theme .modal-close {
    color: #64748b;
}

body.light-theme .modal-close:hover {
    color: #1e293b;
    background: #f1f5f9;
}

/* --- Forms --- */
body.light-theme .form-input,
body.light-theme .form-select,
body.light-theme .form-textarea {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #1e293b;
}

body.light-theme .form-input:focus,
body.light-theme .form-select:focus,
body.light-theme .form-textarea:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

body.light-theme .form-label {
    color: #475569;
}

body.light-theme .detail-section-title {
    color: #1e293b;
}

/* --- Login --- */
body.light-theme #login-page {
    background: linear-gradient(135deg, #e0e7ff, #f0f2f8, #ede9fe);
}

body.light-theme .login-container {
    background: rgba(255, 255, 255, 0.95);
    border-color: #e2e8f0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
}

body.light-theme .login-subtitle {
    color: #64748b;
}

/* --- Toast --- */
body.light-theme .toast {
    background: #ffffff;
    color: #1e293b;
    border-color: #e2e8f0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* --- Scrollbar --- */
body.light-theme ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
}

body.light-theme ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* --- Context Menu --- */
body.light-theme .card-context-menu {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

body.light-theme .context-menu-item {
    color: #475569;
}

body.light-theme .context-menu-item:hover {
    background: #f1f5f9;
    color: #1e293b;
}

/* --- Approval / Comments --- */
body.light-theme .approval-level-badge {
    background: rgba(99, 102, 241, 0.06);
    border-color: rgba(99, 102, 241, 0.15);
}

body.light-theme .comment-bubble {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #475569;
}

/* ========== TradeTracker Light ========== */
body.light-theme .topbar {
    background: rgba(255, 255, 255, 0.92);
    border-color: #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.light-theme .logo-text {
    color: #1e293b;
}

body.light-theme .sidebar {
    background: rgba(255, 255, 255, 0.85);
    border-color: #e2e8f0;
}

body.light-theme .sidebar-footer {
    border-color: #e2e8f0;
}

body.light-theme .stat-mini-value {
    color: #1e293b;
}

body.light-theme .stat-mini-label {
    color: #94a3b8;
}

body.light-theme .nav-item {
    color: #64748b;
}

body.light-theme .nav-item:hover {
    color: #1e293b;
    background: #f1f5f9;
}

body.light-theme .nav-item.active {
    color: #6366f1;
    background: rgba(99, 102, 241, 0.08);
}

body.light-theme .main-content {
    background: #f0f2f8;
}

body.light-theme .stat-card {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.light-theme .stat-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

body.light-theme .stat-card .stat-label {
    color: #64748b;
}

body.light-theme .stat-card .stat-value {
    color: #1e293b;
}

body.light-theme .stage-card {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.light-theme .stage-label {
    color: #475569;
}

body.light-theme .stage-count {
    color: #1e293b;
}

body.light-theme .stage-bar-bg {
    background: #e2e8f0;
}

body.light-theme .view-header h1 {
    background: linear-gradient(135deg, #1e293b, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body.light-theme .search-box {
    background: #ffffff;
    border-color: #e2e8f0;
}

body.light-theme .search-box:focus-within {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

body.light-theme .search-box input {
    color: #1e293b;
}

body.light-theme .search-box svg {
    color: #94a3b8;
}

body.light-theme .search-box kbd {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #64748b;
}

body.light-theme .current-date {
    color: #475569;
}

body.light-theme .filter-select {
    background: #ffffff;
    border-color: #e2e8f0;
    color: #1e293b;
}

body.light-theme .filter-select option {
    background: #ffffff;
}

body.light-theme .table-container,
body.light-theme .panel {
    background: #ffffff;
    border-color: #e2e8f0;
}

body.light-theme table th {
    color: #64748b;
    border-color: #e2e8f0;
    background: #f8fafc;
}

body.light-theme table td {
    color: #475569;
    border-color: #f1f5f9;
}

body.light-theme table tr:hover td {
    background: #f8fafc;
}

body.light-theme .btn-secondary {
    background: #ffffff;
    border-color: #e2e8f0;
    color: #475569;
}

body.light-theme .btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
}

body.light-theme .detail-card,
body.light-theme .info-card {
    background: #ffffff;
    border-color: #e2e8f0;
}

body.light-theme .detail-label {
    color: #94a3b8;
}

body.light-theme .detail-value {
    color: #1e293b;
}

body.light-theme .empty-state {
    color: #94a3b8;
}

/* ==================== TRADE TRACKER STYLES ==================== */

/* ================================================
   TRADE TRACKER — Design System & Styles
   Dark Glassmorphism Theme
   ================================================ */

/* ---------- Design Tokens ---------- */
:root {
    /* Base Colors */
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-tertiary: #1a2236;
    --bg-elevated: rgba(30, 41, 70, 0.6);

    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --glass-blur: blur(20px);

    /* Text Colors */
    --text-primary: #f0f2f8;
    --text-secondary: #8b95b0;
    --text-muted: #5a6480;
    --text-accent: #a5b4fc;

    /* Accent Colors */
    --accent-primary: #6366f1;
    --accent-primary-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.25);
    --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);

    /* Stat Card Gradients */
    --gradient-total: linear-gradient(135deg, #3b82f6, #6366f1);
    --gradient-active: linear-gradient(135deg, #f59e0b, #ef4444);
    --gradient-pending: linear-gradient(135deg, #06b6d4, #3b82f6);
    --gradient-done: linear-gradient(135deg, #10b981, #06b6d4);

    /* Stage Colors */
    --stage-inquiry: #f59e0b;
    --stage-requirement: #8b5cf6;
    --stage-quotation: #3b82f6;
    --stage-feedback: #10b981;
    --stage-closed: #6b7280;

    /* Priority Colors */
    --priority-high: #ef4444;
    --priority-medium: #f59e0b;
    --priority-low: #10b981;

    /* Semantic */
    --danger: #ef4444;
    --danger-hover: #f87171;
    --success: #10b981;
    --warning: #f59e0b;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 999px;

    /* Layout */
    --topbar-height: 60px;
    --sidebar-width: 240px;
    --sidebar-collapsed: 64px;

    /* Transition */
    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    /* Font */
    --font-sans: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Background ambient glow */
body::before {
    content: '';
    position: fixed;
    top: -200px;
    right: -200px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    bottom: -200px;
    left: -100px;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

input,
select,
textarea,
button {
    font-family: inherit;
    font-size: inherit;
}

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

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ============ TOP BAR ============ */
.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
    z-index: 50;
    flex-shrink: 0;
}

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

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
}

.sidebar-toggle:hover {
    color: var(--text-primary);
    background: var(--glass-bg);
}

#module-trade .logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: auto;
    height: auto;
    background: none;
    box-shadow: none;
    font-size: inherit;
    border-radius: 0;
    justify-content: flex-start;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 0 20px var(--accent-glow);
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.logo-accent {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.topbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
    max-width: 480px;
    margin: 0 var(--space-xl);
}

.search-box {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    padding: var(--space-sm) var(--space-md);
    transition: all var(--transition-base);
}

.search-box:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-box svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-box input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    color: var(--text-primary);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box kbd {
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 2px 6px;
    color: var(--text-muted);
    font-family: var(--font-sans);
}

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

.current-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ============ SIDEBAR ============ */
.app-container {
    display: flex;
    height: 100%;
}

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: rgba(17, 24, 39, 0.5);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all var(--transition-slow);
    overflow: hidden;
    z-index: 50;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
    min-width: var(--sidebar-collapsed);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: var(--space-md) var(--space-sm);
    gap: var(--space-xs);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--transition-base);
    white-space: nowrap;
    position: relative;
}

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

.nav-item.active {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.12);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--accent-gradient);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.nav-item svg {
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--accent-primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: var(--space-md);
    border-top: 1px solid var(--glass-border);
}

.sidebar-stats {
    display: flex;
    gap: var(--space-md);
}

.stat-mini {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.stat-mini-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-mini-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ============ MAIN CONTENT ============ */
.main-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space-xl);
    position: relative;
    z-index: 1;
}

.view {
    display: none;
    animation: fadeIn 0.35s ease;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.view-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-primary), var(--text-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.view-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--accent-glow);
}

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

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

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

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

.btn-archive-toggle.active {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

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

.btn-upload {
    cursor: pointer;
}

/* ---------- Filter ---------- */
.filter-group {
    display: flex;
    gap: var(--space-sm);
}

.filter-select {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    outline: none;
    transition: all var(--transition-fast);
    -webkit-appearance: none;
    appearance: none;
}

.filter-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.filter-select option {
    background: var(--bg-secondary);
}

/* ============ STAT CARDS ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.stat-card:active {
    transform: translateY(0);
}

.stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.08;
    border-radius: inherit;
}

.stat-total::before {
    background: var(--gradient-total);
}

.stat-active::before {
    background: var(--gradient-active);
}

.stat-pending::before {
    background: var(--gradient-pending);
}

.stat-done::before {
    background: var(--gradient-done);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-total .stat-card-icon {
    background: var(--gradient-total);
    color: white;
}

.stat-active .stat-card-icon {
    background: var(--gradient-active);
    color: white;
}

.stat-pending .stat-card-icon {
    background: var(--gradient-pending);
    color: white;
}

.stat-done .stat-card-icon {
    background: var(--gradient-done);
    color: white;
}

.stat-card-info {
    display: flex;
    flex-direction: column;
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

.stat-card-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: var(--space-xs);
}

/* ============ DASHBOARD GRID ============ */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
}

/* ---------- Card ---------- */
.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-base);
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

.card-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--glass-border);
}

.card-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-body {
    padding: var(--space-lg);
}

/* ---------- Stage Bars ---------- */
.stage-bars {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.stage-bar-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.stage-bar-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    width: 70px;
    flex-shrink: 0;
    text-align: right;
}

.stage-bar-track {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.stage-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
    min-width: 0;
}

.stage-bar-count {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    width: 28px;
    text-align: center;
}

/* ---------- Recent List ---------- */
.recent-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 320px;
    overflow-y: auto;
}

.recent-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.recent-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.recent-item-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.recent-item-info {
    flex: 1;
    min-width: 0;
}

.recent-item-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-item-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.recent-item-stage {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ============ PROJECT CARDS ============ */
.projects-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: var(--space-md);
}

.project-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    animation: slideUp 0.3s ease backwards;
}

.project-card:hover {
    transform: translateY(-3px);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3), 0 0 20px var(--accent-glow);
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.project-card-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    flex: 1;
    margin-right: var(--space-sm);
}

.priority-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 5px;
}

.priority-dot.high {
    background: var(--priority-high);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.priority-dot.medium {
    background: var(--priority-medium);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

.priority-dot.low {
    background: var(--priority-low);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.project-card-customer {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

/* Mini Pipeline */
.pipeline-mini {
    display: flex;
    gap: 3px;
    margin-bottom: var(--space-md);
}

.pipeline-mini-step {
    flex: 1;
    height: 4px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.06);
    transition: background var(--transition-base);
}

.pipeline-mini-step.completed {
    background: var(--accent-primary);
}

.pipeline-mini-step.current {
    background: var(--accent-primary);
    box-shadow: 0 0 6px var(--accent-glow);
}

.project-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.project-card-stage {
    font-size: 0.8rem;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-weight: 600;
}

.project-card-amount {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-accent);
}

.project-card-tags {
    display: flex;
    gap: var(--space-xs);
    flex-wrap: wrap;
    margin-bottom: var(--space-md);
}

.tag {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: rgba(165, 180, 252, 0.1);
    color: var(--text-accent);
    border: 1px solid rgba(165, 180, 252, 0.15);
}

/* Stage badge colors */
.stage-badge-inquiry {
    background: rgba(245, 158, 11, 0.15);
    color: var(--stage-inquiry);
}

.stage-badge-requirement {
    background: rgba(139, 92, 246, 0.15);
    color: var(--stage-requirement);
}

.stage-badge-quotation {
    background: rgba(59, 130, 246, 0.15);
    color: var(--stage-quotation);
}

.stage-badge-feedback {
    background: rgba(16, 185, 129, 0.15);
    color: var(--stage-feedback);
}

.stage-badge-closed {
    background: rgba(107, 114, 128, 0.15);
    color: #9ca3af;
}

.pipeline-mini-closed {
    font-size: 0.65rem;
    line-height: 4px;
    margin-left: 2px;
    opacity: 0.6;
}

/* ============ CUSTOMER CARDS ============ */
.customers-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-md);
}

.customer-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all var(--transition-base);
    animation: slideUp 0.3s ease backwards;
}

.customer-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.customer-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.customer-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.customer-card-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.customer-card-contact {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.customer-card-details {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.customer-detail-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.customer-detail-row svg {
    flex-shrink: 0;
    opacity: 0.5;
}

.customer-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: var(--space-md);
    border-top: 1px solid var(--glass-border);
}

.customer-project-count {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.customer-card-actions {
    display: flex;
    gap: var(--space-sm);
}

/* ============ DATA VIEW ============ */
.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-lg);
}

.data-card .card-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.data-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.data-actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.data-stats {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.data-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--glass-border);
}

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

.data-stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.data-stat-value {
    font-weight: 700;
    color: var(--text-primary);
}

/* ============ MODALS ============ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
    padding: var(--space-lg);
}

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

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-base);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

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

.modal-large {
    max-width: 900px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--glass-border);
}

.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--glass-bg);
}

.modal-body {
    padding: var(--space-lg);
}

/* ---------- Forms ---------- */
.form-row {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.form-group-wide {
    flex: 1 1 100%;
}

.tag-select {
    position: relative;
}

.tag-select-display {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.45rem 0.6rem;
    min-height: 38px;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.tag-select-display:hover {
    border-color: var(--primary);
}

.tag-select-placeholder {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.tag-select-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--primary);
    color: #fff;
    font-size: 0.78rem;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    white-space: nowrap;
}

.tag-select-chip-remove {
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.tag-select-chip-remove:hover {
    opacity: 1;
}

.tag-select-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    margin-top: 4px;
    max-height: 160px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.tag-select-dropdown.open {
    display: block;
}

.tag-select-dropdown label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary) !important;
    font-weight: 400 !important;
    transition: background 0.15s;
}

.tag-select-dropdown label:hover {
    background: rgba(255, 255, 255, 0.06);
}

.tag-select-dropdown input[type="checkbox"] {
    accent-color: var(--primary);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.tag-select-dropdown-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.75rem;
    text-align: center;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.required {
    color: var(--danger);
}

.form-group input,
.form-group select,
.form-group textarea {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-primary);
    outline: none;
    transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

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

.form-group select {
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.form-group select option {
    background: var(--bg-secondary);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--glass-border);
}

/* ============ PROJECT DETAIL ============ */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
}

.detail-section {
    margin-bottom: var(--space-lg);
}

.detail-section h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.detail-section-header h3 {
    margin-bottom: 0;
}

.detail-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.detail-info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-info-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-info-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* Pipeline */
.pipeline {
    display: flex;
    gap: 2px;
    align-items: center;
}

.pipeline-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-xs);
}

.pipeline-step-bar {
    width: 100%;
    height: 6px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.06);
    transition: all var(--transition-base);
}

.pipeline-step.completed .pipeline-step-bar {
    background: var(--accent-primary);
}

.pipeline-step.current .pipeline-step-bar {
    background: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-glow);
}

.pipeline-step-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
}

.pipeline-step.completed .pipeline-step-label,
.pipeline-step.current .pipeline-step-label {
    color: var(--text-accent);
}

/* Follow-up */
.followup-form {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    animation: fadeIn 0.2s ease;
}

.followup-form .form-group {
    margin-bottom: var(--space-sm);
}

.followup-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
}

.followup-timeline {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 360px;
    overflow-y: auto;
}

.followup-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--glass-border);
    transition: all var(--transition-fast);
    animation: slideUp 0.2s ease;
}

.followup-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.followup-item.type-email {
    border-left-color: var(--stage-quotation);
}

.followup-item.type-phone {
    border-left-color: var(--stage-inquiry);
}

.followup-item.type-meeting {
    border-left-color: var(--stage-sample);
}

.followup-item.type-other {
    border-left-color: var(--text-muted);
}

.followup-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.followup-content {
    flex: 1;
    min-width: 0;
}

.followup-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.5;
    word-break: break-word;
}

.followup-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-xs);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.followup-next {
    color: var(--warning);
    font-weight: 500;
}

.detail-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--glass-border);
}

/* ============ EMPTY STATE ============ */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl) var(--space-lg);
    text-align: center;
}

.empty-state-icon {
    color: var(--text-muted);
    margin-bottom: var(--space-lg);
    opacity: 0.4;
}

.empty-state h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.empty-state-mini {
    text-align: center;
    padding: var(--space-xl) var(--space-md);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ============ TOAST ============ */
.toast-container {
    position: fixed;
    bottom: var(--space-xl);
    right: var(--space-xl);
    display: flex;
    flex-direction: column-reverse;
    gap: var(--space-sm);
    z-index: 300;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    color: var(--text-primary);
    font-size: 0.9rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    max-width: 360px;
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--danger);
}

.toast.info {
    border-left: 3px solid var(--accent-primary);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(30px);
    }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .detail-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: var(--topbar-height);
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
        z-index: 90;
        background: var(--bg-secondary);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        padding: var(--space-md);
    }

    .topbar-center {
        display: none;
    }

    .view-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .projects-list,
    .customers-list {
        grid-template-columns: 1fr;
    }

    .form-row {
        flex-direction: column;
    }

    .modal {
        max-width: 100%;
        border-radius: var(--radius-lg);
    }

    .detail-layout {
        grid-template-columns: 1fr;
    }

    .filter-group {
        width: 100%;
    }

    .filter-select {
        flex: 1;
    }

    .data-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .pipeline-step-label {
        font-size: 0.55rem;
    }
}

/* ==================== WORKSTATION MODULE SHELL ==================== */

/* Module Sidebar */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100%;
}

.module-sidebar {
    width: 64px;
    min-width: 64px;
    background: rgba(10, 10, 20, 0.95);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 12px 0;
    z-index: 100;
}

.module-sidebar-top,
.module-sidebar-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.module-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-weight: 800;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.module-nav-item {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: rgba(255, 255, 255, 0.45);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-size: 12px;
}

.module-nav-item:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.06);
}

.module-nav-item.active {
    color: #fff;
    background: rgba(99, 102, 241, 0.2);
}

.module-nav-label {
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* Module Content */
.module-content {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.module-panel {
    display: none;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    position: absolute;
    top: 0;
    left: 0;
}

.module-panel.active {
    display: flex;
    flex-direction: column;
}

/* TeamBoard module full width */
#module-teamboard .app-content {
    width: 100%;
    max-width: 100%;
    padding: 0;
}

/* Trade module layout */
.trade-app-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.trade-sidebar {
    width: 220px;
    min-width: 220px;
    background: rgba(15, 15, 30, 0.6);
    backdrop-filter: blur(12px);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow-y: auto;
}

.trade-sidebar .sidebar-nav {
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.trade-sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.15s;
}

.trade-sidebar .nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.85);
}

.trade-sidebar .nav-item.active {
    background: rgba(99, 102, 241, 0.15);
    color: #fff;
    font-weight: 600;
}

.trade-sidebar .nav-badge {
    margin-left: auto;
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 600;
}

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

.sidebar-stats {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.stat-mini {
    text-align: center;
}

.stat-mini-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.stat-mini-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
}

.trade-main-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Trade View Styles */
.trade-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.trade-view-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.trade-view-actions {
    display: flex;
    gap: 8px;
}

.trade-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.trade-stat-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 16px 20px;
}

.trade-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.trade-stat-value {
    font-size: 24px;
    font-weight: 800;
}

.trade-section-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.trade-pipeline-overview {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.pipeline-overview-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    min-width: 72px;
}

.pipeline-overview-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.pipeline-overview-label {
    font-size: 11px;
    color: var(--text-muted);
}

.pipeline-overview-count {
    font-size: 18px;
    font-weight: 700;
}

/* Stage Bar Distribution */
.trade-stage-bars {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
    margin-bottom: 24px;
}

.stage-bar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    transition: all 0.25s ease;
    cursor: default;
}

.stage-bar-item:hover {
    background: rgba(35, 35, 60, 0.7);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stage-bar-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 80px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stage-bar-track {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
    min-width: 40px;
}

.stage-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 0;
    box-shadow: 0 0 8px currentColor;
    opacity: 0.9;
}

.stage-bar-count {
    font-size: 16px;
    font-weight: 800;
    min-width: 28px;
    text-align: right;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.trade-recent-pending {
    font-size: 11px;
    color: #f59e0b;
    font-weight: 600;
    white-space: nowrap;
}

.trade-recent-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.trade-recent-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    cursor: pointer;
    transition: background 0.15s;
}

.trade-recent-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.trade-recent-stage {
    font-size: 16px;
}

.trade-recent-name {
    flex: 1;
    font-weight: 500;
    font-size: 13px;
}

.trade-recent-customer {
    font-size: 12px;
    color: var(--text-muted);
}

.trade-recent-time {
    font-size: 11px;
    color: var(--text-muted);
}

.trade-project-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.trade-project-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.15s;
}

.trade-project-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(255, 255, 255, 0.04);
}

.trade-project-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.trade-project-stage {
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.trade-project-amount {
    margin-left: auto;
    font-weight: 700;
    font-size: 14px;
    color: #10b981;
}

.trade-project-card-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.trade-project-card-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.trade-project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.trade-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}

.trade-detail-content {
    padding: 0 4px;
}

.trade-detail-pipeline {
    display: flex;
    gap: 2px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding: 8px 0;
}

.trade-detail-actions {
    display: flex;
    gap: 8px;
    margin: 16px 0;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.trade-followups-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.trade-data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.trade-data-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 20px;
}

.trade-data-card h3 {
    margin-bottom: 8px;
    font-size: 16px;
}

.trade-data-card p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.empty-state-mini {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: 13px;
}

/* Pipeline steps in detail */
.pipeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 60px;
    opacity: 0.3;
    transition: opacity 0.2s;
}

.pipeline-step.completed,
.pipeline-step.current {
    opacity: 1;
}

.pipeline-step-bar {
    height: 4px;
    width: 100%;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.1);
}

.pipeline-step.completed .pipeline-step-bar {
    background: var(--step-color, #6366f1);
}

.pipeline-step.current .pipeline-step-bar {
    background: var(--step-color, #6366f1);
    box-shadow: 0 0 8px var(--step-color, #6366f1);
}

.pipeline-step-label {
    font-size: 11px;
    text-align: center;
    line-height: 1.3;
}

.pipeline-closed {
    text-align: center;
    padding: 12px;
    color: var(--text-muted);
    font-size: 14px;
}

/* Followup items */
.followup-item {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.followup-icon {
    font-size: 16px;
    margin-top: 2px;
}

.followup-content {
    flex: 1;
}

.followup-text {
    font-size: 13px;
    margin-bottom: 4px;
}

.followup-meta {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: var(--text-muted);
}

.followup-next {
    color: #f59e0b;
}

/* Tag styles */
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
}

/* Trade topbar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(10, 10, 20, 0.5);
    backdrop-filter: blur(12px);
    min-height: 48px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-center {
    flex: 1;
    display: flex;
    justify-content: center;
    max-width: 400px;
    margin: 0 auto;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-text {
    font-size: 15px;
    font-weight: 700;
}

.logo-accent {
    color: #818cf8;
}

.current-date {
    font-size: 12px;
    color: var(--text-muted);
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    width: 100%;
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 13px;
    width: 100%;
}

.search-box kbd {
    font-size: 10px;
    padding: 1px 5px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    color: var(--text-muted);
}

/* Login page - ensure it overlays module sidebar */
.login-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
}

/* Customer card styles (shared between trade views) */
.customer-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.15s;
}

.customer-card:hover {
    border-color: rgba(99, 102, 241, 0.2);
}

.customer-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.customer-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.customer-card-name {
    font-weight: 600;
    font-size: 14px;
}

.customer-card-contact {
    font-size: 12px;
    color: var(--text-muted);
}

.customer-card-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.customer-detail-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.customer-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.customer-project-count {
    font-size: 11px;
    color: var(--text-muted);
}

.customer-card-actions {
    display: flex;
    gap: 6px;
}

/* Responsive */
@media (max-width: 768px) {
    .module-sidebar {
        width: 48px;
        min-width: 48px;
    }

    .module-nav-label {
        display: none;
    }

    .trade-sidebar {
        display: none;
    }

    .trade-app-container {
        flex-direction: column;
    }

    .trade-card-grid {
        grid-template-columns: 1fr;
    }

    .topbar-center {
        display: none;
    }
}