/* ========================================
   CA TASK MANAGER V3 - Sunrise UI
   Gen-Z fresh & professional design
   ======================================== */

:root {
    /* ── Sunrise Palette ── */
    --peach: #ff8a6b;
    --rose: #ff8fab;
    --violet: #a78bfa;
    --mint: #68d4a9;
    --sky: #8ec5ff;
    --sun: #ffd479;
    --coral: #ff6b8a;

    /* ── Brand / Primary ── */
    --primary: #7c6ef9;
    --primary-light: #a78bfa;
    --primary-dark: #5b4bdb;

    /* ── Sidebar (always dark, both modes) ── */
    --sidebar-bg: #1a1a24;
    --sidebar-hover: rgba(255,255,255,0.07);
    --sidebar-active: rgba(167,139,250,0.18);

    /* ── Light Mode Surfaces ── */
    --bg: #fdfcf9;
    --white: #ffffff;
    --card-bg: #ffffff;
    --text: #1a1827;
    --text-light: #5a5a72;
    --text-muted: #9898b2;
    --border: #ede9e0;
    --border-light: #f5f3ef;

    /* ── Status Colors ── */
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;

    /* ── Other Accents ── */
    --purple: #8b5cf6;
    --pink: #ec4899;
    --teal: #14b8a6;
    --orange: #f97316;
    --cyan: #06b6d4;

    /* ── Layout ── */
    --radius: 14px;
    --radius-sm: 10px;
    --radius-lg: 20px;
    --shadow: 0 1px 4px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
    --transition: all 0.22s ease;
}

/* ── Dark Mode Overrides ── */
[data-theme="dark"] {
    --bg: #12121a;
    --white: #1e1e2e;
    --card-bg: #1e1e2e;
    --text: #e4e2f0;
    --text-light: #9898b8;
    --text-muted: #5e5e78;
    --border: rgba(255,255,255,0.08);
    --border-light: rgba(255,255,255,0.04);
    --success-light: rgba(16,185,129,0.18);
    --warning-light: rgba(245,158,11,0.18);
    --danger-light: rgba(239,68,68,0.18);
    --info-light: rgba(59,130,246,0.18);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, .logo-text, .page-title, .kpi-value, .login-logo .logo-text {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
}

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

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

/* ========== SIDEBAR ========== */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: var(--transition);
    overflow-y: auto;
}

.sidebar.collapsed {
    width: 72px;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .user-details {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 10px;
}

.sidebar.collapsed .user-info {
    justify-content: center;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: conic-gradient(from 135deg, #ff8a6b, #a78bfa, #68d4a9, #8ec5ff, #ff8fab, #ffd479, #ff8a6b);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 17px;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    color: white;
    white-space: nowrap;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 8px;
    color: #cbd5e1;
    font-size: 13.5px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: white;
    transform: translateX(2px);
}

.nav-item.active {
    background: var(--sidebar-active);
    color: white;
    border-left: 2px solid var(--violet);
}

.nav-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 8px 12px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--pink));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    color: white;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: #94a3b8;
    text-transform: capitalize;
}

.logout-btn {
    color: #94a3b8;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition);
}

.logout-btn:hover {
    background: rgba(239,68,68,0.2);
    color: #ef4444;
}

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

.sidebar.collapsed ~ .main-content {
    margin-left: 72px;
}

.top-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 0 28px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text);
    padding: 4px;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 14px;
    transition: var(--transition);
}

.header-search:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.header-search input {
    border: none;
    background: none;
    outline: none;
    font-size: 13px;
    color: var(--text);
    width: 200px;
    font-family: inherit;
}

.header-fy {
    background: linear-gradient(135deg, var(--violet), var(--sky));
    color: white;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    font-family: 'Space Grotesk', sans-serif;
    letter-spacing: 0.2px;
}

/* ========== CONTENT AREA ========== */
.content-area {
    padding: 24px 28px;
}

