:root {
    color-scheme: light;
    --kb-bg: #f3f6fb;
    --kb-surface: rgba(255,255,255,0.9);
    --kb-surface-strong: #ffffff;
    --kb-border: #a9bcd4;
    --kb-text: #1c2430;
    --kb-muted: #5d6b7a;
    --kb-primary: #123a5b;
    --kb-primary-strong: #0d2d46;
    --kb-accent: #2f7ad5;
    --kb-accent-soft: #eaf3ff;
    --kb-success: #1f7a59;
    --kb-danger: #b63d3d;
    --kb-shadow: 0 16px 38px rgba(15, 34, 56, 0.10);
}

html {
    scroll-behavior: smooth;
}

body {
    background:
        radial-gradient(circle at top left, rgba(47,122,213,0.08), transparent 28%),
        linear-gradient(180deg, #eef4fb 0%, #f8fafc 100%);
    color: var(--kb-text);
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
}

img {
    max-width: 100%;
}

p {
    margin-bottom: 0.75rem;
}

.container-fluid {
    padding-left: 0;
    padding-right: 0;
}

.kb-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 120px;
}

.kb-page {
    flex: 1 0 auto;
}

.kb-header {
    background: linear-gradient(180deg, rgba(12, 29, 43, 0.98), rgba(18, 58, 91, 0.96));
    border-bottom: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 8px 24px rgba(9, 26, 42, 0.10);
}

.kb-nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.9rem 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
}

.kb-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.82rem;
}

.kb-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, #eaf3ff, #bcd7ff);
    color: var(--kb-primary-strong);
    font-weight: 800;
    font-size: 1.05rem;
}

.kb-nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-left: auto;
}

.kb-nav-links a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.kb-nav-links a:hover {
    color: #fff;
}

.kb-user-chip {
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.05);
    color: #fff;
    border-radius: 999px;
    padding: 0.45rem 0.85rem;
    font-size: 0.82rem;
    line-height: 1.3;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: center;
}

.kb-user-menu .kb-user-chip {
    cursor: pointer;
}

.kb-user-menu .dropdown-menu {
    min-width: 180px;
}

.kb-user-menu .dropdown-menu a.dropdown-item,
.kb-user-menu .dropdown-menu button.dropdown-item {
    color: var(--kb-text);
}

.kb-user-menu .dropdown-menu a.dropdown-item:hover,
.kb-user-menu .dropdown-menu button.dropdown-item:hover {
    color: var(--kb-text);
}

@media (max-width: 640px) {
    .kb-nav {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .kb-brand {
        width: 100%;
        justify-content: center;
    }

    .kb-nav-links {
        width: 100%;
        margin-left: 0;
        justify-content: center;
        gap: 0.65rem 0.9rem;
    }

    .kb-user-chip {
        width: 100%;
    }
}

.kb-page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 2.5rem 1.25rem 0;
}

.kb-messages {
    margin-bottom: 1.25rem;
}

.kb-alert {
    border-radius: 1rem;
    border: 1px solid var(--kb-border);
}

.kb-hero {
    background: linear-gradient(135deg, rgba(18,58,91,0.96), rgba(44,109,170,0.93));
    border-radius: 1.5rem;
    box-shadow: var(--kb-shadow);
    padding: 2.2rem 2rem;
    color: #fff;
    margin-bottom: 2rem;
}

.kb-hero h1 {
    font-size: clamp(2rem, 4vw, 3.2rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    margin-bottom: 0.65rem;
}

.kb-hero p {
    font-size: 1.05rem;
    max-width: 42rem;
    color: rgba(255,255,255,0.8);
    margin-bottom: 0;
}

.kb-section {
    background: rgba(255,255,255,0.8);
    border: 1px solid var(--kb-border);
    border-radius: 1.25rem;
    box-shadow: 0 10px 28px rgba(15, 34, 56, 0.05);
    padding: 1.5rem;
}

.kb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.1rem;
}

.kb-card {
    background: var(--kb-surface-strong);
    border: 1px solid var(--kb-border);
    border-radius: 1rem;
    padding: 1.2rem 1.1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 160px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kb-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(15, 34, 56, 0.08);
}

.kb-card h2 {
    font-size: 1.15rem;
    margin-bottom: 0.3rem;
    font-weight: 700;
}

.kb-card a {
    color: var(--kb-primary-strong);
    text-decoration: none;
}

.kb-card p {
    color: var(--kb-muted);
    margin-bottom: 0;
}

.kb-card-link {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 0.3rem;
    color: inherit;
}

.kb-card-link:hover h2 {
    text-decoration: underline;
}

.kb-card-add-btn {
    width: 100%;
    justify-content: center;
}

.kb-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 0.38rem 0.7rem;
    border-radius: 999px;
    background: var(--kb-accent-soft);
    color: var(--kb-primary-strong);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.kb-breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    font-size: 0.9rem;
    color: var(--kb-muted);
    margin-bottom: 1rem;
}

