/* =============================================================
   Bug Tracker — Premium Redesign v2
   Modern, glassmorphic, accessible dark/light theme
   ============================================================= */

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ─── CSS Variables ─── */
:root {
    /* Layout */
    --sidebar-w: 260px;
    --topbar-h: 60px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-pill: 999px;

    /* Light Theme */
    --bg-body: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-surface-2: #f8fafc;
    --bg-hover: #f1f5f9;
    --bg-active: #eff6ff;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: rgba(255, 255, 255, 0.06);
    --bg-sidebar-active: rgba(255, 255, 255, 0.1);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;
    --text-sidebar: #94a3b8;
    --text-sidebar-active: #ffffff;

    --border: #e2e8f0;
    --border-light: #f1f5f9;

    --accent: #f59e0b;
    --accent-hover: #d97706;
    --blue: #3b82f6;
    --blue-hover: #2563eb;
    --green: #10b981;
    --green-hover: #059669;
    --red: #ef4444;
    --red-hover: #dc2626;
    --purple: #8b5cf6;
    --indigo: #6366f1;
    --cyan: #06b6d4;

    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --card-shadow-hover: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 4px 10px -3px rgba(0, 0, 0, 0.04);
    --sidebar-shadow: 2px 0 12px rgba(0, 0, 0, 0.08);

    --input-bg: #ffffff;
    --input-border: #e2e8f0;
    --input-focus: #3b82f6;

    /* Status */
    --badge-open-bg: #dcfce7;
    --badge-open-text: #166534;
    --badge-progress-bg: #dbeafe;
    --badge-progress-text: #1e40af;
    --badge-resolved-bg: #f0fdf4;
    --badge-resolved-text: #15803d;
    --badge-closed-bg: #f1f5f9;
    --badge-closed-text: #64748b;

    /* Priority */
    --badge-critical-bg: #fef2f2;
    --badge-critical-text: #991b1b;
    --badge-high-bg: #fff7ed;
    --badge-high-text: #9a3412;
    --badge-medium-bg: #fffbeb;
    --badge-medium-text: #92400e;
    --badge-low-bg: #f0f9ff;
    --badge-low-text: #0c4a6e;

    /* Stat cards */
    --stat-total-bg: linear-gradient(135deg, #eff6ff, #dbeafe);
    --stat-total-accent: #3b82f6;
    --stat-open-bg: linear-gradient(135deg, #ecfdf5, #d1fae5);
    --stat-open-accent: #10b981;
    --stat-critical-bg: linear-gradient(135deg, #fef2f2, #fee2e2);
    --stat-critical-accent: #ef4444;
    --stat-resolved-bg: linear-gradient(135deg, #fefce8, #fef3c7);
    --stat-resolved-accent: #f59e0b;

    /* Alert */
    --success-bg: #f0fdf4;
    --success-text: #166534;
    --success-border: #bbf7d0;
    --error-bg: #fef2f2;
    --error-text: #991b1b;
    --error-border: #fecaca;
    --warning-bg: #fffbeb;
    --warning-text: #92400e;
    --warning-border: #fde68a;
    --info-bg: #eff6ff;
    --info-text: #1e40af;
    --info-border: #bfdbfe;

    /* Scrollbar */
    --scrollbar-track: #f1f5f9;
    --scrollbar-thumb: #cbd5e1;
}

/* ─── Dark Theme ─── */
[data-theme="dark"] {
    --bg-body: #0c111b;
    --bg-surface: #151c2c;
    --bg-surface-2: #1a2235;
    --bg-hover: #1e293b;
    --bg-active: #1e3a5f;
    --bg-sidebar: #0a0f1a;
    --bg-sidebar-hover: rgba(255, 255, 255, 0.05);
    --bg-sidebar-active: rgba(255, 255, 255, 0.08);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #0f172a;

    --border: #1e293b;
    --border-light: #1e293b;

    --accent: #fbbf24;
    --accent-hover: #f59e0b;
    --blue: #60a5fa;
    --blue-hover: #93c5fd;
    --green: #34d399;
    --red: #f87171;

    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --card-shadow-hover: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    --sidebar-shadow: 2px 0 12px rgba(0, 0, 0, 0.3);

    --input-bg: #1e293b;
    --input-border: #334155;
    --input-focus: #60a5fa;

    --badge-open-bg: #334155;
    --badge-open-text: #cbd5e1;
    --badge-progress-bg: #7c2d12;
    --badge-progress-text: #fdba74;
    --badge-resolved-bg: #064e3b;
    --badge-resolved-text: #a7f3d0;
    --badge-closed-bg: #1e293b;
    --badge-closed-text: #94a3b8;

    --badge-critical-bg: #450a0a;
    --badge-critical-text: #fca5a5;
    --badge-high-bg: #431407;
    --badge-high-text: #fdba74;
    --badge-medium-bg: #451a03;
    --badge-medium-text: #fde68a;
    --badge-low-bg: #0c4a6e;
    --badge-low-text: #7dd3fc;

    --stat-total-bg: linear-gradient(135deg, #172554, #1e3a8a);
    --stat-total-accent: #60a5fa;
    --stat-open-bg: linear-gradient(135deg, #022c22, #064e3b);
    --stat-open-accent: #34d399;
    --stat-critical-bg: linear-gradient(135deg, #2d0a0a, #450a0a);
    --stat-critical-accent: #f87171;
    --stat-resolved-bg: linear-gradient(135deg, #2d1f04, #451a03);
    --stat-resolved-accent: #fbbf24;

    --success-bg: #052e16;
    --success-text: #a7f3d0;
    --success-border: #065f46;
    --error-bg: #450a0a;
    --error-text: #fca5a5;
    --error-border: #991b1b;
    --warning-bg: #451a03;
    --warning-text: #fde68a;
    --warning-border: #92400e;
    --info-bg: #172554;
    --info-text: #bfdbfe;
    --info-border: #1e40af;

    --scrollbar-track: #0f172a;
    --scrollbar-thumb: #334155;
}

/* ─── Typography ─── */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.25s ease, color 0.25s ease;
}

a {
    color: var(--blue);
    text-decoration: none;
    transition: color 0.15s;
}

a:hover {
    color: var(--blue-hover);
    text-decoration: underline;
}

/* ─── Layout Shell ─── */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    box-shadow: var(--sidebar-shadow);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    overflow-y: auto;
    transition: width 0.3s ease, background 0.3s ease;
}

.sidebar-logo {
    padding: 22px 24px;
    font-size: 22px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 3px;
}

.sidebar-logo span {
    color: var(--accent);
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    margin-bottom: 2px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-sidebar);
    text-decoration: none;
    transition: all 0.15s ease;
    position: relative;
}

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

.nav-item.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
    text-decoration: none;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke-width: 1.8;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 20px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.1);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.sidebar-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.sidebar-user-role {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: capitalize;
    display: block;
}

/* ─── Main Content ─── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* ─── Top Bar ─── */
.topbar {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 16px;
    backdrop-filter: blur(12px);
    transition: background 0.25s ease, border 0.25s ease;
}

.topbar-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
    white-space: nowrap;
}

.topbar-search {
    flex: 1;
    max-width: 380px;
    position: relative;
}

.topbar-search::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    z-index: 1;
    pointer-events: none;
}

.topbar-search input {
    width: 100%;
    padding: 9px 14px 9px 38px;
    border-radius: var(--radius-md);
    border: 1px solid var(--input-border);
    background: var(--bg-surface-2);
    font-size: 13px;
    color: var(--text-primary);
    transition: all 0.2s ease;
    font-family: inherit;
}

.topbar-search input::placeholder {
    color: var(--text-muted);
}

.topbar-search input:focus {
    outline: none;
    border-color: var(--input-focus);
    background: var(--input-bg);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Theme Toggle */
.theme-toggle {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-surface-2);
    cursor: pointer;
    font-size: 18px;
    transition: all 0.15s ease;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--blue);
}

/* ─── Page Content ─── */
.page-content {
    flex: 1;
    padding: 28px;
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.3px;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 13.5px;
}

/* ─── Stat Cards (Dashboard) ─── */
.cards-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--stat-total-bg);
    border-radius: var(--radius-lg);
    padding: 22px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
    cursor: default;
}

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

