/* Quiet, dark chrome so the two frames carry the screen. Choreo Labs colours (brand guidelines v1.1)
   and Sora, self-hosted from brand/. */
@font-face {
  font-family: "Sora";
  src: url("brand/sora-latin.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --split: 35; /* the portal's share, in percent; app.js sets it */
  --divider: 12px;
  --head: 52px; /* fits 44px tabs */

  --chrome: #050a1c; /* Blackout */
  --chrome-line: #1b2440;
  --text: #f4f6fa; /* Paper */
  --text-muted: #aab1c4;
  --seg-bg: #0b1633; /* Midnight Ink */
  --seg-hover: #1a2750;
  --seg-on-bg: #ffffff;
  --seg-on-text: #0b1633;
  --grip: #5a6072; /* Slate */
  --accent: #ff4600; /* Signal */
  --focus: #ff4600;

  --font: "Sora", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: 140ms ease;
}

* { box-sizing: border-box; }

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

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--chrome);
  color: var(--text);
  font: 15px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

/* ---------- Layout ---------- */

.split { display: flex; flex: 1 1 0; min-width: 0; min-height: 0; }

.pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pane-left { flex: 0 0 calc(var(--split) * 1% - var(--divider) / 2); }
.pane-right { flex: 1 1 0; }
.pane-body { position: relative; display: flex; flex: 1 1 0; min-width: 0; min-height: 0; }

.frame {
  display: block;
  flex: 1 1 0;
  width: 100%;
  min-width: 0;
  min-height: 0;
  border: 0;
  background: #fff;
}

/* Over a frame until its site has loaded, so the pane never sits blank and white.
   app.js adds one per frame and hides it on the frame's first load. */
.frame-loading {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px 16px;
  background: #f4f6fa; /* Paper */
  color: #5a6072; /* Slate */
  font: 15px/1.4 var(--font);
  text-align: center;
  transition: opacity 200ms ease;
}
.frame-loading.done { opacity: 0; pointer-events: none; }
.frame-loading[hidden] { display: none; }
.frame-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #dfe3ec;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: frame-spin 800ms linear infinite;
}
@keyframes frame-spin { to { transform: rotate(360deg); } }

/* ---------- Pane headers ---------- */

.pane-head {
  display: flex;
  flex: 0 0 var(--head);
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 0 14px;
  border-bottom: 1px solid var(--chrome-line);
  background: var(--chrome);
}

.pane-title {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---------- Segmented control (right pane tabs, and the narrow switcher) ---------- */

.segmented {
  display: inline-flex;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
  padding: 3px;
  border-radius: 11px;
  background: var(--seg-bg);
}

.segment {
  flex: 0 1 auto;
  min-width: 0;
  min-height: 44px;
  padding: 4px 16px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  font: 600 15px/1.15 var(--font);
  cursor: pointer;
  transition: background-color var(--ease), color var(--ease);
}
.segment:hover { background: var(--seg-hover); color: var(--text); }
.segment[aria-selected="true"] {
  background: var(--seg-on-bg);
  color: var(--seg-on-text);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.3);
  cursor: default;
}
.segment:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Divider ---------- */

.divider {
  position: relative;
  z-index: 2;
  flex: 0 0 var(--divider);
  border-inline: 1px solid var(--chrome-line);
  background: var(--chrome);
  cursor: col-resize;
  touch-action: none;
}
/* A wider, invisible grab area that reaches over the frames' edges: 24px for a
   mouse, 44px for a finger. */
