:root {
  color-scheme: dark;
  --bg: #08110f;
  --panel: #101b18;
  --panel-2: #15231f;
  --line: #274139;
  --text: #ecf6f2;
  --muted: #8da99f;
  --accent: #43d99a;
  --accent-2: #1e7556;
  --danger: #ff6b69;
  --warning: #f6bd60;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 20% 0%, #15362b 0, var(--bg) 34%); color: var(--text); font: 15px/1.5 "Segoe UI", sans-serif; }
header { display: flex; justify-content: space-between; align-items: center; padding: 28px 36px 18px; border-bottom: 1px solid var(--line); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 25px; letter-spacing: -.4px; }
h2 { margin-bottom: 16px; font-size: 17px; }
.eyebrow { color: var(--accent); font: 700 11px/1 monospace; letter-spacing: 2px; }
main { padding: 24px 36px 36px; }
.panel { background: rgba(16, 27, 24, .94); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 60px rgba(0,0,0,.2); }
.auth-panel { max-width: 760px; padding: 24px; }
.row, .pairing, .session-header, .prompt-form { display: flex; gap: 12px; align-items: end; }
label { flex: 1; color: var(--muted); font-size: 13px; }
input, textarea { width: 100%; margin-top: 7px; border: 1px solid var(--line); border-radius: 10px; background: #0a1512; color: var(--text); padding: 11px 13px; font: inherit; outline: none; }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(67,217,154,.12); }
button { border: 0; border-radius: 10px; background: var(--accent); color: #052017; padding: 11px 17px; font-weight: 700; cursor: pointer; white-space: nowrap; }
button:hover { filter: brightness(1.08); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.danger { color: #ffd9d8; background: #612b2b; }
.hint, .muted { color: var(--muted); }
.hint { margin: 10px 0 0; font-size: 13px; }
.hidden { display: none !important; }
.workspace { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 18px; min-height: calc(100vh - 145px); }
.sidebar { padding: 20px; max-height: calc(100vh - 145px); overflow-y: auto; }
.pairing { align-items: stretch; }
.pairing input { margin-top: 0; text-transform: uppercase; font-family: Consolas, monospace; letter-spacing: 1px; }
.section-title { color: var(--muted); margin: 28px 0 10px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.section-title.first { margin-top: 0; }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 5px; padding: 0 6px; border-radius: 10px; background: var(--accent-2); color: var(--text); }
.request-list, .device-list { display: grid; gap: 8px; }
.request-card, .managed-device { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.request-card.repair { border-color: #6e5930; }
.request-card small, .managed-device small, .empty-note { color: var(--muted); }
.request-card input { margin: 0; padding: 8px 10px; font-size: 13px; }
.problem-details { display: grid; gap: 4px; padding: 10px; border-radius: 9px; background: #171b22; }
.problem-details span { color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.card-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.card-actions button { padding: 8px 10px; font-size: 12px; }
.deny { background: #492b2b; color: #ffd1d0; }
.link { justify-self: start; padding: 3px 0; background: transparent; color: var(--muted); }
.danger-link { color: var(--danger); }
.assignment { margin: 5px 0 0; color: var(--accent); font-size: 13px; }
.session-list { display: grid; gap: 8px; }
.session-item { text-align: left; background: var(--panel-2); color: var(--text); border: 1px solid transparent; padding: 12px; }
.session-item.active { border-color: var(--accent); }
.session-item small { display: block; color: var(--muted); margin-top: 3px; }
.console { min-width: 0; padding: 22px; }
.empty-state { display: grid; place-content: center; height: 100%; min-height: 400px; text-align: center; color: var(--muted); }
.session-header { justify-content: space-between; align-items: start; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.session-header h2 { font-size: 22px; margin: 8px 0 0; }
.status { display: inline-flex; align-items: center; gap: 7px; color: var(--accent); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 12px currentColor; }
.messages { height: calc(100vh - 390px); min-height: 320px; overflow: auto; padding: 20px 4px; display: flex; flex-direction: column; gap: 14px; }
.message { max-width: 82%; padding: 13px 15px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user { align-self: flex-end; background: var(--accent-2); }
.message.assistant { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); }
.message .label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.tool { color: var(--warning); font-family: Consolas, monospace; font-size: 13px; }
.prompt-form { align-items: stretch; border-top: 1px solid var(--line); padding-top: 16px; }
.prompt-form textarea { resize: vertical; margin: 0; }
.approvals { display: grid; gap: 10px; margin-top: 15px; }
.approval { border: 1px solid #6e5930; background: #2b2619; border-radius: 12px; padding: 14px; }
.approval pre { max-height: 190px; overflow: auto; white-space: pre-wrap; color: #ffe6b1; }
.approval-actions { display: flex; gap: 8px; }
.approval .deny { background: #492b2b; color: #ffd1d0; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 420px; background: #182a24; border: 1px solid var(--accent); border-radius: 12px; padding: 13px 16px; box-shadow: 0 15px 40px rgba(0,0,0,.4); }

@media (max-width: 820px) {
  header, main { padding-left: 18px; padding-right: 18px; }
  .workspace { grid-template-columns: 1fr; }
  .messages { height: 55vh; }
}
