/* ═══════════════════════════════════════════════════════════════════════
   Modrix — app.css
   Full responsive stylesheet. No external CDN dependencies.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Reset ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
a { color: inherit; }

/* ── Variables ──────────────────────────────────────────────────────── */
:root {
    --primary:        #4F46E5;
    --primary-dark:   #3730a3;
    --primary-light:  #818cf8;
    --primary-bg:     #ede9fe;

    --bg:             #f3f4f6;
    --surface:        #ffffff;
    --border:         #e5e7eb;
    --border-dark:    #d1d5db;

    --text:           #111827;
    --text-muted:     #6b7280;
    --text-light:     #9ca3af;

    --success:        #059669;
    --success-bg:     #d1fae5;
    --warning:        #d97706;
    --warning-bg:     #fef3c7;
    --danger:         #dc2626;
    --danger-bg:      #fee2e2;
    --info:           #0284c7;
    --info-bg:        #e0f2fe;

    --sidebar-w:      220px;
    --topbar-h:       56px;
    --radius:         8px;
    --radius-lg:      12px;
    --shadow:         0 1px 6px rgba(0,0,0,.08);
    --shadow-lg:      0 4px 24px rgba(0,0,0,.12);

    --font-sans:      system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, sans-serif;
    --font-mono:      ui-monospace, 'Cascadia Code', 'Fira Mono', monospace;
}

/* Dark mode */
[data-theme="dark"] {
    --bg:           #0f172a;
    --surface:      #1e293b;
    --border:       #334155;
    --border-dark:  #475569;
    --text:         #f1f5f9;
    --text-muted:   #94a3b8;
    --text-light:   #64748b;
    --primary-bg:   #1e1b4b;
}

/* ── Base ────────────────────────────────────────────────────────────── */
body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    font-size: .9rem;
    line-height: 1.55;
}

/* ── Layout ─────────────────────────────────────────────────────────── */
.app-layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: var(--topbar-h) 1fr;
    min-height: 100vh;
}

/* Topbar */
.topbar {
    grid-column: 1 / 3;
    grid-row: 1;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    gap: .75rem;
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--topbar-h);
}
.topbar-brand {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--primary);
    letter-spacing: -.03em;
    text-decoration: none;
    margin-right: .5rem;
    white-space: nowrap;
}
.topbar-search { flex: 1; max-width: 380px; position: relative; }
.topbar-search input {
    width: 100%;
    padding: .4rem .875rem .4rem 2.2rem;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    background: var(--bg);
    color: var(--text);
    font-size: .875rem;
    transition: border-color .15s;
}
.topbar-search input:focus { outline: none; border-color: var(--primary-light); }
.topbar-search-icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: .9rem; pointer-events: none; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.topbar-btn {
    padding: .35rem .65rem;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.1rem;
    position: relative;
    transition: background .15s, color .15s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.topbar-btn:hover { background: var(--bg); color: var(--text); }
.notif-badge {
    position: absolute;
    top: 3px; right: 3px;
    min-width: 16px; height: 16px;
    background: var(--danger);
    color: #fff;
    border-radius: 8px;
    font-size: .65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}
.user-menu-wrap { position: relative; }
.user-avatar-btn {
    display: flex; align-items: center; gap: .5rem;
    background: none; border: none; cursor: pointer;
    padding: .25rem .5rem;
    border-radius: var(--radius);
    color: var(--text);
    transition: background .15s;
}
.user-avatar-btn:hover { background: var(--bg); }
.avatar-sm { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.avatar-lg { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.avatar-initials {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary); color: #fff; font-weight: 700; font-size: .85rem;
}
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute;
    right: 0; top: calc(100% + 6px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 200;
    overflow: hidden;
    display: none;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
    display: block;
    padding: .6rem 1rem;
    color: var(--text);
    text-decoration: none;
    font-size: .875rem;
    transition: background .1s;
}
.dropdown-item:hover { background: var(--bg); }
.dropdown-divider { border-top: 1px solid var(--border); margin: .25rem 0; }

/* Sidebar */
.sidebar {
    grid-column: 1;
    grid-row: 2;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    position: sticky;
    top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h));
    padding: .75rem 0;
}
.sidebar-section { padding: .5rem .75rem .25rem; }
.sidebar-section-title { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-light); padding: 0 .5rem; }
.nav-item {
    display: flex; align-items: center; gap: .6rem;
    padding: .5rem .875rem;
    border-radius: var(--radius);
    margin: 1px .25rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: .875rem;
    font-weight: 500;
    transition: background .13s, color .13s;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--primary-bg); color: var(--primary); }
.nav-item-icon { width: 18px; flex-shrink: 0; opacity: .7; }
.nav-sub {
    display: flex; align-items: center; gap: .6rem;
    padding: .4rem .875rem .4rem 2.25rem;
    border-radius: var(--radius);
    margin: 1px .25rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: .84rem;
    transition: background .13s, color .13s;
}
.nav-sub:hover { background: var(--bg); color: var(--text); }
.nav-sub.active { color: var(--primary); font-weight: 600; }

