:root {
  color-scheme: light;
  --ink: #191d18;
  --muted: #687066;
  --paper: #f3f1e9;
  --panel: #fbfaf5;
  --line: #d9d7cc;
  --lime: #dff36d;
  --lime-dark: #526014;
  --green: #1f5a42;
  --cyra-green: #155b46;
  --cyra-green-soft: #eaf4ee;
  --cyra-blue: #3f678d;
  --cyra-blue-soft: #edf3f8;
  --cyra-amber: #956a1f;
  --cyra-amber-soft: #fbf3df;
  --cyra-violet: #70558f;
  --cyra-violet-soft: #f2edf7;
  --cyra-terracotta: #9b5244;
  --cyra-terracotta-soft: #f8ece8;
  --cyra-sage: #71806f;
  --cyra-sage-soft: #eef2e9;
  --shadow: 0 18px 60px rgba(28, 33, 27, 0.1);
  --topbar-control-height: 44px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  touch-action: pan-y;
  color: var(--ink);
  background: var(--paper);
}

.legal-page {
  background: var(--panel);
}

.legal-page main {
  width: min(760px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 48px 0 80px;
}

.legal-page .brand {
  margin-bottom: 56px;
}

.legal-page h1 {
  margin-bottom: 28px;
}

.legal-page h2 {
  margin-top: 32px;
}

.legal-page p,
.legal-page li {
  color: var(--muted);
  line-height: 1.7;
}

.legal-page a {
  color: var(--green);
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto minmax(240px, 1fr);
  align-items: center;
  gap: 20px;
  padding: calc(20px + env(safe-area-inset-top)) 24px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(243, 241, 233, 0.94);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  color: inherit;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: auto;
  height: clamp(38px, 3.8vw, 52px);
  max-width: min(250px, 30vw);
  object-fit: contain;
}

.brand strong,
.brand small {
  display: block;
}

.brand-logo + span strong {
  display: none;
}

.brand small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.72rem;
}

.session-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.83rem;
}

.is-listening .session-meta {
  color: #a03223;
  font-weight: 800;
}

.consent-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #aeb3ab;
}

.consent-dot.active {
  background: #e14e37;
  box-shadow: 0 0 0 5px rgba(225, 78, 55, 0.13);
}

.header-actions,
.session-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.header-button,
.icon-button,
.primary-button,
.ask-button,
.listen-button,
#sendQuestion {
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--panel);
  font-weight: 700;
}

.header-button {
  padding: 9px 12px;
  font-size: 0.78rem;
}

.account-button {
  display: grid;
  gap: 1px;
  text-align: left;
}

.account-button small {
  color: var(--muted);
  font-size: 0.61rem;
  font-weight: 600;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0 10px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.auth-divider::before,
.auth-divider::after {
  flex: 1;
  height: 1px;
  content: "";
  background: var(--line);
}

.apple-sign-in-button {
  width: 100%;
  min-height: 48px;
  padding: 12px 18px;
  border: 1px solid #000;
  border-radius: 10px;
  color: #fff;
  background: #000;
  font: inherit;
  font-weight: 700;
}

.apple-setup-note {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
  text-align: center;
  overflow-wrap: anywhere;
}

.apple-auth-panel {
  display: grid;
  gap: 6px;
}

.header-button:hover,
.icon-button:hover {
  background: #fff;
  border-color: #bdbdb3;
}

.primary-button {
  padding: 12px 18px;
  border-color: var(--ink);
  color: #f8f8ed;
  background: var(--ink);
}

.primary-button.compact {
  padding: 9px 13px;
  font-size: 0.78rem;
}

.topbar .header-actions > .header-button,
.topbar .header-actions > .primary-button.compact,
.topbar .header-actions > .icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--topbar-control-height);
  min-height: var(--topbar-control-height);
}

.topbar .header-actions > .account-button {
  align-items: flex-start;
  flex-direction: column;
}

.icon-button {
  min-width: 38px;
  min-height: 38px;
  padding: 6px 10px;
  font-size: 1.1rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, clamp(340px, 28vw, 440px));
  height: calc(100vh - 68px);
  min-height: 620px;
  overflow: hidden;
}

.cyranote-panel,
.conversation-panel {
  padding: clamp(22px, 3vw, 44px);
  min-height: 0;
}

.cyranote-panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}

.conversation-panel {
  display: flex;
  flex-direction: column;
  background: rgba(251, 250, 245, 0.65);
}

.cyranote-heading,
.panel-heading,
.section-heading,
.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.dialog-heading small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
}

.panel-heading > div {
  min-width: 0;
}

.conversation-panel .panel-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.panel-heading h2 {
  white-space: nowrap;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 660px;
  margin-bottom: 22px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.7rem);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: 0;
}

#activeSessionTitle {
  font-size: clamp(2rem, 3.1vw, 2.5rem);
  white-space: nowrap;
}

.compact-transcript-button,
.transcript-restore-rail,
.rail-listen-button,
.mobile-session-state,
.mobile-top-action,
.mobile-supporting-line,
.mobile-tabbar {
  display: none;
}

h2 {
  margin-bottom: 6px;
  font-size: 1.35rem;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.05rem;
  letter-spacing: 0;
}

.eyebrow,
.card-tag {
  margin-bottom: 7px;
  color: var(--green);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.card-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.card-tag-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.status-pill,
.mcp-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 9px;
  border-radius: 999px;
  border: 1px solid rgba(31, 90, 66, 0.18);
  color: var(--green);
  background: rgba(251, 250, 245, 0.82);
  font-size: 0.7rem;
  font-weight: 800;
}

.prompt-card {
  margin: 4px 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(28, 33, 27, 0.05);
}

.prompt-card label {
  display: block;
  margin: 0 0 4px 2px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.prompt-hint {
  display: block;
  margin: 0 0 10px 2px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.35;
}

.prompt-row {
  display: flex;
  gap: 9px;
}

.prompt-row input {
  width: 100%;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  background: #fff;
}

.prompt-row input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 90, 66, 0.12);
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 2px 0 12px;
  padding-bottom: 4px;
}

.quick-actions button {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--cyra-green);
  background: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.quick-actions button:disabled {
  cursor: wait;
  opacity: 0.66;
}

