/* OneUp Hub 기본: 디자인 토큰과 공통 요소 (TRD 4편 2·3장). 흑백, Pretendard 400·500, 모서리 0, 그림자 없음 */
@font-face { font-family: "Pretendard"; font-weight: 400; font-display: swap; src: url("../fonts/Pretendard-Regular.woff2") format("woff2"); }
@font-face { font-family: "Pretendard"; font-weight: 500; font-display: swap; src: url("../fonts/Pretendard-Medium.woff2") format("woff2"); }
@font-face { font-family: "PretendardSub"; font-weight: 400; font-display: swap; src: url("../fonts/Pretendard-Regular-subset.woff2") format("woff2"); }
@font-face { font-family: "PretendardSub"; font-weight: 500; font-display: swap; src: url("../fonts/Pretendard-Medium-subset.woff2") format("woff2"); }

:root {
  --ink: #000000;
  --text: #1a1a1a;
  --muted: #666666;
  --line: #d9d9d9;
  --line-strong: #1a1a1a;
  --fill: #f4f4f4;
  --paper: #ffffff;
  --danger: #b3261e;
  --danger-fill: #fbeceb;

  --font: "Pretendard", -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --fs-hero: 40px; --fs-h1: 28px; --fs-h2: 20px; --fs-num: 32px; --fs-body: 16px; --fs-small: 14px; --fs-tiny: 12px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--text); font: 400 var(--fs-body)/1.6 var(--font); }
h1, h2, h3, strong, b, th { font-weight: 500; }
h1 { font-size: var(--fs-h1); line-height: 1.3; margin: 0 0 var(--s5); color: var(--ink); }
h2 { font-size: var(--fs-h2); line-height: 1.4; margin: var(--s6) 0 var(--s4); color: var(--ink); }
h3 { font-size: var(--fs-body); margin: var(--s5) 0 var(--s3); }
p { margin: 0 0 var(--s4); }
a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
em, i { font-style: normal; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
img { max-width: 100%; height: auto; }
code, pre, .mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 0.9em; }
pre.code { background: var(--fill); padding: var(--s4); overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-small); }
.num { font-variant-numeric: tabular-nums; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--s4); top: var(--s4); background: var(--paper); padding: var(--s2) var(--s3); z-index: 10; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 단추 (3.1) */
.btn, button.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 40px; padding: 0 20px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); font: 500 var(--fs-small)/1 var(--font); text-decoration: none; cursor: pointer; border-radius: 0; }
.btn:hover { text-decoration: none; background: #262626; }
.btn.sub { background: var(--paper); color: var(--ink); }
.btn.sub:hover { background: var(--fill); }
.btn.danger { background: var(--paper); color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger-fill); }
.btn.big { min-height: 48px; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* 입력 (3.2) */
.field { display: block; margin: 0 0 var(--s4); }
.field > span { display: block; font-size: var(--fs-small); font-weight: 500; margin-bottom: var(--s1); }
.field small { display: block; color: var(--muted); font-size: var(--fs-tiny); font-weight: 400; margin-top: var(--s1); }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=search], input[type=time], input:not([type]), select, textarea {
  width: 100%; min-height: 40px; padding: var(--s2) var(--s3); border: 1px solid var(--line); background: var(--paper); color: var(--text); font: 400 var(--fs-body)/1.4 var(--font); border-radius: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--line-strong); outline: none; }
textarea { min-height: 120px; resize: vertical; }
input[type=file] { font: inherit; font-size: var(--fs-small); }
.check { display: flex; gap: var(--s2); align-items: flex-start; margin: 0 0 var(--s3); font-size: var(--fs-small); }
.check input { margin-top: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
@media (max-width: 639px) { .row2 { grid-template-columns: 1fr; } }

/* 표 (3.3) */
.table-wrap { overflow-x: auto; margin: 0 0 var(--s5); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.table th { background: var(--fill); text-align: left; padding: var(--s2) var(--s3); white-space: nowrap; }
.table td { border-top: 1px solid var(--line); padding: var(--s2) var(--s3); vertical-align: top; }
.table tr:hover td { background: #fafafa; }
.table .r { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: var(--s5) 0; color: var(--muted); }

/* 상태 배지 (3.4): 색 대신 모양과 글자 */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 var(--s2); border: 1px solid var(--ink); font: 500 var(--fs-tiny)/1 var(--font); letter-spacing: .02em; white-space: nowrap; }
.badge.on { background: var(--ink); color: var(--paper); }
.badge.on::before { content: "●"; font-size: 8px; }
.badge.wait::before { content: "○"; font-size: 9px; }
.badge.off { border-color: var(--line); color: var(--muted); }
.badge.off::before { content: "—"; }
.badge.bad { border-color: var(--danger); color: var(--danger); }
.badge.bad::before { content: "▲"; font-size: 8px; }

/* 알림 띠 (3.5) */
.flash { border: 1px solid var(--ink); padding: var(--s3) var(--s4); margin: 0 0 var(--s4); font-size: var(--fs-small); }
.flash.error { border-color: var(--danger); background: var(--danger-fill); color: var(--danger); }
.flash.error a { color: var(--danger); }

/* 위험 조작 펼침 (확인 + 비밀번호) */
details.act { display: inline-block; position: relative; }
details.act > summary { list-style: none; }
details.act > summary::-webkit-details-marker { display: none; }
details.act[open] > summary { opacity: .6; }
details.act .act-box { position: absolute; z-index: 5; right: 0; top: calc(100% + 4px); width: min(360px, 90vw); background: var(--paper); border: 1px solid var(--ink); padding: var(--s4); text-align: left; }
details.act .act-box p { font-size: var(--fs-small); }

.secret { font: 400 22px/1.4 ui-monospace, Consolas, monospace; letter-spacing: .04em; word-break: break-all; border: 1px solid var(--ink); padding: var(--s4); }
.copy { margin-left: var(--s2); }
.mt4 { margin-top: var(--s4); } .mt5 { margin-top: var(--s5); } .mt6 { margin-top: var(--s6); }
svg.meter { display: block; width: 100%; height: 8px; margin: var(--s2) 0; }
svg.meter .bg { fill: var(--fill); }
svg.meter .fg { fill: var(--ink); }
svg.meter.warn .fg { fill: var(--danger); }

/* 표 안의 위험 조작 펼침이 잘리지 않게 (2026-11-21): 넓은 화면은 표 상자가 자르지 않고, 좁은 화면은 펼침을 제자리에 연다 */
@media (min-width: 1024px) { .table-wrap { overflow-x: visible; } }
@media (max-width: 1023px) {
  details.act { display: block; }
  details.act .act-box { position: static; width: 100%; min-width: 260px; margin-top: var(--s2); }
}
