@font-face {
  font-family: "Source Sans 3";
  src: url("/static/assets/source-sans-3.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
}

@font-face {
  font-family: "Archivo";
  src: url("/static/assets/archivo.woff2") format("woff2");
  font-weight: 700 900;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/assets/ibm-plex-mono.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #161310;
  --text: #26221d;
  --muted: #6e675c;
  --line: #ccc5b7;
  --paper: #f7f4ee;
  --section: #efeae0;
  --card: #ffffff;
  --cyan: #3aabd2;
  --cyan-dark: #1b7ea3;
  --magenta: #d1327a;
  --amber: #e8b13a;
  --danger: #a5205e;
  font-family: "Source Sans 3", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--ink); }
body { margin: 0; background: var(--paper); color: var(--text); font-size: 17px; line-height: 1.58; }
button, textarea, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
a, button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--magenta); outline-offset: 3px; }
h1, h2, h3, strong { color: var(--ink); }
h1, h2, h3 { font-family: "Archivo", Arial, sans-serif; font-weight: 900; line-height: 1.08; letter-spacing: -0.03em; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  min-height: 82px;
  padding: 14px max(24px, 5vw);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid #3a342c;
  background: var(--ink);
  color: var(--paper);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { display: flex; gap: 22px; align-items: center; color: var(--paper); text-decoration: none; }
.brand-logo { display: block; width: 150px; height: auto; flex: 0 0 auto; }
.product-lockup { padding-left: 20px; border-left: 1px solid #3a342c; line-height: 1.1; }
.product-lockup strong { display: block; color: var(--paper); font-family: "Archivo", sans-serif; font-size: 17px; font-weight: 900; letter-spacing: -0.02em; }
.product-lockup small { display: block; margin-top: 5px; color: #a79f91; font-family: "IBM Plex Mono", monospace; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; }
.status-cluster { display: flex; align-items: center; gap: 10px; color: #ccc5b7; font-family: "IBM Plex Mono", monospace; font-size: 11px; letter-spacing: 0.04em; }
.session-cluster { display: flex; align-items: center; gap: 14px; }
.status-dot { width: 9px; height: 9px; background: var(--cyan); border-radius: 50%; box-shadow: 0 0 0 3px rgba(58, 171, 210, 0.2); }
.text-button.compact { padding: 7px 9px; font-size: 11px; color: var(--paper); border-color: #6e675c; }

main { width: min(1020px, 92vw); margin: 38px auto 76px; display: grid; gap: 20px; flex: 1 0 auto; }
.login-view { min-height: calc(100vh - 220px); place-items: center; }
.login-card {
  width: min(560px, 92vw);
  padding: clamp(32px, 6vw, 54px);
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 8px solid var(--amber);
}
.login-card .helper-mark { margin: 0 0 26px; }
.login-card h1 { margin: 8px 0 14px; font-size: clamp(32px, 6vw, 48px); }
.login-card > p:not(.eyebrow, .error-status) { color: var(--muted); margin: 0 0 26px; max-width: 54ch; }
.login-card .primary-button { width: 100%; }
.secondary-link { display: inline-block; margin-top: 18px; color: var(--cyan-dark); font-weight: 700; text-underline-offset: 4px; }
.error-status { min-height: 24px; color: var(--danger); font-weight: 700; font-size: 14px; }
.helper-mark { width: 66px; height: auto; flex: 0 0 auto; display: block; }

.scope-banner { padding: 16px 19px; border: 1px solid var(--line); border-left: 6px solid var(--cyan); background: var(--section); color: var(--text); font-size: 15px; }
.scope-banner strong { font-family: "Source Sans 3", sans-serif; }
.context-panel, .work-card, .result-card, .cowork-card, .inbox-panel, .decision-panel,
.cowork-consent-card, .cowork-setup, .session-summary, .media-stage, .media-controls {
  background: var(--card);
  border: 1px solid var(--line);
}
.context-panel { padding: 26px 28px; display: grid; grid-template-columns: 1fr auto; align-items: center; border-top: 5px solid var(--cyan); }
.context-panel h1, .work-card h2, .result-card h2, .cowork-card h2 { margin: 5px 0 7px; }
.context-panel h1 { font-size: clamp(24px, 4vw, 34px); }
.task-picker { display: inline-flex; align-items: center; gap: 10px; margin: 10px 0 3px; color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }
.task-picker select { max-width: min(460px, 65vw); border: 1px solid var(--line); border-radius: 0; padding: 8px 10px; background: var(--paper); color: var(--ink); text-transform: none; }
.muted, .context-panel p { color: var(--muted); margin: 0; }
.eyebrow { margin: 0; color: var(--cyan-dark); font-family: "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: 0.14em; font-size: 11px; }
.text-button { background: transparent; border: 1px solid var(--line); border-radius: 0; color: var(--cyan-dark); font-weight: 700; padding: 10px 13px; }
.text-button:hover { background: var(--section); }
.context-details { grid-column: 1 / -1; border-top: 1px solid var(--line); margin-top: 22px; padding-top: 22px; }
.context-details dl { margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.context-details dt, .decision-context dt { color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 7px; }
.context-details dd, .decision-context dd { margin: 0; line-height: 1.55; }
.history-heading { display: flex; gap: 10px; align-items: center; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 14px; }
.history-heading span, .count-badge { min-width: 28px; padding: 4px 8px; background: var(--amber); color: var(--ink); text-align: center; font-family: "IBM Plex Mono", monospace; font-size: 11px; }
.action-history { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.action-history p { font-size: 14px; color: var(--muted); }
.action-history button, .manager-inbox button { border: 1px solid var(--line); border-radius: 0; padding: 9px 11px; background: var(--paper); color: var(--ink); }
.action-history button:hover, .manager-inbox button:hover { border-color: var(--cyan-dark); }

.work-card { padding: clamp(28px, 5vw, 48px); border-top: 6px solid var(--amber); }
.helper-intro { display: flex; gap: 24px; align-items: center; margin-bottom: 30px; }
.helper-intro p:last-child { color: var(--muted); margin: 6px 0 0; }
form label { display: block; font-family: "IBM Plex Mono", monospace; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 9px; }
input[type="password"], textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 15px 16px;
  color: var(--ink);
  outline: none;
  background: var(--paper);
}
input[type="password"] { margin-bottom: 15px; }
textarea { resize: vertical; line-height: 1.58; min-height: 142px; }
input[type="password"]:focus, textarea:focus, select:focus { border-color: var(--cyan-dark); box-shadow: inset 5px 0 0 var(--cyan); }
.form-footer { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 15px; }
.form-footer p { color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: 10px; margin: 0; }
.primary-button {
  border: 1px solid var(--amber);
  border-radius: 0;
  padding: 12px 18px;
  background: var(--amber);
  color: var(--ink);
  font-family: "Archivo", sans-serif;
  font-weight: 800;
}
.primary-button:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.result-card { padding: clamp(28px, 5vw, 44px); border-top: 6px solid var(--cyan); scroll-margin-top: 100px; }
.result-heading { display: flex; justify-content: space-between; gap: 22px; align-items: flex-start; }
.mode-pill, .safety-badge, .privacy-facts span {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.mode-pill { margin: 0 0 9px; padding: 6px 9px; background: var(--cyan); color: var(--ink); }
.safety-badge { padding: 7px 10px; background: var(--section); color: var(--muted); border: 1px solid var(--line); }
.safety-badge[data-safety="blocked"] { background: var(--magenta); border-color: var(--magenta); color: white; }
.safety-badge[data-safety="review_required"] { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.reason { color: var(--muted); }
#questions-block { background: var(--section); padding: 17px 20px; border-left: 5px solid var(--amber); margin: 20px 0; }
#questions-block h3 { font-size: 15px; margin: 0 0 8px; }
#questions-block ul { margin: 0; padding-left: 19px; }
.artifact { border: 1px solid var(--line); margin-top: 22px; }
.artifact summary { display: flex; justify-content: space-between; padding: 15px 18px; font-family: "Archivo", sans-serif; font-weight: 800; cursor: pointer; background: var(--section); }
.artifact summary small { color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 400; text-transform: uppercase; }
.artifact pre, .decision-proposal pre { margin: 0; padding: 20px; background: var(--card); white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.65 "IBM Plex Mono", monospace; max-height: 450px; overflow-y: auto; }
.result-actions { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 9px; }
.result-actions button, .media-controls button { border: 1px solid var(--line); border-radius: 0; padding: 10px 13px; background: var(--paper); color: var(--ink); font-weight: 700; }
.result-actions .primary-button { border-color: var(--amber); background: var(--amber); }
.result-actions .danger-text { color: var(--danger); border-color: var(--magenta); }
.feedback-status { color: var(--cyan-dark); min-height: 22px; font-weight: 700; font-size: 14px; margin-bottom: 0; }

.cowork-card { padding: 25px 28px; display: flex; align-items: center; justify-content: space-between; gap: 26px; border-left: 6px solid var(--magenta); }
.cowork-card p:last-child { color: var(--muted); margin: 6px 0 0; }
.cowork-card button { border: 1px solid var(--line); background: var(--section); padding: 11px 14px; border-radius: 0; white-space: nowrap; }

.manager-layout { width: min(1240px, 94vw); margin-left: 50%; transform: translateX(-50%); display: grid; grid-template-columns: minmax(270px, 0.78fr) minmax(0, 1.65fr); gap: 20px; align-items: start; }
.inbox-panel { padding: 22px; position: sticky; top: 102px; border-top: 6px solid var(--magenta); }
.panel-heading { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.panel-heading h1 { margin: 5px 0; font-size: 27px; }
.count-badge { display: grid; place-items: center; height: 31px; }
.manager-inbox { display: grid; gap: 8px; margin-top: 17px; }
.manager-inbox button { display: grid; gap: 5px; width: 100%; text-align: left; padding: 13px; }
.manager-inbox button span { color: var(--muted); font-size: 12px; }
.manager-inbox button[data-status="pending"] { border-left: 5px solid var(--magenta); }
.manager-inbox button[aria-current="true"] { border-color: var(--cyan-dark); background: #eaf6fa; }
.decision-panel { padding: clamp(28px, 4vw, 44px); min-height: 390px; border-top: 6px solid var(--cyan); }
.empty-state { display: grid; min-height: 310px; place-content: center; text-align: center; color: var(--muted); }
.empty-state h2 { margin-bottom: 6px; }
.decision-context { display: grid; grid-template-columns: repeat(3, 1fr); gap: 17px; padding: 20px 0; margin: 22px 0 0; border-top: 1px solid var(--line); }
.decision-proposal { margin: 16px 0 22px; padding: 19px; background: var(--section); border-left: 5px solid var(--cyan); }
.decision-proposal h3 { margin: 0 0 8px; }
.decision-proposal p { color: var(--muted); }
#decision-form fieldset { display: grid; gap: 11px; border: 1px solid var(--line); padding: 19px; }
#decision-form legend { padding: 0 8px; font-family: "Archivo", sans-serif; font-size: 14px; font-weight: 800; }
#decision-form label { display: flex; gap: 10px; align-items: flex-start; margin: 0; font-family: "Source Sans 3", sans-serif; font-size: 16px; font-weight: 650; text-transform: none; letter-spacing: 0; }
#decision-form input { accent-color: var(--cyan-dark); }
#decision-form .primary-button { margin-top: 8px; justify-self: start; }
.decision-history { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 15px; }
.decision-history h3 { font-size: 15px; }
.decision-history p { color: var(--muted); font-size: 13px; }
.inline-link { color: var(--cyan-dark); font-weight: 800; margin-left: 10px; }

.cowork-page { width: min(1160px, 92vw); }
.cowork-consent-card { padding: 28px; display: flex; justify-content: space-between; gap: 28px; align-items: center; border-top: 6px solid var(--amber); }
.cowork-consent-card h1 { margin: 6px 0 8px; font-size: clamp(28px, 5vw, 44px); }
.cowork-consent-card p:last-child { color: var(--muted); margin: 0; max-width: 670px; }
.privacy-facts { display: grid; grid-template-columns: repeat(2, max-content); gap: 7px; }
.privacy-facts span { padding: 8px 10px; background: #eaf6fa; color: var(--cyan-dark); border: 1px solid #afd9e8; }
.cowork-setup { padding: 25px 28px; display: flex; align-items: center; justify-content: space-between; gap: 28px; border-left: 6px solid var(--magenta); }
.cowork-setup h2 { margin: 5px 0; }
.cowork-setup p:last-child { color: var(--muted); margin: 0; }
.cowork-invites { display: grid; gap: 8px; min-width: min(470px, 50vw); }
.cowork-invite { display: flex; gap: 16px; align-items: center; justify-content: space-between; border: 1px solid var(--line); padding: 13px; }
.cowork-invite div { display: grid; gap: 4px; }
.cowork-invite span { color: var(--muted); font-size: 12px; }
.session-summary { display: grid; grid-template-columns: repeat(3, 1fr); padding: 18px 22px; gap: 18px; border-top: 5px solid var(--cyan); }
.session-summary div { display: grid; gap: 4px; }
.session-summary small { color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: 10px; text-transform: uppercase; }
.media-stage { display: grid; grid-template-columns: minmax(0, 4fr) minmax(190px, 1fr); min-height: 430px; overflow: hidden; background: var(--ink); padding: 12px; gap: 12px; border-color: var(--ink); }
.remote-stage, .local-stage { position: relative; overflow: hidden; background: #090807; }
.remote-stage video, .local-stage video { display: block; width: 100%; height: 100%; object-fit: contain; background: #090807; }
.video-placeholder { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 15px; color: #ccc5b7; text-align: center; }
.video-placeholder[hidden] { display: none; }
.video-placeholder .helper-mark { filter: none; }
.local-stage { min-height: 180px; }
.local-stage p { position: absolute; left: 10px; bottom: 8px; margin: 0; color: var(--paper); background: var(--ink); border-left: 4px solid var(--amber); padding: 6px 8px; font: 10px "IBM Plex Mono", monospace; }
.media-controls { padding: 15px; display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; }
.media-controls .danger-button { color: white; background: var(--magenta); border-color: var(--magenta); }
.cowork-status { min-height: 26px; margin: 0; color: var(--cyan-dark); font-weight: 700; text-align: center; }
.cowork-status[data-kind="error"] { color: var(--danger); }
.cowork-status[data-kind="warning"] { color: #725210; }
.headphone-note { margin: 0; color: var(--muted); font: 11px "IBM Plex Mono", monospace; text-align: center; }
.status-dot.is-idle { background: #a79f91; box-shadow: 0 0 0 3px rgba(167, 159, 145, 0.2); }
.status-dot.is-live { background: var(--magenta); animation: live-pulse 1.4s infinite; }
@keyframes live-pulse { 50% { box-shadow: 0 0 0 7px rgba(209, 50, 122, 0.18); } }

.kt-footer { margin-top: auto; padding: 28px max(24px, 5vw); display: flex; justify-content: space-between; gap: 20px; background: var(--ink); color: #ccc5b7; font-family: "IBM Plex Mono", monospace; font-size: 11px; letter-spacing: 0.05em; }
.kt-footer span:first-child { color: var(--paper); font-family: "Archivo", sans-serif; font-size: 14px; font-weight: 800; }
.ci-stripe { display: grid; grid-template-columns: repeat(4, 1fr); height: 8px; }
.ci-stripe i:nth-child(1) { background: var(--cyan); }
.ci-stripe i:nth-child(2) { background: var(--magenta); }
.ci-stripe i:nth-child(3) { background: var(--amber); }
.ci-stripe i:nth-child(4) { background: var(--ink); }

@media (max-width: 760px) {
  body { font-size: 16px; }
  .topbar { min-height: 72px; padding: 12px 5vw; }
  .brand-logo { width: 140px; }
  .product-lockup { display: none; }
  .status-cluster span:last-child { display: none; }
  main { margin-top: 24px; }
  .context-panel { grid-template-columns: 1fr; }
  .text-button { justify-self: start; margin-top: 12px; }
  .context-details dl, .decision-context { grid-template-columns: 1fr; }
  .helper-mark { width: 54px; }
  .form-footer, .cowork-card, .cowork-consent-card, .cowork-setup { align-items: stretch; flex-direction: column; }
  .primary-button { width: 100%; }
  .result-heading { flex-direction: column-reverse; gap: 9px; }
  .manager-layout { width: 100%; margin-left: 0; transform: none; grid-template-columns: 1fr; }
  .inbox-panel { position: static; }
  .privacy-facts { grid-template-columns: 1fr 1fr; }
  .cowork-invites { min-width: 0; }
  .cowork-invite { align-items: stretch; flex-direction: column; }
  .session-summary, .media-stage { grid-template-columns: 1fr; }
  .media-stage { min-height: 320px; }
  .kt-footer { flex-direction: column; }
}

@media (max-width: 430px) {
  .brand-logo { width: 132px; }
  .session-cluster { gap: 6px; }
  .text-button.compact { padding: 6px; }
  .helper-intro { align-items: flex-start; }
  .privacy-facts { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
