:root {
    --bg: #f5f7fa;
    --panel: #ffffff;
    --text: #172033;
    --muted: #667085;
    --line: #dde3ea;
    --accent: #176b87;
    --accent-strong: #0f5067;
    --danger: #b42318;
    --ok: #067647;
    --warn: #b54708;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    font-family: Arial, "Noto Sans KR", sans-serif;
}

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

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

.sidebar {
    background: #101828;
    color: #fff;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
}

.brand {
    display: grid;
    gap: 4px;
    padding-bottom: 22px;
    border-bottom: 1px solid rgba(255,255,255,.14);
}

.brand span {
    color: #cbd5e1;
    font-size: 13px;
}

nav {
    display: grid;
    gap: 6px;
    margin-top: 22px;
}

nav a {
    color: #d0d5dd;
    padding: 11px 12px;
    border-radius: 7px;
}

nav a.active,
nav a:hover {
    color: #fff;
    background: rgba(255,255,255,.12);
}

.logout-form {
    margin-top: auto;
    padding-top: 20px;
}

.logout-form button {
    width: 100%;
    min-height: 40px;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 7px;
    background: transparent;
    color: #d0d5dd;
    cursor: pointer;
}

.main {
    padding: 28px;
    min-width: 0;
}

.topbar,
.panel-head,
.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.topbar {
    margin-bottom: 22px;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: 26px;
}

h2 {
    font-size: 18px;
}

.topbar p {
    margin-top: 5px;
    color: var(--muted);
}

.primary,
button.primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border: 0;
    border-radius: 7px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
}

.primary.large {
    min-height: 48px;
    padding: 0 20px;
    font-weight: 700;
}

.primary:hover,
button.primary:hover {
    background: var(--accent-strong);
    color: #fff;
}

.notice,
.alert {
    padding: 12px 14px;
    border-radius: 7px;
    margin-bottom: 16px;
}

.notice {
    background: #ecfdf3;
    color: var(--ok);
}

.alert {
    background: #fef3f2;
    color: var(--danger);
}

.metrics {
    display: grid;
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metrics div,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.metrics div {
    padding: 16px;
    display: grid;
    gap: 8px;
}

.metrics span {
    color: var(--muted);
    font-size: 13px;
}

.metrics strong {
    font-size: 28px;
}

.panel {
    padding: 18px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
}

th {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

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

.actions form {
    margin: 0;
}

.actions button {
    border: 0;
    background: transparent;
    color: var(--danger);
    cursor: pointer;
    padding: 0;
}

.empty {
    color: var(--muted);
    text-align: center;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    background: #eef2f6;
    color: #344054;
    font-size: 12px;
    font-weight: 700;
}

.status-sent,
.status-received {
    background: #ecfdf3;
    color: var(--ok);
}

.status-failed {
    background: #fef3f2;
    color: var(--danger);
}

.status-queued,
.status-sending {
    background: #fffaeb;
    color: var(--warn);
}

.form {
    display: grid;
    gap: 16px;
}

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

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 10px 11px;
    color: var(--text);
    background: #fff;
}

.detail dl {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 13px 18px;
    margin: 0;
}

.detail dt {
    color: var(--muted);
    font-weight: 700;
}

.detail dd {
    margin: 0;
}

.error-text {
    color: var(--danger);
    white-space: pre-wrap;
}

.terminal {
    background: #101828;
    color: #d1fadf;
    border-radius: 8px;
    padding: 16px;
    overflow: auto;
    min-height: 180px;
}

.welcome-page,
.login-page {
    display: block;
    background:
        linear-gradient(135deg, rgba(23,107,135,.12), transparent 38%),
        linear-gradient(160deg, #f7fafc 0%, #eef4f7 100%);
}

.welcome-shell {
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
    min-height: 100vh;
    padding: 26px 0 34px;
}

.welcome-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0;
}

.welcome-logo {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    color: var(--text);
}

.welcome-logo span {
    font-weight: 700;
    color: var(--accent);
}

.welcome-logo strong {
    font-size: 24px;
}

.ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 15px;
    border: 1px solid rgba(23,107,135,.28);
    border-radius: 7px;
    color: var(--accent);
    background: rgba(255,255,255,.62);
}

