:root {
    --bg: #0f0f13;
    --bg-card: #1a1a24;
    --bg-sidebar: #12121a;
    --bg-input: #22222e;
    --text: #e0e0e8;
    --text-muted: #888898;
    --accent: #6c8cff;
    --accent-hover: #8aa4ff;
    --border: #2a2a3a;
    --success: #4ade80;
    --warn: #fbbf24;
    --error: #f87171;
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

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

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 220px;
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

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

.sidebar-header h2 { font-size: 1.2rem; color: var(--accent); }
.sidebar-header .subtitle { font-size: 0.75rem; color: var(--text-muted); }

.nav-links {
    list-style: none;
    flex: 1;
    padding: 0.5rem 0;
}

.nav-links li a {
    display: block;
    padding: 0.6rem 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: all 0.15s;
}

.nav-links li a:hover, .nav-links li a.active {
    color: var(--text);
    background: var(--bg-card);
}

.nav-links li a.active { border-left: 3px solid var(--accent); }

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Main content */
main { padding: 2rem; }
main.with-sidebar { margin-left: 220px; }

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.page-header h1 { font-size: 1.5rem; font-weight: 600; }

/* Breadcrumb */
.breadcrumb { font-size: 0.85rem; color: var(--text-muted); }
.breadcrumb a { color: var(--accent); }
.breadcrumb span { margin: 0 0.2rem; }

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.card h2 { font-size: 1.1rem; margin-bottom: 0.75rem; }
.card h3 { font-size: 0.95rem; margin: 0.75rem 0 0.5rem; color: var(--text-muted); }

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
}

.stat-number { font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

/* Content grid */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 900px) {
    .content-grid { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    main.with-sidebar { margin-left: 0; }
}

/* Projects */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1rem;
}

.project-item, .file-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.project-item:last-child, .file-item:last-child { border-bottom: none; }

.project-meta { display: flex; gap: 1rem; font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

.git-info { margin-top: 0.5rem; }

.git-log { margin-top: 0.5rem; }
.log-entry code {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    padding: 0.15rem 0;
}

.readme-preview { margin-top: 0.75rem; }
.readme-preview summary { cursor: pointer; color: var(--text-muted); font-size: 0.85rem; }
.readme-content {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    white-space: pre-wrap;
    color: var(--text-muted);
    max-height: 200px;
    overflow-y: auto;
}

/* File list */
.file-item a { font-size: 0.9rem; }
.file-item .meta { display: block; font-size: 0.75rem; color: var(--text-muted); }

/* Tables */
.table-container { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th, .data-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--bg-sidebar);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    position: sticky;
    top: 0;
}

.data-table tr:hover { background: rgba(108, 140, 255, 0.05); }

.path-cell {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg-input);
    color: var(--text-muted);
}

.badge-git { background: #1a2a1a; color: var(--success); }
.badge-warn { background: #2a2a1a; color: var(--warn); }
.badge-ext { background: #1a1a2a; color: var(--accent); }

/* Buttons */
.btn, .btn-small {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    background: var(--bg-input);
    color: var(--text);
}

.btn-small { padding: 0.3rem 0.6rem; font-size: 0.75rem; }

.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-secondary:hover { background: var(--bg-card); }
.btn-logout { color: var(--error); border-color: var(--error); }
.btn-logout:hover { background: rgba(248, 113, 113, 0.1); }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.3rem; }

input[type="text"], input[type="password"], select, .input-search, .input-select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
}

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

/* Filters */
.filter-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 1rem;
}

.filter-form .input-search { width: 250px; }
.filter-form .input-select { width: 150px; }

/* Login */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 380px;
}

.login-box h1 { text-align: center; margin-bottom: 0.25rem; }
.login-subtitle { text-align: center; color: var(--text-muted); font-size: 0.85rem; margin-bottom: 1.5rem; }

/* Flash messages */
.flash-messages { margin-bottom: 1rem; }
.flash {
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}
.flash-error { background: rgba(248, 113, 113, 0.15); color: var(--error); border: 1px solid rgba(248, 113, 113, 0.3); }
.flash-info { background: rgba(108, 140, 255, 0.15); color: var(--accent); border: 1px solid rgba(108, 140, 255, 0.3); }

/* File viewer */
.file-meta { margin-bottom: 1rem; display: flex; gap: 0.75rem; align-items: center; font-size: 0.85rem; color: var(--text-muted); }
.file-actions { display: flex; gap: 0.5rem; }

.file-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.markdown-body {
    line-height: 1.7;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 { margin: 1rem 0 0.5rem; }
.markdown-body p { margin-bottom: 0.75rem; }
.markdown-body code { background: var(--bg-input); padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 0.85rem; }
.markdown-body pre { background: var(--bg-input); padding: 1rem; border-radius: var(--radius); overflow-x: auto; }
.markdown-body pre code { background: none; padding: 0; }
.markdown-body table { border-collapse: collapse; width: 100%; margin: 0.75rem 0; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: 0.5rem; }

.pdf-container { margin: -1.25rem; }

.download-prompt { text-align: center; padding: 2rem; color: var(--text-muted); }

/* Browse up */
.browse-up { margin-bottom: 1rem; }
.browse-up a { font-size: 0.9rem; }

/* Status */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

.status-item .label { display: block; font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; }
.status-item .value { font-size: 1rem; font-weight: 500; }

.git-status { margin-top: 0.5rem; }

.empty { color: var(--text-muted); text-align: center; padding: 2rem; font-size: 0.9rem; }
