:root {
    --bg: #f4f1ea;
    --surface: #ffffff;
    --surface-muted: #f7f4ef;
    --line: #ded6ca;
    --text: #1e1c19;
    --muted: #6a645d;
    --primary: #0f4c5c;
    --primary-dark: #08323c;
    --accent: #c17c5e;
    --success: #357266;
    --warning: #b07a2a;
    --danger: #9d3d3d;
    --shadow: 0 18px 40px rgba(15, 76, 92, 0.08);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
    background:
        radial-gradient(circle at top right, rgba(193, 124, 94, 0.18), transparent 22rem),
        linear-gradient(180deg, #f6f2ea 0%, var(--bg) 100%);
    color: var(--text);
}

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

a:hover {
    text-decoration: underline;
}

.container {
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(12px);
    background: rgba(244, 241, 234, 0.92);
    border-bottom: 1px solid rgba(15, 76, 92, 0.08);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    min-height: 72px;
}

.brand {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.9rem;
}

.nav-user {
    color: var(--muted);
    font-size: 0.95rem;
}

.logout-form {
    margin: 0;
}

.page {
    padding: 2rem 0 4rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.eyebrow {
    margin: 0 0 0.35rem;
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

h1,
h2,
h3,
h4 {
    margin: 0;
}

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

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

.card {
    padding: 1.3rem;
    margin-bottom: 1rem;
}

.narrow-card {
    max-width: 520px;
    margin: 3rem auto;
}

.auth-layout {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 1.25rem;
    min-height: calc(100vh - 12rem);
    align-items: center;
}

.auth-copy h1 {
    font-size: clamp(2rem, 3vw, 3rem);
    margin-bottom: 0.7rem;
}

.auth-card {
    padding: 1.5rem;
}

.auth-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 1rem;
}

.stack-form,
.inline-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.inline-form {
    flex-direction: row;
    align-items: end;
    flex-wrap: wrap;
}

label {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    font-weight: 600;
}

input,
textarea,
select,
button {
    font: inherit;
}

input,
textarea,
select {
    width: 100%;
    padding: 0.85rem 0.95rem;
    border-radius: 12px;
    border: 1px solid #ccc3b7;
    background: #fcfbf8;
}

textarea {
    resize: vertical;
}

.field-help {
    margin: -0.45rem 0 0;
    font-size: 0.9rem;
    color: var(--muted);
}

.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.45rem;
    padding: 0.85rem 1.2rem;
    border: 0;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.button:hover {
    background: var(--primary-dark);
    text-decoration: none;
}

.button-ghost {
    background: transparent;
    color: var(--primary);
    border: 1px solid rgba(15, 76, 92, 0.24);
}

.button-ghost:hover {
    background: rgba(15, 76, 92, 0.06);
}

.action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.metric-card {
    background: linear-gradient(180deg, #fff 0%, #fbf8f4 100%);
}

.metric-label {
    margin: 0 0 0.45rem;
    color: var(--muted);
}

.metric-card strong {
    font-size: 2rem;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-subtitle {
    margin: 0.35rem 0 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.two-column {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.table-wrap,
.diff-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.85rem 0.7rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.92rem;
}

.text-link {
    font-weight: 700;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    font-size: 0.86rem;
    font-weight: 700;
}

.status-submitted {
    background: rgba(15, 76, 92, 0.12);
    color: var(--primary);
}

.status-reviewing {
    background: rgba(176, 122, 42, 0.14);
    color: var(--warning);
}

.status-completed {
    background: rgba(53, 114, 102, 0.14);
    color: var(--success);
}

.status-revision-requested {
    background: rgba(157, 61, 61, 0.12);
    color: var(--danger);
}

.detail-grid {
    align-items: start;
}

.version-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.version-card {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(180deg, #fff 0%, #fbf8f4 100%);
}

.version-card-current {
    border-color: rgba(15, 76, 92, 0.38);
    box-shadow: inset 4px 0 0 var(--primary);
}

.version-header,
.version-actions,
.badge-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.7rem;
}

.version-header {
    justify-content: space-between;
    margin-bottom: 0.9rem;
}

.version-header .muted {
    margin: 0.25rem 0 0;
}

.meta-grid {
    display: grid;
    grid-template-columns: 7rem minmax(0, 1fr);
    gap: 0.5rem 0.8rem;
    padding: 0.9rem;
    border-radius: 14px;
    background: var(--surface-muted);
}

.meta-grid span {
    color: var(--muted);
}

.meta-grid strong {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.pill {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    background: rgba(106, 100, 93, 0.12);
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.pill-primary {
    background: rgba(15, 76, 92, 0.12);
    color: var(--primary);
}

.version-actions {
    justify-content: flex-end;
    margin-top: 0.8rem;
}

.version-comments,
.document-comments {
    margin-top: 1rem;
}

.version-comments h4,
.document-comments h3 {
    margin-bottom: 0.7rem;
    font-size: 1rem;
}

.comment-list.compact {
    gap: 0.65rem;
}

.compact-empty {
    padding: 0.8rem;
    font-size: 0.92rem;
}

.latest-summary {
    margin-bottom: 1rem;
    padding: 0.9rem;
    border-radius: 14px;
    background: var(--surface-muted);
}

.latest-summary p {
    margin: 0.6rem 0 0;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.comment-item {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-muted);
}

.comment-item p {
    margin: 0.65rem 0 0;
    white-space: pre-wrap;
}

.comment-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    color: var(--muted);
    font-size: 0.92rem;
}

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

.timeline li {
    padding-left: 1rem;
    border-left: 3px solid rgba(15, 76, 92, 0.18);
}

.timeline p {
    margin: 0.45rem 0 0;
}

.alert {
    margin-bottom: 1rem;
    padding: 0.95rem 1rem;
    border-radius: 14px;
    border: 1px solid transparent;
}

.alert-info {
    background: rgba(15, 76, 92, 0.08);
    border-color: rgba(15, 76, 92, 0.14);
    color: var(--primary);
}

.alert-success {
    background: rgba(53, 114, 102, 0.1);
    border-color: rgba(53, 114, 102, 0.18);
    color: var(--success);
}

.alert-danger {
    background: rgba(157, 61, 61, 0.08);
    border-color: rgba(157, 61, 61, 0.16);
    color: var(--danger);
}

.empty-state {
    margin: 0;
    padding: 1rem;
    border-radius: 14px;
    background: var(--surface-muted);
    color: var(--muted);
}

.diff {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.diff_header {
    background: rgba(15, 76, 92, 0.1);
}

.diff_next {
    background: #f4efe7;
}

.diff_add {
    background: rgba(53, 114, 102, 0.18);
}

.diff_chg {
    background: rgba(176, 122, 42, 0.18);
}

.diff_sub {
    background: rgba(157, 61, 61, 0.18);
}

@media (max-width: 920px) {
    .auth-layout,
    .two-column,
    .card-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        align-items: start;
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    .container {
        width: min(100% - 1rem, 1120px);
    }

    .header-inner {
        align-items: start;
        flex-direction: column;
        padding: 0.85rem 0;
    }

    .nav {
        width: 100%;
    }

    .card,
    .auth-card {
        padding: 1rem;
    }

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