/* =============================================================================
   ui-terminal — broodev 공통 "네온 그린 터미널/해킹" 테마 (CANONICAL)
   - btc 앱(apps/btc)의 디자인 토큰을 추출 + 사이드바형 앱(web·admin)용 레이아웃 추가
   - 이 파일이 원본(source of truth). 각 앱은 이 파일을 자기 폴더로 복사해 사용한다.
     (버그/디자인 수정 시 여기서 고치고 apps/<name>/theme.css 로 복사)
   - 폰트: Google Fonts JetBrains Mono + Share Tech Mono (각 앱 <head>에서 로드)
   ========================================================================== */

:root {
  --neon: #00ff9c;
  --bg: #05080a;
  --bg-soft: #0a1014;
  --panel: rgba(10, 18, 22, 0.72);
  --panel-solid: #071014;
  --line: rgba(0, 255, 156, 0.18);
  --line-soft: rgba(255, 255, 255, 0.06);
  --text: #c8ffe6;
  --dim: #4f7a6c;
  --ok: #00ff9c;
  --warn: #ffb000;
  --crit: #ff3b5c;
  --cyan: #6fd0ff;
  --radius: 6px;
  --font: 'JetBrains Mono', ui-monospace, 'Share Tech Mono', monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: radial-gradient(1200px 800px at 70% -10%, #0c1a18 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--neon); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--neon); color: #04110c; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ===== 배경 효과 (고정 오버레이) ===== */
.matrix-rain { position: fixed; inset: 0; z-index: 0; opacity: 0.14; pointer-events: none; }
.scanlines {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: repeating-linear-gradient(to bottom,
    rgba(0,0,0,0) 0, rgba(0,0,0,0) 2px, rgba(0,0,0,0.22) 3px, rgba(0,0,0,0) 4px);
  mix-blend-mode: multiply; animation: flicker 6s infinite;
}
.vignette { position: fixed; inset: 0; z-index: 1; pointer-events: none; box-shadow: inset 0 0 220px 40px rgba(0,0,0,0.8); }
@keyframes flicker { 0%,97%,100%{opacity:.55} 98%{opacity:.35} 99%{opacity:.7} }
@keyframes blink { 50% { opacity: 0; } }
.cursor-blink { animation: blink 1s steps(2) infinite; }

/* ===== 사이드바 앱 레이아웃 (web · admin 공통) ===== */
.layout { position: relative; z-index: 2; display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }

.sidebar {
  display: flex; flex-direction: column; gap: 8px;
  padding: 18px 14px; height: 100vh; position: sticky; top: 0;
  border-right: 1px solid var(--line);
  background: rgba(4, 8, 9, 0.66); backdrop-filter: blur(4px);
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 16px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.side-logo { font-size: 24px; color: var(--neon); text-shadow: 0 0 14px var(--neon); letter-spacing: -2px; }
.side-title { font-size: 16px; font-weight: 800; letter-spacing: 1px; color: var(--neon); text-shadow: 0 0 12px rgba(0,255,156,.4); }
.side-title .dim { color: var(--dim); text-shadow: none; font-weight: 500; }
.nav-label { font-size: 9px; letter-spacing: 2px; color: var(--dim); margin: 14px 8px 4px; text-transform: uppercase; }
.side-nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 5px; cursor: pointer; user-select: none;
  color: var(--dim); font-size: 13px; letter-spacing: .3px;
  border: 1px solid transparent; transition: .14s; text-decoration: none;
}
.nav-link:hover { color: var(--text); border-color: var(--line); background: rgba(0,255,156,.04); text-decoration: none; }
.nav-link.active { color: var(--neon); border-color: var(--line); background: rgba(0,255,156,.08); box-shadow: inset 2px 0 0 var(--neon); }
.nav-link .nico { width: 18px; text-align: center; opacity: .9; }
.side-foot { padding: 12px 8px 4px; border-top: 1px solid var(--line); font-size: 10px; color: var(--dim); line-height: 1.6; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 22px; min-height: 58px; position: sticky; top: 0; z-index: 30;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 8, 10, 0.78); backdrop-filter: blur(6px);
}
.topbar-title { font-size: 15px; font-weight: 700; letter-spacing: .5px; color: var(--text); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.nav-toggle {
  display: none; align-items: center; justify-content: center;
  width: 36px; height: 32px; border: 1px solid var(--line); border-radius: 5px;
  background: var(--panel); color: var(--neon); cursor: pointer; font-size: 15px;
}
.content { width: 100%; max-width: 1080px; margin: 0 auto; padding: 26px 28px 72px; }
.scrim { display: none; }

/* ===== 시계 (터미널 룩, btc와 동일 감성) ===== */
.clock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.clock-time { font-size: 16px; font-weight: 700; color: var(--text); text-shadow: 0 0 8px rgba(0,255,156,.3); }
.clock-date { font-size: 10px; color: var(--dim); }

/* ===== 상태 배지 (sys-status) ===== */
.sys-status { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: 1px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); color: var(--ok); }
.sys-status .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); animation: pulse 1.4s infinite; }
.sys-status.status-warn { color: var(--warn); } .sys-status.status-warn .pulse { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.sys-status.status-crit { color: var(--crit); } .sys-status.status-crit .pulse { background: var(--crit); box-shadow: 0 0 10px var(--crit); }
@keyframes pulse { 50% { opacity: .35; transform: scale(.8); } }

/* ===== 패널 / 카드 ===== */
.panel { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; backdrop-filter: blur(3px); }
.corner { position: absolute; width: 12px; height: 12px; border: 2px solid var(--neon); opacity: .8; }
.corner.tl { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.corner.tr { top: -1px; right: -1px; border-left: 0; border-bottom: 0; }
.corner.bl { bottom: -1px; left: -1px; border-right: 0; border-top: 0; }
.corner.br { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.panel-label { font-size: 10px; letter-spacing: 2px; color: var(--dim); margin-bottom: 8px; text-transform: uppercase; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.card { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; transition: transform .15s, box-shadow .2s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 0 26px -8px var(--neon); }
.card .k { font-size: 10px; letter-spacing: 1px; color: var(--dim); text-transform: uppercase; }
.card .v { font-size: 28px; font-weight: 800; line-height: 1.1; margin-top: 6px; color: var(--text); }
.card .sub { font-size: 11px; color: var(--dim); margin-top: 4px; }
.card .v.ok { color: var(--ok); } .card .v.warn { color: var(--warn); } .card .v.crit { color: var(--crit); }

/* ===== 버튼 / 칩 / 태그 ===== */
.btn {
  font-family: var(--font); font-size: 12px; letter-spacing: .5px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px;
  color: var(--neon); background: transparent; border: 1px solid var(--neon); border-radius: 5px; transition: .15s;
}
.btn:hover { background: var(--neon); color: #04110c; text-decoration: none; }
.btn.ghost { color: var(--dim); border-color: var(--line); }
.btn.ghost:hover { color: var(--text); border-color: var(--neon); background: rgba(0,255,156,.06); }
.btn.block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.chip { font-family: var(--font); font-size: 11px; color: var(--dim); background: var(--bg-soft); border: 1px solid var(--line); border-radius: 3px; padding: 5px 10px; cursor: pointer; transition: .15s; }
.chip:hover { color: var(--neon); border-color: var(--neon); }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 9.5px; letter-spacing: .5px; padding: 2px 8px; border-radius: 3px; border: 1px solid var(--line); color: var(--dim); white-space: nowrap; text-transform: uppercase; }
.tag.live { color: var(--ok); border-color: rgba(0,255,156,.4); }
.tag.soon { color: var(--warn); border-color: rgba(255,176,0,.4); }
.tag.beta { color: var(--cyan); border-color: rgba(111,208,255,.4); }
.kbd { font-family: var(--font); font-size: 11px; color: var(--neon); background: var(--bg-soft); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 1px 6px; }

/* ===== 폼 ===== */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 11px; letter-spacing: .5px; color: var(--dim); }
.input, .field input, .field textarea, .field select {
  font-family: var(--font); font-size: 13px; color: var(--text);
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 5px; padding: 9px 11px; outline: none; transition: border-color .15s;
}
.field input:focus, .field textarea:focus, .field select:focus, .input:focus { border-color: var(--neon); }
.field textarea { resize: vertical; min-height: 96px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 12px; color: var(--dim); }
.toggle input { appearance: none; -webkit-appearance: none; width: 15px; height: 15px; margin: 0; cursor: pointer; position: relative; background: var(--bg); border: 1px solid var(--neon); border-radius: 3px; }
.toggle input:checked { background: var(--neon); }
.toggle input:checked::after { content: ''; position: absolute; left: 4px; top: 1px; width: 3px; height: 7px; border: solid #04110c; border-width: 0 2px 2px 0; transform: rotate(45deg); }

/* ===== 테이블 + 페이지네이션 ===== */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th { text-align: left; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--dim); padding: 11px 14px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.02); white-space: nowrap; }
.tbl tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); color: var(--text); vertical-align: middle; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.clickable:hover { background: rgba(0,255,156,.06); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .t-name { font-weight: 700; color: var(--neon); }
.tbl .t-muted { color: var(--dim); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; flex-wrap: wrap; }
.pager .pinfo { font-size: 11px; color: var(--dim); }
.pager .pbtns { display: flex; gap: 6px; align-items: center; }
.pager .pbtn { min-width: 30px; height: 30px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; font-family: var(--font); font-size: 12px; color: var(--dim); background: var(--bg-soft); border: 1px solid var(--line); border-radius: 4px; cursor: pointer; transition: .12s; }
.pager .pbtn:hover:not(:disabled) { color: var(--neon); border-color: var(--neon); }
.pager .pbtn.active { color: #04110c; background: var(--neon); border-color: var(--neon); font-weight: 700; }
.pager .pbtn:disabled { opacity: .35; cursor: not-allowed; }

/* ===== 본문 타이포 (회사소개·약관 등) ===== */
.prose { font-size: 14px; line-height: 1.75; color: var(--text); max-width: 760px; }
.prose h1 { font-size: 24px; color: var(--neon); letter-spacing: .5px; margin: 0 0 14px; text-shadow: 0 0 10px rgba(0,255,156,.3); }
.prose h2 { font-size: 16px; color: var(--text); margin: 28px 0 10px; border-left: 3px solid var(--neon); padding-left: 10px; }
.prose h3 { font-size: 13px; color: var(--dim); letter-spacing: 1px; text-transform: uppercase; margin: 20px 0 6px; }
.prose p { margin: 10px 0; }
.prose strong { color: var(--neon); }
.prose ul, .prose ol { margin: 10px 0; padding-left: 20px; }
.prose li { margin: 5px 0; }
.prose .lead { font-size: 16px; color: var(--text); opacity: .92; }
.prose .muted { color: var(--dim); }

/* ===== 페이지 헤더 / 유틸 ===== */
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 22px; font-weight: 800; letter-spacing: .5px; color: var(--neon); margin: 0; text-shadow: 0 0 12px rgba(0,255,156,.35); }
.page-head p { font-size: 12px; color: var(--dim); margin: 6px 0 0; }
.muted { color: var(--dim); }
.neon { color: var(--neon); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.empty { color: var(--dim); font-size: 12px; padding: 24px; text-align: center; }

/* ===== 목업 표식 배너 (***! TODO 시각화) ===== */
.mock-note {
  display: flex; align-items: flex-start; gap: 9px; margin-bottom: 18px;
  padding: 10px 14px; font-size: 11.5px; line-height: 1.6; color: #ffd591;
  background: linear-gradient(180deg, rgba(255,176,0,.12), rgba(255,176,0,.05));
  border: 1px solid rgba(255,176,0,.45); border-left: 3px solid var(--warn); border-radius: 5px;
}
.mock-note b { color: var(--warn); }

/* ===== 터미널 (btc와 동일) ===== */
.terminal { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(4,8,9,.86); overflow: hidden; box-shadow: 0 0 40px -20px var(--neon); }
.term-head { display: flex; align-items: center; gap: 7px; padding: 8px 12px; background: rgba(255,255,255,.03); border-bottom: 1px solid var(--line); }
.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot.red { background: #ff5f56; } .dot.yellow { background: #ffbd2e; } .dot.green { background: #27c93f; }
.term-title { margin-left: 8px; font-size: 12px; color: var(--dim); }
.term-body { padding: 12px 14px; height: 300px; overflow-y: auto; font-size: 13px; line-height: 1.55; cursor: text; }
.term-line { white-space: pre-wrap; word-break: break-word; color: var(--text); }
.term-line .ok { color: var(--ok); } .term-line .warn { color: var(--warn); } .term-line .crit { color: var(--crit); } .term-line .dim { color: var(--dim); }
.term-input-row { display: flex; gap: 8px; align-items: center; }
.term-prompt { color: var(--neon); flex-shrink: 0; }
.term-input-row input { flex: 1; background: transparent; border: none; outline: none; color: var(--text); font-family: var(--font); font-size: 13px; caret-color: var(--neon); }

/* ===== 반응형 (사이드바 → 드로어) ===== */
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; width: 272px; max-width: 84vw; z-index: 60;
    transform: translateX(-100%); transition: transform .22s ease;
  }
  .sidebar.open { transform: none; box-shadow: 0 0 60px -10px rgba(0,255,156,.25); }
  .nav-toggle { display: inline-flex; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.55); opacity: 0; pointer-events: none; transition: opacity .22s; }
  .scrim.show { opacity: 1; pointer-events: auto; }
  .content { padding: 20px 16px 56px; }
  .topbar { padding: 10px 14px; }
}
@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr; }
  .prose h1 { font-size: 20px; }
  .page-head h1 { font-size: 19px; }
  .clock-date { display: none; }
  /* iOS 입력 줌 방지 */
  .field input, .field textarea, .field select, .term-input-row input { font-size: 16px; }
  .content { padding: 18px 13px 48px; }
}