.stat-card .stat-icon {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(4px);
}

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

.stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 30px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1;
}

.stat-card[data-type="total"] {
    background: var(--stat-total-bg);
}

.stat-card[data-type="total"] .stat-icon {
    color: var(--stat-total-accent);
}

.stat-card[data-type="open"] {
    background: var(--stat-open-bg);
}

.stat-card[data-type="open"] .stat-icon {
    color: var(--stat-open-accent);
}

.stat-card[data-type="critical"] {
    background: var(--stat-critical-bg);
}

.stat-card[data-type="critical"] .stat-icon {
    color: var(--stat-critical-accent);
}

.stat-card[data-type="resolved"] {
    background: var(--stat-resolved-bg);
}

.stat-card[data-type="resolved"] .stat-icon {
    color: var(--stat-resolved-accent);
}

/* ─── Cards ─── */
.card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--card-shadow);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
    box-shadow: var(--card-shadow-hover);
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.2px;
}

.card-row-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

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

/* Recent list items */
.recent-list {
    margin-top: 12px;
}

.recent-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
    transition: all 0.15s ease;
}

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

.recent-item:hover {
    background: var(--bg-hover);
    margin: 0 -24px;
    padding-left: 24px;
    padding-right: 24px;
    border-radius: var(--radius-md);
}

