/* Developer-centric, information-dense UI */
:root {
    --bg: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #1c2128;
    --border: #30363d;
    --text: #c9d1d9;
    --text-muted: #8b949e;
    --text-bright: #f0f6fc;
    --accent: #58a6ff;
    --accent-muted: #1f6feb;
    --success: #3fb950;
    --warning: #d29922;
    --error: #f85149;
    --mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Roboto Mono', monospace;
}

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

body {
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
}

/* Navbar */
.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand h1 {
    font-size: 1.1rem;
    color: var(--text-bright);
    display: inline;
}

.nav-brand .subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

.nav-links {
    display: flex;
    gap: 1rem;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.nav-links a:hover {
    color: var(--text-bright);
    background: var(--bg-tertiary);
}

.nav-links a.active {
    color: var(--accent);
    background: var(--bg-tertiary);
}

/* Container */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Page Header */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h2 {
    color: var(--text-bright);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.stats-row {
    display: flex;
    gap: 1rem;
}

.stat-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    color: var(--accent);
    font-weight: bold;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
}

/* SQL Query */
.sql-query {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-bottom: 1rem;
    padding: 0.75rem;
}

.sql-query summary {
    color: var(--accent);
    cursor: pointer;
    user-select: none;
}

.sql-query pre {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.85rem;
    color: var(--success);
}

/* Tables */
.task-table, .schema-table, .meta-table, .services-table, .api-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.task-table th, .schema-table th, .meta-table th, .services-table th, .api-table th {
    background: var(--bg-tertiary);
    color: var(--text-bright);
    font-weight: 600;
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.task-table td, .schema-table td, .meta-table td, .services-table td, .api-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

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

.task-table tbody tr:last-child td,
.schema-table tbody tr:last-child td,
.meta-table tbody tr:last-child td,
.services-table tbody tr:last-child td,
.api-table tbody tr:last-child td {
    border-bottom: none;
}

.task-title {
    color: var(--text-bright);
    font-weight: 500;
}

.compact {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.timestamp {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.mono {
    font-family: var(--mono);
    color: var(--accent);
    font-size: 0.85rem;
}

.no-data {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem !important;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-status-todo { background: var(--bg-tertiary); color: var(--text-muted); }
.badge-status-in_progress { background: #1f6feb; color: white; }
.badge-status-done { background: var(--success); color: white; }
.badge-status-blocked { background: var(--error); color: white; }

.badge-priority-low { background: var(--bg-tertiary); color: var(--text-muted); }
.badge-priority-medium { background: #1f6feb; color: white; }
.badge-priority-high { background: var(--warning); color: black; }
.badge-priority-urgent { background: var(--error); color: white; }

.badge-service { background: var(--accent-muted); color: white; }

/* Entity Tags */
.entity-tag {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    margin: 0.1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 0.75rem;
}

.entity-tag.repo { border-left: 3px solid var(--accent); }
.entity-tag.file { border-left: 3px solid var(--warning); }
.entity-tag.person { border-left: 3px solid var(--success); }
.entity-tag.project { border-left: 3px solid #bc8cff; }

.label-tag {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    margin: 0.1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Pagination */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1rem 0;
}

.pagination {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.page-info {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--accent-muted);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-family: var(--mono);
    font-size: 0.85rem;
    transition: background 0.2s;
}

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

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.btn.disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Task Detail */
.breadcrumb {
    margin-bottom: 1rem;
}

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

.task-detail {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1.5rem;
}

.task-header {
    margin-bottom: 1.5rem;
}

.task-header h2 {
    color: var(--text-bright);
    margin-bottom: 0.75rem;
}

.task-meta {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.detail-section {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1rem;
}

.detail-section.full-width {
    grid-column: 1 / -1;
}

.detail-section h3 {
    color: var(--text-bright);
    font-size: 1rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.task-content {
    color: var(--text);
    line-height: 1.6;
    white-space: pre-wrap;
}

.json-data, .json-schema {
    background: var(--bg);
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.85rem;
    color: var(--text);
}

/* Infrastructure */
.infra-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.infra-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1.5rem;
}

.infra-section.full-width {
    grid-column: 1 / -1;
}

.infra-section h3 {
    color: var(--text-bright);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.infra-section h4 {
    color: var(--text-bright);
    margin: 1rem 0 0.5rem 0;
    font-size: 0.95rem;
}

.db-name {
    color: var(--accent);
    margin-bottom: 1rem;
}

.type-badge {
    background: var(--accent-muted);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
}

.lang-badge {
    background: var(--success);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
}

.index-list {
    list-style: none;
    padding: 0;
}

.index-list li {
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.flow-diagram {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.flow-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.step-number {
    background: var(--accent);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.step-text {
    color: var(--text);
}

.method {
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
}

.method.GET { background: var(--accent); color: white; }

.tool-list, .resource-list {
    list-style: none;
    padding: 0;
}

.tool-list li, .resource-list li {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.tool-list code, .resource-list code {
    display: block;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--bg);
    border-radius: 3px;
    color: var(--success);
    font-size: 0.8rem;
}

.resource-list a {
    color: var(--accent);
    text-decoration: none;
}

.resource-list a:hover {
    text-decoration: underline;
}

/* Error Page */
.error-page {
    text-align: center;
    padding: 3rem;
}

.error-page h2 {
    color: var(--error);
    margin-bottom: 1rem;
}

.error-message {
    color: var(--text);
    margin-bottom: 2rem;
}

/* Footer */
footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem;
    margin-top: 3rem;
    text-align: center;
}

.footer-content {
    color: var(--text-muted);
    font-size: 0.85rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
}

.footer-content a {
    color: var(--accent);
    text-decoration: none;
}

/* Responsive */
@media (max-width: 1024px) {
    .detail-grid, .infra-grid {
        grid-template-columns: 1fr;
    }
}
