/*
 * RemotiX — 디자인 토큰 + 공통 크롬 + 앱 화면.
 *
 * 토큰은 회사 홈페이지(optix.goodautosys.kr)의 값을 그대로 쓴다. 두 사이트를 오가는
 * 사용자가 같은 회사라고 느끼려면 색과 서체가 먼저 같아야 한다.
 */
:root {
    --bg: #0a0f1e;
    --surface: #111a2e;
    --surface-2: #16213b;
    --border: #233252;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --accent: #3b82f6;
    --accent-2: #22d3ee;
    --success: #34d399;
    --warn: #fbbf24;
    --danger: #f87171;

    /* 기존 앱 화면이 쓰던 이름. 토큰을 갈아끼워도 그 화면들이 깨지지 않게 남긴다. */
    --card: var(--surface);
    --card2: var(--surface-2);
    --accent2: var(--accent-2);

    --radius: 14px;
    --shell: 1200px;
    --shadow: 0 18px 50px rgba(2, 8, 23, .55);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* 헤더가 고정이라 앵커로 이동하면 제목이 그 아래로 숨는다. */
:target, [id] { scroll-margin-top: 88px; }

body {
    margin: 0;
    -webkit-text-size-adjust: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui,
        "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    word-break: keep-all;
}

a { color: inherit; }

img { max-width: 100%; }

.shell { width: 100%; max-width: var(--shell); margin: 0 auto; padding: 0 24px; }

/* ── 헤더 ─────────────────────────────────────────────────────────── */

.topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    background: rgba(10, 15, 30, .85);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid transparent;
    transition: border-color .25s ease, background-color .25s ease;
}
.topbar.scrolled {
    border-bottom-color: var(--border);
    background: rgba(10, 15, 30, .92);
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 14px;
    height: 68px;
}

.brand {
    display: flex; align-items: center; gap: 10px;
    color: var(--text); text-decoration: none;
    font-weight: 700; font-size: 17px; letter-spacing: -.02em;
    white-space: nowrap;
}
/* 심볼 마크. 가운데가 뚫린 매듭이라 예전 꽉 찬 사각형보다 작아 보여 2px 키웠다. */
.logo { display: block; width: 36px; height: 36px; }
.brand small {
    display: block; font-size: 11px; font-weight: 500; color: var(--muted);
    letter-spacing: .06em; line-height: 1.2;
}

.nav { display: flex; align-items: center; gap: 2px; margin-left: 10px; }
.nav > a, .menu > button {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 8px 12px; border-radius: 9px;
    color: var(--muted); text-decoration: none;
    font-size: 15px; font-weight: 500;
    background: none; border: none; cursor: pointer;
    font-family: inherit;
}
.nav > a:hover, .menu > button:hover { color: var(--text); background: var(--surface-2); }
.nav > a.on { color: var(--text); background: var(--surface-2); }

.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.who { color: var(--muted); font-size: 13px; }

/* 드롭다운 — 계정·관리 메뉴가 헤더를 넘치게 하지 않는다. */
.menu { position: relative; }
.menu > button::after { content: "▾"; font-size: 10px; opacity: .7; }
.menu-panel {
    position: absolute; top: calc(100% + 8px); left: 0;
    min-width: 214px; padding: 8px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; box-shadow: var(--shadow);
    display: none; flex-direction: column; gap: 2px;
}
.menu-panel.right { left: auto; right: 0; }
.menu.open .menu-panel { display: flex; }
.menu-panel a {
    padding: 9px 12px; border-radius: 8px; text-decoration: none;
    color: var(--text); font-size: 14px; white-space: nowrap;
}
.menu-panel a:hover { background: var(--surface-2); }
.menu-panel a span { display: block; color: var(--muted); font-size: 12px; }
.menu-panel hr { border: none; border-top: 1px solid var(--border); margin: 6px 4px; }
.menu-panel .head {
    padding: 6px 12px 2px; color: var(--muted);
    font-size: 11px; font-weight: 700; letter-spacing: .1em;
}