.quick-actions button.premium-locked,
.quick-actions button.premium-locked[data-action-tone],
.instant-response-button.premium-locked {
  border-color: rgba(104, 112, 102, 0.2);
  color: var(--muted);
  background: rgba(251, 250, 245, 0.7);
  opacity: 0.62;
}

.quick-actions button.premium-locked::before,
.instant-response-button.premium-locked::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 7px;
  margin-right: 7px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  box-shadow: 0 -4px 0 -2px currentColor;
  opacity: 0.8;
  vertical-align: 0;
}

.quick-actions button[data-action-tone="talking"] {
  border-color: rgba(21, 91, 70, 0.22);
  color: var(--cyra-green);
  background: var(--cyra-green-soft);
}

.quick-actions button[data-action-tone="verify"] {
  border-color: rgba(63, 103, 141, 0.22);
  color: var(--cyra-blue);
  background: var(--cyra-blue-soft);
}

.quick-actions button[data-action-tone="clarify"] {
  border-color: rgba(149, 106, 31, 0.24);
  color: var(--cyra-amber);
  background: var(--cyra-amber-soft);
}

.quick-actions button[data-action-tone="summary"] {
  border-color: rgba(112, 85, 143, 0.22);
  color: var(--cyra-violet);
  background: var(--cyra-violet-soft);
}

#sendQuestion {
  width: 48px;
  border-color: var(--ink);
  color: #fff;
  background: var(--ink);
  font-size: 1.25rem;
}

.console-stream {
  position: relative;
  min-height: 0;
}

.response-console {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  margin-bottom: 14px;
  overflow: hidden;
}

.response-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.response-heading h2 {
  margin: 2px 0 0;
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  line-height: 1.05;
}

.ai-guidance-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ai-guidance-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  border-radius: 999px;
  color: var(--cyra-green);
  background: var(--cyra-green-soft);
  font-size: 0.76rem;
  line-height: 1;
  letter-spacing: 0;
}

.response-heading small {
  max-width: 240px;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: right;
}

.response-heading-tools {
  display: grid;
  justify-items: end;
  gap: 7px;
}

.guidance-interval-button {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid rgba(31, 90, 66, 0.2);
  border-radius: 999px;
  color: var(--green);
  background: var(--cyra-green-soft);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 800;
  cursor: pointer;
}

.guidance-interval-button.premium-opportunity::after {
  content: "Pro";
  margin-left: 7px;
  padding: 2px 6px;
  border-radius: 999px;
  color: #fff;
  background: var(--green);
  font-size: 0.58rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.guidance-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(31, 90, 66, 0.18);
  border-radius: 14px;
  background: rgba(236, 243, 210, 0.72);
  color: var(--green);
  font-size: 0.82rem;
}

.guidance-status-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.guidance-status[hidden] {
  display: none;
}

.guidance-status strong {
  color: var(--ink);
  font-family: var(--display);
  font-size: 0.88rem;
}

.instant-response-button {
  flex: 0 0 auto;
  border-color: rgba(31, 90, 66, 0.28);
  color: var(--green);
  background: #fffef8;
}

.instant-response-button:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.62;
}

.setting-warning {
  color: #8a4d0f;
  font-weight: 700;
}

