:root {
  --brand-navy: #0b1324;
  --brand-blue: #146bff;
  --brand-blue-dark: #0c55d4;
  --brand-blue-soft: #edf4ff;
  --brand-silver: #c6cad3;
  --page: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #fafbfc;
  --line: #dce2eb;
  --line-strong: #c7d0dc;
  --text: #0b1324;
  --text-muted: #5f6d82;
  --text-faint: #8994a5;
  --success: #14845d;
  --success-soft: #eaf8f2;
  --danger: #c63b4d;
  --danger-soft: #fff0f2;
  --shadow: 0 18px 55px rgba(11, 19, 36, 0.08);
  --shadow-small: 0 8px 24px rgba(11, 19, 36, 0.06);
  --radius-lg: 24px;
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-width: 270px;
  --font-body: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
  color-scheme: light;
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background: var(--page);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

img {
  display: block;
  max-width: 100%;
}

[hidden],
.is-hidden {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--brand-navy);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 180ms var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid rgba(20, 107, 255, 0.3);
  outline-offset: 3px;
}

.ambient-grid {
  display: none;
}

.eyebrow,
.system-index,
.nav-label,
.char-counter,
.result-status {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow,
.system-index {
  color: var(--brand-blue);
}

.session-loading {
  display: grid;
  min-height: 100dvh;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background: var(--surface);
}

.session-loading p {
  margin: 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.boot-mark {
  position: relative;
  width: 66px;
  height: 66px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff url("/img/fred-monogram-official.png") center / 48px auto no-repeat;
  box-shadow: var(--shadow-small);
}

.boot-mark span {
  position: absolute;
  bottom: -11px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--brand-blue);
  animation: loading-dots 900ms var(--ease) infinite alternate;
}

.boot-mark span:nth-child(1) { left: 21px; animation-delay: 0ms; }
.boot-mark span:nth-child(2) { left: 31px; animation-delay: 130ms; }
.boot-mark span:nth-child(3) { left: 41px; animation-delay: 260ms; }

@keyframes loading-dots {
  from { opacity: 0.25; transform: translateY(0); }
  to { opacity: 1; transform: translateY(-4px); }
}

.login-view {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 36px;
  background: var(--page);
}

.login-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) minmax(380px, 0.86fr);
  width: min(1120px, 100%);
  min-height: 650px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: view-enter 520ms var(--ease) both;
}

.login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  overflow: hidden;
  padding: 58px 64px;
  background: var(--brand-blue-soft);
}