/* ─── Badges ─── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.badge-status-open {
    background: var(--badge-open-bg);
    color: var(--badge-open-text);
}

.badge-status-progress {
    background: var(--badge-progress-bg);
    color: var(--badge-progress-text);
}

.badge-status-closed {
    background: var(--badge-closed-bg);
    color: var(--badge-closed-text);
}

.badge-priority-high {
    background: var(--badge-critical-bg);
    color: var(--badge-critical-text);
}

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

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

.badge-sm {
    padding: 2px 8px;
    font-size: 11px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface-2);
    color: var(--text-secondary);
    font-weight: 500;
}

/* ─── Table Card Header / Filters ─── */
.table-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
    gap: 14px;
}

.filter-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

.filter-input {
    min-width: 220px;
    padding: 9px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    font-size: 13px;
    color: var(--text-primary);
    font-family: inherit;
    transition: all 0.15s ease;
}

.filter-input::placeholder {
    color: var(--text-muted);
}

.filter-input:focus {
    outline: none;
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-select {
    min-width: 130px;
    padding: 9px 14px;
    padding-right: 32px;
    border-radius: var(--radius-md);
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    font-size: 13px;
    color: var(--text-primary);
    font-family: inherit;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-select:focus {
    outline: none;
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.filter-group {
    position: relative;
}

.btn-filter {
    background: var(--bg-surface-2);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 9px 18px;
    font-weight: 600;
    box-shadow: var(--card-shadow);
}

.btn-filter:hover {
    background: var(--bg-hover);
    text-decoration: none;
}

/* ─── Tooltip System ─── */
[data-tooltip] {
    position: relative;
    cursor: pointer;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    padding: 5px 10px;
    background: #1e293b;
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.15s ease;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) scale(1);
}

[data-theme="dark"] [data-tooltip]::after {
    background: #334155;
    border: 1px solid #475569;
}

/* ─── Icon Buttons ─── */
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    color: #fff;
}

.btn-icon svg,
.btn-icon i {
    width: 18px !important;
    height: 18px !important;
    stroke-width: 2.2px;
}

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-md);
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    font-family: inherit;
    line-height: 1.4;
}

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

