* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs-body)/1.6 var(--font);
  word-break: keep-all;
  overflow-wrap: anywhere;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.35; font-weight: 700; letter-spacing: -0.8px; text-wrap: balance; }
h2 { font-size: 18px; line-height: 1.35; font-weight: 700; letter-spacing: -0.4px; }
.eyebrow { display: block; color: var(--eyebrow); font-size: 10px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase; margin-bottom: 3px; }
h3 { font-size: 16px; font-weight: 700; }
a { color: var(--brand-strong); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand-mid); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: 8px; top: -60px; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-sm); z-index: 100; }
.skip-link:focus { top: 8px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 0.94em; }
.muted { color: var(--text-sub); }
.small { font-size: var(--fs-sub); }
.icon { display: inline-flex; width: 16px; height: 16px; flex: none; }
.icon svg { width: 100%; height: 100%; }

/* ── 머리말 ───────────────────────────────────────────── */
.app-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-inner { max-width: 1240px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 8px 20px; flex-wrap: wrap; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--text); text-decoration: none; padding: 8px 0; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 14px; font-weight: 800; }
.sample-badge { font-size: var(--fs-small); font-weight: 600; color: var(--warn); background: var(--warn-soft); border: 1px solid var(--warn-line); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.main-nav { display: flex; gap: 4px; align-self: stretch; }
.main-nav a { display: flex; align-items: center; padding: 0 14px; color: var(--text-sub); text-decoration: none; font-weight: 700; font-size: 15px; border-bottom: 3px solid transparent; border-top: 3px solid transparent; min-height: 44px; }
.main-nav a:hover { color: var(--text); }
.main-nav a[aria-current="page"] { color: var(--brand-ink); border-bottom-color: var(--brand); }
.header-user { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: var(--fs-sub); color: var(--text-sub); }
.role-chip { font-size: var(--fs-small); border: 1px solid var(--line-strong); border-radius: 999px; padding: 1px 8px; color: var(--text-sub); }

.app-main { max-width: 1240px; margin: 0 auto; padding: 28px 24px 120px; outline: none; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { color: var(--text-sub); font-size: var(--fs-sub); margin-top: 4px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sub); font-weight: 600; margin-bottom: 14px; text-decoration: none; }
.back-link:hover { text-decoration: underline; }

/* ── 버튼·입력 ────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 7px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 700; font-size: 15px; cursor: pointer; text-decoration: none; color: var(--text); white-space: nowrap; transition: background 0.15s, border-color 0.15s; }
.btn:hover { background: var(--surface-sub); border-color: #b4c5ba; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.page-head .btn-primary, .form-actions .btn-primary { min-height: 44px; padding: 0 18px; }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: var(--fs-sub); border-radius: 7px; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--brand-strong); }
.btn-ghost:hover { background: var(--brand-soft); border-color: transparent; }
.btn.is-done { background: var(--brand-soft); border-color: #b9cfc3; color: var(--brand-ink); }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.input, .select { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); }
.select { padding-right: 30px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%2356606b' stroke-width='1.8'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.input:focus, .select:focus { outline: 2px solid var(--brand-mid); outline-offset: 2px; }
.input[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--danger); }
.input[readonly] { background: var(--surface-sub); }
.field { display: grid; gap: 7px; margin-bottom: 17px; }
.field .input, .field .select { min-height: 48px; padding: 11px 13px; }
.field .input-prefix > input { min-height: 46px; }
.field > label, .field-label { font-weight: 700; font-size: 13px; }
.req { color: var(--danger); font-weight: 600; font-size: var(--fs-small); margin-left: 4px; }
.opt { color: var(--text-mute); font-weight: 400; font-size: var(--fs-small); margin-left: 4px; }
.hint { color: var(--text-sub); font-size: var(--fs-small); }
.field-error { color: var(--danger); font-size: var(--fs-sub); font-weight: 600; min-height: 0; }
.field-error:empty { display: none; }
.input-prefix { display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); overflow: hidden; }
.input-prefix:focus-within { outline: 2px solid var(--brand-mid); outline-offset: 2px; }
.input-prefix > span { display: flex; align-items: center; padding: 0 10px; background: var(--surface-sub); color: var(--text-sub); border-right: 1px solid var(--line); font-size: var(--fs-sub); white-space: nowrap; }
.input-prefix > input { border: 0; min-height: 38px; padding: 8px 10px; flex: 1; min-width: 0; outline: none; background: transparent; }

.alert { border-radius: 7px; padding: 12px 14px; font-size: var(--fs-sub); border: 1px solid; margin-bottom: 16px; }
.alert:empty { display: none; }
.alert-danger { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.alert-warn { background: var(--warn-soft); border-color: var(--warn-line); color: #5c440d; }
.alert-info { background: var(--info-soft); border-color: var(--info-line); color: var(--text); }
.alert strong { font-weight: 700; }

.badge { display: inline-flex; align-items: center; font-size: var(--fs-small); font-weight: 600; border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-mute { background: #e8eeea; color: var(--text-sub); }
.badge-brand { background: var(--brand-soft); color: var(--brand-ink); }
.chip { display: inline-flex; align-items: center; font-size: var(--fs-sub); border: 1px solid var(--line); background: var(--surface-sub); border-radius: 999px; padding: 1px 10px; color: var(--text-sub); white-space: nowrap; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.section { margin-top: 20px; }

/* ── 상태(로딩·오류·빈 화면) ─────────────────────────── */
.state { min-height: 280px; display: grid; place-content: center; justify-items: center; gap: 8px; text-align: center; padding: 32px 20px; color: var(--text-sub); }
.state h3 { color: var(--text); font-size: 17px; }
.state .btn { margin-top: 8px; }
.state-sm { min-height: 140px; }
.skeleton { display: grid; gap: 10px; padding: 18px 20px; min-height: 280px; align-content: start; }
.skeleton span { display: block; height: 18px; border-radius: 6px; background: linear-gradient(90deg, #e8eeea 0%, #f4f7f5 50%, #e8eeea 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skeleton span:nth-child(odd) { width: 92%; }
.skeleton span:nth-child(3n) { width: 74%; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton span, .spinner { animation: none; } }

/* ── 링크 관리: 도구 모음 ─────────────────────────────── */
.toolbar { padding: 16px 20px; display: grid; gap: 12px; }
.toolbar-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.tfield { display: grid; gap: 4px; min-width: 0; }
.tfield > label, .tfield > .tlabel { font-size: var(--fs-small); font-weight: 700; color: var(--text); }
.tfield-search { flex: 1 1 280px; }
.tfield-select { flex: 0 1 170px; }
.search-box { position: relative; }
.search-box .icon { position: absolute; left: 12px; top: 12px; color: var(--text-mute); }
.search-box .input { padding-left: 36px; }
.filter-toggle { display: none; }
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 7px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; min-height: 38px; padding: 0 12px; font-size: var(--fs-sub); font-weight: 600; color: var(--text-sub); cursor: pointer; border-left: 1px solid var(--line); white-space: nowrap; }
.seg button:first-child { border-left: 0; }
.seg button:hover { background: var(--surface-sub); }
.seg button[aria-pressed="true"] { background: var(--brand); color: #fff; }
.seg button:focus-visible { box-shadow: inset 0 0 0 2px var(--brand-mid); border-radius: 0; }
.period { display: grid; gap: 8px; justify-items: start; }
.period-custom { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: var(--fs-sub); }
.period-custom .input { width: auto; min-height: 36px; padding: 4px 8px; }
.period-range { font-size: var(--fs-small); color: var(--text-sub); }

.result-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--line); font-size: var(--fs-sub); color: var(--text-sub); }
.result-bar strong { color: var(--text); }
.results { min-height: 280px; }

/* ── 표 ───────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: 0.2px; color: var(--eyebrow); background: var(--surface-sub); padding: 10px 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: var(--fs-sub); }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table tbody tr:hover { background: #fafcfb; }
.table .t-right { text-align: right; }
.table .name-cell a { font-size: var(--fs-body); font-weight: 600; color: var(--text); text-decoration: none; }
.table .name-cell a:hover { color: var(--brand-strong); text-decoration: underline; }
.th-sort { border: 0; background: none; font: inherit; color: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px; margin: -2px -4px; border-radius: 4px; }
.th-sort:hover { color: var(--text); }
.th-sort[data-active="true"] { color: var(--brand-ink); }
.short-cell { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.clicks-link { font-size: var(--fs-body); font-weight: 700; color: var(--text); text-decoration: none; }
.clicks-link:hover { color: var(--brand-strong); text-decoration: underline; }
.clicks-wrap { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); min-width: 150px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; box-shadow: var(--shadow); padding: 4px; z-index: 10; display: grid; }
.menu-list a, .menu-list button { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; border: 0; background: none; text-align: left; text-decoration: none; color: var(--text); font-size: var(--fs-sub); cursor: pointer; white-space: nowrap; }
.menu-list a:hover, .menu-list button:hover { background: var(--surface-sub); }

.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 14px 20px; font-size: var(--fs-sub); color: var(--text-sub); }

/* 휴대폰용 카드 목록 */
.link-cards { display: none; list-style: none; margin: 0; padding: 0; }
.link-card { padding: 14px 16px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.link-card .lc-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.link-card .lc-name { font-weight: 600; color: var(--text); text-decoration: none; }
.link-card .lc-clicks { text-align: right; flex: none; }
.link-card .lc-clicks small { display: block; font-size: 12px; color: var(--text-mute); }
.link-card .lc-short { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.link-card details summary { font-size: var(--fs-sub); color: var(--brand-strong); font-weight: 600; cursor: pointer; padding: 4px 0; }
.link-card dl { margin: 6px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: var(--fs-sub); }
.link-card dt { color: var(--text-mute); }
.link-card dd { margin: 0; }
.lc-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ── 겹침 화면(옆 패널·대화상자) ─────────────────────── */
.overlay { position: fixed; inset: 0; z-index: 50; display: flex; }
.overlay-backdrop { position: absolute; inset: 0; background: rgba(22, 40, 32, 0.45); }
.overlay-box { position: relative; background: var(--surface); display: flex; flex-direction: column; box-shadow: var(--shadow); outline: none; max-height: 100%; }
.overlay--panel { justify-content: flex-end; }
.overlay--panel .overlay-box { width: min(480px, 100%); height: 100%; animation: slide-in 0.18s ease-out; }
.overlay--dialog { align-items: center; justify-content: center; padding: 20px; }
.overlay--dialog .overlay-box { width: min(560px, 100%); border-radius: 16px; max-height: calc(100vh - 40px); }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .overlay--panel .overlay-box { animation: none; } }
.overlay-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.overlay-body { padding: 20px; overflow-y: auto; flex: 1; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
.options { border: 1px solid var(--line); border-radius: 7px; margin-bottom: 18px; }
.options > summary { padding: 12px 14px; font-weight: 600; cursor: pointer; font-size: 15px; }
.options > div { padding: 4px 14px 2px; }
.success-box { display: grid; gap: 14px; }
.success-box .ok-mark { width: 44px; height: 44px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.success-box .ok-mark .icon { width: 22px; height: 22px; }
.copy-row { display: flex; gap: 8px; }
.copy-row .input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 15px; }
.compare { display: grid; gap: 4px; background: var(--surface-sub); border: 1px solid var(--line); border-radius: 7px; padding: 10px 12px; margin-bottom: 16px; font-size: var(--fs-sub); }
.compare b { font-size: var(--fs-small); color: var(--text-sub); }

.toast-region { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--text); color: #fff; padding: 10px 16px; border-radius: 7px; font-size: var(--fs-sub); box-shadow: var(--shadow); }

/* ── 상세 ─────────────────────────────────────────────── */
.detail-head { display: grid; gap: 14px; }
.detail-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 10px 16px; align-items: start; margin: 0; }
.kv dt { color: var(--text-sub); font-size: var(--fs-sub); padding-top: 2px; }
.kv dd { margin: 0; min-width: 0; display: flex; gap: 8px 12px; align-items: center; flex-wrap: wrap; }
.short-big { font-family: var(--mono); font-size: 18px; font-weight: 600; }
.dest-url { word-break: break-all; font-size: var(--fs-sub); flex: 1 1 320px; }
.stat-row { display: flex; gap: 12px 32px; flex-wrap: wrap; align-items: flex-end; margin: 6px 0 16px; }
.stat .stat-label { font-size: var(--fs-small); font-weight: 700; color: var(--text-sub); }
.stat .stat-value { font-size: 34px; line-height: 1.15; font-weight: 700; letter-spacing: -1px; }
.stat.sub .stat-value { font-size: 20px; font-weight: 600; color: var(--text-sub); }
.metric-note { font-size: var(--fs-small); color: var(--text-sub); }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.history li { border-left: 3px solid var(--line-strong); padding: 2px 0 2px 14px; font-size: var(--fs-sub); }
.history .h-meta { color: var(--text-sub); }
.history .h-url { word-break: break-all; }
.demo-box { border: 1px dashed var(--warn-line); background: #fdfaf0; border-radius: var(--radius); padding: 16px 20px; }
.demo-box h2 { font-size: 16px; }
.demo-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 8px; }
.demo-log { font-size: var(--fs-sub); min-height: 22px; }

/* ── 차트 ─────────────────────────────────────────────── */
.chart { display: grid; grid-template-columns: auto 1fr; gap: 0 8px; }
.chart-y { display: flex; flex-direction: column; justify-content: space-between; height: 180px; font-size: 12px; color: var(--text-mute); text-align: right; min-width: 24px; }
.chart-plot { position: relative; height: 180px; display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--line-strong); background: linear-gradient(to bottom, var(--line) 1px, transparent 1px) 0 0 / 100% 50%; }
.chart-col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.chart-bar { width: 100%; max-width: 44px; background: var(--brand); border-radius: 3px 3px 0 0; min-height: 0; }
.chart-col:hover .chart-bar { background: var(--brand-strong); }
.chart-val { font-size: 12px; color: var(--text-sub); line-height: 1.3; position: relative; }
.chart-bar { position: relative; }
.chart-col.is-check::before, .chart-col.is-pending::before { content: ""; position: absolute; inset: 0 8%; border-radius: 3px; }
.chart-col.is-check::before { background: repeating-linear-gradient(45deg, #ecdcae 0 5px, #fbf5e3 5px 10px); }
.chart-col.is-pending::before { border: 1.5px dashed var(--line-strong); }
.chart-col.is-check .chart-bar { position: relative; opacity: 0.85; }
.chart-col.is-na { background: repeating-linear-gradient(90deg, transparent 0 3px, #e9eeeb 3px 4px); }
.chart-marker { position: absolute; top: 0; bottom: 0; border-left: 2px dashed var(--marker); pointer-events: none; }
.chart-x { grid-column: 2; display: flex; gap: 2px; font-size: 12px; color: var(--text-mute); margin-top: 4px; }
.chart-x span { flex: 1; min-width: 0; text-align: center; white-space: nowrap; overflow: visible; }
.chart-legend { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: var(--fs-small); color: var(--text-sub); margin-top: 10px; }
.chart-legend i { display: inline-block; width: 12px; height: 12px; vertical-align: -1px; margin-right: 5px; border-radius: 2px; }
.lg-check { background: repeating-linear-gradient(45deg, #ecdcae 0 3px, #fbf5e3 3px 6px); }
.lg-pending { border: 1.5px dashed var(--line-strong); }
.lg-marker { border-left: 2px dashed var(--marker); border-radius: 0 !important; width: 2px !important; }
.lg-na { background: repeating-linear-gradient(90deg, #fff 0 3px, #d5ddd8 3px 4px); }
.chart-table { margin-top: 12px; font-size: var(--fs-sub); }
.chart-table summary { cursor: pointer; color: var(--brand-strong); font-weight: 600; }
.chart-table table { border-collapse: collapse; margin-top: 8px; width: 100%; max-width: 520px; }
.chart-table th, .chart-table td { text-align: left; padding: 5px 10px 5px 0; border-bottom: 1px solid var(--line); }
.chart-table td.t-right, .chart-table th.t-right { text-align: right; }

/* ── 통계 ─────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.kpi { padding: 22px 24px; }
.kpi .stat-value { font-size: 30px; }
.kpi.sub .stat-value { font-size: 24px; color: var(--text-sub); font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.hbar-top { display: flex; justify-content: space-between; gap: 12px; font-size: var(--fs-sub); }
.hbar-top .hbar-label { font-weight: 600; }
.hbar-track { height: 8px; background: #e8eeea; border-radius: 4px; margin-top: 5px; overflow: hidden; }
.hbar-fill { height: 100%; background: var(--brand); border-radius: 4px; }
.hbar-total { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 12px; font-weight: 700; font-size: var(--fs-sub); }
.rank { width: 28px; color: var(--text-mute); }
.rank-bar { height: 6px; background: var(--brand); border-radius: 3px; margin-top: 4px; min-width: 2px; }

/* ── 설정·로그인·공개 링크 ───────────────────────────── */
.invite-form { display: grid; grid-template-columns: 1fr 1.4fr 140px auto; gap: 12px; align-items: end; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: var(--fs-sub); }
.switch input { width: 18px; height: 18px; accent-color: var(--brand); }
.narrow { max-width: 460px; margin: 24px auto 0; }
.account-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.account-list button { width: 100%; display: flex; justify-content: space-between; gap: 8px; align-items: center; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 7px; padding: 8px 12px; cursor: pointer; font-size: var(--fs-sub); }
.account-list button:hover { background: var(--surface-sub); }

/* ── 프로토타입 도구 ─────────────────────────────────── */
.proto { position: fixed; right: 16px; bottom: 16px; z-index: 40; display: grid; justify-items: end; gap: 8px; }
.proto-toggle { background: var(--text); color: #fff; border: 0; border-radius: 999px; padding: 9px 16px; font-size: var(--fs-sub); font-weight: 600; cursor: pointer; box-shadow: var(--shadow); }
.proto-toggle:hover { background: #16261f; }
.proto-panel { width: min(330px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 16px; display: grid; gap: 14px; font-size: var(--fs-sub); max-height: calc(100vh - 90px); overflow-y: auto; }
.proto-panel h2 { font-size: 15px; }
.proto-panel fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.proto-panel legend { font-weight: 700; padding: 0; margin-bottom: 6px; font-size: var(--fs-small); color: var(--text-sub); }
.proto-panel label { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.proto-panel input[type="checkbox"] { width: 16px; height: 16px; margin-top: 3px; accent-color: var(--brand); flex: none; }

/* ── 반응형 ───────────────────────────────────────────── */
@media (max-width: 960px) {
  .app-main { padding: 22px 16px 120px; }
  .header-inner { padding: 0 16px; }
  .invite-form { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  h1 { font-size: 21px; }
  .header-inner { gap: 0 10px; padding-top: 6px; }
  .brand { font-size: 16px; }
  .main-nav { order: 5; flex: 1 0 auto; margin-left: -8px; }
  .main-nav a { padding: 0 8px; white-space: nowrap; }
  .header-user { order: 6; margin-left: 0; gap: 6px; white-space: nowrap; }
  .header-user .user-name { display: none; }
  .page-head .btn-primary { width: 100%; min-height: 46px; }
  .toolbar { padding: 14px 16px; }
  .filter-toggle { display: inline-flex; }
  .filters { display: none; width: 100%; }
  .filters.is-open { display: grid; grid-template-columns: 1fr 1fr; }
  .filters .tfield-period { grid-column: 1 / -1; }
  .tfield-select { flex: 1 1 auto; }
  .period { justify-items: stretch; }
  .seg { display: flex; }
  .seg button { flex: 1; padding: 0 6px; }
  .result-bar { padding: 12px 16px; }
  .overlay--panel .overlay-box { width: 100%; }
  .overlay--dialog { padding: 0; align-items: flex-end; }
  .overlay--dialog .overlay-box { width: 100%; border-radius: 16px 14px 0 0; max-height: 92vh; }
  .card-pad { padding: 16px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 10px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpis .kpi:first-child { grid-column: 1 / -1; }
  .grid-2 { grid-template-columns: 1fr; }
  .invite-form { grid-template-columns: 1fr; }
  .stack-table thead { display: none; }
  .stack-table tr { display: grid; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .stack-table td { border: 0; padding: 0 !important; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
  .stack-table td::before { content: attr(data-label); color: var(--text-mute); font-size: var(--fs-small); flex: none; }
  .stack-table td.t-right { text-align: left; }
  .hide-sm { display: none; }
  .chart-val { display: none; }
  .form-actions .btn { flex: 1; }
}

/* 표 칸 폭 다듬기 */
.table .name-cell { min-width: 220px; }
.table .col-created, .table td.t-right { white-space: nowrap; }
@media (max-width: 720px) {
  .card-head .period { width: 100%; }
}

/* ── 로그인 카드 ─────────────────────────────────────── */
.login-wrap { max-width: 430px; margin: 16px auto 0; }
.login-card { padding: 36px 40px 40px; }
.login-brand { display: grid; justify-items: center; gap: 2px; padding-bottom: 27px; margin-bottom: 27px; border-bottom: 1px solid var(--line); }
.login-brand .brand-mark { width: 52px; height: 52px; border-radius: 14px; font-size: 26px; margin-bottom: 8px; }
.login-brand strong { font-size: 20px; letter-spacing: -0.6px; line-height: 1.2; }
.login-brand span.en { font-size: 9px; font-weight: 700; letter-spacing: 1.2px; color: var(--text); }
.login-heading { text-align: center; }
.login-heading p { color: var(--text-sub); font-size: 13px; margin-top: 8px; }
.login-card form { margin-top: 27px; }
.login-card .btn-primary { width: 100%; min-height: 48px; margin-top: 6px; }
@media (max-width: 480px) {
  .login-card { padding: 28px 25px 30px; }
  .login-brand { padding-bottom: 22px; margin-bottom: 22px; }
}

/* 표가 들어가지 않는 폭에서는 글자를 줄이지 않고 카드 목록으로 바꿉니다. */
/* 옆 메뉴(208px)를 뺀 폭 기준 */
@media (max-width: 1340px) {
  .table-wrap { display: none; }
  .link-cards { display: block; }
}
.table-wrap { overflow-x: auto; }
.table .name-cell { min-width: 190px; }


/* ════════════════════════════════════════════════════════
   리치스쿨 방문 현황(로그인 뒤 화면) 구성에 맞춘 배치
   PC: 흰 옆 메뉴 + 흰 제목 띠 / 좁은 화면: 위 머리말 + 알약 모양 메뉴
   ════════════════════════════════════════════════════════ */
.brand-text { display: grid; line-height: 1.15; }
.brand-text strong { font-size: 17px; letter-spacing: -0.5px; }
.brand-text small { font-size: 11px; font-weight: 700; color: var(--text-sub); letter-spacing: 0.2px; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; font-size: 17px; }
.side-label, .site-label { display: none; font-size: 11px; color: var(--text-sub); }
.main-nav a { gap: 10px; }
.main-nav a .icon { width: 17px; height: 17px; }

/* 패널: 테두리 없이 아주 옅은 그림자 */
.card { border: 0; border-radius: 10px; box-shadow: 0 2px 6px rgba(28, 81, 63, 0.04); }
.login-card { border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm); }
h2 { font-size: 16px; letter-spacing: -0.3px; }

/* 제목 띠 */
.app-main { padding-top: 0; }
.app-main > :first-child:not(.page-head) { margin-top: 20px; }
.page-head { margin: 0 -24px 20px; padding: 16px 24px; min-height: 84px; align-items: center; background: var(--surface); border-bottom: 1px solid var(--line); }
.page-head .sub { font-size: var(--fs-small); margin-top: 2px; }

/* 기간 선택: 연한 바탕 위 흰 선택 칸 */
.seg { border: 0; background: #e9efeb; padding: 3px; gap: 3px; border-radius: 7px; overflow: visible; }
.seg button { border: 0; border-radius: 5px; min-height: 34px; padding: 0 15px; font-weight: 400; color: var(--text); }
.seg button:hover { background: rgba(255, 255, 255, 0.55); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--brand); font-weight: 700; box-shadow: 0 1px 4px rgba(37, 61, 34, 0.08); }
.seg button:focus-visible { box-shadow: none; outline: 2px solid var(--brand-mid); outline-offset: 2px; border-radius: 5px; }

/* 숫자 */
.stat .stat-value, .clicks-link, .rank-badge { font-family: Manrope, "Noto Sans KR", var(--font); }
.stat .stat-value { font-weight: 600; color: #1d4c3a; letter-spacing: -1px; }
.stat.sub .stat-value { color: #1d4c3a; }
.stat .stat-label { color: var(--text); }

/* 지표 3칸을 한 패널로 */
.kpis { gap: 0; background: var(--surface); border-radius: 10px; box-shadow: 0 2px 6px rgba(28, 81, 63, 0.04); padding: 21px 0 18px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis .kpi { background: none; box-shadow: none; border-radius: 0; padding: 0 24px; grid-column: auto !important; }
.kpis .kpi + .kpi { border-left: 1px solid var(--line); }
.kpi .stat-value, .kpi.sub .stat-value { font-size: 34px; font-weight: 600; }

/* 표 */
.table th { font-size: 12px; font-weight: 400; letter-spacing: 0; color: var(--text-sub); background: #f7f9f8; border-color: #e7ece8; padding-top: 8px; padding-bottom: 8px; }
.table td { border-bottom-color: #e7ece8; }
.table tbody tr:last-child td { border-bottom: 0; }
.link-card { border-top-color: #e7ece8; }
.result-bar { border-top-color: #e7ece8; }
.rank { width: 56px; }
.rank-badge { display: inline-grid; place-items: center; width: 25px; height: 28px; border-radius: 6px 6px 10px 10px; background: #d8e8de; color: #24513c; font-size: 11px; font-weight: 800; }
.rank-badge.is-top { background: var(--brand); color: #fff; box-shadow: 0 2px 4px rgba(28, 81, 63, 0.125); }
.rank-bar { background: var(--brand-mid); }

/* 차트 */
.chart-bar { background: var(--brand-mid); border-radius: 4px 4px 0 0; }
.chart-col:hover .chart-bar { background: var(--brand); }
.chart-plot { border-bottom-color: var(--line); background: repeating-linear-gradient(to right, var(--line) 0 4px, transparent 4px 8px) 0 0 / 100% 1px no-repeat, repeating-linear-gradient(to right, var(--line) 0 4px, transparent 4px 8px) 0 50% / 100% 1px no-repeat; }
.hbar-fill { background: var(--brand-mid); }

/* 버튼 */
.btn { border-radius: 7px; font-size: 14px; font-weight: 500; }
.btn-primary { font-weight: 700; }
.btn-sm { font-size: 13px; }

@media (min-width: 1101px) {
  .app-header { position: fixed; inset: 0 auto 0 0; width: 208px; border-bottom: 0; border-right: 1px solid var(--line); }
  .header-inner { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 0; height: 100%; max-width: none; padding: 26px 12px 20px; }
  .brand { padding: 0 8px; }
  .sample-badge { align-self: flex-start; margin: 14px 8px 0; }
  .side-label { display: block; padding: 0 8px; margin: 26px 0 10px; }
  .main-nav { flex-direction: column; align-self: auto; gap: 5px; }
  .main-nav a { border: 0; border-radius: 7px; min-height: 46px; padding: 0 13px; font-size: 14px; font-weight: 400; color: var(--text); }
  .main-nav a:hover { background: var(--brand-soft); }
  .main-nav a[aria-current="page"] { background: var(--brand); color: #fff; font-weight: 700; box-shadow: 0 2px 4px rgba(28, 81, 63, 0.12); }
  .header-user { margin: auto 0 0; flex-direction: column; align-items: stretch; gap: 10px; }
  .site-label { display: block; padding: 14px 8px 4px; border-top: 1px solid var(--line); }
  .header-user .user-name { padding: 0 8px; color: var(--text); font-weight: 700; }
  .header-user .role-chip { align-self: flex-start; margin-left: 8px; }
  .header-user .btn { justify-content: flex-start; border: 0; background: none; color: var(--text-sub); padding: 0 8px; font-size: 13px; }
  .header-user .btn:hover { background: var(--brand-soft); }
  .app-main { margin-left: 208px; max-width: 1510px; padding-left: 24px; padding-right: 24px; }
  body:has(.login-wrap) .app-main, body:has(.narrow) .app-main { margin-left: auto; margin-right: auto; }
}

@media (max-width: 1100px) {
  .header-inner { gap: 6px 12px; padding-top: 10px; min-height: 0; }
  .header-user { margin-left: auto; }
  .main-nav { order: 5; width: 100%; flex: none; margin: 0; gap: 6px; padding: 4px 0 10px; }
  .main-nav a { border: 0; border-radius: 8px; min-height: 40px; padding: 0 14px; font-size: 14px; font-weight: 400; color: var(--text-sub); white-space: nowrap; }
  .main-nav a[aria-current="page"] { background: var(--brand); color: #fff; font-weight: 700; }
  .main-nav a .icon { display: none; }
  .page-head { margin-left: -16px; margin-right: -16px; padding: 14px 16px; min-height: 0; }
}
@media (max-width: 720px) {
  .header-user { order: 0; }
  .header-user .role-chip { display: none; }
  .kpis .kpi { padding: 0 12px; }
  .kpi .stat-value, .kpi.sub .stat-value { font-size: 24px; }
  .kpi .stat-value .small { display: block; }
}

/* ── 공식 로고 ───────────────────────────────────────── */
.brand { gap: 8px; }
.brand-logo { display: block; width: 141px; height: auto; }
.brand-product { font-size: 11px; font-weight: 700; color: var(--eyebrow); border: 1px solid var(--line-strong); border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.login-brand img { display: block; width: 122px; height: auto; }
@media (min-width: 1101px) {
  .brand { flex-direction: column; align-items: flex-start; gap: 10px; }
  .brand-logo { width: 150px; }
}
@media (max-width: 720px) {
  .brand-logo { width: 112px; }
  .sample-badge { font-size: 12px; padding: 1px 8px; }
}
@media (max-width: 480px) { .login-brand img { width: 107px; } }

/* ════════════════════════════════════════════════════════
   추가 기능: 새로고침·집계 상태·복제·보관·캠페인 범위·표시 단위
   ════════════════════════════════════════════════════════ */
.refresh { margin-bottom: 14px; display: grid; gap: 10px; }
.refresh-row { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; }
.refresh-info { display: inline-flex; gap: 4px 14px; flex-wrap: wrap; align-items: center; font-size: var(--fs-small); color: var(--text-sub); font-variant-numeric: tabular-nums; }
.refresh-alert { margin: 0; }
.refresh-alert .btn { margin-left: 6px; vertical-align: baseline; }

.csv-control { display: inline-flex; gap: 6px; align-items: center; }
.select-sm { width: auto; min-height: 32px; padding: 3px 28px 3px 10px; font-size: var(--fs-small); border-radius: 7px; }
.page-head .csv-control .btn { min-height: 40px; }
.page-head .csv-control .select-sm { min-height: 40px; font-size: var(--fs-sub); }

.link-btn { border: 0; background: none; padding: 0; font: inherit; font-weight: inherit; color: var(--brand); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; text-align: left; }
.link-btn:hover { color: var(--brand-strong); }
.hbar-label .link-btn { font-weight: 700; color: var(--text); text-decoration-color: var(--line-strong); }

.chip-link { text-decoration: none; color: var(--text-sub); }
.chip-link:hover { border-color: var(--brand-mid); color: var(--brand); background: var(--brand-soft); }
.chip-none { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.chip-on { background: var(--brand-soft); border-color: #b9cfc3; color: var(--brand); font-weight: 700; padding-right: 4px; gap: 4px; }
.chip-x { border: 0; background: none; color: inherit; cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 6px; border-radius: 999px; }
.chip-x:hover { background: rgba(28, 81, 63, 0.12); }
.scope-line { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.scope-label { font-size: var(--fs-small); font-weight: 700; color: var(--text-sub); }
.analytics-filters { display: flex; }

.seg button:disabled { color: #a9b3ad; cursor: not-allowed; }
.seg button:disabled:hover { background: transparent; }
.unit-picker { display: flex; gap: 6px 12px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.unit-picker .hint { max-width: 420px; }
.chart-tools { display: flex; gap: 10px 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.chart-tools .unit-picker { justify-content: flex-start; }

.name-block { min-width: 0; }
.name-sub { display: flex; gap: 6px; align-items: center; margin-top: 2px; min-width: 0; }
.dest-host { font-size: 12px; color: var(--text-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; max-width: 260px; }
.link-card .name-block { flex: 1; }
.link-card .dest-host { max-width: 100%; }
.is-archived .name-block > a { color: var(--text-sub); }
.list-hint { margin: 0; padding: 10px 20px; font-size: var(--fs-sub); color: var(--text-sub); background: var(--surface-sub); border-top: 1px solid #e7ece8; }
.menu-list button { width: 100%; font-family: inherit; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stat .stat-value .badge { font-family: var(--font); font-size: var(--fs-small); letter-spacing: 0; vertical-align: middle; }
.stat .stat-value .clicks-wrap { justify-content: flex-start; gap: 10px; }
.result-bar .clicks-wrap { vertical-align: baseline; }

/* 차트: 일부만 집계된 구간과 기록이 없는 구간 */
.chart-col.is-partial::before, .chart-col.is-nodata::before { content: ""; position: absolute; inset: 0 8%; border-radius: 3px; }
.chart-col.is-partial::before { background: repeating-linear-gradient(45deg, #f1e7c6 0 4px, transparent 4px 9px); }
.chart-col.is-nodata::before { background: repeating-linear-gradient(0deg, #e3e9e5 0 2px, transparent 2px 7px); }
.lg-partial { background: repeating-linear-gradient(45deg, #e3d39c 0 3px, #fbf5e3 3px 6px); }
.lg-nodata { background: repeating-linear-gradient(0deg, #cfd8d2 0 2px, #fff 2px 4px); }

@media (max-width: 720px) {
  .seg-wrap { flex-wrap: wrap; }
  .seg-wrap button { flex: 1 1 30%; }
  .unit-picker { justify-content: flex-start; }
  .analytics-filters { display: grid; grid-template-columns: 1fr 1fr; }
  .analytics-filters .tfield-period { grid-column: 1 / -1; }
  .page-head .csv-control { width: 100%; }
  .page-head .csv-control .select-sm { flex: 1; }
  .detail-actions .btn { flex: 1; }
  .refresh-info { gap: 2px 10px; }
  .list-hint { padding: 10px 16px; }
}

/* 설정: 로그인 상태 칸 */
.login-cell { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
