/* 360 Remote — one stylesheet for the app and the viewer. */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --text: #14171c;
  --muted: #5b6370;
  --faint: #8a919c;
  --border: #e1e4e9;
  --accent: #2f6fed;
  --accent-ink: #ffffff;
  --accent-soft: #e8efff;
  --ok: #17904d;
  --ok-soft: #e3f5ea;
  --warn: #b7791f;
  --warn-soft: #fbf1df;
  --danger: #cf3030;
  --danger-soft: #fdeaea;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1014;
    --surface: #161920;
    --surface-2: #1b1f27;
    --text: #e7e9ee;
    --muted: #a0a7b3;
    --faint: #727a87;
    --border: #272c35;
    --accent: #5b8cff;
    --accent-ink: #0b1020;
    --accent-soft: #1b2744;
    --ok: #3ccf7f;
    --ok-soft: #12291d;
    --warn: #e2a64a;
    --warn-soft: #2c2213;
    --danger: #ff6b6b;
    --danger-soft: #331717;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 620; }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.hidden { display: none !important; }

/* ---- buttons + inputs ---------------------------------------------------------------------- */
button, .btn {
  font: inherit; font-weight: 550; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  white-space: nowrap;
}
button:hover { background: var(--surface-2); }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover { filter: brightness(1.06); }
button.danger { color: var(--danger); }
button.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
button.ghost { background: transparent; border-color: transparent; }
button.ghost:hover { background: var(--surface-2); }
button.small { height: 28px; padding: 0 10px; font-size: 13px; }
button.wide { width: 100%; height: 40px; }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-weight: 550; margin-bottom: 6px; }
label.field > small { display: block; margin-top: 5px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input:not([type]), select, textarea {
  font: inherit; width: 100%; height: 38px; padding: 0 11px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text);
}
textarea { height: auto; padding: 9px 11px; resize: vertical; }
input.code { font-size: 22px; letter-spacing: .35em; text-align: center; height: 50px; font-family: ui-monospace, Consolas, monospace; }
label.check { display: flex; gap: 9px; align-items: flex-start; margin: 10px 0; cursor: pointer; }
label.check input { margin-top: 3px; }

.error { color: var(--danger); background: var(--danger-soft); border-radius: 8px; padding: 9px 12px; margin: 0 0 14px; }
.note { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; color: var(--muted); }

/* ---- auth card ----------------------------------------------------------------------------- */
.auth-wrap { min-height: 100%; display: grid; place-items: center; padding: 32px 16px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow); padding: 28px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 680; font-size: 16px; }
.brand img { width: 26px; height: 26px; }
.auth-card .brand { margin-bottom: 22px; }
.auth-card h1 { margin-bottom: 6px; }
.auth-card p.lead { margin: 0 0 20px; color: var(--muted); }
.qr { display: grid; place-items: center; background: #fff; border-radius: 10px; padding: 10px; margin: 0 auto 12px; width: 200px; height: 200px; }
.qr svg { width: 180px; height: 180px; }
.secret { text-align: center; margin-bottom: 18px; word-break: break-all; }

/* ---- app shell ----------------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 0 20px; height: 56px; display: flex; align-items: center; gap: 24px; }
.tabs { display: flex; gap: 2px; flex: 1; }
.tabs a {
  color: var(--muted); font-weight: 550; padding: 7px 12px; border-radius: 7px; text-decoration: none;
}
.tabs a:hover { background: var(--surface-2); color: var(--text); }
.tabs a.on { color: var(--text); background: var(--surface-2); }
.who { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 650; font-size: 13px;
}
main.page { max-width: 1180px; margin: 0 auto; padding: 28px 20px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ---- computers ----------------------------------------------------------------------------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 12px; position: relative;
}
.card-top { display: flex; gap: 12px; align-items: flex-start; }
.pc-icon {
  width: 40px; height: 40px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border);
  display: grid; place-items: center; flex: none; color: var(--muted);
}
.card.online .pc-icon { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.card-title { flex: 1; min-width: 0; }
.card-title h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-title .sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12.5px; color: var(--muted); }
.card-actions { display: flex; gap: 8px; margin-top: auto; }
.card-actions .primary { flex: 1; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 99px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.off { color: var(--faint); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.plain::before { display: none; }

.empty {
  text-align: center; padding: 56px 20px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
}
.empty h2 { margin-bottom: 6px; }
.empty p { color: var(--muted); margin: 0 0 18px; }

/* ---- menus -------------------------------------------------------------------------------- */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 200px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px; box-shadow: var(--shadow); padding: 5px;
}
.menu button { width: 100%; justify-content: flex-start; border: 0; background: transparent; height: 32px; font-weight: 500; }
.menu button:hover { background: var(--surface-2); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 0; }

