/* 요구사항서 14-2 공통 디자인 규칙 */
:root {
  --bg: #0D1117;
  --card: #161B22;
  --line: #262C36;
  --text: #E6EDF3;
  --sub: #8B949E;
  --up: #2DBE7E;
  --down: #F45B69;
  --accent: #F5B841;
  --ok: #3FB950;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --sans: "Noto Sans KR", system-ui, -apple-system, "Malgun Gothic", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
a.badge { text-decoration: none; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
#view { padding: calc(14px + env(safe-area-inset-top)) 16px 16px; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .down { color: var(--down); } .sub { color: var(--sub); } .accent { color: var(--accent); }
h1 { font-size: 20px; margin: 0; font-weight: 700; }
.head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; gap: 8px; }
.head .meta { font-size: 12px; color: var(--sub); margin-top: 3px; line-height: 1.5; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.label { font-size: 12px; color: var(--sub); }
.big { font-family: var(--mono); font-size: 30px; font-weight: 700; letter-spacing: -0.5px; }
.big small { font-size: 14px; color: var(--sub); font-weight: 400; margin-left: 4px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; cursor: pointer; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.running { color: var(--ok); background: rgba(63,185,80,.1); }
.badge.paused { color: var(--accent); background: rgba(245,184,65,.1); }
.badge.error, .badge.offline { color: var(--down); background: rgba(244,91,105,.1); }
.tabs { display: flex; background: var(--bg); border-radius: 10px; padding: 3px; margin: 12px 0; }
.tabs button { flex: 1; background: none; border: 0; color: var(--sub); font: 500 13px var(--sans); padding: 7px 0; border-radius: 8px; cursor: pointer; }
.tabs button.on { background: var(--line); color: var(--text); }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 10px; }
.cell .label { margin-bottom: 3px; }
.cell .v { font-family: var(--mono); font-size: 15px; }
.pill { font-family: var(--mono); font-size: 13px; padding: 5px 9px; border-radius: 8px; }
.pill.up { background: rgba(45,190,126,.12); } .pill.down { background: rgba(244,91,105,.12); }
.side { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 7px; font-size: 12px; font-weight: 700; }
.side.LONG { color: var(--up); background: rgba(45,190,126,.14); } .side.SHORT { color: var(--down); background: rgba(244,91,105,.14); }
.inner { background: var(--bg); border-radius: 10px; padding: 12px; margin-top: 12px; }
.protect { margin-top: 14px; }
.bars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.bars div { height: 5px; border-radius: 3px; background: var(--line); }
.bars div.on { background: var(--accent); }
.bars-l { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 5px; font-size: 11px; color: var(--sub); }
.bars-l span.on { color: var(--text); }
.ladder .step { display: flex; align-items: center; gap: 10px; padding: 11px 4px; border-top: 1px solid var(--line); }
.ladder .step:first-child { border-top: 0; }
.ladder .dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--sub); flex: none; }
.ladder .t { flex: 1; font-size: 13px; } .ladder .t small { display: block; font-size: 11px; color: var(--sub); margin-top: 2px; }
.ladder .v { font-family: var(--mono); font-size: 14px; }
.ladder .gone { color: var(--sub); } .ladder .gone .v, .ladder .gone .t b { text-decoration: line-through; }
.ladder .cur { background: rgba(245,184,65,.09); border: 1px solid rgba(245,184,65,.45); border-radius: 10px; }
.ladder .cur .dot { border-color: var(--accent); background: var(--accent); } .ladder .cur .t b, .ladder .cur .v { color: var(--accent); }
.ladder .now.up { background: rgba(45,190,126,.08); border-radius: 10px; } .ladder .now.down { background: rgba(244,91,105,.08); border-radius: 10px; }
.ladder .now .dot { border-color: currentColor; background: currentColor; }
.ladder .done .dot { border: 0; width: auto; height: auto; color: var(--ok); } .ladder .done .dot::before { content: "✓"; font-size: 12px; }
.btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.btn { border: 1px solid var(--line); background: var(--card); color: var(--text); font: 600 14px var(--sans); padding: 13px; border-radius: 11px; cursor: pointer; }
.btn.danger { background: rgba(244,91,105,.14); border-color: rgba(244,91,105,.5); color: var(--down); }
.btn.solid-danger { background: var(--down); border-color: var(--down); color: #fff; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #111; }
.btn:disabled { opacity: .5; cursor: default; }
.chart { display: flex; align-items: stretch; height: 150px; gap: 8px; padding-top: 4px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; }
.chart .half { flex: 1; width: 100%; display: flex; justify-content: center; }
.chart .half.top { align-items: flex-end; } .chart .half.bot { align-items: flex-start; border-top: 1px solid var(--line); }
.chart .bar { width: 64%; max-width: 30px; border-radius: 3px; position: relative; min-height: 2px; }
.chart .bar.up { background: var(--up); } .chart .bar.down { background: var(--down); }
.chart .bar span { position: absolute; left: 50%; transform: translateX(-50%); font: 10px var(--mono); white-space: nowrap; }
.chart .half.top .bar span { bottom: 100%; margin-bottom: 3px; color: var(--up); }
.chart .half.bot .bar span { top: 100%; margin-top: 3px; color: var(--down); }
.chart .m { font-size: 11px; color: var(--sub); margin-top: 6px; }
.trade { display: flex; align-items: center; gap: 10px; }
.trade .mid { flex: 1; min-width: 0; } .trade .mid .d { font-family: var(--mono); font-size: 13px; } .trade .mid small { font-size: 11px; color: var(--sub); }
.trade .r { text-align: right; } .trade .r b { font-family: var(--mono); font-size: 14px; display: block; } .trade .r small { font: 11px var(--mono); }
.toggle { display: flex; justify-content: space-between; align-items: center; padding: 13px 0; border-top: 1px solid var(--line); gap: 10px; }
.toggle:first-child { border-top: 0; padding-top: 2px; }
.toggle b { font-size: 14px; font-weight: 600; } .toggle small { display: block; font-size: 11px; color: var(--sub); margin-top: 2px; }
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--accent); } .switch input:checked + span::before { transform: translateX(20px); background: #222; }
.switch input:disabled + span { opacity: .6; cursor: default; }
.kv { display: flex; justify-content: space-between; padding: 7px 0; font-size: 13px; gap: 12px; } .kv span:first-child { color: var(--sub); flex: none; } .kv span:last-child { text-align: right; }
.tag { font-size: 11px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line); color: var(--sub); }
.ok { color: var(--ok); } .bad { color: var(--down); }
nav#tabs { position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
nav#tabs a { flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 8px; color: var(--sub); text-decoration: none; font-size: 11px; }
nav#tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
nav#tabs a.on { color: var(--accent); }
#sheet { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
#sheet .panel { background: var(--card); border: 1px solid var(--line); border-radius: 18px 18px 0 0; width: 100%; max-width: 480px; padding: 20px 16px calc(18px + env(safe-area-inset-bottom)); animation: up .18s ease-out; }
#sheet h3 { margin: 0 0 8px; font-size: 16px; } #sheet p { margin: 0 0 16px; font-size: 13px; color: var(--sub); line-height: 1.6; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
#toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #2b313b; color: var(--text); padding: 10px 16px; border-radius: 10px; font-size: 13px; z-index: 30; max-width: 90%; }
.login { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; }
.login input { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 13px; font-size: 16px; margin: 14px 0 10px; }
.empty { text-align: center; color: var(--sub); font-size: 13px; padding: 26px 0; }
.err { color: var(--down); font-size: 13px; min-height: 18px; }
.more { text-align: center; padding: 10px; color: var(--sub); font-size: 12px; }

