* {
    box-sizing: border-box;
}

body {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    min-height: 100vh;
}

.login-screen {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.login-box {
    background: #0f172a;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    display: grid;
    gap: 14px;
    max-width: 380px;
    padding: 28px;
    width: 100%;
}

.login-box h1 {
    font-size: 28px;
}

.login-box input {
    background: #020617;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 8px;
    color: #f8fafc;
    padding: 12px;
    width: 100%;
}

.login-box p {
    color: #fca5a5;
    margin: 0;
}

.sidebar {
    border-right: 1px solid rgba(148, 163, 184, 0.18);
    background: #0f172a;
    padding: 24px;
}

.brand {
    align-items: center;
    display: flex;
    font-size: 20px;
    font-weight: 800;
    gap: 12px;
    margin-bottom: 24px;
}

.brand-mark {
    align-items: center;
    background: #14b8a6;
    border-radius: 8px;
    color: #042f2e;
    display: inline-flex;
    font-weight: 900;
    height: 36px;
    justify-content: center;
    width: 36px;
}

.search-form {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
}

.search-form input,
.title-input,
.editor textarea {
    background: #020617;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 8px;
    color: #f8fafc;
    outline: none;
    width: 100%;
}

.search-form input {
    padding: 12px;
}

button,
.button,
.search-form button,
.nav-actions a {
    background: #f8fafc;
    border: 0;
    border-radius: 8px;
    color: #0f172a;
    cursor: pointer;
    display: inline-flex;
    font-weight: 800;
    justify-content: center;
    padding: 10px 14px;
}

.nav-actions {
    display: grid;
    gap: 8px;
    margin-bottom: 28px;
}

.nav-actions a {
    background: rgba(20, 184, 166, 0.13);
    color: #ccfbf1;
}

.side-section h2,
.detail-grid h2 {
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0;
    margin: 0 0 10px;
    text-transform: uppercase;
}

.tag-cloud,
.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-cloud a,
.pill-row a,
.tag-link {
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.25);
    border-radius: 999px;
    color: #fde68a;
    display: inline-flex;
    gap: 6px;
    padding: 5px 9px;
}

.tag-cloud span {
    color: #f8fafc;
}

.main-pane {
    background: #111827;
    min-width: 0;
    padding: 32px;
}

.topbar {
    align-items: flex-start;
    display: flex;
    gap: 20px;
    justify-content: space-between;
    margin-bottom: 26px;
}

.eyebrow {
    color: #5eead4;
    font-size: 13px;
    font-weight: 800;
    margin: 0 0 6px;
    text-transform: uppercase;
}

h1 {
    font-size: 34px;
    font-weight: 850;
    line-height: 1.1;
    margin: 0;
}

.graph-controls {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    max-width: 620px;
}

.graph-controls button {
    background: rgba(20, 184, 166, 0.14);
    border: 1px solid rgba(94, 234, 212, 0.28);
    color: #ccfbf1;
    min-height: 40px;
}

.graph-controls label {
    align-items: center;
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    color: #cbd5e1;
    display: inline-flex;
    font-size: 13px;
    font-weight: 800;
    gap: 8px;
    min-height: 40px;
    padding: 8px 10px;
}

.graph-controls input[type="range"] {
    accent-color: #14b8a6;
    width: 110px;
}

.note-list {
    display: grid;
    gap: 10px;
}

.note-card,
.empty-state,
.detail-grid section {
    background: rgba(15, 23, 42, 0.78);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
}

.note-card {
    align-items: center;
    display: flex;
    justify-content: space-between;
    min-height: 62px;
    padding: 16px;
}

.note-card span {
    font-weight: 750;
}

.note-card small {
    color: #94a3b8;
}

.empty-state {
    padding: 28px;
}

.empty-state h2 {
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 8px;
}

.empty-state p {
    color: #cbd5e1;
    margin: 0 0 18px;
}

.editor {
    display: grid;
    gap: 14px;
}

.title-input {
    font-size: 28px;
    font-weight: 850;
    padding: 14px 16px;
}

.editor textarea {
    font-family: "Cascadia Code", Consolas, monospace;
    min-height: 58vh;
    padding: 18px;
    resize: vertical;
}

.textarea-wrap {
    position: relative;
}

.link-suggest {
    background: #020617;
    border: 1px solid rgba(94, 234, 212, 0.34);
    border-radius: 8px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
    display: grid;
    left: 16px;
    max-height: 260px;
    overflow: auto;
    padding: 6px;
    position: absolute;
    right: 16px;
    top: 54px;
    z-index: 10;
}

.link-suggest button {
    background: transparent;
    color: #e2e8f0;
    display: block;
    font-weight: 700;
    justify-content: flex-start;
    padding: 9px 10px;
    text-align: left;
    width: 100%;
}

.link-suggest button:hover,
.link-suggest button.is-active {
    background: rgba(20, 184, 166, 0.16);
    color: #ccfbf1;
}

.editor-bar,
.mini-upload {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
}

.editor-bar label {
    color: #cbd5e1;
}

.note-view {
    margin: 0 auto;
    max-width: 1050px;
}

.rendered {
    color: #e2e8f0;
    font-size: 17px;
    line-height: 1.72;
    margin-bottom: 22px;
}

.rendered h1,
.rendered h2,
.rendered h3 {
    color: #f8fafc;
    font-weight: 850;
    margin: 22px 0 10px;
}

.rendered h1 {
    font-size: 30px;
}

.rendered h2 {
    font-size: 24px;
}

.rendered h3 {
    font-size: 19px;
}

.rendered p {
    margin: 0 0 14px;
}

.wiki-link {
    color: #67e8f9;
    font-weight: 750;
}

.detail-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 28px;
}

.detail-grid section {
    min-height: 160px;
    padding: 16px;
}

.list-link {
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    color: #f8fafc;
    display: block;
    padding: 9px 0;
}

.mini-upload {
    margin-top: 12px;
}

.mini-upload input {
    max-width: 100%;
}

#graph {
    background: #020617;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    height: calc(100vh - 140px);
    min-height: 520px;
    overflow: hidden;
    position: relative;
}

#graph canvas {
    display: block;
}

@media (max-width: 860px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-bottom: 1px solid rgba(148, 163, 184, 0.18);
        border-right: 0;
    }

    .main-pane {
        padding: 20px;
    }

    .topbar {
        display: grid;
    }

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

    h1 {
        font-size: 28px;
    }
}
