/* GPU Board — Google/DeepMind 계열 라이트 퍼스트 디자인 */
:root {
  --bg: #ffffff;
  --surface: #f8f9fa;
  --surface2: #f1f3f4;
  --line: #dadce0;
  --hair: #e8eaed;
  --ink: #1f1f1f;
  --muted: #5f6368;
  --accent: #1a73e8;
  --accent-weak: #e8f0fe;
  --ok: #188038;      --ok-bg: #e6f4ea;
  --warn: #b26a00;    --warn-bg: #fef7e0;
  --bad: #d93025;     --bad-bg: #fce8e6;
  --shadow: 0 1px 2px rgba(60,64,67,.12), 0 1px 3px 1px rgba(60,64,67,.08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131314; --surface: #1e1f20; --surface2: #28292a;
    --line: #3c4043; --hair: #2d2f31;
    --ink: #e8eaed; --muted: #9aa0a6;
    --accent: #8ab4f8; --accent-weak: #1f3049;
    --ok: #81c995; --ok-bg: #1e3a29;
    --warn: #fdd663; --warn-bg: #3d3013;
    --bad: #f28b82; --bad-bg: #412a27;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #131314; --surface: #1e1f20; --surface2: #28292a;
  --line: #3c4043; --hair: #2d2f31;
  --ink: #e8eaed; --muted: #9aa0a6;
  --accent: #8ab4f8; --accent-weak: #1f3049;
  --ok: #81c995; --ok-bg: #1e3a29;
  --warn: #fdd663; --warn-bg: #3d3013;
  --bad: #f28b82; --bad-bg: #412a27;
  --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  font-size: 14px; line-height: 1.6;
}
button { font: inherit; }

/* ---------- 앱바 ---------- */
.appbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 24px; position: sticky; top: 0; z-index: 20;
  background: var(--bg); border-bottom: 1px solid var(--hair);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: "Outfit", "Noto Sans KR", sans-serif;
  font-size: 17px; font-weight: 600; letter-spacing: -.005em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.appbar-right { display: flex; align-items: center; gap: 12px; }
.userchip { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent);
  color: var(--bg); display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.chip {
  font-size: 12px; padding: 3px 10px; border-radius: 999px; font-weight: 500;
}
.chip-warn { background: var(--warn-bg); color: var(--warn); }

/* ---------- 버튼 ---------- */
.btn {
  border: 1px solid var(--line); background: var(--bg); color: var(--accent);
  border-radius: 999px; padding: 6px 16px; font-size: 13.5px; font-weight: 500;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s;
}
.btn:hover { background: var(--surface2); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.06); }
.btn-text { border: none; background: none; color: var(--muted); padding: 6px 8px; }
.btn-text:hover { background: var(--surface2); border-radius: 999px; }
.btn[disabled] { opacity: .5; cursor: default; }

/* ---------- 레이아웃 ---------- */
main { max-width: 1360px; margin: 0 auto; padding: 20px 24px 72px; }
.loading { color: var(--muted); }

/* ---------- 시스템 어드바이저리 배너 ---------- */
.advisories { display: grid; gap: 8px; margin-bottom: 22px; }
.adv {
  border-left: 4px solid var(--warn); background: var(--surface);
  border-radius: 0 10px 10px 0; padding: 10px 16px;
}
.adv.crit { border-left-color: var(--bad); }
.adv.info { border-left-color: var(--accent); }
.adv-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.adv-head b { font-size: 13.5px; }
.adv-since { color: var(--muted); font-size: 11.5px; font-family: "Roboto Mono", monospace; white-space: nowrap; }
.adv-detail { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ---------- 컨테이너 테이블 ---------- */
details.containers { margin: 0 0 12px; }
details.containers summary {
  cursor: pointer; color: var(--muted); font-size: 12.5px;
  padding: 4px 0; list-style-position: inside;
}
details.containers summary:hover { color: var(--ink); }
table.ctable {
  width: 100%; border-collapse: collapse; font-size: 12px;
  background: var(--surface); border: 1px solid var(--hair); border-radius: 10px;
  overflow: hidden; margin-top: 6px;
}
table.ctable th {
  text-align: left; font-family: "Roboto Mono", monospace; font-size: 10.5px;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  padding: 7px 12px; border-bottom: 1px solid var(--hair); font-weight: 500;
}
table.ctable td { padding: 5px 12px; border-bottom: 1px solid var(--hair); }
table.ctable tr:last-child td { border-bottom: none; }
table.ctable td.n { font-weight: 600; }
table.ctable td.num { font-family: "Roboto Mono", monospace; font-variant-numeric: tabular-nums; }
table.ctable td.dim { color: var(--muted); }

/* ---------- 서버 섹션 ---------- */
.server { margin-bottom: 36px; }
.server-head {
  display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: flex-end;
  justify-content: space-between; margin-bottom: 14px;
}
.server-title { display: flex; align-items: center; gap: 10px; }
.server-title h2 {
  margin: 0; font-family: "Outfit", "Noto Sans KR", sans-serif;
  font-size: 22px; font-weight: 600; letter-spacing: -.01em;
}
.hw-chip {
  font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 999px;
  background: var(--accent-weak); color: var(--accent);
}
.chip-off { background: var(--bad-bg); color: var(--bad); }
.hw-meta { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }

.sys-meters { display: flex; gap: 20px; flex-wrap: wrap; }
.sysm { min-width: 120px; }
.sysm .k {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 11.5px; color: var(--muted);
  font-family: "Roboto Mono", monospace; letter-spacing: .02em;
}
.sysm .k b { color: var(--ink); font-weight: 500; }
.track {
  height: 4px; border-radius: 2px; background: var(--surface2);
  overflow: hidden; margin-top: 5px;
}
.track > i { display: block; height: 100%; border-radius: 2px; background: var(--accent);
             transition: width .5s ease; }
.track > i.warn { background: var(--warn); }
.track > i.bad { background: var(--bad); }

/* ---------- GPU 그리드/카드 (기본 4열, 컴팩트) ---------- */
.gpu-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1080px) { .gpu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 540px) { .gpu-grid { grid-template-columns: 1fr; } }
.gcard {
  background: var(--surface); border: 1px solid var(--hair); border-radius: 12px;
  padding: 12px 14px 11px; transition: box-shadow .2s, border-color .2s;
  min-width: 0;
}
.gcard:hover { box-shadow: var(--shadow); }
.gcard.mine { border-color: var(--accent); }
.gcard-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.gpu-idx {
  font-family: "Roboto Mono", monospace; font-size: 12px; color: var(--muted);
  letter-spacing: .04em;
}
.status-chip { font-size: 11.5px; font-weight: 500; padding: 2px 10px; border-radius: 999px; }
.st-free { background: var(--ok-bg); color: var(--ok); }
.st-busy { background: var(--accent); color: var(--bg); font-weight: 700; }
.st-held { background: var(--accent-weak); color: var(--accent); }
.st-rogue { background: var(--warn-bg); color: var(--warn); }
.st-off { background: var(--bad-bg); color: var(--bad); }

