/* ═══════════════════════════════════════════════════════════════════════════
   TaskMaster — Global Stylesheet
   Dual-theme: [data-theme="dark"] (default) / [data-theme="light"]
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Theme Tokens ─────────────────────────────────────────────────────────── */

:root,
[data-theme="dark"] {
    --primary:        #6366f1;
    --primary-hover:  #4f46e5;
    --primary-light:  rgba(99,102,241,0.12);
    --success:        #10b981;
    --danger:         #ef4444;
    --warning:        #f59e0b;
    --info:           #0ea5e9;

    --bg-main:        #0f172a;
    --bg-surface:     #1e293b;
    --bg-card:        #1e293b;
    --bg-input:       #334155;
    --bg-hover:       rgba(255,255,255,0.05);

    --border:         rgba(255,255,255,0.08);
    --border-focus:   var(--primary);
    --radius:         10px;
    --radius-sm:      6px;

    --text:           #f1f5f9;
    --text-muted:     #94a3b8;
    --text-inv:       #0f172a;

    --shadow-sm:      0 1px 3px rgba(0,0,0,0.3);
    --shadow-md:      0 4px 16px rgba(0,0,0,0.4);

    --kanban-col-bg:  rgba(255,255,255,0.025);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

[data-theme="light"] {
    --primary:        #4f46e5;
    --primary-hover:  #4338ca;
    --primary-light:  rgba(79,70,229,0.10);

    --bg-main:        #f8fafc;
    --bg-surface:     #ffffff;
    --bg-card:        #ffffff;
    --bg-input:       #f1f5f9;
    --bg-hover:       rgba(0,0,0,0.04);

    --border:         rgba(0,0,0,0.09);

    --text:           #0f172a;
    --text-muted:     #64748b;
    --text-inv:       #ffffff;

    --shadow-sm:      0 1px 3px rgba(0,0,0,0.10);
    --shadow-md:      0 4px 16px rgba(0,0,0,0.12);

    --kanban-col-bg:  #f1f5f9;
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: var(--font);
    background: var(--bg-main);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    transition: background 0.2s ease, color 0.2s ease;
}

/* ── Layout ────────────────────────────────────────────────────────────────── */

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

.main-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* Header */
.header {
    height: 60px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.header-inner {
    width: 100%;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 0;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none !important;
}

.logo-icon-img {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: block;
    flex-shrink: 0;
}

.logo-text {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Header left group: toggle + logo */
.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Header actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

/* Header avatar chip */
.header-avatar-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 10px 3px 3px;
    border-radius: 24px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.header-avatar-chip:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.header-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    overflow: hidden;
    flex-shrink: 0;
}

.header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Keep old user-chip name hiding on small screens */
.user-chip { display: none; }

.btn-icon {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

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

.theme-toggle { font-size: 1rem; }

/* Content area — fills remaining viewport, children scroll independently */
.layout-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

/* Sidebar */
.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    padding: 12px;
    box-shadow: var(--shadow-sm);
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.25s ease, padding 0.25s ease;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Desktop sidebar icon-only mode */
@media (min-width: 993px) {
    .sidebar-icon-only .sidebar {
        width: 56px;
        padding: 8px 4px;
    }

    .sidebar-icon-only .nav-section-header { display: none; }
    .sidebar-icon-only .nav-divider { margin: 4px 6px; }
    .sidebar-icon-only .nav-section-content { max-height: 2000px !important; }

    .sidebar-icon-only .nav-link {
        padding: 10px;
        justify-content: center;
        gap: 0;
    }

    .sidebar-icon-only .nav-link span { display: none; }
    .sidebar-icon-only .nav-badge { display: none; }
    .sidebar-icon-only .nav-link i { width: auto; font-size: 1.1rem; }

    .sidebar-icon-only .nav-logout {
        justify-content: center;
    }
}

.main-content {
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

/* Chat page needs the container to be a fixed-height flex column (no scroll) */
.main-content:has(.chat-page) {
    overflow: hidden;
    padding: 12px;
    display: flex;
    flex-direction: column;
}

.chat-page {
    flex: 1;
    min-height: 0;
    height: 100%;
}

.main-content::-webkit-scrollbar { width: 4px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.footer {
    padding: 10px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
    text-align: center;
    flex-shrink: 0;
    z-index: 10;
    position: relative;
}

/* ── Sidebar Navigation ──────────────────────────────────────────────────── */

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 100%;
}

.nav-logout { color: var(--danger) !important; }
.nav-logout:hover { background: rgba(239,68,68,0.1) !important; color: var(--danger) !important; }
.nav-logout.active { background: rgba(239,68,68,0.15) !important; color: var(--danger) !important; }
.mt-auto { margin-top: auto; }

/* Collapsible section header */
.nav-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 12px 4px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.nav-section-header:hover { background: var(--bg-hover); }

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.nav-chevron {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.nav-chevron.open { transform: rotate(-180deg); }

/* Section content slide */
.nav-section-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.25s ease;
}

.nav-section-content.open { max-height: 800px; }

.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s;
}

.nav-link i { font-size: 1rem; width: 18px; }

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

.nav-link.active {
    background: var(--primary-light);
    color: var(--primary) !important;
    font-weight: 600;
}

/* ── Typography ─────────────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
    color: var(--text);
    font-weight: 700;
    line-height: 1.3;
}

.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--primary) !important; }

/* ── Cards ──────────────────────────────────────────────────────────────── */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    font-weight: 700;
    color: var(--text);
}

.card-body { padding: 24px; }

/* ── Buttons ────────────────────────────────────────────────────────────── */

.btn {
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    transition: all 0.15s;
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99,102,241,0.4);
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.btn-outline-secondary {
    color: var(--text-muted);
    border-color: var(--border);
    background: transparent;
}

.btn-outline-secondary:hover:not(:disabled) {
    color: var(--text);
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
    background: transparent;
}

.btn-outline-primary:hover:not(:disabled) {
    background: var(--primary-light);
    color: var(--primary);
}

/* ── Forms ──────────────────────────────────────────────────────────────── */

.form-control,
.form-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    font-size: 0.875rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus,
.form-select:focus {
    background: var(--bg-input);
    color: var(--text);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
    outline: none;
}

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

.input-group-text {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

/* ── Tables ─────────────────────────────────────────────────────────────── */

.table {
    color: var(--text);
    border-color: var(--border);
    font-size: 0.875rem;
}

.table thead th {
    background: var(--bg-hover);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.07em;
    font-weight: 700;
    color: var(--text-muted);
    padding: 10px 16px;
    border-bottom-color: var(--border);
}

.table td, .table th {
    padding: 11px 16px;
    border-bottom-color: var(--border);
    vertical-align: middle;
}

.table-hover tbody tr:hover td {
    background: var(--bg-hover);
    color: var(--text);
}

.table-hover tbody tr:hover td .text-muted { color: var(--text-muted) !important; }
.table-hover tbody tr:hover td .text-danger { color: var(--danger) !important; }

/* ── Alerts & Badges ────────────────────────────────────────────────────── */

.alert {
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 0.875rem;
}

.alert-info    { background: rgba(14,165,233,0.12);  border-color: rgba(14,165,233,0.3);  color: #0ea5e9; }
.alert-danger  { background: rgba(239,68,68,0.12);   border-color: rgba(239,68,68,0.3);   color: #ef4444; }
.alert-success { background: rgba(16,185,129,0.12);  border-color: rgba(16,185,129,0.3);  color: #10b981; }
.alert-warning { background: rgba(245,158,11,0.12);  border-color: rgba(245,158,11,0.3);  color: #f59e0b; }

.badge { font-weight: 600; border-radius: 4px; font-size: 0.7rem; }
.text-bg-secondary { background: var(--bg-input); color: var(--text-muted); }

/* ── Modals ─────────────────────────────────────────────────────────────── */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.7);
    z-index: 1040;
    backdrop-filter: blur(2px);
}

.modal { z-index: 1050; }

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    color: var(--text);
}

.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 18px 24px;
}

.modal-body  { padding: 24px; }
.modal-footer { border-top: 1px solid var(--border); padding: 16px 24px; gap: 8px; }

.btn-close { filter: var(--btn-close-filter, invert(1) grayscale(100%)); }

[data-theme="light"] { --btn-close-filter: none; }

/* ── Kanban Tabs ─────────────────────────────────────────────────────────── */

.kb-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
    flex-wrap: nowrap;
    margin-bottom: 16px;
}

.kb-tabs::-webkit-scrollbar { display: none; }

.kb-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    flex-shrink: 0;
}

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

.kb-tab.active {
    color: #fff;
    border-color: transparent;
    font-weight: 600;
}

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

.kb-tab-count {
    background: rgba(255,255,255,0.25);
    border-radius: 10px;
    padding: 1px 6px;
    font-size: 0.72rem;
}

.kb-tab:not(.active) .kb-tab-count {
    background: var(--bg-hover);
    color: var(--text-muted);
}

/* ── Kanban Board ────────────────────────────────────────────────────────── */

.kb-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 16px;
    min-height: 200px;
}

