/* ============================================
   wrkr Agent Board - Styles
   Font: Inter | Accent: #00D4AA
   ============================================ */

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

:root {
    /* Colors */
    --bg: #0a0a0a;
    --bg-subtle: #111111;
    --bg-card: #151515;
    --bg-hover: #1a1a1a;
    --bg-input: #0d0d0d;
    
    --border: #222;
    --border-hover: #333;
    
    --text: #ededed;
    --text-secondary: #888;
    --text-tertiary: #555;
    
    --accent: #00D4AA;
    --accent-hover: #00E5B8;
    --accent-bg: rgba(0, 212, 170, 0.1);
    
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.1);
    --warning: #eab308;
    --warning-bg: rgba(234, 179, 8, 0.1);
    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.1);
    
    /* Layout */
    --sidebar-width: 240px;
    --sidebar-collapsed: 60px;
    --radius: 8px;
    --radius-lg: 12px;
    --transition: 0.15s ease;
}

/* ============================================
   Base
   ============================================ */

html, body {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Loading Screen
   ============================================ */

.loading-screen {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    text-align: center;
}

.logo-large {
    margin-bottom: 2rem;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Login Screen
   ============================================ */

.login-screen {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-subtitle {
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.hidden {
    display: none !important;
}

/* ============================================
   Layout
   ============================================ */

.app-container {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   Sidebar
   ============================================ */

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-subtle);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transition: width 0.2s ease, min-width 0.2s ease;
}

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

.sidebar.collapsed .nav-item span,
.sidebar.collapsed .user-details {
    display: none;
}

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

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

.sidebar-toggle {
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s;
}

.sidebar-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.sidebar-toggle svg {
    width: 14px;
    height: 14px;
    color: var(--text-secondary);
    transition: transform 0.2s;
}

.sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-nav {
    padding: 1rem 0.75rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    margin-bottom: 0.25rem;
}

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

.nav-item.active {
    background: var(--accent-bg);
    color: var(--accent);
}

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

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-hover);
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--accent);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-details {
    min-width: 0;
}

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

.user-email {
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logout-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.logout-btn:hover {
    border-color: var(--error);
    color: var(--error);
}

/* ============================================
   Main Content
   ============================================ */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    min-height: 100vh;
    transition: margin-left 0.2s ease;
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed);
}

/* ============================================
   Pages
   ============================================ */

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    margin-bottom: 2rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-subtitle {
    color: var(--text-secondary);
    flex: 1;
}

/* ============================================
   Stats Grid
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--border-hover);
}

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

.stat-icon.tasks-icon {
    background: var(--accent-bg);
    color: var(--accent);
}

.stat-icon.progress-icon {
    background: var(--warning-bg);
    color: var(--warning);
}

.stat-icon.done-icon {
    background: var(--success-bg);
    color: var(--success);
}

.stat-icon.agents-icon {
    background: var(--info-bg);
    color: var(--info);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ============================================
   Sections
   ============================================ */

.section {
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.section-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: var(--transition);
}

.link:hover {
    color: var(--accent);
}

/* ============================================
   Agents Mini Grid (Dashboard)
   ============================================ */

.agents-mini-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.agent-mini-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition);
}

.agent-mini-card:hover {
    border-color: var(--accent);
}

.agent-emoji {
    font-size: 24px;
}

.agent-mini-info {
    flex: 1;
    min-width: 0;
}

.agent-mini-name {
    font-weight: 600;
    font-size: 14px;
}

.agent-mini-status {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.agent-mini-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.agent-mini-status.online::before {
    background: var(--success);
}

.agent-mini-status.standby::before {
    background: var(--warning);
}

.agent-mini-status.offline::before {
    background: var(--text-tertiary);
}

/* ============================================
   Activity List
   ============================================ */

.activity-list {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-message {
    font-size: 14px;
    margin-bottom: 0.25rem;
}

.activity-time {
    font-size: 12px;
    color: var(--text-tertiary);
}

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}

/* ============================================
   Kanban Board
   ============================================ */

.kanban-board {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    min-height: calc(100vh - 200px);
}

.kanban-board::-webkit-scrollbar {
    height: 8px;
}

.kanban-board::-webkit-scrollbar-track {
    background: var(--bg);
}

.kanban-board::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.kanban-column {
    flex: 0 0 320px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 220px);
}

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

