/* Gronurb Desk — palette taken from the logo */
:root {
  --navy-900: #06163f;
  --navy-800: #0b2a6f;
  --blue-600: #1557d6;
  --blue-500: #1e7bff;
  --cyan-400: #22c3f0;
  --ink: #0d1b3d;
  --ink-2: #44506b;
  --ink-3: #6b7690;
  --line: #dfe5f0;
  --surface: #ffffff;
  --bg: #f3f6fc;
  --focus: rgba(30, 123, 255, .35);
  --danger: #c62d3b;
  --ok: #0f8a5f;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(13, 27, 61, .06), 0 12px 32px -12px rgba(13, 27, 61, .18);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html {
  background:
    radial-gradient(1200px 600px at 110% -10%, rgba(34, 195, 240, .16), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(21, 87, 214, .12), transparent 60%),
    var(--bg);
}
body {
  color: var(--ink);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--blue-600); }
code { font-family: var(--mono); font-size: .88em; background: #eef2fa; padding: .1em .35em; border-radius: 6px; }
h1, h2 { letter-spacing: -.02em; }

/* ---------- boot splash ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.boot img { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.92); opacity: .6; } }

/* ---------- shared controls ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.card h2 { margin: 0; font-size: 19px; }
.card-sub { margin: 6px 0 18px; color: var(--ink-2); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
input, select {
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  background: #fbfcff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  width: 100%;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:hover, select:hover { border-color: #c6d0e2; }
input:focus, select:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 4px var(--focus); background: #fff; }
input[aria-invalid=true] { border-color: var(--danger); }
.id-input { font-family: var(--mono); letter-spacing: .08em; font-size: 17px; }
.help { font-weight: 400; color: var(--ink-3); font-size: 12.5px; }
.hint { margin: 0; color: var(--ink-3); font-size: 13px; }
.pw { position: relative; display: block; }
.pw input { padding-right: 84px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  font: 600 12px var(--font); color: var(--blue-600);
  background: transparent; border: 0; padding: 6px 10px; border-radius: 8px; cursor: pointer;
}
.pw-toggle:hover { background: #eef3ff; }
.meter { height: 4px; border-radius: 4px; background: #e8edf6; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--danger); transition: width .25s, background .25s; }
.meter span.s2 { background: #e39b16; }
.meter span.s3 { background: var(--blue-500); }
.meter span.s4 { background: var(--ok); }

.btn {
  font: 600 15px var(--font);
  border-radius: 12px;
  padding: 11px 18px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .06s, box-shadow .15s, background .15s, opacity .15s;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .tabs button:focus-visible, .pw-toggle:focus-visible, summary:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--focus); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--blue-600), var(--blue-500) 55%, var(--cyan-400));
  box-shadow: 0 8px 20px -8px rgba(21, 87, 214, .7);
}
.btn-primary:hover { box-shadow: 0 10px 26px -8px rgba(21, 87, 214, .85); }
.btn-lg { padding: 14px 20px; font-size: 16px; }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover { background: #f2f5fb; }
.btn-soft { background: #eaf1ff; color: var(--blue-600); font-size: 14px; padding: 9px 14px; margin-top: 8px; }
.btn-soft:hover { background: #dde8ff; }

.tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: #eef2f9; border-radius: 12px; padding: 4px; gap: 4px; }
.tabs button {
  font: 600 14px var(--font); color: var(--ink-2);
  background: transparent; border: 0; border-radius: 9px; padding: 9px 10px; cursor: pointer;
}
.tabs button[aria-selected=true] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(13, 27, 61, .12); }
.tabs-small { display: inline-grid; margin-bottom: 14px; }
.tabs-small button { padding: 7px 18px; }

.form-intro { margin: 4px 0 2px; color: var(--ink-2); }
.form-status { margin: 0; min-height: 1.5em; font-size: 14px; color: var(--ink-2); }
.form-status.error { color: var(--danger); }
.form-status.ok { color: var(--ok); }
.notice { background: #fff6e6; border: 1px solid #f5d89a; color: #7a4d00; padding: 12px 14px; border-radius: 12px; font-size: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--blue-600); }

/* ---------- auth ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 440px);
  gap: clamp(32px, 6vw, 96px);
  align-items: center;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 64px) 24px;
}
.brand-logo { width: min(420px, 90%); height: auto; display: block; margin: 0 0 28px -8px; }
.auth-intro h1 { font-size: clamp(28px, 3.4vw, 42px); line-height: 1.12; margin: 0 0 14px; color: var(--navy-900); }
.lead { font-size: 17px; color: var(--ink-2); margin: 0 0 32px; max-width: 56ch; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--blue-600); margin: 0 0 14px; }
.steps { list-style: none; margin: 0 0 30px; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.steps li { display: flex; gap: 16px; align-items: flex-start; }
.steps strong { color: var(--ink); }
.steps p { margin: 2px 0 0; color: var(--ink-2); font-size: 14.5px; max-width: 58ch; }
.step-num {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--navy-800), var(--blue-500));
  box-shadow: 0 6px 14px -6px rgba(11, 42, 111, .8);
}
.trust { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.trust li {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink-2);
  background: rgba(255, 255, 255, .7); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px;
}
.trust svg { width: 16px; height: 16px; fill: none; stroke: var(--blue-600); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.auth-card { position: relative; padding-top: 44px; }
.card-mark { position: absolute; top: -28px; left: 50%; transform: translateX(-50%); background: #fff; border-radius: 50%; box-shadow: var(--shadow); padding: 4px; }
.auth-card .tabs { margin-bottom: 18px; }
.card-logo { display: none; }

/* ---------- home ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-logo { height: 44px; width: auto; display: block; }
.user { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--navy-800), var(--blue-500));
}
.user-name { display: flex; flex-direction: column; line-height: 1.2; font-weight: 600; font-size: 14px; }
.user-name small { font-weight: 400; color: var(--ink-3); font-size: 12px; }
.user .btn { padding: 8px 14px; font-size: 14px; }

.home-grid {
  max-width: 1180px; margin: 0 auto;
  padding: clamp(20px, 4vw, 40px) clamp(16px, 4vw, 40px) 24px;
  display: grid; gap: 24px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
}
.guide-card, .faq-card { grid-column: span 1; }
.connect-card { border-top: 4px solid var(--blue-500); }
.save-row { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px; background: #f5f8fe; border: 1px dashed #cfdaef; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.badge { font-size: 12px; font-weight: 700; color: var(--blue-600); background: #eaf1ff; padding: 3px 10px; border-radius: 999px; }
.devices { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.device {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcff;
  transition: border-color .15s, box-shadow .15s;
}
.device:hover { border-color: #bcd0f5; box-shadow: 0 6px 16px -10px rgba(21, 87, 214, .5); }
.device-icon { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: #eaf1ff; }
.device-icon svg { width: 22px; height: 22px; fill: none; stroke: var(--blue-600); stroke-width: 1.8; stroke-linejoin: round; }
.device-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.device-main b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-main span { font-family: var(--mono); font-size: 13px; color: var(--ink-3); }
.device-main .quick { font-size: 11.5px; font-weight: 700; color: var(--ok); }
.device-actions { display: flex; gap: 6px; }
.device-actions button {
  font: 600 13px var(--font); border-radius: 10px; padding: 7px 10px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
}
.device-actions button:hover { background: #f2f5fb; }
.device-actions .go { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.device-actions .go:hover { background: var(--blue-500); }
.empty { margin: 0; color: var(--ink-3); font-size: 14px; }

.guide { margin: 0; padding: 0; list-style: none; counter-reset: g; display: flex; flex-direction: column; gap: 14px; }
.guide li { counter-increment: g; position: relative; padding-left: 40px; color: var(--ink-2); font-size: 14.5px; }
.guide li::before {
  content: counter(g); position: absolute; left: 0; top: 0;
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font: 700 13px var(--font); color: var(--blue-600); background: #eaf1ff;
}
.guide strong { color: var(--ink); }
.guide .btn-soft { display: flex; width: fit-content; }
.guide .help { display: block; margin-top: 4px; }
.code {
  margin-top: 8px; display: flex; align-items: stretch; gap: 0;
  background: var(--navy-900); border-radius: 12px; overflow: hidden;
}
.code code { flex: 1; display: block; background: transparent; color: #cfe3ff; padding: 12px 14px; font-size: 12.5px; overflow-x: auto; white-space: nowrap; border-radius: 0; }
.code .copy { flex: none; font: 600 12px var(--font); color: #fff; background: rgba(255, 255, 255, .1); border: 0; padding: 0 14px; cursor: pointer; }
.code .copy:hover { background: rgba(255, 255, 255, .2); }
.guide-card .hint { margin-top: 18px; }

.faq-card h2 { margin-bottom: 10px; }
details { border-top: 1px solid var(--line); }
details:last-child { border-bottom: 1px solid var(--line); }
summary { cursor: pointer; list-style: none; padding: 13px 28px 13px 0; font-weight: 600; position: relative; border-radius: 8px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; position: absolute; right: 4px; top: 10px; font-size: 20px; color: var(--blue-600); transition: transform .2s; }
details[open] summary::after { transform: rotate(45deg); }
details p { margin: 0 0 14px; color: var(--ink-2); font-size: 14.5px; }
.foot { text-align: center; color: var(--ink-3); font-size: 12.5px; padding: 8px 16px 28px; }

/* ---------- verification dialog ---------- */
dialog {
  border: 0; border-radius: 22px; padding: 30px; width: min(440px, calc(100vw - 32px));
  box-shadow: 0 30px 80px -20px rgba(6, 22, 63, .5); color: var(--ink);
}
dialog::backdrop { background: rgba(6, 22, 63, .45); backdrop-filter: blur(4px); }
dialog h2 { margin: 0; font-size: 20px; }
dialog p { margin: 0; color: var(--ink-2); }
.dialog-mark { align-self: center; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---------- remote session (dark, stays out of the way) ---------- */
#session-view { position: fixed; inset: 0; display: flex; flex-direction: column; background: #000; color: #e8eefc; }
#toolbar {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 5px 10px; background: #0b1430; border-bottom: 1px solid #1c2a52;
}
.toolbar-mark { display: block; }
#toolbar select, #toolbar button {
  font: 13px var(--font); color: #e8eefc; background: #14214a; border: 1px solid #25376e;
  border-radius: 8px; padding: 4px 10px; width: auto; cursor: pointer;
}
#toolbar button:hover { background: #1b2c60; }
#toolbar button.danger { background: #5a1621; border-color: #7c2331; }
#toolbar button.danger:hover { background: #761c2b; }
#session-title { font-weight: 600; margin-right: auto; font-size: 14px; }
#stage { position: relative; flex: 1; min-height: 0; }
#video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; outline: none; touch-action: none; }
#stats {
  position: absolute; top: 8px; left: 8px; margin: 0; padding: 6px 8px;
  background: rgba(0, 0, 0, .7); color: #9f9; font: 12px/1.35 var(--mono);
  pointer-events: none; border-radius: 6px;
}
#overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; background: rgba(0, 0, 0, .55); font-size: 18px; text-align: center; padding: 16px;
}

