/* filename: static/css/base.css */

:root {
    --bg: #edf3fb;
    --surface: #ffffff;
    --surface-soft: #f6f9fe;

    --sidebar: #0b2f57;
    --sidebar-soft: #133d6b;
    --sidebar-active: #2f86f6;

    --border: #d7e3f3;
    --text: #1b2436;
    --text-soft: #6c7b92;

    --primary: #2f86f6;
    --primary-dark: #1f73de;
    --primary-soft: #e8f2ff;

    --shadow: 0 18px 42px rgba(25, 42, 70, 0.08);

    --radius-lg: 18px;
    --radius-xl: 24px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
    font-size: 16px;
    line-height: 1.65;
}

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

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

.sidebar {
    background: linear-gradient(180deg, var(--sidebar) 0%, #082746 100%);
    color: white;
    padding: 28px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    min-height: 100vh;
    position: sticky;
    top: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 6px 8px;
}

.sidebar-logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 18px;
}

.sidebar-title {
    font-size: 20px;
    font-weight: 900;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.sidebar-subtitle {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.72);
    margin-top: 4px;
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.sidebar-link {
    min-height: 52px;
    border-radius: 16px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.88);
    font-weight: 700;
    transition: 0.18s ease;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.sidebar-link.active {
    background: var(--sidebar-active);
    color: white;
    box-shadow: 0 10px 22px rgba(47, 134, 246, 0.24);
}

.sidebar-icon {
    width: 20px;
    text-align: center;
    opacity: 0.95;
}

.sidebar-new-badge {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: #ef4444;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    flex-shrink: 0;
}

.sidebar-quota-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.65);
    white-space: nowrap;
}

.sidebar-quota-badge.sidebar-quota-empty {
    color: rgba(255, 160, 160, 0.85);
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-user-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.68);
    margin-bottom: 6px;
}

.sidebar-user-name {
    font-size: 15px;
    font-weight: 800;
}

.main-shell {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    min-height: 76px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-page-title {
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-user {
    color: var(--text-soft);
    font-size: 14px;
    margin-right: 4px;
}

.topbar-link {
    min-height: 42px;
    padding: 0 14px;
    border-radius: 999px;
    background: white;
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

.page {
    max-width: 1480px;
    width: 100%;
    padding: 28px;
}

.page-header {
    margin-bottom: 28px;
}

.page-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}

.page-title {
    margin: 0 0 10px;
    font-size: 38px;
    line-height: 1.08;
    letter-spacing: -0.04em;
    font-weight: 900;
}

.page-subtitle {
    margin: 0;
    color: var(--text-soft);
    font-size: 18px;
    line-height: 1.7;
}

.card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.card-header {
    padding: 28px 28px 0;
}

.card-title {
    margin: 0;
    font-size: 24px;
    line-height: 1.15;
    font-weight: 900;
}

.card-subtitle {
    margin-top: 8px;
    font-size: 15px;
    color: var(--text-soft);
}

.card-body {
    padding: 28px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    padding: 0 22px;
    border: 0;
    border-radius: 18px;
    font-size: 15px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: 0.18s ease;
    box-sizing: border-box;
}

.button-primary {
    background: linear-gradient(180deg, #4394ff 0%, var(--primary) 100%);
    color: white;
    box-shadow: 0 10px 22px rgba(47, 134, 246, 0.24);
}

.button-primary:hover {
    background: linear-gradient(180deg, #2f86f6 0%, var(--primary-dark) 100%);
}

.button-secondary {
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
}

.input,
select,
textarea {
    width: 100%;
    min-height: 56px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: white;
    padding: 15px 18px;
    font-size: 16px;
    color: var(--text);
    outline: none;
    font-family: inherit;
}

textarea {
    min-height: 140px;
    resize: vertical;
}

.input:focus,
select:focus,
textarea:focus {
    border-color: #b8cff6;
    box-shadow: 0 0 0 4px rgba(47, 134, 246, 0.08);
}

.toolbar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.grid {
    display: grid;
    gap: 20px;
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.two-col {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.85fr);
    gap: 20px;
}

.stack {
    display: grid;
    gap: 20px;
}

.summary-box {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 22px;
}

.summary-title {
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 10px;
}

.empty-box {
    padding: 18px;
    border-radius: 16px;
    background: #f7fbff;
    border: 1px dashed #cfe0f7;
    color: var(--text-soft);
}

.section-gap {
    margin-bottom: 20px;
}

.section-inner-gap {
    margin-bottom: 16px;
}

.muted {
    color: var(--text-soft);
}

.preserve-line {
    white-space: pre-line;
}

.message-stack {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
}

.flash-message {
    padding: 14px 16px;
    background: #eff8ff;
    border: 1px solid #d4e8ff;
    border-radius: 14px;
    color: #215c9f;
    font-weight: 700;
}



.badge-source {
    display: inline-block;
    margin-left: 8px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #eef4ff;
    color: #3f6fd8;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.badge-source:hover {
    background: #dfeaff;
    color: #275ac4;
}

.badge-uncertain-date {
    display: inline-block;
    margin-left: 8px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #fff4e5;
    color: #b86900;
    font-size: 12px;
    font-weight: 700;
}

.section-item-warning {
    background: #fffdf7;
    border-color: #f4dfb8;
}


.badge-date-only {
    display: inline-block;
    margin-left: 8px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #edf7ed;
    color: #22733a;
    font-size: 12px;
    font-weight: 700;
}

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

    .sidebar {
        position: relative;
        min-height: auto;
    }

    .grid-4,
    .two-col {
        grid-template-columns: 1fr;
    }
}