/* 카드 좌측 상태 스트라이프 — 한눈에 구분 */
.gcard { border-left-width: 4px; }
.gcard.state-free { border-left-color: var(--ok); }
.gcard.state-busy { border-left-color: var(--accent); }
.gcard.state-held { border-left-color: color-mix(in srgb, var(--accent) 45%, var(--hair)); }
.gcard.state-rogue { border-left-color: var(--warn); }
.gcard.state-off { border-left-color: var(--bad); }

.legend { display: flex; gap: 18px; flex-wrap: wrap; margin: 0 0 16px; color: var(--muted); font-size: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.dot-free { background: var(--ok); }
.dot-busy { background: var(--accent); }
.dot-held { background: color-mix(in srgb, var(--accent) 45%, var(--hair)); }
.dot-rogue { background: var(--warn); }

.chip-btn { border: none; cursor: pointer; font: inherit; font-size: 12px; }

.util-row { display: flex; align-items: baseline; justify-content: space-between; }
.util-num {
  font-family: "Outfit", sans-serif; font-size: 26px; font-weight: 600;
  line-height: 1; font-variant-numeric: tabular-nums;
}
.util-num .unit { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 2px; }
.mini-meta { color: var(--muted); font-size: 11px; font-family: "Roboto Mono", monospace; }

.mem-row {
  display: flex; justify-content: space-between; font-size: 11px; color: var(--muted);
  margin-top: 8px; font-family: "Roboto Mono", monospace;
}
.mem-row b { color: var(--ink); font-weight: 500; }
.track.mem > i { background: var(--accent); opacity: .55; }

canvas.spark { width: 100%; height: 26px; margin-top: 9px; display: block; }

.res-info { margin-top: 8px; font-size: 11.5px; color: var(--muted); display: grid; gap: 2px; }
.res-info .holder { color: var(--ink); }
.res-info .warn-note { color: var(--warn); }
.res-info .cancel-mini {
  border: none; background: none; color: var(--accent); cursor: pointer;
  font-size: 12px; padding: 0 4px;
}

table.procs { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 11px; }
table.procs td { padding: 1px 6px 1px 0; color: var(--muted); white-space: nowrap;
                 overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
table.procs td.u { color: var(--ink); font-weight: 500; }

.actions { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.actions .btn { padding: 3px 11px; font-size: 12px; }

/* ---------- 예약 패널 ---------- */
.claim-panel {
  margin-top: 12px; border-top: 1px solid var(--hair); padding-top: 12px;
  display: grid; gap: 10px;
}
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button {
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  border-radius: 8px; padding: 5px 12px; font-size: 13px; cursor: pointer;
}
.seg button.on { background: var(--accent-weak); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.linklike {
  border: none; background: none; color: var(--accent); cursor: pointer;
  font-size: 12.5px; padding: 0; text-align: left; width: fit-content;
}
.custom-time { display: grid; gap: 8px; font-size: 12.5px; }
.custom-time label { display: grid; grid-template-columns: 44px 1fr; align-items: center; gap: 8px; color: var(--muted); }
.custom-time input[type="datetime-local"] {
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px;
  background: var(--bg); color: var(--ink); font: inherit; font-size: 13px;
}
.custom-time input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dur-note { color: var(--muted); font-size: 12px; }
.dur-note b { color: var(--accent); font-weight: 600; }
.panel-actions { display: flex; gap: 8px; }
.preempt-row { font-size: 12.5px; color: var(--warn); display: flex; gap: 6px; align-items: center; cursor: pointer; }
.chip-admin { background: var(--accent-weak); color: var(--accent); }
.ext-count { color: var(--muted); font-size: 11.5px; align-self: center; font-family: "Roboto Mono", monospace; }
.btn-danger { color: var(--bad); border-color: var(--bad); }

/* ---------- 푸터/토스트 ---------- */
footer {
  position: fixed; bottom: 0; left: 0; right: 0;
  padding: 6px 24px; font-size: 12px; color: var(--muted);
  background: var(--bg); border-top: 1px solid var(--hair);
}
#toast {
  position: fixed; bottom: 48px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); border-radius: 8px; padding: 9px 18px;
  font-size: 13px; opacity: 0; transition: opacity .25s; pointer-events: none; z-index: 30;
  box-shadow: var(--shadow);
}
#toast.show { opacity: 1; }
#toast.err { background: var(--bad); color: #fff; }

/* ---------- 랜딩 페이지 (비로그인) ---------- */
.landing-card { max-width: 480px; }
.landing-card h1 { font-size: 24px; margin-bottom: 4px; }
.landing-stats { display: flex; justify-content: center; gap: 28px; margin: 22px 0 6px; }
.lstat { display: grid; gap: 2px; justify-items: center; }
.lstat-name { font-family: "Roboto Mono", monospace; font-size: 12px; color: var(--muted); }
.lstat-num { font-family: "Outfit", sans-serif; font-size: 34px; font-weight: 700; line-height: 1; }
.lstat-num small { font-size: 15px; color: var(--muted); font-weight: 500; }
.lstat-num.ok { color: var(--ok); }
.lstat-num.zero { color: var(--muted); }
.lstat-label { font-size: 11.5px; color: var(--muted); }
.landing-login { text-align: left; background: var(--surface2); border-radius: 10px;
                 padding: 12px 16px; margin-top: 14px; font-size: 13px; }
.landing-login pre { margin: 8px 0; }

/* ---------- 매뉴얼 페이지 ---------- */
main.manual { max-width: 760px; }
.manual h1 { font-family: "Outfit", "Noto Sans KR", sans-serif; font-size: 26px; margin: 8px 0 6px; }
.manual .lead { color: var(--muted); font-size: 15px; margin-bottom: 8px; }
.manual h2 {
  font-family: "Outfit", "Noto Sans KR", sans-serif; font-size: 17px;
  margin: 30px 0 8px; padding-top: 14px; border-top: 1px solid var(--hair);
}
.manual p, .manual li { font-size: 14px; }
.manual ul, .manual ol { padding-left: 22px; }
.manual li { margin: 4px 0; }
.manual code {
  font-family: "Roboto Mono", monospace; font-size: .88em;
  background: var(--surface2); padding: 1px 6px; border-radius: 4px;
}
.manual table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 13.5px; }
.manual th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px;
             border-bottom: 2px solid var(--hair); padding: 6px 12px 6px 0; }