.kanban-column-title {
    font-weight: 600;
    font-size: 14px;
}

.kanban-column-count {
    background: var(--bg-hover);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

.kanban-cards {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

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

.kanban-cards::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.kanban-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.kanban-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.kanban-card-title {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.kanban-card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kanban-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.kanban-card-priority {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 600;
}

.priority-high {
    background: var(--error-bg);
    color: var(--error);
}

.priority-medium {
    background: var(--warning-bg);
    color: var(--warning);
}

.priority-low {
    background: var(--success-bg);
    color: var(--success);
}

.kanban-card-assignee {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
}

/* Drag states */
.kanban-cards.drag-over {
    background: var(--accent-bg);
    border-radius: var(--radius);
}

.kanban-card.dragging {
    opacity: 0.5;
}

/* ============================================
   Agents Grid
   ============================================ */

.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.agent-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: var(--transition);
}

.agent-card:hover {
    border-color: var(--accent);
}

.agent-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.agent-avatar {
    width: 48px;
    height: 48px;
    background: var(--bg-hover);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.agent-info {
    flex: 1;
}

.agent-name {
    font-weight: 600;
    font-size: 16px;
}

.agent-role {
    font-size: 12px;
    color: var(--accent);
}

.agent-status {
    font-size: 12px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.agent-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.agent-status.online::before {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.agent-status.standby::before {
    background: var(--warning);
}

.agent-status.offline::before {
    background: var(--text-tertiary);
}

.agent-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.agent-stats {
    display: flex;
    gap: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.agent-stat {
    text-align: center;
}

.agent-stat .stat-value {
    font-size: 20px;
    font-weight: 600;
}

.agent-stat .stat-label {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

/* ============================================
   Logs
   ============================================ */

.filters-bar {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.filter-group label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.filter-group select {
    padding: 0.625rem 2rem 0.625rem 0.875rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

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

.logs-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.log-entry {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.log-entry:last-child {
    border-bottom: none;
}

.log-time {
    color: var(--text-tertiary);
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 12px;
    min-width: 80px;
}

.log-agent {
    font-size: 18px;
    min-width: 24px;
}

.log-message {
    flex: 1;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ============================================
   Settings
   ============================================ */

.settings-sections {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.settings-section h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.section-description {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 1.5rem;
}

.settings-options {
    display: flex;
    flex-direction: column;
}

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

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

.setting-name {
    font-weight: 500;
    margin-bottom: 0.125rem;
}

.setting-description {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Toggle Switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 100px;
    transition: var(--transition);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: var(--transition);
}

.toggle input:checked + .toggle-slider {
    background: var(--accent);
    border-color: var(--accent);
}

.toggle input:checked + .toggle-slider:before {
    background: #fff;
    transform: translateX(20px);
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: #000;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

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

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--text);
}

/* ============================================
   Modal
   ============================================ */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

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

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
}

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

#task-form {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 13px;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
}

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

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

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

/* ============================================
   Toast Notifications
   ============================================ */

#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 9999;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.2s ease;
    font-size: 14px;
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--error);
}

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

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

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .kanban-column {
        flex: 0 0 280px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Column status dots */
.kanban-column-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}
.kanban-column-dot.backlog { background: #888; }
.kanban-column-dot.todo { background: #3b82f6; }
.kanban-column-dot.doing { background: #eab308; }
.kanban-column-dot.review { background: #a855f7; }
.kanban-column-dot.done { background: #22c55e; }

/* Adjust kanban board for 5 columns */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    min-height: 500px;
}

@media (max-width: 1200px) {
    .kanban-board {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .kanban-board {
        grid-template-columns: 1fr;
    }
}

/* Task Detail Modal */
.modal-large {
    max-width: 800px;
    width: 95%;
}

.task-detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.task-status-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.task-status-badge.backlog { background: var(--text-tertiary); color: var(--bg); }
.task-status-badge.todo { background: var(--info); color: white; }
.task-status-badge.doing { background: var(--warning); color: var(--bg); }
.task-status-badge.review { background: var(--purple, #a855f7); color: white; }
.task-status-badge.done { background: var(--success); color: white; }

.task-detail-body {
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 24px;
    padding: 24px 0;
}

.task-detail-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.detail-section h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.detail-text {
    color: var(--text);
    line-height: 1.6;
}

.result-content {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    font-size: 14px;
    line-height: 1.7;
    max-height: 400px;
    overflow-y: auto;
}

.result-content pre {
    background: var(--bg);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 13px;
}

.result-content code {
    font-family: 'SF Mono', Monaco, monospace;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.comment {
    background: var(--bg-subtle);
    border-radius: 8px;
    padding: 12px;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
}

.comment-author {
    font-weight: 600;
    color: var(--text);
}

.comment-time {
    color: var(--text-tertiary);
}

.comment-text {
    color: var(--text-secondary);
    font-size: 14px;
}

.no-comments {
    color: var(--text-tertiary);
    font-size: 14px;
    font-style: italic;
}

.comment-input {
    display: flex;
    gap: 8px;
}

.comment-input textarea {
    flex: 1;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    resize: none;
}

.task-detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.detail-meta {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.meta-item label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.meta-item span {
    font-size: 14px;
    color: var(--text);
}

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

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

.btn-danger:hover {
    background: var(--error);
    color: white;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 13px;
}

@media (max-width: 768px) {
    .task-detail-body {
        grid-template-columns: 1fr;
    }
    
    .task-detail-sidebar {
        order: -1;
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .detail-meta {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .detail-actions {
        flex-direction: row;
        width: 100%;
    }
}

/* Live Agent Status */
.agent-card.agent-working {
    border-color: var(--success);
    box-shadow: 0 0 0 1px var(--success), 0 4px 12px rgba(34, 197, 94, 0.15);
}

.agent-avatar {
    position: relative;
}

.pulse-indicator {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background: var(--success);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.agent-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-tertiary);
}

.agent-status.idle .status-dot { background: var(--text-tertiary); }
.agent-status.working .status-dot { background: var(--success); animation: pulse 1.5s infinite; }
.agent-status.error .status-dot { background: var(--error); }
.agent-status.standby .status-dot { background: var(--warning); }

.agent-current-task {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 6px;
    padding: 8px 12px;
    margin: 12px 0;
    font-size: 13px;
}

.current-task-label {
    color: var(--success);
    font-weight: 500;
    margin-right: 6px;
}

.current-task-title {
    color: var(--text);
}

.agent-capabilities {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 12px 0;
}

.capability-tag {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 11px;
    color: var(--text-secondary);
}

/* Settings Page */
.settings-sections {
    display: flex;
    flex-direction: column;
    gap: 32px;
    max-width: 700px;
}

.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
}

.settings-section h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.section-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.workspace-info-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-subtle);
    border-radius: 8px;
    padding: 16px;
}

.workspace-plan {
    display: flex;
    align-items: center;
    gap: 16px;
}

.plan-badge {
    background: linear-gradient(135deg, var(--info) 0%, var(--purple, #8b5cf6) 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.plan-badge.free { background: var(--text-tertiary); }
.plan-badge.starter { background: var(--info); }
.plan-badge.pro { background: linear-gradient(135deg, var(--info) 0%, var(--purple, #8b5cf6) 100%); }
.plan-badge.business { background: linear-gradient(135deg, var(--warning) 0%, var(--error) 100%); }

.plan-name {
    font-weight: 600;
    color: var(--text);
}

.plan-email {
    font-size: 13px;
    color: var(--text-secondary);
}

.usage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.usage-card {
    background: var(--bg-subtle);
    border-radius: 8px;
    padding: 16px;
}

.usage-card .usage-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.usage-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
}

.usage-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.usage-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.usage-bar-fill {
    height: 100%;
    background: var(--success);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.usage-bar-fill.warning { background: var(--warning); }
.usage-bar-fill.danger { background: var(--error); }

.settings-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

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

.setting-name {
    font-weight: 500;
    color: var(--text);
    margin-bottom: 2px;
}

.setting-description {
    font-size: 13px;
    color: var(--text-secondary);
}

.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border);
    border-radius: 24px;
    transition: 0.2s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
}

.toggle input:checked + .toggle-slider {
    background: var(--success);
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.danger-section {
    border-color: var(--error);
}

.danger-section h2 {
    color: var(--error);
}

/* Onboarding Modal */
.onboarding-container {
    text-align: center;
    padding: 40px 20px;
}

.onboarding-step {
    animation: fadeIn 0.3s ease;
}

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

.onboarding-icon {
    font-size: 64px;
    margin-bottom: 24px;
}

.onboarding-container h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
}

.onboarding-container p {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 32px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

.agent-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 32px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.agent-preview {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 12px;
    font-size: 14px;
    text-align: center;
}

.agent-preview small {
    color: var(--text-secondary);
    font-size: 11px;
}

.example-tasks {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.example-task {
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 14px;
}

.example-task:hover {
    border-color: var(--text-secondary);
    background: var(--bg-hover);
}

.hint {
    font-size: 13px !important;
    color: var(--text-tertiary) !important;
    margin-bottom: 24px !important;
}

.onboarding-progress {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
}

.progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: all 0.2s;
}

.progress-dot.active {
    background: var(--text);
    width: 24px;
    border-radius: 4px;
}

.onboarding-skip {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 13px;
}

.onboarding-skip:hover {
    color: var(--text-secondary);
}

/* ============================================
   Custom Agents Section
   ============================================ */

.agents-section {
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.section-desc {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.agent-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
}

.agent-card.custom {
    border-color: var(--primary);
    border-width: 2px;
}

.agent-avatar {
    font-size: 2rem;
}

.agent-info h3 {
    font-size: 1rem;
    margin: 0;
}

.agent-keywords {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

.agent-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.agent-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.agent-badge.system {
    background: var(--bg-tertiary);
}

.agent-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

/* ============================================
   Agent Modal
   ============================================ */

.emoji-input {
    font-size: 1.5rem;
    text-align: center;
    width: 60px;
}

.form-hint {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* ============================================
   Labels
   ============================================ */

.labels-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.label-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    color: white;
}

.label-remove {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
    opacity: 0.7;
}

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

.label-picker {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.label-option {
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.1s;
}

.label-option:hover {
    transform: scale(1.02);
    background: var(--label-color);
    color: white;
}

.modal-small .modal-content {
    max-width: 350px;
}

/* ============================================
   Checklist
   ============================================ */

.checklist-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.checklist-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.checklist-bar-fill {
    height: 100%;
    background: var(--success);
    transition: width 0.3s;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 4px;
}

.checklist-item:hover {
    background: var(--bg-tertiary);
}

.checklist-item.done span {
    text-decoration: line-through;
    color: var(--text-muted);
}

.checklist-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.checklist-item .btn-icon {
    margin-left: auto;
    opacity: 0;
}

.checklist-item:hover .btn-icon {
    opacity: 1;
}

.checklist-add {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.checklist-add input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.empty-checklist {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ============================================
   Result Section
   ============================================ */

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.result-actions {
    display: flex;
    gap: 0.25rem;
}

.result-meta {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================
   Meta Item Updates
   ============================================ */

.meta-value {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-meta select,
.detail-meta input[type="date"] {
    width: 100%;
    padding: 0.4rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.btn-ghost {
    background: transparent;
    border: 1px dashed var(--border);
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
}

.btn-ghost.danger {
    color: var(--danger);
    border-color: var(--danger);
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--text-muted);
}

.btn-icon:hover {
    color: var(--text-primary);
}