/* ── Kanban Grid (tab mode) ──────────────────────────────────────────────── */

.kb-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    align-items: start;
}

/* 27"/24" wide monitors */
@media (min-width: 1800px) { .kb-grid { grid-template-columns: repeat(5, 1fr); } }

/* 16"/14" laptops ~1200-1599px */
@media (max-width: 1599px) { .kb-grid { grid-template-columns: repeat(4, 1fr); } }

/* 13"/12" laptops ~1024-1279px */
@media (max-width: 1279px) { .kb-grid { grid-template-columns: repeat(3, 1fr); } }

/* 10" tablet landscape ~900-1023px */
@media (max-width: 1023px) { .kb-grid { grid-template-columns: repeat(3, 1fr); } }

/* 7"-10" tablet portrait ~600-899px */
@media (max-width: 899px)  { .kb-grid { grid-template-columns: repeat(2, 1fr); } }

/* Phone ~480-599px */
@media (max-width: 599px)  { .kb-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }

/* Small phone <380px */
@media (max-width: 379px)  { .kb-grid { grid-template-columns: 1fr; } }

/* Cards in grid should stretch to same height */
.kb-grid .kb-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.kb-column {
    min-width: 290px;
    width: 290px;
    background: var(--kanban-col-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

.kb-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
}

.kb-col-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.kb-column-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.kb-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    transition: box-shadow 0.15s, transform 0.1s;
    cursor: default;
}

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

