/* ============================================
   정산관리자 반응형 관리자 UI
   ============================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }
body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Malgun Gothic', '맑은 고딕', sans-serif;
    background: #f1f4f9; color: #1e293b; line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ── 레이아웃 ───────────────────────────── */
.adm-wrap { display: flex; min-height: 100vh; }

.adm-side {
    width: 230px; flex-shrink: 0; background: #0f172a; color: #cbd5e1;
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; z-index: 50;
}
.adm-logo {
    padding: 18px 20px; font-size: 17px; font-weight: 700; color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08); letter-spacing: -.3px;
}
.adm-logo i { color: #fbbf24; margin-right: 6px; }

.adm-nav { flex: 1; overflow-y: auto; padding: 10px 0; }
.adm-nav-group {
    padding: 14px 20px 6px; font-size: 11px; color: #64748b;
    text-transform: uppercase; letter-spacing: .5px;
}
.adm-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px; color: #cbd5e1; font-size: 14px;
    border-left: 3px solid transparent; transition: background .15s;
}
.adm-nav a i { width: 18px; text-align: center; font-size: 14px; color: #64748b; }
.adm-nav a:hover { background: rgba(255,255,255,.05); text-decoration: none; color: #fff; }
.adm-nav a.on { background: rgba(37,99,235,.18); border-left-color: #3b82f6; color: #fff; }
.adm-nav a.on i { color: #60a5fa; }

.adm-side-foot {
    padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.08);
    font-size: 13px; display: flex; align-items: center; gap: 8px;
}
.adm-side-foot .logout { margin-left: auto; color: #94a3b8; font-size: 15px; }
.adm-side-foot .logout:hover { color: #f87171; }

.adm-dim { display: none; }

.adm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.adm-top {
    background: #fff; border-bottom: 1px solid #e2e8f0;
    padding: 0 22px; height: 56px;
    display: flex; align-items: center; gap: 14px;
    position: sticky; top: 0; z-index: 40;
}
.adm-top h1 { font-size: 17px; font-weight: 700; letter-spacing: -.3px; }
.adm-top-right { margin-left: auto; }
.adm-date { font-size: 13px; color: #64748b; }
.adm-burger {
    display: none; background: none; border: none; font-size: 19px;
    color: #334155; cursor: pointer; padding: 6px;
}

.adm-content { padding: 20px 22px 60px; max-width: 1500px; width: 100%; }

/* ── 카드 ──────────────────────────────── */
.card {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
    padding: 18px 20px; margin-bottom: 18px;
    box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.card-title {
    font-size: 15px; font-weight: 700; margin-bottom: 14px;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.card-title i { color: #3b82f6; }
.card-title small { font-weight: 400; color: #64748b; }
.card-more { margin-left: auto; font-size: 12.5px; font-weight: 400; }
.sub-title { font-size: 13.5px; font-weight: 700; margin: 14px 0 6px; }
.mt20 { margin-top: 20px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-2 > .card { margin-bottom: 18px; }

/* ── KPI 카드 ──────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi-grid.kpi-2 { grid-template-columns: repeat(2, 1fr); }
.kpi-card {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
    padding: 16px 18px; display: flex; align-items: center; gap: 14px;
    box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.kpi-ico {
    width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 18px; color: #fff;
}
.kpi-ico.blue { background: #3b82f6; } .kpi-ico.green { background: #22c55e; }
.kpi-ico.amber { background: #f59e0b; } .kpi-ico.violet { background: #8b5cf6; }
.kpi-body { min-width: 0; }
.kpi-label { font-size: 12.5px; color: #64748b; margin-bottom: 2px; }
.kpi-value { font-size: 20px; font-weight: 800; letter-spacing: -.5px; }
.kpi-value small { font-size: 12px; font-weight: 500; color: #94a3b8; margin-left: 2px; }
.kpi-sm .kpi-value { font-size: 17px; }

/* ── 테이블 ────────────────────────────── */
.tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { padding: 9px 10px; border-bottom: 1px solid #eef2f7; text-align: left; vertical-align: middle; }
.tbl thead th {
    background: #f8fafc; color: #475569; font-size: 12.5px; font-weight: 600;
    border-bottom: 1px solid #e2e8f0; white-space: nowrap;
}
.tbl tbody tr:hover { background: #f8fafc; }
.tbl tfoot th { background: #f1f5f9; font-weight: 700; }
.tbl .ta-r { text-align: right; }
.tbl .nowrap { white-space: nowrap; }
.tbl-detail th { width: 130px; background: #f8fafc; color: #475569; font-weight: 600; white-space: nowrap; }
.row-total th { border-top: 2px solid #cbd5e1; }
.raw-text { font-size: 12.5px; color: #475569; max-width: 340px; word-break: break-all; }

.strong { font-weight: 700; }
.text-blue { color: #2563eb; } .text-green { color: #16a34a; }
.text-amber { color: #d97706; } .text-red { color: #dc2626; }
.text-muted { color: #94a3b8; }
.empty { text-align: center; color: #94a3b8; padding: 26px 10px !important; font-size: 13.5px; }
.empty i { margin-right: 6px; }

/* ── 뱃지 ──────────────────────────────── */
.badge {
    display: inline-block; padding: 2px 9px; border-radius: 20px;
    font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge-green { background: #dcfce7; color: #15803d; }
.badge-blue  { background: #dbeafe; color: #1d4ed8; }
.badge-amber { background: #fef3c7; color: #b45309; }
.badge-red   { background: #fee2e2; color: #b91c1c; }
.badge-gray  { background: #e2e8f0; color: #475569; }
.badge-sky   { background: #e0f2fe; color: #0369a1; }

/* ── 버튼 ──────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: #fff; border: 1px solid #cbd5e1; border-radius: 8px;
    padding: 8px 14px; font-size: 13.5px; font-weight: 600; color: #334155;
    cursor: pointer; transition: all .15s; text-decoration: none !important;
    font-family: inherit; line-height: 1.3;
}
.btn:hover { background: #f1f5f9; }
.btn-primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-green { background: #16a34a; border-color: #16a34a; color: #fff; }
.btn-green:hover { background: #15803d; }
.btn-danger { background: #fff; border-color: #fca5a5; color: #dc2626; }
.btn-danger:hover { background: #fef2f2; }
.btn-xs { padding: 4px 9px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }
.inline { display: inline-block; }

/* ── 폼 ───────────────────────────────── */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; font-weight: 600; color: #475569; margin-bottom: 5px; }
.form-row label em { color: #dc2626; font-style: normal; }
.form-row input[type="text"], .form-row input[type="password"], .form-row input[type="number"],
.form-row input[type="date"], .form-row input[type="datetime-local"], .form-row input[type="email"],
.form-row select, .form-row textarea {
    width: 100%; padding: 9px 12px; border: 1px solid #cbd5e1; border-radius: 8px;
    font-size: 14px; font-family: inherit; background: #fff; color: #1e293b;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
    outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.form-row input[disabled], .form-row input[readonly] { background: #f1f5f9; color: #64748b; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.rate-grid { grid-template-columns: repeat(4, 1fr); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.form-card { max-width: 980px; }
.hint { display: block; font-size: 12px; color: #94a3b8; margin-top: 4px; }
.rate-summary {
    background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 8px;
    padding: 10px 14px; font-size: 13.5px; margin-bottom: 16px;
}
.date-pair { display: flex; align-items: center; gap: 8px; }
.tilde { color: #94a3b8; }
.form-inline-lg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 16px; align-items: end; }
.form-row-btn { display: flex; align-items: flex-end; }

/* 필터 폼 */
.page-actions {
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.page-actions > div { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-form input[type="text"], .filter-form input[type="date"], .filter-form select {
    padding: 8px 11px; border: 1px solid #cbd5e1; border-radius: 8px;
    font-size: 13.5px; font-family: inherit; background: #fff;
}
.filter-form input[type="text"] { width: 190px; }

/* ── 알림 ─────────────────────────────── */
.alert {
    display: flex; align-items: flex-start; gap: 9px;
    padding: 12px 15px; border-radius: 10px; margin-bottom: 14px; font-size: 13.5px;
}
.alert i { margin-top: 2px; }
.alert-success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.alert-error   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── 탭 ───────────────────────────────── */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; border-bottom: 2px solid #e2e8f0; }
.tabs a {
    padding: 9px 16px; font-size: 14px; font-weight: 600; color: #64748b;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tabs a:hover { color: #334155; text-decoration: none; }
.tabs a.on { color: #2563eb; border-bottom-color: #2563eb; }

/* ── 페이저 ────────────────────────────── */
.pager { display: flex; gap: 5px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.pager a {
    min-width: 32px; height: 32px; padding: 0 8px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid #cbd5e1; border-radius: 7px; font-size: 13px; color: #475569;
}
.pager a:hover { background: #f1f5f9; text-decoration: none; }
.pager a.on { background: #2563eb; border-color: #2563eb; color: #fff; }

/* ── 기타 컴포넌트 ─────────────────────── */
.chart-box { height: 280px; position: relative; }
.stat-boxes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat-box {
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 14px;
}
.stat-box span { display: block; font-size: 12px; color: #64748b; }
.stat-box strong { display: block; font-size: 17px; letter-spacing: -.4px; margin-top: 2px; }
.stat-box small { font-size: 11.5px; color: #94a3b8; }
.mini-counts { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.mini-counts a {
    flex: 1; min-width: 110px; text-align: center; background: #f8fafc;
    border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px; font-size: 13px; color: #475569;
}
.mini-counts a:hover { background: #f1f5f9; text-decoration: none; }
.mini-counts strong { color: #1e293b; margin-left: 4px; }
.code-sample {
    background: #0f172a; color: #e2e8f0; border-radius: 10px;
    padding: 13px 15px; font-size: 13px; line-height: 1.7; overflow-x: auto;
    font-family: 'D2Coding', Consolas, monospace;
}
.info-list { padding-left: 18px; margin-top: 10px; font-size: 13.5px; color: #475569; }
.info-list li { margin-bottom: 5px; }
.log-register-form { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.log-register-form select, .log-register-form input {
    padding: 5px 8px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 12.5px; font-family: inherit;
}
.log-register-form input { width: 100px; }

/* ── 로그인 ────────────────────────────── */
.login-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%); padding: 20px;
}
.login-card {
    background: #fff; border-radius: 16px; padding: 38px 34px;
    width: 100%; max-width: 400px; box-shadow: 0 20px 50px rgba(0,0,0,.3);
}
.login-logo {
    width: 58px; height: 58px; border-radius: 14px; background: #2563eb; color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 25px; margin: 0 auto 14px;
}
.login-card h1 { text-align: center; font-size: 20px; letter-spacing: -.4px; }
.login-sub { text-align: center; color: #64748b; font-size: 13.5px; margin: 6px 0 22px; }

/* ── 인쇄 ─────────────────────────────── */
@media print {
    .adm-side, .adm-top, .page-actions, .adm-dim, .pager { display: none !important; }
    .adm-content { padding: 0; }
    .card { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
    body { background: #fff; }
}

/* ── 반응형 ────────────────────────────── */
@media (max-width: 1200px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .form-inline-lg { grid-template-columns: 1fr 1fr; }
    .rate-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 960px) {
    .adm-side {
        position: fixed; left: -240px; top: 0; height: 100vh;
        transition: left .22s ease; box-shadow: 4px 0 20px rgba(0,0,0,.25);
    }
    body.side-open .adm-side { left: 0; }
    body.side-open .adm-dim {
        display: block; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 45;
    }
    .adm-burger { display: block; }
    .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .adm-content { padding: 14px 12px 50px; }
    .adm-top { padding: 0 12px; }
    .kpi-grid, .kpi-grid.kpi-2 { grid-template-columns: 1fr 1fr; gap: 9px; }
    .kpi-card { padding: 12px; gap: 10px; }
    .kpi-ico { width: 38px; height: 38px; font-size: 15px; }
    .kpi-value { font-size: 16px; }
    .form-grid, .rate-grid, .form-inline-lg { grid-template-columns: 1fr; }
    .card { padding: 14px; border-radius: 10px; }
    .stat-boxes { grid-template-columns: 1fr 1fr; }
    .page-actions { flex-direction: column; align-items: stretch; }
    .page-actions .btn { justify-content: center; }
    .filter-form input[type="text"] { width: 100%; flex: 1; }
    .adm-date { display: none; }
}