.manual td { border-bottom: 1px solid var(--hair); padding: 8px 12px 8px 0; vertical-align: top; }
.manual .dim { color: var(--muted); }

/* ---------- 로그인 카드 ---------- */
.center-card { display: flex; justify-content: center; padding-top: 10vh; }
.card {
  background: var(--surface); border: 1px solid var(--hair); border-radius: 16px;
  padding: 32px 36px; max-width: 440px; text-align: center;
}
.card h1 { font-family: "Outfit", "Noto Sans KR", sans-serif; font-size: 22px; margin: 0 0 12px; }
.card pre {
  background: var(--surface2); padding: 10px; border-radius: 8px; font-size: 14px;
  font-family: "Roboto Mono", monospace;
}
.card .dim { color: var(--muted); font-size: 13px; }
.card .error { color: var(--bad); }
.card .btn { margin-top: 4px; }

/* ---------- 모바일 ---------- */
@media (max-width: 640px) {
  .appbar { flex-wrap: wrap; gap: 4px 8px; padding: 8px 12px; }
  .brand { font-size: 14px; flex: 1 1 auto; min-width: 0; }
  .appbar-right { gap: 6px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
  .appbar .btn { padding: 3px 10px; font-size: 12px; }
  .userchip { font-size: 12px; }
  .avatar { width: 22px; height: 22px; font-size: 11px; }
  main { padding: 14px 12px 72px; }
  .server-title h2 { font-size: 18px; }
  .hw-meta { font-size: 11.5px; }
  .sys-meters { gap: 10px 14px; }
  .sysm { min-width: 96px; }
  .legend { gap: 10px 14px; }
  footer { font-size: 11px; padding: 5px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
