:root {
  --brand-navy: #00335c;
  --brand-teal: #0a8da2;
  --brand-teal-2: #098ea2;
  --ink: #17202a;
  --muted: #667085;
  --line: #d8e0e7;
  --soft: #f5f7fa;
  --panel: #ffffff;
  --success: #00b42a;
  --warning: #ffc53d;
  --danger: #f53f3f;
  --shadow: 0 10px 30px rgba(0, 51, 92, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--brand-navy);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

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

.app-shell {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(420px, 1fr) minmax(280px, 360px);
  gap: 1px;
  min-height: 100vh;
  background: var(--line);
}

.mobile-secondary-bar,
.mobile-primary-tabs,
.mobile-profile,
.mobile-entry-flow {
  display: none;
}

.sidebar,
.workspace,
.inspector {
  min-width: 0;
  background: var(--soft);
}

.sidebar,
.inspector {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  overflow: auto;
}

.workspace {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  box-shadow: var(--shadow);
}

.brand-logo {
  flex: 0 0 auto;
  width: 132px;
  height: 84px;
  display: block;
}

.brand h1,
.brand p,
.session-bar h2,
.session-bar p,
.panel h3,
.panel p {
  margin: 0;
}

.brand h1 {
  color: var(--brand-navy);
  font-size: 28px;
  line-height: 1;
}

.brand-copy {
  min-width: 0;
}

.brand-copy p {
  margin-top: 5px;
  line-height: 1.35;
}

.brand p,
.muted,
.eyebrow {
  color: var(--muted);
}

.panel,
.session-bar,
.composer {
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.panel h3 {
  margin-bottom: 10px;
  color: var(--brand-navy);
  font-size: 15px;
}

.filters {
  display: grid;
  gap: 8px;
}

.filters label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

select,
input,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

select,
input {
  height: 38px;
  padding: 0 10px;
}

textarea {
  min-height: 54px;
  max-height: 150px;
  resize: vertical;
  padding: 10px 12px;
}

textarea::placeholder {
  color: rgba(23, 32, 42, 0.3);
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 3px rgba(10, 141, 162, 0.14);
}

.stats {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.custom-scene-panel {
  display: grid;
  gap: 8px;
}

.custom-scene-panel label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.custom-scene-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.card-list {
  display: grid;
  gap: 10px;
  overflow: auto;
}

.scenario-card {
  width: 100%;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand-teal);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.scenario-card.active {
  border-color: var(--brand-navy);
  border-left-color: var(--brand-navy);
  box-shadow: var(--shadow);
}

.scenario-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--brand-navy);
  font-size: 14px;
}

.scenario-card .zh-title {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.scenario-card span,
.scenario-card small {
  display: block;
  color: var(--muted);
  line-height: 1.35;
}

.scenario-card small {
  margin-top: 7px;
}

.scenario-card .meta-zh {
  margin-top: 3px;
  color: var(--brand-teal);
}

.session-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.session-bar h2 {
  margin: 3px 0 6px;
  color: var(--brand-navy);
  font-size: 22px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.session-bar p {
  font-size: 14px;
  line-height: 1.45;
}

.session-bar h2:empty,
.session-bar p:empty,
.empty-state:empty,
#currentTask:empty {
  display: none;
}

.session-side {
  display: grid;
  gap: 10px;
  flex: 0 0 min(360px, 42%);
}

.user-status,
.mobile-user-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.user-status {
  padding: 4px 0;
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-teal);
  color: #fff;
  font-weight: 800;
}

.user-copy,
.user-wallet {
  display: grid;
  min-width: 0;
}

  .user-copy strong,
  .user-wallet b {
    color: var(--brand-navy);
    font-size: 13px;
  line-height: 1.2;
}

  .user-copy span,
  .user-wallet span {
    color: var(--muted);
    font-size: 10px;
  line-height: 1.25;
}

.user-copy strong,
.user-copy span,
.user-wallet b,
.user-wallet span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-wallet {
  justify-items: end;
}

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

#stepBadge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--brand-navy);
  font-weight: 700;
}

