/* kspark.kr 터미널 테마 (2026-11-22) — 다크 전용. 2026-11-24 다른 앱(스케줄러·파일서버·MTR)의 남색(slate) 계열에 맞춤 */
:root {
  --bg: #0f172a;
  --pane: #0b1222;
  --pane-head: #172036;
  --well: #070d1a;
  --line: #2e3c58;
  --line-soft: #1e293b;
  --text: #cbd5e1;
  --bright: #f1f5f9;
  --dim: #94a3b8;
  --faint: #64748b;
  --green: #7FD3A0;
  --blue: #7DB3DF;
  --amber: #E8B86A;
  --cyan: #79C7D9;
  --red: #F59A7A;
  --warn-bg: #2A1F12;
  --accent: var(--green);
  --mono: 'JetBrains Mono', 'IBM Plex Sans KR', ui-monospace, monospace;
  --sans: 'IBM Plex Sans KR', system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { min-height: 100vh; background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%) fixed; }
body { font-family: var(--mono); font-size: 14px; line-height: 1.65; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: #A9CDEB; text-decoration: underline; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--bright); outline-offset: 2px; }
input:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
input::placeholder { color: #64748b; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.c-green { color: var(--green); } .c-blue { color: var(--blue); } .c-amber { color: var(--amber); }
.c-cyan { color: var(--cyan); } .c-red { color: var(--red); } .c-dim { color: var(--dim); }
.c-faint { color: var(--faint); } .c-bright { color: var(--bright); } .c-line { color: var(--line); }
.c-accent { color: var(--accent); }
.b { font-weight: 700; }
.sans { font-family: var(--sans); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }

@keyframes ks-blink { 50% { opacity: 0; } }
.cur { display: inline-block; width: 9px; height: 17px; vertical-align: -3px; background: var(--text); animation: ks-blink 1.1s steps(1) infinite; }
@media (prefers-reduced-motion: reduce) { .cur { animation: none; } }

/* ---------- 창 ---------- */
.win { background: var(--pane); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; min-width: 0; }
.win-bar { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; background: var(--pane-head); border-bottom: 1px solid var(--line); }
.win-bar .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.win-bar .dot.r { background: #E2685E; } .win-bar .dot.y { background: #E0B54F; } .win-bar .dot.g { background: #67B36A; }
.win-bar .title { flex: 1; text-align: center; font-size: 12px; color: var(--dim); margin-right: 52px; }
.win-body { padding: 22px 24px 26px; }
.prompt .u { color: var(--green); } .prompt .h { color: var(--dim); } .prompt .p { color: var(--blue); } .prompt .cmd { color: var(--bright); }

.pane { background: var(--pane); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; min-width: 0; display: flex; flex-direction: column; }
.pane-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 36px; padding: 0 16px; background: var(--pane-head); border-bottom: 1px solid var(--line); font-size: 12px; }
.pane-head h2 { margin: 0; font-size: 12px; font-weight: 600; color: var(--bright); }
.pane-head h2 span { color: var(--dim); font-weight: 400; }
.pane-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.cmdline::before { content: '$ '; color: var(--dim); }
.cmdline { color: var(--bright); }
.muted { color: var(--dim); font-size: 13px; }
.sep { border-top: 1px dashed var(--line); padding-top: 10px; }

/* ---------- 버튼·입력 ---------- */
.btn { height: 48px; border: 0; border-radius: 8px; background: var(--accent); color: #0b1222; font-family: var(--mono); font-size: 15px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 0 16px; }
.btn:disabled { opacity: .55; cursor: wait; }
.btn kbd { font: inherit; font-size: 12px; font-weight: 600; padding: 1px 6px; border: 1px solid rgba(11,18,34,.4); border-radius: 4px; }
.btn-ghost { height: 44px; border: 0; background: transparent; color: var(--dim); font-family: var(--mono); font-size: 13px; cursor: pointer; padding: 0 8px; }
.btn-ghost:hover { color: var(--bright); }
.btn-sm { height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--text); font-size: 13px; cursor: pointer; }
.btn-sm[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #0b1222; font-weight: 700; }
.btn-sm.danger { color: var(--red); }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label { font-size: 13px; color: var(--dim); }
.input { display: flex; align-items: center; min-height: 48px; border: 1px solid var(--line); border-radius: 8px; background: var(--well); padding: 0 4px 0 14px; }
.input.bad { border-color: var(--red); }
.input > .pfx { color: var(--green); margin-right: 10px; }
.input input { flex: 1; min-width: 0; height: 42px; border: 0; background: transparent; font: inherit; color: var(--bright); caret-color: var(--green); outline: none; }
.input .icon-btn { width: 44px; height: 42px; border: 0; background: transparent; color: var(--dim); display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 6px; }
.code-input { height: 56px; width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--well); font-family: var(--mono); font-size: 24px; letter-spacing: .3em; text-align: center; color: var(--bright); caret-color: var(--green); }
.code-input.bad { border-color: var(--red); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-family: var(--sans); font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.err { margin: 0; font-family: var(--sans); font-size: 13px; color: var(--red); }

/* ---------- 로그인 ---------- */
.login { min-height: 100vh; padding: 32px 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 32px; }
.login { gap: 20px; }
/* tmux 한 창을 좌우로 나눈다: 왼쪽 로그인(활성 pane), 오른쪽 소개. 아래는 tmux 상태줄 */
.tmux { width: 100%; max-width: 1180px; display: flex; flex-direction: column; }
.split { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); }
.split > .auth { border-right: 1px solid var(--green); }
.intro { line-height: 1.7; min-width: 0; }
.tmux-status { display: flex; align-items: center; min-height: 30px; background: var(--pane-head); border-top: 1px solid var(--line); font-size: 13px; white-space: nowrap; overflow: hidden; }
.tmux-status .sess { background: var(--accent); color: #0b1222; font-weight: 700; padding: 0 12px; line-height: 30px; margin-right: 6px; }
.tmux-status .tw { padding: 0 10px; color: var(--dim); line-height: 30px; }
.tmux-status .tw.on { color: var(--bright); background: #1e2a40; }
.tmux-status .st-right { margin-left: auto; display: flex; gap: 18px; padding: 0 14px; color: var(--dim); }
.tmux-status #login-clock { color: var(--bright); }
.intro .win-body { display: flex; flex-direction: column; gap: 18px; overflow-wrap: anywhere; }
.intro .block { display: flex; flex-direction: column; gap: 6px; }
.hl { display: grid; grid-template-columns: 44px 84px minmax(0, 1fr); column-gap: 12px; row-gap: 2px; }
.tag-win { color: #0b1222; background: var(--amber); font-weight: 700; padding: 0 6px; border-radius: 3px; justify-self: start; align-self: start; }
.team { color: var(--dim); } .team b { color: var(--cyan); font-weight: 400; }
.ctf { display: flex; flex-wrap: wrap; gap: 6px 22px; color: var(--cyan); font-weight: 600; }
.contacts { display: grid; grid-template-columns: 96px minmax(0, 1fr); column-gap: 12px; row-gap: 2px; }
.contacts .k { color: var(--dim); }
.auth { min-width: 0; display: flex; flex-direction: column; }
.auth form { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 14px; }
.auth h2 { margin: 0; font-family: var(--sans); font-size: 20px; font-weight: 700; color: var(--bright); }
.foot { font-size: 12px; color: #7c8aa3; }

/* 로그인 카드: 터미널 느낌 (모노 글꼴, # 프롬프트, [ ]/[x] 체크, ✗ 오류) */
.auth h2 { font-family: var(--mono); font-size: 18px; letter-spacing: -.01em; }
.auth h2::before { content: '# '; color: var(--red); }
.auth .input, .auth .code-input { border-radius: 4px; }
.auth .btn { border-radius: 4px; }
.auth .err { font-family: var(--mono); font-size: 12.5px; line-height: 1.6; }
.auth .err::before { content: '✗ '; }
.auth .check { font-family: var(--mono); font-size: 13px; color: var(--text); gap: 0; }
.auth .check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.auth .check .box::before { content: '[ ]'; color: var(--dim); margin-right: 10px; white-space: pre; }
.auth .check input:checked + .box::before { content: '[x]'; color: var(--green); }
.auth .check input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.auth .check:hover .box::before { color: var(--bright); }

/* 로그인 왼쪽 칸 아래: date · motd · fortune (공개 화면이라 서버 내부 정보는 넣지 않는다) */
.sysinfo { margin-top: auto; padding: 0 24px 22px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; line-height: 1.6; }
.sysinfo .prompt + div { margin-bottom: 10px; }
.sysinfo > div:last-child { margin-bottom: 0; }
.boot .sysinfo { animation: ks-in .35s ease-out .9s both; }
/* 로그인 화면 글자는 드래그·길게 눌러 선택 안 되게 (입력칸은 그대로) */
#view-login { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#view-login a { -webkit-user-drag: none; }
#view-login input { -webkit-user-select: text; user-select: text; }

/* 로그인 화면 등장 (app.js playIntro) */
@keyframes ks-rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes ks-in { from { opacity: 0; transform: translateY(3px); } }
.boot .tmux { animation: ks-rise .5s cubic-bezier(.2,.7,.2,1) both; }
.boot .tmux-status { animation: ks-in .3s ease-out .35s both; }
.pre { visibility: hidden; }
.ks-in { animation: ks-in .22s ease-out both; }
.cur.typing { animation: none; margin-left: 1px; }
.intro { cursor: default; }

/* 대시보드 등장 (app.js playDashIntro) */
@keyframes ks-drop { from { opacity: 0; transform: translateY(-100%); } }
@keyframes ks-fill { from { clip-path: inset(0 100% 0 0); } }
.boot-dash .topbar { animation: ks-drop .4s cubic-bezier(.2,.7,.2,1) both; }
.boot-dash .rise { animation: ks-rise .5s cubic-bezier(.2,.7,.2,1) var(--d, 0s) both; }
.boot-dash .bf { animation: ks-fill .8s cubic-bezier(.3,.7,.2,1) calc(var(--d, 0s) + 250ms) both; }
.boot-dash :is(#srv-units, #chk-list, #log-rows) > * { animation: ks-in .25s ease-out calc(var(--d, 0s) + 300ms + var(--k, 0) * 60ms) both; }
:is(#srv-units, #chk-list, #log-rows) > :nth-child(2) { --k: 1; } :is(#srv-units, #chk-list, #log-rows) > :nth-child(3) { --k: 2; }
:is(#srv-units, #chk-list, #log-rows) > :nth-child(4) { --k: 3; } :is(#srv-units, #chk-list, #log-rows) > :nth-child(5) { --k: 4; }
:is(#srv-units, #chk-list, #log-rows) > :nth-child(6) { --k: 5; } :is(#srv-units, #chk-list, #log-rows) > :nth-child(n+7) { --k: 6; }

/* ---------- 대시보드 ---------- */
.topbar { display: flex; flex-wrap: wrap; align-items: center; min-height: 36px; padding: 0 0 0 0; background: var(--pane); border-bottom: 1px solid var(--line); font-size: 13px; position: sticky; top: 0; z-index: 5; }
.topbar .brandtag { background: var(--accent); color: #0b1222; font-weight: 700; padding: 0 12px; line-height: 36px; margin-right: 8px; }
.tabs { display: flex; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 7px 10px; color: var(--dim); white-space: nowrap; text-decoration: none; }
.tabs a:hover { color: var(--bright); }
.tabs a[aria-current="page"] { color: var(--bright); background: #1e2a40; }
.tabs .hd { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-left: 6px; vertical-align: 2px; background: var(--line); }
.tabs .hd.on { background: var(--green); } .tabs .hd.off { background: var(--red); }
.topbar .right { margin-left: auto; display: flex; align-items: center; }
.topbar .right > span { padding: 0 10px; white-space: nowrap; }
.topbar .right button { height: 36px; padding: 0 12px; border: 0; border-left: 1px solid var(--line); background: transparent; color: var(--dim); cursor: pointer; }
.topbar .right button:hover { color: var(--bright); }
.wrap { max-width: 1360px; margin: 0 auto; padding: 24px 32px 40px; display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; flex-wrap: wrap; gap: 20px; }
.cmdbar { position: relative; }
.cmdbar form { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 8px 0 18px; background: var(--pane); border: 1px solid var(--line); border-radius: 10px; }
.cmdbar input { flex: 1; min-width: 0; height: 42px; border: 0; background: transparent; font: inherit; color: var(--bright); caret-color: var(--green); outline: none; }
.cmdbar kbd { font: inherit; font-size: 12px; color: var(--dim); border: 1px solid var(--line); border-radius: 4px; padding: 2px 8px; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--pane); border: 1px solid var(--line); border-radius: 10px; margin: 0; padding: 6px; list-style: none; z-index: 10; box-shadow: 0 20px 40px -20px #000; }
.suggest button { width: 100%; display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 0; border-radius: 6px; background: transparent; text-align: left; cursor: pointer; }
.suggest button[aria-selected="true"], .suggest button:hover { background: #1e2a40; }
.suggest .hint { color: var(--dim); font-size: 12px; }

.ev { display: grid; grid-template-columns: 52px 20px minmax(0, 1fr); column-gap: 10px; row-gap: 4px; }
:is(.ev, .wk) .past { color: var(--faint); } :is(.ev, .wk) .past.t { text-decoration: line-through; }
.wk { display: flex; flex-direction: column; }
.wk .wd { display: grid; grid-template-columns: 76px minmax(0, 1fr); column-gap: 12px; padding: 5px 0; border-top: 1px dashed var(--line-soft); }
.wk .wd:first-child { border-top: 0; }
.wk .wd.is-today { background: #111a2c; margin: 0 -10px; padding: 6px 10px; border-radius: 4px; border-top-color: transparent; }
.wk .wd.is-today + .wd { border-top-color: transparent; }
.wk .day { color: var(--dim); white-space: nowrap; }
.wk .day.today { color: var(--accent); font-weight: 700; } .wk .day.sat { color: var(--blue); } .wk .day.sun { color: var(--red); }
.wk .wl { display: grid; grid-template-columns: 48px minmax(0, 1fr); column-gap: 10px; }
.wk .wl > :last-child { overflow-wrap: anywhere; }
.bars { display: grid; grid-template-columns: 44px minmax(0, 1fr) 96px; column-gap: 10px; row-gap: 2px; white-space: nowrap; }
.bars > span:nth-child(3n+2) { overflow: hidden; }
.bars > span:nth-child(3n) { text-align: right; color: var(--bright); }
.units { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 16px; }
.alerts { display: flex; flex-direction: column; gap: 10px; }
.alert { display: grid; grid-template-columns: 64px minmax(0, 1fr); column-gap: 8px; }
.alert.warn { padding: 8px 10px; margin: 0 -10px; background: var(--warn-bg); border-radius: 6px; }
.alert .lv { text-align: center; font-size: 12px; line-height: 22px; }
.alert.warn .lv { color: #0b1222; background: var(--amber); font-weight: 700; border-radius: 3px; height: 22px; }
.alert.ok .lv { color: var(--green); } .alert.info .lv { color: var(--blue); }
.alert .d { color: var(--dim); font-size: 13px; display: block; }
.srv { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.srv a { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; background: var(--pane); border: 1px solid var(--line); border-radius: 10px; color: var(--text); text-decoration: none; min-height: 96px; }
.srv a:hover { border-color: #475569; }
.srv .name { display: flex; justify-content: space-between; } .srv .name b { color: var(--cyan); }
.srv .stats { display: flex; flex-wrap: wrap; gap: 4px 18px; } .srv .stats b { color: var(--bright); font-size: 20px; }
.tbl-wrap { overflow-x: auto; }
table.log { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 13px; }
table.log th { text-align: left; font-weight: 400; color: var(--dim); padding: 4px 8px 4px 0; }
table.log td { padding: 7px 8px 7px 0; border-top: 1px solid var(--line-soft); vertical-align: top; }
table.log td.msg { overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.fkeys { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; font-size: 13px; }
.fkeys button, .fkeys a { padding: 8px 14px 8px 0; border: 0; background: transparent; color: var(--text); cursor: pointer; text-decoration: none; }
.fkeys kbd { font: inherit; background: var(--line); color: var(--bright); padding: 0 5px; margin-right: 6px; }
.fkeys .tail { margin-left: auto; color: var(--faint); padding: 8px 0; }

/* ---------- 창(dialog) ---------- */
dialog.win { padding: 0; color: var(--text); width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
dialog.win.narrow { width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog .win-body { overflow: auto; max-height: calc(100vh - 120px); display: flex; flex-direction: column; gap: 14px; }
dialog .close { margin-left: auto; margin-right: -8px; width: 40px; height: 40px; border: 0; background: transparent; color: var(--dim); cursor: pointer; font-size: 18px; }
dialog .win-bar .title { margin-right: 0; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.list li > .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--pane-head); border: 1px solid var(--line); border-radius: 8px; padding: 10px 16px; font-family: var(--sans); z-index: 50; }

@media (max-width: 760px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .split > .auth { border-right: 0; border-bottom: 1px solid var(--green); }
  .tmux-status .opt { display: none; }
  .sysinfo { display: none; }
}
/* 접이식·태블릿 폭까지: 위쪽 줄을 '탭 / 상태' 두 줄로 고정해 로그아웃이 화면 밖으로 밀리지 않게 한다 */
html, body { overflow-x: clip; }
@media (max-width: 900px) {
  .tabs { flex: 1 1 0; min-width: 0; }
  .topbar .right { flex: 1 1 100%; min-width: 0; margin-left: 0; border-top: 1px solid var(--line-soft); }
  .topbar .right #top-clock { margin-left: auto; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .topbar .right button { height: 40px; white-space: nowrap; flex: none; }
}
@media (max-width: 640px) {
  body { font-size: 13px; }
  /* 휴대폰: 바깥 여백 16, 창 안쪽 여백 16 으로 통일해 글자 시작선을 맞춘다 */
  .login { padding: 16px 12px 24px; gap: 16px; justify-content: flex-start; }
  .win-bar { padding: 0 14px; }
  .win-body, .auth form { padding: 16px; }
  .intro .win-body { gap: 16px; }
  .hl { grid-template-columns: 40px minmax(0, 1fr); column-gap: 10px; row-gap: 0; }
  .hl > :nth-child(3n) { grid-column: 1 / -1; padding-left: 50px; margin-bottom: 6px; }
  .contacts { grid-template-columns: 84px minmax(0, 1fr); }
  .wrap { padding: 16px 16px 32px; gap: 16px; }
  .row { gap: 16px; }
  .pane-head { padding: 0 14px; }
  .pane-body { padding: 14px; }
  .topbar .brandtag { display: none; }
  .tabs a { padding: 10px 12px; }
  .topbar .right .opt { display: none; }
  .topbar .right > span:first-child { padding-left: 16px; }
  .topbar .right button .x { display: none; }
  table.log .ip { display: none; }
  .cmdbar form { padding: 0 8px 0 14px; }
  .cmdbar .who { display: none; }
  .cmdbar kbd { display: none; }
  .bars { grid-template-columns: 40px minmax(0, 1fr) 76px; }
  .srv { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .srv a { padding: 12px 14px; min-height: 88px; }
  .srv .stats b { font-size: 17px; }
  table.log { min-width: 0; }
  table.log th:first-child { width: 46px !important; }
  table.log th:nth-child(2) { width: 78px !important; }
  .fkeys .tail { display: none; }
}
