/* Go-Share — design tokens from spec §9 */
:root {
    --primary: #1E5F8C;
    --primary-light: #E8F1F8;
    --neutral-900: #1A1D21;
    --neutral-600: #5B6270;
    --neutral-200: #E4E7EB;
    --neutral-50: #F7F8FA;
    --success: #2E7D5B;
    --warning: #C97A1E;
    --danger: #C4423B;
    --info: #6B5FA8;
    --radius: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: var(--neutral-900);
    background: var(--neutral-50);
    line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 600; margin: 0 0 .5em; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
p { margin: 0 0 1em; }

/* ---- Layout ---- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 220px; flex-shrink: 0; background: #fff;
    border-right: 1px solid var(--neutral-200);
    display: flex; flex-direction: column; padding: 20px 12px;
    position: sticky; top: 0; height: 100vh;
}
.brand { padding: 4px 12px 20px; }
.brand img { display: block; width: 130px; height: auto; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--neutral-200); padding-top: 8px; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 6px; color: var(--neutral-600);
    font-weight: 500; border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--neutral-50); text-decoration: none; }
.nav-item.is-active { background: var(--primary-light); color: var(--primary); border-left-color: var(--primary); }
.nav-item.is-muted { opacity: .45; }
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    height: 56px; background: #fff; border-bottom: 1px solid var(--neutral-200);
    display: flex; align-items: center; justify-content: space-between; padding: 0 24px; gap: 12px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }

/* Hamburger menu toggle - hidden on desktop, shown under the mobile breakpoint */
.menu-toggle {
    display: none; align-items: center; justify-content: center; flex-shrink: 0;
    width: 36px; height: 36px; padding: 0; border: 1px solid var(--neutral-200);
    border-radius: 6px; background: #fff; cursor: pointer;
}
.menu-toggle .bars { position: relative; width: 18px; height: 14px; }
.menu-toggle .bars span {
    position: absolute; left: 0; width: 18px; height: 2px; background: var(--neutral-900);
    border-radius: 1px; transition: transform .15s ease, opacity .15s ease;
}
.menu-toggle .bars span:nth-child(1) { top: 0; }
.menu-toggle .bars span:nth-child(2) { top: 6px; }
.menu-toggle .bars span:nth-child(3) { top: 12px; }
body.nav-open .menu-toggle .bars span:nth-child(1) { top: 6px; transform: rotate(45deg); }
body.nav-open .menu-toggle .bars span:nth-child(2) { opacity: 0; }
body.nav-open .menu-toggle .bars span:nth-child(3) { top: 6px; transform: rotate(-45deg); }

.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(16, 24, 40, .45); z-index: 40; }
body.nav-open .sidebar-backdrop { display: block; }
.user-name { color: var(--neutral-600); font-weight: 500; }
.group-switch select, .filter-bar select, .filter-bar input, .form input, .form select, .form textarea {
    font: inherit; padding: 7px 10px; border: 1px solid var(--neutral-200);
    border-radius: 6px; background: #fff; color: var(--neutral-900);
}
.group-name { font-weight: 600; }
.content { padding: 24px; max-width: 1140px; width: 100%; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
    font: inherit; font-weight: 500; padding: 8px 14px; border-radius: 6px;
    border: 1px solid var(--primary); background: var(--primary); color: #fff;
}
.btn:hover { text-decoration: none; opacity: .93; }
.btn-secondary { background: #fff; color: var(--neutral-900); border-color: var(--neutral-200); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--neutral-600); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---- Cards ---- */
.card {
    background: #fff; border: 1px solid var(--neutral-200);
    border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.metric { text-align: left; }
.metric .value { font-size: 30px; font-weight: 600; color: var(--primary); }
.metric .label { color: var(--neutral-600); font-size: 13px; }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.muted { color: var(--neutral-600); }
.stack > * + * { margin-top: 16px; }

/* ---- Tables ---- */
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--neutral-200); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 12px 14px; height: 44px; border-bottom: 1px solid var(--neutral-200); }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--neutral-600); font-weight: 600; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--neutral-50); }
.table-wrap { overflow-x: auto; }