.nav-toggle {
    display: none; margin-left: auto;
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--surface-2); border: 1px solid var(--border);
    color: var(--text); font-size: 17px; cursor: pointer;
}

@media (max-width: 1080px) {
    .nav-toggle { display: block; }
    .topbar-inner { position: relative; }
    .nav, .nav-right {
        display: none;
        flex-direction: column; align-items: stretch; gap: 4px;
        margin: 0; padding: 0 0 14px;
    }
    .topbar.open .nav, .topbar.open .nav-right { display: flex; }
    .topbar.open .nav { padding-top: 6px; }
    .topbar.open .topbar-inner {
        height: auto; flex-wrap: wrap; align-items: flex-start; padding-bottom: 6px;
    }
    .topbar.open .brand, .topbar.open .nav-toggle { height: 68px; }
    .topbar.open .nav, .topbar.open .nav-right { flex-basis: 100%; }
    .menu-panel { position: static; display: flex; border: none; box-shadow: none; padding: 0 0 0 10px; background: none; }
    .menu > button { justify-content: space-between; }
    .nav-right .btn, .nav-right .btn-ghost { width: 100%; }
}

/* ── 본문 셸 ──────────────────────────────────────────────────────── */

main { flex: 1; }
main.app-main { padding: 44px 24px; }

/* ── 푸터 ─────────────────────────────────────────────────────────── */

.site-footer {
    border-top: 1px solid var(--border);
    background: #070b16;
    padding: 56px 0 40px;
    font-size: 13px;
    color: var(--muted);
}
.footer-top {
    display: grid; grid-template-columns: 1.7fr repeat(3, 1fr); gap: 32px;
    padding-bottom: 32px; border-bottom: 1px solid var(--border);
}
.footer-top h4 {
    margin: 0 0 12px; font-size: 13px; color: var(--text); letter-spacing: .02em;
}
.footer-top ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.footer-top a { color: var(--muted); text-decoration: none; }
.footer-top a:hover { color: var(--text); }
.footer-lede { max-width: 330px; margin: 14px 0 0; line-height: 1.75; }
.legal { padding-top: 26px; line-height: 1.95; }
.legal b { color: #cbd5e1; font-weight: 600; }
.legal .sep { opacity: .35; margin: 0 7px; }
.legal .note { margin-top: 14px; opacity: .85; }
.legal .copy { margin-top: 18px; opacity: .6; }

@media (max-width: 880px) {
    .footer-top { grid-template-columns: 1fr 1fr; }
    .footer-lede { max-width: none; }
}

/* ── 버튼 ─────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 46px; padding: 0 22px; border: none; border-radius: 8px;
    background: var(--accent);
    color: #fff; font-size: 15px; font-weight: 600; font-family: inherit;
    text-decoration: none; cursor: pointer; white-space: nowrap;
    transition: background .12s ease, opacity .12s ease;
}
.btn:hover { background: #2f76ec; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.lg { height: 54px; padding: 0 28px; font-size: 16px; }
.btn.sm { height: 34px; padding: 0 14px; font-size: 13px; border-radius: 7px; }
.btn.block { width: 100%; }

.btn-ghost {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 46px; padding: 0 20px; border-radius: 8px;
    background: transparent; border: 1px solid var(--border); color: var(--text);
    font-size: 15px; font-weight: 500; font-family: inherit;
    text-decoration: none; cursor: pointer; white-space: nowrap;
    transition: background .12s ease, border-color .12s ease;
}
.btn-ghost:hover { background: var(--surface-2); border-color: #31456e; }
.btn-ghost:active { transform: translateY(1px); }
.btn-ghost.lg { height: 54px; padding: 0 26px; font-size: 16px; }
.btn-ghost.sm { height: 34px; padding: 0 14px; font-size: 13px; border-radius: 7px; }
.btn-ghost.block { width: 100%; }
.btn-danger { background: transparent; border: 1px solid rgba(248, 113, 113, .5); color: var(--danger); }
.btn-danger:hover { background: rgba(248, 113, 113, .12); }

/* ── 폼 ───────────────────────────────────────────────────────────── */

label {
    display: block; margin: 16px 0 6px;
    color: var(--muted); font-size: 13px; font-weight: 500;
}
input[type=text], input[type=password], input[type=email], input[type=tel],
input[type=number], input[type=search], textarea, select {
    width: 100%; height: 46px; padding: 0 14px;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text);
    font-size: 16px; font-family: inherit; outline: none;
    transition: border-color .12s ease, box-shadow .12s ease;
}
textarea { height: auto; padding: 12px 14px; line-height: 1.6; resize: vertical; }
input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .18);
}
select { cursor: pointer; }
input[type=file] {
    width: 100%; padding: 11px 12px;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text); font-size: 14px; font-family: inherit;
}
input[type=file]::file-selector-button {
    margin-right: 10px; padding: 6px 12px; border-radius: 6px;
    background: var(--surface); border: 1px solid var(--border);
    color: var(--text); font-family: inherit; font-size: 13px; cursor: pointer;
}