/* Page content */
.page-content {
    grid-column: 2;
    grid-row: 2;
    padding: 1.75rem 2rem;
    overflow-x: hidden;
}

/* ── Page header ─────────────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.page-header h1 { font-size: 1.4rem; font-weight: 700; line-height: 1.25; }
.header-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.breadcrumb-bar { font-size: .8rem; color: var(--text-muted); margin-bottom: .25rem; }
.breadcrumb-bar a { color: var(--primary); text-decoration: none; }
.breadcrumb-bar a:hover { text-decoration: underline; }
.breadcrumb-sep { margin: 0 .35rem; }

/* ── Cards ──────────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-header {
    padding: .875rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
}
.card-header h2, .card-header h3, .card-header h4 { margin: 0; font-size: 1rem; font-weight: 600; }
.card-body { padding: 1.25rem; }
.card-footer {
    padding: .875rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--bg);
}
.p-0 { padding: 0 !important; }
.p-2 { padding: .5rem !important; }
.p-3 { padding: .75rem !important; }

/* ── Grid ────────────────────────────────────────────────────────────── */
.row { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.col-2 { flex: 0 0 calc(16.666% - .625rem); }
.col-3 { flex: 0 0 calc(25% - .9375rem); min-width: 200px; }
.col-4 { flex: 0 0 calc(33.333% - .833rem); }
.col-5 { flex: 0 0 calc(41.666% - .729rem); }
.col-6 { flex: 1 1 calc(50% - .625rem); min-width: 260px; }
.col-7 { flex: 1 1 calc(58.333% - .521rem); }
.col-8 { flex: 0 0 calc(66.666% - .417rem); }
.col-9 { flex: 1 1 calc(75% - .3125rem); }
.col-12 { flex: 0 0 100%; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1.25rem; }
.mt-1 { margin-top: .25rem; }
.mt-4 { margin-top: 1.25rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-5 { padding-top: 2rem; padding-bottom: 2rem; }
.max-w-2xl { max-width: 720px; }
.max-w-lg { max-width: 540px; }

/* ── Stats row ──────────────────────────────────────────────────────── */
.stats-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.stat-card {
    flex: 1 1 140px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.15rem 1.25rem;
    box-shadow: var(--shadow);
}
.stat-value { font-size: 1.75rem; font-weight: 800; color: var(--primary); line-height: 1.1; }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-top: .2rem; }

/* ── Tables ─────────────────────────────────────────────────────────── */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}
.table th {
    padding: .65rem 1rem;
    text-align: left;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}
.table td {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg); }
.table-bordered td, .table-bordered th { border: 1px solid var(--border); }
.table-responsive { overflow-x: auto; }
.row-disabled { opacity: .5; }

/* ── Forms ──────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: .35rem;
    color: var(--text);
}
.form-label.required::after { content: ' *'; color: var(--danger); }
.form-control {
    display: block;
    width: 100%;
    padding: .55rem .875rem;
    border: 1.5px solid var(--border-dark);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: .9rem;
    transition: border-color .15s, box-shadow .15s;
    line-height: 1.5;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.15);
}
.form-control:disabled { opacity: .6; cursor: not-allowed; }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }

/* ── Assignee picker (multi-select checkboxes) ────────────── */
.assignee-picker { display: flex; flex-wrap: wrap; gap: .45rem; padding: .25rem 0; }
.assignee-option {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .3rem .7rem .3rem .4rem;
    border: 1.5px solid var(--border-dark);
    border-radius: 20px; cursor: pointer;
    font-size: .845rem; color: var(--text);
    transition: border-color .15s, background .15s, color .15s;
    user-select: none;
    background: var(--surface);
}
.assignee-option input[type=checkbox] { display: none; }
.assignee-option:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-bg);
    color: var(--primary);
    font-weight: 600;
}
.assignee-option:hover { border-color: var(--primary-light); background: var(--primary-bg); }
.avatar-xs {
    width: 20px; height: 20px; border-radius: 50%;
    font-size: .65rem; flex-shrink: 0;
}
/* Multi-assignee display in show */
.assignee-display { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .15rem; }
.assignee-chip {
    display: inline-flex; align-items: center; gap: .3rem;
    background: var(--primary-bg); color: var(--primary);
    border: 1px solid var(--primary-light);
    border-radius: 20px; padding: .15rem .55rem .15rem .3rem;
    font-size: .82rem; font-weight: 600;
}
.avatar-xs-img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.form-control-sm { padding: .35rem .65rem; font-size: .825rem; }
.form-control-color { padding: .2rem .4rem; height: 38px; width: 60px; cursor: pointer; }
.form-hint { font-size: .78rem; color: var(--text-muted); margin-top: .3rem; display: block; }
.form-check-label { display: flex; align-items: center; gap: .5rem; cursor: pointer; font-size: .88rem; }
.form-check-label input[type=checkbox], .form-check-label input[type=radio] { width: 15px; height: 15px; cursor: pointer; }
.check-group { display: flex; flex-direction: column; gap: .4rem; }
.form-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline-form { display: inline-flex; align-items: center; gap: .5rem; }