/* 진입 조건 점검 카드 */
.row.chk { padding: 7px 0; border-top: 1px solid var(--line); }
.chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; margin-left: 6px; }
.chip.okc { color: var(--up); background: color-mix(in srgb, var(--up) 15%, transparent); }
.chip.badc { color: var(--down); background: color-mix(in srgb, var(--down) 15%, transparent); }

/* 회원 포털: 관리 화면 · 입력 양식 */
#bar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: rgba(245,184,65,.14); border-bottom: 1px solid rgba(245,184,65,.45); color: var(--accent);
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px; font-size: 13px; }
#bar button { background: none; border: 1px solid rgba(245,184,65,.6); color: var(--accent); border-radius: 8px; padding: 5px 10px; font: 600 12px var(--sans); cursor: pointer; }
.acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.acts .btn { flex: 1 1 auto; padding: 9px 10px; font-size: 13px; }
#sheet .panel { max-height: 92vh; overflow-y: auto; }
.form label { display: block; font-size: 12px; color: var(--sub); margin: 10px 0 4px; }
.form input, .form select { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 11px; font-size: 15px; font-family: var(--sans); }
.form label.chkl { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); margin-top: 14px; }
.form label.chkl input { width: auto; }
.login.form input { margin: 0 0 4px; }