.inline { display: inline; }
.inline-check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin: 0 0 0 10px; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

.msg { margin-top: 14px; font-size: 14px; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--success); }
.altlink { margin-top: 20px; text-align: center; font-size: 14px; color: var(--muted); }
.altlink a { color: var(--accent); text-decoration: none; font-weight: 500; }

/* ── 앱 카드 ──────────────────────────────────────────────────────── */

.card {
    width: 100%; max-width: 460px; margin: 0 auto;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 18px; padding: 34px;
    box-shadow: var(--shadow);
}
.card.wide { max-width: 1060px; }
.card h1 { margin: 0 0 6px; font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.card .sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.stat { color: var(--muted); font-size: 14px; }

/* ── 표 ───────────────────────────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 13px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; }

.badge {
    display: inline-block; padding: 2px 9px; border-radius: 999px;
    font-size: 12px; font-weight: 600;
    background: rgba(148, 163, 184, .15); color: var(--muted);
}
.badge.admin { background: rgba(59, 130, 246, .16); color: #93c5fd; }
.badge.blocked { background: rgba(248, 113, 113, .16); color: var(--danger); }
.badge.active { background: rgba(52, 211, 153, .16); color: var(--success); }
.row-actions { display: flex; gap: 8px; }
.row-actions button { font-size: 12px; height: 30px; padding: 0 10px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.toolbar input { max-width: 260px; margin: 0; }

/* ── 슬롯 격자 ────────────────────────────────────────────────────── */

.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-top: 8px; }
.slot {
    position: relative; background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 14px; padding: 16px 14px 14px; min-height: 150px;
}
.slot.on { border-color: rgba(52, 211, 153, .45); }
.slot.empty { border-style: dashed; opacity: .6; }
.slot.over { border-color: rgba(248, 113, 113, .45); }
.slot-no { position: absolute; top: 10px; right: 12px; font-size: 22px; font-weight: 700; color: var(--border); }
.slot.on .slot-no { color: var(--success); }
.slot-name { font-size: 15px; font-weight: 600; margin-bottom: 8px; padding-right: 28px; }
.slot-state { margin-bottom: 6px; }
.slot-meta { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.slot-form { display: flex; gap: 6px; margin-bottom: 8px; }
.slot-form input[type=text] { height: 34px; font-size: 13px; margin: 0; }
.slot-form button { white-space: nowrap; }
.slot form { margin: 0; }

/* ── 구매 화면 ────────────────────────────────────────────────────── */

.buy-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; margin-top: 8px; }
.quote-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 24px; min-height: 180px; }
.quote-amount { font-size: 36px; font-weight: 700; letter-spacing: -.03em; margin-bottom: 8px; }
.quote-detail { color: var(--muted); font-size: 13px; line-height: 1.75; min-height: 48px; margin-bottom: 16px; }
.rate-title { font-size: 17px; margin: 34px 0 12px; }
.rate-title .sub { font-size: 12px; margin-left: 8px; color: var(--muted); font-weight: 400; }

