/* Prokyonz Remote web technician app. Colours from the desktop apps' Theme.cs. */
:root {
  --blue: #1170bf;
  --blue-dark: #0b4f87;
  --blue-tint: #e3eef9;
  --text: #1a1d21;
  --text-muted: #4a525c;
  --border: #c9ced6;
  --divider: #e3e6ea;
  --surface: #f1f4f8;
  --page: #f4f6f9;
  --green: #1e8e3e;
  --amber: #c77700;
  --amber-text: #6b3f00;
  --amber-tint: #fff4e0;
  --red: #b3261e;
  --screen: #202020;
  --radius: 6px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  font: 14px/1.4 "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--page);
}

[hidden] { display: none !important; }

h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 15px; margin: 0; }

.muted { color: var(--text-muted); }
.small-text { font-size: 12px; margin: 6px 0 0; }
.mono { font-family: Consolas, "Cascadia Mono", ui-monospace, monospace; font-weight: 700; letter-spacing: .04em; }
.spacer { flex: 1; }

.view { min-height: 100%; }

.banner {
  background: var(--amber-tint);
  color: var(--amber-text);
  border-bottom: 1px solid var(--amber);
  padding: 10px 16px;
}

.card {
  background: #fff;
  border: 1px solid var(--divider);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgb(0 0 0 / .04);
}

.rule { height: 3px; background: var(--blue); flex: none; }

/* ---- Controls ---- */

