/* ZEDDesk client — dark by design: the UI should disappear behind the desktop
   it is showing. System fonts only, so the client works with no network. */

:root {
  --bg: #0b0e13;
  --surface: #151a22;
  --surface-2: #1d242e;
  --line: #262f3b;
  --ink: #e8edf4;
  --muted: #8b97a8;
  --faint: #616e7f;
  --accent: #2ed3e9;
  --accent-ink: #04222a;
  --danger: #f0808c;
  --warn: #e5a93f;
  --radius: 6px;
  --tb-h: 34px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: none;
}

button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------------------------------------------------------------- login */

.card {
  width: min(400px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 28px 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.brand { display: flex; align-items: center; gap: 11px; }
.brand h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 22px;
  height: 16px;
  border: 2px solid var(--accent);
  border-radius: 3px;
  position: relative;
  flex: none;
}
.brand-mark::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  width: 10px;
  height: 2px;
  background: var(--accent);
}
.brand-sub {
  margin: -8px 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--faint); }
.field input, .field select {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 11px;
  outline: none;
}
.field input:focus, .field select:focus { border-color: var(--accent); }

.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }

.btn {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 10px 14px;
  cursor: pointer;
}
.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 600;
}
.btn--primary:disabled { opacity: 0.55; cursor: progress; }

.msg { margin: 0; min-height: 18px; font-size: 13px; color: var(--muted); }
.msg.is-error { color: var(--danger); }

.advanced { border-top: 1px solid var(--line); padding-top: 12px; }
.advanced summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.advanced > *:not(summary) { margin-top: 12px; }

/* ---------------------------------------------------------------- stage */

.stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}
.stage.is-actual { align-items: flex-start; justify-content: flex-start; overflow: auto; }

.viewport { transform-origin: center center; will-change: transform; }

#screen {
  display: block;
  outline: none;
  image-rendering: auto;
  background: #000;
  touch-action: none;
}

.remote-cursor {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 40;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}

/* ---------------------------------------------------------------- toolbar */

.toolbar {
  position: fixed;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 50;
  background: rgba(21, 26, 34, 0.94);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px;
  backdrop-filter: blur(12px);
  max-width: calc(100vw - 16px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.toolbar.is-hidden { opacity: 0; transform: translate(-50%, 20px); pointer-events: none; }

.toolbar-row {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.toolbar-row::-webkit-scrollbar { height: 4px; }
.toolbar-row::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }

.tb {
  flex: none;
  height: var(--tb-h);
  min-width: var(--tb-h);
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tb:hover { border-color: var(--line); }
.tb:active { transform: translateY(1px); }
.tb.is-on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.tb--danger { color: var(--danger); }
.tb--warn { color: var(--warn); }
.tb--select { padding-right: 4px; }
.tb-sep { width: 1px; height: 20px; background: var(--line); flex: none; margin: 0 3px; }

.toolbar-peek {
  position: fixed;
  left: 50%;
  bottom: max(6px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 49;
  width: 46px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(21, 26, 34, 0.8);
  color: var(--muted);
  cursor: pointer;
}

/* ---------------------------------------------------------------- overlays */

.banner {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  background: rgba(21, 26, 34, 0.96);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 9px 14px;
  font-size: 13px;
  max-width: calc(100vw - 24px);
}
.banner.is-error { border-left-color: var(--danger); color: var(--danger); }

.stats {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: 10px;
  z-index: 45;
  background: rgba(21, 26, 34, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  min-width: 168px;
}
.stats dl { margin: 0; display: grid; gap: 4px; }
.stats dl > div { display: flex; justify-content: space-between; gap: 14px; }
.stats dt { color: var(--faint); }
.stats dd { margin: 0; color: var(--ink); }

#ime {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* ---------------------------------------------------------------- files */

.panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  z-index: 55;
  background: var(--surface);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.panel-actions { display: flex; gap: 4px; }
.panel-actions label.tb { cursor: pointer; }
.panel-path {
  padding: 9px 14px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  word-break: break-all;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
.panel-list { flex: 1; overflow-y: auto; padding: 6px; }
.panel-status {
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  min-height: 34px;
}
.panel-status.is-error { color: var(--danger); }

.file-row {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 7px 9px;
  border: none;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
}
.file-row:hover { background: var(--surface-2); }
.file-row:disabled { opacity: 0.4; cursor: not-allowed; }
.file-icon { color: var(--faint); }
.file-row--dir .file-icon { color: var(--accent); }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--faint); font-size: 11.5px; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- mobile */

@media (max-width: 720px) {
  .tb { height: 38px; min-width: 38px; font-size: 12px; }
  .toolbar { padding: 5px; bottom: max(6px, env(safe-area-inset-bottom)); }
  .stats { font-size: 11px; min-width: 150px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#screen:focus-visible { outline: none; }
