:root {
  --bg: #f6f7f9; --panel: #fff; --text: #1d2330; --muted: #6b7385; --line: #e6e8ee;
  --brand: #3b5bdb; --brand-soft: #edf1ff; --good: #2b8a3e; --bad: #c92a2a; --warn: #e67700;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14161b; --panel: #1c1f26; --text: #e8eaf0; --muted: #9aa2b4; --line: #2b2f3a;
    --brand: #7c96ff; --brand-soft: #232a45; --good: #69db7c; --bad: #ff8787; --warn: #ffc078; }
}
* { box-sizing: border-box; }
body { margin: 0; display: flex; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 14px/1.55 "Pretendard", "Malgun Gothic", system-ui, sans-serif; }
.side { width: 230px; flex: none; background: var(--panel); border-right: 1px solid var(--line);
  padding: 18px 12px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; padding: 0 8px 18px; }
main a { color: var(--brand); }
.bizsel { margin: 0 4px 12px; font-weight: 600; }
.tips { margin: 0; padding-left: 18px; } .tips li { margin: 4px 0; }
.brand b { display: block; font-size: 16px; } .brand small { color: var(--muted); }
.logo { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 800; }
nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: auto; }
nav a { padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
nav a:hover { background: var(--bg); } nav a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.navgroup { font-size: 11px; color: var(--muted); padding: 12px 10px 2px; }
.userbox { font-size: 12px; padding: 8px 10px; border-top: 1px solid var(--line); margin-top: 6px; }
.userbox a { color: var(--brand); }
body.authmode .side { display: none; }
body.authmode main { display: grid; place-items: center; max-width: none; }
.authbox { width: min(380px, 100%); margin-top: 8vh; }
[hidden] { display: none !important; }
.disclaimer { font-size: 11px; color: var(--muted); padding: 8px; margin: 0; }
main { flex: 1; padding: 28px 32px; max-width: 1200px; min-width: 0; }
h1 { font-size: 22px; margin: 0 0 4px; } h2 { font-size: 16px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; }
.grid .card { margin: 0; }
.stat .label { color: var(--muted); font-size: 12px; } .stat .value { font-size: 22px; font-weight: 700; margin-top: 4px; }
.stat .hint { color: var(--muted); font-size: 12px; margin-top: 2px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 700; }
.tablewrap { overflow-x: auto; }
button, .btn { border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 8px;
  padding: 7px 12px; font: inherit; cursor: pointer; }
button:hover { border-color: var(--brand); }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.danger { color: var(--bad); }
button.small { padding: 3px 8px; font-size: 12px; }
input, select, textarea { border: 1px solid var(--line); background: var(--bg); color: var(--text); border-radius: 8px;
  padding: 7px 10px; font: inherit; min-width: 0; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.form { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11px; background: var(--bg); border: 1px solid var(--line); }
.badge.ok { color: var(--good); border-color: currentColor; } .badge.draft { color: var(--warn); border-color: currentColor; }
.muted { color: var(--muted); } .good { color: var(--good); } .bad { color: var(--bad); }
.cal li { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.cal { list-style: none; padding: 0; margin: 0; } .cal .d { flex: none; width: 54px; font-weight: 700; color: var(--brand); white-space: nowrap; }
.grid.wide { grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); }
@media (max-width: 1000px) { .grid.wide { grid-template-columns: 1fr; } }
.bars { display: flex; gap: 10px; align-items: flex-end; height: 160px; padding-top: 10px; }
.bars .m { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.bars .pair { display: flex; gap: 3px; align-items: flex-end; height: 130px; }
.bars .in, .bars .out { width: 12px; border-radius: 3px 3px 0 0; }
.bars .in { background: var(--brand); } .bars .out { background: var(--warn); }
.bars small { font-size: 11px; color: var(--muted); }
.legend { font-size: 12px; color: var(--muted); } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px 0 10px; }
.hbar { display: grid; grid-template-columns: 110px 1fr 110px; gap: 8px; align-items: center; margin: 6px 0; font-size: 13px; }
.hbar .track { background: var(--bg); border-radius: 4px; height: 10px; overflow: hidden; }
.hbar .fill { background: var(--brand); height: 100%; }
/* chat */
.chat { display: flex; flex-direction: column; height: calc(100vh - 140px); }
.msgs { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px 2px 12px; }
.msg { max-width: 80%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 4px; white-space: normal; }
.msg.assistant table { margin: 6px 0; } .msg.assistant p { margin: 4px 0; }
.msg .acts { font-size: 11px; color: var(--muted); margin-top: 6px; }
.composer { display: flex; gap: 8px; } .composer textarea { flex: 1; resize: none; height: 52px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chips button { font-size: 12px; border-radius: 99px; }
.slip { border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 13px; }
.slip .two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.slip div.l { display: flex; justify-content: space-between; padding: 2px 0; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 9px 16px; border-radius: 8px; opacity: 0; transition: .2s; pointer-events: none; }
#toast.show { opacity: 1; }
dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); max-width: 640px; width: 92vw; }
dialog::backdrop { background: rgba(0,0,0,.35); }
@media (max-width: 760px) {
  body { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; }
  nav { flex-direction: row; flex-wrap: wrap; } .navgroup, .disclaimer { display: none; }
  main { padding: 16px; }
}
