/* ===========================================================================
   Agent Screen V4 — HUD design system
   Futuristic / minimal. Dark glass, single cyan accent, mono technical labels.
   Shared by login.html, machines.html, remote.html.
   =========================================================================== */

:root {
  /* surfaces */
  --bg:        #06080c;
  --bg-2:      #090c12;
  --panel:     rgba(255, 255, 255, 0.025);
  --panel-2:   rgba(255, 255, 255, 0.045);
  --line:      rgba(255, 255, 255, 0.07);
  --line-2:    rgba(255, 255, 255, 0.12);

  /* text */
  --txt:       #e7eef6;
  --txt-dim:   #8a97a6;
  --txt-faint: #56616e;

  /* accent */
  --acc:       #ff2b3b;   /* primary red */
  --acc-2:     #8e0e18;   /* deep crimson (gradients only) */
  --acc-glow:  rgba(255, 43, 59, 0.55);
  --acc-soft:  rgba(255, 43, 59, 0.12);

  /* status */
  --ok:        #2fe0a6;
  --warn:      #ffc24b;
  --err:       #ff5d6c;
  --idle:      #4a5562;

  /* geometry */
  --r:         14px;
  --r-sm:      9px;
  --gap:       18px;
  --mono:      ui-monospace, "SF Mono", "JetBrains Mono", "Menlo", monospace;
  --sans:      -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--sans);
  color: var(--txt);
  background:
    radial-gradient(1200px 700px at 78% -10%, rgba(255,43,59,0.12), transparent 60%),
    radial-gradient(1000px 600px at 10% 110%, rgba(142,14,24,0.16), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.1px;
  overflow-x: hidden;
}

/* faint engineering grid overlay */
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 38%, #000 0%, transparent 78%);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

/* ---- layout shells ----------------------------------------------------- */
.shell { position: relative; z-index: 1; min-height: 100%; }

.center {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 28px;
}

/* ---- top bar (brand) --------------------------------------------------- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand .mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, var(--acc), var(--acc-2));
  box-shadow: 0 0 18px var(--acc-glow);
  position: relative; flex: none;
}
.brand .mark::after {
  content: ""; position: absolute; inset: 6px;
  border: 1.5px solid rgba(0,0,0,0.55); border-radius: 3px;
}
.brand b { font-weight: 600; font-size: 15px; letter-spacing: 0.3px; }
.brand .ver {
  font-family: var(--mono); font-size: 10px; color: var(--acc);
  border: 1px solid var(--line-2); padding: 2px 6px; border-radius: 5px;
  letter-spacing: 1px;
}
.topbar .spacer { flex: 1; }

/* ---- labels & text ----------------------------------------------------- */
.kicker {
  font-family: var(--mono); font-size: 11px; letter-spacing: 3px;
  text-transform: uppercase; color: var(--acc);
}
.muted   { color: var(--txt-dim); }
.faint   { color: var(--txt-faint); }
.mono    { font-family: var(--mono); }

h1 { font-size: 26px; font-weight: 600; letter-spacing: 0.2px; }
h2 { font-size: 17px; font-weight: 600; }

/* ---- card / panel ------------------------------------------------------ */
.card {
  position: relative;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--r);
  backdrop-filter: blur(14px);
}
/* futuristic corner ticks */
.card.ticks::before, .card.ticks::after,
.card.ticks > .tick-bl, .card.ticks > .tick-br {
  content: ""; position: absolute; width: 12px; height: 12px;
  border-color: var(--line-2); border-style: solid; border-width: 0;
}
.card.ticks::before { top: -1px; left: -1px; border-top-width: 1.5px; border-left-width: 1.5px; border-top-left-radius: var(--r); }
.card.ticks::after  { top: -1px; right: -1px; border-top-width: 1.5px; border-right-width: 1.5px; border-top-right-radius: var(--r); }
.card.ticks > .tick-bl { bottom: -1px; left: -1px; border-bottom-width: 1.5px; border-left-width: 1.5px; border-bottom-left-radius: var(--r); }
.card.ticks > .tick-br { bottom: -1px; right: -1px; border-bottom-width: 1.5px; border-right-width: 1.5px; border-bottom-right-radius: var(--r); }

/* ---- login panel ------------------------------------------------------- */
.auth { width: 100%; max-width: 392px; padding: 34px 32px 30px; }
.auth .kicker { margin-bottom: 14px; display: block; }
.auth h1 { margin-bottom: 6px; }
.auth .sub { color: var(--txt-dim); font-size: 13.5px; margin-bottom: 26px; }