.insight-feed {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  grid-auto-rows: max-content;
  gap: 16px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 4px 28px 0;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

.insight-card {
  display: block;
  height: auto;
  min-height: 118px;
  padding: 19px 18px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 12px;
  background: var(--panel);
  overflow: visible;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.insight-card.new-card:not(.notice-card) {
  animation: insight-enter 210ms ease-out both, insight-border-glow 760ms ease-out 120ms both;
}

.insight-card.pending-card {
  background: linear-gradient(90deg, rgba(234, 244, 238, 0.86), var(--panel) 36%);
}

.insight-card.pending-card h3::after {
  content: "...";
  display: inline-block;
  width: 1.2em;
  margin-left: 0.15em;
  overflow: hidden;
  vertical-align: bottom;
  animation: thinking-dots 1.1s steps(4, end) infinite;
}

.insight-card.notice-card {
  min-height: 0;
  padding: 14px 16px;
  border-left-width: 3px;
  background: rgba(251, 250, 245, 0.72);
}

.insight-card.notice-card h3 {
  font-size: 1rem;
}

.insight-card.notice-card p:not(.card-tag) {
  font-size: 0.88rem;
}

@keyframes insight-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes insight-border-glow {
  0% {
    box-shadow: inset 4px 0 0 rgba(31, 90, 66, 0.22), 0 0 0 rgba(31, 90, 66, 0);
  }
  38% {
    box-shadow: inset 4px 0 0 rgba(31, 90, 66, 0.42), 0 0 0 3px rgba(31, 90, 66, 0.08);
  }
  100% {
    box-shadow: inset 0 0 0 rgba(31, 90, 66, 0), 0 0 0 rgba(31, 90, 66, 0);
  }
}

@keyframes thinking-dots {
  from { width: 0; }
  to { width: 1.2em; }
}

@media (prefers-reduced-motion: reduce) {
  .insight-card.new-card:not(.notice-card),
  .insight-card.pending-card h3::after {
    animation: none;
  }
}

.insight-card.tone-talking {
  border-color: rgba(21, 91, 70, 0.18);
  border-left-color: var(--cyra-green);
  background: linear-gradient(90deg, var(--cyra-green-soft), var(--panel) 28%);
}

.insight-card.tone-verify {
  border-color: rgba(63, 103, 141, 0.2);
  border-left-color: var(--cyra-blue);
  background: linear-gradient(90deg, var(--cyra-blue-soft), var(--panel) 28%);
}

.insight-card.tone-clarify {
  border-color: rgba(149, 106, 31, 0.21);
  border-left-color: var(--cyra-amber);
  background: linear-gradient(90deg, var(--cyra-amber-soft), var(--panel) 28%);
}

.insight-card.tone-next,
.insight-card.tone-summary {
  border-color: rgba(112, 85, 143, 0.2);
  border-left-color: var(--cyra-violet);
  background: linear-gradient(90deg, var(--cyra-violet-soft), var(--panel) 28%);
}

.insight-card.tone-warning {
  border-color: rgba(155, 82, 68, 0.22);
  border-left-color: var(--cyra-terracotta);
  background: linear-gradient(90deg, var(--cyra-terracotta-soft), var(--panel) 28%);
}

.insight-card.tone-context {
  border-color: rgba(113, 128, 111, 0.18);
  border-left-color: var(--cyra-sage);
  background: linear-gradient(90deg, var(--cyra-sage-soft), var(--panel) 28%);
}

.insight-card.tone-talking .card-tag { color: var(--cyra-green); }
.insight-card.tone-verify .card-tag { color: var(--cyra-blue); }
.insight-card.tone-clarify .card-tag { color: var(--cyra-amber); }
.insight-card.tone-next .card-tag,
.insight-card.tone-summary .card-tag { color: var(--cyra-violet); }
.insight-card.tone-warning .card-tag { color: var(--cyra-terracotta); }
.insight-card.tone-context .card-tag { color: var(--cyra-sage); }

.insight-card p:not(.card-tag) {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.62;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.insight-card h3 {
  margin: 10px 0 8px;
  overflow-wrap: anywhere;
  word-break: normal;
}

.insight-bullets {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.45;
}

.insight-bullets li {
  padding-left: 2px;
}

.suggested-question {
  margin-top: 15px;
  padding: 10px 12px;
  border-left: 3px solid var(--green);
  background: rgba(31, 90, 66, 0.06);
  color: var(--green) !important;
  font-weight: 800;
  line-height: 1.45 !important;
}

.suggested-question-label {
  display: block;
  margin-bottom: 4px;
  color: inherit;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1.2;
  text-transform: uppercase;
}

.insight-detail {
  margin-top: 12px;
}

.insight-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.insight-card.accent-card {
  color: var(--ink);
}

.insight-card.accent-card .card-tag {
  color: inherit;
}

.insight-card.accent-card p:not(.card-tag) {
  color: var(--muted);
}

.insight-card.accent-card .insight-bullets {
  color: var(--ink);
}

.insight-card.accent-card .suggested-question {
  border-left-color: currentColor;
  background: rgba(31, 90, 66, 0.07);
  color: var(--green) !important;
}

.event-meta {
  margin: -1px 0 10px 24px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
}

.insight-card.accent-card .event-meta {
  color: var(--muted);
}

.insight-card.accent-card.tone-talking .card-tag { color: var(--cyra-green); }
.insight-card.accent-card.tone-verify .card-tag { color: var(--cyra-blue); }
.insight-card.accent-card.tone-clarify .card-tag { color: var(--cyra-amber); }
.insight-card.accent-card.tone-next .card-tag,
.insight-card.accent-card.tone-summary .card-tag { color: var(--cyra-violet); }
.insight-card.accent-card.tone-warning .card-tag { color: var(--cyra-terracotta); }
.insight-card.accent-card.tone-context .card-tag { color: var(--cyra-sage); }

.source-link {
  display: inline-block;
  margin-top: 12px;
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 800;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.language-pair {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.panel-tools {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.transcript-visibility-button,
.notes-control-button {
  padding: 8px 10px;
  font-size: 0.68rem;
  white-space: nowrap;
}

.language-pair.disabled,
.disabled-setting {
  opacity: 0.55;
}

.swap {
  font-size: 1rem;
}

.grounding-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-top: 17px;
  padding: 11px 0 14px;
  border-bottom: 1px solid var(--line);
}

.grounding-strip p,
.grounding-strip strong {
  margin-bottom: 0;
}

.grounding-strip strong {
  font-size: 0.8rem;
}

.transcript-console {
  flex: 1;
  overflow: hidden;
}

.transcript {
  height: 100%;
  min-height: 180px;
  overflow-y: auto;
  padding: 18px 3px 12px;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

.transcript-empty {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.transcript-line {
  padding: 0 0 17px 13px;
  border-left: 2px solid var(--line);
}

.transcript-meta {
  display: block;
  margin-bottom: 6px;
  color: #8f968c;
}

.transcript-line .speaker {
  color: var(--green);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.transcript-line p {
  margin: 5px 0 0;
  font-size: 0.88rem;
  line-height: 1.5;
}

.transcript-line .translation {
  color: var(--muted);
  font-style: italic;
}

.transcript-line .translation.pending {
  opacity: 0.75;
}

.transcript-line .translation.error {
  color: #9f3425;
}

.listening-bar {
  display: grid;
  grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr);
  align-items: center;
  gap: 10px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.listening-bar .ask-button {
  justify-self: end;
}

.listen-button,
.ask-button {
  padding: 11px 13px;
}

.listen-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-color: var(--ink);
  color: #fff;
  background: var(--ink);
  font-size: 0.77rem;
}

.listen-button.active {
  border-color: #a03223;
  background: #c3412e;
}

.listen-icon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.ask-button {
  font-size: 0.77rem;
}

.wave {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 30px;
}

.is-listening .wave {
  display: flex;
}

.wave i {
  width: 2px;
  height: 6px;
  border-radius: 99px;
  background: #a7ada4;
}

.wave.active i {
  background: var(--green);
  animation: wave 0.75s ease-in-out infinite alternate;
}

.wave.active i:nth-child(2n) {
  animation-delay: 0.2s;
}

.wave.active i:nth-child(3n) {
  animation-delay: 0.4s;
}

@keyframes wave {
  to {
    height: 25px;
  }
}

.mic-status,
.connection-status {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.4;
}

.is-listening .mic-status {
  color: #a03223;
  font-weight: 800;
}

.connection-status {
  margin-top: 3px;
}

.connection-status.error {
  color: #9f3425;
  font-weight: 800;
}

.latest-button {
  position: absolute;
  z-index: 2;
  right: 12px;
  bottom: 12px;
  padding: 8px 11px;
  border: 1px solid #b7c45f;
  border-radius: 999px;
  color: var(--lime-dark);
  background: rgba(245, 247, 223, 0.96);
  box-shadow: 0 8px 22px rgba(28, 33, 27, 0.15);
  font-size: 0.7rem;
  font-weight: 800;
}

.latest-button:hover {
  background: #fff;
}

dialog {
  width: min(480px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  max-height: calc(100vh - 28px);
  overflow: hidden;
  overflow-x: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: var(--shadow);
}

dialog[open] {
  display: flex;
  flex-direction: column;
}

dialog.wide-dialog {
  width: min(620px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
}

dialog::backdrop {
  background: rgba(20, 24, 19, 0.5);
  backdrop-filter: blur(5px);
}

dialog form {
  display: grid;
  gap: 17px;
  max-height: calc(100vh - 28px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 23px;
}

.dialog-shell {
  display: grid;
  gap: 20px;
  width: 100%;
  min-width: 0;
  max-height: calc(100vh - 28px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  padding: 23px;
}

.dialog-shell > *,
dialog form > * {
  min-width: 0;
}

dialog label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

dialog input:not([type="checkbox"]),
dialog select,
dialog textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
}

dialog textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.45;
}

dialog textarea[readonly] {
  color: #485048;
  background: #f1f2e8;
}

dialog option:disabled {
  color: #a9aca4;
}

dialog label > small {
  color: var(--muted);
  font-weight: 500;
  line-height: 1.45;
}

.assistant-lock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.assistant-lock div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.assistant-lock span {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
}

.assistant-lock strong {
  overflow-wrap: anywhere;
}

.upload-zone {
  padding: 20px;
  border: 1px dashed #b6b9ad;
  border-radius: 13px;
  background: #f4f4eb;
}

#sessionDialog {
  width: min(680px, calc(100vw - 28px));
}

#accountDialog {
  width: min(860px, calc(100vw - 28px));
}

.upgrade-dialog,
.purchase-dialog {
  width: min(440px, calc(100vw - 28px));
}

.upgrade-dialog .dialog-shell,
.purchase-dialog .dialog-shell {
  gap: 16px;
}

.upgrade-dialog p,
.purchase-dialog p {
  margin: 0;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.5;
}

.upgrade-balance {
  padding: 12px 14px;
  border: 1px solid rgba(31, 90, 66, 0.18);
  border-radius: 12px;
  background: var(--cyra-green-soft);
  color: var(--green) !important;
}

.unlock-actions {
  grid-template-columns: 1fr;
  gap: 9px;
}

.unlock-actions .primary-button,
.unlock-actions .header-button {
  justify-content: center;
  min-height: 44px;
}

.purchase-steps {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.purchase-steps li {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
}

.purchase-steps li::before {
  content: "";
  width: 10px;
  height: 10px;
  border: 2px solid rgba(31, 90, 66, 0.22);
  border-radius: 50%;
  background: var(--paper);
}

.purchase-steps li.active::before,
.is-busy::after {
  border-color: rgba(31, 90, 66, 0.25);
  border-top-color: var(--green);
  animation: cyra-spin 0.8s linear infinite;
}

.purchase-steps li.complete {
  color: var(--ink);
}

.purchase-steps li.complete::before {
  border-color: var(--green);
  background: var(--green);
  box-shadow: inset 0 0 0 3px var(--paper);
}

.purchase-result {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(31, 90, 66, 0.16);
  border-radius: 14px;
  background: var(--cyra-green-soft);
}

.purchase-result.error {
  border-color: rgba(155, 82, 68, 0.24);
  background: var(--cyra-terracotta-soft);
}

.purchase-result strong {
  color: var(--green);
  font-size: 1.05rem;
}

.purchase-result.error strong {
  color: var(--cyra-terracotta);
}

.purchase-result ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
}

.support-fallback {
  padding: 10px 12px;
  border-radius: 12px;
  background: #f7f5eb;
  overflow-wrap: anywhere;
}

.is-busy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.is-busy::after {
  content: "";
  width: 13px;
  height: 13px;
  border-width: 2px;
  border-style: solid;
  border-radius: 50%;
}

.purchase-emphasis {
  outline: 2px solid rgba(31, 90, 66, 0.22);
  outline-offset: 8px;
}

@keyframes cyra-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .purchase-steps li.active::before,
  .is-busy::after {
    animation: none;
  }
}

#settingsDialog {
  width: min(760px, calc(100vw - 28px));
}

#sessionForm {
  gap: 15px;
  padding-bottom: 0;
}

#sessionForm .dialog-heading {
  position: sticky;
  z-index: 3;
  top: -23px;
  margin: -23px -23px 0;
  padding: 23px 23px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfaf5;
}

.talking-points-editor,
.advanced-setup,
.reference-material,
.ai-instructions-card {
  display: grid;
  gap: 11px;
  min-width: 0;
}

.talking-points-editor,
.advanced-setup {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}

.talking-points-editor strong,
.reference-material strong,
.ai-instructions-card strong {
  display: block;
  margin-bottom: 3px;
  font-size: 0.86rem;
}

.talking-points-editor small,
.reference-material small,
.ai-instructions-card small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.4;
}

.talking-point-rows {
  display: grid;
  gap: 8px;
}

.talking-point-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
}

.talking-point-row input {
  min-height: 44px;
}

.talking-point-row .icon-button {
  min-width: 44px;
  min-height: 44px;
}

.advanced-setup {
  display: block;
  padding: 0;
  overflow: visible;
}

.advanced-setup summary {
  display: grid;
  gap: 3px;
  min-height: 52px;
  padding: 14px;
  cursor: pointer;
  list-style: none;
}

.advanced-setup summary::-webkit-details-marker {
  display: none;
}

.advanced-setup summary span {
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 800;
}

.advanced-setup summary small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.35;
}