/* Filter bar */
.filter-bar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.filter-group { flex: 1 1 140px; }
.filter-group .form-control { margin-bottom: 0; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .5rem 1.1rem;
    border-radius: var(--radius);
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid transparent;
    text-decoration: none;
    white-space: nowrap;
    transition: opacity .13s, background .13s, color .13s, border-color .13s;
    line-height: 1.4;
}
.btn:hover { opacity: .85; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-outline { background: transparent; border-color: var(--border-dark); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { opacity: .85; }
.comment-header { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.comment-header .ml-auto { margin-left: auto; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-link { background: transparent; border-color: transparent; color: var(--primary); padding-left: .25rem; padding-right: .25rem; }
.btn-block { width: 100%; justify-content: center; margin-top: .25rem; }
.btn-lg { padding: .65rem 1.5rem; font-size: .95rem; }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-xs { padding: .2rem .55rem; font-size: .77rem; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-hover, rgba(0,0,0,.05)); color: var(--text); border-color: transparent; }

/* Table sm */
.table.table-sm td, .table.table-sm th { padding: .35rem .6rem; font-size: .82rem; }

/* ── Badges ──────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: .2rem .55rem;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}
.badge-primary   { background: var(--primary-bg); color: var(--primary); }
.badge-success   { background: var(--success-bg); color: var(--success); }
.badge-warning   { background: var(--warning-bg); color: var(--warning); }
.badge-danger    { background: var(--danger-bg);  color: var(--danger); }
.badge-info      { background: var(--info-bg);    color: var(--info); }
.badge-secondary { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border-dark); }

/* Priority badges */
.priority-critical { background: #7f1d1d; color: #fecaca; }
.priority-high     { background: var(--danger-bg); color: var(--danger); }
.priority-medium   { background: var(--warning-bg); color: var(--warning); }
.priority-low      { background: var(--info-bg); color: var(--info); }

/* Status label */
.status-label {
    display: inline-flex;
    align-items: center;
    padding: .2rem .65rem;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 700;
    color: #fff;
}

/* ── Flash messages ──────────────────────────────────────────────────── */
.flash { padding: .875rem 1.1rem; border-radius: var(--radius); margin-bottom: 1.25rem; font-size: .875rem; display: flex; align-items: flex-start; gap: .75rem; }
.flash-success { background: var(--success-bg); color: #064e3b; border: 1px solid #6ee7b7; }
.flash-error   { background: var(--danger-bg);  color: #7f1d1d; border: 1px solid #fca5a5; }
.flash-warning { background: var(--warning-bg); color: #78350f; border: 1px solid #fcd34d; }
.flash-info    { background: var(--info-bg);    color: #075985; border: 1px solid #7dd3fc; }

/* ── Alerts ──────────────────────────────────────────────────────────── */
.alert { padding: .875rem 1rem; border-radius: var(--radius); margin-bottom: 1.25rem; font-size: .875rem; }
.alert-danger, .alert-error { background: var(--danger-bg);  border: 1px solid #fca5a5; color: #7f1d1d; }
.alert-success { background: var(--success-bg); border: 1px solid #6ee7b7; color: #064e3b; }

/* ── Markdown editor ─────────────────────────────────────────────────── */
.md-editor-wrap { border: 1.5px solid var(--border-dark); border-radius: var(--radius); overflow: hidden; }
.md-toolbar {
    display: flex;
    gap: .25rem;
    padding: .4rem .5rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.md-btn {
    padding: .25rem .55rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    cursor: pointer;
    font-size: .8rem;
    color: var(--text);
    transition: background .1s;
}
.md-btn:hover { background: var(--primary-bg); color: var(--primary); }
.md-preview-toggle {
    padding: .25rem .7rem;
    border: 1px solid var(--primary-light);
    border-radius: 4px;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    font-size: .8rem;
    font-weight: 600;
    transition: background .1s, color .1s;
    margin-left: auto;
}
.md-preview-toggle:hover { background: var(--primary-bg); }
.md-textarea { border: none !important; border-radius: 0 !important; font-family: var(--font-mono); font-size: .85rem; }
input[type=file].form-control {
    padding: .4rem .6rem;
    font-size: .82rem;
    cursor: pointer;
    color: var(--text-muted);
}
input[type=file].form-control::file-selector-button {
    padding: .3rem .75rem;
    border: 1.5px solid var(--border-dark);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    margin-right: .75rem;
    transition: background .13s;
}
input[type=file].form-control::file-selector-button:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }
.md-textarea:focus { box-shadow: none; }
.md-preview { padding: 1.25rem; min-height: 100px; background: var(--surface); }

/* ── Markdown body (rendered HTML) ─────────────────────────────────── */
.markdown-body { line-height: 1.7; font-size: .9rem; }
.markdown-body h1,.markdown-body h2,.markdown-body h3,.markdown-body h4 { margin: 1.2em 0 .5em; font-weight: 700; line-height: 1.3; }
.markdown-body h1 { font-size: 1.5rem; border-bottom: 2px solid var(--border); padding-bottom: .35rem; }
.markdown-body h2 { font-size: 1.2rem; }
.markdown-body h3 { font-size: 1rem; }
.markdown-body p { margin-bottom: .875rem; }
.markdown-body ul,.markdown-body ol { padding-left: 1.5rem; margin-bottom: .875rem; }
.markdown-body li { margin-bottom: .3rem; }
.markdown-body code {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 4px; padding: .1rem .4rem; font-size: .84rem;
    font-family: var(--font-mono); color: var(--primary);
}
.markdown-body pre {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1rem; overflow-x: auto; margin-bottom: .875rem;
}
.markdown-body pre code { background: none; border: none; padding: 0; color: var(--text); }
.markdown-body blockquote {
    border-left: 4px solid var(--primary); padding-left: 1rem;
    color: var(--text-muted); margin: .875rem 0;
}
.markdown-body table { width: 100%; border-collapse: collapse; margin-bottom: .875rem; }
.markdown-body th,.markdown-body td { border: 1px solid var(--border); padding: .5rem .75rem; }
.markdown-body th { background: var(--bg); font-weight: 700; font-size: .85rem; }
.markdown-body a { color: var(--primary); text-decoration: underline; }
.markdown-body hr { border: none; border-top: 2px solid var(--border); margin: 1.25rem 0; }
.markdown-body img { max-width: 100%; border-radius: var(--radius); }

/* ── Kanban board ────────────────────────────────────────────────────── */
.kanban-board {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    align-items: flex-start;
    min-height: calc(100vh - 160px);
}
.kanban-col {
    flex: 0 0 268px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 160px);
    overflow: hidden;
}
.kanban-col-header {
    padding: .75rem 1rem;
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.kanban-col-count { font-size: .7rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .1rem .4rem; }
.kanban-cards {
    flex: 1;
    overflow-y: auto;
    padding: .625rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    min-height: 60px;
}
.kanban-cards.drag-over { background: var(--primary-bg); border-radius: var(--radius); }
.kanban-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .75rem;
    cursor: grab;
    transition: box-shadow .15s, transform .15s;
    user-select: none;
}
.kanban-card:hover { box-shadow: var(--shadow-lg); }
.kanban-card.dragging { opacity: .4; transform: rotate(2deg); cursor: grabbing; }
.kanban-card-title { font-weight: 600; font-size: .875rem; margin-bottom: .4rem; }
.kanban-card-title a { text-decoration: none; color: var(--text); }
.kanban-card-title a:hover { color: var(--primary); }
.kanban-card-meta { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }

/* ── Wiki ────────────────────────────────────────────────────────────── */
.wiki-nav-tree { list-style: none; padding: 0; margin: 0; }
.wiki-nav-tree ul, .wiki-nav-tree .wiki-nav-tree { padding-left: 1rem; }
.wiki-nav-details > summary { list-style: none; }
.wiki-nav-details > summary::-webkit-details-marker { display: none; }
.wiki-nav-item {
    display: flex; align-items: center; gap: .4rem;
    padding: .38rem .85rem;
    font-size: .835rem; color: var(--text-muted);
    text-decoration: none; cursor: pointer;
    transition: background .12s, color .12s;
    border-radius: 0;
}
.wiki-nav-item:hover { color: var(--primary); background: var(--primary-bg); }
.wiki-nav-item.active { color: var(--primary); font-weight: 700; background: var(--primary-bg); }
.wiki-nav-item a { color: inherit; text-decoration: none; flex: 1; }
.wiki-nav-item svg { flex-shrink: 0; color: var(--primary-light); }
.wiki-tree { list-style: none; padding: 0; margin: 0; }
.wiki-tree-item { padding: .3rem .5rem; }
.wiki-tree-item a { text-decoration: none; color: var(--text-muted); font-size: .875rem; }
.wiki-tree-item a:hover { color: var(--primary); }
.wiki-content { padding: 1.5rem; }
/* Wiki card list (index) */
.wiki-card-list { display: flex; flex-direction: column; gap: .85rem; }
.wiki-page-card { margin: 0; }
.wiki-page-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .35rem; }
.wiki-page-title { font-size: 1.05rem; font-weight: 700; color: var(--primary); text-decoration: none; }
.wiki-page-title:hover { text-decoration: underline; }
.wiki-page-preview { margin: 0 0 .45rem; font-size: .875rem; line-height: 1.55; }
.wiki-page-meta { font-size: .8rem; }

/* Diff */
.diff-view { font-family: var(--font-mono); font-size: .82rem; line-height: 1.6; overflow-x: auto; }
.diff-add    { background: #d1fae5; color: #065f46; padding: 0 .25rem; }
.diff-remove { background: #fee2e2; color: #7f1d1d; padding: 0 .25rem; }
.diff-context{ color: var(--text-muted); }

/* ── Files ───────────────────────────────────────────────────────────── */
.file-folder-link { text-decoration: none; color: var(--warning); font-weight: 600; }
.file-folder-link:hover { color: var(--primary); }
.file-link { text-decoration: none; color: var(--primary); }
.file-link:hover { text-decoration: underline; }

/* ── Attachments ─────────────────────────────────────────────────────── */
.attachment-list { list-style: none; padding: 0; margin: 0; }
.attachment-item { display: flex; align-items: center; gap: .5rem; padding: .4rem 0; border-bottom: 1px solid var(--border); font-size: .875rem; flex-wrap: wrap; }
.attachment-item:last-child { border-bottom: none; }

/* ── Attachment rows with replace / version history ── */
.att-row { border-bottom: 1px solid var(--border); }
.att-row:last-child { border-bottom: none; }
.att-main { display: flex; align-items: center; gap: .6rem; padding: .65rem 1rem; flex-wrap: wrap; }
.att-icon { font-size: 1.15rem; flex-shrink: 0; }
.att-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.att-name { font-weight: 500; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-meta { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; margin-top: .1rem; }
.att-actions { display: flex; align-items: center; gap: .35rem; flex-shrink: 0; margin-left: auto; }
.att-replace-panel { padding: .75rem 1rem; background: var(--surface-alt, #f8f9fa); border-top: 1px solid var(--border); }
.att-replace-form { display: flex; flex-direction: column; gap: .5rem; }
.att-replace-actions { display: flex; gap: .5rem; margin-top: .25rem; }
.att-history { padding: .5rem 1rem .75rem; background: var(--surface-alt, #f8f9fa); border-top: 1px solid var(--border); overflow-x: auto; }
.att-history .table { margin: 0; }
/* Version badge */
.version-badge { display: inline-block; padding: .1rem .45rem; background: var(--primary-bg); color: var(--primary); border: 1px solid var(--primary-light); border-radius: 20px; font-size: .72rem; font-weight: 700; line-height: 1.4; }
.text-nowrap { white-space: nowrap; }
.attachment-icon { font-size: 1.1rem; }

/* ── Notifications ──────────────────────────────────────────────────── */
.notification-list { list-style: none; padding: 0; margin: 0; }
.notification-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: .875rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-size: .875rem;
}
.notification-item:last-child { border-bottom: none; }
.notification-unread { background: #faf5ff; }
[data-theme=dark] .notification-unread { background: #1e1b4b22; }
.notification-body { display: flex; gap: .75rem; align-items: flex-start; flex: 1; }
.notification-badge {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: .45rem;
}
.notification-badge.task_comment { background: var(--primary); }
.notification-badge.task_status  { background: var(--success); }
.notification-badge.mention      { background: var(--warning); }
.notification-badge.info         { background: var(--info); }
.notification-meta { color: var(--text-muted); font-size: .78rem; margin-top: .2rem; }
.notification-actions { flex-shrink: 0; }

/* ── Activity feed ──────────────────────────────────────────────────── */
.activity-feed { list-style: none; padding: 0; margin: 0; }
.activity-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: .6rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-size: .875rem;
    gap: .75rem;
}
.activity-item:last-child { border-bottom: none; }
.activity-meta { font-size: .78rem; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }

/* ── User cell ───────────────────────────────────────────────────────── */
.user-cell { display: flex; align-items: center; gap: .5rem; }

/* ── Pagination ──────────────────────────────────────────────────────── */
.pagination { display: flex; gap: .25rem; flex-wrap: wrap; }
.page-link {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    font-size: .85rem;
    transition: background .1s, color .1s;
}
.page-link:hover { background: var(--bg); }
.page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Collapsible panels ──────────────────────────────────────────────── */
.collapsible-panel { animation: slideDown .15s ease; }
@keyframes slideDown { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:none; } }

/* ── Transition matrix ───────────────────────────────────────────────── */
.transition-matrix th, .transition-matrix td { text-align: center; min-width: 80px; }
.transition-matrix td:first-child, .transition-matrix th:first-child { text-align: left; font-weight: 600; min-width: 100px; }

/* ── Empty states ────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1rem; }
.empty-icon { font-size: 3rem; margin-bottom: .75rem; opacity: .4; }

/* ── Auth layout ─────────────────────────────────────────────────────── */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    padding: 1.5rem;
}
.auth-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 380px;
}
.auth-logo { text-align: center; font-size: 2rem; font-weight: 900; color: var(--primary); letter-spacing: -.04em; margin-bottom: 1.75rem; }
.auth-logo span { color: var(--text-muted); }

/* ── Misc helpers ────────────────────────────────────────────────────── */
.text-sm    { font-size: .8rem !important; }
.text-muted { color: var(--text-muted) !important; }
.text-danger{ color: var(--danger) !important; }
.text-right { text-align: right; }
.text-center{ text-align: center; }
.font-bold  { font-weight: 700; }
.d-flex     { display: flex; }
.gap-1      { gap: .25rem; }
.gap-2      { gap: .5rem; }
.flex-wrap  { flex-wrap: wrap; }
.align-center { align-items: center; }
.w-100      { width: 100%; }

/* ── Sidebar toggle (mobile) ─────────────────────────────────────────── */
#sidebar-toggle { display: none; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    :root { --sidebar-w: 0px; }
    .app-layout { grid-template-columns: 1fr; }
    .sidebar { display: none; position: fixed; left: 0; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); width: 220px; z-index: 300; }
    .sidebar.open { display: block; }
    .page-content { grid-column: 1; padding: 1rem; }
    #sidebar-toggle { display: inline-flex !important; }
    .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9 { flex: 0 0 100%; min-width: 0; }
    .topbar-search { max-width: 160px; }
}

@media (max-width: 480px) {
    .page-header { flex-direction: column; }
    .stats-row > .stat-card { flex: 0 0 calc(50% - .5rem); }
    .kanban-board { gap: .75rem; }
    .kanban-col { flex: 0 0 240px; }
    /* Hide search bar on very small screens to make room for hamburger */
    .topbar-search { display: none; }
    /* Hide username text, keep avatar + dropdown arrow */
    .user-name { display: none; }
    /* Tighter topbar padding */
    .topbar { padding: 0 .6rem; gap: .4rem; }
}

/* ── Topbar search refinement ────────────────────────────────────────── */
.topbar-search button[type=submit] { display: none; }
.topbar-search input { padding-left: 2.25rem; }

/* ── User menu button ────────────────────────────────────────────────── */
.user-menu-btn {
    display: flex; align-items: center; gap: .45rem;
    background: none; border: 1.5px solid var(--border);
    border-radius: 20px;
    padding: .3rem .75rem .3rem .35rem;
    cursor: pointer; color: var(--text);
    font-size: .85rem; font-weight: 600;
    transition: background .15s, border-color .15s;
    white-space: nowrap;
}
.user-menu-btn:hover { background: var(--bg); border-color: var(--border-dark); }
.avatar-initials {
    width: 28px; height: 28px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary); color: #fff;
    font-weight: 700; font-size: .8rem; flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }

/* ── Stat card icon ──────────────────────────────────────────────────── */
.stat-icon { margin-bottom: .4rem; opacity: .85; }

/* ── Admin nav links ─────────────────────────────────────────────────── */
.admin-nav-link {
    display: flex; align-items: center; gap: .875rem;
    padding: .875rem 1.25rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none; color: var(--text);
    transition: background .13s;
}
.admin-nav-link:hover { background: var(--bg); }
.admin-nav-icon {
    width: 36px; height: 36px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

/* ── Projects grid ───────────────────────────────────────────────────── */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}
.project-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: .6rem;
    transition: box-shadow .15s, border-color .15s;
}
.project-card:hover { box-shadow: var(--shadow-lg); border-color: var(--primary-light); }
.project-card-header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.project-card-title {
    font-weight: 700; font-size: 1rem; color: var(--text);
    text-decoration: none; line-height: 1.3;
}
.project-card-title:hover { color: var(--primary); }
.project-card-desc { font-size: .85rem; line-height: 1.5; margin: 0; }
.project-card-meta {
    display: flex; gap: 1rem; font-size: .78rem;
    color: var(--text-muted); flex-wrap: wrap;
}
.project-card-actions { display: flex; gap: .5rem; margin-top: .25rem; }
.badge-role { text-transform: capitalize; }
.badge-role-admin   { background: #fee2e2; color: #dc2626; }
.badge-role-manager { background: #fef3c7; color: #d97706; }
.badge-role-member  { background: var(--primary-bg); color: var(--primary); }
.badge-role-viewer  { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border-dark); }

/* ── Project list (dashboard sidebar) ───────────────────────────────── */
.project-list { list-style: none; padding: 0; margin: 0; }
.project-list-item {
    display: flex; align-items: center; justify-content: space-between;
    gap: .5rem; padding: .65rem 1.25rem;
    text-decoration: none; color: var(--text);
    border-bottom: 1px solid var(--border);
    transition: background .12s;
    font-size: .875rem;
}
.project-list-item:hover { background: var(--bg); }
.project-name { font-weight: 600; }

/* ── Members list ────────────────────────────────────────────────────── */
.member-list { list-style: none; padding: 0; margin: 0; }
.member-item {
    display: flex; align-items: center; gap: .75rem;
    padding: .65rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-size: .875rem;
}
.member-item:last-child { border-bottom: none; }

/* ── Status / priority badges ────────────────────────────────────────── */
.status-badge {
    display: inline-flex; align-items: center;
    padding: .2rem .65rem; border-radius: 20px;
    font-size: .72rem; font-weight: 700; color: #fff;
    white-space: nowrap;
}
.priority-badge {
    display: inline-flex; align-items: center;
    padding: .2rem .55rem; border-radius: 20px;
    font-size: .72rem; font-weight: 700;
    text-transform: capitalize; white-space: nowrap;
}
.priority-badge.priority-urgent, .priority-badge.priority-critical { background: #fee2e2; color: #dc2626; }
.priority-badge.priority-high   { background: #fef3c7; color: #d97706; }
.priority-badge.priority-normal { background: var(--primary-bg); color: var(--primary); }
.priority-badge.priority-low    { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border-dark); }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .3rem; vertical-align: middle; }

/* ── Module tiles (project show page) ───────────────────────────────── */
.module-tiles {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .75rem;
}
.module-tile {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: .5rem;
    padding: 1.1rem .75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-decoration: none; color: var(--text-muted);
    font-size: .8rem; font-weight: 600;
    transition: background .13s, color .13s, border-color .13s, box-shadow .13s;
    text-align: center;
}
.module-tile:hover { background: var(--primary-bg); color: var(--primary); border-color: var(--primary-light); box-shadow: var(--shadow); }
.module-tile svg { transition: color .13s; }

/* ── Activity feed items ─────────────────────────────────────────────── */
.activity-actor { font-weight: 600; margin-right: .3rem; }
.activity-desc  { color: var(--text-muted); font-size: .85rem; }
.activity-time  { font-size: .75rem; color: var(--text-light); white-space: nowrap; margin-left: auto; }
.text-xs { font-size: .75rem !important; }
.row-overdue td { background: #fff7f7; }
.mt-6 { margin-top: 1.75rem; }

/* ── Form select ──────────────────────────────────────────────── */
.form-select {
    appearance: none;
    -webkit-appearance: none;
    padding: .45rem 2.2rem .45rem .75rem;
    border: 1.5px solid var(--border-dark);
    border-radius: var(--radius);
    font-size: .875rem;
    background-color: var(--surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    color: var(--text);
    cursor: pointer;
    transition: border-color .15s;
    height: 38px;
}
.form-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.form-select:hover { border-color: var(--primary); }

/* ── Kanban add btn ──────────────────────────────────────────────── */
.kanban-add-btn {
    display: block;
    padding: .5rem 1rem;
    margin: .4rem .625rem .625rem;
    border: 1.5px dashed var(--border-dark);
    border-radius: var(--radius);
    text-align: center;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition: background .13s, color .13s, border-color .13s;
    flex-shrink: 0;
}
.kanban-add-btn:hover { background: var(--primary-bg); color: var(--primary); border-color: var(--primary); }

/* ── Avatar extra small ─────────────────────────────────────────── */
.avatar-xs { width: 22px; height: 22px; font-size: .6rem; }
.kanban-card-assignee { display: flex; align-items: center; gap: .35rem; margin-top: .4rem; }
.kanban-card-id { margin-top: .25rem; }

/* ── Task details info-list ────────────────────────────────────────── */
.info-list { margin: 0; }
.info-list dt {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-muted); margin-bottom: .2rem; margin-top: .85rem; font-weight: 700;
}
.info-list dt:first-child { margin-top: 0; }
.info-list dd { font-size: .875rem; color: var(--text); margin-left: 0; font-weight: 500; }
.info-list dd .tag {
    display: inline-block; background: var(--primary-bg); color: var(--primary);
    border-radius: 20px; padding: .12rem .55rem; font-size: .72rem; font-weight: 600;
    margin: .1rem .1rem 0 0;
}

/* ── Watcher list ──────────────────────────────────────────────── */
.watcher-list { display: flex; flex-direction: column; gap: .45rem; }
.watcher-item { display: flex; align-items: center; gap: .6rem; font-size: .875rem; }

/* ── Status change form (dropdown) ───────────────────────────────── */
.status-change-form { display: inline-flex; align-items: center; }
.status-select {
    height: 34px !important;
    padding: .2rem 2rem .2rem .65rem !important;
    font-size: .82rem !important;
    font-weight: 600;
    cursor: pointer;
    border-color: var(--border-dark);
}

/* ── Type badge ────────────────────────────────────────────────── */
.type-badge {
    display: inline-flex; align-items: center;
    padding: .2rem .55rem; border-radius: 20px;
    font-size: .72rem; font-weight: 700; text-transform: capitalize;
    background: var(--bg); color: var(--text-muted); border: 1px solid var(--border-dark);
    white-space: nowrap;
}
.type-badge.type-bug         { background: #fee2e2; color: var(--danger);  border-color: #fca5a5; }
.type-badge.type-feature     { background: var(--primary-bg); color: var(--primary); border-color: var(--primary-light); }
.type-badge.type-improvement { background: var(--success-bg); color: var(--success); border-color: #6ee7b7; }
.type-badge.type-question    { background: var(--warning-bg); color: var(--warning); border-color: #fcd34d; }

/* ── Status badge size variants ─────────────────────────────────────────── */
.status-badge.status-lg { font-size: .82rem; padding: .3rem .95rem; }

/* ── Task meta bar ──────────────────────────────────────────────── */
.task-meta-bar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; padding: .75rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }

/* ── Favorites ─────────────────────────────────────────────────── */
.btn-star { background: transparent; border: 1.5px solid var(--border-dark); color: var(--text-muted); }
.btn-star:hover { border-color: #f59e0b; color: #f59e0b; background: #fffbeb; opacity: 1; }
.btn-star.active { background: #fffbeb; border-color: #f59e0b; color: #d97706; }

/* ── Global Wiki Explorer ──────────────────────────────────────────────── */
.gw-layout {
    display: flex;
    height: calc(100vh - 56px);
    margin: -1.5rem;
    overflow: hidden;
}
.gw-tree-panel {
    width: 280px;
    min-width: 200px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.gw-tree-header {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .875rem 1rem;
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.gw-tree-search { padding: .6rem .75rem; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.gw-search-input {
    width: 100%; padding: .35rem .65rem;
    border: 1.5px solid var(--border-dark); border-radius: var(--radius);
    font-size: .8rem; background: var(--bg); color: var(--text); outline: none;
    transition: border-color .15s;
}
.gw-search-input:focus { border-color: var(--primary); background: var(--surface); }
.gw-tree { list-style: none; padding: .35rem 0; margin: 0; overflow-y: auto; flex: 1; }
.gw-project-details > summary { list-style: none; }
.gw-project-details > summary::-webkit-details-marker { display: none; }
.gw-project-summary.active .gw-project-link { background: var(--primary-bg); color: var(--primary); }
.gw-project-link {
    display: flex; align-items: center; gap: .45rem;
    padding: .5rem 1rem; font-size: .845rem; font-weight: 600;
    color: var(--text); text-decoration: none; transition: background .12s;
}
.gw-project-link:hover { background: var(--bg); }
.gw-folder-icon { width: 15px; height: 15px; flex-shrink: 0; color: var(--warning); }
.gw-project-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gw-count {
    font-size: .68rem; font-weight: 700;
    background: var(--border); color: var(--text-muted);
    border-radius: 10px; padding: .1rem .45rem; flex-shrink: 0;
}
.gw-pages-tree { list-style: none; padding: 0 0 .25rem 0; margin: 0; }
.gw-page-details > summary { list-style: none; }
.gw-page-details > summary::-webkit-details-marker { display: none; }
.gw-page-link {
    display: flex; align-items: center; gap: .4rem;
    padding: .35rem 1rem .35rem 2rem;
    font-size: .82rem; color: var(--text-muted);
    text-decoration: none; transition: background .12s, color .12s;
}
.gw-page-link:hover { color: var(--primary); background: var(--primary-bg); }
.gw-page-link a { color: inherit; text-decoration: none; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gw-page-details > summary.gw-page-link { cursor: pointer; }
.gw-icon { width: 13px; height: 13px; flex-shrink: 0; color: var(--primary-light); }
.gw-subtree { list-style: none; padding: 0; margin: 0; }
.gw-subtree .gw-page-link { padding-left: 3rem; }
.gw-empty-folder { padding: .3rem 1rem .3rem 2rem; font-size: .78rem; color: var(--text-light); font-style: italic; }
.gw-detail-panel { flex: 1; overflow-y: auto; padding: 1.75rem; background: var(--bg); min-width: 0; }
.gw-detail-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap;
}
.gw-detail-title { display: flex; align-items: center; gap: .6rem; }
.gw-detail-title h2 { font-size: 1.2rem; font-weight: 700; color: var(--text); }
.gw-pages-grid { display: flex; flex-direction: column; gap: .6rem; }
.gw-page-card {
    display: flex; align-items: flex-start; gap: 1rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 1rem 1.25rem;
    transition: box-shadow .15s, border-color .15s;
}
.gw-page-card:hover { box-shadow: var(--shadow); border-color: var(--primary-light); }
.gw-page-card-icon { color: var(--primary); flex-shrink: 0; margin-top: .15rem; }
.gw-page-card-body { flex: 1; min-width: 0; }
.gw-page-card-title {
    font-weight: 700; font-size: .95rem; color: var(--text);
    text-decoration: none; display: block; margin-bottom: .25rem;
}
.gw-page-card-title:hover { color: var(--primary); }
.gw-page-card-meta { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: .35rem; }
.gw-sub-pages { list-style: none; padding: 0; margin: .35rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.gw-sub-pages li a {
    display: inline-flex; align-items: center; gap: .3rem;
    font-size: .78rem; color: var(--text-muted); text-decoration: none;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 20px; padding: .1rem .55rem; transition: color .12s, background .12s;
}
.gw-sub-pages li a:hover { color: var(--primary); background: var(--primary-bg); border-color: var(--primary-light); }
.gw-page-card-actions { flex-shrink: 0; display: flex; align-items: center; }
.gw-welcome { text-align: center; padding: 3rem 1rem 2rem; color: var(--text-muted); }
.gw-welcome-icon { margin-bottom: 1rem; color: var(--text-light); display: flex; justify-content: center; }
.gw-welcome h2 { font-size: 1.35rem; color: var(--text); margin-bottom: .5rem; }
.gw-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: .75rem; margin-top: 1.5rem;
}
.gw-overview-card {
    display: flex; flex-direction: column; align-items: flex-start; gap: .35rem;
    padding: 1.1rem; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); text-decoration: none; color: var(--text);
    transition: box-shadow .15s, border-color .15s;
}
.gw-overview-card:hover { box-shadow: var(--shadow); border-color: var(--primary-light); }
.gw-overview-icon { color: var(--warning); }
.gw-overview-name { font-weight: 700; font-size: .9rem; }
.gw-overview-count { font-size: .78rem; color: var(--text-muted); }
@media (max-width: 700px) {
    .gw-layout { flex-direction: column; height: auto; margin: -.75rem; }
    .gw-tree-panel { width: 100%; height: auto; max-height: 200px; border-right: none; border-bottom: 1px solid var(--border); }
    .gw-tree { max-height: 120px; }
    .gw-detail-panel { padding: 1rem; }
    .gw-overview-grid { grid-template-columns: 1fr; }
}

/* ── Scrollbar ───────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }
