:root {
    --color-bg: #f8f9fa;
    --color-surface: #ffffff;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-text: #1a1a2e;
    --color-text-muted: #6b7280;
    --color-border: #e5e7eb;
    --color-danger: #dc2626;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.1);
}

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

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
}

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

a:hover {
    text-decoration: underline;
}

/* Nav */
nav {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    height: 56px;
}

nav .logo {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--color-text);
}

nav .spacer {
    flex: 1;
}

/* Main layout */
main {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

/* Login page */
.login-page {
    max-width: 400px;
    margin: 6rem auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.login-page h1 {
    font-size: 2rem;
}

/* Buttons */
.btn-primary {
    display: inline-block;
    background: var(--color-primary);
    color: #fff;
    padding: 0.6rem 1.4rem;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s;
}

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

.btn-secondary {
    display: inline-block;
    background: transparent;
    color: var(--color-text);
    padding: 0.6rem 1.4rem;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    transition: border-color 0.15s;
}

.btn-secondary:hover {
    border-color: var(--color-text-muted);
    text-decoration: none;
}

/* Card grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: box-shadow 0.15s;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}

.card h2 {
    font-size: 1.05rem;
    font-weight: 600;
}

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

/* Glossary layout */
.glossary-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
    align-items: start;
    height: calc(100vh - 5rem);
}

.glossary-sidebar {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

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

.sidebar-pkg {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.15rem;
}

.sidebar-iri {
    font-size: 0.75rem;
    color: #6b7280;
    margin: 0 0 0.5rem;
    word-break: break-all;
}

.sidebar-section {
    flex-shrink: 0;
}

.sidebar-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7280;
    margin: 0.5rem 0 0.25rem;
}

.sidebar-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    color: var(--color-text);
}

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

.sidebar-item.active {
    background: var(--color-primary);
    color: #fff;
}

.sidebar-item.active .badge-enum {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

.glossary-right {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 0;
    overflow-y: auto;
}

.glossary-detail {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    flex: 1;
    min-height: 300px;
    overflow-y: auto;
}

.detail-empty {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
}

.detail-content {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.loading {
    padding: 2rem;
    color: #6b7280;
    text-align: center;
}

/* Publish panel */
.publish-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.publish-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.publish-panel-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.pub-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pub-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.pub-slug {
    flex: 1;
    font-family: monospace;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pub-date {
    color: #6b7280;
    font-size: 0.8rem;
    white-space: nowrap;
}

.btn-sm {
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
}

.error-msg {
    color: #dc2626;
    font-size: 0.875rem;
}

/* Public banner */
.public-banner {
    background: #fef9c3;
    border: 1px solid #fde68a;
    border-radius: var(--radius);
    padding: 0.6rem 1rem;
    font-size: 0.875rem;
    color: #92400e;
    margin-bottom: 1.25rem;
}

/* Responsive */
@media (max-width: 700px) {
    .glossary-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .glossary-sidebar {
        height: auto;
        max-height: 220px;
    }

    .glossary-right {
        overflow-y: visible;
    }

    .glossary-detail {
        height: auto;
        min-height: 200px;
    }

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

    nav {
        padding: 0.75rem 1rem;
    }

    .pub-row {
        flex-wrap: wrap;
    }

    .pub-slug {
        width: 100%;
    }
}