.advanced-setup-body {
  display: grid;
  gap: 14px;
  padding: 0 14px 14px;
}

.ai-instructions-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f6f5ee;
}

.system-prompt-field[hidden] {
  display: none;
}

.reference-material {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  padding: 12px;
  border: 1px dashed #b6b9ad;
  border-radius: 13px;
  background: #f4f4eb;
}

.reference-material > div,
.reference-material .document-list {
  grid-column: 1 / -1;
}

.reference-material .upload-button {
  justify-content: center;
  min-height: 40px;
}

.consent-warning {
  margin: -6px 0 0;
  color: #9f3425;
  font-size: 0.74rem;
  font-weight: 800;
}

.session-start-actions {
  position: sticky;
  z-index: 3;
  bottom: 0;
  display: grid;
  margin: 0 -23px;
  padding: 14px 23px 23px;
  border-top: 1px solid var(--line);
  background: #fbfaf5;
}

.session-start-actions .primary-button {
  min-height: 48px;
}

.settings-form {
  gap: 16px;
}

.settings-section {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.settings-grid-wide {
  grid-column: 1 / -1;
}

.section-heading {
  display: grid;
  gap: 4px;
}

.section-heading h3,
.section-heading p {
  margin: 0;
}

.section-heading small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.45;
}

.voice-enrollment {
  background: #f4f4eb;
}

