:root {
    --bg-body:    #0d1117;
    --bg-card:    #161b22;
    --bg-nav:     #0d1f30;
    --bg-sidebar: #0f1923;
    --bg-input:   #1c2128;
    --bg-hover:   #1f2a38;
    --border:     #30363d;
    --text:       #e6edf3;
    --text-muted: #7d8590;
    --accent:     #2f81f7;
    --accent-dim: #1a4f9f;
    --green:      #3fb950;
    --red:        #f85149;
    --orange:     #d29922;
    --blue:       #58a6ff;
    --purple:     #a371f7;
    --radius:     6px;
    --shadow:     0 1px 3px rgba(0,0,0,.4);
}

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

body {
    background: var(--bg-body);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* ── Navbar ──────────────────────────────────── */
.navbar {
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    height: 48px;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand a {
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
    white-space: nowrap;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 16px;
    flex: 1;
}

.nav-links a, .nav-right a {
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: var(--radius);
    font-size: 13px;
    transition: background .15s, color .15s;
}
.nav-links a:hover, .nav-right a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }

.nav-right { display: flex; align-items: center; gap: 4px; }
.nav-right a { color: var(--text-muted); }
.nav-btn { background: var(--accent-dim); color: var(--text) !important; padding: 4px 12px; border-radius: var(--radius); }
.nav-btn:hover { background: var(--accent) !important; }

/* ── Container ───────────────────────────────── */
.container { flex: 1; padding: 24px; max-width: 1400px; margin: 0 auto; width: 100%; }

/* ── Home Layout ─────────────────────────────── */
.home-layout { display: grid; grid-template-columns: 1fr 280px; gap: 24px; }

.home-hero { margin-bottom: 24px; }
.home-hero h1 { font-size: 24px; margin-bottom: 8px; }
.home-hero p  { color: var(--text-muted); line-height: 1.7; }

.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.project-card h3 { font-size: 15px; margin-bottom: 8px; }
.project-card h3 a { color: var(--text); }
.project-card h3 a:hover { color: var(--accent); text-decoration: none; }

.latest-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }

.latest-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 13px;
    overflow: hidden;
}
.latest-item-bar { width: 3px; height: 14px; border-radius: 2px; flex-shrink: 0; }
.latest-item a { color: var(--text-muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 220px; }
.latest-item a:hover { color: var(--text); text-decoration: none; }

/* ── Stats Sidebar ───────────────────────────── */
.stats-sidebar { display: flex; flex-direction: column; gap: 12px; }
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}
.stat-card h4 { font-size: 14px; margin-bottom: 8px; color: var(--text); }
.stat-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-muted); padding: 1px 0; }
.stat-row span:last-child { color: var(--text); }

/* ── Project Page ────────────────────────────── */
.project-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.project-header h1 { font-size: 22px; }

.tab-bar { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tab-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color .15s;
}
.tab-btn.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-btn:hover { color: var(--text); }

.issues-table { width: 100%; border-collapse: collapse; }
.issues-table th {
    text-align: left;
    padding: 8px 12px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.issues-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.issues-table tr:last-child td { border-bottom: none; }
.issues-table tr:hover td { background: var(--bg-hover); }
.issues-table .title-cell a { color: var(--text); }
.issues-table .title-cell a:hover { color: var(--accent); text-decoration: none; }
.issues-table .meta { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

/* ── Status Badge ────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .3px;
}
.badge-open     { background: rgba(248,81,73,.15); color: var(--red); border: 1px solid var(--red); }
.badge-solved   { background: rgba(88,166,255,.15); color: var(--blue); border: 1px solid var(--blue); }
.badge-accepted { background: rgba(63,185,80,.15); color: var(--green); border: 1px solid var(--green); }
.badge-backlogged{ background: rgba(210,153,34,.15); color: var(--orange); border: 1px solid var(--orange); }
.badge-declined { background: rgba(248,81,73,.15); color: var(--red); border: 1px solid var(--red); }
.badge-archived { background: rgba(110,118,129,.15); color: var(--text-muted); border: 1px solid var(--border); }

/* ── Issue / Feedback View ───────────────────── */
.view-layout { display: grid; grid-template-columns: 1fr 240px; gap: 24px; }
.view-sidebar-left {
    width: 200px;
    border-right: 1px solid var(--border);
    padding-right: 20px;
    flex-shrink: 0;
    display: none;
}

.view-main { min-width: 0; }
.view-header h1 { font-size: 22px; margin-bottom: 4px; }
.view-header .meta { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }
.view-header .meta a { color: var(--text-muted); }

.view-section { margin-bottom: 24px; }
.view-section h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin-bottom: 10px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }

.detail-list { list-style: none; font-size: 14px; }
.detail-list li { padding: 3px 0; }
.detail-list strong { color: var(--text-muted); font-weight: 400; }

.description-body {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    font-size: 14px;
    line-height: 1.7;
}
.description-body code { background: var(--bg-input); padding: 2px 5px; border-radius: 3px; font-size: 12px; }

.view-actions { display: flex; flex-direction: column; gap: 8px; }
.view-actions .action-group { display: flex; gap: 6px; flex-wrap: wrap; }
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
    transition: background .15s, border-color .15s;
    white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); border-color: var(--text-muted); text-decoration: none; color: var(--text); }
.btn-danger  { border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: rgba(248,81,73,.1); color: var(--red); }
.btn-success { border-color: var(--green); color: var(--green); }
.btn-success:hover { background: rgba(63,185,80,.1); color: var(--green); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

.people-section .person-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.people-section .person-label { color: var(--text-muted); }
.people-section .person-val { color: var(--text); }

.votes-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
    margin-top: 8px;
}
.votes-count { font-size: 24px; font-weight: 700; display: block; }
.votes-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; }