.kb-card-overdue {
    border-left: 3px solid var(--danger);
}

/* Drag-and-drop states */
.kb-drag-ghost {
    opacity: 0.35;
    border: 2px dashed var(--accent);
}

.kb-dragging {
    opacity: 0.9;
    box-shadow: var(--shadow-md);
    transform: rotate(1.5deg);
    cursor: grabbing !important;
}

.kb-card {
    cursor: grab;
}

.kb-card:active {
    cursor: grabbing;
}

/* Highlight column while dragging over it */
.kb-column-body.sortable-over {
    background: rgba(99,102,241,0.07);
    border-radius: 8px;
}

/* Flash animation for rejected drop */
@keyframes kb-error-flash {
    0%, 100% { background: var(--bg-card); }
    40%       { background: rgba(239,68,68,0.25); }
}

.kb-drop-error {
    animation: kb-error-flash 0.8s ease;
}

/* Task detail / history panel */
.kb-detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 420px;
    max-width: 95vw;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    box-shadow: -4px 0 24px rgba(0,0,0,0.25);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: panelSlideIn 0.2s ease;
}

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

.kb-detail-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.kb-detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.kb-detail-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.kb-history-item {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.78rem;
}

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

.kb-history-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    margin-top: 4px;
    flex-shrink: 0;
}

.kb-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 24px 0;
    opacity: 0.5;
    font-size: 1.5rem;
}

/* ── Login Page ─────────────────────────────────────────────────────────── */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-main);
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 36px;
    box-shadow: var(--shadow-md);
}

.login-brand {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    color: #fff;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.2rem;
    margin: 0 auto 16px;
    letter-spacing: -0.5px;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 0 4px;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0;
}

.login-footer-text {
    text-align: center;
    margin-top: 20px;
}

/* ── Stat Cards (Dashboards) ─────────────────────────────────────────────── */

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}

.stat-primary::before { background: var(--primary); }
.stat-success::before { background: var(--success); }
.stat-warning::before { background: var(--warning); }
.stat-danger::before  { background: var(--danger); }
.stat-info::before    { background: var(--info); }

.stat-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text);
}

.stat-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Utility ─────────────────────────────────────────────────────────────── */

.spin {
    animation: spin 0.8s linear infinite;
}

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