.kb-breadcrumbs a {
    color: var(--kb-primary-strong);
    text-decoration: none;
    font-weight: 600;
}

.kb-header-row {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.2rem;
    flex-wrap: wrap;
}

.kb-header-row h1 {
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.kb-inline-form {
    margin: 0;
}


.kb-action-bar {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin: 1.2rem 0 1.5rem;
}

.kb-modal .modal-content {
    border-radius: 1.25rem;
    border: 1px solid var(--kb-border);
    box-shadow: 0 12px 30px rgba(15, 34, 56, 0.12);
}

.kb-modal .modal-header,
.kb-modal .modal-footer {
    border-color: var(--kb-border);
}

.kb-modal .modal-title {
    font-weight: 700;
    color: var(--kb-primary-strong);
}

.kb-modal .modal-body {
    color: var(--kb-muted);
}

.kb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    padding: 0.72rem 1.2rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.kb-btn:hover {
    transform: translateY(-1px);
    opacity: 0.97;
}

.kb-btn-primary {
    background: linear-gradient(135deg, var(--kb-primary), var(--kb-accent));
    color: #fff;
}

.kb-btn-secondary {
    background: #fff;
    border: 1.5px solid var(--kb-border);
    color: var(--kb-primary-strong);
}

.kb-btn-danger {
    background: var(--kb-danger);
    color: #fff;
}

.kb-article-list {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

.kb-article-card {
    background: rgba(255,255,255,0.9);
    border: 1px solid var(--kb-border);
    border-radius: 1rem;
    padding: 1.25rem 1.2rem;
    box-shadow: 0 10px 26px rgba(15, 34, 56, 0.04);
}

.kb-article-card h2 {
    margin-bottom: 0.5rem;
    font-size: 1.45rem;
    font-weight: 700;
}

.kb-article-card h2 a {
    color: var(--kb-primary-strong);
    text-decoration: none;
}

.kb-meta {
    color: var(--kb-muted);
    font-size: 0.92rem;
    margin-bottom: 0.6rem;
}

.kb-content {
    background: #ffffff;
    border: 1px solid var(--kb-border);
    border-radius: 1rem;
    padding: 1.5rem;
    line-height: 1.8;
    font-size: 1.02rem;
    color: #263544;
}

.kb-content h1 {
    font-size: clamp(2rem, 3vw, 2.8rem);
    margin-bottom: 1rem;
    letter-spacing: -0.04em;
}

.kb-panel {
    background: rgba(255,255,255,0.92);
    border: 1px solid var(--kb-border);
    border-radius: 1.25rem;
    padding: 1.8rem;
    box-shadow: 0 12px 30px rgba(15, 34, 56, 0.04);
}

.kb-form {
    max-width: 780px;
    margin: 0 auto;
}

.kb-markdown-layout {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}

.kb-markdown-main {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
}

.kb-toastui-editor {
    margin-top: 0.5rem;
}

#id_content {
    display: none;
}

.form-control,
.form-select,
textarea {
    color: var(--kb-text) !important;
    background-color: #ffffff !important;
    border-radius: 0.8rem !important;
    border: 1px solid var(--kb-border) !important;
    box-shadow: none !important;
    padding: 0.8rem 0.9rem !important;
}

.form-control:focus,
.form-select:focus,
textarea:focus {
    border-color: var(--kb-accent) !important;
    box-shadow: 0 0 0 0.2rem rgba(47,122,213,0.14) !important;
}

.kb-auth {
    max-width: 520px;
    margin: 3rem auto 0;
    background: rgba(255,255,255,0.9);
    border: 1px solid var(--kb-border);
    border-radius: 1.4rem;
    box-shadow: var(--kb-shadow);
    padding: 2rem;
}

.kb-auth h1,
.kb-auth h2,
.kb-auth h3 {
    margin-bottom: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.kb-auth .btn,
.kb-panel .btn {
    border-radius: 0.8rem;
    padding: 0.72rem 1.1rem;
    font-weight: 600;
}

.kb-auth a,
.kb-panel a {
    color: var(--kb-primary-strong);
    text-decoration: none;
}

.kb-alert {
    border-radius: 0.85rem;
    border: 1px solid rgba(18,58,91,0.1);
    background: #f2f8ff;
    color: var(--kb-primary-strong);
}

.kb-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(11,22,33,0.96);
    border-top: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.8);
    font-size: 0.82rem;
    padding: 0.9rem 1rem;
}

.kb-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .kb-shell {
        min-height: auto;
        padding-bottom: 0;
    }

    .kb-markdown-layout {
        display: block;
    }

    .kb-side-note {
        width: 100%;
        margin-top: 1rem;
        margin-left: 0;
    }

    .kb-hero {
        padding: 1.4rem 1.1rem;
    }

    .kb-page {
        padding-top: 1.4rem;
    }

    .kb-auth {
        margin-top: 1.4rem;
        padding: 1.2rem;
    }

    .kb-footer {
        position: static;
        margin-top: 2rem;
    }
}