:root {
  --bg: #0A0E1A; --bg-deep: #06080F; --sidebar: #0D1220; --surface: #121829; --surface-2: #161C2E;
  --line: #232B40; --line-soft: #1C2338; --line-strong: #343E5C;
  --text: #EEF1F7; --text-2: #B4BCCF; --muted: #9AA3B8;
  --sky: #38BDF8; --sky-light: #7DD3FC; --sky-wash: #0F2A3D; --sky-border: #1F5577;
  --amber: #FFB224; --on-amber: #1A1206;
  --online: #34D399; --online-text: #6EE7B7;
  --danger-text: #FCA5A5; --danger-border: #7F2D2D;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: 'DM Sans', system-ui, sans-serif; font-size: 15px; }
[hidden] { display: none !important; }

.brand { display: flex; align-items: center; gap: 10px; font-family: 'Manrope', sans-serif; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }
.logo { width: 32px; height: 32px; border-radius: 9px; background: var(--sky); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.logo.small { width: 28px; height: 28px; border-radius: 8px; }

h1, h2 { font-family: 'Manrope', sans-serif; letter-spacing: -0.02em; margin: 0; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 17px; font-weight: 700; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
input, select { background: var(--bg); color: var(--text); border: 1px solid var(--line-strong); border-radius: 12px; min-height: 44px; padding: 0 14px; font: inherit; }
select { appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239AA3B8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
input:focus, select:focus { outline: 2px solid var(--sky); outline-offset: 1px; }

button { font: inherit; font-weight: 600; min-height: 44px; padding: 0 20px; border-radius: 999px; cursor: pointer; }
.primary { background: var(--sky); color: #0A0E1A; border: none; }
.secondary { background: transparent; color: var(--text); border: 1px solid var(--line-strong); }
.danger { background: transparent; color: var(--danger-text); border: 1px solid var(--danger-border); }
/* Waiting on the server: a spinner where the label was, at the same size. */
button.busy { position: relative; cursor: progress; -webkit-text-fill-color: transparent; }
button.busy > * { visibility: hidden; }
button.busy::after { content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; box-sizing: border-box; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { button.busy::after { animation-duration: 2s; } }
.primary-link { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px; border-radius: 999px; background: var(--sky); color: #0A0E1A; font-weight: 600; text-decoration: none; align-self: flex-start; }
.link { color: var(--sky-light); font-weight: 600; font-size: 14px; text-decoration: none; }
.link:hover { text-decoration: underline; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.spaced { margin-top: 12px; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.grow { flex-grow: 1; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.message { color: var(--danger-text); font-size: 14px; margin: 0; }
.message:empty { display: none; }
.message.ok { color: var(--online-text); }
.mono { font-family: 'JetBrains Mono', monospace; font-size: 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; word-break: break-all; }

/* Signing in */
.auth { max-width: 440px; margin: 0 auto; padding: 48px 16px 64px; display: flex; flex-direction: column; gap: 24px; }
.sso { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.secondary-link { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--text); font-weight: 600; text-decoration: none; }
.secondary-link:hover { border-color: var(--sky-border); color: var(--sky-light); }
.auth .link-button { padding: 0; }
.details { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }

/* Portal layout */
.shell { display: flex; min-height: 100%; }
.sidebar { width: 240px; flex-shrink: 0; background: var(--sidebar); border-right: 1px solid var(--line-soft); padding: 22px 14px; display: flex; flex-direction: column; gap: 28px; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { padding: 0 8px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 12px; color: var(--text-2); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--surface); color: var(--text); }
.nav a.active { background: var(--sky-wash); color: var(--sky-light); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 0 8px; }
.sidebar-foot .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.content { flex-grow: 1; min-width: 0; max-width: 1180px; padding: 32px 32px 64px; display: flex; flex-direction: column; gap: 20px; }
.page { display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head > div:first-child { display: flex; flex-direction: column; gap: 6px; max-width: 640px; }

.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--sky-wash); border: 1px solid var(--sky-border); color: var(--sky-light); border-radius: 14px; padding: 8px 8px 8px 16px; font-weight: 500; }
.banner-message { padding: 0 4px; }

.search { flex-direction: row; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 999px; padding: 0 14px; min-height: 44px; }
.search input { border: none; background: transparent; min-height: 40px; padding: 0; width: 200px; }
.search input:focus { outline: none; }
.search:focus-within { outline: 2px solid var(--sky); outline-offset: 1px; }

/* Computer cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.cards:empty { display: none; }
.computer-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; }
.thumb { aspect-ratio: 16 / 10; background: var(--surface-2); border-bottom: 1px solid var(--line-soft); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 13px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.idle { color: #6B7590; }
.card-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.actions { flex-wrap: nowrap; }
.actions button { padding: 0 16px; }
.actions .icon-button { padding: 0; flex-shrink: 0; }
.computer-name { font-family: 'Manrope', sans-serif; font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); }
.status { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); flex-shrink: 0; }
.status.online { color: var(--online-text); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #7C86A0; }
.status.online .dot { background: var(--online); }
.icon-button { background: transparent; border: none; color: var(--muted); min-width: 44px; min-height: 44px; padding: 0; font-size: 20px; }
.icon-button:hover { color: var(--text); }
.danger-text:hover { color: var(--danger-text); }
.empty { align-items: flex-start; }
.apps-strip { gap: 8px; }

/* Guest links and downloads */
.list { gap: 0; padding: 6px 22px; }
.list > .hint { padding: 16px 0; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.list-row:first-child { border-top: none; }
.list-row > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.download { gap: 10px; }
.download.current { border-color: var(--sky-border); }
.soon { align-self: flex-start; font-size: 13px; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 999px; padding: 6px 12px; }

/* Team */
.subnav { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; overflow-x: auto; align-self: flex-start; max-width: 100%; }
.subnav-item { background: transparent; color: var(--text-2); border: none; border-radius: 999px; min-height: 40px; padding: 0 16px; font-weight: 500; font-size: 14px; white-space: nowrap; }
.subnav-item:hover { color: var(--text); }
.subnav-item.active { background: var(--sky-wash); color: var(--sky-light); }
.team-tab { display: flex; flex-direction: column; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.member-row { display: flex; flex-direction: column; gap: 12px; padding: 16px 0; border-top: 1px solid var(--line-soft); }
.member-row:first-child { border-top: none; }
.member-edit { display: flex; flex-direction: column; gap: 10px; padding-left: 12px; border-left: 2px solid var(--line); }
.member-edit select { align-self: flex-start; }
.checks { display: flex; flex-direction: column; gap: 10px; }
.checks.inline { flex-direction: row; flex-wrap: wrap; gap: 8px 18px; }
.check { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--text); font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; accent-color: var(--sky); }
.checks > .check .hint { flex-basis: 100%; padding-left: 28px; }
.plain-list { display: flex; flex-direction: column; }
.plain-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.plain-row:first-child { border-top: none; }
.link-button.danger-text { color: var(--danger-text); }

/* Dialogs */
.dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 20px; padding: 0; width: min(460px, calc(100% - 32px)); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55); }
.dialog::backdrop { background: rgba(6, 8, 15, 0.75); }
.dialog-body { padding: 24px; display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - 48px); overflow-y: auto; }
.dialog-section { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
h3 { font-family: 'Manrope', sans-serif; font-size: 15px; font-weight: 700; margin: 0; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; color: var(--text-2); line-height: 1.5; }

/* Live session */
#session { position: fixed; inset: 0; background: var(--bg-deep); display: flex; flex-direction: column; z-index: 20; }
.session-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 16px; background: var(--sidebar); border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.session-name { font-family: 'Manrope', sans-serif; font-weight: 700; font-size: 15px; }
.live { background: var(--amber); color: var(--on-amber); font-family: 'JetBrains Mono', monospace; font-size: 11px; padding: 3px 8px; border-radius: 999px; }
.live.recorded { background: #3A1518; color: var(--danger-text); border: 1px solid var(--danger-border); }
.stats { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); padding: 4px 10px; border-radius: 999px; }
.stats:empty { display: none; }
.stats.watching { color: var(--sky-light); border-color: var(--sky-border); background: var(--sky-wash); }
.tools { display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; flex-wrap: wrap; }
.tool { background: transparent; color: #DDE2EC; border: none; border-radius: 999px; min-height: 44px; padding: 0 14px; font-size: 14px; font-weight: 500; cursor: pointer; list-style: none; display: inline-flex; align-items: center; }
.tool:hover, .menu[open] > .tool { background: var(--sky-wash); color: var(--sky-light); }
.menu { position: relative; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; top: calc(100% + 8px); left: 0; z-index: 10; min-width: 260px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 6px; display: flex; flex-direction: column; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); }
.menu-item { background: transparent; color: var(--text); border: none; border-radius: 10px; text-align: left; font-weight: 500; padding: 0 12px; }
.menu-item:hover { background: var(--sky-wash); color: var(--sky-light); }

.privacy-toggle { min-height: 40px; padding: 0 14px; font-size: 14px; }
.privacy-toggle.on { background: var(--sky-wash); color: var(--sky-light); border-color: var(--sky-border); }

.tab-strip { display: flex; align-items: flex-end; gap: 4px; padding: 6px 12px 0; background: var(--sidebar); border-bottom: 1px solid var(--line-soft); overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 6px 0 14px; border-radius: 10px 10px 0 0; background: transparent; color: var(--text-2); border: 1px solid transparent; border-bottom: none; font-weight: 500; font-size: 14px; white-space: nowrap; }
.tab:hover { background: var(--surface); }
.tab.active { background: var(--bg-deep); color: var(--text); border-color: var(--line-soft); }
.tab-dot { width: 7px; height: 7px; border-radius: 50%; background: #7C86A0; }
.tab-dot.live { background: var(--online); }
.tab-close { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 8px; color: var(--muted); font-size: 16px; }
.tab-close:hover { background: var(--line); color: var(--text); }
.tab-add { min-height: 34px; padding: 0 12px; margin-bottom: 4px; background: transparent; color: var(--sky-light); border: none; font-size: 14px; white-space: nowrap; }
.tab-add:hover { background: var(--sky-wash); border-radius: 10px; }

.session-body { position: relative; flex-grow: 1; min-height: 0; display: flex; }
.screens { flex-grow: 1; min-width: 0; min-height: 0; display: flex; }
.screen-area { position: relative; flex-grow: 1; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 10px; outline: none; overflow: hidden; }
.screen-area:focus-visible { box-shadow: inset 0 0 0 2px var(--sky); }
.screen { width: 100%; height: 100%; object-fit: contain; background: #000; border-radius: 10px; touch-action: none; }
.touch-cursor { position: absolute; left: 0; top: 0; width: 20px; height: 20px; pointer-events: none; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6)); }
.screen-area.actual-size { overflow: auto; display: block; }
.screen-area.actual-size .screen { width: auto; height: auto; max-width: none; max-height: none; }

.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(6, 8, 15, 0.82); padding: 16px; }
.overlay-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; display: flex; flex-direction: column; gap: 14px; }

.toast { position: absolute; left: 24px; bottom: 24px; z-index: 6; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); max-width: calc(100% - 48px); }

.print-card { position: absolute; right: 24px; bottom: 24px; z-index: 7; width: min(360px, calc(100% - 48px)); background: var(--surface); border: 1px solid var(--sky-border); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); }
.print-card h2 { font-size: 15px; }
.print-card p { margin-top: 4px; overflow-wrap: anywhere; }
.print-card .icon-button { margin-left: auto; }
.print-frame { position: fixed; right: 0; bottom: 0; width: 1px; height: 1px; border: 0; opacity: 0; pointer-events: none; }

/* Files */
.files-panel { width: 320px; flex-shrink: 0; background: var(--sidebar); border-left: 1px solid var(--line-soft); padding: 16px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.files-content { display: flex; flex-direction: column; gap: 16px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; }
.link-button { background: transparent; border: none; color: var(--sky-light); min-height: 32px; padding: 0 6px; font-weight: 600; font-size: 13px; }
.drop-zone { border: 1.5px dashed var(--sky-border); background: #0B1A28; border-radius: 14px; padding: 22px 16px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; color: #DDE2EC; font-size: 14px; }
.drop-zone.dragging { border-color: var(--sky); background: var(--sky-wash); }
.transfers { display: flex; flex-direction: column; gap: 12px; }
.transfers:empty { display: none; }
.transfer { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.transfer-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.transfer-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transfer-side { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.transfer-done { color: var(--online-text); font-size: 13px; flex-shrink: 0; }
.transfer-failed { color: var(--danger-text); font-size: 13px; flex-shrink: 0; }
.bar { height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar-fill { height: 5px; background: var(--sky); border-radius: 3px; }
.browser { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.browser-header { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.browser-path { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.browser-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: transparent; border: none; border-radius: 10px; color: var(--text); text-align: left; font-weight: 400; min-height: 40px; padding: 0 10px; }
.browser-row:hover { background: var(--surface); }
.browser-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.browser-name.folder { color: var(--sky-light); font-weight: 500; }

/* Plan and billing */
.badge { background: var(--sky-wash); color: var(--sky-light); border: 1px solid var(--sky-border); border-radius: 999px; padding: 2px 12px; font-size: 13px; font-weight: 600; }
.meter { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.meter-bar { height: 6px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.meter-fill { height: 100%; background: var(--sky); border-radius: 999px; }
.meter-fill.full { background: var(--danger-text); }
.plan-card { background: var(--surface-2); }
.plan-card h3 { margin: 0; font-family: Manrope, "DM Sans", sans-serif; font-size: 20px; }
.price { font-family: Manrope, "DM Sans", sans-serif; font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.features { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
input.seats { width: 84px; }

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; border-right: none; border-bottom: 1px solid var(--line-soft); }
  .nav { flex-direction: row; overflow-x: auto; order: 3; width: 100%; }
  .nav a { white-space: nowrap; }
  .nav a svg { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; padding: 0; }
  .sidebar-foot .hint { display: none; }
  .content { padding: 20px 16px 48px; }
  .search { flex-grow: 1; }
  .search input { width: 100%; }
}

@media (max-width: 760px) {
  .files-panel { position: absolute; right: 0; top: 0; bottom: 0; width: min(320px, 100%); z-index: 5; }
}