.fw-semibold { font-weight: 600; }

/* Bootstrap dark overrides */
.bg-light {
    background: var(--bg-hover) !important;
    color: var(--text) !important;
}

.text-dark  { color: var(--text) !important; }
.border     { border-color: var(--border) !important; }

/* Spinner */
.spinner-border { color: var(--primary); }

/* ══════════════════════════════════════════════════════════════════════════
   Responsive — Mobile-First Upgrade
   Breakpoints: 992px (tablet), 768px (mobile), 576px (small mobile)
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Hamburger / Sidebar Toggle Button (always visible) ───────────────────── */
.hamburger-btn {
    display: flex;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.15rem;
    transition: all 0.2s;
    flex-shrink: 0;
    order: -1;
}

.hamburger-btn:hover { color: var(--text); background: var(--bg-hover); }

/* ── Drawer Backdrop (hidden on desktop) ──────────────────────────────────── */
.drawer-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1030;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

/* ── Tablet ≤992px ────────────────────────────────────────────────────────── */
@media (max-width: 992px) {
    /* Sidebar → fixed slide-out drawer (overrides desktop permanent panel) */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        height: 100dvh;
        width: 272px;
        z-index: 1035;
        border-radius: 0;
        border-right: 1px solid var(--border);
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        padding: 60px 12px 20px;
    }

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

    /* Icon-only class has no effect on mobile — drawer behavior rules */
    .sidebar-icon-only .sidebar {
        width: 272px !important;
        padding: 60px 12px 20px !important;
    }
    .sidebar-icon-only .nav-section-header { display: flex !important; }
    .sidebar-icon-only .nav-link { padding: 9px 12px !important; justify-content: flex-start !important; gap: 10px !important; }
    .sidebar-icon-only .nav-link span { display: inline !important; }
    .sidebar-icon-only .nav-link i { width: 18px !important; font-size: 1rem !important; }

    /* Backdrop visible when drawer open */
    .drawer-backdrop.drawer-open { display: block; }

    /* Main content takes full width */
    .main-content { padding: 16px; }
    .main-content:has(.chat-page) { padding: 8px; }

    /* Cards */
    .card-header { padding: 14px 18px; }
    .card-body { padding: 18px; }

    /* Modals */
    .modal-dialog { margin: 16px auto; }

    /* Stat cards tighter */
    .stat-card { padding: 16px 18px; }
    .stat-value { font-size: 1.75rem; }
}

/* ── Mobile ≤768px ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    /* Header */
    .header-inner { padding: 0 14px; }
    .logo-text { font-size: 1rem; }
    .header-actions { gap: 8px; }

    /* Layout */
    .main-content { padding: 12px; }
    .main-content:has(.chat-page) { padding: 6px; }

    /* Cards */
    .card-header { padding: 12px 14px; }
    .card-body { padding: 14px; }

    /* Prevent iOS double-tap zoom on inputs */
    .form-control,
    .form-select,
    textarea.form-control {
        font-size: 16px;
    }

    /* Full-width inline filter inputs */
    .card-header .form-control,
    .card-header .form-select {
        width: 100% !important;
        max-width: none !important;
    }

    /* Modals: near full-width */
    .modal-dialog {
        margin: 10px;
        max-width: calc(100vw - 20px);
    }
    .modal-content { border-radius: 10px; }
    .modal-body { padding: 16px; }
    .modal-header { padding: 14px 16px; }
    .modal-footer { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }

    /* Stat value */
    .stat-value { font-size: 1.5rem; }
    .stat-card { padding: 14px 16px; }

    /* ── Mobile Table Cards ────────────────────────────────────────────────
       Add class="mobile-table-cards" to the .table-responsive wrapper to
       activate this card view automatically on mobile.
    ─────────────────────────────────────────────────────────────────────── */
    .mobile-table-cards .table thead { display: none; }

    .mobile-table-cards .table,
    .mobile-table-cards .table tbody,
    .mobile-table-cards .table tr {
        display: block;
    }

    .mobile-table-cards .table tr {
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        margin-bottom: 10px;
        padding: 10px 12px;
        background: var(--bg-card);
        box-shadow: var(--shadow-sm);
    }

    .mobile-table-cards .table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 5px 0;
        border: none;
        font-size: 0.82rem;
        gap: 8px;
        flex-wrap: wrap;
    }

    .mobile-table-cards .table td[data-label]::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--text-muted);
        font-size: 0.68rem;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        min-width: 80px;
        flex-shrink: 0;
    }

    .mobile-table-cards .table td:last-child {
        padding-top: 8px;
        margin-top: 4px;
        border-top: 1px solid var(--border);
        justify-content: flex-end;
    }

    .mobile-table-cards .table tr.opacity-50 { opacity: 0.55; }

    /* ── Kanban Mobile ────────────────────────────────────────────────────── */
    .kb-mobile-col-select { display: flex !important; }
    .kb-board { gap: 0; overflow-x: hidden; }
    .kb-column { min-width: 100%; width: 100%; }
    .kb-column.kb-col-hidden { display: none; }
    .kb-card { cursor: default; }

    /* ── Chat Mobile Panel Switching ─────────────────────────────────────── */
    .chat-sidebar-panel.chat-panel-hidden,
    .chat-messages-panel.chat-panel-hidden { display: none !important; }
    .chat-mobile-back { display: inline-flex !important; }

    /* ── Chat: fixed position bypasses all flex chain height issues ───────── */
    .chat-page {
        position: fixed !important;
        top: 60px !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        height: auto !important;
        border-radius: 8px !important;
        z-index: 50;
    }
    /* Hide main-content scroll when chat is fixed */
    .main-content { overflow: hidden !important; }

    /* Login */
    .login-card { padding: 28px 20px; }
}