.login-brand::after {
  position: absolute;
  right: -170px;
  bottom: -190px;
  width: 430px;
  height: 430px;
  border: 74px solid rgba(20, 107, 255, 0.08);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.login-fred {
  position: absolute;
  right: -62px;
  bottom: 12px;
  z-index: 0;
  width: 360px;
  height: 520px;
  object-fit: contain;
  object-position: right bottom;
  opacity: 0.28;
  pointer-events: none;
  filter: drop-shadow(0 18px 26px rgba(11, 19, 36, 0.12));
}

.brand-lockup {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.brand-logo {
  width: 164px;
  height: auto;
}

.brand-lockup--large .brand-logo {
  width: 224px;
}

.brand-product {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.login-statement {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: auto 0;
  padding: 76px 0;
}

.login-statement .eyebrow {
  margin: 0 0 18px;
}

.login-statement h1 {
  max-width: 12ch;
  margin: 0;
  color: var(--brand-navy);
  font-size: clamp(40px, 5vw, 62px);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.login-statement > p:last-child {
  max-width: 48ch;
  margin: 24px 0 0;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1.6;
}

.login-signal {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(80px, 1fr) auto;
  align-items: center;
  gap: 14px;
  max-width: 420px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.signal-line {
  height: 1px;
  overflow: hidden;
  background: rgba(20, 107, 255, 0.22);
}

.signal-line i {
  display: block;
  width: 36%;
  height: 100%;
  background: var(--brand-blue);
  animation: signal-move 2.4s var(--ease) infinite;
}

@keyframes signal-move {
  0%, 100% { transform: translateX(-100%); }
  50% { transform: translateX(280%); }
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 64px;
  background: var(--surface);
}

.login-panel__head .system-index {
  display: block;
  margin-bottom: 16px;
}

.login-panel__head h2 {
  margin: 0;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.login-panel__head p {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 16px;
}

#loginForm {
  margin-top: 38px;
}

.field-group {
  display: grid;
  gap: 9px;
}

.field-group + .field-group {
  margin-top: 24px;
}

.field-group > label,
.label-row label,
.preset-fieldset legend {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease), background-color 180ms var(--ease);
}

input {
  min-height: 50px;
  padding: 0 15px;
}

textarea {
  min-height: 220px;
  padding: 16px;
  resize: vertical;
  line-height: 1.62;
}

input::placeholder,
textarea::placeholder {
  color: #9aa5b5;
}

input:hover,
textarea:hover {
  border-color: #aeb9c8;
}

input:focus,
textarea:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 4px rgba(20, 107, 255, 0.1);
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 52px;
}

.icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 180ms var(--ease), border-color 180ms var(--ease), background-color 180ms var(--ease), transform 180ms var(--ease);
}

.icon-button:hover {
  border-color: var(--brand-blue);
  color: var(--brand-blue);
}

.icon-button:active {
  transform: scale(0.97);
}

.icon-button svg {
  width: 19px;
  height: 19px;
}

.password-toggle {
  position: absolute;
  top: 4px;
  right: 4px;
  border: 0;
  background: transparent;
}

.password-toggle .icon-eye-off {
  display: none;
}

.password-toggle[aria-pressed="true"] .icon-eye {
  display: none;
}

.password-toggle[aria-pressed="true"] .icon-eye-off {
  display: block;
}

.field-help {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.form-error {
  margin: 14px 0 0;
  padding: 11px 13px;
  border: 1px solid #f0c5cb;
  border-radius: 10px;
  background: var(--danger-soft);
  color: #9e2537;
  font-size: 14px;
}

.primary-button,
.secondary-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 11px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: color 180ms var(--ease), border-color 180ms var(--ease), background-color 180ms var(--ease), transform 180ms var(--ease), opacity 180ms var(--ease);
}

.primary-button {
  border: 1px solid var(--brand-blue);
  background: var(--brand-blue);
  color: #fff;
  box-shadow: 0 8px 18px rgba(20, 107, 255, 0.18);
}

.primary-button:hover {
  border-color: var(--brand-blue-dark);
  background: var(--brand-blue-dark);
  transform: translateY(-1px);
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
}

.secondary-button:hover {
  border-color: var(--brand-blue);
  color: var(--brand-blue);
  transform: translateY(-1px);
}

.text-button {
  min-height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
}

.text-button:hover {
  color: var(--brand-blue);
}

.primary-button:active,
.secondary-button:active,
.text-button:active {
  transform: scale(0.98);
}

.primary-button:disabled,
.secondary-button:disabled,
.text-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.primary-button--wide,
.secondary-button--wide {
  width: 100%;
}

.primary-button svg,
.secondary-button svg,
.text-button svg {
  width: 18px;
  height: 18px;
}

#loginButton {
  margin-top: 30px;
}

.button-loader {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: rotate 700ms linear infinite;
}

.is-loading .button-label,
.is-loading > svg {
  display: none;
}

.is-loading .button-loader {
  display: block;
}

@keyframes rotate {
  to { transform: rotate(360deg); }
}

.login-security {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 26px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.login-security svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  margin-top: 1px;
  color: var(--success);
}

.app-shell {
  min-height: 100dvh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 30px 20px 22px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.sidebar .brand-lockup {
  padding: 0 12px 30px;
  border-bottom: 1px solid var(--line);
}

.sidebar .brand-logo {
  width: 150px;
}

.side-nav {
  display: grid;
  gap: 6px;
  margin-top: 28px;
}

.nav-label {
  margin: 0 12px 8px;
  color: var(--text-faint);
}

.nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 50px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: color 180ms var(--ease), border-color 180ms var(--ease), background-color 180ms var(--ease), transform 180ms var(--ease);
}

.nav-item:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.nav-item--call {
  border-color: #d7e5ff;
  background: #f7faff;
  color: var(--brand-blue-dark);
}

.nav-item--call:hover {
  border-color: #bfd3f8;
  background: var(--brand-blue-soft);
}

.nav-item:active {
  transform: scale(0.985);
}

.nav-item.is-active {
  border-color: #d7e5ff;
  background: var(--brand-blue-soft);
  color: var(--brand-blue-dark);
  font-weight: 600;
}

.nav-item.is-active::before {
  position: absolute;
  inset: 10px auto 10px -1px;
  width: 3px;
  border-radius: 999px;
  background: var(--brand-blue);
  content: "";
}

.nav-item svg {
  width: 21px;
  height: 21px;
}

.nav-item i {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 11px;
  font-style: normal;
}

.sidebar-foot {
  margin-top: auto;
  padding: 20px 12px 0;
  border-top: 1px solid var(--line);
}

.sidebar-fred {
  position: absolute;
  right: 50%;
  bottom: 126px;
  width: 190px;
  height: 260px;
  object-fit: contain;
  object-position: center bottom;
  opacity: 0.64;
  pointer-events: none;
  filter: drop-shadow(0 10px 18px rgba(11, 19, 36, 0.12));
  transform: translateX(50%);
}

.account-chip {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
}

.account-initial {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: var(--brand-navy);
  color: #fff;
  font-weight: 600;
}

.account-chip div {
  min-width: 0;
}

.account-chip strong {
  display: block;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-chip div > span {
  display: block;
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 12px;
}

.sidebar-foot .text-button {
  margin-top: 12px;
}

.workspace {
  min-height: 100dvh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  padding: 0 clamp(24px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.topbar-context {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text-muted);
  font-size: 14px;
}

.system-status,
.availability-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.system-status {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.system-status i,
.availability-badge i {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--success);
  animation: status-pulse 2.2s var(--ease) infinite;
}

@keyframes status-pulse {
  0%, 100% { opacity: 0.45; transform: scale(0.82); }
  50% { opacity: 1; transform: scale(1); }
}

.topbar-divider {
  width: 1px;
  height: 20px;
  background: var(--line);
}

.mobile-brand,
.mobile-logout,
.mobile-nav {
  display: none;
}

.main-content {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 44px clamp(28px, 4.2vw, 64px) 84px;
}

.panel-section {
  animation: view-enter 420ms var(--ease) both;
}

@keyframes view-enter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-heading {
  display: flex;
  min-height: 126px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line);
}

.section-heading .eyebrow {
  margin: 0 0 10px;
}

.section-heading h1 {
  margin: 0;
  font-size: clamp(34px, 4vw, 48px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.04;
}

.section-heading > div:first-child > p:last-child {
  max-width: 62ch;
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 17px;
}

.availability-badge {
  margin-top: 25px;
  padding: 9px 12px;
  border: 1px solid #cde8dc;
  border-radius: 999px;
  background: var(--success-soft);
  color: #126d4f;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.studio-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 30px;
  align-items: start;
  padding-top: 32px;
}

.production-console,
.locked-config,
.audio-result,
.context-form,
.context-explainer,
.knowledge-manager,
.credits-console {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-small);
}

.production-console {
  container: production-console / inline-size;
  padding: 28px;
  border-radius: var(--radius-lg);
}

.console-head,
.rail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.console-head > span:first-child {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.char-counter {
  color: var(--text-faint);
  white-space: nowrap;
}

.char-counter[data-near-limit="true"] {
  color: var(--danger);
}

.production-console > .field-group {
  margin-top: 16px;
}

.production-console textarea {
  min-height: 300px;
  border-color: var(--line);
  background: var(--surface-soft);
  font-size: 17px;
}

.preset-fieldset {
  min-width: 0;
  margin: 30px 0 0;
  padding: 0;
  border: 0;
}

.preset-fieldset legend {
  margin-bottom: 12px;
}

.preset-selector {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
}

.preset-option {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.preset-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.preset-option > span {
  display: flex;
  min-height: 76px;
  flex-direction: column;
  justify-content: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  transition: color 180ms var(--ease), border-color 180ms var(--ease), background-color 180ms var(--ease), transform 180ms var(--ease);
}

.preset-option strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preset-option small {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
}

.preset-option:hover > span {
  border-color: #a9c7ff;
  transform: translateY(-1px);
}

.preset-option input:checked + span {
  border-color: var(--brand-blue);
  background: var(--brand-blue-soft);
  color: var(--brand-blue-dark);
  box-shadow: inset 0 0 0 1px var(--brand-blue);
}

.preset-option input:focus-visible + span {
  outline: 3px solid rgba(20, 107, 255, 0.24);
  outline-offset: 2px;
}

.form-action-row,
.context-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.cost-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.cost-note svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: var(--brand-blue);
}

.studio-rail {
  display: grid;
  gap: 18px;
}

.locked-config,
.audio-result {
  border-radius: 18px;
}

.locked-config {
  padding: 24px;
}

.rail-heading .system-index {
  color: var(--brand-blue);
}

.rail-heading > svg {
  width: 18px;
  height: 18px;
  color: var(--text-faint);
}

.locked-config h2,
.audio-result h2 {
  margin: 14px 0 0;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.config-list {
  margin: 22px 0 0;
}

.config-list > div {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.config-list dt {
  color: var(--text-muted);
  font-size: 13px;
}

.config-list dd {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.config-list dd span {
  flex: 0 0 auto;
  color: var(--brand-blue);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.audio-result {
  min-height: 340px;
  padding: 24px;
}

.result-status {
  color: var(--text-faint);
  font-size: 10px;
}

.audio-result.is-generating .result-status {
  color: var(--brand-blue);
}

.empty-result,
.generated-result {
  display: flex;
  min-height: 250px;
  flex-direction: column;
  justify-content: center;
}

.empty-result > svg {
  width: 44px;
  height: 44px;
  margin-bottom: 18px;
  color: #aeb8c7;
}

.empty-result p,
.generated-result > p {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.result-wave {
  display: flex;
  height: 42px;
  align-items: center;
  gap: 4px;
  margin: 28px 0 10px;
}

.result-wave i {
  width: 4px;
  height: 26px;
  border-radius: 999px;
  background: var(--brand-blue);
  transform-origin: center;
  animation: wave 1.1s var(--ease) infinite alternate;
}

.result-wave i:nth-child(2n) { animation-delay: 90ms; }
.result-wave i:nth-child(3n) { animation-delay: 180ms; }
.result-wave i:nth-child(4n) { animation-delay: 270ms; }

@keyframes wave {
  from { opacity: 0.36; transform: scaleY(0.34); }
  to { opacity: 1; transform: scaleY(1); }
}

.generated-result audio {
  width: 100%;
  margin: 22px 0 18px;
}

.live-call-note {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 11px 14px;
  border: 1px solid #d5e4ff;
  border-radius: 12px;
  background: var(--brand-blue-soft);
}

.live-call-note > svg {
  width: 20px;
  height: 20px;
  color: var(--brand-blue);
}

.live-call-note div {
  display: grid;
}

.live-call-note span {
  color: var(--brand-blue);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.live-call-note strong {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 600;
}

.context-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 30px;
  align-items: start;
  padding-top: 32px;
}

.context-form,
.context-explainer {
  border-radius: var(--radius-lg);
}

.context-form {
  padding: 30px;
}

.context-state-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.context-state-row h2 {
  margin: 7px 0 0;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.context-publication-state {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin-top: 22px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f7f9fc;
}

.context-publication-dot {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 50%;
  background: #a7b1c2;
}

.context-publication-state span:not(.context-publication-dot) {
  display: block;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.context-publication-state strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 650;
}

.context-publication-state p {
  max-width: 64ch;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.context-publication-state.is-active {
  border-color: rgba(20, 107, 255, 0.28);
  background: rgba(20, 107, 255, 0.055);
}

.context-publication-state.is-active .context-publication-dot {
  background: #15875f;
  box-shadow: 0 0 0 4px rgba(21, 135, 95, 0.12);
}

.context-publication-state.is-active span:not(.context-publication-dot) {
  color: #0f7452;
}

.context-form > .field-group {
  margin-top: 26px;
}

.context-form textarea {
  min-height: 330px;
  font-size: 16px;
}

.switch-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.switch-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch-track {
  position: relative;
  width: 46px;
  height: 26px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #e7ebf1;
  transition: border-color 180ms var(--ease), background-color 180ms var(--ease);
}

.switch-track i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(11, 19, 36, 0.18);
  transition: transform 220ms var(--ease);
}

.switch-control input:checked + .switch-track {
  border-color: var(--brand-blue);
  background: var(--brand-blue);
}

.switch-control input:checked + .switch-track i {
  transform: translateX(20px);
}

.switch-control input:focus-visible + .switch-track {
  outline: 3px solid rgba(20, 107, 255, 0.24);
  outline-offset: 2px;
}

.switch-label {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.context-actions {
  justify-content: flex-end;
}

.danger-action:hover {
  border-color: #e4a7af;
  color: var(--danger);
}

.context-explainer {
  padding: 30px;
}

.context-orbit {
  position: relative;
  display: grid;
  width: 150px;
  height: 150px;
  margin: 0 0 30px auto;
  place-items: center;
}

.orbit-core {
  position: relative;
  z-index: 2;
  display: grid;
  width: 72px;
  height: 72px;
  overflow: hidden;
  place-items: center;
  border: 1px solid #d4e2fb;
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow-small);
}

.orbit-core img {
  width: 58px;
  height: 58px;
  object-fit: cover;
}

.orbit-path {
  position: absolute;
  inset: 18px;
  border: 1px solid #d8e3f3;
  border-radius: 50%;
}

.orbit-path--two {
  inset: 3px;
  border-style: dashed;
}

.orbit-node {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-blue);
}

.orbit-node--one {
  animation: orbit-one 7s linear infinite;
}

.orbit-node--two {
  animation: orbit-two 11s linear infinite reverse;
}

@keyframes orbit-one {
  from { transform: rotate(0deg) translateX(56px) rotate(0deg); }
  to { transform: rotate(360deg) translateX(56px) rotate(-360deg); }
}

@keyframes orbit-two {
  from { transform: rotate(0deg) translateX(70px) rotate(0deg); }
  to { transform: rotate(360deg) translateX(70px) rotate(-360deg); }
}

.context-explainer .eyebrow {
  margin: 0 0 10px;
}

.context-explainer > h2 {
  margin: 0;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.knowledge-manager {
  margin-top: 30px;
  padding: 30px;
  border-radius: var(--radius-lg);
}

.knowledge-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 30px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.knowledge-heading .eyebrow {
  margin: 0 0 10px;
}

.knowledge-heading h2 {
  margin: 0;
  color: var(--brand-navy);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.knowledge-heading > div:first-child > p:last-child {
  max-width: 68ch;
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.55;
}

.knowledge-count {
  display: grid;
  min-width: 86px;
  place-items: center;
  padding: 12px 16px;
  border: 1px solid #d5e4ff;
  border-radius: 14px;
  background: var(--brand-blue-soft);
}

.knowledge-count strong {
  color: var(--brand-blue-dark);
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
}

.knowledge-count span {
  margin-top: 5px;
  color: var(--brand-blue);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.knowledge-search {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  max-width: 520px;
  margin-top: 22px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-soft);
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}

.knowledge-search:focus-within {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(20, 107, 255, 0.12);
}

.knowledge-search svg {
  width: 20px;
  height: 20px;
  color: var(--text-faint);
}

.knowledge-search input {
  width: 100%;
  min-height: 46px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--brand-navy);
  font: inherit;
}

.knowledge-search input::placeholder {
  color: var(--text-faint);
}

.knowledge-skeleton,
.knowledge-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.knowledge-skeleton span {
  min-height: 78px;
  border-radius: 14px;
  background: #edf1f6;
  animation: skeleton 1.3s var(--ease) infinite alternate;
}

.knowledge-item {
  position: relative;
}

.knowledge-item[hidden] {
  display: none;
}

.knowledge-item__surface {
  display: grid;
  min-height: 86px;
  grid-template-columns: minmax(0, 1fr) 38px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  transition:
    border-color 180ms var(--ease),
    background-color 180ms var(--ease),
    transform 180ms var(--ease);
}

.knowledge-item:hover .knowledge-item__surface,
.knowledge-item:focus-within .knowledge-item__surface {
  border-color: #a9c7ff;
  transform: translateY(-1px);
}

.knowledge-item.is-selected .knowledge-item__surface {
  border-color: #9fbeff;
  background: var(--brand-blue-soft);
}

.knowledge-item__details {
  display: grid;
  min-width: 0;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.knowledge-item__details:focus-visible {
  border-radius: 10px;
}

.knowledge-item__icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text-muted);
}

.knowledge-item__icon svg {
  width: 19px;
  height: 19px;
}

.knowledge-item.is-selected .knowledge-item__icon {
  border-color: #bfd3ff;
  color: var(--brand-blue);
}

.knowledge-item__copy {
  min-width: 0;
}

.knowledge-item__copy strong {
  display: -webkit-box;
  overflow: hidden;
  color: var(--brand-navy);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.knowledge-item__copy small {
  display: block;
  margin-top: 5px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.knowledge-item.is-selected .knowledge-item__copy small {
  color: var(--brand-blue);
}

.knowledge-item__switch {
  position: relative;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  cursor: pointer;
}

.knowledge-item__switch > input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.knowledge-item__switch:focus-within {
  outline: 3px solid rgba(20, 107, 255, 0.2);
  outline-offset: 2px;
}

.knowledge-toggle {
  position: relative;
  width: 36px;
  height: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #e6ebf1;
  transition: border-color 180ms var(--ease), background-color 180ms var(--ease);
}

.knowledge-toggle i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(11, 19, 36, 0.16);
  transition: transform 180ms var(--ease);
}

.knowledge-item.is-selected .knowledge-toggle {
  border-color: var(--brand-blue);
  background: var(--brand-blue);
}

.knowledge-item.is-selected .knowledge-toggle i {
  transform: translateX(14px);
}

.knowledge-dialog {
  width: min(760px, calc(100vw - 40px));
  max-height: min(760px, calc(100dvh - 40px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 30px 90px rgba(11, 19, 36, 0.24);
}

.knowledge-dialog::backdrop {
  background: rgba(7, 14, 29, 0.58);
  backdrop-filter: blur(5px);
}

.knowledge-dialog__shell {
  display: flex;
  max-height: min(760px, calc(100dvh - 40px));
  flex-direction: column;
}

.knowledge-dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 28px 22px;
  border-bottom: 1px solid var(--line);
}

.knowledge-dialog__header .eyebrow {
  margin: 0 0 8px;
}

.knowledge-dialog__header h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.knowledge-dialog__meta {
  margin: 10px 0 0;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.knowledge-dialog__close {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  cursor: pointer;
}

.knowledge-dialog__close:hover {
  border-color: #aac8ff;
  background: var(--brand-blue-soft);
  color: var(--brand-blue);
}

.knowledge-dialog__close svg {
  width: 19px;
  height: 19px;
}

.knowledge-dialog__body {
  min-height: 240px;
  overflow: auto;
  padding: 26px 28px;
  background: #fbfcfe;
}

.knowledge-dialog__loading {
  display: grid;
  gap: 12px;
}

.knowledge-dialog__loading span {
  height: 15px;
  border-radius: 5px;
  background: #e9eef5;
  animation: skeleton 1.3s var(--ease) infinite alternate;
}

.knowledge-dialog__loading span:nth-child(2),
.knowledge-dialog__loading span:nth-child(5) {
  width: 82%;
}

.knowledge-dialog__loading span:nth-child(3) {
  width: 94%;
}

.knowledge-dialog__content {
  margin: 0;
  color: #243147;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.72;
  white-space: pre-wrap;
}

.knowledge-dialog__empty {
  display: grid;
  min-height: 210px;
  place-content: center;
  justify-items: center;
  color: var(--text-muted);
  text-align: center;
}

.knowledge-dialog__empty svg {
  width: 38px;
  height: 38px;
  margin-bottom: 14px;
  color: var(--brand-blue);
}

.knowledge-dialog__empty p {
  max-width: 44ch;
  margin: 0;
}

.knowledge-dialog__empty strong {
  display: block;
  margin-bottom: 4px;
  color: var(--brand-navy);
}

.knowledge-dialog__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 28px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.knowledge-dialog__footer > span {
  color: var(--text-faint);
  font-size: 13px;
}

.knowledge-empty {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  color: var(--text-muted);
}

.knowledge-empty svg {
  width: 28px;
  height: 28px;
  color: var(--brand-blue);
}

.knowledge-empty p {
  margin: 0;
  font-size: 14px;
}

.knowledge-empty strong {
  display: block;
  margin-bottom: 2px;
  color: var(--brand-navy);
}

.knowledge-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.knowledge-actions > p {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.knowledge-actions > p svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--brand-blue);
}

.process-list {
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.process-list li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.process-list li > span {
  color: var(--brand-blue);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

.process-list p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.process-list strong {
  color: var(--text);
  font-weight: 600;
}

.next-call-alert {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 11px;
  margin-top: 24px;
  padding: 15px;
  border: 1px solid #d6e3f7;
  border-radius: 12px;
  background: var(--brand-blue-soft);
}

.next-call-alert svg {
  width: 21px;
  height: 21px;
  color: var(--brand-blue);
}

.next-call-alert p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.next-call-alert strong {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
}

.published-at {
  margin: 18px 0 0;
  color: var(--text-faint);
  font-size: 12px;
}

.compact-button {
  min-height: 42px;
  margin-top: 16px;
}

.credits-console {
  min-height: 500px;
  margin-top: 32px;
  padding: 34px;
  border-radius: var(--radius-lg);
}

.credits-skeleton {
  display: grid;
  grid-template-columns: 1fr 150px;
  gap: 18px;
}

.credits-skeleton span {
  min-height: 94px;
  border-radius: 12px;
  background: #edf0f5;
  animation: skeleton 1.3s var(--ease) infinite alternate;
}

.credits-skeleton span:nth-child(1) {
  min-height: 180px;
}

.credits-skeleton span:nth-child(2) {
  min-height: 180px;
}

.credits-skeleton span:nth-child(3),
.credits-skeleton span:nth-child(4) {
  min-height: 130px;
}

@keyframes skeleton {
  from { opacity: 0.55; }
  to { opacity: 1; }
}

.billing-strip {
  margin-bottom: 30px;
  overflow: hidden;
  border: 1px solid #cbdcff;
  border-radius: 18px;
  background:
    radial-gradient(circle at 95% 0%, rgba(26, 104, 255, 0.12), transparent 34%),
    linear-gradient(135deg, #f3f7ff 0%, #ffffff 64%);
  box-shadow: 0 16px 38px rgba(18, 59, 124, 0.08);
}

.billing-strip__top {
  display: grid;
  grid-template-columns: minmax(210px, 0.8fr) minmax(320px, 1.2fr);
  gap: 28px;
  padding: 25px 26px 22px;
}

.billing-plan h2 {
  margin: 7px 0 4px;
  color: var(--brand-navy);
  font-size: 26px;
  letter-spacing: -0.04em;
}

.billing-plan p {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 0;
}

.billing-plan p strong {
  color: var(--brand-blue);
  font-family: var(--font-mono);
  font-size: 21px;
}

.billing-plan p span {
  color: var(--text-muted);
  font-size: 13px;
}

.billing-entitlements {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: center;
  gap: 10px 18px;
}

.billing-entitlements span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}

.billing-entitlements span:first-child {
  grid-column: 1 / -1;
  color: var(--brand-navy);
}

.billing-entitlements svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  padding: 3px;
  border-radius: 50%;
  background: #dce9ff;
  color: var(--brand-blue);
}

.billing-cycle {
  padding: 18px 26px 20px;
  border-top: 1px solid #dbe6f8;
  background: rgba(255, 255, 255, 0.68);
}

.billing-cycle__heading,
.billing-cycle__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.billing-cycle__heading > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.billing-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(35, 179, 125, 0.11);
}

.billing-cycle__heading strong {
  color: var(--brand-navy);
  font-size: 14px;
}

.billing-cycle__heading > span,
.billing-cycle__meta {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.billing-progress {
  height: 7px;
  margin: 13px 0 11px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4ebf5;
}

.billing-progress > span {
  display: block;
  width: 0;
  min-width: 7px;
  height: 100%;
  border-radius: inherit;
  background: #1b6eff;
  transition: width 620ms var(--ease), background-color 220ms var(--ease);
}

.billing-cycle__meta strong {
  color: var(--brand-blue);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
}

.billing-strip.is-urgent {
  border-color: #f1c27b;
}

.billing-strip.is-urgent .billing-status-dot {
  background: #e79224;
  box-shadow: 0 0 0 5px rgba(231, 146, 36, 0.12);
}

.billing-strip.is-urgent .billing-progress > span {
  background: #e5484d;
}

.billing-strip.is-paid {
  border-color: #a9dec9;
  background:
    radial-gradient(circle at 95% 0%, rgba(35, 179, 125, 0.12), transparent 34%),
    linear-gradient(135deg, #f1fbf7 0%, #ffffff 64%);
}

.billing-strip.is-paid .billing-cycle {
  border-top-color: #cfeade;
}

.billing-strip.is-paid .billing-progress > span {
  background: #1b6eff;
}

.balance-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  align-items: center;
  gap: 40px;
  padding: 14px 10px 34px;
}

.balance-value {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 12px 0 0;
}

.balance-value strong {
  color: var(--brand-navy);
  font-family: var(--font-mono);
  font-size: clamp(52px, 8vw, 82px);
  font-weight: 600;
  letter-spacing: -0.06em;
  line-height: 1;
}

.balance-value span {
  color: var(--text-muted);
  font-size: 17px;
}

.balance-caption {
  margin: 14px 0 0;
  color: var(--text-muted);
  font-size: 16px;
}

.balance-gauge {
  position: relative;
  width: 150px;
  height: 150px;
}

.balance-gauge svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.balance-gauge circle {
  fill: none;
  stroke-width: 8;
}

.gauge-track {
  stroke: #e8edf3;
}

.gauge-value {
  stroke: var(--brand-blue);
  stroke-dasharray: 301.6;
  stroke-dashoffset: 301.6;
  transition: stroke-dashoffset 620ms var(--ease);
}

.balance-gauge > span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--brand-navy);
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
}

.usage-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf3;
}

.usage-track > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--brand-blue);
  transition: width 620ms var(--ease);
}

.call-time-estimate {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  margin-top: 24px;
  padding: 20px 22px;
  border: 1px solid #d7e5ff;
  border-radius: 14px;
  background: var(--brand-blue-soft);
}

.call-time-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 13px;
  background: #fff;
  color: var(--brand-blue);
}

.call-time-icon svg {
  width: 24px;
  height: 24px;
}

.call-time-estimate p {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 5px 0 0;
}

.call-time-estimate p strong {
  flex-shrink: 0;
  color: var(--brand-navy);
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.call-time-estimate p span {
  color: var(--text-muted);
  font-size: 13px;
}

.credit-breakdown {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 34px 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.credit-breakdown > div {
  padding: 26px 12px;
}

.credit-breakdown > div + div {
  border-left: 1px solid var(--line);
  padding-left: 34px;
}

.credit-breakdown dt {
  color: var(--text-muted);
  font-size: 14px;
}

.credit-breakdown dd {
  margin: 6px 0 2px;
  color: var(--brand-navy);
  font-family: var(--font-mono);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.credit-breakdown span {
  color: var(--text-faint);
  font-size: 11px;
}

.credit-footnote {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-top: 26px;
  color: var(--text-muted);
}

.credit-footnote > svg {
  width: 22px;
  height: 22px;
  color: var(--brand-blue);
}

.credit-footnote p {
  margin: 0;
  font-size: 13px;
}

.credit-footnote strong {
  display: block;
  color: var(--text);
}

.credit-footnote > span {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 10px;
  white-space: nowrap;
}

.credits-error {
  display: flex;
  min-height: 430px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.credits-error > svg {
  width: 46px;
  height: 46px;
  color: var(--danger);
}

.credits-error h2 {
  margin: 18px 0 0;
  font-size: 24px;
}

.credits-error p {
  margin: 8px 0 0;
  color: var(--text-muted);
}

.toast-region {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  display: grid;
  width: min(390px, calc(100vw - 32px));
  gap: 10px;
}

.toast {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 18px;
  border: 1px solid #bedecf;
  border-radius: 13px;
  background: #fff;
  color: #185b43;
  box-shadow: var(--shadow);
  font-size: 14px;
  animation: toast-enter 260ms var(--ease) both;
}

.toast.is-error {
  border-color: #edc0c7;
  color: #9d2c3d;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 180ms var(--ease), transform 180ms var(--ease);
}

.toast button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: currentColor;
  cursor: pointer;
}

.toast button:hover {
  background: rgba(11, 19, 36, 0.05);
}

.toast svg {
  width: 17px;
  height: 17px;
}

@keyframes toast-enter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1160px) {
  .studio-layout,
  .context-layout {
    grid-template-columns: minmax(0, 1fr) 310px;
  }

  .preset-selector {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .sidebar {
    display: none;
  }

  .workspace {
    margin-left: 0;
  }

  .topbar {
    min-height: 64px;
    justify-content: space-between;
    padding: 0 20px;
  }

  .mobile-brand {
    display: flex;
    align-items: center;
  }

  .mobile-brand img {
    width: 116px;
  }

  .mobile-logout {
    display: inline-grid;
  }

  .topbar-context {
    margin-left: auto;
  }

  .topbar-divider,
  #topbarUser {
    display: none;
  }

  .mobile-nav {
    position: sticky;
    top: 64px;
    z-index: 19;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
  }

  .mobile-nav .nav-item {
    grid-template-columns: 20px auto;
    justify-content: center;
    min-height: 44px;
    padding: 0 10px;
    font-size: 13px;
  }

  .mobile-nav .nav-item i,
  .mobile-nav .nav-item::before {
    display: none;
  }

  .main-content {
    padding-top: 34px;
  }
}

@media (max-width: 820px) {
  .login-view {
    padding: 20px;
  }

  .login-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .login-brand {
    min-height: 390px;
    padding: 42px;
  }

  .login-fred {
    right: -40px;
    bottom: -54px;
    width: 290px;
    height: 430px;
    opacity: 0.16;
  }

  .login-statement {
    padding: 54px 0;
  }

  .login-statement h1 {
    max-width: 14ch;
    font-size: 46px;
  }

  .login-panel {
    padding: 46px 42px;
  }

  .studio-layout,
  .context-layout {
    grid-template-columns: 1fr;
  }

  .studio-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .context-explainer {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 0 28px;
  }

  .context-orbit {
    grid-row: 1 / span 5;
    margin: 0;
  }

  .context-explainer .eyebrow,
  .context-explainer > h2,
  .context-explainer .process-list,
  .context-explainer .next-call-alert,
  .context-explainer .published-at {
    grid-column: 2;
  }
}

@media (max-width: 680px) {
  .topbar-context {
    display: none;
  }

  .main-content {
    padding: 28px 16px 64px;
  }

  .section-heading {
    min-height: auto;
    flex-direction: column;
    gap: 18px;
    padding-bottom: 24px;
  }

  .section-heading h1 {
    font-size: 36px;
  }

  .section-heading > div:first-child > p:last-child {
    font-size: 16px;
  }

  .availability-badge,
  .live-call-note,
  .compact-button {
    margin-top: 0;
  }

  .studio-layout,
  .context-layout {
    padding-top: 24px;
  }

  .production-console,
  .context-form,
  .context-explainer,
  .knowledge-manager,
  .credits-console {
    padding: 22px;
    border-radius: 18px;
  }

  .production-console textarea {
    min-height: 250px;
  }

  .preset-selector {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-action-row {
    align-items: stretch;
    flex-direction: column;
  }

  .form-action-row .primary-button {
    width: 100%;
  }

  .studio-rail {
    grid-template-columns: 1fr;
  }

  .context-state-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .context-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .context-actions .primary-button,
  .context-actions .secondary-button {
    width: 100%;
  }

  .context-explainer {
    display: block;
  }

  .knowledge-heading {
    align-items: flex-start;
  }

  .knowledge-list,
  .knowledge-skeleton {
    grid-template-columns: 1fr;
  }

  .knowledge-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .knowledge-actions .primary-button {
    width: 100%;
  }

  .context-orbit {
    margin: 0 0 24px auto;
  }

  .balance-stage {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .billing-strip__top {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .balance-gauge {
    width: 128px;
    height: 128px;
  }

  .credit-footnote {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .credit-footnote > span {
    grid-column: 2;
  }
}

@media (max-width: 480px) {
  .login-view {
    padding: 0;
  }

  .login-shell {
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .login-brand {
    min-height: 340px;
    padding: 32px 24px;
  }

  .brand-lockup--large .brand-logo {
    width: 178px;
  }

  .login-statement {
    padding: 42px 0;
  }

  .login-statement h1 {
    font-size: 38px;
  }

  .login-statement > p:last-child {
    margin-top: 18px;
    font-size: 16px;
  }

  .login-panel {
    padding: 38px 24px 44px;
  }

  .login-panel__head h2 {
    font-size: 28px;
  }

  .mobile-brand img {
    width: 96px;
  }

  .mobile-nav {
    padding-inline: 8px;
  }

  .mobile-nav .nav-item {
    gap: 6px;
    padding-inline: 6px;
    font-size: 11px;
  }

  .mobile-nav .nav-item svg {
    width: 18px;
    height: 18px;
  }

  .section-heading h1 {
    font-size: 32px;
  }

  .production-console,
  .context-form,
  .context-explainer,
  .knowledge-manager,
  .credits-console {
    padding: 18px;
  }

  .knowledge-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
  }

  .knowledge-heading h2 {
    font-size: 25px;
  }

  .knowledge-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    border-radius: 18px;
  }

  .knowledge-dialog__shell {
    max-height: calc(100dvh - 20px);
  }

  .knowledge-dialog__header,
  .knowledge-dialog__body {
    padding: 20px;
  }

  .knowledge-dialog__footer {
    align-items: stretch;
    flex-direction: column;
    padding: 14px 20px 18px;
  }

  .knowledge-dialog__footer .secondary-button {
    width: 100%;
  }

  .knowledge-heading > div:first-child > p:last-child {
    grid-column: 1 / -1;
  }

  .billing-strip__top,
  .billing-cycle {
    padding-inline: 18px;
  }

  .billing-entitlements {
    grid-template-columns: 1fr;
  }

  .billing-entitlements span:first-child {
    grid-column: auto;
  }

  .billing-cycle__heading,
  .billing-cycle__meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .billing-cycle__meta strong {
    line-height: 1.35;
  }

  .knowledge-count {
    min-width: 70px;
    padding: 10px 12px;
  }

  .preset-selector {
    grid-template-columns: 1fr;
  }

  .preset-option > span {
    min-height: 64px;
  }

  .label-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .live-call-note {
    width: 100%;
  }

  .balance-value {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .balance-value strong {
    font-size: 48px;
  }

  .credit-breakdown {
    grid-template-columns: 1fr;
  }

  .credit-breakdown > div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
    padding-left: 12px;
  }

  .toast-region {
    right: 16px;
    bottom: 16px;
  }
}

@media (max-height: 760px) and (min-width: 1081px) {
  .sidebar-fred {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@container production-console (max-width: 680px) {
  .preset-selector {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .preset-option {
    grid-column: span 2;
  }

  .preset-option:nth-child(n + 4) {
    grid-column: span 3;
  }
}

@container production-console (max-width: 430px) {
  .preset-selector {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .preset-option,
  .preset-option:nth-child(n + 4) {
    grid-column: span 1;
  }

  .preset-option:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}
