:root {
    --bg: #f3f5f9;
    --surface: #ffffff;
    --surface-2: #f7f9fc;
    --text: #18202f;
    --muted: #5d6779;
    --line: #e2e7ef;
    --brand: #1d4ea3;
    --brand-dark: #153a7b;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
    --radius: 14px;

    --accent: var(--brand);
    --accent-soft: #e8efff;
    --warn: #b45309;
    --warn-soft: #fff7ea;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f141c;
        --surface: #171e29;
        --surface-2: #1c2431;
        --text: #e6eaf2;
        --muted: #9aa5b8;
        --line: #2a3443;
        --brand: #5b8def;
        --brand-dark: #4677d6;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
        --accent-soft: #1f2b44;
        --warn: #f0b058;
        --warn-soft: #2b2416;
    }
}

/* 제품별 색 */
.accent-blue   { --accent: #2563eb; --accent-soft: #e8efff; }
.accent-teal   { --accent: #0d9488; --accent-soft: #e2f6f3; }
.accent-orange { --accent: #ea580c; --accent-soft: #fff0e6; }
.accent-purple { --accent: #7c3aed; --accent-soft: #f1eaff; }

@media (prefers-color-scheme: dark) {
    .accent-blue   { --accent: #6b9bff; --accent-soft: #1d2a47; }
    .accent-teal   { --accent: #3cc8b8; --accent-soft: #15302d; }
    .accent-orange { --accent: #ff9156; --accent-soft: #35231a; }
    .accent-purple { --accent: #ad8bff; --accent-soft: #2a2242; }
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Pretendard", "Malgun Gothic", "맑은 고딕", system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    word-break: keep-all;
}

h1, h2, h3 {
    margin: 0;
    line-height: 1.3;
}

a {
    color: var(--accent);
}

button {
    font: inherit;
    cursor: pointer;
}

.wrap {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
}

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

/* 버튼 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    background: var(--accent);
    border: none;
    border-radius: 10px;
    transition: filter .15s, transform .15s;
}

.btn:hover {
    filter: brightness(1.08);
}

.btn:active {
    transform: translateY(1px);
}

.btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-ghost {
    padding: 6px 12px;
    color: inherit;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 8px;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, .12);
}

/* 로고 */
.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    font-weight: 800;
    letter-spacing: -.5px;
    color: #fff;
    background: linear-gradient(135deg, #2f6fd6, #153a7b);
    border-radius: 10px;
    flex: none;
}

/* 상단 바 */
.topbar {
    color: #fff;
    background: linear-gradient(120deg, #153a7b, #1d4ea3 60%, #2a63c4);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

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

.topbar .brand-mark {
    background: rgba(255, 255, 255, .16);
    border: 1px solid rgba(255, 255, 255, .25);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-text small {
    opacity: .8;
}

.user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.user-id {
    opacity: .85;
}

/* 머리글 */
.hero {
    padding: 36px 0 28px;
    color: #fff;
    background: linear-gradient(120deg, #153a7b, #1d4ea3 60%, #2a63c4);
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.hero h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -.5px;
}

.hero p {
    max-width: 720px;
    margin: 8px 0 20px;
    opacity: .9;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 6px;
    font-size: 14px;
    color: #fff;
    text-decoration: none;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 999px;
    transition: background .15s;
}

.chip:hover {
    background: rgba(255, 255, 255, .22);
}

.chip-badge {
    padding: 1px 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    background: #fff;
    border-radius: 999px;
}

.chip-ver {
    font-size: 12px;
    opacity: .8;
}

/* 공통 안내 */
main.wrap {
    padding-top: 24px;
    padding-bottom: 40px;
}

.guide {
    padding: 22px 24px;
    margin-bottom: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.guide h2 {
    margin-bottom: 14px;
    font-size: 17px;
}

.guide-steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: g;
}

.guide-steps li {
    position: relative;
    padding: 14px 14px 14px 52px;
    background: var(--surface-2);
    border-radius: 10px;
    counter-increment: g;
}

.guide-steps li::before {
    content: counter(g);
    position: absolute;
    top: 14px;
    left: 14px;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    background: var(--brand);
    border-radius: 50%;
}

.guide-steps strong {
    display: block;
    margin-bottom: 4px;
}

.guide-steps span {
    font-size: 13.5px;
    color: var(--muted);
}

/* 제품 카드 */
.product {
    position: relative;
    padding: 26px 28px;
    margin-bottom: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    scroll-margin-top: 16px;
}

.product::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: var(--accent);
}

.product-head {
    display: flex;
    align-items: center;
    gap: 16px;
}

.badge {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    font-size: 17px;
    font-weight: 800;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: 14px;
    flex: none;
}

.product-title {
    flex: 1;
    min-width: 0;
}

.product-title h2 {
    font-size: 21px;
    letter-spacing: -.3px;
}

.product-title p {
    margin: 2px 0 0;
    color: var(--muted);
}

.pill {
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
    background: var(--accent-soft);
    border-radius: 999px;
}

.desc {
    margin: 16px 0 18px;
}

/* 제품별 강조 안내 */
.notice {
    margin: 0 0 18px;
    padding: 12px 14px;
    border-left: 4px solid var(--warn);
    border-radius: 6px;
    background: var(--warn-soft);
    color: var(--warn);
    font-weight: 600;
}

/* 내려받기 */
.download {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 18px;
    padding: 16px 18px;
    background: var(--accent-soft);
    border-radius: 12px;
}

.download.none {
    color: var(--muted);
    background: var(--surface-2);
}

.file-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    font-size: 13.5px;
    color: var(--muted);
}

.file-name {
    font-weight: 600;
    color: var(--text);
    word-break: break-all;
}

/* 제품 정보 */
.facts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    margin: 18px 0 0;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}

.facts div {
    padding: 12px 16px;
    background: var(--surface);
}

.facts dt {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
}

.facts dd {
    margin: 2px 0 0;
    word-break: break-all;
}

.cols {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 16px;
    margin-top: 18px;
}

.cols h3 {
    margin-bottom: 8px;
    font-size: 15px;
}

.steps {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: s;
}

.steps li {
    position: relative;
    padding: 4px 0 4px 32px;
    counter-increment: s;
}

.steps li::before {
    content: counter(s);
    position: absolute;
    top: 6px;
    left: 0;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: 50%;
}

.caution {
    padding: 14px 16px;
    background: var(--warn-soft);
    border-radius: 12px;
}

.caution h3 {
    color: var(--warn);
}

.caution ul {
    margin: 0;
    padding-left: 18px;
}

.caution li + li {
    margin-top: 6px;
}

/* 이전 버전 */
.history {
    margin-top: 18px;
    border-top: 1px solid var(--line);
}

.history summary {
    padding-top: 14px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
}

.history ul,
.history-list {
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.history li,
.history-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 14px;
    padding: 10px 0;
    font-size: 14px;
    border-bottom: 1px dashed var(--line);
}

.history li .file-name,
.history-list li .file-name {
    flex: 1;
    min-width: 200px;
    font-weight: 500;
}

/* 기타 파일 */
.others {
    padding: 22px 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.others h2 {
    font-size: 17px;
}

.others p {
    margin: 4px 0 0;
}

/* 이전 버전 관리 */
.brand {
    color: inherit;
    text-decoration: none;
}

.top-link {
    margin-right: 6px;
    font-size: 14px;
    color: #fff;
    opacity: .9;
}

.hero-link {
    color: #fff;
    font-weight: 600;
}

.history-link {
    display: inline-block;
    margin-top: 18px;
    font-weight: 600;
    text-decoration: none;
}

.history-link:hover {
    text-decoration: underline;
}

.hero-sm {
    padding: 22px 0 22px;
}

.hero-sm h1 {
    font-size: 24px;
}

.hero-sm p {
    margin-bottom: 0;
}

.back {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #fff;
    opacity: .85;
    text-decoration: none;
}

.back:hover {
    opacity: 1;
}

.product.compact {
    padding: 20px 24px;
}

.product.compact .product-title p {
    font-size: 13.5px;
    word-break: break-all;
}

.empty-note {
    margin: 12px 0 0;
    font-size: 14px;
}

form.inline {
    display: inline;
    margin: 0;
}

.btn-danger {
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #b42318;
    background: transparent;
    border: 1px solid #f1b5ae;
    border-radius: 8px;
    transition: background .15s, color .15s;
}

.btn-danger:hover {
    color: #fff;
    background: #d92d20;
    border-color: #d92d20;
}

.flash {
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 14px;
    border-radius: 10px;
    word-break: break-all;
}

.flash.ok {
    color: #05603a;
    background: #ecfdf3;
    border: 1px solid #abefc6;
}

.flash.err {
    color: #b42318;
    background: #fef3f2;
    border: 1px solid #fecdca;
}

@media (prefers-color-scheme: dark) {
    .btn-danger {
        color: #ff8a80;
        border-color: #6b2b27;
    }

    .flash.ok {
        color: #75e0a7;
        background: #0f2a1d;
        border-color: #1d4d33;
    }

    .flash.err {
        color: #ff8a80;
        background: #2d1614;
        border-color: #5c2420;
    }
}

/* 저장 공간 */
.meter {
    position: relative;
    display: block;
    height: 10px;
    background: var(--surface-2);
    border-radius: 999px;
    overflow: hidden;
}

.meter > span {
    display: block;
    height: 100%;
    min-width: 2px;
    background: #2f6fd6;
    border-radius: 999px;
}

.warn .meter > span {
    background: #f59e0b;
}

.danger .meter > span {
    background: #d92d20;
}

.storage {
    padding: 18px 22px;
    margin-bottom: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.storage-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 10px;
}

.storage-head b {
    font-size: 20px;
}

.storage p {
    margin: 8px 0 0;
    font-size: 13.5px;
}

.storage-mini {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    margin-bottom: 14px;
    font-size: 13.5px;
    color: #fff;
    text-decoration: none;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 999px;
}

.storage-mini:hover {
    background: rgba(255, 255, 255, .18);
}

.storage-mini .meter {
    width: 120px;
    height: 8px;
    background: rgba(255, 255, 255, .2);
}

.storage-mini .meter > span {
    background: #fff;
}

.storage-mini.warn .meter > span {
    background: #fbbf24;
}

.storage-mini.danger .meter > span {
    background: #f87171;
}

.storage-mini-size {
    opacity: .8;
}

@media (max-width: 600px) {
    .storage-mini-size {
        display: none;
    }
}

/* 바닥글 */
.footer {
    padding: 20px 0 32px;
    font-size: 13px;
    color: var(--muted);
}

.footer .wrap {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
}

/* 로그인 */
.login-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 20%, rgba(47, 111, 214, .18), transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(124, 58, 237, .14), transparent 40%),
        var(--bg);
}

/* body 가 아닌 감싸는 요소로 가운데 맞춤. 아래 여백을 조금 더 줘서 눈으로 보기에 정가운데 */
.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 20px 20px 8vh;
}

.login-card {
    width: 100%;
    max-width: 380px;
    padding: 32px 30px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 10px 40px rgba(16, 24, 40, .12);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 26px;
}

.login-brand .brand-mark {
    width: 46px;
    height: 46px;
    font-size: 18px;
    border-radius: 12px;
}

.login-brand h1 {
    font-size: 20px;
}

.login-brand p {
    margin: 2px 0 0;
    font-size: 13.5px;
    color: var(--muted);
}

.login-card label {
    display: block;
    margin: 14px 0 6px;
    font-size: 13.5px;
    font-weight: 600;
}

.login-card input {
    width: 100%;
    padding: 11px 12px;
    font: inherit;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.login-card input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(47, 111, 214, .18);
}

.login-card .btn {
    margin-top: 22px;
    --accent: var(--brand);
}

.login-error {
    margin: 14px 0 0;
    padding: 10px 12px;
    font-size: 13.5px;
    color: #b42318;
    background: #fef3f2;
    border-radius: 8px;
}

/* 좁은 화면 */
@media (max-width: 900px) {
    .guide-steps {
        grid-template-columns: repeat(2, 1fr);
    }

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

@media (max-width: 600px) {
    .wrap {
        padding: 0 16px;
    }

    .hero h1 {
        font-size: 23px;
    }

    .guide-steps,
    .facts {
        grid-template-columns: 1fr;
    }

    .product {
        padding: 20px 18px;
    }

    .product-head {
        flex-wrap: wrap;
    }

    .badge {
        width: 46px;
        height: 46px;
        font-size: 15px;
    }

    .brand-text small,
    .user-id {
        display: none;
    }

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