/* ── Small Mobile ≤576px ──────────────────────────────────────────────────── */
@media (max-width: 576px) {
    /* Header: very compact */
    .header-inner { padding: 0 12px; }
    .user-name { display: none; }
    .logo-text { display: none; }
    .header-actions { gap: 6px; }

    /* Hide logout label, keep icon */
    .logout-label { display: none; }

    /* Layout */
    .main-content { padding: 10px; }
    .card-body { padding: 12px; }

    /* Touch targets: minimum 44px */
    .btn { min-height: 40px; }
    .btn-sm { min-height: 36px; }
    .btn-icon { width: 44px; height: 44px; font-size: 1rem; }

    /* Bigger tap targets in drawer nav */
    .nav-link { padding: 11px 14px; font-size: 0.9rem; }
    .nav-link i { font-size: 1.05rem; width: 20px; }

    /* Tables baseline */
    .table { font-size: 0.82rem; }
    .table td, .table th { padding: 8px 10px; }
    .table thead th { padding: 8px 10px; }

    /* Page titles */
    h3.fw-bold { font-size: 1.15rem; }
    h3 { font-size: 1.15rem; }

    /* Stat */
    .stat-value { font-size: 1.35rem; }

    /* Modals: almost full screen */
    .modal-dialog { margin: 6px; max-width: calc(100vw - 12px); }
    .modal-content { border-radius: 8px; }

    /* Login */
    .login-card { padding: 24px 16px; }

    /* Footer: hide on very small screens to save space */
    .footer { display: none; }

    /* Chat: fill the container edge-to-edge on tiny screens */
    .chat-page {
        border-radius: 0 !important;
        border: none !important;
    }
}

/* ── Notification Dropdown ───────────────────────────────────────────────── */

.notif-dropdown-wrap {
    position: relative;
    z-index: 1030;
}

.notif-bell-btn {
    position: relative;
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: var(--danger);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    pointer-events: none;
}

/* Dropdown panel */
.notif-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 340px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1031;
}

.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--primary);
    flex-shrink: 0;
}

.notif-panel-title {
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
}

.notif-panel-count {
    background: rgba(255,255,255,0.25);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
}

.notif-panel-body {
    max-height: 380px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.notif-panel-body::-webkit-scrollbar { width: 4px; }
.notif-panel-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.notif-panel-item {
    position: relative;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
    cursor: pointer;
    transition: background 0.15s;
}

.notif-panel-item:last-child { border-bottom: none; }
.notif-panel-item:hover { background: var(--bg-hover); }

.notif-panel-unread {
    background: var(--primary-light) !important;
    border-left: 3px solid var(--primary);
}

.notif-panel-unread:hover { background: rgba(99,102,241,0.18) !important; }

.notif-panel-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.notif-panel-item-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--primary);
}

