/* augg.io Remote Assist dashboard — brand manual 2023 + @auggio/ui tokens.
   Monochrome base; colour only for selection (cyan) and status (green / orange / magenta). */

@font-face { font-family: "Poppins"; font-weight: 600; src: url("/assets/fonts/Poppins-SemiBold.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Inter"; font-weight: 400; src: url("/assets/fonts/Inter-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Inter"; font-weight: 600; src: url("/assets/fonts/Inter-SemiBold.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Fragment Mono"; font-weight: 400; src: url("/assets/fonts/FragmentMono-Regular.ttf") format("truetype"); font-display: swap; }

:root {
  --bg: #020106;
  --surface: rgba(255, 255, 255, 0.05);
  --surface-2: rgba(255, 255, 255, 0.08);
  --border: #2c2c2e;
  --ink: #ffffff;
  --muted: #8e8e93;
  --accent: #18f1ff;
  --success: #03ff95;
  --warning: #ff7a41;
  --error: #ff29c3;
  --purple: #4c00ac;
  --heading: "Poppins", system-ui, sans-serif;
  --body: "Inter", system-ui, sans-serif;
  --mono: "Fragment Mono", ui-monospace, monospace;
  --radius: 16px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.mono { font-family: var(--mono); }
.eyebrow {
  font: 600 10.5px/1 var(--heading);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
[hidden] { display: none !important; }

/* ---------- header */
.topbar {
  height: 64px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; min-width: 0; }
.brand__logo { height: 22px; margin-right: 22px; } /* protective zone = logo height */
.brand__divider { width: 1px; height: 22px; background: var(--border); }
.brand__product { font: 600 15px var(--heading); margin-left: 14px; white-space: nowrap; }
.topbar__right { display: flex; align-items: center; gap: 18px; }
.job { text-align: right; }
.job__customer { font-weight: 600; font-size: 13px; }
.job__detail { font-size: 10.5px; color: var(--muted); margin-top: 2px; }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface);
  white-space: nowrap;
}
.pill__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill__label { color: var(--muted); }
.pill__time { font-size: 12px; font-variant-numeric: tabular-nums; }
.pill[data-state="live"] .pill__dot { background: var(--success); animation: pulse 1.8s ease-in-out infinite; box-shadow: 0 0 6px var(--success); }
.pill[data-state="live"] .pill__label { color: var(--ink); }
.pill[data-state="connecting"] .pill__dot { background: var(--success); opacity: 0.6; }
.pill[data-state="connecting"] .pill__label { color: var(--ink); }
.pill[data-state="lost"] .pill__dot { background: var(--error); }
.pill[data-state="lost"] .pill__label { color: var(--ink); }
.pill[data-state="offline"] .pill__dot { background: var(--warning); }
.pill[data-state="offline"] .pill__label { color: var(--ink); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ---------- layout */
.portal {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 34%);
  gap: 16px;
  padding: 16px;
  min-height: 0;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  min-height: 0;
}
.panel__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel__title { font: 600 22px/1.2 var(--heading); margin: 4px 0 0; }

/* ---------- tabs */
.tabs { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.tab { height: 30px; padding: 0 16px; border-radius: 999px; font: 600 12.5px var(--body); color: var(--muted); }
.tab.is-active { background: rgba(255, 255, 255, 0.14); color: var(--ink); }
.view { display: none; flex: 1; min-height: 0; flex-direction: column; gap: 14px; }
.view.is-active { display: flex; }

/* ---------- diagram */
.sheet {
  position: relative;
  flex: 1;
  min-height: 240px;
  background: #030303;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.sheet__image {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  display: block;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 6%, #000 94%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 6%, #000 94%, transparent 100%);
}
.sheet__callouts { position: absolute; pointer-events: none; }
.callout {
  position: absolute;
  width: 7.2%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: auto;
}
.callout::before, .callout::after {
  content: ""; position: absolute; inset: 18%;
  border-radius: 50%; border: 2px solid var(--accent);
  opacity: 0; transition: opacity 0.15s;
}
.callout.is-selected::before { opacity: 1; }
.callout.is-selected::after { opacity: 0.8; animation: ring 1.4s ease-out infinite; border-width: 1.5px; }
@keyframes ring { 0% { transform: scale(1); opacity: 0.8; } 100% { transform: scale(1.8); opacity: 0; } }

.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.part {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; text-align: left;
  border: 1px solid transparent; border-radius: 10px;
  background: var(--surface);
}
.part.is-selected { background: rgba(24, 241, 255, 0.10); border-color: rgba(24, 241, 255, 0.6); }
.part__name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.part__note { font-family: var(--mono); font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.part__text { min-width: 0; }
.num {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font: 11.5px var(--mono); color: var(--ink);
  border: 1.2px solid rgba(255, 255, 255, 0.35);
}
.num.is-selected { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.num.is-current { border-color: var(--accent); }
.num.is-done { background: var(--success); border-color: var(--success); color: var(--bg); }

/* ---------- procedure */
.procedure__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.procedure__title { font-weight: 600; font-size: 16px; }
.procedure__count { font-size: 12px; color: var(--muted); }
.progress { height: 4px; border-radius: 999px; background: var(--border); overflow: hidden; }
.progress__bar { height: 100%; width: 0; background: var(--accent); transition: width 0.3s; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; overflow: auto; }
.step {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid transparent;
  cursor: pointer;
}
.step.is-current { background: rgba(24, 241, 255, 0.08); border-color: rgba(24, 241, 255, 0.6); }
.step__title { font-weight: 600; font-size: 14.5px; }
.step.is-done .step__title { text-decoration: line-through; text-decoration-color: var(--muted); }
.step.is-upcoming .step__title { color: rgba(255, 255, 255, 0.75); }
.step__detail { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.step__text { flex: 1; min-width: 0; }
.chip {
  flex: none; height: 24px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--border); font: 10.5px var(--mono); color: var(--muted);
}
.chip:hover { color: var(--ink); }
.num--step { width: 26px; height: 26px; }

/* ---------- live */
.iconbtn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
}
.videocard {
  position: relative; flex: 1; min-height: 280px;
  background: #000; border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden;
}
.videocard__frame { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.videocard video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.videocard[data-state="waiting"] video, .videocard[data-state="lost"] video, .videocard[data-state="offline"] video { visibility: hidden; }
.videocard__placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  text-align: center; padding: 24px;
}
.videocard[data-state="live"] .videocard__placeholder { display: none; }
.orb {
  position: absolute; width: 46%; aspect-ratio: 1; border-radius: 50%;
  background:
    radial-gradient(circle at 60% 35%, rgba(76, 0, 172, 0.95), transparent 55%),
    radial-gradient(circle at 42% 30%, rgba(255, 41, 195, 0.55), transparent 45%),
    radial-gradient(circle at 40% 55%, rgba(24, 241, 255, 0.85), transparent 55%),
    radial-gradient(circle at 70% 70%, rgba(3, 255, 149, 0.5), transparent 45%);
  filter: blur(28px);
  opacity: 0.75;
}
.placeholder__mark { position: relative; width: 48px; height: 48px; }
.placeholder__title { position: relative; font: 600 17px var(--heading); }
.placeholder__hint { position: relative; font-size: 10.5px; color: rgba(255, 255, 255, 0.7); white-space: pre-line; line-height: 1.7; }
.badge {
  position: absolute; display: inline-flex; align-items: center; gap: 7px;
  height: 26px; padding: 0 10px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.6); font-size: 10.5px;
}
.badge--live { top: 12px; left: 12px; }
.badge--live .pill__dot { background: var(--success); animation: pulse 1.8s ease-in-out infinite; }
.badge--live .eyebrow { color: var(--ink); }
.badge--stats { bottom: 12px; left: 12px; height: 24px; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; transition: opacity 0.3s; }
.tiles.is-dim { opacity: 0.45; }
.tile { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); }
.tile.is-warning { border-color: rgba(255, 122, 65, 0.6); }
.tile.is-warning .tile__number { color: var(--warning); }
.tile__value { display: flex; align-items: baseline; gap: 4px; margin-top: 4px; white-space: nowrap; }
.tile__number { font: 600 24px/1.1 var(--heading); font-variant-numeric: tabular-nums; }
.tile__unit { font-size: 11px; color: var(--muted); }

.events { display: flex; flex-direction: column; gap: 6px; }
.events__list { min-height: 62px; display: flex; flex-direction: column; gap: 3px; font-size: 10.5px; color: var(--muted); }
.events__list div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.events__empty { color: rgba(142, 142, 147, 0.6); }

/* ---------- locked page */
body.locked { display: grid; place-items: center; }
.locked__box { max-width: 420px; padding: 32px; text-align: center; }
.locked__logo { height: 28px; margin-bottom: 28px; }
.locked__box h1 { font: 600 22px var(--heading); margin: 0 0 12px; }
.locked__box p { color: var(--muted); margin: 0; }

/* ---------- narrow screens (tablet portrait, phone): panels stack and the page scrolls */
@media (max-width: 859px) {
  html, body { height: auto; }
  .topbar { height: auto; padding: 12px 16px; flex-wrap: wrap; }
  .job { display: none; }
  .portal { display: flex; flex-direction: column; padding: 12px; gap: 12px; }
  .panel, .view, .videocard, .sheet, .steps { flex: none; }
  .live { order: -1; }
  .videocard { height: 56vh; min-height: 320px; }
  .sheet { height: 62vw; min-height: 260px; }
  .steps { overflow: visible; }
  .legend { grid-template-columns: 1fr; }
  .panel__title { font-size: 19px; }
}
