/* ═══ LifeOS Council Dashboard — Design System ═══ */
:root {
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-glass: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.08);
    --text-primary: #e8e8f0;
    --text-secondary: #8888a8;
    --text-muted: #555577;
    --accent: #7c3aed;
    --accent-glow: rgba(124, 58, 237, 0.3);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --transition: 200ms ease;
}

[data-theme="light"] {
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-glass: rgba(0, 0, 0, 0.02);
    --border: rgba(0, 0, 0, 0.08);
    --text-primary: #1a1a2e;
    --text-secondary: #555577;
    --text-muted: #999;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', 'Pretendard', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
}

/* ═══ Header ═══ */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    font-size: 24px;
}

.header h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header h1 span {
    color: var(--accent);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.clock {
    font-size: 14px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.theme-toggle {
    width: 44px;
    height: 24px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    position: relative;
    transition: background var(--transition);
}

.theme-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    transition: transform var(--transition);
}

[data-theme="light"] .theme-toggle::after {
    transform: translateX(20px);
}

/* ═══ Tabs ═══ */
.tabs {
    display: flex;
    gap: 4px;
    padding: 12px 32px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.tab {
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
}

.tab:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.tab.active {
    background: var(--accent);
    color: white;
}

/* ═══ Main Layout ═══ */
.main {
    padding: 24px 32px;
    max-width: 1400px;
    margin: 0 auto;
}

.section {
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn 300ms ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ═══ Stats Row ═══ */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.stat-card .icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-card .label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent-glow);
    filter: blur(30px);
    opacity: 0.3;
}

/* ═══ Kanban Board ═══ */
.kanban-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.kanban-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.btn {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 150ms ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    filter: brightness(1.15);
    transform: scale(1.02);
}

.btn-primary:active {
    transform: scale(0.97);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    filter: brightness(1.15);
}

.kanban {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.kanban-col {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    min-height: 300px;
    transition: background var(--transition);
}

.kanban-col.drag-over {
    background: var(--accent-glow);
    border-color: var(--accent);
}

.col-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.col-title {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.col-count {
    font-size: 12px;
    background: var(--bg-card);
    padding: 2px 8px;
    border-radius: 10px;
    color: var(--text-secondary);
}

.task-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 10px;
    cursor: grab;
    transition: all var(--transition);
    position: relative;
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--accent);
}

.task-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.task-card .task-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}

.task-card .task-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    line-height: 1.5;
}

.task-card .task-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.priority {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.priority-high {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.priority-medium {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.priority-low {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.task-card .task-agent {
    font-size: 11px;
    color: var(--text-muted);
}

.task-card .delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    opacity: 0;
    transition: opacity var(--transition);
}

.task-card:hover .delete-btn {
    opacity: 1;
}

.task-card .delete-btn:hover {
    color: var(--danger);
}

/* ═══ Agent Monitor ═══ */
.agents-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.agent-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    transition: all var(--transition);
}

.agent-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.agent-avatar {
    font-size: 48px;
    margin-bottom: 12px;
}

.agent-name {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.agent-role {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.skill-bar {
    margin-bottom: 12px;
    text-align: left;
}

.skill-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 4px;
}

.skill-track {
    height: 6px;
    background: var(--bg-glass);
    border-radius: 3px;
    overflow: hidden;
}

.skill-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s ease;
    background: linear-gradient(90deg, var(--accent), var(--info));
}

.agent-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 12px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    margin-top: 12px;
}

.agent-status .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

/* ═══ Modal ═══ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(4px);
    animation: fadeIn 200ms ease;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    width: 90%;
    max-width: 460px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
    animation: modalIn 250ms ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.92);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-glass);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* ═══ Toast ═══ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 13px;
    font-weight: 500;
    min-width: 240px;
    animation: slideIn 300ms ease;
    box-shadow: var(--shadow);
}

.toast-success {
    background: var(--success);
}

.toast-error {
    background: var(--danger);
}

.toast-info {
    background: var(--info);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ═══ Responsive ═══ */
@media (max-width: 768px) {
    .header {
        padding: 12px 16px;
    }

    .tabs {
        padding: 8px 16px;
        overflow-x: auto;
    }

    .main {
        padding: 16px;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .kanban {
        grid-template-columns: 1fr;
    }

    .agents-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr;
    }

    .header h1 {
        font-size: 14px;
    }
}