/* ==========================================================================
   TEAM NBT TASK & WORKLOAD MANAGEMENT SYSTEM - STYLESHEET
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS & VARIABLES
   -------------------------------------------------------------------------- */
:root {
    /* Color Palette - Dark Theme (Default) */
    --bg-main: #0b0f19;
    --bg-header: rgba(15, 23, 42, 0.85);
    --bg-card: #1e293b;
    --bg-card-hover: #26354a;
    --bg-input: #0f172a;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-hover: rgba(255, 255, 255, 0.18);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;

    /* Primary Accent Colors */
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-glow: rgba(59, 130, 246, 0.25);
    --accent: #8b5cf6;

    /* Status Colors */
    --status-todo: #6366f1;
    --status-todo-bg: rgba(99, 102, 241, 0.12);
    --status-progress: #0284c7;
    --status-progress-bg: rgba(2, 132, 199, 0.12);
    --status-review: #a855f7;
    --status-review-bg: rgba(168, 85, 247, 0.12);
    --status-done: #10b981;
    --status-done-bg: rgba(16, 185, 129, 0.12);

    /* Priority Colors */
    --priority-urgent: #ef4444;
    --priority-urgent-bg: rgba(239, 68, 68, 0.15);
    --priority-high: #f97316;
    --priority-high-bg: rgba(249, 115, 22, 0.15);
    --priority-medium: #eab308;
    --priority-medium-bg: rgba(234, 179, 8, 0.15);
    --priority-low: #10b981;
    --priority-low-bg: rgba(16, 185, 129, 0.15);

    /* Layout & Effects */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
    --transition: all 0.25s ease;
    --font-family: 'Prompt', 'Kanit', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Light Mode Overrides */
[data-theme="light"] {
    --bg-main: #f1f5f9;
    --bg-header: rgba(255, 255, 255, 0.9);
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-input: #f8fafc;
    --border-color: #e2e8f0;
    --border-color-hover: #cbd5e1;

    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-dim: #94a3b8;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* --------------------------------------------------------------------------
   2. GLOBAL RESET & BASE STYLES
   -------------------------------------------------------------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color-hover);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}

/* --------------------------------------------------------------------------
   3. APP CONTAINER & HEADER
   -------------------------------------------------------------------------- */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1700px;
    margin: 0 auto;
    padding: 1rem 1.5rem 2rem 1.5rem;
    gap: 1.25rem;
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 1rem;
    z-index: 100;
    flex-wrap: wrap;
    gap: 1rem;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.logo-wrapper {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #fff;
    padding: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

.nbt-logo {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.brand-title {
    font-family: 'Kanit', sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.1;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* View Navigation */
.view-nav {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    gap: 4px;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.nav-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 8px var(--primary-glow);
}

/* Header Right Buttons */
.header-controls {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

/* Database Status Badge */
.db-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-muted);
    transition: var(--transition);
}

.db-status-badge.online {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.12);
    color: var(--status-done);
}

.db-status-badge.local {
    border-color: rgba(59, 130, 246, 0.4);
    background: rgba(59, 130, 246, 0.12);
    color: var(--primary);
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.icon-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color-hover);
    transform: translateY(-1px);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px var(--primary-glow);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px var(--primary-glow);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color-hover);
}

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

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}
.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
}

/* --------------------------------------------------------------------------
   4. METRICS STATS BAR
   -------------------------------------------------------------------------- */
.metrics-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.85rem;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 1rem 1.1rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

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