.diagnostics-panel {
  background: #fff;
}

.diagnostics-panel div {
  display: grid;
  gap: 4px;
}

.diagnostics-panel strong {
  font-size: 0.82rem;
}

.diagnostics-panel small {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.45;
}

.voice-enrollment small,
.voice-enrollment p {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.45;
}

.voice-sample-script {
  display: grid;
  gap: 5px;
  padding: 11px 12px;
  border-left: 3px solid var(--lime-dark);
  border-radius: 0 9px 9px 0;
  background: #fff;
}

.voice-sample-script span {
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.voice-sample-script q {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.95rem;
  line-height: 1.4;
}

.voice-enrollment p {
  margin: 0;
}

.voice-enrollment.recording {
  border-color: #c3412e;
  box-shadow: 0 0 0 3px rgba(195, 65, 46, 0.12);
}

.voice-enrollment.recording p {
  color: #9f3425;
  font-weight: 800;
}

.voice-enrollment.error p {
  color: #9f3425;
}

.voice-enrollment.ready p {
  color: var(--green);
  font-weight: 800;
}

.enrollment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.upload-button {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  cursor: pointer;
}

.upload-button input {
  display: none;
}

.danger-button {
  color: #8b2c20;
}

.upload-zone small,
.toggle-row small {
  font-weight: 500;
}

.document-list {
  display: grid;
  gap: 7px;
}

.document-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--green);
  background: #eaf0dc;
  font-size: 0.69rem;
  font-weight: 700;
}

.document-chip button {
  border: 0;
  color: inherit;
  background: transparent;
  font-size: 0.66rem;
  font-weight: 800;
}

.document-chip.unsupported {
  color: #8b2c20;
  background: #f4e7e2;
}

.toggle-row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.consent-confirmation {
  grid-template-columns: auto 1fr;
  align-items: start;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f1f3df;
}

.consent-confirmation input {
  margin-top: 3px;
}

.consent-confirmation span {
  display: grid;
  gap: 4px;
}

.toggle-row span {
  display: grid;
  gap: 4px;
}

.privacy-note,
.use-boundary {
  padding: 13px;
  border-left: 3px solid var(--lime-dark);
  color: var(--muted);
  background: #f1f3df;
  font-size: 0.75rem;
  line-height: 1.5;
}

.use-boundary {
  display: grid;
  gap: 4px;
  border-left-color: var(--green);
  background: #edf2eb;
}

.use-boundary strong {
  color: var(--ink);
}

.saved-session-list {
  display: grid;
  gap: 9px;
}

.saved-session {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.saved-session div {
  display: grid;
  gap: 5px;
}

.session-library-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1.45;
}

.saved-session-actions {
  display: flex !important;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px !important;
}

.saved-session span,
.empty-message {
  color: var(--muted);
  font-size: 0.72rem;
}

.session-summary-content {
  display: grid;
  gap: 14px;
}

.session-summary-overview {
  margin: 0;
  padding: 16px;
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: #edf2eb;
  color: var(--ink);
  font-weight: 650;
  line-height: 1.55;
}

.session-summary-section {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.session-summary-section h3 {
  margin: 0 0 8px;
}

.session-summary-section ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.45;
}

.session-summary-actions {
  flex-wrap: wrap;
}

.auth-tabs,
.account-actions,
.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.auth-tabs {
  margin-bottom: 16px;
}

.auth-tabs .active {
  border-color: var(--ink);
  color: #fff;
  background: var(--ink);
}

.account-form {
  padding: 0;
}

.account-form > small,
.subscription-disclosure {
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.5;
}

.account-dashboard {
  display: grid;
  gap: 18px;
}

.signed-out-panel {
  display: grid;
  gap: 16px;
}

.apple-auth-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f4f4eb;
}

.apple-auth-panel div {
  display: grid;
  gap: 5px;
}

.apple-auth-panel strong {
  font-size: 1rem;
}

.apple-auth-panel small,
.apple-setup-note {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.45;
}

.auth-divider {
  display: grid;
  align-items: center;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  background: var(--line);
}

.account-summary,
.subscription-heading,
.usage-card > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.account-summary p,
.account-summary strong,
.subscription-heading p,
.subscription-heading h3,
.usage-card strong,
.usage-card span {
  margin: 0;
  overflow-wrap: anywhere;
}

.usage-card {
  display: grid;
  gap: 11px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f4f4eb;
}

.account-usage-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.8fr);
  gap: 12px;
}

.usage-card-primary {
  min-height: 150px;
}

.ai-usage-card {
  align-content: start;
  background: #fff;
}

.usage-card span,
.usage-card small,
.subscription-heading span {
  color: var(--muted);
  font-size: 0.7rem;
}

.ai-remaining-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid #d9dacd;
  border-radius: 10px;
  background: #fff;
}

.ai-remaining-row strong {
  color: var(--green);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.65rem;
  line-height: 1;
  overflow-wrap: normal;
  white-space: nowrap;
}

.ai-remaining-row span {
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 800;
  text-align: right;
}

.usage-card progress {
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: 99px;
  overflow: hidden;
  background: #dedfd5;
}

.usage-card progress::-webkit-progress-bar {
  background: #dedfd5;
}

.usage-card progress::-webkit-progress-value,
.usage-card progress::-moz-progress-bar {
  background: var(--green);
}