button {
  font: inherit;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
  padding: 0 18px;
  height: 44px;
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
}
button.small { height: 32px; padding: 0 12px; font-size: 13px; font-weight: 400; }
button:disabled { opacity: .55; cursor: default; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

.primary { background: var(--blue); color: #fff; }
.primary:hover:not(:disabled) { background: var(--blue-dark); }
.primary.cancel { background: var(--text-muted); }
.secondary { background: #fff; color: var(--text); border-color: var(--border); }
.secondary:hover:not(:disabled) { background: var(--surface); }
.danger { background: var(--red); color: #fff; font-weight: 700; }
.danger:hover { background: #8f1e18; }

.field { display: block; margin-bottom: 14px; color: var(--text-muted); font-size: 13px; }
.field input, .search {
  display: block;
  width: 100%;
  margin-top: 4px;
  height: 40px;
  padding: 0 10px;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}
.field input.mono { font-size: 18px; }
.field input.mono::placeholder { font: 14px "Segoe UI", system-ui, sans-serif; letter-spacing: 0; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--blue); }

.error { color: var(--red); min-height: 20px; margin: 8px 0; }

/* ---- Sign in ---- */

.login-view { display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(380px, 100%); padding: 28px; }
.login-card .primary { width: 100%; }
.login-card .check { margin: 2px 0 4px; }
.login-logo { display: block; width: 180px; max-width: 100%; margin: 0 0 20px; }

/* ---- Home ---- */

.home-view { display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #fff;
}
.topbar-logo { height: 34px; min-width: 0; max-width: 45vw; object-fit: contain; object-position: left center; }
.tech-name { font-weight: 700; margin-right: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.home-body {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px;
  align-items: flex-start;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}
.customers { flex: 999 1 420px; min-width: 0; padding: 16px; }
.connect { flex: 1 1 300px; padding: 16px; }
.connect h2 { margin-bottom: 14px; }
.connect .primary { width: 100%; }

.section-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }

.customer-list { list-style: none; margin: 10px 0 0; padding: 0; max-height: calc(100vh - 230px); overflow: auto; }
.customer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
}
.customer:hover { background: var(--surface); }
.customer[aria-selected="true"] { background: var(--blue-tint); border-color: #b9d3ee; }
.customer:focus-visible { outline: 2px solid var(--blue); }
.dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--green); margin: 0 2px 0 4px; }
.dot.busy { background: var(--amber); }
.customer-text { flex: 1; min-width: 0; }
.customer-id, .customer-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-id { font-size: 17px; font-weight: 700; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.customer-meta { color: var(--text-muted); font-size: 12px; }
.badge { flex: none; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 4px; background: var(--surface); color: var(--text-muted); }
.badge.busy { background: var(--amber-tint); color: var(--amber-text); }
.online-count { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 4px; background: #e3f4e8; color: var(--green); }
.online-count:empty { display: none; }
.empty { margin: 16px 4px 4px; }

.status { min-height: 20px; margin: 12px 0 0; display: flex; gap: 8px; align-items: flex-start; }
.status:empty { display: none; }
.status::before { content: ""; flex: none; width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; background: currentColor; }
.status.info { color: var(--text); }
.status.info::before { background: var(--blue); }
.status.waiting::before { background: var(--amber); }
.status.ok::before { background: var(--green); }
.status.failed { color: var(--red); }

/* ---- Technicians (admin) ---- */

.admin-view { display: flex; flex-direction: column; }
.admin-view .topbar { flex-wrap: wrap; gap: 10px 12px; }
.admin-title { display: flex; flex-direction: column; min-width: 0; }
.admin-title h1 { margin: 0; font-size: 19px; }
.admin-title .muted { font-size: 12px; }
.admin-search { width: 240px; height: 34px; margin: 0; font-size: 14px; }
.add-button { font-weight: 700; }

.admin-body { display: flex; flex-wrap: wrap; gap: 16px; padding: 16px; align-items: flex-start; }
.accounts { flex: 999 1 520px; min-width: 0; overflow: hidden; }
.admin-side { flex: 1 1 340px; max-width: 420px; padding: 20px; }
.admin-side h2 { font-size: 17px; margin-bottom: 16px; }

.table-scroll { overflow-x: auto; }
.accounts-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.accounts-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--divider);
  white-space: nowrap;
}
.accounts-table td { padding: 11px 14px; border-bottom: 1px solid var(--divider); white-space: nowrap; }
.accounts-table tbody tr { cursor: pointer; }
.accounts-table tbody tr:hover { background: var(--surface); }
.accounts-table tbody tr[aria-selected="true"] { background: var(--blue-tint); }
.accounts-table tbody tr:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.accounts-table tr.disabled td { color: var(--text-muted); }
.accounts-table .you { color: var(--text-muted); font-size: 12px; margin-left: 6px; }
.pill { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 4px; }
.pill.active { background: #e3f4e8; color: var(--green); }
.pill.disabled { background: var(--surface); color: var(--text-muted); }
.pill.admin { background: var(--blue-tint); color: var(--blue-dark); }

.hint { font-size: 12px; color: var(--text-muted); margin: -8px 0 14px; }
.field-row { display: flex; justify-content: space-between; align-items: baseline; }
.link-button { height: auto; padding: 0; border: none; background: none; color: var(--blue); font-size: 13px; font-weight: 600; }
.link-button:hover { text-decoration: underline; }
.add-admin { margin: 0 0 16px; }
#add-panel .primary { width: 100%; }

.otp-box { background: #e3f4e8; color: #14532d; border-radius: var(--radius); padding: 12px; margin-top: 14px; }
.otp-box p { margin: 0 0 8px; font-size: 13px; }
.otp-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.otp-row code { font: 700 17px Consolas, "Cascadia Mono", ui-monospace, monospace; color: var(--text); user-select: all; overflow-wrap: anywhere; }
.copy-button { flex: none; }

.detail-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.detail-head h2 { margin: 0 0 2px; overflow-wrap: anywhere; }
.detail-head .muted { font-size: 13px; }
.initials {
  flex: none; width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--blue); color: #fff; font-weight: 700; font-size: 17px;
}
.initials.off { background: #8a929c; }
.detail-stats { display: flex; gap: 16px; margin-bottom: 18px; }
.detail-stats > div { flex: 1; display: flex; flex-direction: column; }
.detail-stats .hint { margin: 0 0 2px; }
.self-note { margin: 0 0 8px; }
.detail-actions { display: flex; flex-direction: column; gap: 10px; }
.detail-actions .otp-box { margin-top: 0; }
.action { height: 40px; font-size: 14px; }
.destructive { color: var(--red); border-color: #e8b4b0; }
.destructive:hover:not(:disabled) { background: #fdf0ef; }
.admin-side .error:empty { display: none; }
.admin-side .error { margin: 14px 0 0; }

@media (max-width: 700px) {
  .admin-search { order: 5; width: 100%; }
  .admin-side { max-width: none; }
}

/* ---- Session ---- */

.session-view { height: 100%; height: 100dvh; display: flex; flex-direction: column; background: var(--screen); }
.session-bar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 6px 12px;
  background: #fff;
}
.session-title { display: flex; flex-direction: column; min-width: 0; }
.session-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-info { color: var(--text-muted); font-size: 12px; }
.session-tools { display: contents; }
.more-button { display: none; }
.touch-only { display: none; }
body.touch .touch-only { display: inline-flex; align-items: center; }
.wide-label { margin-left: 6px; }

.menu-wrap { position: relative; }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 10;
  min-width: 240px;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgb(0 0 0 / .18);
}
.menu button {
  display: block;
  width: 100%;
  height: 32px;
  text-align: left;
  font-weight: 400;
  font-size: 13px;
  padding: 0 10px;
  background: none;
  color: var(--text);
}
.menu button:hover, .menu button:focus-visible { background: var(--surface); outline: none; }

.screen-host { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--screen); }
.screen-host .placeholder { color: #9aa0a6; margin: 16px; }
.screen-host.has-picture .placeholder { display: none; }

/* Fits the picture, keeping its aspect ratio, never larger than 1:1 (like the desktop viewer). */
.remote-canvas {
  position: absolute;
  inset: 0;
  margin: auto;
  max-width: 100%;
  max-height: 100%;
  outline: none;
  image-rendering: auto;
  transform-origin: 0 0;
}
.remote-canvas.controlling { cursor: crosshair; }

.remote-cursor {
  position: absolute;
  left: 0;
  top: 0;
  width: 13px;
  height: 21px;
  pointer-events: none;
  background: url("../img/cursor.svg") no-repeat;
  will-change: transform;
}

.zoom-fit { position: absolute; top: 10px; right: 10px; z-index: 5; box-shadow: 0 2px 10px rgb(0 0 0 / .3); }
.touch-hint {
  position: absolute;
  left: 50%;
  bottom: 16px;
  z-index: 5;
  width: max-content;
  max-width: calc(100% - 32px);
  transform: translateX(-50%);
  margin: 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgb(0 0 0 / .78);
  color: #fff;
  font-size: 13px;
  pointer-events: none;
}

/* Extra keys for phone keyboards, above the keyboard. */
.soft-keys { position: relative; flex: none; background: #fff; border-top: 1px solid var(--divider); }
.soft-keys-row { display: flex; gap: 6px; padding: 6px 8px; overflow-x: auto; scrollbar-width: none; }
.soft-keys-row::-webkit-scrollbar { display: none; }
.soft-key {
  flex: none;
  min-width: 44px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  touch-action: manipulation;
}
.soft-key.armed { background: var(--blue); border-color: var(--blue); color: #fff; }
/* Invisible but focusable, so the phone opens its keyboard; 16px stops iOS zooming the page. */
.soft-input {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  resize: none;
  font-size: 16px;
  caret-color: transparent;
}

/* Files: floating panel over the screen, bottom right. */
.files-panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  width: min(380px, calc(100% - 32px));
  max-height: min(60vh, 460px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 28px rgb(0 0 0 / .3);
}
.files-head { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-bottom: 1px solid var(--divider); }
.file-list { list-style: none; margin: 0; padding: 0 14px; overflow: auto; }
.file { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--divider); }
.file-icon { flex: none; width: 20px; font-size: 16px; line-height: 20px; text-align: center; color: var(--blue); }
.file.saved .file-icon { color: var(--green); }
.file.failed .file-icon { color: var(--red); }
.file.cancelled .file-icon { color: var(--text-muted); }
.file-body { flex: 1; min-width: 0; }
.file-top { display: flex; gap: 10px; align-items: baseline; }
.file-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-actions { flex: none; display: flex; gap: 12px; }
.file-status { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file.failed .file-status { color: var(--red); }
.file-progress { height: 3px; margin-top: 6px; background: var(--divider); border-radius: 2px; overflow: hidden; }
.file-progress > div { height: 100%; width: 0; background: var(--blue); }
.file-ask { margin-top: 8px; display: flex; gap: 8px; }
.file-ask button { height: 30px; }
.files-hint { margin: 0; padding: 8px 14px 10px; font-size: 12px; color: var(--text-muted); }

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgb(17 112 191 / .25);
  border: 3px dashed var(--blue);
  pointer-events: none;
}
.drop-overlay span { padding: 14px 22px; border-radius: 8px; background: #fff; font-size: 16px; font-weight: 700; box-shadow: 0 6px 20px rgb(0 0 0 / .2); }

/* ---- Dialogs ---- */

.dialog {
  border: none;
  border-radius: 8px;
  padding: 22px;
  width: min(440px, calc(100% - 32px));
  box-shadow: 0 12px 40px rgb(0 0 0 / .25);
  color: var(--text);
}
.dialog::backdrop { background: rgb(0 0 0 / .35); }
.dialog h2 { margin-bottom: 14px; }
.confirm-text p { margin: 0 0 10px; }
.settings-password {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--divider);
  color: var(--text-muted); font-size: 13px;
}
#password-dialog .error:empty { display: none; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

@media (max-width: 600px) {
  .topbar .tech-name { display: none; }
}

/* Narrow screens: the session bar keeps one row; the rarely used controls move into "More". */
@media (max-width: 860px) {
  .session-bar { flex-wrap: nowrap; gap: 6px; padding: 6px 8px; }
  .session-title { flex: 1; }
  .session-bar > .spacer { display: none; }
  .session-info { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .more-button { display: inline-flex; align-items: center; }
  .session-tools {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 8px;
    z-index: 25;
    width: min(300px, calc(100vw - 16px));
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 6px 20px rgb(0 0 0 / .25);
  }
  .session-bar.tools-open .session-tools { display: flex; }
  .session-tools .check { min-height: 32px; }
  .session-tools button.small { width: 100%; }
  .session-tools .menu { position: static; box-shadow: none; margin-top: 6px; min-width: 0; }
}
@media (max-width: 480px) {
  .wide-label { display: none; }
  .session-bar button.small { padding: 0 9px; }
}