.divider::before {
  content: "";
  position: absolute;
  inset: 0 -6px;
}
@media (pointer: coarse) {
  .divider::before { inset: 0 -16px; }
}
/* The grip: a pill in the middle, lit on hover, drag and focus. */
.divider::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 56px;
  border-radius: 999px;
  background: var(--grip);
  transform: translate(-50%, -50%);
  transition: background-color var(--ease), height var(--ease);
}
.divider:hover, body.dragging .divider { background: #0b1633; }
.divider:hover::after, .divider:focus-visible::after, body.dragging .divider::after {
  height: 88px;
  background: var(--accent);
}
.divider:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

/* While dragging, the frames would swallow pointer events and stall the drag. */
body.dragging { cursor: col-resize; user-select: none; -webkit-user-select: none; }
body.dragging .frame { pointer-events: none; }

/* ---------- Agent Manager sign-in cover ---------- */

/* Over the Agent Manager pane when the console has gone to its sign-in page,
   which refuses to load inside a frame. */
.sign-in {
  position: absolute;
  inset: 0;
  z-index: 2; /* over the frame's loading cover */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow: auto;
  background: #f4f6fa;
  color: #0b1633;
}
.sign-in-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  max-width: 420px;
  padding: 36px 28px 32px;
  border: 1px solid #dfe3ec;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 32px rgb(11 22 51 / 0.10);
  text-align: center;
}
.sign-in-logo { width: 44px; height: auto; margin-bottom: 8px; } /* the logo kit's C mark, unmodified (the kit has no navy C mark yet) */
.sign-in-title { margin: 4px 0 0; color: #0b1633; font: 600 22px/1.25 var(--font); }
.sign-in-hint { margin: 0; color: #5a6072; font: 16px/1.45 var(--font); }
.sign-in-button {
  min-height: 48px;
  min-width: 180px;
  margin-top: 8px;
  padding: 0 24px;
  border: 0;
  border-radius: 10px;
  background: #ff4600; /* Signal, as Oxygen UI's primary button */
  color: #fff;
  font: 600 16px/1.2 var(--font);
  cursor: pointer;
  transition: background-color var(--ease);
}
.sign-in-button:hover { background: #c43300; } /* Burn */
.sign-in-button:focus-visible { outline: 3px solid #0b1633; outline-offset: 3px; }

/* ---------- Tab view: one pane at a time ----------
   Narrow screens always use it. On a wide screen the presenter can switch to it
   (and back) with the toggle. Tab view is the default: "tabs-mode" is on <html> in
   index.html, and layout-early.js removes it before the first paint for split view. */

.switcher { display: none; }
.layout-toggle {
  position: fixed;
  top: 4px;
  right: 12px;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--chrome-line);
  border-radius: 8px;
  background: var(--chrome);
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color var(--ease), color var(--ease);
}
.layout-toggle:hover { background: var(--seg-hover); color: var(--text); }
.layout-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.layout-toggle svg { width: 20px; height: 20px; grid-area: 1 / 1; }
/* Show the icon of the view the button switches to. */
.layout-toggle .icon-split { display: none; }
.tabs-mode .layout-toggle .icon-tabs { display: none; }
.tabs-mode .layout-toggle .icon-split { display: block; }

.tabs-mode .switcher {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--chrome-line);
}
.tabs-mode .switcher .segmented { display: flex; flex: 1 1 auto; width: 100%; max-width: 560px; }
.tabs-mode .switcher .segment { flex: 1 1 0; padding: 4px 8px; font-size: 14px; }
.tabs-mode .pane-head, .tabs-mode .divider { display: none; }
.tabs-mode .pane-left, .tabs-mode .pane-right { flex: 1 1 auto; }
.tabs-mode .split[data-view="left"] .pane-right,
.tabs-mode .split[data-view="right"] .pane-left { display: none; }

/* A phone-sized screen has no room for both, so it has no toggle either. */
@media (max-width: 899.98px) {
  .layout-toggle { display: none; }
  .switcher {
    display: flex;
    flex: 0 0 auto;
    justify-content: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--chrome-line);
  }
  .switcher .segmented { display: flex; width: 100%; max-width: 560px; }
  .switcher .segment { flex: 1 1 0; padding: 4px 8px; font-size: 14px; }
  .pane-head, .divider { display: none; }
  .pane-left, .pane-right { flex: 1 1 auto; }
  .split[data-view="left"] .pane-right,
  .split[data-view="right"] .pane-left { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .frame-spinner { animation: none; border-top-color: #dfe3ec; }
}