/* ========== FLASH MESSAGES ========== */
.flash-container {
    padding: 16px 28px 0;
}

.flash-message {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    animation: slideIn 0.3s ease;
}

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

.flash-success { background: var(--success-light); color: #065f46; border-left: 4px solid var(--success); }
.flash-error { background: var(--danger-light); color: #991b1b; border-left: 4px solid var(--danger); }
.flash-warning { background: var(--warning-light); color: #92400e; border-left: 4px solid var(--warning); }
.flash-info { background: var(--info-light); color: #1e40af; border-left: 4px solid var(--info); }

.flash-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.5;
    color: inherit;
}

/* ========== CARDS ========== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.3s ease;
}

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

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 22px;
}

.card-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

/* ========== KPI CARDS ========== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.kpi-card {
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    border: 1px solid var(--border);
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

/* Vibrant tint backgrounds */
.kpi-card.kpi-primary  { background: linear-gradient(135deg, rgba(124,110,249,0.10) 0%, var(--card-bg) 60%); }
.kpi-card.kpi-success  { background: linear-gradient(135deg, rgba(104,212,169,0.14) 0%, var(--card-bg) 60%); }
.kpi-card.kpi-warning  { background: linear-gradient(135deg, rgba(255,212,121,0.18) 0%, var(--card-bg) 60%); }
.kpi-card.kpi-danger   { background: linear-gradient(135deg, rgba(255,107,138,0.12) 0%, var(--card-bg) 60%); }
.kpi-card.kpi-info     { background: linear-gradient(135deg, rgba(142,197,255,0.16) 0%, var(--card-bg) 60%); }
.kpi-card.kpi-purple   { background: linear-gradient(135deg, rgba(167,139,250,0.14) 0%, var(--card-bg) 60%); }

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.kpi-card.kpi-primary::before  { background: linear-gradient(90deg, var(--violet), var(--sky)); }
.kpi-card.kpi-success::before  { background: linear-gradient(90deg, var(--mint), var(--sky)); }
.kpi-card.kpi-warning::before  { background: linear-gradient(90deg, var(--sun), var(--peach)); }
.kpi-card.kpi-danger::before   { background: linear-gradient(90deg, var(--coral), var(--rose)); }
.kpi-card.kpi-info::before     { background: linear-gradient(90deg, var(--sky), var(--violet)); }
.kpi-card.kpi-purple::before   { background: linear-gradient(90deg, var(--violet), var(--rose)); }

.kpi-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.kpi-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    white-space: nowrap;
}

.btn:hover { opacity: 0.9; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-info { background: var(--info); color: white; }

.btn-outline {
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--bg); border-color: var(--text-muted); }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 8px; }

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

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

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

thead th {
    background: var(--bg);
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    vertical-align: middle;
}

tbody tr:hover {
    background: var(--border-light);
}

tbody tr:last-child td {
    border-bottom: none;
}

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

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

.form-control {
    width: 100%;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

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

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

.form-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-error {
    font-size: 11px;
    color: var(--danger);
    margin-top: 4px;
}

/* ========== STATUS BADGES ========== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background: var(--success-light); color: #065f46; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-info { background: var(--info-light); color: #1e40af; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-pink { background: #fce7f3; color: #9d174d; }
.badge-teal { background: #ccfbf1; color: #115e59; }
.badge-orange { background: #fff7ed; color: #c2410c; }

/* Status-specific badges */
.status-pending { background: #f1f5f9; color: #475569; }
.status-in_progress, .status-in-progress { background: var(--info-light); color: #1e40af; }
.status-sent_for_review, .status-sent-for-review { background: #fef3c7; color: #92400e; }
.status-approved { background: #d1fae5; color: #065f46; }
.status-rejected { background: #fee2e2; color: #991b1b; }
.status-done { background: #d1fae5; color: #065f46; }
.status-overdue { background: #fee2e2; color: #991b1b; }

/* Service status dots */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.dot-doing { background: var(--success); }
.dot-na { background: #d1d5db; }
.dot-hold { background: var(--warning); }
.dot-check { background: var(--orange); }

/* ========== MODALS ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 6px;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg);
    color: var(--text);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ========== FILTERS BAR ========== */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 7px 32px 7px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
    transition: var(--transition);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

.filter-text {
    background-image: none !important;
    cursor: text;
    padding-right: 12px;
}

.filter-search {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--white);
}

.filter-search input {
    border: none;
    outline: none;
    font-size: 13px;
    font-family: inherit;
    width: 180px;
}

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

.pagination a, .pagination span {
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    transition: var(--transition);
}

.pagination a:hover { background: var(--bg); }
.pagination .active { background: var(--primary); color: white; }
.pagination .disabled { color: var(--text-muted); pointer-events: none; }

/* ========== MATRIX GRID ========== */
.matrix-container {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
}

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

.matrix-table th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg);
}

.matrix-table th:first-child,
.matrix-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 20;
    background: var(--white);
    border-right: 2px solid var(--border);
    min-width: 200px;
}

.matrix-table th:first-child {
    z-index: 30;
    background: var(--bg);
}

.matrix-cell {
    padding: 6px 10px;
    border: 1px solid var(--border-light);
    text-align: center;
    min-width: 80px;
    cursor: pointer;
    transition: var(--transition);
}

.matrix-cell:hover {
    background: #f0f0ff;
}

.matrix-group-header {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white;
    padding: 8px 12px;
}

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 16px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 13px;
    margin-bottom: 20px;
}

/* ========== LOGIN PAGE ========== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a24 0%, #2a1a3e 40%, #1a2a3a 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(167,139,250,0.15) 0%, transparent 70%);
    top: -150px; left: -150px;
    pointer-events: none;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(104,212,169,0.12) 0%, transparent 70%);
    bottom: -100px; right: -100px;
    pointer-events: none;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 44px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

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

.login-logo .logo-icon {
    width: 48px;
    height: 48px;
    font-size: 24px;
}

.login-logo .logo-text {
    color: var(--text);
    font-size: 24px;
}

.login-title {
    text-align: center;
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 28px;
}

.login-card .form-control {
    padding: 12px 14px;
    font-size: 14px;
}

.login-card .btn {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    justify-content: center;
}

.login-hint {
    margin-top: 24px;
    padding: 14px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-light);
}

.login-hint strong {
    color: var(--text);
}

/* ========== TAGS ========== */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    background: var(--bg);
    color: var(--text-light);
}

.tag-remove {
    cursor: pointer;
    opacity: 0.5;
    font-size: 14px;
}

.tag-remove:hover { opacity: 1; }

/* ========== PROGRESS BAR ========== */
.progress {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-bar.bg-success { background: var(--success); }
.progress-bar.bg-primary { background: var(--primary); }
.progress-bar.bg-warning { background: var(--warning); }
.progress-bar.bg-danger { background: var(--danger); }

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

.page-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

/* ========== TABS ========== */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
    gap: 0;
}

.tab {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: var(--transition);
}

.tab:hover {
    color: var(--text);
}

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

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: block;
    }
}

@media (max-width: 768px) {
    .content-area {
        padding: 16px;
    }

    .top-header {
        padding: 0 16px;
    }

    .header-search {
        display: none;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========== UTILITY ========== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-bold { font-weight: 600; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mr-1 { margin-right: 8px; }
.ml-auto { margin-left: auto; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.w-full { width: 100%; }
.hidden { display: none; }

/* ========================================
   SUNRISE UI ENHANCEMENTS + DARK MODE
   ======================================== */

/* ── Dark Mode Toggle Button ── */
.dark-mode-toggle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    transition: var(--transition);
    flex-shrink: 0;
    line-height: 1;
}

.dark-mode-toggle:hover {
    background: var(--border-light);
    transform: rotate(20deg) scale(1.1);
    border-color: var(--violet);
}

/* ── Hero / Banner Card ── */
.hero-card {
    background: linear-gradient(135deg, #1a1a24 0%, #2d1b52 50%, #1a2e3a 100%);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    color: white;
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
    border: none;
    box-shadow: var(--shadow-md);
}

.hero-card::before {
    content: '';
    position: absolute;
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(167,139,250,0.25) 0%, transparent 70%);
    top: -80px; right: -50px;
    pointer-events: none;
}

.hero-card::after {
    content: '';
    position: absolute;
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(104,212,169,0.2) 0%, transparent 70%);
    bottom: -60px; left: 30%;
    pointer-events: none;
}

.hero-greeting {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
    background: linear-gradient(90deg, #fff 0%, rgba(255,255,255,0.85) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-sub {
    font-size: 13px;
    color: rgba(255,255,255,0.6);
    position: relative;
    z-index: 1;
    margin-bottom: 0;
}

/* ── Table dark mode ── */
[data-theme="dark"] thead th {
    background: rgba(255,255,255,0.04);
}

[data-theme="dark"] .table-wrapper {
    background: var(--card-bg);
    border-color: var(--border);
}

[data-theme="dark"] .matrix-table th:first-child,
[data-theme="dark"] .matrix-table td:first-child {
    background: var(--card-bg);
}

[data-theme="dark"] .matrix-table th {
    background: rgba(255,255,255,0.04);
}

/* ── Form controls dark mode ── */
[data-theme="dark"] .form-control {
    background: rgba(255,255,255,0.06);
    border-color: var(--border);
    color: var(--text);
}

[data-theme="dark"] .form-control:focus {
    border-color: var(--violet);
    box-shadow: 0 0 0 3px rgba(167,139,250,0.2);
}

[data-theme="dark"] .filter-select,
[data-theme="dark"] .filter-search {
    background: rgba(255,255,255,0.06);
    border-color: var(--border);
    color: var(--text);
}

[data-theme="dark"] .header-search {
    background: rgba(255,255,255,0.06);
    border-color: var(--border);
}

[data-theme="dark"] .header-search input {
    color: var(--text);
}

/* ── Btn outline dark mode ── */
[data-theme="dark"] .btn-outline {
    background: rgba(255,255,255,0.06);
    color: var(--text);
    border-color: var(--border);
}

[data-theme="dark"] .btn-outline:hover {
    background: rgba(255,255,255,0.1);
}

/* ── Modal dark mode ── */
[data-theme="dark"] .modal {
    background: var(--card-bg);
    border: 1px solid var(--border);
}

[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
    border-color: var(--border);
}

[data-theme="dark"] .modal-close:hover {
    background: rgba(255,255,255,0.08);
}

/* ── Card footer/header dark mode ── */
[data-theme="dark"] .card-header,
[data-theme="dark"] .card-footer {
    border-color: var(--border);
}

[data-theme="dark"] .card-footer {
    background: rgba(255,255,255,0.03);
}

/* ── Login card dark mode ── */
[data-theme="dark"] .login-card {
    background: #1e1e2e;
    border: 1px solid rgba(255,255,255,0.08);
}

[data-theme="dark"] .login-hint {
    background: rgba(255,255,255,0.05);
    color: var(--text-light);
}

/* ── Badge dark mode ── */
[data-theme="dark"] .badge-gray { background: rgba(255,255,255,0.08); color: var(--text-light); }
[data-theme="dark"] .status-pending { background: rgba(255,255,255,0.08); color: var(--text-light); }

/* ── Focus ring to violet ── */
.form-control:focus,
.filter-select:focus {
    border-color: var(--violet);
    box-shadow: 0 0 0 3px rgba(124,110,249,0.15);
}

/* ── Gradient text utility ── */
.gradient-text {
    background: linear-gradient(90deg, var(--violet), var(--sky));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Sunrise page title ── */
.page-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}

/* ── Smooth transitions for dark mode ── */
.card, .table-wrapper, .modal, .login-card,
.form-control, .filter-select, .btn-outline,
thead th, .card-header, .card-footer, .card-body,
.kpi-card, .badge, .top-header, .content-area,
.flash-message, .sidebar-footer {
    transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

/* ── Scrollbar styling (dark + light) ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Sidebar logo area pill on hover ── */
.sidebar-header .logo:hover .logo-icon {
    transform: rotate(15deg) scale(1.1);
    transition: transform 0.3s ease;
}

/* ── Active nav item subtle glow ── */
.nav-item.active .nav-icon {
    box-shadow: 0 0 12px rgba(167,139,250,0.4);
}

/* ── Bento dashboard grid ── */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}

.bento-span-2 { grid-column: span 2; }
.bento-span-3 { grid-column: span 3; }
.bento-span-4 { grid-column: span 4; }
.bento-span-6 { grid-column: span 6; }

@media (max-width: 1280px) {
    .bento-grid { grid-template-columns: repeat(4, 1fr); }
    .bento-span-4 { grid-column: span 4; }
    .bento-span-3 { grid-column: span 2; }
}

@media (max-width: 900px) {
    .bento-grid { grid-template-columns: repeat(2, 1fr); }
    .bento-span-2, .bento-span-3, .bento-span-4, .bento-span-6 { grid-column: span 2; }
}

/* ── Sunrise accent line for sections ── */
.section-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: '';
    width: 3px;
    height: 16px;
    background: linear-gradient(180deg, var(--violet), var(--mint));
    border-radius: 2px;
    flex-shrink: 0;
}

/* ── Sunrise status pills (richer) ── */
[data-theme="dark"] .status-in_progress,
[data-theme="dark"] .status-in-progress  { background: rgba(59,130,246,0.2); color: #93c5fd; }
[data-theme="dark"] .status-sent_for_review,
[data-theme="dark"] .status-sent-for-review { background: rgba(245,158,11,0.2); color: #fcd34d; }
[data-theme="dark"] .status-approved,
[data-theme="dark"] .status-done  { background: rgba(16,185,129,0.2); color: #6ee7b7; }
[data-theme="dark"] .status-rejected { background: rgba(239,68,68,0.2); color: #fca5a5; }
[data-theme="dark"] .status-overdue  { background: rgba(239,68,68,0.2); color: #fca5a5; }
[data-theme="dark"] .badge-success { background: rgba(16,185,129,0.2); color: #6ee7b7; }
[data-theme="dark"] .badge-warning { background: rgba(245,158,11,0.2); color: #fcd34d; }
[data-theme="dark"] .badge-danger  { background: rgba(239,68,68,0.2); color: #fca5a5; }
[data-theme="dark"] .badge-info    { background: rgba(59,130,246,0.2); color: #93c5fd; }
[data-theme="dark"] .badge-purple  { background: rgba(139,92,246,0.2); color: #c4b5fd; }
[data-theme="dark"] .badge-pink    { background: rgba(236,72,153,0.2); color: #f9a8d4; }
[data-theme="dark"] .badge-teal    { background: rgba(20,184,166,0.2); color: #5eead4; }
[data-theme="dark"] .badge-orange  { background: rgba(249,115,22,0.2); color: #fdba74; }

/* ========================================
   DASHBOARD V2 — Mockup Design
   ======================================== */

/* ── Greeting ── */
.dash-v2 { display: flex; flex-direction: column; gap: 20px; }
.dash-greeting-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.dash-greeting-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px; font-weight: 700; color: var(--text);
  line-height: 1.2; margin-bottom: 6px;
}
.dash-name { color: var(--peach); }
.dash-greeting-sub {
  font-size: 13px; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
}
.dash-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--mint); display: inline-block; flex-shrink: 0;
  box-shadow: 0 0 6px var(--mint);
}

/* ── Filters collapsible ── */
.dash-filters-wrap { border: none; }
.dash-filters-toggle {
  font-size: 12px; color: var(--text-muted); cursor: pointer;
  list-style: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 0;
}
.dash-filters-toggle::-webkit-details-marker { display: none; }
.dash-filters-wrap[open] .dash-filters-toggle { color: var(--text); }

/* ── Hero focus card ── */
.focus-card {
  background: linear-gradient(135deg, #1a1a2e 0%, #2d1b52 50%, #1a2d3a 100%);
  border-radius: var(--radius-lg); padding: 28px 32px;
  position: relative; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
}
.focus-card::before {
  content: ''; position: absolute;
  width: 350px; height: 350px; border-radius: 50%;
  background: radial-gradient(circle, rgba(167,139,250,0.2) 0%, transparent 70%);
  top: -100px; right: -50px; pointer-events: none;
}
.focus-card::after {
  content: ''; position: absolute;
  width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(104,212,169,0.15) 0%, transparent 70%);
  bottom: -50px; left: 30%; pointer-events: none;
}
.focus-tag {
  font-size: 11px; font-weight: 700; letter-spacing: .1em;
  color: rgba(255,255,255,0.5); text-transform: uppercase;
  margin-bottom: 12px; position: relative; z-index: 1;
}
.focus-heading {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px; font-weight: 700; color: white;
  line-height: 1.3; margin-bottom: 10px; position: relative; z-index: 1;
}
.focus-tasks-list {
  font-size: 13px; color: rgba(255,255,255,0.55);
  margin-bottom: 20px; position: relative; z-index: 1;
}
.focus-view-btn {
  display: inline-block; padding: 9px 20px;
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px; color: white; font-size: 13px; font-weight: 600;
  text-decoration: none; position: relative; z-index: 1;
  transition: var(--transition);
}
.focus-view-btn:hover { background: rgba(255,255,255,0.2); color: white; transform: none; }

/* ── 3-col KPI row ── */
.dash-kpi-row-3 {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.dash-kpi-tile {
  border-radius: var(--radius-lg); padding: 22px 24px;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  border: 1px solid var(--border); position: relative;
}
.dash-kpi-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.kpi-tile-blue   { background: linear-gradient(135deg, #dbeafe 0%, #ede9fe 100%); }
.kpi-tile-purple { background: linear-gradient(135deg, #ede9fe 0%, #e0e7ff 100%); }
.kpi-tile-salmon { background: linear-gradient(135deg, #fff1f2 0%, #fef3c7 100%); }
.kpi-tile-peach  { background: linear-gradient(135deg, #fff7ed 0%, #fff1f2 100%); }

[data-theme="dark"] .kpi-tile-blue   { background: linear-gradient(135deg, rgba(59,130,246,0.12) 0%, rgba(99,102,241,0.08) 100%); }
[data-theme="dark"] .kpi-tile-purple { background: linear-gradient(135deg, rgba(139,92,246,0.12) 0%, rgba(99,102,241,0.08) 100%); }
[data-theme="dark"] .kpi-tile-salmon { background: linear-gradient(135deg, rgba(244,63,94,0.1) 0%, rgba(245,158,11,0.08) 100%); }
[data-theme="dark"] .kpi-tile-peach  { background: linear-gradient(135deg, rgba(249,115,22,0.1) 0%, rgba(244,63,94,0.07) 100%); }

.kpi-tile-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.kpi-tile-label {
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  color: var(--text-light); text-transform: uppercase;
}
.kpi-tile-emoji { font-size: 20px; }
.kpi-tile-num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 42px; font-weight: 800; line-height: 1;
  color: var(--text); margin-bottom: 6px;
}
.kpi-tile-danger-num { color: #e44; }
[data-theme="dark"] .kpi-tile-danger-num { color: #f87171; }
.kpi-tile-sub { font-size: 12px; color: var(--text-muted); }
.kpi-tile-danger-sub { color: #e44; font-weight: 600; }
[data-theme="dark"] .kpi-tile-danger-sub { color: #f87171; }
.kpi-review-btn {
  display: inline-block; margin-top: 14px; padding: 8px 18px;
  background: #1a1a24; color: white; border-radius: 8px;
  font-size: 13px; font-weight: 600; text-decoration: none;
  transition: var(--transition);
}
.kpi-review-btn:hover { background: #2d2d40; color: white; }

/* ── Main two-col row ── */
.dash-main-row {
  display: grid; grid-template-columns: 300px 1fr; gap: 16px;
}
.dash-left-col { display: flex; flex-direction: column; gap: 0; }
.dash-left-col .dash-kpi-tile { flex-shrink: 0; }

/* ── Team online ── */
.team-online-grid {
  display: flex; flex-wrap: wrap; gap: 10px;
}
.team-online-member {
  display: flex; align-items: center; gap: 6px;
}
.team-online-name {
  font-size: 12px; color: var(--text-light); white-space: nowrap;
}

/* ── Active Work card ── */
.active-work-card { height: 100%; display: flex; flex-direction: column; }

/* ── Active Work tabs ── */
.aw-tabs {
  display: flex; gap: 4px; padding: 0 20px 14px;
}
.aw-tab {
  padding: 6px 14px; border-radius: 8px;
  font-size: 12px; font-weight: 600; border: none;
  background: var(--border-light); color: var(--text-muted);
  cursor: pointer; transition: var(--transition); font-family: inherit;
}
.aw-tab:hover { background: var(--border); color: var(--text); }
.aw-tab.active {
  background: rgba(124,110,249,0.15); color: var(--violet);
}

/* ── Active Work rows ── */
.aw-panel { flex: 1; }
.aw-panel.hidden { display: none; }
.aw-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; border-top: 1px solid var(--border-light);
  transition: background 0.15s;
}
.aw-row:hover { background: var(--border-light); }
.aw-cat-bubble {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; letter-spacing: .05em;
}
.aw-info { flex: 1; min-width: 0; }
.aw-task-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.aw-client-name { font-weight: 400; color: var(--text-muted); }
.aw-task-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.aw-due-badge {
  flex-shrink: 0; padding: 4px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.aw-due-red   { background: rgba(244,63,94,0.12); color: #e11d48; }
.aw-due-amber { background: rgba(245,158,11,0.12); color: #d97706; }
.aw-due-gray  { background: var(--border-light); color: var(--text-muted); }
[data-theme="dark"] .aw-due-red   { background: rgba(244,63,94,0.2); color: #fb7185; }
[data-theme="dark"] .aw-due-amber { background: rgba(245,158,11,0.2); color: #fbbf24; }
.aw-empty {
  padding: 40px 20px; text-align: center;
  color: var(--text-muted); font-size: 13px;
}

/* ── Sidebar: section labels + badges ── */
.nav-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: rgba(255,255,255,0.3);
  padding: 8px 12px 4px; margin-top: 4px;
}
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px;
  border-radius: 10px; background: rgba(255,255,255,0.15);
  color: white; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
}
.nav-badge-danger {
  background: rgba(244,63,94,0.8); color: white;
}

/* ── Responsive ── */
@media (max-width: 1100px) {
  .dash-main-row { grid-template-columns: 1fr; }
  .dash-kpi-row-3 { grid-template-columns: repeat(2, 1fr); }
  .dash-kpi-row-3 .kpi-tile-salmon { grid-column: span 2; }
}
@media (max-width: 768px) {
  .dash-kpi-row-3 { grid-template-columns: 1fr; }
  .dash-kpi-row-3 .kpi-tile-salmon { grid-column: span 1; }
  .focus-heading { font-size: 18px; }
  .dash-greeting-title { font-size: 22px; }
}