/* ---------- file transfer panel (inside the dark session) ---------- */
#files-panel {
  position: absolute; top: 8px; right: 8px; bottom: 8px; width: min(420px, calc(100% - 16px));
  display: flex; flex-direction: column; gap: 10px;
  background: rgba(11, 20, 48, .97); color: #e8eefc;
  border: 1px solid #25376e; border-radius: 14px; padding: 14px;
  box-shadow: 0 20px 60px -10px rgba(0, 0, 0, .7); z-index: 3;
  font-size: 14px;
}
.files-head { display: flex; align-items: center; justify-content: space-between; }
.files-head h2 { margin: 0; font-size: 16px; }
#files-panel button {
  font: 13px var(--font); color: #e8eefc; background: #14214a; border: 1px solid #25376e;
  border-radius: 8px; padding: 5px 10px; cursor: pointer;
}
#files-panel button:hover { background: #1b2c60; }
#files-panel .btn-primary { background: linear-gradient(135deg, var(--blue-600), var(--blue-500)); border: 0; padding: 9px 12px; font-weight: 600; width: 100%; }
.files-roots { display: flex; flex-wrap: wrap; gap: 6px; }
.files-roots button[aria-current=true] { background: var(--blue-600); border-color: var(--blue-500); }
.files-bar { display: flex; align-items: center; gap: 6px; }
#files-path { flex: 1; min-width: 0; font: 12px var(--mono); color: #9fb3e6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left; }
.files-list { list-style: none; margin: 0; padding: 0; flex: 1; min-height: 80px; overflow-y: auto; border: 1px solid #1c2a52; border-radius: 10px; }
.files-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid #16224a; cursor: pointer; }
.files-list li:hover, .files-list li:focus { background: #14214a; outline: none; }
.files-list .ico { width: 18px; text-align: center; flex: none; }
.files-list .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-list .meta { font-size: 12px; color: #8ea0cc; flex: none; }
.files-list .empty { color: #8ea0cc; cursor: default; }
.files-status { margin: 0; min-height: 1.2em; font-size: 13px; color: #9fb3e6; }
.files-status.error { color: #ff8a93; }
.files-actions { display: flex; flex-direction: column; gap: 6px; }
.files-hint { margin: 0; font-size: 12px; color: #8ea0cc; }
.files-transfers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 30%; overflow-y: auto; }
.files-transfers li { background: #0f1a3d; border: 1px solid #1c2a52; border-radius: 10px; padding: 8px 10px; display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; font-size: 12.5px; }
.files-transfers .tname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-transfers .tbar { grid-column: 1 / -1; height: 4px; background: #1c2a52; border-radius: 4px; overflow: hidden; }
.files-transfers .tbar span { display: block; height: 100%; width: 0; background: var(--cyan-400); transition: width .2s; }
.files-transfers .tstate { grid-column: 1 / -1; color: #8ea0cc; }
.files-transfers li.done .tbar span { background: var(--ok); }
.files-transfers li.failed .tstate { color: #ff8a93; }
#drop-overlay {
  position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; text-align: center;
  background: rgba(21, 87, 214, .35); border: 3px dashed #7fb2ff; color: #fff; font-size: 20px; pointer-events: none;
}

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .auth { grid-template-columns: 1fr; gap: 40px; }
  .auth-card { order: -1; max-width: 480px; width: 100%; justify-self: center; }
  .brand-logo, .card-mark { display: none; }
  .auth-card { padding-top: 24px; }
  .card-logo { display: block; width: min(260px, 80%); height: auto; margin: 0 auto 18px; }
  .auth-intro { max-width: 640px; justify-self: center; }
  .home-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .card { padding: 22px 18px; }
  .user-name { display: none; }
  .topbar-logo { height: 36px; }
  .device { flex-wrap: wrap; }
  .device-actions { width: 100%; justify-content: flex-end; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