.plan-ladder {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.plan-ladder article {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.plan-ladder span {
  color: var(--green);
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.plan-ladder strong {
  font-size: 0.82rem;
  line-height: 1.2;
}

.plan-ladder small {
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.45;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.plan-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}

.plan-card.featured {
  border-color: #b7c45f;
  background: #f5f7df;
}

.plan-card > span {
  color: var(--green);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.plan-card h3 {
  margin: 0;
}

.plan-card > strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
}

.plan-card em {
  color: var(--green);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 800;
  line-height: 1.35;
}

.plan-card strong small {
  color: var(--muted);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 500;
}

.plan-allowance {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid #d9dacd;
  border-radius: 10px;
  background: #fafaf2;
}

.plan-allowance b {
  color: var(--ink);
  font-size: 0.76rem;
  line-height: 1.25;
}

.plan-card .primary-button {
  margin-top: 5px;
}

.topup-grid {
  display: grid;
  gap: 9px;
}

.topup-card {
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #fff;
}

.topup-card strong,
.topup-card span {
  min-width: 0;
}

.topup-card span {
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.4;
}

.topup-card button:disabled {
  opacity: 0.55;
}

.account-message {
  min-height: 18px;
  margin: 2px 0 0;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.account-message.error {
  color: #9f3425;
}

.legal-links {
  margin-top: 6px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.legal-links a {
  color: var(--green);
  font-size: 0.7rem;
  font-weight: 800;
}

.mobile-sheet {
  width: min(420px, calc(100vw - 20px));
}

.mobile-sheet-shell {
  display: grid;
  gap: 16px;
  width: 100%;
  padding: 18px;
}

.mobile-more-actions {
  display: grid;
  gap: 10px;
}

.mobile-more-actions .header-button {
  justify-content: flex-start;
  min-height: 44px;
  text-decoration: none;
}

#mobileTopActionButton {
  display: none;
}

@media (max-width: 1100px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .session-meta {
    display: none;
  }

  .workspace {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - 68px);
    overflow: visible;
  }

  .cyranote-panel {
    border-right: 0;
    border-bottom: 0;
  }

  .response-console {
    flex: none;
    min-height: 0;
    height: auto;
    overflow: visible;
  }

  .transcript-hidden .workspace {
    grid-template-columns: 1fr;
  }

}

@media (min-width: 721px) and (max-width: 1400px) {
  .topbar {
    padding: calc(8px + env(safe-area-inset-top)) 20px 8px;
  }

  .brand-logo {
    height: clamp(46px, 3.8vw, 52px);
    max-width: min(250px, 30vw);
  }

  .cyranote-panel,
  .conversation-panel {
    padding: 24px 32px 18px;
  }

  .cyranote-heading {
    align-items: flex-start;
  }

  h1 {
    margin-bottom: 18px;
    font-size: clamp(2.35rem, 3.8vw, 3.45rem);
  }

  .prompt-card {
    margin-bottom: 18px;
  }

  .response-console {
    gap: 10px;
    margin-bottom: 10px;
  }

  .response-console .insight-feed {
    flex: none;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .insight-feed {
    padding-bottom: 14px;
  }

  .insight-card {
    min-height: 0;
    padding: 17px;
  }

  .conversation-panel {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }

  .panel-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .panel-tools {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .mic-status,
  .connection-status {
    line-height: 1.3;
  }
}

@media (min-width: 1101px) {
  .workspace {
    height: calc(100vh - 68px);
    min-height: 620px;
    overflow: hidden;
  }

  .response-console .insight-feed {
    flex: 1;
    overflow-y: auto;
  }

  .transcript-hidden .workspace {
    grid-template-columns: minmax(0, 1fr) 64px;
  }

  .transcript-hidden .conversation-panel {
    display: none;
  }

  .transcript-hidden .cyranote-panel {
    align-items: stretch;
    border-right: 0;
  }

  .transcript-hidden .cyranote-panel > * {
    width: 100%;
    max-width: 1220px;
    margin-right: auto;
    margin-left: auto;
  }

  .transcript-hidden .response-console {
    min-height: 0;
  }

  .transcript-hidden .response-console .insight-feed {
    max-width: 1180px;
    width: 100%;
  }

  .transcript-hidden .insight-card p:not(.card-tag),
  .transcript-hidden .insight-bullets,
  .transcript-hidden .suggested-question {
    max-width: 920px;
  }

  .transcript-hidden .transcript-restore-rail {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: stretch;
    gap: 12px;
    min-width: 64px;
    height: 100%;
    padding: 14px 8px;
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    color: var(--green);
    background: rgba(251, 250, 245, 0.78);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0;
    writing-mode: horizontal-tb;
    text-orientation: initial;
  }

  .transcript-hidden .rail-restore-button {
    display: inline-flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 48px;
    min-height: 44px;
    border: 1px solid rgba(31, 90, 66, 0.12);
    border-radius: 12px;
    color: var(--green);
    background: rgba(255, 255, 255, 0.62);
    font-size: 0.72rem;
    font-weight: 900;
  }

  .transcript-hidden .rail-restore-button strong {
    margin-top: 0;
    font-size: 0.86rem;
  }

  .transcript-hidden .rail-restore-button span {
    writing-mode: vertical-rl;
    text-orientation: mixed;
  }

  .transcript-hidden .rail-listen-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    min-height: 44px;
    margin-top: 0;
    margin-bottom: clamp(64px, 8vh, 118px);
    border: 1px solid rgba(31, 90, 66, 0.24);
    border-radius: 12px;
    color: #fff;
    background: var(--ink);
    font-size: 0.68rem;
    font-weight: 900;
  }

  .transcript-hidden .rail-listen-button.active {
    border-color: rgba(155, 82, 68, 0.35);
    background: var(--cyra-terracotta);
  }
}

@media (min-width: 721px) and (max-width: 1100px) {
  .workspace {
    display: block;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .cyranote-panel {
    min-height: calc(100dvh - 70px - env(safe-area-inset-top));
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
  }

  .cyranote-heading {
    display: block;
  }

  .cyranote-heading h1 {
    max-width: min(100%, 720px);
    font-size: clamp(2.05rem, 4.6vw, 3rem);
    line-height: 1.05;
    overflow-wrap: normal;
  }

  .session-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-bottom: 18px;
  }

  .compact-transcript-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    margin: -4px 0 18px;
  }

  .conversation-panel {
    display: none;
  }

  .compact-transcript-open .conversation-panel {
    position: fixed;
    z-index: 30;
    top: calc(78px + env(safe-area-inset-top));
    right: 18px;
    bottom: calc(18px + env(safe-area-inset-bottom));
    display: flex;
    width: min(430px, calc(100vw - 36px));
    min-height: 0;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--panel);
    box-shadow: 0 22px 70px rgba(28, 33, 27, 0.24);
    overflow: hidden;
  }

  .compact-transcript-open .conversation-panel .panel-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
  }

  .compact-transcript-open .conversation-panel .panel-tools {
    align-items: flex-end;
    flex-direction: column;
    gap: 8px;
  }

  .compact-transcript-open .conversation-panel .grounding-strip {
    flex: 0 0 auto;
  }

  .compact-transcript-open.transcript-hidden .conversation-panel .grounding-strip,
  .compact-transcript-open.transcript-hidden .conversation-panel .transcript-console {
    display: flex;
  }

  .compact-transcript-open .conversation-panel .transcript-console {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    overflow: hidden;
  }

  .compact-transcript-open .conversation-panel .listening-bar,
  .compact-transcript-open .conversation-panel .mic-status,
  .compact-transcript-open .conversation-panel .connection-status {
    flex: 0 0 auto;
  }

  .compact-transcript-open .conversation-panel .listening-bar {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .compact-transcript-open .conversation-panel .wave {
    display: none;
  }

  .compact-transcript-open.is-listening .conversation-panel .wave {
    display: flex;
  }

  .compact-transcript-open .conversation-panel .listen-button,
  .compact-transcript-open .conversation-panel .ask-button {
    justify-self: stretch;
    justify-content: center;
  }
}

@media (max-width: 720px) {
  body {
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
  }

  dialog,
  dialog.wide-dialog {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 8px);
    right: 10px;
    bottom: calc(env(safe-area-inset-bottom) + 8px);
    left: 10px;
    width: calc(100vw - 20px);
    height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px);
    max-width: none;
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px);
    margin: 0;
    touch-action: pan-y;
  }

  .dialog-shell,
  dialog form {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    max-height: none;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 18px 16px;
  }

  #sessionDialog {
    top: env(safe-area-inset-top);
    right: 0;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: calc(100dvh - env(safe-area-inset-top));
    max-height: calc(100dvh - env(safe-area-inset-top));
    border-radius: 18px 18px 0 0;
  }

  #sessionForm {
    padding: 18px 16px 0;
  }

  #sessionForm .dialog-heading {
    top: -18px;
    margin: -18px -16px 0;
    padding: 18px 16px 12px;
  }

  .ai-instructions-card,
  .reference-material {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .ai-instructions-card .header-button,
  .reference-material .header-button,
  .reference-material .upload-button,
  .advanced-setup .assistant-lock .header-button {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }

  .advanced-setup .assistant-lock {
    display: grid;
    align-items: stretch;
  }

  .session-start-actions {
    margin: 0 -16px;
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  }

  #accountDialog .dialog-heading {
    position: sticky;
    z-index: 2;
    top: -18px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
    padding: 18px 0 12px;
    background: var(--panel);
  }

  #accountDialog .dialog-heading h2 {
    font-size: clamp(1.35rem, 8vw, 2.1rem);
    line-height: 0.98;
    overflow-wrap: anywhere;
  }

  #accountDialog .dialog-heading .eyebrow {
    overflow-wrap: anywhere;
  }

  .topbar {
    position: sticky;
    grid-template-columns: minmax(0, auto) minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    padding: calc(9px + env(safe-area-inset-top)) 12px 9px;
  }

  .brand {
    min-width: 0;
    gap: 6px;
  }

  .brand-logo {
    height: 44px;
    max-width: min(150px, 40vw);
  }

  .brand strong {
    font-size: 0.95rem;
  }

  .brand small {
    display: none;
  }

  .header-actions {
    justify-content: flex-end;
    gap: 4px;
    min-width: 0;
    overflow: visible;
  }

  #savedSessionsButton,
  #accountButton,
  #startSessionButton,
  #settingsButton {
    display: none;
  }

  .mobile-session-state {
    display: grid;
    min-width: 0;
    margin-right: 6px;
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 1.15;
    text-align: right;
  }

  .mobile-session-state strong {
    color: var(--ink);
    font-size: 0.74rem;
  }

  #mobileTopActionButton.mobile-top-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 62px;
    min-height: 44px;
    padding: 10px 13px;
    border-radius: 11px;
    font-size: 0.76rem;
  }

  .is-listening .mobile-session-state {
    color: #a03223;
  }

  .is-listening #mobileTopActionButton.mobile-top-action {
    border-color: #a03223;
    color: #fff;
    background: #c3412e;
    box-shadow: 0 0 0 4px rgba(195, 65, 46, 0.12);
  }

  .icon-button {
    flex: 0 0 auto;
    min-width: 44px;
    min-height: 44px;
    padding: 5px 8px;
    font-size: 0.95rem;
  }

  .cyranote-panel,
  .conversation-panel {
    padding: 18px 16px;
  }

  .workspace {
    display: block;
    min-height: 0;
  }

  body:not(.mobile-view-transcript) .conversation-panel {
    display: none;
  }

  .mobile-view-transcript .cyranote-panel {
    display: none;
  }

  .mobile-view-transcript .conversation-panel {
    display: flex;
    min-height: calc(100dvh - 132px - env(safe-area-inset-bottom));
    padding-bottom: calc(94px + env(safe-area-inset-bottom));
    border-top: 0;
  }

  .mobile-view-transcript.transcript-hidden .conversation-panel .panel-heading {
    display: block;
  }

  .mobile-view-transcript.transcript-hidden .conversation-panel .grounding-strip,
  .mobile-view-transcript.transcript-hidden .conversation-panel .transcript-console {
    display: flex;
  }

  .mobile-view-transcript.transcript-hidden .conversation-panel .transcript-console {
    flex: 1 1 auto;
  }

  .cyranote-heading,
  .panel-heading {
    display: block;
  }

  .session-actions {
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    margin-bottom: 18px;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .session-actions::-webkit-scrollbar {
    display: none;
  }

  .session-actions .header-button,
  .session-actions .status-pill {
    flex: 0 0 auto;
    min-height: 36px;
  }

  h1 {
    max-width: 11ch;
    margin-bottom: 10px;
    font-size: clamp(2.05rem, 12vw, 2.95rem);
    line-height: 1.02;
  }

  #activeSessionTitle {
    max-width: 100%;
    font-size: clamp(1.58rem, 7.4vw, 2.75rem);
    line-height: 1.02;
    white-space: nowrap;
  }

  .mobile-supporting-line {
    display: block;
    max-width: 34rem;
    margin: -4px 0 16px;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.48;
  }

  .prompt-card {
    margin-bottom: 12px;
    padding: 13px;
  }

  .prompt-row {
    gap: 8px;
  }

  .prompt-row input {
    min-height: 48px;
    padding: 12px 14px;
    font-size: 1rem;
  }

  #sendQuestion {
    flex: 0 0 48px;
    width: 48px;
    min-height: 48px;
  }

  .quick-actions {
    display: flex;
    gap: 8px;
    margin: 0 -16px 18px;
    padding: 0 16px 4px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .quick-actions::-webkit-scrollbar {
    display: none;
  }

  .quick-actions button {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 9px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--green);
    background: #fff;
    font-size: 0.73rem;
    font-weight: 800;
    white-space: nowrap;
  }

  .quick-actions button[data-action-tone="talking"] {
    border-color: rgba(21, 91, 70, 0.22);
    color: var(--cyra-green);
    background: var(--cyra-green-soft);
  }

  .quick-actions button[data-action-tone="verify"] {
    border-color: rgba(63, 103, 141, 0.22);
    color: var(--cyra-blue);
    background: var(--cyra-blue-soft);
  }

  .quick-actions button[data-action-tone="clarify"] {
    border-color: rgba(149, 106, 31, 0.24);
    color: var(--cyra-amber);
    background: var(--cyra-amber-soft);
  }

  .quick-actions button[data-action-tone="summary"] {
    border-color: rgba(112, 85, 143, 0.22);
    color: var(--cyra-violet);
    background: var(--cyra-violet-soft);
  }

  .insight-feed {
    grid-template-columns: 1fr;
  }

  .response-heading {
    display: block;
  }

  .response-heading small {
    display: block;
    max-width: none;
    margin-top: 6px;
    text-align: left;
  }

  .response-heading-tools {
    justify-items: start;
  }

  .guidance-interval-button {
    margin-top: 2px;
  }

  .saved-session {
    align-items: flex-start;
    flex-direction: column;
  }

  .saved-session-actions {
    justify-content: flex-start;
  }

  .guidance-status {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .guidance-status-copy {
    flex: 1 1 190px;
  }

  .instant-response-button {
    flex: 1 1 130px;
    min-height: 36px;
    white-space: normal;
  }

  .response-console,
  .transcript-console {
    min-height: 0;
    height: auto;
  }

  .response-console {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .response-console .insight-feed {
    flex: none;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .insight-card {
    min-height: 0;
    padding: 16px;
  }

  .insight-card h3 {
    font-size: clamp(1.12rem, 6.4vw, 1.45rem);
    line-height: 1.16;
    overflow-wrap: anywhere;
  }

  .insight-card p:not(.card-tag) {
    font-size: 1rem;
    line-height: 1.62;
  }

  .settings-grid,
  .account-usage-grid,
  .plan-ladder,
  .plan-grid {
    grid-template-columns: 1fr;
  }

  .plan-card,
  .topup-card {
    min-width: 0;
  }

  .plan-card > strong {
    font-size: clamp(1.3rem, 9vw, 2rem);
    overflow-wrap: anywhere;
  }

  .plan-card .primary-button,
  .account-actions .header-button {
    width: 100%;
    min-width: 0;
    white-space: normal;
  }

  .topup-card {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .account-summary,
  .subscription-heading,
  .usage-card > div {
    align-items: flex-start;
  }

  .language-pair {
    margin-top: 0;
  }

  .mobile-view-transcript .panel-heading {
    display: grid;
    gap: 12px;
  }

  .mobile-view-transcript .panel-tools {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    margin: 0 -16px;
    padding: 0 16px 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .mobile-view-transcript .panel-tools::-webkit-scrollbar {
    display: none;
  }

  .mobile-view-transcript .transcript-visibility-button {
    display: none;
  }

  .mobile-view-transcript .language-pair,
  .mobile-view-transcript .notes-control-button {
    flex: 0 0 auto;
    min-height: 44px;
  }

  .listening-bar {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .transcript-hidden .listening-bar {
    width: 100%;
    max-width: none;
    justify-items: stretch;
  }

  .wave {
    display: none;
  }

  .listening-bar .listen-button,
  .listening-bar .ask-button {
    min-height: 44px;
    justify-self: stretch;
    justify-content: center;
  }

  .transcript-hidden .transcript-visibility-button,
  .transcript-hidden .listening-bar .listen-button,
  .transcript-hidden .listening-bar .ask-button {
    width: 100%;
    max-width: none;
  }

  .transcript-hidden .listening-bar .listen-button,
  .transcript-hidden .listening-bar .ask-button {
    justify-self: stretch;
  }

  .mobile-tabbar {
    position: fixed;
    z-index: 20;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    left: 10px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(251, 250, 245, 0.96);
    box-shadow: 0 14px 40px rgba(28, 33, 27, 0.18);
    backdrop-filter: blur(16px);
  }

  .mobile-tab {
    min-width: 0;
    min-height: 44px;
    padding: 7px 4px;
    border: 0;
    border-radius: 11px;
    color: var(--muted);
    background: transparent;
    font-size: 0.68rem;
    font-weight: 800;
  }

  .mobile-tab.active {
    color: #fff;
    background: var(--ink);
  }

  .mobile-sheet {
    top: auto;
    bottom: calc(80px + env(safe-area-inset-bottom));
    width: min(420px, calc(100vw - 20px));
    max-height: min(70vh, 480px);
    border-radius: 18px;
  }

  .mobile-sheet[open] {
    display: flex;
  }

  .mobile-more-actions .header-button {
    width: 100%;
    min-height: 48px;
  }

  .is-listening .mic-status {
    position: sticky;
    bottom: 8px;
    z-index: 3;
    padding: 9px 10px;
    border: 1px solid rgba(195, 65, 46, 0.28);
    border-radius: 12px;
    background: rgba(255, 251, 242, 0.96);
    box-shadow: 0 10px 24px rgba(28, 33, 27, 0.12);
  }
}