.metric-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.card-total .metric-icon { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.card-todo .metric-icon { background: var(--status-todo-bg); color: var(--status-todo); }
.card-progress .metric-icon { background: var(--status-progress-bg); color: var(--status-progress); }
.card-review .metric-icon { background: var(--status-review-bg); color: var(--status-review); }
.card-done .metric-icon { background: var(--status-done-bg); color: var(--status-done); }
.card-rate .metric-icon { background: rgba(234, 179, 8, 0.15); color: #eab308; }

.metric-info {
    display: flex;
    flex-direction: column;
}

.metric-value {
    font-family: 'Kanit', sans-serif;
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.1;
}

.metric-label {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   5. SEARCH & FILTER TOOLBAR
   -------------------------------------------------------------------------- */
.toolbar-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 250px;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.search-box input {
    width: 100%;
    padding: 0.55rem 2.2rem 0.55rem 2.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: var(--font-family);
    font-size: 0.88rem;
    outline: none;
    transition: var(--transition);
}

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

.clear-search-btn {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
}
.clear-search-btn:hover { color: var(--text-main); }

.filters-wrapper {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.filter-group select {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

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

/* --------------------------------------------------------------------------
   6. MAIN CONTENT & VIEWS
   -------------------------------------------------------------------------- */
.main-content {
    flex: 1;
}

.view-panel {
    display: none;
}
.view-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* --------------------------------------------------------------------------
   7. KANBAN BOARD VIEW
   -------------------------------------------------------------------------- */
.kanban-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(280px, 1fr));
    gap: 1.25rem;
    align-items: start;
    overflow-x: auto;
    padding-bottom: 1rem;
}

.kanban-column {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 270px);
    min-height: 500px;
}

[data-theme="light"] .kanban-column {
    background: rgba(255, 255, 255, 0.6);
}

.column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--border-color);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
}

.column-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: 'Kanit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
}

.status-todo { border-top: 3px solid var(--status-todo); }
.status-progress { border-top: 3px solid var(--status-progress); }
.status-review { border-top: 3px solid var(--status-review); }
.status-done { border-top: 3px solid var(--status-done); }

.task-count {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-full);
}

.kanban-tasks {
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    flex: 1;
    overflow-y: auto;
    min-height: 200px;
}

.kanban-tasks.drag-over {
    background: rgba(59, 130, 246, 0.08);
    border-radius: var(--radius-md);
}

/* TASK CARD */
.task-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    cursor: grab;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    position: relative;
    user-select: none;
}

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

.task-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.category-badge {
    font-size: 0.72rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-muted);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.priority-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.priority-urgent { background: var(--priority-urgent-bg); color: var(--priority-urgent); }
.priority-high { background: var(--priority-high-bg); color: var(--priority-high); }
.priority-medium { background: var(--priority-medium-bg); color: var(--priority-medium); }
.priority-low { background: var(--priority-low-bg); color: var(--priority-low); }

.task-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.35;
    word-break: break-word;
}

.task-card.completed .task-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

/* Subtasks Progress Bar in Card */
.subtask-progress-box {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.subtask-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.73rem;
    color: var(--text-muted);
}

.progress-bar-bg {
    height: 5px;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #10b981);
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border-color);
    margin-top: 0.2rem;
}

.assignee-info {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.avatar-sm {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    flex-shrink: 0;
}

.avatar-sm img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-full);
}

.assignee-name {
    font-size: 0.8rem;
    color: var(--text-main);
    font-weight: 500;
}

.due-date-info {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.due-date-info.overdue {
    color: var(--priority-urgent);
    font-weight: 600;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    opacity: 0.7;
    transition: var(--transition);
}

.task-card:hover .card-actions {
    opacity: 1;
}

.action-icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.action-icon-btn:hover {
    color: var(--primary);
    background: var(--bg-input);
}
.action-icon-btn.delete:hover {
    color: var(--priority-urgent);
}
.action-icon-btn.complete {
    color: var(--text-muted);
}
.action-icon-btn.complete:hover,
.action-icon-btn.complete.active {
    color: var(--status-done);
    background: var(--status-done-bg);
}

/* --------------------------------------------------------------------------
   8. TEAM WORKLOAD VIEW
   -------------------------------------------------------------------------- */
.section-intro {
    margin-bottom: 1.5rem;
}
.section-intro h2 {
    font-family: 'Kanit', sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
}
.section-intro p {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.team-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.25rem;
}

.team-member-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: var(--transition);
}