.notif-panel-item-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.notif-panel-item-msg {
    font-size: 0.82rem;
    color: var(--text);
    margin: 0;
    line-height: 1.4;
}

.notif-panel-unread-dot {
    position: absolute;
    top: 14px;
    right: 12px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
}

.notif-panel-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-surface);
}

.btn-ghost {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    transition: background 0.15s;
}
.btn-ghost:hover { background: var(--bg-hover); }

/* Nav link notification badge */
.nav-link { position: relative; }

.nav-badge {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--danger);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
}

/* ── Notifications ───────────────────────────────────────────────────────── */

.notif-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
    cursor: pointer;
    transition: background 0.15s;
}

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

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

.notif-unread {
    background: var(--primary-light) !important;
    border-left: 3px solid var(--primary);
}

.notif-unread:hover { background: rgba(99,102,241,0.18) !important; }

.notif-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
    margin-top: 2px;
}

.notif-body { flex: 1; min-width: 0; }

.notif-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text);
    margin-bottom: 2px;
}

.notif-message {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.notif-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.notif-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    display: block;
}

/* Kill Bootstrap list-group white background in all themes */
.list-group-item {
    background: var(--bg-surface) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

.list-group-item-action:hover,
.list-group-item-action:focus {
    background: var(--bg-hover) !important;
    color: var(--text) !important;
}

.bg-light { background: var(--bg-hover) !important; }

/* ── Blazor Error UI ─────────────────────────────────────────────────────── */

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 2000;
    background: var(--danger);
    color: #fff;
    padding: 10px 16px;
    font-size: 0.875rem;
    text-align: center;
}

#blazor-error-ui .dismiss { cursor: pointer; margin-left: 12px; }

/* ── Task Page Tabs (My Tasks / Assigned by Me / For Review / For Approval) ── */

.task-page-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.task-page-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    border-radius: 0;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.task-page-tab:hover { color: var(--text); }
.task-page-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.task-page-tab-count {
    background: var(--bg-hover);
    color: var(--text-muted);
    border-radius: 20px;
    font-size: 0.7rem;
    padding: 1px 7px;
    font-weight: 600;
    min-width: 22px;
    text-align: center;
}
.task-page-tab-count.review   { background: rgba(139,92,246,0.2); color: #8b5cf6; }
.task-page-tab-count.approval { background: rgba(16,185,129,0.2); color: #10b981; }

/* ── Kanban Card Redesign ────────────────────────────────────────────────── */

.kb-card-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
}

.kb-card-title {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text);
}

.kb-card-view-btn {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border: none;
    background: var(--bg-hover);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.kb-card-view-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.kb-card-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin: 0 0 8px;
}

.kb-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.kb-card-assigner {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}
.kb-card-assigner i { font-size: 0.65rem; }

.kb-card-due {
    font-size: 0.73rem;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 10px;
}

.kb-card-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: auto;
}
.kb-card-actions .btn { font-size: 0.75rem; padding: 4px 10px; }

