:root {
  --bg: #15141c;
  --panel: #1f1d29;
  --panel2: #282535;
  --line: #383447;
  --text: #ece9f5;
  --muted: #9a95ad;
  --accent: #ffb547;
  --accent2: #7c6cff;
  --ok: #4fd18b;
  --warn: #ffcc3d;
  --bad: #ff6b6b;
  --rest: #6fb7ff;
  --off: #6b667c;
  --radius: 10px;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { font-size: 14px; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--bad); min-height: 1.2em; }

/* logo */
.logo { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-weight: 800; font-size: 20px; letter-spacing: -.5px; color: var(--accent); }
.logo span { color: var(--text); margin-left: 8px; font-size: 13px; letter-spacing: 1.5px; font-weight: 700; }
.logo.big { font-size: 34px; }
.logo.big span { display: block; margin: 4px 0 0; font-size: 15px; }

/* login */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 30% 20%, #2b2340, var(--bg) 60%); }
.login-card { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 28px; display: grid; gap: 12px; text-align: center; box-shadow: 0 20px 60px #0008; }

input, select, textarea { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent2); }
textarea { resize: vertical; }
button { cursor: pointer; border: 0; border-radius: 8px; padding: 9px 14px; background: var(--accent); color: #241a05; font-weight: 700; }
button:hover { filter: brightness(1.07); }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); font-weight: 500; padding: 5px 10px; }
button.secondary { background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
button.danger { background: var(--bad); color: #fff; }
button.ok { background: var(--ok); color: #062513; }
button:disabled { opacity: .5; cursor: default; }

/* top bar */
.top { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.stats { display: flex; gap: 14px; flex: 1; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.stats b { color: var(--text); }
.top-right { display: flex; align-items: center; gap: 8px; }
.pill { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); white-space: nowrap; }
.pill.on { color: var(--ok); border-color: #2c6b4a; }
.pill.off { color: var(--muted); }

/* layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; padding: 16px; align-items: start; }
@media (max-width: 1100px) { .layout { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .layout { padding: 10px; } .stats { display: none; } .top { padding: 8px 10px; gap: 8px; } }

.office-frame { position: relative; border-radius: 14px; overflow: hidden; border: 3px solid #0d0c12; box-shadow: 0 0 0 1px var(--line), 0 18px 50px #0007; background: #0d0c12; }
#office { display: block; width: 100%; image-rendering: pixelated; cursor: default; }
.tip { position: absolute; pointer-events: none; background: #0d0c12ee; border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 12px; max-width: 260px; transform: translate(-50%, -110%); white-space: normal; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 10px 2px; font-size: 12px; color: var(--muted); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.dot.working { background: var(--ok); } .dot.waiting { background: var(--warn); } .dot.idle { background: #c9c4da; }
.dot.resting { background: var(--rest); } .dot.offline { background: var(--off); }

/* agent cards */
.agent-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.agent { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; cursor: pointer; transition: border-color .15s; }
.agent:hover, .agent.sel { border-color: var(--accent2); }
.agent .h { display: flex; align-items: center; gap: 8px; }
.agent .nm { font-weight: 700; }
.agent .rl { color: var(--muted); font-size: 12px; }
.agent .eng { margin-left: auto; font-size: 11px; padding: 1px 6px; border-radius: 5px; background: var(--panel2); color: var(--muted); }
.agent .eng.claude { color: #ffb37a; } .agent .eng.codex { color: #7fe0c2; }
.agent .st { font-size: 12px; margin-top: 6px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent .st b { font-weight: 600; }

/* side */
.side { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; position: sticky; top: 70px; max-height: calc(100vh - 86px); display: flex; flex-direction: column; }
@media (max-width: 1100px) { .side { position: static; max-height: none; } }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; background: transparent; color: var(--muted); border-radius: 0; padding: 11px 6px; font-weight: 600; border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.badge { background: var(--warn); color: #2a2000; border-radius: 99px; padding: 0 6px; font-size: 11px; margin-left: 3px; }
.tab { padding: 14px; overflow: auto; }
.card { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.form { display: grid; gap: 10px; }
.form label { display: grid; gap: 5px; font-size: 12px; color: var(--muted); }

/* board */
.col-h { font-size: 12px; color: var(--muted); margin: 14px 0 6px; display: flex; justify-content: space-between; }
.col-h:first-child { margin-top: 0; }
.task { background: var(--panel2); border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; cursor: pointer; }
.task:hover { border-color: var(--accent2); }
.task.queued { border-left-color: #c9c4da; } .task.running { border-left-color: var(--ok); }
.task.review { border-left-color: var(--warn); } .task.done { border-left-color: #3d7a5a; opacity: .8; }
.task.failed { border-left-color: var(--bad); } .task.canceled { opacity: .5; }
.task .tt { font-weight: 600; font-size: 13px; }
.task .tm { font-size: 11px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }

/* feed */
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.feed li { font-size: 13px; line-height: 1.45; border-bottom: 1px dashed var(--line); padding-bottom: 8px; }
.feed .who { font-weight: 700; margin-right: 4px; }
.feed .when { color: var(--muted); font-size: 11px; float: right; margin-left: 6px; }
.feed .k-report .body { color: var(--warn); } .feed .k-error .body { color: var(--bad); }
.feed .k-approve .body { color: var(--ok); } .feed .k-instruction .body { color: var(--accent); }
.feed .k-reject .body { color: #ff9f6b; }
.feed .link { cursor: pointer; text-decoration: underline dotted; }

/* modal */
.modal { position: fixed; inset: 0; background: #000a; display: grid; place-items: center; padding: 16px; z-index: 20; }
.modal-card { position: relative; width: min(860px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.close { position: absolute; top: 10px; right: 10px; background: transparent; color: var(--muted); font-size: 18px; padding: 4px 8px; }
.modal h2 { margin: 0 30px 6px 0; font-size: 19px; }
.modal .meta { color: var(--muted); font-size: 12px; display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.modal h3 { font-size: 14px; margin: 18px 0 8px; color: var(--muted); }
.report { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; line-height: 1.65; overflow-wrap: anywhere; }
.report h1, .report h2, .report h3, .report h4 { margin: 14px 0 6px; color: var(--text); font-size: 15px; }
.report h1 { font-size: 18px; } .report h2 { font-size: 16px; }
.report code { background: var(--panel2); padding: 1px 5px; border-radius: 4px; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.report pre { background: #0c0b10; padding: 10px 12px; border-radius: 8px; overflow: auto; }
.report pre code { background: none; padding: 0; }
.report table { border-collapse: collapse; margin: 8px 0; display: block; overflow-x: auto; }
.report th, .report td { border: 1px solid var(--line); padding: 4px 8px; font-size: 13px; }
.report ul, .report ol { padding-left: 22px; margin: 6px 0; }
.report p { margin: 6px 0; }
.report a { color: var(--accent2); }
.desc { white-space: pre-wrap; background: var(--panel2); border-radius: 8px; padding: 10px 12px; }
.actions { display: grid; gap: 8px; margin-top: 14px; }
.actions .row { display: flex; gap: 8px; flex-wrap: wrap; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: 12.5px; display: grid; gap: 4px; }
.timeline .when { color: var(--muted); margin-right: 8px; font-variant-numeric: tabular-nums; }
.attach { display: grid; gap: 6px; }
.attach details { background: var(--panel2); border-radius: 8px; padding: 6px 10px; }
.attach summary { cursor: pointer; font-size: 13px; }
.attach pre { max-height: 360px; overflow: auto; font-size: 12px; background: #0c0b10; padding: 8px; border-radius: 6px; }
