/* Zamica 가맹점 센터 — 조회 전용. 외부 파일 없이, 색은 Zamica 앱(골드 #F6B146·어두운 바탕)에 맞춘다. */
:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface-2: #f9fafb;
    --text: #15171c;
    --text-2: #3d4250;
    --muted: #7a8090;
    --line: #e7e9ee;
    --line-strong: #d6d9e0;
    --brand: #f6b146;
    --brand-strong: #d68a1f;
    --brand-soft: #fff6e6;
    --side: #15171c;
    --side-2: #1f2229;
    --side-text: #c9ccd4;
    --side-muted: #7d828f;
    --ok: #0f7a4f;
    --ok-bg: #e8f7ef;
    --warn: #a15c00;
    --warn-bg: #fff4e0;
    --bad: #c0352b;
    --bad-bg: #fdecea;
    --info: #285bb8;
    --info-bg: #eaf1fd;
    --neutral: #5d6372;
    --neutral-bg: #eef0f3;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 24px; line-height: 1.3; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 15px; margin: 0 0 14px; }

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; }
.inline-form { display: inline; margin: 0; }
.link-button { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; }
.link-button:hover { text-decoration: underline; }

/* ---------- 앱 틀: 사이드 메뉴 + 본문 ---------- */

.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--side);
    color: var(--side-text);
    padding: 22px 16px 18px;
}
.sidebar-brand { display: block; padding: 4px 8px 22px; border-bottom: 1px solid rgba(255, 255, 255, .07); margin-bottom: 16px; }
.sidebar-brand:hover { text-decoration: none; }
.sidebar-brand img { display: block; width: 132px; height: auto; }
.sidebar-brand span { display: block; margin-top: 8px; color: var(--side-muted); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 9px;
    color: var(--side-text);
    font-weight: 500;
}
.side-nav a:hover { background: var(--side-2); color: #fff; text-decoration: none; }
.side-nav a.active { background: rgba(246, 177, 70, .14); color: var(--brand); }
.side-nav svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.main { min-width: 0; display: flex; flex-direction: column; }

/* 오른쪽 위 계정 메뉴(비밀번호 변경·언어·로그아웃) */
.topbar {
    position: sticky; top: 0; z-index: 10;
    display: flex; justify-content: flex-end; align-items: center;
    height: 60px; padding: 0 40px;
    background: rgba(244, 245, 247, .92);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--line);
}
.user-menu { position: relative; }
.user-menu summary {
    display: flex; align-items: center; gap: 10px;
    padding: 5px 10px 5px 5px;
    border: 1px solid transparent; border-radius: 999px;
    cursor: pointer; list-style: none; user-select: none;
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover, .user-menu[open] summary { background: var(--surface); border-color: var(--line); }
.avatar {
    width: 32px; height: 32px; flex: none;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--brand); color: var(--side);
    font-weight: 700;
}
.user-text { display: flex; flex-direction: column; line-height: 1.2; text-align: left; }
.user-text strong { font-size: 13.5px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-text small { color: var(--muted); font-size: 12px; }
.chevron { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.user-menu[open] .chevron { transform: rotate(180deg); }
.menu-pop {
    position: absolute; right: 0; top: calc(100% + 8px);
    width: 240px; padding: 6px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
    box-shadow: 0 12px 32px rgba(16, 24, 40, .14);
}
.menu-head { display: flex; flex-direction: column; padding: 10px 12px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.menu-head span { color: var(--muted); font-size: 12.5px; }
.menu-pop a, .menu-logout {
    display: block; width: 100%;
    padding: 9px 12px; border: 0; border-radius: 8px;
    background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.menu-pop a:hover, .menu-logout:hover { background: var(--surface-2); text-decoration: none; }
.menu-pop a.active { color: var(--brand-strong); font-weight: 600; }
.menu-pop form { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--line); }
.menu-logout { color: var(--bad); }

.content { min-width: 0; padding: 28px 40px 56px; max-width: 1360px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.lead { margin: 6px 0 0; color: var(--muted); }

/* ---------- 패널·알림 ---------- */

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}
.panel-narrow { max-width: 480px; }
.panel-meta {
    display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 0 2px 12px; color: var(--text-2);
}
.note { margin: 14px 0 0; color: var(--muted); font-size: 12.5px; }
.count { display: inline-block; margin-left: 6px; padding: 0 8px; border-radius: 999px; background: var(--neutral-bg); color: var(--neutral); font-size: 12px; font-weight: 600; }

.alert { border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-info { background: var(--info-bg); color: #1d3f80; border-color: #d4e2fb; }
.alert-warn { background: var(--warn-bg); color: var(--warn); border-color: #fde3b8; }
.alert-error { background: var(--bad-bg); color: var(--bad); border-color: #f8cfca; }

/* ---------- 폼·버튼 ---------- */

.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.form-actions { display: flex; justify-content: flex-end; }

input, select, button { font: inherit; }
input, select {
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    min-width: 0;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { outline: none; border-color: var(--brand-strong); box-shadow: 0 0 0 3px rgba(246, 177, 70, .25); }
input[type="search"] { width: 100%; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 40px; padding: 0 18px;
    border: 1px solid transparent; border-radius: 9px;
    font-weight: 600; cursor: pointer; white-space: nowrap;
    transition: background .15s, border-color .15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: var(--side); }
.btn-primary:hover { background: #f2a52c; }
.btn-ghost { background: #fff; border-color: var(--line-strong); color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-block { width: 100%; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.disabled { opacity: .45; pointer-events: none; }

.toolbar {
    display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
    padding-bottom: 18px; margin-bottom: 16px; border-bottom: 1px solid var(--line);
}
.toolbar .grow { flex: 1 1 240px; }
.toolbar-actions { display: flex; gap: 8px; margin-left: auto; }
.range { display: flex; align-items: center; gap: 6px; }
.range span { color: var(--muted); }

/* ---------- 표 ---------- */

.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th {
    position: sticky; top: 0;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 12px; font-weight: 600; text-align: left; white-space: nowrap;
    padding: 10px 12px;
    border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.table th:first-child { border-left: 1px solid var(--line); border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
.table th:last-child { border-right: 1px solid var(--line); border-top-right-radius: 8px; border-bottom-right-radius: 8px; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.table td a, .fields dd a { color: var(--text); font-weight: 600; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.table td a:hover, .fields dd a:hover { color: var(--brand-strong); text-decoration-color: currentColor; }
.table tbody tr:hover td { background: #fcfcfd; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .time { color: var(--text-2); font-variant-numeric: tabular-nums; }
.table td.empty { text-align: center; color: var(--muted); padding: 48px 12px; }
.cell-title { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: 12.5px; }
.unit { color: var(--muted); font-size: 12px; }

/* 상태 표시 */
.pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 2px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600; line-height: 20px;
    background: var(--neutral-bg); color: var(--neutral);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill + .pill { margin-left: 4px; }
.pill-lg { padding: 4px 12px; font-size: 13px; }
.pill.s-paid { background: var(--ok-bg); color: var(--ok); }
.pill.s-created { background: var(--warn-bg); color: var(--warn); }
.pill.s-refunded { background: var(--bad-bg); color: var(--bad); }
.pill.s-settled { background: var(--info-bg); color: var(--info); }

.pager { display: flex; justify-content: center; align-items: center; gap: 10px; padding-top: 18px; }
.pager-pos { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 64px; text-align: center; }

/* ---------- 상세 ---------- */

.back-link { display: inline-block; margin-bottom: 14px; color: var(--muted); font-weight: 500; }
.back-link:hover { color: var(--text); text-decoration: none; }

.hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 24px; }
.eyebrow { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.hero-amount { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.hero-amount span { font-size: 18px; color: var(--muted); font-weight: 600; }
.hero-side { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-2 .panel { margin-bottom: 20px; }

.fields { display: grid; grid-template-columns: 150px minmax(0, 1fr); margin: 0; }
.fields dt, .fields dd { padding: 10px 0; border-bottom: 1px solid var(--line); }
.fields dt { color: var(--muted); }
.fields dd { margin: 0; word-break: break-all; }
.fields dt:last-of-type, .fields dd:last-of-type { border-bottom: 0; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 20px; }
.stat-label { color: var(--muted); font-size: 12.5px; }
.stat-value { margin-top: 4px; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-value.small { font-size: 14px; font-weight: 600; }

/* 오류·없음 */
.state-card {
    max-width: 420px; margin: 64px auto; text-align: center;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 40px 28px;
}
.state-card h1 { font-size: 18px; margin: 14px 0 22px; }
.state-icon {
    width: 48px; height: 48px; margin: 0 auto;
    display: grid; place-items: center;
    border-radius: 50%; background: var(--brand-soft); color: var(--brand-strong);
    font-size: 22px; font-weight: 700;
}

/* ---------- 로그인 ---------- */

.auth-shell { min-height: 100vh; }
.auth-lang { position: fixed; top: 20px; right: 24px; z-index: 2; color: var(--muted); font-weight: 500; }
.auth { display: grid; grid-template-columns: minmax(360px, 44%) 1fr; min-height: 100vh; }
.auth-brand {
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 48px 56px;
    color: #fff;
    background:
        radial-gradient(900px 500px at 0% 0%, rgba(43, 169, 133, .28), transparent 60%),
        radial-gradient(700px 500px at 100% 100%, rgba(246, 177, 70, .22), transparent 60%),
        var(--side);
}
.auth-logo { width: 168px; height: auto; }
.auth-brand-text h2 { font-size: 34px; line-height: 1.25; margin: 0 0 14px; letter-spacing: -0.02em; }
.auth-brand-text p { margin: 0; max-width: 380px; color: var(--side-text); font-size: 16px; }
.auth-brand-foot { margin: 0; color: var(--side-muted); font-size: 12px; }
.auth-main { display: grid; place-items: center; padding: 48px 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { margin-bottom: 6px; }
.auth-card > .muted { margin: 0 0 24px; }
.auth-card .btn-block { margin-top: 8px; height: 44px; }
.is-auth .state-card { margin-top: 18vh; }

/* ---------- 좁은 화면 ---------- */

@media (max-width: 960px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px 16px; }
    .sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0; margin: 0; border: 0; }
    .sidebar-brand img { width: 96px; }
    .sidebar-brand span { margin: 0; }
    .side-nav { order: 3; flex-direction: row; width: 100%; overflow-x: auto; gap: 4px; }
    .side-nav a { padding: 8px 10px; white-space: nowrap; }
    .topbar { height: 52px; padding: 0 16px; }
    .content { padding: 20px 16px 40px; }
    .grid-2, .stats { grid-template-columns: 1fr; gap: 0; }
    .stats .stat { margin-bottom: 12px; }
    .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .auth-brand { padding: 28px 24px; gap: 28px; justify-content: flex-start; }
    .auth-main { place-items: start center; padding: 32px 24px 48px; }
    .auth-brand-text h2 { font-size: 24px; }
    .auth-brand-foot { display: none; }
    .auth-lang { color: var(--side-text); }
}

@media (max-width: 640px) {
    h1 { font-size: 20px; }
    .user-text strong { max-width: 140px; }
    .toolbar .field, .toolbar .range, .toolbar-actions { width: 100%; }
    .range input { flex: 1; }
    .toolbar-actions .btn { flex: 1; }
    .hero { flex-direction: column; }
    .hero-amount { font-size: 26px; }
    .fields { grid-template-columns: 1fr; }
    .fields dt { padding-bottom: 0; border-bottom: 0; font-size: 12.5px; }
}