/* Status chips inside action row */
.kb-status-chip {
    display: inline-flex;
    align-items: center;
    flex: 1;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 6px;
    letter-spacing: 0.02em;
}
.chip-pending   { background: rgba(100,116,139,.18); color: var(--text-muted, #94a3b8); }
.chip-verified  { background: rgba(20,184,166,.18);  color: #14b8a6; }
.chip-cancelled { background: rgba(100,116,139,.14); color: var(--text-muted, #94a3b8); text-decoration: line-through; }

.kb-card-notes {
    font-size: 0.72rem;
    color: var(--text-muted);
    background: var(--bg-hover);
    border-radius: 6px;
    padding: 6px 8px;
    margin-bottom: 8px;
    border-left: 3px solid var(--border);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Review / Approval card accent borders */
.kb-card-review   { border-left: 3px solid #8b5cf6; }
.kb-card-approval { border-left: 3px solid #10b981; }

/* ═══════════════════════════════════════════════════════════
   EPIC LIST + BOARD
   ═══════════════════════════════════════════════════════════ */

.epic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
.epic-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color, rgba(255,255,255,.08));
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow .2s;
}
.epic-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.18); }
.epic-card-archived { opacity: .55; }
.epic-card-inner { padding: 16px; display: flex; flex-direction: column; gap: 8px; height: 100%; }

.epic-title     { font-weight: 700; font-size: .98rem; }
.epic-meta-line { font-size: .78rem; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 6px; }
.epic-desc      { font-size: .81rem; color: var(--text-muted); }
.epic-dates     { font-size: .8rem; color: var(--text-muted); }
.epic-owner     { font-size: .78rem; color: var(--text-muted); }
.epic-actions   { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border-color, rgba(255,255,255,.06)); }
.epic-progress-wrap { margin-top: 4px; }
.epic-progress-bar  { height: 5px; border-radius: 10px; background: rgba(255,255,255,.08); }

.epic-priority-badge, .epic-health-badge {
    font-size: .7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(255,255,255,.06);
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════
   SPRINT LIST PAGE
   ═══════════════════════════════════════════════════════════ */

/* Active sprint banner */
.sprint-active-banner {
    background: linear-gradient(135deg, rgba(245,158,11,.12), rgba(245,158,11,.04));
    border: 1.5px solid rgba(245,158,11,.35);
    border-radius: 12px;
    padding: 14px 20px;
}
.sprint-active-badge {
    background: rgba(245,158,11,.25);
    color: #fbbf24;
    font-weight: 700;
    font-size: .8rem;
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
}
.sprint-progress-bar { height: 6px; border-radius: 10px; background: rgba(255,255,255,.1); }

/* Sprint card grid */
.sprint-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}
.sprint-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color, rgba(255,255,255,.08));
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: box-shadow .2s;
}
.sprint-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.2); }
.sprint-card-active  { border-color: rgba(245,158,11,.5); box-shadow: 0 0 0 1px rgba(245,158,11,.2); }
.sprint-card-done    { opacity: .75; }
.sprint-card-cancelled { opacity: .5; }

.sprint-card-head   { }
.sprint-card-name   { font-weight: 700; font-size: 1rem; }
.sprint-card-goal   { font-size: .82rem; color: var(--text-muted); margin-top: 2px; }
.sprint-card-dates  { font-size: .82rem; color: var(--text-muted); }
.sprint-card-meta   { display: flex; gap: 12px; font-size: .8rem; color: var(--text-muted); }
.sprint-card-progress { margin-top: 4px; }
.sprint-card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--border-color, rgba(255,255,255,.06)); }