.welcome-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.02fr) minmax(360px, .98fr);
    gap: 42px;
    align-items: center;
    min-height: calc(100vh - 190px);
    padding: 58px 0 30px;
}

.hero-copy {
    display: grid;
    gap: 22px;
}

.eyebrow {
    color: var(--accent);
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
}

.hero-copy h1 {
    max-width: 720px;
    font-size: 58px;
    line-height: 1.05;
}

.hero-copy p {
    max-width: 620px;
    color: #475467;
    font-size: 19px;
    line-height: 1.75;
}

.hero-panel {
    position: relative;
    min-height: 520px;
    border: 1px solid rgba(23,107,135,.18);
    border-radius: 8px;
    background: rgba(255,255,255,.74);
    box-shadow: 0 24px 70px rgba(16,24,40,.12);
    padding: 24px;
    overflow: hidden;
}

.signal-card {
    display: grid;
    gap: 8px;
    border-radius: 8px;
    background: #101828;
    color: #fff;
    padding: 20px;
}

.signal-card span {
    color: #cbd5e1;
    font-size: 13px;
}

.signal-card strong {
    font-size: 26px;
}

.paper-stack {
    position: relative;
    height: 230px;
    margin: 28px 18px 20px;
}

.paper-stack div {
    position: absolute;
    inset: 0;
    border: 1px solid #d9e2ea;
    border-radius: 7px;
    background:
        linear-gradient(#eef4f7 0 0) 28px 46px / 70% 10px no-repeat,
        linear-gradient(#eef4f7 0 0) 28px 78px / 58% 10px no-repeat,
        linear-gradient(#eef4f7 0 0) 28px 110px / 66% 10px no-repeat,
        #fff;
    box-shadow: 0 14px 35px rgba(16,24,40,.12);
}

.paper-stack div:nth-child(1) {
    transform: rotate(-8deg) translate(-18px, 12px);
}

.paper-stack div:nth-child(2) {
    transform: rotate(5deg) translate(16px, 4px);
}

.paper-stack div:nth-child(3) {
    transform: translate(0, -8px);
}

.feature-grid,
.welcome-about {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.feature-grid div,
.welcome-about div {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 16px;
}

.feature-grid strong,
.feature-grid span {
    display: block;
}

.feature-grid span {
    margin-top: 5px;
    color: var(--muted);
    font-size: 13px;
}

.welcome-about {
    padding-bottom: 20px;
}

.welcome-about h2 {
    margin-bottom: 10px;
}

.welcome-about p {
    color: var(--muted);
    line-height: 1.7;
}

.login-shell {
    width: min(920px, calc(100% - 36px));
    min-height: 100vh;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 390px;
    gap: 44px;
    align-items: center;
}

.login-intro {
    display: grid;
    gap: 16px;
}

.back-link {
    color: var(--accent);
    font-weight: 800;
}

.login-intro h1 {
    font-size: 44px;
}

.login-intro p {
    color: var(--muted);
    font-size: 18px;
}

.login-card {
    display: grid;
    gap: 16px;
    border: 1px solid rgba(23,107,135,.18);
    border-radius: 8px;
    background: #fff;
    padding: 26px;
    box-shadow: 0 22px 60px rgba(16,24,40,.12);
}

.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.check-row input {
    width: auto;
}

@media (max-width: 900px) {
    body {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

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

    .main {
        padding: 18px;
    }

    .topbar,
    .panel-head,
    .form-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .metrics,
    .grid.two,
    .welcome-hero,
    .welcome-about,
    .feature-grid,
    .login-shell {
        grid-template-columns: 1fr;
    }

    .welcome-hero {
        min-height: auto;
        padding-top: 36px;
    }

    .hero-copy h1 {
        font-size: 40px;
    }

    .hero-panel {
        min-height: auto;
    }

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