:root {
  --bg: #f5f6f8; --surface: #fff; --text: #1a1d23; --muted: #646b78; --line: #e2e5ea;
  --accent: #5865f2; --accent-text: #fff; --danger: #d83c3e; --ok: #1f9d55;
  --radius: 12px;
  --series-1: #2a78d6; --series-2: #eb6834; --grid: #e6e8ec;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101216; --surface: #181b21; --text: #e8eaee; --muted: #9aa1ad; --line: #272b33;
    --accent: #7983f5; --accent-text: #0e1020; --danger: #ff6b6d; --ok: #4cd08a;
    --series-1: #3987e5; --series-2: #d95926; --grid: #262a32;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 system-ui, -apple-system, "Segoe UI", "Noto Sans KR", sans-serif; }
a { color: var(--accent); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.user { display: flex; align-items: center; gap: 10px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--line); object-fit: cover; flex: none; }
.wrap { max-width: 880px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 1.4rem; margin: 0 0 4px; }
h2 { font-size: 1.05rem; margin: 0 0 12px; }
.muted { color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-top: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 16px; }
.server { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none; }
.server:hover, .server:focus-visible { border-color: var(--accent); outline: none; }
.server .avatar { width: 40px; height: 40px; border-radius: 12px; }
.server span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button, .btn { font: inherit; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; display: inline-block; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button:disabled { opacity: .55; cursor: default; }
button:focus-visible, .btn:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.slider-row { display: flex; align-items: center; gap: 14px; margin: 14px 0; }
.slider-row input[type=range] { flex: 1; accent-color: var(--accent); min-width: 0; }
.pct { min-width: 3.5em; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .title { overflow-wrap: anywhere; }
.badge { padding: 2px 10px; border-radius: 999px; font-size: .85rem; font-weight: 600; background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); white-space: nowrap; }
.badge.minus { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.status { margin-left: 12px; font-size: .9rem; }
.status.ok { color: var(--ok); } .status.err { color: var(--danger); }
.crumbs { margin-bottom: 8px; }
.empty { padding: 28px 0; text-align: center; }
@media (max-width: 520px) { .slider-row { flex-wrap: wrap; } }

/* ── 서버 화면 ── */
.stack { display: grid; gap: 16px; } .stack > .card { margin-top: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; } .two > .card { margin-top: 0; }
@media (max-width: 720px) { .two { grid-template-columns: 1fr; } }
.small { font-size: .85rem; }
.grow { flex: 1; min-width: 0; }
.pad { padding: 10px 12px; }
.tabs { display: flex; gap: 4px; margin: 14px 0 16px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { padding: 8px 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.tab[aria-current=page] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 560px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile-label { color: var(--muted); font-size: .85rem; }
.tile-value { font-size: 1.5rem; font-weight: 650; margin-top: 2px; overflow-wrap: anywhere; }
.field { display: grid; gap: 6px; margin: 12px 0; } .field.inline { display: flex; align-items: center; gap: 10px; }
.field label { font-weight: 600; font-size: .9rem; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0; }
input.num { width: 5em; } textarea { resize: vertical; width: 100%; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0 6px; } .actions .status { margin-left: 4px; }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
button.small, .btn.small { padding: 5px 12px; font-size: .85rem; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; }
.linkish:hover { text-decoration: underline; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); }
.chip .x { border: 0; background: none; padding: 0 2px; color: var(--muted); cursor: pointer; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; } .chips:empty { display: none; }
.target { position: relative; }
.results { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgb(0 0 0 / .18); max-height: 260px; overflow: auto; }
.result { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; border-radius: 0; text-align: left; background: none; padding: 8px 12px; }
.result:hover, .result:focus-visible { background: var(--bg); }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.filters input[type=search] { flex: 1; min-width: 140px; }
.pager { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.list.busy { opacity: .55; transition: opacity .15s; }
.badge.minus { background: color-mix(in srgb, var(--ok) 16%, transparent); }
.badge.neutral { background: var(--line); color: var(--muted); }
/* ── 차트 ── */
.chart-stage { position: relative; }
.chart svg { display: block; max-width: 100%; }
.chart .grid { stroke: var(--grid); stroke-width: 1; } .chart .axis { stroke: var(--muted); stroke-width: 1; opacity: .55; }
.chart .tick { fill: var(--muted); font-size: 11px; } .chart .direct { fill: var(--muted); font-size: 11px; }
.chart path.s1 { fill: var(--series-1); } .chart path.s2 { fill: var(--series-2); }
.chart .col { transition: opacity .1s; } .chart:has(.hot) .col:not(.hot) { opacity: .45; }
.chart .hit { fill: transparent; } .chart .hit:focus-visible { outline: none; stroke: var(--accent); stroke-width: 2; }
.legend { display: flex; gap: 16px; font-size: .85rem; color: var(--muted); margin: 6px 0; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.tip-row { display: flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 12px; height: 4px; border-radius: 2px; } .key.s1 { background: var(--series-1); } .key.s2 { background: var(--series-2); }
.tooltip { position: absolute; top: 0; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; box-shadow: 0 6px 18px rgb(0 0 0 / .18); font-size: .85rem; white-space: nowrap; z-index: 3; }
.tooltip[hidden] { display: none; }
.tip-title { color: var(--muted); margin-bottom: 4px; } .tip-row strong { font-size: 1rem; min-width: 1.4em; text-align: right; }
.table-view { margin-top: 8px; } .table-view summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.data-table { border-collapse: collapse; margin-top: 8px; font-size: .85rem; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 3px 14px 3px 0; text-align: left; border-bottom: 1px solid var(--line); }

/* ── 티켓 ── */
.checklist { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; background: var(--bg); }
.field label.check, .check { font-weight: 400; }
.check { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; font-weight: 400; }
.check[hidden] { display: none; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.field select, .field input[type=text] { width: 100%; }
.field.inline input { width: auto; }
.row .btn.small { white-space: nowrap; }

/* ── 금지어 ── */
.check.big { font-size: 1.05rem; font-weight: 600; }
.duration { display: grid; gap: 6px; }
.duration select, .duration input[type=text] { width: 100%; }
.duration input[hidden], .duration span[hidden] { display: none; }
.addbox { padding: 12px 0 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.inline-fields { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.inline-fields .field { margin: 12px 0; flex: 1 1 200px; }
.inline-fields label.small { display: flex; align-items: center; gap: 6px; }
.row.edit { align-items: flex-start; } .row .editor { display: grid; gap: 8px; }
.row .editor input[type=text] { width: 100%; }
.row code, .title code { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; margin-right: 4px; overflow-wrap: anywhere; }
.row .right { text-align: right; max-width: 40%; }

.msg { margin-top: 6px; padding: 8px 10px; background: var(--bg); border-left: 3px solid var(--danger); border-radius: 6px; font-size: .92rem; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-body.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.msg mark { background: color-mix(in srgb, var(--danger) 28%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }
.preview { background: var(--bg); border: 1px dashed var(--line); border-radius: 8px; padding: 8px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.section-title { margin: 20px 0 4px; font-size: 1rem; }

.thumbs { display: flex; flex-wrap: wrap; gap: 8px; } .thumbs:empty { display: none; }
.thumbs img { height: 80px; max-width: 140px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); }
.thumbs img.broken { opacity: .35; outline: 2px dashed var(--danger); }
.field input[type=url] { width: 100%; }

/* 목록 행의 동작 버튼: 좁은 화면에서는 아래 줄로 내려가 가로 스크롤이 생기지 않게 */
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 600px) { .row.wrap { flex-wrap: wrap; } .row.wrap .row-actions { width: 100%; justify-content: flex-start; padding-left: 38px; } }

/* 로그 탭: 카테고리 카드를 가로로 (스크린샷처럼 4열 → 좁은 화면에서는 1열) */
.log-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.log-grid > .card { margin-top: 0; }

/* STT 사용량 */
.usage { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.usage h3 { margin: 0; font-size: 1rem; }
.usage-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.meter { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.meter-fill { height: 100%; background: var(--accent, #4f7cff); } .meter-fill.warm { background: #e0a100; } .meter-fill.hot { background: #d63b3b; }
.hours { display: flex; align-items: flex-end; gap: 2px; height: 60px; }
.hour { flex: 1; min-width: 0; background: var(--accent, #4f7cff); border-radius: 2px 2px 0 0; opacity: .8; }

/* 밴 목록 */
.ban-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ban-row .ban-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { .ban-row { flex-wrap: wrap; } .ban-row .ban-main { flex-basis: calc(100% - 50px); } }
.field[hidden] { display: none; }

/* 메시지 편집 */
.msg-card h3 { margin: 0 0 4px; font-size: 1.05rem; } .msg-card textarea { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9rem; }
.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-text); vertical-align: middle; } .badge[hidden] { display: none; }
.row-between { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; } .row-between .chips { margin: 0; }
.over { color: var(--danger); font-weight: 600; }
.discord-preview { background: var(--bg); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 6px; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.discord-preview .mention { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); border-radius: 4px; padding: 0 3px; }
.discord-preview code { background: var(--line); padding: 0 4px; border-radius: 4px; }
[hidden].stack, .stack[hidden], h2[hidden], .msg-card[hidden] { display: none; }

/* 티켓 패널 편집 */
.panel-item { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-top: 10px; } .panel-item > summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.pv-embed { border-left: 4px solid var(--accent); background: var(--surface); border-radius: 4px; padding: 8px 12px; display: grid; gap: 6px; max-width: 480px; }
.pv-title { font-weight: 700; overflow-wrap: anywhere; } .pv-desc { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .92rem; }
.pv-img { max-width: 100%; border-radius: 4px; } .pv-img[hidden], .pv-foot[hidden] { display: none; }
.pv-row { margin-top: 8px; } .pv-btn { display: inline-block; padding: 6px 16px; border-radius: 4px; color: #fff; font-weight: 600; font-size: .9rem; }
input[type=color] { width: 44px; height: 32px; padding: 2px; }
.field.inline input[type=color] { width: 44px; min-width: 44px; height: 34px; padding: 2px; flex: none; } .field.inline select { width: auto; } .field.inline label { white-space: nowrap; }