/* ---- Badges ---- */
.badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px;
    border-radius: 999px; font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .03em; background: var(--neutral-200); color: var(--neutral-600);
}
.badge.success { background: #E4F1EA; color: var(--success); }
.badge.warning { background: #FaeEDD; color: var(--warning); }
.badge.danger { background: #F8E3E2; color: var(--danger); }
.badge.info { background: #ECEAF5; color: var(--info); }
.badge.muted { background: var(--neutral-200); color: var(--neutral-600); }
.badge-shared { background: #ECEAF5; color: var(--info); text-transform: none; letter-spacing: 0; }
.crit-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.crit-dot.low { background: var(--neutral-600); }
.crit-dot.medium { background: var(--warning); }
.crit-dot.high, .crit-dot.critical { background: var(--danger); }
.crit-dot.urgent { background: var(--danger); }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--neutral-200); margin-bottom: 18px; }
.tabs a { padding: 10px 14px; color: var(--neutral-600); font-weight: 500; border-bottom: 2px solid transparent; }
.tabs a:hover { text-decoration: none; }
.tabs a.is-active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---- Forms ---- */
.form { max-width: 640px; }
.form .field { margin-bottom: 16px; }
.form label { display: block; font-weight: 500; margin-bottom: 5px; }
.form input, .form select, .form textarea { width: 100%; }
.form textarea { min-height: 120px; font-family: inherit; resize: vertical; }
.form .hint { color: var(--neutral-600); font-size: 12px; margin-top: 4px; }
.form .field-error { color: var(--danger); font-size: 12px; margin-top: 4px; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.req { color: var(--danger); }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---- Alerts ---- */
.alert { padding: 12px 14px; border-radius: 6px; margin-bottom: 16px; font-weight: 500; }
.alert-success { background: #E4F1EA; color: var(--success); }
.alert-danger { background: #F8E3E2; color: var(--danger); }

/* ---- Filter bar ---- */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filter-bar input[type=search] { min-width: 220px; }

/* ---- Auth ---- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--neutral-50); padding: 20px; }
.auth-card { background: #fff; border: 1px solid var(--neutral-200); border-radius: var(--radius); padding: 32px; width: 100%; max-width: 380px; box-shadow: var(--shadow); }
.auth-card .brand { text-align: center; padding-bottom: 8px; }
.auth-card .brand img { width: 190px; margin: 0 auto; }
.auth-card h1 { text-align: center; font-size: 18px; }

/* ---- Empty states ---- */
.empty { text-align: center; padding: 48px 24px; color: var(--neutral-600); }
.empty h2 { color: var(--neutral-900); }

.pill-list { display: flex; flex-wrap: wrap; gap: 6px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; }
.kv dt { color: var(--neutral-600); }
.kv dd { margin: 0; }

.article-body { max-width: 720px; }
.article-body h1 { font-size: 20px; margin-top: 1em; }
.article-body h2 { font-size: 16px; margin-top: 1em; }
.article-body code { background: var(--neutral-50); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--neutral-200); }
.article-body ul { padding-left: 20px; }
.article-body img { max-width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--neutral-200); margin: 10px 0; display: block; }

/* ---- Documentatie (onepager, Confluence-achtig) ---- */
.wiki { display: flex; gap: 20px; align-items: flex-start; }
.wiki-menu {
    width: 240px; flex-shrink: 0; background: #fff; border: 1px solid var(--neutral-200);
    border-radius: var(--radius); padding: 10px; position: sticky; top: 76px;
    max-height: calc(100vh - 100px); overflow-y: auto;
}
.wiki-menu-head { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--neutral-600); font-weight: 600; padding: 6px 8px; }
.wiki-menu-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; font-size: 13px; color: var(--neutral-900); }
.wiki-menu-item:hover { background: var(--neutral-50); text-decoration: none; }
.wiki-menu-item.is-active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.wiki-menu-item .has-doc-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); flex-shrink: 0; }
.wiki-page { flex: 1; min-width: 0; }
.wiki-body { display: flex; gap: 28px; align-items: flex-start; margin-top: 18px; }
.wiki-toc { width: 220px; flex-shrink: 0; position: sticky; top: 76px; }
.wiki-toc-head { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--neutral-600); font-weight: 600; margin-bottom: 8px; }
.wiki-toc a { display: block; padding: 3px 0; font-size: 13px; color: var(--neutral-600); border-left: 2px solid transparent; padding-left: 8px; }
.wiki-toc a:hover { color: var(--primary); text-decoration: none; }
.wiki-toc a.level-2 { padding-left: 20px; }
.wiki-toc a.level-3 { padding-left: 32px; }
.wiki-content { flex: 1; min-width: 0; max-width: none; }
.wiki-content:empty::before, .wiki-empty { color: var(--neutral-600); }

.doc-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 12px; }
.doc-gallery figure { margin: 0; border: 1px solid var(--neutral-200); border-radius: 6px; overflow: hidden; background: #fff; }
.doc-gallery img { width: 100%; height: 100px; object-fit: cover; display: block; }
.doc-gallery figcaption { padding: 6px 8px; font-size: 11px; color: var(--neutral-600); }
.doc-gallery .snippet { width: 100%; border: none; border-top: 1px solid var(--neutral-200); padding: 5px 8px; font-size: 11px; font-family: monospace; background: var(--neutral-50); color: var(--neutral-600); }

/* ---- Responsive: the sidebar becomes an off-canvas menu behind the hamburger button ---- */
@media (max-width: 860px) {
    .menu-toggle { display: inline-flex; }

    .sidebar {
        position: fixed; top: 0; left: 0; z-index: 50;
        width: 260px; max-width: 82vw; height: 100vh;
        transform: translateX(-100%); transition: transform .2s ease;
        box-shadow: 4px 0 16px rgba(16, 24, 40, .12);
    }
    body.nav-open .sidebar { transform: translateX(0); }
    body.nav-open { overflow: hidden; }

    .content { padding: 16px; }
    .topbar { padding: 0 12px; }
    .group-name { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; }

    .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .kv { grid-template-columns: 1fr; }
    .wiki, .wiki-body { flex-direction: column; }
    .wiki-menu, .wiki-toc { width: 100%; position: static; max-height: none; }
}

@media (max-width: 480px) {
    .user-name { display: none; }
}