/* Sprint status badges */
.sprint-status-badge  { font-size: .72rem; font-weight: 600; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.sprint-badge-planned  { background: rgba(99,102,241,.2); color: #a5b4fc; }
.sprint-badge-active   { background: rgba(245,158,11,.25); color: #fbbf24; }
.sprint-badge-done     { background: rgba(34,197,94,.2); color: #86efac; }
.sprint-badge-cancelled { background: rgba(100,116,139,.2); color: #94a3b8; }

/* ═══════════════════════════════════════════════════════════
   SPRINT BOARD PAGE
   ═══════════════════════════════════════════════════════════ */

.spb-board {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding-bottom: 12px;
    align-items: flex-start;
    min-height: 60vh;
}
.spb-column {
    min-width: 240px;
    max-width: 260px;
    flex-shrink: 0;
    background: var(--bg-surface);
    border-radius: 10px;
    border: 1px solid var(--border-color, rgba(255,255,255,.07));
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 200px);
}
.spb-col-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    font-size: .82rem;
    border-radius: 10px 10px 0 0;
}
.spb-col-body {
    padding: 8px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.spb-empty { font-size: .78rem; color: var(--text-muted); text-align: center; padding: 20px 0; opacity: .5; }

.spb-card {
    background: var(--bg-hover, rgba(255,255,255,.04));
    border: 1px solid var(--border-color, rgba(255,255,255,.07));
    border-radius: 8px;
    padding: 10px 12px;
    cursor: default;
    transition: box-shadow .15s;
}
.spb-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,.18); }
.spb-card-overdue { border-left: 3px solid #ef4444; }

.spb-card-title { font-weight: 600; font-size: .86rem; margin-bottom: 4px; line-height: 1.35; }
.spb-card-desc  { font-size: .75rem; color: var(--text-muted); margin-bottom: 6px; }
.spb-card-footer { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.spb-assignee   { font-size: .72rem; color: var(--text-muted); }
.spb-due        { font-size: .72rem; }

/* Detail panel label */
.kb-detail-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ═══════════════════════════════════════════════════════════
   SPRINT BACKLOG PAGE
   ═══════════════════════════════════════════════════════════ */

.backlog-search {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-primary);
}
.backlog-search:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }

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

.backlog-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color .2s;
}
.backlog-card:hover { border-color: var(--primary); }
.backlog-card.backlog-overdue { border-left: 3px solid #ef4444; }

.backlog-check { flex-shrink: 0; }

.backlog-body { flex: 1; min-width: 0; }

.backlog-title {
    font-weight: 600;
    font-size: .9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.backlog-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.backlog-priority-badge {
    font-size: .68rem;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

.backlog-status-badge {
    font-size: .68rem;
    padding: 1px 8px;
    border-radius: 20px;
    background: rgba(255,255,255,.06);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.backlog-overdue-badge {
    font-size: .68rem;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 20px;
    background: rgba(239,68,68,.15);
    color: #ef4444;
}

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

.backlog-sprint-pick {
    font-size: .78rem;
    min-width: 140px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════
   SPRINT PLAN PAGE
   ═══════════════════════════════════════════════════════════ */

.plan-stats-row {
    display: grid;
    grid-template-columns: repeat(3, auto) 1fr;
    gap: 12px;
}
@media (max-width: 768px) {
    .plan-stats-row { grid-template-columns: 1fr 1fr; }
    .plan-stat-wide { grid-column: 1 / -1; }
}

.plan-stat-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 20px;
}

.plan-stat-wide { padding: 14px 20px; }

.plan-stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.plan-stat-unit { font-size: 1rem; font-weight: 500; color: var(--text-muted); margin-left: 2px; }

.plan-stat-label { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }

.plan-capacity-bar { height: 8px; border-radius: 4px; background: var(--border); }

/* Task list */
.plan-task-list { display: flex; flex-direction: column; gap: 4px; }

.plan-task-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color .15s;
}
.plan-task-row:hover { border-color: var(--primary); }
.plan-task-row.plan-task-overdue { border-left: 3px solid #ef4444; }

.plan-task-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.plan-task-body { flex: 1; min-width: 0; }

.plan-task-title {
    font-size: .875rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.plan-task-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: .73rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.plan-priority-badge { font-size: .7rem; font-weight: 700; }

.plan-task-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.plan-status-pill {
    font-size: .68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

/* Backlog panel */
.plan-backlog-panel {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-top: 8px;
}

.plan-backlog-list { display: flex; flex-direction: column; gap: 6px; max-height: 380px; overflow-y: auto; }

.plan-backlog-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    background: var(--surface-1, var(--surface));
    border: 1px solid var(--border);
    border-radius: 8px;
}

.plan-backlog-info { flex: 1; min-width: 0; }

/* ═══════════════════════════════════════════════════════════
   SPRINT VELOCITY WIDGET (Admin Dashboard)
   ═══════════════════════════════════════════════════════════ */

.velocity-grid { display: flex; flex-direction: column; gap: 10px; }

.velocity-item { display: grid; grid-template-columns: 160px 1fr; grid-template-rows: auto auto; gap: 2px 12px; align-items: center; }
@media (max-width: 576px) { .velocity-item { grid-template-columns: 1fr; } }

.velocity-name { font-size: .82rem; font-weight: 600; color: var(--text-primary); grid-row: 1; }

.velocity-bar-wrap { display: flex; align-items: center; gap: 8px; grid-row: 1; }

.velocity-bar-bg { flex: 1; height: 10px; border-radius: 5px; background: var(--border); overflow: hidden; }

.velocity-bar-fill { height: 100%; border-radius: 5px; transition: width .5s ease; }

.velocity-bar-success { background: linear-gradient(90deg, #22c55e, #16a34a); }
.velocity-bar-warning { background: linear-gradient(90deg, #f59e0b, #d97706); }
.velocity-bar-danger  { background: linear-gradient(90deg, #ef4444, #dc2626); }

.velocity-pct { font-size: .78rem; font-weight: 700; color: var(--text-primary); min-width: 34px; text-align: right; }

.velocity-meta { display: flex; gap: 12px; font-size: .72rem; color: var(--text-muted); grid-column: 2; grid-row: 2; flex-wrap: wrap; }
@media (max-width: 576px) { .velocity-meta { grid-column: 1; } }