/* ---- tables ------------------------------------------------------------------------------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); font-weight: 600; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td .sub { color: var(--muted); font-size: 12.5px; }
td.actions { text-align: right; white-space: nowrap; }
.section { margin-top: 30px; }
.section > h2 { margin-bottom: 12px; }

/* ---- modal -------------------------------------------------------------------------------- */
.modal-back { position: fixed; inset: 0; background: rgba(10, 14, 22, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal {
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3); width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto;
}
.modal-head { padding: 20px 22px 0; }
.modal-head p { margin: 6px 0 0; color: var(--muted); }
.modal-body { padding: 18px 22px; }
.modal-foot { padding: 0 22px 20px; display: flex; justify-content: flex-end; gap: 8px; }
.copy-box { display: flex; gap: 8px; align-items: stretch; margin: 6px 0 14px; }
.copy-box code {
  flex: 1; display: block; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 11px; word-break: break-all; max-height: 160px; overflow: auto;
}
.big-code { font-size: 28px; font-weight: 650; letter-spacing: .12em; text-align: center; padding: 14px; background: var(--surface-2); border-radius: 10px; margin-bottom: 14px; font-family: ui-monospace, Consolas, monospace; }
ol.steps { padding-left: 20px; margin: 0 0 6px; }
ol.steps li { margin-bottom: 8px; }
.checklist { max-height: 220px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: #1d2230; color: #fff; padding: 10px 16px; border-radius: 9px; box-shadow: var(--shadow); font-weight: 500;
}

/* ---- viewer ------------------------------------------------------------------------------- */
body.viewer { background: #000; overflow: hidden; color: #e7e9ee; color-scheme: dark; }
#stage { position: fixed; inset: 0; display: grid; place-items: center; }
#screen {
  display: block; background: #000; touch-action: none;
  /* Small dot: the real pointer is drawn into the video, this just shows where yours is. */
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10'%3E%3Ccircle cx='5' cy='5' r='3' fill='white' stroke='black' stroke-width='1.2'/%3E%3C/svg%3E") 5 5, crosshair;
}
#screen:focus { outline: none; }
.vbar {
  position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 20;
  display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 12px;
  background: rgba(22, 25, 32, .92); border: 1px solid rgba(255, 255, 255, .09); box-shadow: 0 8px 30px rgba(0, 0, 0, .45);
  transition: opacity .2s, transform .2s; backdrop-filter: blur(8px); max-width: calc(100vw - 20px); overflow-x: auto;
}
.vbar.tucked { opacity: 0; transform: translate(-50%, -70px); pointer-events: none; }
.vbar button, .vbar select {
  height: 30px; border-radius: 7px; background: transparent; border: 1px solid transparent; color: #e7e9ee;
  padding: 0 10px; font-size: 13px; font-weight: 500;
}
.vbar select { width: auto; background: rgba(255, 255, 255, .06); }
.vbar button:hover { background: rgba(255, 255, 255, .1); }
.vbar button.on { background: rgba(91, 140, 255, .25); color: #fff; }
.vbar button.end { color: #ff8a8a; }
.vbar .sep { width: 1px; height: 20px; background: rgba(255, 255, 255, .12); margin: 0 2px; }
.vbar .title { font-weight: 620; padding: 0 8px 0 4px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.vbar .dot { width: 8px; height: 8px; border-radius: 50%; background: #727a87; }
.vbar .dot.live { background: #3ccf7f; }
.vbar .dot.bad { background: #e2a64a; }
.vbar .stats { font: 12px ui-monospace, Consolas, monospace; color: #a0a7b3; padding: 0 8px; white-space: nowrap; }
.vbar .mon { display: flex; gap: 2px; }
.vbar .mon button { min-width: 30px; padding: 0 8px; }
.peek { position: fixed; top: 0; left: 50%; transform: translateX(-50%); width: 240px; height: 8px; z-index: 19; }
.overlay {
  position: fixed; inset: 0; display: grid; place-items: center; z-index: 15; pointer-events: none;
}
.overlay .box {
  pointer-events: auto; text-align: center; background: rgba(22, 25, 32, .92); border: 1px solid rgba(255, 255, 255, .09);
  padding: 22px 28px; border-radius: 14px; max-width: 420px;
}
.overlay .box h2 { margin-bottom: 6px; font-size: 17px; }
.overlay .box p { margin: 0; color: #a0a7b3; }
.overlay .box .row { margin-top: 16px; display: flex; gap: 8px; justify-content: center; }
.overlay .box button { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .12); color: #fff; }
.overlay .box button.primary { background: #5b8cff; border-color: #5b8cff; color: #0b1020; }
.spinner {
  width: 28px; height: 28px; margin: 0 auto 14px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .15); border-top-color: #5b8cff; animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.vtoast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 30;
  background: rgba(22, 25, 32, .95); border: 1px solid rgba(255, 255, 255, .1); color: #e7e9ee;
  padding: 9px 15px; border-radius: 9px; font-size: 13px;
}

@media (max-width: 640px) {
  .topbar-inner { gap: 10px; padding: 0 12px; }
  .who .name { display: none; }
  main.page { padding: 20px 12px 40px; }
  .page-head { flex-direction: column; align-items: stretch; }
}