.field { margin-bottom: 16px; }
.field label {
  display: block; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 1.5px; text-transform: uppercase; color: var(--txt-dim);
  margin-bottom: 7px;
}
.input {
  width: 100%; background: rgba(0,0,0,0.35);
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  color: var(--txt); font-size: 14.5px; font-family: var(--sans);
  padding: 12px 13px; outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input::placeholder { color: var(--txt-faint); }
.input:focus {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px var(--acc-soft);
  background: rgba(0,0,0,0.5);
}

/* OTP boxes */
.otp { display: flex; gap: 9px; justify-content: space-between; }
.otp .input {
  text-align: center; font-family: var(--mono); font-size: 22px;
  padding: 12px 0; letter-spacing: 1px;
}

/* ---- buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; cursor: pointer; border: none; border-radius: var(--r-sm);
  font-family: var(--sans); font-size: 14px; font-weight: 600;
  padding: 13px 16px; color: #fff;
  background: linear-gradient(135deg, var(--acc), #ff5b66);
  box-shadow: 0 6px 26px -8px var(--acc-glow);
  transition: transform .08s, box-shadow .15s, filter .15s;
  letter-spacing: 0.2px;
}
.btn:hover { filter: brightness(1.06); box-shadow: 0 8px 30px -7px var(--acc-glow); }
.btn:active { transform: translateY(1px); }
.btn.ghost {
  background: transparent; color: var(--txt);
  border: 1px solid var(--line-2); box-shadow: none; font-weight: 500;
}
.btn.ghost:hover { border-color: var(--acc); color: var(--acc); }
.btn.sm { width: auto; padding: 9px 14px; font-size: 13px; }
.btn.danger { background: linear-gradient(135deg, #ff5d6c, #ff8a72); color: #1a0608; box-shadow: 0 6px 26px -8px rgba(255,93,108,.5); }

.row { display: flex; gap: 12px; align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; }
.mt { margin-top: 18px; }
.mt-s { margin-top: 10px; }

/* ---- status dot -------------------------------------------------------- */
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.dot.ok   { background: var(--ok);   box-shadow: 0 0 10px var(--ok); animation: pulse 2.4s infinite; }
.dot.warn { background: var(--warn); box-shadow: 0 0 10px var(--warn); animation: pulse 1.1s infinite; }
.dot.err  { background: var(--err);  box-shadow: 0 0 10px var(--err); }
.dot.idle { background: var(--idle); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.5px;
  padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--txt-dim);
}

/* ---- machines grid ----------------------------------------------------- */
.page { max-width: 1080px; margin: 0 auto; padding: 30px 24px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin: 8px 0 24px; gap: 18px; flex-wrap: wrap; }
.page-head .kicker { display: block; margin-bottom: 9px; }

.grid {
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}

.machine {
  padding: 18px 18px 16px; cursor: pointer;
  transition: transform .12s, border-color .15s, box-shadow .15s;
}
.machine:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: 0 18px 40px -22px rgba(0,0,0,.9); }
.machine.offline { opacity: 0.5; cursor: not-allowed; }
.machine.offline:hover { transform: none; }

.machine .top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.machine .os {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.04); border: 1px solid var(--line);
  font-size: 17px;
}
.machine .name { font-size: 15.5px; font-weight: 600; }
.machine .host { font-family: var(--mono); font-size: 11px; color: var(--txt-faint); margin-top: 2px; }
.machine .stat { display: flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 11px; color: var(--txt-dim); }

.specs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.spec {
  font-family: var(--mono); font-size: 10.5px; color: var(--txt-dim);
  background: rgba(0,0,0,0.3); border: 1px solid var(--line);
  padding: 4px 8px; border-radius: 6px; letter-spacing: 0.3px;
}
.machine .cta {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  font-family: var(--mono); font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--acc);
}
.machine .cta .arrow { transition: transform .15s; }
.machine:hover .cta .arrow { transform: translateX(4px); }

