:root {
  color-scheme: dark;
  --ink-950: #0c090c;
  --ink-900: #120e12;
  --ink-850: #171217;
  --ink-800: #211922;
  --ink-700: #2d232c;
  --line: #453541;
  --line-strong: #6b5965;
  --rose-700: #9f2859;
  --rose-600: #b82f66;
  --rose-500: #d93b79;
  --rose-400: #e76798;
  --rose-300: #f5a6c5;
  --rose-wash: #351827;
  --text: #fff8fb;
  --text-soft: #e9dfe4;
  --muted: #cdbfc7;
  --subtle: #95828e;
  --success: #4fd19a;
  --success-wash: #113629;
  --warning: #f0b35a;
  --warning-wash: #3a2a15;
  --danger: #ff6b7d;
  --danger-wash: #3b1820;
  --focus: #f5a6c5;
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 0.75rem;
  --space-lg: 1rem;
  --space-xl: 1.5rem;
  --space-2xl: 2rem;
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --nav-height: 4.5rem;
  --composer-height: 7.25rem;
  --tool-composer-height: 4.75rem;
  --z-sticky: 25;
  --z-nav: 30;
  --z-sidebar: 40;
  --z-toast: 100;
  --z-skip-link: 1000;
}

* { box-sizing: border-box; }

html {
  width: 100%;
  min-width: 20rem;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  background: var(--ink-950);
  font-family: var(--font);
  font-kerning: normal;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  width: 100%;
  min-width: 20rem;
  max-width: 100%;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 88% -8%, #4a1730 0, #1b1017 18rem, var(--ink-950) 36rem);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.65;
}

button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button, a, select, input[type="date"], input[type="time"], input[type="checkbox"] { touch-action: manipulation; }
button, .bottom-nav, .scene-chip, .tool-tabs { -webkit-user-select: none; user-select: none; }
textarea, input[type="text"], input[type="password"] { touch-action: pan-y; }
button { cursor: pointer; }
svg { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.5rem; line-height: 1.25; font-weight: 750; letter-spacing: -0.025em; }
h2 { font-size: 1.5rem; line-height: 1.3; font-weight: 750; letter-spacing: -0.02em; }
h3 { font-size: 1.25rem; line-height: 1.35; font-weight: 700; }

:focus { outline: none; }
:focus-visible { outline: 0.125rem solid var(--focus); outline-offset: 0.125rem; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: var(--z-skip-link);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--ink-950);
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

.eyebrow, .mini-label {
  color: var(--rose-300);
  font-size: 0.875rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}
.mini-label { color: var(--subtle); letter-spacing: 0.04em; }
.muted { color: var(--muted); }

.auth-screen {
  display: grid;
  min-height: 100dvh;
  align-content: center;
  gap: var(--space-xl);
  padding: max(2rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}
.auth-brand {
  width: 4rem;
  height: 4rem;
  margin-inline: auto;
  overflow: hidden;
  border: 0;
  background: transparent;
}
.auth-panel {
  width: min(100%, 27rem);
  margin-inline: auto;
  padding: var(--space-xl);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, #21151d 0%, var(--ink-850) 45%, #120e12 100%);
}
.auth-panel h1 { margin-top: var(--space-xs); font-size: 2rem; }
.auth-lead { margin-top: var(--space-md); color: var(--muted); }
.auth-help { margin-top: var(--space-lg); color: var(--subtle); font-size: 0.875rem; text-align: center; }

.form-stack, .dialog-body, .tool-workbench { display: grid; gap: var(--space-lg); }
.form-stack { margin-top: var(--space-xl); }
.field { display: grid; min-width: 0; max-width: 100%; gap: var(--space-sm); color: var(--text-soft); font-size: 0.875rem; font-weight: 650; }
.field input, .field textarea, .field select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--ink-800);
  color: var(--text);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  padding: 0.75rem 1rem;
}
.field textarea { min-height: 7rem; resize: vertical; }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 1.25rem) calc(50% - 0.15rem), calc(100% - 0.9rem) calc(50% - 0.15rem); background-size: 0.35rem 0.35rem; background-repeat: no-repeat; }
.field input::placeholder, .field textarea::placeholder, .composer-field textarea::placeholder { color: var(--subtle); opacity: 1; }
.field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible { border-color: var(--rose-400); }
.password-wrap { position: relative; display: block; }
.password-wrap input { padding-right: 3.5rem; }
.password-toggle { position: absolute; right: 0.25rem; top: 0.15rem; }
.consent-row { display: grid; grid-template-columns: 1.5rem 1fr; align-items: start; gap: var(--space-sm); color: var(--muted); font-size: 0.875rem; font-weight: 400; }
.consent-row input { width: 1.25rem; height: 1.25rem; margin: 0.15rem 0 0; accent-color: var(--rose-500); }
.text-btn { display: inline-block; min-height: 44px; margin: -0.65rem 0; padding: 0.65rem 0; border: 0; background: transparent; color: var(--rose-300); text-decoration: underline; text-underline-offset: 0.2em; }

