/* vLabNxt web UI */
:root {
  --bg: #f4f6f9; --panel: #ffffff; --ink: #1d2433; --muted: #5d6779; --line: #d9dee7;
  --accent: #1f5fae; --accent-ink: #ffffff; --danger: #b42318; --ok: #1a7f37; --warn: #9a6700;
  --code-bg: #0f1419; --code-ink: #e6e1cf;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
button {
  border: 1px solid var(--line); background: var(--panel); border-radius: 6px;
  padding: 6px 12px; cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.primary:disabled { opacity: .6; cursor: progress; }
button.link { border: 0; background: none; color: inherit; text-decoration: underline; padding: 4px 6px; }
button.small { padding: 3px 9px; font-size: .9em; }
kbd { font-size: .75em; opacity: .75; margin-left: 4px; font-family: inherit; }
input, select, textarea { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: #fff; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.error { color: var(--danger); margin: 8px 0 0; }
.notice { background: #fff8e1; border: 1px solid #f0d58a; padding: 8px 10px; border-radius: 6px; }

/* login */
.login-page { display: grid; place-items: center; min-height: 100%; padding: 16px; }
.login-card {
  width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 28px 24px;
}
.login-card h1 { margin: 0; color: var(--accent); }
.login-card form { display: grid; gap: 6px; margin: 20px 0 12px; }
.login-card label { font-weight: 600; font-size: .9em; margin-top: 6px; }
.login-card button { margin-top: 12px; padding: 9px; }

/* editor page */
.editor-page { display: flex; flex-direction: column; height: 100vh; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 8px 16px;
  background: var(--accent); color: var(--accent-ink);
}
.topbar .brand { font-weight: 700; font-size: 1.1em; margin-right: auto; }
.topbar .role { font-size: .75em; border: 1px solid rgba(255,255,255,.6); border-radius: 10px; padding: 1px 7px; margin-left: 4px; }
.layout { flex: 1; display: grid; grid-template-columns: 240px 1fr; min-height: 0; }
.sidebar { border-right: 1px solid var(--line); background: var(--panel); overflow: auto; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; }
.sidebar h2 { font-size: 1em; margin: 0; }
.program-list { list-style: none; margin: 0; padding: 0 6px 12px; }
.program-list li { display: flex; align-items: center; gap: 4px; border-radius: 6px; }
.program-list li.active { background: #e8f0fb; }
.program-list .open { flex: 1; text-align: left; border: 0; background: none; padding: 6px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.program-list .lang { font-size: .75em; color: var(--muted); }
.program-list .del { border: 0; background: none; color: var(--muted); padding: 2px 8px; visibility: hidden; }
.program-list li:hover .del, .program-list li.active .del { visibility: visible; }
.workspace { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 10px 12px; gap: 8px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar #program-name { width: 220px; max-width: 100%; font-weight: 600; }
.toolbar .spacer { flex: 1; }
.editor { flex: 1 1 55%; min-height: 220px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.io { flex: 1 1 45%; display: grid; grid-template-columns: 1fr 2fr; gap: 8px; min-height: 160px; }
.pane { display: flex; flex-direction: column; min-height: 0; }
.pane h3 { font-size: .9em; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.pane textarea { flex: 1; resize: none; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.output {
  flex: 1; overflow: auto; background: var(--code-bg); color: var(--code-ink); border-radius: 6px;
  padding: 8px 10px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px;
  white-space: pre-wrap; word-break: break-word;
}
.output .muted { color: #8b96a8; }
.output .section { color: #8b96a8; margin-top: 8px; display: block; }
.output .err { color: #ff9b8f; }
.output .ports { color: #9fd5ff; }
.badge { font-size: .75em; font-weight: 600; border-radius: 10px; padding: 1px 8px; color: #fff; background: var(--muted); }
.badge.ok { background: var(--ok); }
.badge.bad { background: var(--danger); }
.badge.limit { background: var(--warn); }

dialog { border: 1px solid var(--line); border-radius: 10px; padding: 20px; width: min(420px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(15, 20, 25, .45); }
dialog form { display: grid; gap: 6px; }
dialog h2 { margin: 0 0 8px; font-size: 1.15em; }
dialog label { font-weight: 600; font-size: .9em; margin-top: 4px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

@media (max-width: 760px) {
  .editor-page { height: auto; min-height: 100vh; }
  .topbar { flex-wrap: wrap; gap: 4px 10px; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); max-height: 180px; }
  .editor { min-height: 320px; flex-basis: 320px; }
  .io { grid-template-columns: 1fr; }
  .pane textarea { min-height: 90px; }
  .output { min-height: 160px; }
  kbd { display: none; }
}