/* capability chips */
.caps { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.cap {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.5px;
  color: var(--acc); background: var(--acc-soft);
  border: 1px solid rgba(53,233,255,0.22); padding: 3px 7px; border-radius: 5px;
}
.cap.off { color: var(--txt-faint); background: transparent; border-color: var(--line); }

/* ---- connecting overlay ------------------------------------------------ */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: none;
  align-items: center; justify-content: center;
  background: rgba(3,5,9,0.78); backdrop-filter: blur(7px);
}
.overlay.show { display: flex; }
.connecting { text-align: center; max-width: 360px; padding: 38px 34px; }
.scanner {
  width: 74px; height: 74px; margin: 0 auto 22px; border-radius: 50%;
  border: 2px solid var(--line-2); border-top-color: var(--acc);
  box-shadow: 0 0 26px -4px var(--acc-glow);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.connecting h2 { margin-bottom: 8px; }
.steps { font-family: var(--mono); font-size: 12px; color: var(--txt-dim); text-align: left; margin-top: 20px; }
.steps div { padding: 5px 0; display: flex; align-items: center; gap: 9px; opacity: 0.35; transition: opacity .3s, color .3s; }
.steps div.done { opacity: 1; color: var(--ok); }
.steps div.active { opacity: 1; color: var(--acc); }

/* ---- remote control surface ------------------------------------------- */
.remote-wrap { display: flex; flex-direction: column; height: 100vh; }
.remote-bar {
  display: flex; align-items: center; gap: 14px; padding: 10px 16px;
  border-bottom: 1px solid var(--line); background: rgba(6,8,12,0.7);
  backdrop-filter: blur(10px); z-index: 5; flex-wrap: wrap;
}
.remote-bar .target { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 14px; }
.remote-bar .metric { font-family: var(--mono); font-size: 11px; color: var(--txt-dim); display: flex; align-items: center; gap: 6px; }
.remote-bar .spacer { flex: 1; }

.tabs { display: flex; gap: 6px; }
.tab {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.5px;
  padding: 7px 13px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line); color: var(--txt-dim); background: transparent;
  transition: all .12s;
}
.tab:hover { border-color: var(--line-2); color: var(--txt); }
.tab.active { color: var(--acc); border-color: var(--acc); background: var(--acc-soft); }

.screen-stage {
  flex: 1; position: relative; display: flex; align-items: center; justify-content: center;
  padding: 8px; overflow: hidden;
}
.screen-frame {
  /* fill the whole stage so the remote screen renders as large as the window allows
     (the <img> inside is object-fit:contain, so it scales up to fit and letterboxes on
     the frame background — no fixed 980px cap, no 16:10 mismatch with 16:9 displays). */
  position: relative; width: 100%; height: 100%; max-width: 100%; max-height: 100%;
  border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.012) 0 2px, transparent 2px 4px),
    linear-gradient(135deg, #0b1018, #0a0d13);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.4), 0 30px 80px -30px rgba(0,0,0,0.9);
}
.screen-frame .liveband {
  position: absolute; top: 12px; left: 12px;
  display: flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 1px;
  color: var(--err); background: rgba(0,0,0,0.5); padding: 4px 9px; border-radius: 6px;
  border: 1px solid var(--line);
}
.screen-frame .ghost-cursor {
  position: absolute; width: 16px; height: 16px; left: 52%; top: 46%;
  border-left: 2px solid var(--acc); border-top: 2px solid var(--acc);
  transform: rotate(-12deg); filter: drop-shadow(0 0 6px var(--acc-glow));
}
.screen-frame .placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; color: var(--txt-faint);
  font-family: var(--mono); font-size: 12px; letter-spacing: 1px;
}

/* on-screen control dock */
.dock {
  display: flex; gap: 8px; align-items: center; justify-content: center;
  padding: 12px; border-top: 1px solid var(--line); background: rgba(6,8,12,0.7);
  flex-wrap: wrap;
}
.key {
  font-family: var(--mono); font-size: 12px; color: var(--txt-dim);
  border: 1px solid var(--line-2); border-radius: 7px; padding: 9px 13px;
  cursor: pointer; background: rgba(255,255,255,0.02); transition: all .1s;
}
.key:hover { color: var(--acc); border-color: var(--acc); }
.hint { font-family: var(--mono); font-size: 10.5px; color: var(--txt-faint); letter-spacing: 0.5px; }

/* prototype banner */
.proto {
  position: fixed; bottom: 14px; right: 16px;
  z-index: 80; font-family: var(--mono); font-size: 10.5px; letter-spacing: 1px;
  color: var(--warn); background: rgba(0,0,0,0.6); border: 1px solid var(--line-2);
  padding: 6px 13px; border-radius: 999px;
}

.link { color: var(--acc); text-decoration: none; cursor: pointer; }
.link:hover { text-decoration: underline; }
.sep { height: 1px; background: var(--line); margin: 20px 0; }
.err-msg { color: var(--err); font-size: 12.5px; font-family: var(--mono); min-height: 16px; margin-top: 10px; }