#startButton,
#sendButton {
  min-width: 84px;
  height: 40px;
  padding: 0 16px;
}

.conversation {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  overflow: auto;
}

.empty-state {
  display: grid;
  place-content: center;
  gap: 8px;
  min-height: 260px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--brand-navy);
  font-size: 17px;
}

.empty-state span {
  max-width: 360px;
  font-size: 14px;
  line-height: 1.55;
}

.message {
  max-width: min(760px, 88%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.message.user {
  align-self: flex-end;
  border-color: rgba(10, 141, 162, 0.35);
  background: #eef9fb;
}

.message.assistant {
  align-self: flex-start;
}

.message.system {
  align-self: center;
  max-width: 100%;
  background: #fff7df;
  border-color: rgba(255, 197, 61, 0.7);
  color: #6f5200;
  font-size: 14px;
}

.message.correction-summary {
  align-self: flex-start;
  display: grid;
  gap: 10px;
  border-color: rgba(0, 180, 42, 0.28);
  background: #f3fcf6;
  font-size: 14px;
}

.message.correction-summary section {
  display: grid;
  gap: 5px;
}

.message.correction-summary b {
  color: var(--brand-navy);
}

.message.correction-summary del,
.message.correction-summary ins {
  text-decoration: none;
}

.message.correction-summary del {
  color: var(--danger);
}

.message.correction-summary ins {
  color: var(--success);
  font-weight: 700;
}

.message.correction-summary p {
  margin: 0;
  color: var(--muted);
}

.composer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 14px;
}

.input-hint {
  grid-column: 2 / 4;
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.audio-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

.audio-toggle input {
  width: 18px;
  height: 18px;
}

.corrections {
  display: grid;
  gap: 10px;
}

.correction {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.correction b {
  display: block;
  margin-bottom: 4px;
  color: var(--brand-navy);
  font-size: 13px;
}

.correction del,
.correction ins {
  display: block;
  text-decoration: none;
  line-height: 1.4;
}

.correction del {
  color: var(--danger);
}

.correction ins {
  color: var(--success);
}

#audioPlayer {
  width: 100%;
  min-height: 38px;
}

.admin-form {
  display: grid;
  gap: 8px;
}

.admin-form label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.admin-form input,
.admin-form select,
.admin-form textarea,
.admin-form button {
  width: 100%;
  min-width: 0;
}

.admin-form input,
.admin-form select {
  height: 40px;
}

.admin-form textarea {
  min-height: 62px;
}

.admin-adjustments {
  display: grid;
  gap: 8px;
}

.admin-adjustments div {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

.admin-adjustments b {
  color: var(--brand-navy);
  font-size: 13px;
}

.admin-adjustments span,
.admin-adjustments small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
  }

  .inspector {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-height: none;
  }
}

@media (max-width: 760px) {
  body {
    overflow: hidden;
  }

  .mobile-entry-flow {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: block;
    overflow: hidden;
    background: linear-gradient(180deg, #ffffff 0%, #f7fbfc 58%, #eef7f9 100%);
  }

  body.entry-complete .mobile-entry-flow {
    display: none;
  }

  .entry-track {
    display: flex;
    width: 200%;
    height: 100%;
    transform: translateX(calc(var(--entry-step, 0) * -50%));
    transition: transform 260ms ease-out;
    touch-action: pan-y;
  }

  .entry-slide {
    position: relative;
    display: grid;
    align-content: center;
    justify-items: center;
    width: 50%;
    min-width: 50%;
    min-height: 100%;
    padding: max(28px, env(safe-area-inset-top)) 28px max(92px, env(safe-area-inset-bottom));
    overflow: hidden;
    color: var(--brand-navy);
    text-align: center;
  }

  .entry-guide::after,
  .entry-login::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 6px;
    background: linear-gradient(180deg, var(--brand-navy) 0%, var(--brand-teal) 48%, var(--brand-teal-2) 100%);
    box-shadow: 8px 0 22px rgba(10, 141, 162, 0.12);
    pointer-events: none;
  }

  .entry-slide::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
      linear-gradient(135deg, rgba(0, 51, 92, 0.08), transparent 42%),
      linear-gradient(315deg, rgba(10, 141, 162, 0.12), transparent 44%);
    pointer-events: none;
  }

  .entry-guide {
    align-content: center;
    padding-top: max(48px, env(safe-area-inset-top));
    padding-bottom: max(148px, env(safe-area-inset-bottom));
  }

  .entry-guide::before {
    display: none;
  }

  .entry-logo {
    position: relative;
    width: min(76vw, 292px);
    height: 174px;
    margin-bottom: 24px;
  }

  .entry-logo.small {
    width: 172px;
    height: 100px;
    margin-bottom: 0;
  }

  .entry-copy {
    position: relative;
    display: grid;
    gap: 10px;
    max-width: 320px;
  }

  .entry-kicker {
    margin: 0;
    color: var(--brand-teal);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.25;
  }

  .entry-copy h1,
  .entry-copy h2 {
    margin: 0;
    color: var(--brand-navy);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: 0;
  }

  .entry-copy h1 {
    font-size: 42px;
  }

  .entry-copy h2,
  .entry-preview-top h2 {
    font-size: 24px;
  }

  .entry-copy p,
  .entry-slogan {
    margin: 0;
    font-size: 16px;
    line-height: 1.55;
  }

  .entry-copy p {
    color: #52606b;
  }

  .entry-slogan {
    color: var(--brand-navy);
    font-size: 18px;
    font-weight: 800;
  }

  .entry-login {
    align-content: center;
    padding-top: max(88px, env(safe-area-inset-top));
    padding-bottom: max(42px, env(safe-area-inset-bottom));
  }

  .entry-actions {
    position: relative;
    display: grid;
    gap: 10px;
    width: min(100%, 320px);
    margin-top: 28px;
  }

  .entry-actions button {
    min-height: 44px;
    touch-action: manipulation;
  }

  .entry-next {
    width: 100%;
    background: linear-gradient(135deg, var(--brand-navy), var(--brand-teal));
    box-shadow: 0 12px 26px rgba(0, 51, 92, 0.2);
  }

  .entry-text-button {
    width: 100%;
    border: 1px solid rgba(0, 51, 92, 0.12);
    background: rgba(255, 255, 255, 0.72);
    color: var(--brand-navy);
    box-shadow: none;
  }

  .entry-qr {
    position: relative;
    display: grid;
    place-items: center;
    gap: 6px;
    width: 164px;
    height: 164px;
    margin-top: 36px;
    border: 1px solid rgba(0, 51, 92, 0.12);
    border-radius: 8px;
    background:
      linear-gradient(90deg, rgba(0, 51, 92, 0.1) 1px, transparent 1px) 0 0 / 18px 18px,
      linear-gradient(rgba(10, 141, 162, 0.1) 1px, transparent 1px) 0 0 / 18px 18px,
      #fff;
    box-shadow: 0 16px 34px rgba(0, 51, 92, 0.12);
  }

  .entry-qr span {
    width: 54px;
    height: 54px;
    border: 12px solid var(--brand-navy);
    border-radius: 8px;
    box-shadow:
      -38px -38px 0 -20px var(--brand-teal),
      38px -38px 0 -20px var(--brand-teal),
      -38px 38px 0 -20px var(--brand-teal),
      38px 38px 0 -20px var(--brand-teal);
  }

  .entry-qr b {
    color: var(--brand-navy);
    font-size: 12px;
  }

  .entry-qr-note {
    position: relative;
    margin: 0;
    color: rgba(82, 96, 107, 0.72);
    font-size: 10px;
    line-height: 1.35;
  }

  .entry-qr-note {
    margin-top: 9px;
  }

  .phone-bind {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 88px;
    gap: 7px;
    width: min(100%, 296px);
    margin-top: 42px;
    text-align: left;
  }

  .phone-bind label,
  .phone-bind p,
  .phone-bind span {
    grid-column: 1 / -1;
    margin: 0;
  }

  .phone-bind label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
  }

  .phone-bind p,
  .phone-bind span {
    color: rgba(82, 96, 107, 0.68);
    font-size: 10px;
    line-height: 1.35;
  }

  .phone-bind input,
  .phone-bind button {
    height: 36px;
    border-color: rgba(0, 51, 92, 0.12);
    border-radius: 8px;
    padding: 0 10px;
    font-size: 12px;
  }

  .phone-bind input {
    background: rgba(255, 255, 255, 0.78);
    color: var(--brand-navy);
    box-shadow: 0 6px 18px rgba(0, 51, 92, 0.04);
  }

  .phone-bind input::placeholder {
    color: rgba(82, 96, 107, 0.48);
  }

  .phone-bind .age-confirm {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: 14px minmax(0, 1fr);
    gap: 7px;
    align-items: start;
    margin-top: 2px;
    color: rgba(0, 51, 92, 0.72);
    font-size: 10px;
    line-height: 1.35;
    font-weight: 500;
  }

  .phone-bind .age-confirm input {
    width: 14px;
    height: 14px;
    margin: 1px 0 0;
    padding: 0;
    accent-color: var(--brand-teal);
  }

  .phone-bind button {
    border: 1px solid rgba(10, 141, 162, 0.28);
    background: rgba(255, 255, 255, 0.82);
    color: var(--brand-teal);
    font-weight: 800;
    box-shadow: none;
  }

  .phone-bind button:disabled {
    color: var(--muted);
    opacity: 0.75;
  }

  .entry-slider {
    position: absolute;
    z-index: 2;
    top: max(18px, env(safe-area-inset-top));
    left: 50%;
    display: flex;
    width: 112px;
    height: 32px;
    transform: translateX(-50%);
    justify-content: center;
    align-items: center;
    gap: 4px;
  }

  .entry-slider button {
    position: relative;
    width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    background: transparent;
    box-shadow: none;
    touch-action: manipulation;
  }

  .entry-slider button::before {
    content: "";
    position: absolute;
    top: 13px;
    left: 3px;
    width: 26px;
    height: 5px;
    border-radius: 999px;
    background: rgba(0, 51, 92, 0.18);
    transition: background 180ms ease, transform 180ms ease;
  }

  .entry-slider button.active::before {
    background: var(--brand-teal);
    transform: scaleX(1.18);
  }

  body.entry-step-1 .entry-track {
    --entry-step: 1;
  }

  @media (prefers-reduced-motion: reduce) {
    .entry-track {
      transition: none;
    }
  }

  .mobile-secondary-bar {
    position: fixed;
    z-index: 20;
    top: 0;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 48px 42px 36px;
    gap: 6px;
    align-items: stretch;
    height: 146px;
    padding: 6px 10px 6px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    background: linear-gradient(135deg, rgba(0, 51, 92, 0.5) 0%, rgba(5, 72, 111, 0.5) 52%, rgba(10, 141, 162, 0.5) 100%);
    box-shadow: 0 8px 18px rgba(0, 51, 92, 0.16);
  }

  .mobile-secondary-bar::before,
  .mobile-primary-tabs::before,
  .mobile-profile::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 6px;
    background: linear-gradient(180deg, var(--brand-navy) 0%, var(--brand-teal) 48%, var(--brand-teal-2) 100%);
    box-shadow: 8px 0 22px rgba(10, 141, 162, 0.12);
    pointer-events: none;
  }

  .mobile-user-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    height: 48px;
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 8px;
    padding: 1px 8px 1px 0;
    background: rgba(255, 255, 255, 0.92);
  }

  .mobile-user-row .user-copy strong,
  .mobile-user-row .user-wallet b {
    color: var(--brand-navy);
  }

  .mobile-user-row .user-copy span,
  .mobile-user-row .user-wallet span {
    color: var(--muted);
  }

  .mobile-logo {
    width: 72px;
    height: 46px;
    margin-left: -6px;
    margin-right: -4px;
    display: block;
  }

  .mobile-practice-row {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr) 62px;
    gap: 6px;
    align-items: center;
  }

  #mobileModeSelect,
  #mobileCardSelect {
    min-width: 0;
    height: 40px;
    padding: 0 22px 0 10px;
    font-size: 12px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #mobileModeSelect {
    font-size: 12px;
  }

  #mobileStartButton {
    height: 40px;
    min-width: 0;
    padding: 0 10px;
    font-size: 12px;
  }

  .mobile-custom-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 62px;
    gap: 6px;
  }

  .mobile-custom-row input,
  .mobile-custom-row button {
    height: 36px;
  }

  .mobile-custom-row input {
    font-size: 12px;
    border-color: rgba(255, 255, 255, 0.34);
    background: rgba(255, 255, 255, 0.94);
  }

  .mobile-custom-row button {
    min-width: 0;
    padding: 0 8px;
    background: rgba(255, 255, 255, 0.94);
    color: var(--brand-navy);
    font-size: 12px;
    box-shadow: none;
  }

  .mobile-primary-tabs {
    position: fixed;
    z-index: 20;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    min-height: 48px;
    padding: 3px 8px max(3px, env(safe-area-inset-bottom)) 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    background: linear-gradient(135deg, rgba(0, 51, 92, 0.5) 0%, rgba(5, 72, 111, 0.5) 52%, rgba(10, 141, 162, 0.5) 100%);
    box-shadow: 0 -8px 18px rgba(0, 51, 92, 0.16);
  }

  .mobile-primary-tabs button {
    display: grid;
    place-items: center;
    min-width: 0;
    height: 40px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    padding: 2px;
    font-size: 10px;
    line-height: 1.2;
    font-weight: 800;
  }

  .mobile-primary-tabs button.active {
    border-color: rgba(255, 255, 255, 0.82);
    background: transparent;
    color: var(--ink);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
  }

  .app-shell {
    position: relative;
    display: block;
    height: 100vh;
    min-height: 0;
    padding-top: 146px;
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
    overflow: hidden;
  }

  .app-shell::before {
    content: "";
    position: fixed;
    z-index: 22;
    top: 0;
    bottom: 0;
    left: 0;
    width: 6px;
    background: linear-gradient(180deg, var(--brand-navy) 0%, var(--brand-teal) 48%, var(--brand-teal-2) 100%);
    box-shadow: 8px 0 22px rgba(10, 141, 162, 0.12);
    pointer-events: none;
  }

  body.profile-view .mobile-secondary-bar {
    display: none;
  }

  .app-shell.profile-view {
    padding-top: 0;
  }

  .sidebar {
    display: none;
  }

  .app-shell.profile-view .workspace {
    display: none;
  }

  .workspace {
    height: calc(100vh - 170px - env(safe-area-inset-bottom));
    min-height: 0;
    background: #fff;
  }

  .mobile-profile {
    position: relative;
    height: calc(100vh - 74px - env(safe-area-inset-bottom));
    overflow: auto;
    padding: 16px 14px 22px 20px;
    background: linear-gradient(180deg, #ffffff 0%, #f7fbfc 56%, #eef7f9 100%);
  }

  .app-shell.profile-view .mobile-profile {
    display: block;
  }

  .profile-header {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 14px;
    background: linear-gradient(135deg, var(--brand-navy) 0%, #05486f 52%, var(--brand-teal) 100%);
    box-shadow: 0 8px 18px rgba(0, 51, 92, 0.14);
  }

  .profile-avatar {
    display: grid;
    place-items: center;
    width: 58px;
    height: 44px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 18px;
    font-weight: 800;
  }

  .profile-title {
    min-width: 0;
  }

  .profile-title h2,
  .profile-title span,
  .profile-section h3,
  .profile-section p {
    margin: 0;
  }

  .profile-title h2 {
    color: #fff;
    font-size: 18px;
    line-height: 1.2;
  }

  .profile-company {
    margin: -4px 0 12px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
  }

  .profile-title span {
    display: block;
    color: rgba(255, 255, 255, 0.72);
    font-size: 11px;
  }

  .profile-header .eyebrow {
    color: rgba(255, 255, 255, 0.72);
  }

  .profile-section {
    display: grid;
    gap: 10px;
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fff;
  }

  .profile-section h3 {
    color: var(--brand-navy);
    font-size: 14px;
  }

  .nickname-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 76px;
    gap: 8px;
    align-items: end;
  }

  .nickname-form label {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
  }

  .nickname-form input,
  .nickname-form button {
    height: 44px;
  }

  .redemption-form {
    display: grid;
    gap: 8px;
  }

  .redemption-form label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
  }

  .redemption-form input,
  .redemption-form select,
  .redemption-form button {
    height: 44px;
  }

  .redemption-form textarea {
    min-height: 64px;
  }

  .profile-status {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
  }

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

  .profile-metrics div {
    display: grid;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: #fff;
  }

  .profile-metrics span,
  .profile-row span,
  .recharge-grid span {
    color: var(--muted);
    font-size: 11px;
  }

  .profile-metrics strong,
  .profile-row b,
  .recharge-grid b {
    color: var(--brand-navy);
    font-size: 13px;
  }

  .profile-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    background: #fff;
    color: var(--ink);
    text-align: left;
  }

  .profile-field {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    background: #fff;
  }

  .profile-field span {
    color: var(--muted);
    font-size: 11px;
  }

  .profile-field select {
    height: 34px;
    border-color: rgba(10, 141, 162, 0.24);
    color: var(--brand-navy);
    font-size: 12px;
    font-weight: 700;
  }

  .profile-row.service-row {
    border-color: rgba(10, 141, 162, 0.3);
    background: linear-gradient(135deg, #fff, #eef9fb);
  }

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

  .recharge-grid button {
    display: grid;
    gap: 4px;
    min-height: 70px;
    border: 1px solid rgba(10, 141, 162, 0.28);
    border-radius: 8px;
    padding: 10px;
    background: #eef9fb;
    color: var(--ink);
    text-align: left;
  }

  .session-bar,
  .composer,
  .inspector {
    grid-template-columns: 1fr;
  }

  .brand-logo {
    width: 116px;
    height: 74px;
  }

  .session-bar {
    display: grid;
    padding: 12px;
  }

  .session-bar h2 {
    font-size: 16px;
  }

  .session-bar p {
    font-size: 11px;
  }

  .session-side {
    display: none;
  }

  .conversation {
    padding: 12px;
  }

  .message {
    max-width: 100%;
    font-size: 14px;
  }

  .message.assistant,
  .message.system,
  .message.correction-summary {
    font-size: 14px;
    line-height: 1.55;
  }

  .composer {
    grid-template-columns: minmax(0, 1fr) 62px;
    gap: 8px;
    align-items: start;
    margin-bottom: 18px;
    padding: 8px 10px 16px 18px;
  }

  .input-hint {
    grid-column: 1 / 3;
    min-height: 0;
    margin: 0;
    font-size: 11px;
    color: rgba(102, 112, 133, 0.72);
  }

  textarea {
    min-height: 86px;
    padding-left: 12px;
    font-size: 16px;
    line-height: 1.45;
  }

  .composer-actions {
    display: grid;
    grid-template-rows: 36px 28px;
    gap: 6px;
    align-self: start;
    align-content: end;
    height: 86px;
  }

  #sendButton {
    min-width: 0;
    height: 36px;
    padding: 0 8px;
    font-size: 12px;
  }

  .case-alert {
    min-width: 0;
    height: 28px;
    min-height: 28px;
    border: 1px solid rgba(255, 197, 61, 0.85);
    background: #ffc53d;
    color: #3a2a00;
    padding: 0 6px;
    font-size: 11px;
    box-shadow: none;
  }

  .inspector {
    display: none;
  }
}