.team-member-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-color-hover);
}

.member-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar-lg {
    width: 54px;
    height: 54px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: #fff;
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    flex-shrink: 0;
    overflow: hidden;
}

.avatar-lg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-full);
}

.member-details h3 {
    font-family: 'Kanit', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.2;
}

.member-role {
    font-size: 0.82rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    display: inline-block;
    margin-top: 3px;
}

.member-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    border-radius: var(--radius-md);
    text-align: center;
}

.stat-box .num {
    font-family: 'Kanit', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    display: block;
}

.stat-box .lbl {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.member-tasks-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 4px;
}

.member-task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    gap: 0.5rem;
    border-left: 3px solid var(--status-todo);
}

.member-task-item.status-todo { border-left-color: var(--status-todo); }
.member-task-item.status-in-progress { border-left-color: var(--status-progress); }
.member-task-item.status-review { border-left-color: var(--status-review); }
.member-task-item.status-done { border-left-color: var(--status-done); text-decoration: line-through; opacity: 0.7; }

/* --------------------------------------------------------------------------
   9. LIST VIEW (TABLE)
   -------------------------------------------------------------------------- */
.list-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table-responsive {
    overflow-x: auto;
}

.task-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.88rem;
}

.task-table th {
    background: var(--bg-input);
    color: var(--text-muted);
    font-weight: 600;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.task-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.task-table tbody tr:hover {
    background: var(--bg-card-hover);
}

/* --------------------------------------------------------------------------
   10. ANALYTICS VIEW
   -------------------------------------------------------------------------- */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chart-card.wide {
    grid-column: span 2;
}

.chart-card h3 {
    font-family: 'Kanit', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
}

.chart-wrapper {
    position: relative;
    height: 280px;
    width: 100%;
}

/* --------------------------------------------------------------------------
   11. MODALS
   -------------------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    padding: 1rem;
}

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

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color-hover);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

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

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

.modal-header h3 {
    font-family: 'Kanit', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
}

.modal-close-btn:hover { color: var(--text-main); }

#taskForm {
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-main);
}
.form-group label.required::after {
    content: " *";
    color: var(--priority-urgent);
}

.form-group input,
.form-group select,
.form-group textarea {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 0.88rem;
    outline: none;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

/* Subtasks Edit List */
.subtask-input-group {
    display: flex;
    gap: 0.5rem;
}

.subtask-input-group input {
    flex: 1;
}

.subtask-list-edit {
    list-style: none;
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 150px;
    overflow-y: auto;
}

.subtask-edit-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-input);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    border: 1px solid var(--border-color);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.1);
}

/* Team Management Modal Body */
.team-manage-body {
    padding: 1.25rem 1.5rem;
}

.add-member-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 0.6rem;
}

.add-member-form input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 0.85rem;
}

.member-list-manage {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 250px;
    overflow-y: auto;
}

.member-item-manage {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-input);
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

/* --------------------------------------------------------------------------
   12. TOAST NOTIFICATIONS
   -------------------------------------------------------------------------- */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    z-index: 2000;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color-hover);
    color: var(--text-main);
    padding: 0.75rem 1.2rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    animation: slideInRight 0.3s ease;
    border-left: 4px solid var(--primary);
}

.toast.success { border-left-color: var(--status-done); }
.toast.info { border-left-color: var(--primary); }
.toast.error { border-left-color: var(--priority-urgent); }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* --------------------------------------------------------------------------
   13. RESPONSIVE BREAKPOINTS
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .kanban-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .analytics-grid {
        grid-template-columns: 1fr;
    }
    .chart-card.wide {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        align-items: stretch;
    }
    .view-nav {
        overflow-x: auto;
    }
    .kanban-grid {
        grid-template-columns: 1fr;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .add-member-form {
        grid-template-columns: 1fr;
    }
}