.primary-btn, .secondary-btn, .danger-btn {
  display: inline-flex;
  min-height: 3rem;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 750;
  line-height: 1;
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}
.primary-btn { border: 1px solid var(--rose-500); background: var(--rose-500); color: #fffafc; }
.secondary-btn { border: 1px solid var(--line); background: var(--ink-800); color: var(--text-soft); }
.danger-btn { border: 1px solid var(--danger); background: var(--danger-wash); color: #ffdce1; }
.primary-btn:active, .secondary-btn:active, .danger-btn:active { transform: translateY(1px); }
.primary-btn:disabled, .secondary-btn:disabled, .danger-btn:disabled { cursor: not-allowed; opacity: 0.55; }
.full { width: 100%; }
.compact { min-height: 2.75rem; padding-inline: 0.75rem; font-size: 0.875rem; }
.compact svg { width: 1.125rem; height: 1.125rem; }

.form-message { padding: 0.75rem 1rem; border-radius: var(--radius-sm); background: var(--success-wash); color: #a9f3d3; font-size: 0.875rem; font-weight: 600; }
.form-message.error { background: var(--danger-wash); color: #ffc4cd; }

.app-shell { width: min(100%, 48rem); max-width: 100%; min-height: 100dvh; margin-inline: auto; overflow-x: hidden; overscroll-behavior-x: none; background: var(--ink-950); }
.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  display: flex;
  min-height: calc(5rem + env(safe-area-inset-top));
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-lg);
  padding: calc(0.75rem + env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 0.75rem max(1rem, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: #100c10f2;
}
.brand-lockup { display: flex; min-width: 0; align-items: center; gap: var(--space-md); }
.brand-lockup img { width: 2.75rem; height: 2.75rem; flex: 0 0 auto; object-fit: contain; }
.brand-lockup h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-shell[data-current-view="home"] .brand-lockup .eyebrow {
  color: var(--text);
  font-size: 1.125rem;
  letter-spacing: -0.015em;
  text-transform: none;
}
.app-shell[data-current-view="home"] .brand-lockup h1 { display: none; }
.quota-pill {
  display: grid;
  min-width: 4rem;
  min-height: 2.75rem;
  place-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--ink-800);
  color: var(--muted);
  line-height: 1.1;
  text-align: center;
}
.quota-pill span { font-size: 0.875rem; }
.quota-pill strong { margin-top: 0.15rem; color: var(--text); font-size: 0.875rem; font-variant-numeric: tabular-nums; }

#main-content { min-height: calc(100dvh - 5rem); }
.view { padding: var(--space-lg) max(1rem, env(safe-area-inset-right)) calc(var(--composer-height) + var(--nav-height) + env(safe-area-inset-bottom) + 1.5rem) max(1rem, env(safe-area-inset-left)); }
.view:not([data-view-panel="chat"]) { padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 1.25rem); }
.view[data-view-panel="tools"] { padding-bottom: calc(var(--tool-composer-height) + var(--nav-height) + env(safe-area-inset-bottom) + var(--space-lg)); }

/* 独立首页：方案 2「品牌动效中枢」 */
.home-view {
  display: grid;
  gap: 1.1rem;
  min-height: calc(100dvh - 5rem);
  padding-top: clamp(0.75rem, 2vh, 1.25rem);
  background:
    radial-gradient(circle at 50% 7.5rem, #5c173433 0, #2b101c1f 8rem, transparent 15rem),
    var(--ink-950);
}
.home-hero { display: grid; justify-items: center; gap: 0.75rem; text-align: center; }
.home-orbit {
  position: relative;
  display: grid;
  width: clamp(8rem, 20vh, 10.5rem);
  height: clamp(8rem, 20vh, 10.5rem);
  place-items: center;
}
.home-orbit img {
  position: relative;
  z-index: 2;
  width: 60%;
  height: 60%;
  object-fit: contain;
}
.home-orbit-ring {
  position: absolute;
  inset: 0;
  border: 1px solid #d93b7966;
  border-radius: 50%;
  opacity: 0.38;
}
.home-orbit .ring-two { inset: 13%; border-color: #e7679873; }
.home-orbit .ring-three { inset: 27%; border-color: #f5a6c58c; }
.home-greeting h2 { font-size: clamp(1.55rem, 6.2vw, 1.9rem); letter-spacing: -0.025em; }
.home-greeting p { margin-top: 0.25rem; color: var(--muted); font-size: 0.9375rem; }
.home-coach-action {
  position: relative;
  display: inline-flex;
  width: min(100%, 21rem);
  min-height: 3.25rem;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  overflow: hidden;
  padding: 0.75rem 1.25rem;
  border: 1px solid var(--rose-500);
  border-radius: var(--radius-lg);
  background: linear-gradient(110deg, var(--rose-600), var(--rose-500));
  color: #fffafc;
  font-size: 1.125rem;
  font-weight: 750;
  line-height: 1;
  transition: transform 120ms ease, filter 180ms ease;
}
.home-coach-action::after {
  position: absolute;
  inset: -35% auto -35% -28%;
  width: 18%;
  background: linear-gradient(90deg, transparent, #fff7, transparent);
  content: "";
  filter: blur(0.2rem);
  transform: skewX(-15deg);
  pointer-events: none;
}
.home-coach-action:active { transform: scale(0.975); }
.home-coach-action svg { width: 1.45rem; height: 1.45rem; }
.home-feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.home-feature-card {
  display: grid;
  min-width: 0;
  min-height: 4.75rem;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--ink-850);
  color: var(--text);
  text-align: left;
  transition: border-color 180ms ease, background-color 180ms ease, transform 120ms ease;
}
.home-feature-card:active { transform: scale(0.975); }
.home-feature-card svg { width: 2rem; height: 2rem; color: var(--rose-400); stroke-width: 1.65; }
.home-feature-card span, .home-feature-card strong, .home-feature-card small { display: block; min-width: 0; }
.home-feature-card strong { font-size: 1.05rem; }
.home-feature-card small { margin-top: 0.1rem; overflow: hidden; color: var(--subtle); font-size: 0.8125rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.home-section { display: grid; gap: 0.55rem; }
.home-section-heading { display: flex; min-height: 2.1rem; align-items: center; justify-content: space-between; gap: 1rem; }
.home-section-heading h3 { font-size: 1.075rem; }
.home-section-link { min-height: 44px; margin-block: -0.55rem; padding: 0.55rem 0; border: 0; background: transparent; color: var(--muted); font-size: 0.875rem; }
.home-data-row {
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 4.5rem;
  align-items: center;
  gap: 0.65rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--ink-850);
  color: var(--text);
  text-align: left;
  transition: border-color 180ms ease, background-color 180ms ease, transform 120ms ease;
}
.home-data-row:active { transform: scale(0.985); }
.home-schedule-row { grid-template-columns: 1.1rem auto minmax(0, 1fr) auto 1rem; }
.home-client-row { grid-template-columns: 2.5rem minmax(0, 1fr) auto 1rem; }
.home-event-marker { position: relative; width: 0.75rem; height: 0.75rem; border-radius: 50%; background: var(--rose-300); box-shadow: 0 0 0 0.35rem #d93b7924; }
.home-event-marker::after { position: absolute; inset: -0.35rem; border: 1px solid #f5a6c575; border-radius: 50%; content: ""; }
.home-schedule-time { color: var(--rose-300); font-size: 1.125rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.home-row-copy { display: block; min-width: 0; }
.home-row-copy strong, .home-row-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-row-copy strong { font-size: 0.95rem; }
.home-row-copy small { margin-top: 0.1rem; color: var(--subtle); font-size: 0.775rem; font-weight: 500; }
.home-row-link { color: var(--rose-300); font-size: 0.8125rem; font-weight: 700; white-space: nowrap; }
.home-chevron { width: 1rem; height: 1rem; color: var(--rose-400); }
.home-client-avatar { display: grid; width: 2.5rem; height: 2.5rem; place-items: center; border: 1px solid #75344f; border-radius: 50%; background: var(--rose-wash); color: var(--rose-300); font-weight: 750; }
.home-entitlement {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: -0.35rem;
  padding: 0.45rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.8125rem;
}
.home-entitlement svg { width: 1.1rem; height: 1.1rem; color: var(--rose-400); }

.home-view.active .home-orbit { animation: home-orbit-enter 520ms var(--ease-out-expo, cubic-bezier(0.16, 1, 0.3, 1)) both; }
.home-view.active .home-orbit .ring-one { animation: home-ring 2.7s 160ms ease-out 2 both; }
.home-view.active .home-orbit .ring-two { animation: home-ring 2.7s 360ms ease-out 2 both; }
.home-view.active .home-orbit .ring-three { animation: home-ring 2.7s 560ms ease-out 2 both; }
.home-view.active .home-greeting { animation: home-rise 420ms 100ms cubic-bezier(0.22, 1, 0.36, 1) both; }
.home-view.active .home-coach-action { animation: home-rise 440ms 160ms cubic-bezier(0.22, 1, 0.36, 1) both; }
.home-view.active .home-coach-action::after { animation: home-sheen 780ms 620ms cubic-bezier(0.22, 1, 0.36, 1) both; }
.home-view.active .home-feature-card,
.home-view.active .home-section { animation: home-rise 380ms calc(220ms + var(--home-order, 0) * 45ms) cubic-bezier(0.22, 1, 0.36, 1) both; }
.home-view.active .home-event-marker::after { animation: home-dot-pulse 2.2s 900ms ease-out infinite; }
.scene-strip { margin-inline: -1rem; padding-bottom: var(--space-md); border-bottom: 1px solid #261c24; }
.scene-strip > span { display: block; padding-inline: 1rem; color: var(--subtle); font-size: 0.875rem; font-weight: 700; }
.scene-scroll { display: flex; gap: var(--space-sm); margin-top: var(--space-sm); overflow-x: auto; padding: 0 1rem 0.25rem; scrollbar-width: none; scroll-snap-type: x proximity; touch-action: pan-x; overscroll-behavior-x: contain; }
.scene-scroll::-webkit-scrollbar { display: none; }
.scene-chip {
  display: inline-flex;
  min-height: 2.75rem;
  flex: 0 0 auto;
  align-items: center;
  gap: var(--space-sm);
  scroll-snap-align: start;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--ink-850);
  color: var(--text-soft);
  font-size: 0.875rem;
  font-weight: 650;
}
.scene-chip svg { width: 1rem; height: 1rem; color: var(--rose-300); }
.session-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-lg); padding-block: var(--space-md); }
.session-select { display: inline-flex; min-height: 2.75rem; align-items: center; gap: var(--space-xs); margin-left: -0.5rem; padding: 0.35rem 0.5rem; border: 0; background: transparent; color: var(--text); font-size: 1.25rem; font-weight: 750; }
.session-select svg { width: 1.125rem; height: 1.125rem; color: var(--muted); }
.message-list { display: grid; gap: var(--space-lg); }
.welcome-card { display: grid; grid-template-columns: 2.75rem 1fr; gap: var(--space-md); align-items: start; padding-block: var(--space-sm) var(--space-lg); border-bottom: 1px solid var(--line); }
.welcome-card h2 { margin-top: var(--space-xs); }
.welcome-card p:last-child { max-width: 42ch; margin-top: var(--space-sm); color: var(--muted); }
.assistant-avatar { width: 2.75rem; height: 2.75rem; overflow: hidden; background: transparent; }
.assistant-avatar img, .auth-brand img { display: block; width: 100%; height: 100%; object-fit: contain; }

.message { display: grid; gap: var(--space-sm); }
.message.user { justify-items: end; }
.user-bubble { max-width: 86%; padding: 0.75rem 1rem; border-radius: var(--radius-lg) var(--radius-sm) var(--radius-lg) var(--radius-lg); background: linear-gradient(135deg, var(--rose-600), var(--rose-500)); color: white; line-height: 1.6; white-space: pre-wrap; }
.assistant-response { display: grid; gap: var(--space-lg); }
.response-heading { display: flex; align-items: center; gap: var(--space-md); }
.response-heading .assistant-avatar { width: 2.25rem; height: 2.25rem; border-radius: var(--radius-sm); }
.response-heading strong { font-size: 0.875rem; }
.response-heading span { display: block; color: var(--subtle); font-size: 0.875rem; }
.insight-block { padding: var(--space-lg); border: 1px solid #5a2d42; border-radius: var(--radius-lg); background: #25151e; }
.insight-block .block-title { color: var(--rose-300); }
.block-title { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); margin-bottom: var(--space-sm); font-size: 1rem; font-weight: 750; }
.block-hint { color: var(--subtle); font-size: 0.875rem; font-weight: 500; }
.response-copy { color: var(--text-soft); line-height: 1.72; white-space: pre-wrap; overflow-wrap: anywhere; }
.script-section { display: grid; gap: var(--space-md); }
.script-list { display: grid; gap: var(--space-md); }
.script-option { display: grid; gap: var(--space-md); padding: var(--space-lg); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--ink-850); }
.script-option-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); }
.script-meta { display: grid; grid-template-columns: 1.75rem 1fr; align-items: center; gap: var(--space-sm); min-width: 0; }
.script-index { display: grid; width: 1.75rem; height: 1.75rem; place-items: center; border-radius: 50%; background: var(--rose-wash); color: var(--rose-300); font-size: 0.875rem; font-weight: 800; }
.script-name { font-weight: 750; }
.script-note { display: block; color: var(--subtle); font-size: 0.875rem; }
.script-text { transition: opacity 160ms ease, color 160ms ease; }
.script-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; padding-top: 0.1rem; }
.script-action { display: inline-flex; min-width: 0; min-height: 2.75rem; align-items: center; justify-content: center; gap: 0.35rem; padding: 0.5rem 0.625rem; border: 1px solid #513342; border-radius: var(--radius-sm); background: #21181f; color: var(--text-soft); font-size: 0.875rem; font-weight: 700; line-height: 1.2; }
.script-action.is-copy { border-color: #76405a; background: #2a1720; color: var(--rose-300); }
.script-action svg { width: 1rem; height: 1rem; flex: 0 0 auto; }
.script-action:active { transform: scale(0.98); }
.script-action:disabled { cursor: wait; opacity: 0.48; transform: none; }
.script-option.is-refining .script-text { opacity: 0.55; }
.script-option.is-updated { border-color: #96506f; }
.script-option.is-updated .script-text { color: var(--text); }
.reasoning-grid { display: grid; gap: var(--space-md); }
.reasoning-block { padding-top: var(--space-lg); border-top: 1px solid var(--line); }
.reasoning-block h3 { font-size: 1rem; }
.reasoning-block p { margin-top: var(--space-sm); color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-label { color: var(--subtle); font-size: 0.875rem; line-height: 1.5; }
.loading-response { display: grid; grid-template-columns: 2.25rem 1fr; gap: var(--space-md); align-items: center; color: var(--muted); }
.loading-dots { display: flex; gap: 0.3rem; }
.loading-dots i { width: 0.4rem; height: 0.4rem; border-radius: 50%; background: var(--rose-400); animation: pulse 1.1s ease-in-out infinite; }
.loading-dots i:nth-child(2) { animation-delay: 120ms; }.loading-dots i:nth-child(3) { animation-delay: 240ms; }

.composer-shell {
  position: fixed;
  right: 0;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
  left: 0;
  z-index: var(--z-sticky);
  width: min(100%, 48rem);
  min-height: var(--composer-height);
  margin-inline: auto;
  padding: var(--space-md) max(1rem, env(safe-area-inset-right)) var(--space-sm) max(1rem, env(safe-area-inset-left));
  border-top: 1px solid var(--line);
  background: #100c10f5;
  box-shadow: 0 -1rem 2rem #0c090c57;
}
.composer-form { display: grid; grid-template-columns: minmax(0, 1fr) 4.5rem; align-items: end; gap: var(--space-sm); }
.composer-field textarea { display: block; width: 100%; min-height: 3rem; max-height: min(30dvh, 12rem); overflow-y: auto; resize: none; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--ink-800); color: var(--text); padding: 0.7rem 1rem; font-size: 1rem; line-height: 1.6; }
.composer-field textarea:focus-visible { border-color: var(--rose-400); }
.send-btn { width: 4.5rem; min-width: 4.5rem; padding-inline: 0.75rem; }
.send-btn svg { display: none; width: 1.125rem; height: 1.125rem; }
.ai-disclosure { margin-top: var(--space-xs); color: var(--subtle); font-size: 0.875rem; line-height: 1.4; text-align: center; }

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: var(--z-nav);
  display: grid;
  width: min(100%, 48rem);
  min-height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  grid-template-columns: repeat(5, 1fr);
  margin-inline: auto;
  padding: 0.35rem max(0.5rem, env(safe-area-inset-right)) max(0.25rem, env(safe-area-inset-bottom)) max(0.5rem, env(safe-area-inset-left));
  border-top: 1px solid var(--line);
  background: #100c10fa;
}
.bottom-nav button { position: relative; display: grid; min-height: 3.75rem; place-content: center; gap: 0.1rem; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--subtle); font-size: 0.8125rem; font-weight: 650; }
.bottom-nav button, .scene-chip, .tool-tabs button, .session-choice, .session-remove { min-width: 44px; min-height: 44px; }
.bottom-nav button svg { width: 1.55rem; height: 1.55rem; margin-inline: auto; }
.bottom-nav button[aria-current="page"] { color: var(--rose-300); }
.bottom-nav button[aria-current="page"]::after { position: absolute; right: 27%; bottom: 0.1rem; left: 27%; height: 0.16rem; border-radius: 99px; background: var(--rose-400); content: ""; animation: home-nav-in 240ms cubic-bezier(0.22, 1, 0.36, 1) both; transform-origin: center; }

.section-heading { display: grid; gap: var(--space-sm); margin-bottom: var(--space-xl); }
.section-heading > p:last-child { max-width: 42rem; color: var(--muted); }
.horizontal-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--space-xl); }
.compact-heading { margin-bottom: var(--space-lg); }
.tool-chat-head { display: flex; align-items: end; justify-content: space-between; gap: var(--space-md); margin-bottom: var(--space-lg); }
.tool-chat-head h2 { margin-top: var(--space-xs); font-size: 1.25rem; }
.tool-profile-sync { display: inline-flex; min-height: 2.75rem; align-items: center; gap: 0.4rem; padding: 0.55rem 0.7rem; border-radius: var(--radius-sm); background: var(--ink-800); color: var(--subtle); font-size: 0.75rem; line-height: 1.35; }
.tool-profile-sync svg { width: 1rem; height: 1rem; flex: 0 0 auto; }
.tool-profile-sync.is-ready { color: var(--rose-300); }
.tool-tabs { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-xs); padding: var(--space-xs); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--ink-850); }
.tool-tabs button { min-height: 2.75rem; padding: 0.5rem; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); font-size: 0.875rem; font-weight: 700; }
.tool-tabs button[aria-selected="true"] { background: var(--rose-wash); color: var(--rose-300); }
.tool-thread { display: grid; min-height: 17rem; align-content: start; align-items: start; gap: var(--space-xl); padding-block: var(--space-lg); }
.tool-thread > * { width: 100%; }
.compact-welcome { padding-top: var(--space-sm); }
.compact-welcome h3 { margin-top: var(--space-xs); font-size: 1.125rem; }
.tool-response { display: grid; gap: var(--space-md); padding: var(--space-lg); border: 1px solid #5a2d42; border-radius: var(--radius-md); background: #171016; }
.tool-copy { padding-block: var(--space-sm); color: var(--text-soft); line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; transition: opacity 160ms ease; }
.tool-response.is-refining .tool-copy { opacity: 0.52; }
.tool-quality { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tool-quality span { padding: 0.28rem 0.55rem; border-radius: 999px; background: var(--ink-800); color: var(--subtle); font-size: 0.75rem; line-height: 1.3; }
.tool-quality span:first-child { background: var(--rose-wash); color: var(--rose-300); }
.tool-result-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.tool-version-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--space-sm); color: var(--subtle); font-size: 0.8125rem; text-align: center; }
.tool-version-nav button { min-height: 2.75rem; padding: 0.4rem 0.75rem; border: 0; border-radius: var(--radius-sm); background: var(--ink-800); color: var(--text-soft); }
.tool-version-nav button:last-child { justify-self: stretch; }
.tool-version-nav button:disabled { opacity: 0.35; }
.tool-composer { position: fixed; right: 0; bottom: calc(var(--nav-height) + env(safe-area-inset-bottom)); left: 0; z-index: var(--z-sticky); display: grid; width: min(100%, 48rem); min-height: 0; grid-template-columns: minmax(0, 1fr) 4.5rem; align-items: end; gap: var(--space-sm); margin-inline: auto; padding: var(--space-md) max(1rem, env(safe-area-inset-right)) var(--space-md) max(1rem, env(safe-area-inset-left)); border-top: 1px solid var(--line); background: #100c10f7; box-shadow: 0 -1rem 2rem #0c090c57; }
.tool-composer .send-btn { white-space: nowrap; }
.tool-error { grid-column: 1 / -1; }

.schedule-month-view, .schedule-day-view { min-width: 0; margin-top: var(--space-lg); }
.month-overview-bar { display: flex; min-height: 3.25rem; align-items: center; justify-content: space-between; gap: var(--space-md); margin-bottom: var(--space-sm); }
.month-overview-bar > div { display: grid; gap: 0.15rem; }
.month-overview-bar strong { color: var(--text-soft); font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.month-overview-bar .text-action { min-height: 44px; padding-inline: 0.65rem; }
.calendar-shell { width: 100%; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: linear-gradient(180deg, #1b1319 0%, #100c10 100%); box-shadow: 0 1rem 2.5rem #00000024; }
.month-switcher { display: grid; min-height: 3.75rem; grid-template-columns: 2.75rem 1fr 2.75rem; align-items: center; padding: 0.25rem 0.4rem; border-bottom: 1px solid var(--line); text-align: center; }
.month-switcher strong { color: var(--text); font-size: 1.1rem; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.icon-btn { display: inline-grid; width: 44px; min-width: 44px; height: 44px; place-items: center; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); text-align: center; }
.calendar-weekdays { min-height: 2rem; align-items: center; color: var(--subtle); font-size: 0.6875rem; font-weight: 700; }
.calendar-weekdays span { padding-block: 0.45rem; }
.calendar-grid { width: 100%; min-width: 0; overflow: hidden; }
.calendar-grid > * { min-width: 0; border-top: 1px solid #4b35421f; }
.calendar-grid > *:not(:nth-child(7n + 1)) { border-left: 1px solid #4b35421f; }
.calendar-grid .calendar-blank { min-height: clamp(5.35rem, 14vw, 7rem); background: #0e0a0e66; }
.calendar-grid button { position: relative; display: flex; min-width: 0; min-height: clamp(5.35rem, 14vw, 7rem); align-items: stretch; flex-direction: column; gap: 0.18rem; padding: 0.3rem 0.16rem 0.35rem; border: 0; border-radius: 0; background: transparent; color: var(--text-soft); font-variant-numeric: tabular-nums; overflow: hidden; transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease; }
.calendar-grid button.weekend .calendar-date-head { color: var(--subtle); }
.calendar-grid button:active { transform: scale(0.97); }
.calendar-grid button[aria-selected="true"] { background: #351827a3; box-shadow: inset 0 0 0 1px #dd337e99; }
.calendar-date-head { display: grid; min-height: 2.45rem; place-content: start center; gap: 0.05rem; line-height: 1; }
.calendar-date-head strong { display: inline-grid; min-width: 1.55rem; min-height: 1.55rem; place-items: center; padding: 0.1rem; border-radius: 50%; font-size: 0.95rem; font-weight: 760; }
.calendar-date-head small { color: var(--subtle); font-size: 0.625rem; font-weight: 500; line-height: 1.2; white-space: nowrap; }
.calendar-grid button.today .calendar-date-head strong { background: var(--rose-500); color: #fff; box-shadow: 0 0 0 0.2rem #dd337e22; }
.calendar-events { display: grid; min-width: 0; gap: 0.15rem; align-content: start; }
.calendar-event { display: grid; min-width: 0; grid-template-columns: 0.28rem auto minmax(0, 1fr); align-items: center; gap: 0.15rem; padding: 0.2rem 0.16rem; border-radius: 0.25rem; background: #4b1c38; color: #ffd8e9; font-size: 0.58rem; line-height: 1.1; text-align: left; }
.calendar-event i { width: 0.22rem; height: 0.22rem; border-radius: 50%; background: var(--rose-300); }
.calendar-event strong, .calendar-event span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-event strong { color: var(--rose-300); font-size: inherit; font-weight: 800; }
.calendar-event.status-pending { background: #47301b; color: #ffe0a3; }
.calendar-event.status-pending i { background: #ffc867; }
.calendar-event.status-completed { background: #16362c; color: #bfeedd; }
.calendar-event.status-completed i { background: #65d0aa; }
.calendar-event.status-cancelled { background: #282128; color: #8f828b; text-decoration: line-through; }
.calendar-event.status-cancelled i { background: #796d75; }
.calendar-more { padding: 0.12rem 0.16rem; color: var(--rose-300); font-size: 0.58rem; font-weight: 750; line-height: 1.2; text-align: left; }
.calendar-help { display: flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.75rem 0 0.1rem; color: var(--subtle); font-size: 0.75rem; }
.calendar-help span { width: 0.35rem; height: 0.35rem; border-radius: 50%; background: var(--rose-400); box-shadow: 0 0 0 0.25rem #dd337e14; }

.day-back-button { display: inline-flex; min-height: 44px; align-items: center; gap: 0.2rem; margin-left: -0.55rem; padding: 0 0.55rem; border: 0; background: transparent; color: var(--rose-300); font-weight: 700; }
.day-back-button svg { width: 1.25rem; height: 1.25rem; }
.day-detail-hero { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: var(--space-sm); margin-top: var(--space-xs); padding: 1.15rem 0; border-block: 1px solid var(--line); text-align: center; }
.day-detail-hero > div { min-width: 0; }
.day-detail-hero h3 { margin: 0.2rem 0; font-size: clamp(1.4rem, 6vw, 1.9rem); letter-spacing: -0.03em; }
.day-detail-hero .muted { font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.schedule-list { display: grid; min-width: 0; }
.day-timeline { padding-block: var(--space-sm) 5rem; }
.schedule-item { display: grid; min-width: 0; grid-template-columns: 3.25rem 0.9rem minmax(0, 1fr); gap: 0.55rem; align-items: stretch; padding: 1.05rem 0; border-bottom: 1px solid #4b354266; transition: opacity 160ms ease, transform 160ms ease; }
.schedule-item.is-updating { opacity: 0.48; transform: translateX(0.25rem); pointer-events: none; }
.schedule-time { padding-top: 0.16rem; color: var(--text); font-size: 0.9375rem; font-weight: 760; font-variant-numeric: tabular-nums; }
.schedule-rail { position: relative; display: flex; justify-content: center; }
.schedule-rail::after { position: absolute; top: 1rem; bottom: -1.1rem; width: 1px; background: var(--line); content: ""; }
.schedule-item:last-child .schedule-rail::after { display: none; }
.schedule-rail i { position: relative; z-index: 1; width: 0.65rem; height: 0.65rem; margin-top: 0.35rem; border: 0.15rem solid var(--ink-950); border-radius: 50%; background: var(--rose-400); box-shadow: 0 0 0 0.18rem #dd337e35; }
.schedule-item.status-pending .schedule-rail i { background: #ffc867; box-shadow: 0 0 0 0.18rem #ffc86726; }
.schedule-item.status-completed .schedule-rail i { background: #65d0aa; box-shadow: 0 0 0 0.18rem #65d0aa26; }
.schedule-item.status-cancelled .schedule-rail i { background: #796d75; box-shadow: none; }
.schedule-content { min-width: 0; }
.schedule-content-head { display: flex; min-width: 0; align-items: flex-start; justify-content: space-between; gap: var(--space-sm); }
.schedule-content-head > strong { min-width: 0; color: var(--text-soft); font-size: 1rem; line-height: 1.55; overflow-wrap: anywhere; }
.schedule-item.status-completed .schedule-content-head > strong, .schedule-item.status-cancelled .schedule-content-head > strong { color: var(--muted); text-decoration: line-through; }
.schedule-status { flex: 0 0 auto; padding: 0.22rem 0.45rem; border-radius: 999px; background: var(--rose-wash); color: var(--rose-300); font-size: 0.68rem; font-weight: 750; white-space: nowrap; }
.schedule-status.status-pending { background: var(--warning-wash); color: #ffd28f; }
.schedule-status.status-completed { background: var(--success-wash); color: #a9f3d3; }
.schedule-status.status-cancelled { background: #292229; color: #a697a1; }
.schedule-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.7rem; }
.schedule-actions > button, .schedule-more > summary { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; padding: 0.45rem 0.7rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--ink-850); color: var(--text-soft); font-size: 0.78rem; font-weight: 700; }
.schedule-actions > button:first-child { border-color: #8d2b58; color: var(--rose-300); }
.schedule-more { position: relative; }
.schedule-more > summary { min-width: 44px; padding-inline: 0.6rem; cursor: pointer; list-style: none; letter-spacing: 0.08em; }
.schedule-more > summary::-webkit-details-marker { display: none; }
.schedule-more > button { position: absolute; right: 0; bottom: calc(100% + 0.35rem); z-index: 2; width: 7rem; min-height: 44px; border: 1px solid var(--danger); border-radius: var(--radius-sm); background: #2a171b; color: #ff9eaa; box-shadow: 0 0.75rem 1.5rem #0008; }
.day-add-button { position: sticky; bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 0.75rem); z-index: 3; min-height: 3.25rem; box-shadow: 0 0.75rem 2rem #050305cc; }
.day-add-button svg { width: 1.15rem; height: 1.15rem; }
.day-empty { position: relative; margin-top: var(--space-lg); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #171116; }
.empty-orbit { display: block; width: 2.25rem; height: 2.25rem; margin: 0 auto 0.8rem; border: 1px solid #a52b6055; border-radius: 50%; box-shadow: 0 0 0 0.55rem #a52b6012, 0 0 1.5rem #dd337e2b; }
.month-enter-left { animation: calendar-left 210ms ease both; }
.month-enter-right { animation: calendar-right 210ms ease both; }
.day-view-enter { animation: day-view-enter 210ms ease both; }
.day-content-refresh .day-detail-hero > div, .day-content-refresh .schedule-list { animation: day-content-refresh 180ms ease both; }
.empty-state { padding: var(--space-2xl) var(--space-lg); border-block: 1px solid var(--line); color: var(--muted); text-align: center; }
.empty-state strong { display: block; color: var(--text); }
.empty-state p { margin-top: var(--space-sm); }
.compact-empty { padding-block: var(--space-xl); }

.profile-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-lg); padding: var(--space-xl); border: 1px solid #5a2d42; border-radius: var(--radius-lg); background: linear-gradient(135deg, #351827 0%, #1b1218 72%); }
.profile-hero h2 { margin-top: var(--space-xs); }
.profile-settings { margin-top: var(--space-xl); padding: var(--space-lg); border: 1px solid #5a2d42; border-radius: var(--radius-lg); background: #21131b; }
.profile-settings-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-lg); }
.profile-settings-heading h3 { margin-top: var(--space-xs); }
.profile-settings-heading > strong { color: var(--rose-300); font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.profile-settings > .muted { margin-top: var(--space-sm); }
.profile-progress { margin-top: var(--space-md); }
.profile-missing-copy { margin-block: var(--space-sm) var(--space-md); color: var(--subtle); font-size: 0.8125rem; }
.status-badge { display: inline-flex; min-height: 2rem; align-items: center; padding: 0.3rem 0.65rem; border-radius: 999px; background: var(--warning-wash); color: #ffd28f; font-size: 0.875rem; font-weight: 750; white-space: nowrap; }
.status-badge.active { background: var(--success-wash); color: #a9f3d3; }
.entitlement-panel, .settings-section { margin-top: var(--space-xl); padding: var(--space-lg); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--ink-850); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-lg); }
.panel-heading h3 { margin-top: var(--space-xs); }
.panel-heading > p { font-size: 0.875rem; text-align: right; }
.quota-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-md); margin-top: var(--space-xl); }
.quota-grid div { padding: var(--space-lg); border-radius: var(--radius-md); background: var(--ink-800); }
.quota-grid span { display: block; color: var(--muted); font-size: 0.875rem; }
.quota-grid strong { display: block; margin-top: var(--space-xs); font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.progress-track { height: 0.35rem; margin-top: var(--space-lg); overflow: hidden; border-radius: 99px; background: var(--ink-700); }
.progress-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--rose-600), var(--rose-400)); transition: width 200ms ease; }
#quota-description { margin-top: var(--space-md); font-size: 0.875rem; }
.inline-form { display: grid; gap: var(--space-md); }
.settings-list { display: grid; }
.settings-list button { display: flex; min-height: 3.25rem; align-items: center; justify-content: space-between; gap: var(--space-lg); padding: 0.75rem 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text-soft); text-align: left; }
.settings-list button:last-child { border-bottom: 0; }
.settings-list .danger-row { color: var(--danger); }

.app-dialog { width: min(calc(100% - 2rem), 30rem); max-width: calc(100% - 2rem); max-height: min(86dvh, 46rem); margin: auto; overflow-x: hidden; overflow-y: auto; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--ink-850); color: var(--text); box-shadow: 0 1.5rem 5rem #000a; }
.app-dialog::backdrop { background: #080608cc; }
.dialog-body { width: 100%; min-width: 0; max-width: 100%; padding: var(--space-xl); }
.dialog-heading { display: grid; gap: var(--space-sm); }
.dialog-heading > p:last-child { color: var(--muted); }
.row-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-xl); }
.bottom-sheet { width: min(100%, 48rem); max-width: 100%; margin: auto auto 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding-bottom: env(safe-area-inset-bottom); }
.selection-list { display: grid; }
.session-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; border-bottom: 1px solid var(--line); }
.selection-list button { border: 0; background: transparent; }
.session-choice { display: flex; align-items: center; justify-content: space-between; gap: var(--space-lg); padding: 0.75rem var(--space-md) 0.75rem 0; text-align: left; }
.session-choice strong { display: block; }
.session-choice span span { color: var(--muted); font-size: 0.875rem; }
.session-choice[aria-current="true"] { color: var(--rose-300); }
.session-remove { display: inline-flex; min-width: 4.25rem; align-items: center; justify-content: center; gap: var(--space-xs); margin-block: var(--space-sm); padding: var(--space-sm); border-left: 1px solid var(--line) !important; color: var(--danger); font-size: 0.875rem; font-weight: 700; }
.session-remove svg { width: 1rem; height: 1rem; }
.app-dialog { overscroll-behavior: contain; }
.profile-dialog { max-height: min(92dvh, 52rem); }
.profile-dialog .dialog-body { display: grid; gap: var(--space-lg); }
.profile-dialog-meter { padding: var(--space-md); border-radius: var(--radius-md); background: var(--ink-800); }
.profile-dialog-meter > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: var(--space-lg); }
.profile-dialog-meter strong { color: var(--rose-300); font-size: 1.25rem; }
.profile-dialog-meter .progress-track { margin-top: var(--space-sm); }
.profile-dialog-meter p { margin-top: var(--space-sm); font-size: 0.8125rem; }
.profile-example { border-block: 1px solid var(--line); }
.profile-example summary { min-height: 3rem; padding-block: 0.7rem; color: var(--rose-300); cursor: pointer; font-weight: 700; }
.profile-example p { margin-bottom: var(--space-md); color: var(--muted); line-height: 1.7; }
.profile-editor-heading { display: flex; min-height: 2.75rem; align-items: center; justify-content: space-between; gap: var(--space-md); font-weight: 700; }
.profile-editor-heading .text-action { width: auto; min-height: 44px; padding-inline: 0.75rem; }
.profile-textarea { display: block; width: 100%; min-height: 16rem; max-height: 42dvh; resize: vertical; padding: var(--space-md); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--ink-800); color: var(--text); line-height: 1.7; }
.profile-textarea:focus-visible { border-color: var(--rose-400); }
.profile-editor-meta { display: flex; justify-content: space-between; gap: var(--space-md); color: var(--subtle); font-size: 0.75rem; line-height: 1.5; }
.profile-editor-meta span:last-child { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1.25fr; gap: var(--space-sm); }
.two-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }
.time-picker-field { width: 100%; min-width: 0; max-width: 100%; gap: var(--space-sm); }
.time-input-shell { position: relative; display: grid; width: 100%; min-width: 0; max-width: 100%; height: 3rem; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--ink-800); }
.time-value { color: var(--text); font-size: 1rem; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1; pointer-events: none; }
.time-input-shell input { position: absolute; inset: 0; z-index: 2; display: block; width: 100%; min-width: 0; max-width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.time-input-shell svg { position: absolute; top: 50%; right: var(--space-lg); width: 1.25rem; height: 1.25rem; color: var(--rose-300); transform: translateY(-50%); pointer-events: none; }
.time-input-shell input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.time-input-shell:has(input:focus-visible) { outline: 0.125rem solid var(--focus); outline-offset: 0.125rem; border-color: var(--rose-400); }
.time-picker-field small { color: var(--subtle); font-size: 0.875rem; font-weight: 400; }

/* iOS 会给 date/time 原生控件附加固有宽度，排班弹窗需单独约束。 */
#schedule-dialog {
  width: min(calc(100% - 1rem), 30rem);
  max-width: calc(100% - 1rem);
  max-height: calc(100dvh - max(1rem, env(safe-area-inset-top)) - max(1rem, env(safe-area-inset-bottom)));
  margin: auto auto max(0.5rem, env(safe-area-inset-bottom));
  border-radius: var(--radius-lg);
  touch-action: pan-y;
  overscroll-behavior-x: none;
}
#schedule-dialog .dialog-body { min-width: 0; overflow-x: hidden; gap: var(--space-lg); padding: 1.25rem; }
#schedule-dialog .dialog-heading { gap: var(--space-xs); }
#schedule-dialog .field { min-width: 0; gap: 0.375rem; }
#schedule-dialog .field > span:first-child { line-height: 1.4; }
.date-input-shell { display: block; width: 100%; min-width: 0; max-width: 100%; overflow: hidden; border-radius: var(--radius-md); }
#schedule-date {
  display: block;
  inline-size: 100%;
  min-inline-size: 0;
  max-inline-size: 100%;
  min-height: 3rem;
  block-size: 3rem;
  margin: 0;
  box-sizing: border-box;
}
#schedule-date { -webkit-appearance: none; appearance: none; text-align: center; }
#schedule-dialog .time-picker-field small { line-height: 1.4; }
#schedule-note { min-height: 5.5rem; max-height: 8rem; resize: vertical; }
#schedule-dialog .primary-btn { min-height: 3rem; }

@media (max-width: 22.5rem) {
  #schedule-dialog .dialog-body { padding: 1rem; }
}
.legal-copy { line-height: 1.75; }
.legal-copy h3 { margin-top: var(--space-sm); font-size: 1rem; }
.legal-copy p { color: var(--muted); }

.toast-region { position: fixed; right: 1rem; bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 1rem); left: 1rem; z-index: var(--z-toast); display: grid; justify-items: center; pointer-events: none; }
.toast { max-width: 28rem; padding: 0.75rem 1rem; border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--ink-700); color: var(--text); font-size: 0.875rem; box-shadow: 0 0.75rem 2rem #0008; animation: toast-in 180ms ease both; }

@media (hover: hover) {
  .primary-btn:hover { background: var(--rose-600); border-color: var(--rose-600); }
  .secondary-btn:hover, .scene-chip:hover, .script-action:hover { border-color: var(--rose-400); background: var(--rose-wash); }
  .icon-btn:hover, .bottom-nav button:hover { background: var(--ink-800); color: var(--text); }
  .settings-list button:hover { color: var(--rose-300); }
}

@media (min-width: 40rem) {
  .app-shell { border-inline: 1px solid #241a22; }
  .inline-form { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
  .view { padding-inline: 1.5rem; }
  .scene-strip { margin-inline: -1.5rem; }
  .scene-strip > span, .scene-scroll { padding-inline: 1.5rem; }
  .reasoning-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 22.5rem) {
  .composer-form { grid-template-columns: minmax(0, 1fr) 3.25rem; }
  .send-btn { width: 3.25rem; min-width: 3.25rem; }
  .send-btn span { display: none; }
  .send-btn svg { display: block; }
  .script-option { padding: 0.9rem; }
  .script-action { padding-inline: 0.4rem; font-size: 0.82rem; }
  .tool-tabs button { font-size: 0.875rem; }
  .calendar-grid .calendar-blank, .calendar-grid button { min-height: 5rem; }
  .calendar-event { grid-template-columns: 0.25rem minmax(0, 1fr); gap: 0.1rem; padding-inline: 0.15rem; font-size: 0.54rem; }
  .calendar-event span { display: none; }
  .calendar-date-head strong { font-size: 0.9rem; }
  .calendar-date-head small { font-size: 0.57rem; }
  .schedule-actions > button { flex: 1 1 auto; }
}

@media (max-width: 30rem) {
  :root { --nav-height: 4.15rem; }
  html { font-size: 15px; }
  /* iOS 会在聚焦小于 16px 的表单控件时强制放大页面。 */
  body input:not([type="checkbox"]),
  body textarea,
  body select { font-size: 16px !important; }
  .app-header { min-height: calc(4.5rem + env(safe-area-inset-top)); padding-top: calc(0.55rem + env(safe-area-inset-top)); padding-bottom: 0.55rem; }
  .brand-lockup img { width: 2.75rem; height: 2.75rem; }
  .brand-lockup h1 { font-size: 1.25rem; }
  .view { padding-top: 0.8rem; }
  .scene-chip { min-height: 2.65rem; padding-block: 0.5rem; }
  .session-bar { padding-block: 1.15rem; }
  .bottom-nav button { min-height: 3.4rem; }
  .bottom-nav button svg { width: 1.4rem; height: 1.4rem; }
  .home-view { gap: 0.85rem; padding-top: 0.7rem; }
  .home-feature-card { min-height: 4.5rem; padding: 0.75rem; }
  .home-data-row { min-height: 4.25rem; padding: 0.7rem 0.75rem; }
}

/* 只裁掉页面级横向溢出；快捷场景等明确的横向滚动区仍可正常滑动。 */
@supports (overflow: clip) {
  html,
  body,
  .app-shell { overflow-x: clip; }
}

@media (max-width: 21rem) {
  html { font-size: 14.5px; }
  .two-field-row { grid-template-columns: 1fr; }
  .tool-chat-head { align-items: stretch; flex-direction: column; }
  .tool-profile-sync { align-self: flex-start; }
}

@media (orientation: landscape) and (max-height: 31rem) {
  .app-header { position: relative; min-height: calc(4.5rem + env(safe-area-inset-top)); }
  .composer-field textarea { max-height: 7rem; }
}

@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; }
}

@keyframes pulse { 0%, 80%, 100% { opacity: 0.35; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-0.15rem); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(0.5rem); } to { opacity: 1; transform: translateY(0); } }
@keyframes home-orbit-enter { from { opacity: 0; filter: blur(0.45rem); transform: scale(0.88); } to { opacity: 1; filter: blur(0); transform: scale(1); } }
@keyframes home-ring { 0% { opacity: 0.08; transform: scale(0.86); } 45% { opacity: 0.48; } 100% { opacity: 0.16; transform: scale(1.035); } }
@keyframes home-rise { from { opacity: 0; transform: translateY(0.65rem); } to { opacity: 1; transform: translateY(0); } }
@keyframes home-sheen { from { left: -28%; } to { left: 112%; } }
@keyframes home-dot-pulse { 0% { opacity: 0.65; transform: scale(0.72); } 70%, 100% { opacity: 0; transform: scale(1.4); } }
@keyframes home-nav-in { from { opacity: 0; transform: scaleX(0.25); } to { opacity: 1; transform: scaleX(1); } }
@keyframes calendar-left { from { opacity: 0.2; transform: translateX(0.7rem); } to { opacity: 1; transform: translateX(0); } }
@keyframes calendar-right { from { opacity: 0.2; transform: translateX(-0.7rem); } to { opacity: 1; transform: translateX(0); } }
@keyframes day-view-enter { from { opacity: 0; transform: translateY(0.55rem); } to { opacity: 1; transform: translateY(0); } }
@keyframes day-content-refresh { from { opacity: 0.25; transform: translateX(0.3rem); } to { opacity: 1; transform: translateX(0); } }

/* Desktop administration console */
.admin-body { background: var(--ink-950); }
.admin-shell { min-height: 100dvh; }
.admin-sidebar { position: fixed; inset: 0 auto 0 0; z-index: var(--z-sidebar); display: flex; width: 16rem; flex-direction: column; padding: 1.5rem 1rem; border-right: 1px solid var(--line); background: var(--ink-850); }
.admin-brand { display: grid; grid-template-columns: 2.75rem minmax(0, 1fr); align-items: center; gap: var(--space-md); padding: 0 0.5rem 1.5rem; }
.admin-brand img { width: 2.75rem; height: 2.75rem; border-radius: var(--radius-md); background: #f5e7ee; }
.admin-brand strong, .admin-brand span { display: block; }
.admin-brand span { color: var(--muted); font-size: 0.875rem; }
.admin-nav { display: grid; gap: var(--space-xs); }
.admin-nav button, .admin-logout { display: flex; min-height: 3rem; align-items: center; gap: var(--space-md); padding: 0.75rem; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); font-size: 0.875rem; font-weight: 700; text-align: left; }
.admin-nav button svg, .admin-logout svg { width: 1.25rem; height: 1.25rem; }
.admin-nav button[aria-current="page"] { background: var(--rose-wash); color: var(--rose-300); }
.admin-logout { width: 100%; margin-top: auto; color: var(--danger); }
.admin-workspace { min-height: 100dvh; margin-left: 16rem; }
.admin-header { position: sticky; top: 0; z-index: var(--z-sticky); display: flex; min-height: 5.5rem; align-items: center; justify-content: space-between; gap: var(--space-xl); padding: 1rem 2rem; border-bottom: 1px solid var(--line); background: #100c10f2; }
.admin-identity { display: flex; align-items: center; gap: var(--space-md); color: var(--muted); font-size: 0.875rem; }
#admin-main { padding: 2rem; }
.metric-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-lg); }
.metric-row article { min-height: 10rem; padding: var(--space-xl); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--ink-850); }
.metric-row span, .metric-row small { display: block; color: var(--muted); font-size: 0.875rem; }
.metric-row strong { display: block; margin-block: 0.75rem 0.25rem; color: var(--rose-300); font-size: 2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.admin-split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-lg); margin-top: var(--space-lg); }
.admin-panel { padding: var(--space-xl); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--ink-850); }
.admin-panel h2 { margin-top: var(--space-xs); }
.quick-actions { display: flex; flex-wrap: wrap; gap: var(--space-md); margin-top: var(--space-xl); }
.check-list { display: grid; gap: var(--space-md); margin: var(--space-xl) 0 0; padding: 0; list-style: none; }
.check-list li { position: relative; padding-left: 1.75rem; color: var(--muted); }
.check-list li::before { content: ""; position: absolute; left: 0; top: 0.55rem; width: 0.55rem; height: 0.55rem; border: 2px solid var(--rose-400); border-radius: 50%; }
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-xl); margin-bottom: var(--space-xl); }
.admin-search { display: grid; width: min(100%, 24rem); grid-template-columns: 1.25rem 1fr; align-items: center; gap: var(--space-sm); min-height: 3rem; padding: 0 1rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--ink-800); }
.admin-search svg { width: 1.125rem; height: 1.125rem; color: var(--subtle); }
.admin-search input { min-width: 0; border: 0; background: transparent; color: var(--text); font-size: 1rem; }
.table-shell { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--ink-850); }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { padding: 1rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--subtle); font-size: 0.875rem; font-weight: 750; letter-spacing: 0.04em; }
td { color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
td strong, td span { display: block; }
td strong { color: var(--text); }
td span { margin-top: 0.15rem; font-size: 0.875rem; }
.table-status { display: inline-flex; min-height: 1.75rem; align-items: center; padding: 0.25rem 0.55rem; border-radius: 999px; background: var(--warning-wash); color: #ffd28f; font-size: 0.875rem; font-weight: 750; white-space: nowrap; }
.table-status.active { background: var(--success-wash); color: #a9f3d3; }
/* 学员权益状态徽章 */
.table-status.ent-active { background: var(--success-wash); color: #a9f3d3; }
.table-status.ent-warn { background: var(--danger-wash); color: #ffc4cd; }
.table-status.ent-muted { background: var(--ink-800); color: var(--muted); }
.table-status.ent-off { background: var(--ink-800); color: var(--muted); }
.ent-expire { display: block; margin-top: 0.15rem; font-size: 0.875rem; color: var(--muted); font-variant-numeric: tabular-nums; }
/* 一键重置密码结果框 */
.reset-password-result { margin-top: var(--space-lg); }
.reset-code { display: flex; flex-direction: column; gap: var(--space-sm); padding: var(--space-lg); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--ink-850); }
.reset-code-value { font: 750 1.5rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.18em; color: var(--rose-300); user-select: all; }
.table-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-sm); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-lg); }
.codes-dialog pre { max-height: 20rem; overflow: auto; margin: 0; padding: var(--space-lg); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--ink-950); color: var(--rose-300); font: 600 0.875rem/1.8 ui-monospace, SFMono-Regular, Menlo, monospace; user-select: all; }
.admin-list { display: grid; gap: var(--space-md); }
.admin-section-gap { margin-top: var(--space-2xl); }
.batch-item, .complaint-item { padding: var(--space-xl); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--ink-850); }
.batch-summary { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-xl); }
.batch-summary h3 { margin-block: var(--space-xs); }
.batch-summary p:not(.mini-label), .complaint-item > p { color: var(--muted); font-size: 0.875rem; }
.batch-count { min-width: 6rem; text-align: right; }
.batch-count strong, .batch-count span { display: block; }
.batch-count strong { color: var(--rose-300); font-size: 2rem; line-height: 1; }
.batch-count span { margin-top: var(--space-xs); color: var(--muted); font-size: 0.875rem; }
.batch-item details { margin-top: var(--space-lg); border-top: 1px solid var(--line); }
.batch-item summary { min-height: 3rem; padding-top: 0.85rem; color: var(--rose-300); cursor: pointer; font-size: 0.875rem; font-weight: 700; }
.code-status-list { display: grid; }
.code-status-list > div { display: grid; grid-template-columns: minmax(0, 1fr) auto 4rem; align-items: center; gap: var(--space-md); min-height: 2.75rem; border-top: 1px solid #2a2029; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.875rem; }
.text-action { min-height: 2.75rem; padding: 0.5rem; border: 0; background: transparent; color: var(--rose-300); font-size: 0.875rem; }
.danger-text { color: var(--danger); }
.complaint-meta { display: flex; align-items: center; gap: var(--space-md); color: var(--subtle); font-size: 0.875rem; }
.complaint-item h3 { max-width: 60ch; margin-block: var(--space-lg) var(--space-sm); font-size: 1rem; font-weight: 650; line-height: 1.65; }
.complaint-actions { display: flex; justify-content: flex-end; gap: var(--space-sm); margin-top: var(--space-lg); padding-top: var(--space-lg); border-top: 1px solid var(--line); }
.admin-toast { bottom: 1rem; }

@media (hover: hover) {
  .admin-nav button:hover, .admin-logout:hover { background: var(--ink-800); color: var(--text); }
  tbody tr:hover { background: #21192280; }
}

@media (max-width: 64rem) {
  .admin-sidebar { width: 5rem; padding-inline: 0.75rem; }
  .admin-brand { display: block; padding-inline: 0.35rem; }
  .admin-brand div, .admin-nav span, .admin-logout span { display: none; }
  .admin-nav button, .admin-logout { justify-content: center; }
  .admin-workspace { margin-left: 5rem; }
  .metric-row { grid-template-columns: repeat(3, 1fr); }
  .admin-split { grid-template-columns: 1fr; }
}

@media (max-width: 48rem) {
  .admin-sidebar { position: fixed; inset: auto 0 0 0; width: 100%; height: calc(4.5rem + env(safe-area-inset-bottom)); flex-direction: row; align-items: center; padding: 0.35rem 0.5rem max(0.35rem, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); border-right: 0; }
  .admin-brand, .admin-logout { display: none; }
  .admin-nav { width: 100%; grid-template-columns: repeat(5, 1fr); gap: var(--space-xs); }
  .admin-nav button { min-height: 3.5rem; padding: 0.5rem; }
  .admin-workspace { margin-left: 0; padding-bottom: calc(4.5rem + env(safe-area-inset-bottom)); }
  .admin-header { min-height: calc(5.5rem + env(safe-area-inset-top)); padding: calc(1rem + env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 1rem max(1rem, env(safe-area-inset-left)); }
  .admin-identity > span:first-child { display: none; }
  #admin-main { padding: 1rem; }
  .metric-row { grid-template-columns: 1fr; }
  .metric-row article { display: grid; min-height: auto; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--space-sm) var(--space-lg); padding: var(--space-lg); }
  .metric-row article strong { grid-column: 2; grid-row: 1 / span 2; margin: 0; font-size: 2rem; }
  .admin-toolbar { align-items: stretch; flex-direction: column; }
  .admin-search { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .table-shell { border: 0; background: transparent; overflow: visible; }
  table, thead, tbody, tr, th, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  tbody { display: grid; gap: var(--space-md); }
  tr { padding: var(--space-lg); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--ink-850); }
  td { display: grid; grid-template-columns: 7rem 1fr; gap: var(--space-md); padding: 0.65rem 0; border-bottom: 1px solid var(--line); }
  td[colspan] { display: block; width: 100%; padding: 0; }
  td[colspan]::before { display: none; }
  td::before { content: attr(data-label); color: var(--subtle); font-size: 0.875rem; font-weight: 700; }
  td.table-actions { display: flex; justify-content: flex-start; padding-top: 1rem; border-bottom: 0; }
  .table-actions::before { display: none; }
  .batch-summary { display: grid; grid-template-columns: 1fr; gap: var(--space-md); }
  .batch-count { min-width: 0; text-align: left; }
  .batch-count strong, .batch-count span { display: inline; }
  .batch-count span { margin-left: var(--space-sm); }
}

/* 备案号展示（工信部要求：网站底部展示并链接至 beian.miit.gov.cn） */
.site-beian {
  position: relative;
  z-index: 1;
  margin-top: var(--space-lg);
  color: var(--subtle);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  text-align: center;
}
.site-beian a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}
.site-beian a:hover { color: var(--text-soft); text-decoration: underline; }
.mine-beian { margin-top: var(--space-xl); padding-bottom: var(--space-lg); }