/* ── Attachments ─────────────────────────────── */
.attachments-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.attachment-thumb {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    width: 120px;
}
.attachment-thumb img { width: 100%; height: 80px; object-fit: cover; display: block; }
.attachment-name { padding: 4px 6px; font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attachment-link { padding: 8px; display: block; color: var(--text-muted); font-size: 12px; }

/* ── Add Form ────────────────────────────────── */
.add-layout { max-width: 760px; margin: 0 auto; }
.form-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.form-tab {
    padding: 8px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    transition: all .15s;
}
.form-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.form-tab:hover:not(.active) { background: var(--bg-hover); color: var(--text); }

.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}
.form-card h2 { font-size: 16px; margin-bottom: 20px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.form-control {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 8px 12px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--accent); }
textarea.form-control { resize: vertical; min-height: 140px; }
select.form-control option { background: var(--bg-card); }

.file-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}
.file-input-wrapper input[type="file"] { display: none; }
.file-label {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 14px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-muted);
}
.file-label:hover { border-color: var(--accent); color: var(--text); }

/* ── Account Page ────────────────────────────── */
.account-layout { display: grid; grid-template-columns: 200px 1fr; gap: 24px; }
.account-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}
.account-avatar { width: 100px; height: 100px; border-radius: 50%; margin-bottom: 12px; border: 3px solid var(--border); }
.account-username { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.account-stat { font-size: 12px; color: var(--text-muted); }
.account-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }

.activity-list { list-style: none; }
.activity-list li { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.activity-list li:last-child { border-bottom: none; }
.activity-time { color: var(--text-muted); font-size: 12px; }

/* ── Staff Panel ─────────────────────────────── */
.staff-layout { display: grid; grid-template-columns: 180px 1fr; gap: 0; min-height: calc(100vh - 100px); }
.staff-sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    padding: 16px 0;
}
.staff-sidebar a {
    display: block;
    padding: 8px 20px;
    color: var(--text-muted);
    font-size: 13px;
    transition: color .15s, background .15s;
    border-left: 3px solid transparent;
}
.staff-sidebar a:hover, .staff-sidebar a.active {
    color: var(--accent);
    background: rgba(47,129,247,.08);
    border-left-color: var(--accent);
    text-decoration: none;
}

.staff-content { padding: 24px; }
.staff-content h1 { font-size: 22px; margin-bottom: 20px; }

.staff-grid { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left;
    padding: 8px 12px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-hover); }
.data-table .actions a { font-size: 12px; margin-right: 8px; }
.data-table .actions .del { color: var(--red); }
.data-table .actions .del:hover { color: var(--red); }
.data-table .actions .edit { color: var(--blue); }

.side-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.side-form h3 { font-size: 14px; margin-bottom: 14px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }

/* ── Alert ───────────────────────────────────── */
.alert { padding: 10px 16px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px; border: 1px solid; }
.alert-success { background: rgba(63,185,80,.1); border-color: var(--green); color: var(--green); }
.alert-error   { background: rgba(248,81,73,.1); border-color: var(--red); color: var(--red); }
.alert-info    { background: rgba(88,166,255,.1); border-color: var(--blue); color: var(--blue); }

/* ── Login Page ──────────────────────────────── */
.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 120px);
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    width: 100%;
    max-width: 380px;
}
.login-card h1 { font-size: 22px; margin-bottom: 8px; }
.login-card p { color: var(--text-muted); margin-bottom: 28px; font-size: 14px; }
.discord-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #5865F2;
    color: #fff;
    padding: 10px 24px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s;
}
.discord-btn:hover { background: #4752c4; color: #fff; text-decoration: none; }

/* ── Markdown Toolbar ─────────────────────────── */
.md-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 4px 6px;
}
.md-toolbar + .form-control {
    border-radius: 0 0 var(--radius) var(--radius);
}
.md-toolbar button {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    min-width: 28px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .12s, color .12s, border-color .12s;
    padding: 0 6px;
}
.md-toolbar button:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--border);
}
.md-toolbar-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }

/* ── Pagination ──────────────────────────────── */
.pagination { display: flex; gap: 4px; margin-top: 16px; justify-content: center; }
.page-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
    transition: all .15s;
}
.page-btn:hover, .page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; text-decoration: none; }

/* ── Misc ────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); font-size: 15px; }
.empty-state i { font-size: 32px; margin-bottom: 12px; display: block; }

.site-footer { border-top: 1px solid var(--border); padding: 16px 24px; text-align: center; color: var(--text-muted); font-size: 12px; }

/* ── Color swatch ────────────────────────────── */
.color-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; margin-right: 4px; }

@media (max-width: 900px) {
    .home-layout { grid-template-columns: 1fr; }
    .view-layout  { grid-template-columns: 1fr; }
    .account-layout { grid-template-columns: 1fr; }
    .staff-layout { grid-template-columns: 1fr; }
    .staff-sidebar { display: flex; flex-wrap: wrap; padding: 8px; border-right: none; border-bottom: 1px solid var(--border); }
    .staff-sidebar a { border-left: none; border-bottom: 2px solid transparent; padding: 6px 12px; }
    .staff-sidebar a:hover, .staff-sidebar a.active { border-bottom-color: var(--accent); background: transparent; }
    .staff-grid { grid-template-columns: 1fr; }
}