.btn-primary:hover {
    background: var(--blue-hover);
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.btn-secondary {
    background: var(--bg-surface-2);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    text-decoration: none;
}

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

.btn-accent:hover {
    background: var(--accent-hover);
    text-decoration: none;
}

.btn-sm {
    padding: 7px 14px;
    font-size: 12px;
}

/* Outline variants */
.btn-outline-primary {
    background: transparent;
    color: var(--blue);
    border: 1px solid var(--blue);
}

.btn-outline-primary:hover {
    background: var(--blue);
    color: #fff;
    text-decoration: none;
}

.btn-outline-info {
    background: transparent;
    color: var(--cyan);
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.btn-outline-info:hover {
    background: var(--cyan);
    color: #fff;
    text-decoration: none;
}

.btn-outline-danger {
    background: transparent;
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-outline-danger:hover {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
    text-decoration: none;
}

.btn-outline-success {
    background: transparent;
    color: var(--green);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-outline-success:hover {
    background: var(--green);
    color: #fff;
    border-color: var(--green);
    text-decoration: none;
}

/* ─── Table ─── */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table thead {
    background: var(--bg-surface-2);
}

.table th,
.table td {
    padding: 12px 14px;
    text-align: left;
    vertical-align: middle;
}

.table th {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background-color 0.1s ease;
}

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

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

.table tbody td {
    color: var(--text-primary);
}

.table tbody td a {
    color: var(--blue);
    font-weight: 600;
}

.table tbody td a:hover {
    color: var(--blue-hover);
}

.table tbody td:first-child {
    max-width: 420px;
    min-width: 240px;
}

.issue-title-link {
    color: var(--blue);
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.01em;
}

.issue-title-link:hover {
    color: var(--blue-hover);
    text-decoration: underline;
}

/* ─── Chips / Tags ─── */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.chip {
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: var(--bg-surface-2);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
    border: 1px solid var(--border);
    transition: background 0.15s ease;
}

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

/* ─── Bug Detail ─── */
.bug-description {
    margin: 20px 0;
    padding: 20px 0;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    line-height: 1.7;
    color: var(--text-primary);
}

.bug-description p {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.bug-meta {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.meta-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.bug-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

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

.btn-link:hover {
    color: var(--blue);
    text-decoration: none;
}

.btn-link.btn-danger {
    color: var(--red);
}

.btn-link.btn-danger:hover {
    color: var(--red-hover);
}

/* Status Update */
.status-update-form {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.status-form {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.status-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.status-select {
    min-width: 150px;
    padding: 8px 12px;
    padding-right: 32px;
    border-radius: var(--radius-md);
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    font-size: 13px;
    color: var(--text-primary);
    font-family: inherit;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.status-select:focus {
    outline: none;
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ─── Forms ─── */
.form-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border);
    max-width: 840px;
}

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

.software-version-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-group {
    margin-bottom: 18px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    transition: all 0.15s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    cursor: pointer;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

/* ─── Alerts ─── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    margin-bottom: 20px;
    border: 1px solid;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: var(--success-border);
}

.alert-error {
    background: var(--error-bg);
    color: var(--error-text);
    border-color: var(--error-border);
}

/* ─── Activity Timeline ─── */
.activity-timeline {
    padding: 0;
}

.activity-item {
    display: flex;
    gap: 14px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
}

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

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

.activity-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.activity-icon-inner {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

.activity-header {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 4px;
}

.activity-time {
    color: var(--text-muted);
    font-size: 12px;
    margin-left: auto;
    white-space: nowrap;
}

.activity-comment {
    margin-top: 8px;
    padding: 10px 14px;
    background: var(--bg-surface-2);
    border-radius: var(--radius-md);
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
    border-left: 3px solid var(--blue);
}

/* ─── Bug Detail 2-Column ─── */
.bug-detail-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
    align-items: start;
}

.bug-detail-main {
    min-width: 0;
}

.bug-detail-sidebar {
    min-width: 0;
}

.bug-detail-sidebar .card {
    max-height: calc(100vh - 100px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.bug-detail-sidebar .activity-timeline {
    overflow-y: auto;
    max-height: calc(100vh - 320px);
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ─── Responsive ─── */
@media (max-width: 1200px) {
    .bug-detail-layout {
        grid-template-columns: 1fr;
    }

    .bug-detail-sidebar .card {
        position: static !important;
        max-height: none;
    }

    .bug-detail-sidebar .activity-timeline {
        max-height: 600px;
    }
}

@media (max-width: 1024px) {
    :root {
        --sidebar-w: 220px;
    }

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

@media (max-width: 768px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
        border-bottom: 1px solid var(--border);
        box-shadow: none;
    }

    .sidebar-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        padding: 8px;
    }

    .sidebar-nav .nav-item {
        padding: 8px 12px;
        font-size: 12px;
        gap: 6px;
    }

    .sidebar-nav .nav-item.active::before {
        display: none;
    }

    .sidebar-footer {
        display: none;
    }

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

    .topbar {
        padding: 0 16px;
    }

    .topbar-search {
        display: none;
    }

    .page-content {
        padding: 16px;
    }

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

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

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

    .software-version-grid {
        grid-template-columns: 1fr;
    }

    .filter-form {
        flex-direction: column;
        width: 100%;
    }

    .filter-input,
    .filter-select {
        width: 100%;
        min-width: 100%;
    }

    .table-card-header {
        flex-direction: column;
        align-items: stretch;
    }

    .table {
        font-size: 12px;
    }

    .table th,
    .table td {
        padding: 10px 8px;
    }
}

@media (max-width: 768px) {
    .activity-item {
        padding: 14px;
        gap: 10px;
    }

    .activity-icon {
        width: 30px;
        height: 30px;
    }

    .activity-icon-inner {
        width: 26px;
        height: 26px;
        font-size: 12px;
    }

    .activity-header {
        font-size: 12px;
    }

    .activity-time {
        font-size: 11px;
        margin-left: 0;
        width: 100%;
    }

    .activity-comment {
        font-size: 12px;
        padding: 8px 10px;
    }
}

/* ─── Animations ─── */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card {
    animation: fadeInUp 0.3s ease both;
}

.stat-card:nth-child(1) {
    animation-delay: 0s;
}

.stat-card:nth-child(2) {
    animation-delay: 0.05s;
}

.stat-card:nth-child(3) {
    animation-delay: 0.1s;
}

.stat-card:nth-child(4) {
    animation-delay: 0.15s;
}

.card {
    animation: fadeInUp 0.3s ease both;
}