.rate-form { display: flex; gap: 8px; align-items: center; margin: 0; }
.rate-form input[type=number] { width: 120px; height: 34px; border-radius: 8px; font-size: 14px; }
.grant-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.grant-form label { margin: 0 0 4px; }
.grant-form input { height: 40px; border-radius: 9px; font-size: 14px; width: 130px; }

@media (max-width: 760px) {
    .buy-grid { grid-template-columns: 1fr; }
    .card { padding: 26px 20px; }
    main.app-main { padding: 28px 16px; }
}


/* ══ 모바일 보정 ═══════════════════════════════════════════════════
 * 가로 넘침이 없다고 잘 보이는 것은 아니다. 폰에서 실제로 읽고 누를 수
 * 있는지를 기준으로 여백·글자·터치 영역을 다시 잡는다.
 */

@media (max-width: 1080px) {
    /* 메뉴를 연 상태에서 본문이 밀리지 않도록 헤더를 겹쳐 띄운다. */
    .topbar.open { box-shadow: 0 18px 40px rgba(2, 8, 23, .5); }
}

@media (max-width: 760px) {
    .shell { padding: 0 20px; }
    .topbar-inner { height: 60px; }
    :target, [id] { scroll-margin-top: 72px; }

    main.app-main { padding: 24px 16px; }

    .card { padding: 24px 18px; border-radius: 14px; }
    .card h1 { font-size: 21px; }

    /*
     * 표는 가로 스크롤로 넘긴다. 폰 폭에 열을 욱여넣으면 "2026-09-17 10:40" 같은
     * 값이 세 줄로 쪼개져 읽을 수 없게 된다. 줄바꿈을 막고 넘치는 만큼 밀어서 본다.
     */
    .card table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    table { font-size: 13.5px; }
    th, td { padding: 11px 10px; }

    /* 앱 화면의 주요 동작 버튼도 폰에서는 가득 채운다. */
    .quote-box .btn, .card > form > .btn { width: 100%; }

    /* 슬롯 카드: 이름 저장과 해제가 한 줄에 나란히 놓이게 한다. */
    .slot { min-height: 0; }
    .slot-form { margin-bottom: 10px; }
    .slot-form input[type=text] { height: 40px; font-size: 14px; }
    .slot-form button { height: 40px; }
    .slot > form > button { width: 100%; height: 38px; }

    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar input { max-width: none; }

    /* 표가 옆으로 밀리므로 행 안의 버튼은 접지 않는다. 접으면 행 높이만 커진다. */
    .row-actions { flex-wrap: nowrap; }
    .row-actions .inline { display: flex; }

    /* 관리자 입력 폼(수동 부여·릴리즈 업로드)은 한 줄에 욱여넣지 않고 쌓는다. */
    .grant-form { flex-direction: column; align-items: stretch; gap: 14px; }
    .grant-form > div { width: 100%; }
    .grant-form input, .grant-form select, .grant-form button { width: 100%; }
    .grant-form label { white-space: normal; }

    .quote-amount { font-size: 30px; }
    .rate-title { font-size: 16px; margin-top: 28px; }

    .grant-form, .rate-form { width: 100%; }
    .grant-form input, .rate-form input[type=number] { width: 100%; }

    /* 손가락으로 누를 수 있는 최소 크기. 34px는 작다. */
    .btn.sm, .btn-ghost.sm { height: 40px; padding: 0 16px; font-size: 14px; }
    .row-actions button { height: 36px; white-space: nowrap; }

    .site-footer { padding: 44px 0 32px; }
    .footer-top { gap: 26px; padding-bottom: 26px; }
    .legal { padding-top: 22px; line-height: 1.85; }
}

@media (max-width: 520px) {
    .footer-top { grid-template-columns: 1fr; }
    .footer-top > div:first-child { margin-bottom: 4px; }

    /* 사업자 정보는 항목마다 줄을 바꿔야 읽힌다. */
    .legal .sep { display: block; height: 0; overflow: hidden; margin: 0; }

    .brand { font-size: 16px; }
    .brand small { font-size: 10px; }
}


@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .btn:active, .btn-ghost:active { transform: none; }
    .topbar { transition: none; }
}
