:root {
  --bg: #0b0f14;
  --panel: #111821;
  --panel-2: #16202b;
  --line: #1f2c3a;
  --text: #e6edf5;
  --muted: #8ba0b6;
  --accent: #35c2a4;
  --danger: #e5484d;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Segoe UI", system-ui, sans-serif;
}

button, input, select {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
}

button { cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }
button:not(:disabled):hover { border-color: #33475e; }

.ghost { background: transparent; }
.danger { background: #3a1417; border-color: #5a1d22; }
.small { padding: 4px 8px; font-size: 12px; }
.muted { color: var(--muted); }
.error { color: #ff8b8f; }
.code { display: block; padding: 10px; background: #0a1016; border: 1px solid var(--line); border-radius: 8px; word-break: break-all; font-family: Consolas, monospace; font-size: 12px; }

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(1200px 600px at 50% -10%, #14342f 0%, var(--bg) 60%);
}

.card {
  width: 340px;
  display: grid;
  gap: 12px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.card h1, .card h2 { margin: 0; font-size: 20px; }
.card label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.brand { font-weight: 700; letter-spacing: .5px; color: var(--accent); }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.layout { display: grid; grid-template-columns: 280px 1fr; height: calc(100vh - 57px); }

.sidebar {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--panel);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.sidebar-head h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }

.devices { list-style: none; margin: 0; padding: 8px; overflow: auto; }

.device {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
}
.device:hover { background: var(--panel-2); }
.device.active { background: var(--panel-2); border-color: var(--line); }
.device .name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.device .meta { color: var(--muted); font-size: 12px; margin-top: 4px; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: #3d4a59; flex: none; }
.dot.online { background: var(--accent); box-shadow: 0 0 8px #35c2a480; }
.dot.live { background: var(--danger); box-shadow: 0 0 8px #e5484d80; }

.audit { border-top: 1px solid var(--line); padding: 10px 14px; overflow: auto; max-height: 38%; }
.audit h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.audit ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.audit li { font-size: 12px; color: var(--muted); border-left: 2px solid var(--line); padding-left: 8px; }
.audit li b { color: var(--text); font-weight: 600; }

.stage { display: flex; flex-direction: column; min-width: 0; padding: 14px; gap: 10px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.device-title { font-weight: 600; }
.toolbar-actions { display: flex; gap: 8px; }

.screen {
  position: relative;
  flex: 1;
  min-height: 260px;
  display: grid;
  place-items: center;
  background: #05080b;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

#view { display: none; max-width: 100%; max-height: 100%; outline: none; }
#view.visible { display: block; }

.placeholder { color: var(--muted); text-align: center; padding: 24px; max-width: 420px; }
.placeholder[hidden] { display: none; }

.live {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #3a1417;
  color: #ff9a9d;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
}

.browser-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.browser-bar input { flex: 0 0 auto; }
.browser-bar #url { flex: 1 1 200px; }

.hint { margin: 0; color: var(--muted); font-size: 12px; }

dialog { background: transparent; border: 0; color: var(--text); }
dialog::backdrop { background: #000a; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
