/* Shared self-hosted UI typeface; scene text and technical monospace retain their own fonts. */
@font-face { font-family: Inter; src: url('/static/_releases/20261109-mo-image-26-spec-ui-v1/fonts/inter-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Inter; src: url('/static/_releases/20261109-mo-image-26-spec-ui-v1/fonts/inter-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: Inter; src: url('/static/_releases/20261109-mo-image-26-spec-ui-v1/fonts/inter-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Noto Sans SC'; src: url('/static/_releases/20261109-mo-image-26-spec-ui-v1/fonts/noto-sans-sc-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Noto Sans SC'; src: url('/static/_releases/20261109-mo-image-26-spec-ui-v1/fonts/noto-sans-sc-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Noto Sans SC'; src: url('/static/_releases/20261109-mo-image-26-spec-ui-v1/fonts/noto-sans-sc-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #f5f6f7;
  --surface: #ffffff;
  --surface-soft: #f0f2f3;
  --surface-dark: #171a1b;
  --surface-dark-text: #ffffff;
  --text: #171a1b;
  --muted: #697176;
  --border: #dde1e3;
  --border-strong: #cbd0d3;
  --success: #16794d;
  --success-soft: #e4f4ec;
  --danger: #b13f37;
  --danger-soft: #faecea;
  --focus: #337bf1;
  --shadow-sm: 0 4px 14px rgba(20, 25, 28, .06);
  --shadow-md: 0 20px 60px rgba(20, 25, 28, .11);
  font-family: Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-synthesis: none;
  line-height: 1.5;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100dvh; color: var(--text); background: var(--bg); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }
.skip-link { position: fixed; left: 16px; top: -64px; z-index: 1000; padding: 10px 14px; border-radius: 9px; background: var(--surface-dark); color: var(--surface-dark-text); transition: top .2s ease; }
.skip-link:focus { top: 16px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 58%, transparent); outline-offset: 2px; }

/* Initial route resolution */
.boot-shell {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(circle at 50% 42%, rgba(125, 190, 180, .12), transparent 34%),
    var(--bg);
}
.boot-content { display: grid; grid-template-columns: auto auto auto; align-items: center; gap: 13px; }
.boot-content > div { display: grid; gap: 2px; }
.boot-content strong { font-size: 14px; letter-spacing: -.01em; }
.boot-content #boot-message { color: var(--muted); font-size: 12px; }
.boot-pulse {
  width: 7px; height: 7px; margin-left: 3px; border-radius: 50%;
  background: var(--surface-dark); animation: bootPulse 1.4s ease-in-out infinite;
}
@keyframes bootPulse {
  0%, 100% { opacity: .24; transform: scale(.82); }
  50% { opacity: .82; transform: scale(1); }
}

.brand-mark, .mobile-brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto;
  border-radius: 10px; color: var(--surface-dark-text); background: var(--surface-dark); font-size: 11px; font-weight: 750; letter-spacing: -.02em;
}
.brand-edition { color: var(--muted); font-size: 12px; font-weight: 500; }
.environment-badge { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; border: 1px solid #b9d9cd; border-radius: 999px; color: #176441; background: #eaf6f0; font-size: 11px; font-weight: 700; white-space: nowrap; }
.eyebrow, .dialog-kicker { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .14em; }

/* Authentication */
.auth-shell { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; padding: 24px clamp(20px, 4vw, 56px); overflow: hidden; position: relative; }
.auth-shell::before { content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .48; background-image: radial-gradient(#cbd0d3 1px, transparent 1px); background-size: 28px 28px; }
.auth-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; height: 44px; font-weight: 700; }
.auth-layout { position: relative; z-index: 1; width: min(1180px, 100%); margin: auto; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(420px, .92fr); min-height: 660px; border: 1px solid rgba(208, 213, 216, .86); border-radius: 28px; overflow: hidden; background: rgba(255,255,255,.78); box-shadow: var(--shadow-md); backdrop-filter: blur(18px); }
.auth-story { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: clamp(40px, 5vw, 68px); color: white; background: #1a1e20; isolation: isolate; }
.auth-story::before { content: ""; position: absolute; width: 520px; height: 520px; left: -180px; bottom: -250px; z-index: -1; border-radius: 50%; background: radial-gradient(circle, rgba(125,190,180,.32), transparent 68%); }
.auth-story::after { content: ""; position: absolute; width: 460px; height: 460px; right: -220px; top: -240px; z-index: -1; border-radius: 50%; background: radial-gradient(circle, rgba(144,156,217,.25), transparent 68%); }
.story-copy { max-width: 500px; }
.story-copy .eyebrow { color: #9da6aa; }
.story-copy h1 { margin: 20px 0 18px; font-size: clamp(34px, 4vw, 58px); line-height: 1.12; letter-spacing: -.045em; }
.story-copy p { margin: 0; max-width: 440px; color: #b9c0c3; font-size: 16px; line-height: 1.75; }
.story-canvas { position: relative; align-self: center; width: min(420px, 88%); aspect-ratio: 1.65; }
.story-card { position: absolute; border: 1px solid rgba(255,255,255,.22); border-radius: 18px; background: rgba(255,255,255,.08); box-shadow: 0 18px 50px rgba(0,0,0,.22); backdrop-filter: blur(8px); }
.story-card::before { content: ""; position: absolute; inset: 12px; border-radius: 11px; background: linear-gradient(135deg, rgba(142,197,188,.5), rgba(153,138,206,.34) 58%, rgba(242,177,151,.42)); }
.story-card-a { width: 58%; aspect-ratio: 1.05; left: 4%; top: 16%; transform: rotate(-4deg); }
.story-card-b { width: 42%; aspect-ratio: .82; right: 3%; top: 3%; transform: rotate(5deg); }
.story-line { position: absolute; left: 49%; top: 50%; width: 27%; height: 1px; background: rgba(255,255,255,.3); transform: rotate(-14deg); transform-origin: left; }
.story-dot { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: white; box-shadow: 0 0 0 5px rgba(255,255,255,.12); }
.story-dot-a { left: 48%; top: 49%; }.story-dot-b { right: 24%; top: 39%; }
.story-points { display: flex; flex-wrap: wrap; gap: 20px; color: #c6cccf; font-size: 12px; }
.story-points span { display: flex; align-items: center; gap: 7px; }.story-points i { width: 5px; height: 5px; border-radius: 50%; background: #79c6aa; }
.auth-panel { display: grid; place-items: center; padding: clamp(30px, 5vw, 70px); background: rgba(255,255,255,.76); }
.login-card { width: min(390px, 100%); }
.login-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 34px; }
.mobile-brand-mark { display: none; }
.login-heading h2 { margin: 0; font-size: 28px; line-height: 1.25; letter-spacing: -.025em; }
.login-heading p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.login-heading .environment-badge { margin-top: 10px; }
.auth-mode-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 4px; min-height: 48px; padding: 4px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-soft); }
.auth-mode-tabs button { min-height: 38px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 650; transition: background .18s ease, color .18s ease, box-shadow .18s ease; }
.auth-mode-tabs button[aria-selected="true"] { color: var(--text); background: var(--surface); box-shadow: 0 2px 8px rgba(20, 25, 28, .07); }
.form-field { display: grid; gap: 8px; margin-top: 20px; font-size: 13px; font-weight: 650; }
.form-field small { color: var(--muted); font-size: 11px; font-weight: 400; }
.input-wrap, .code-wrap { min-height: 50px; display: flex; align-items: center; overflow: hidden; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); transition: border-color .18s ease, box-shadow .18s ease; }
.input-wrap:focus-within, .code-wrap:focus-within { border-color: var(--text); box-shadow: 0 0 0 3px rgba(23,26,27,.08); }
.country-code { padding: 0 12px 0 15px; border-right: 1px solid var(--border); color: var(--muted); font-weight: 500; }
.form-field input { min-width: 0; height: 48px; flex: 1; border: 0; outline: 0; padding: 0 14px; background: transparent; color: var(--text); font-size: 16px; }
.form-field input::placeholder { color: #a3aaad; }
.single-input input { padding-inline: 15px; }
.text-button { min-width: 116px; align-self: stretch; border: 0; border-left: 1px solid var(--border); background: transparent; color: var(--text); font-size: 13px; font-weight: 650; }
.text-button:hover { background: var(--surface-soft); }.text-button:disabled { cursor: not-allowed; color: #a5aaad; }
.password-toggle { min-width: 74px; }
.auth-secondary-action { min-height: 44px; display: inline-flex; align-items: center; margin-top: 6px; border: 0; padding: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.auth-secondary-action:hover { color: var(--text); }
.auth-secondary-action:focus-visible { border-radius: 4px; outline: 2px solid rgba(59, 130, 246, .5); outline-offset: 3px; }
.demo-notice { display: grid; gap: 3px; margin-top: 18px; padding: 13px 14px; border: 1px solid #cde3da; border-radius: 12px; color: #184f39; background: #eef8f4; }
.demo-notice b { font-size: 12px; }.demo-notice span { color: #4c6b5e; font: var(--ui-body-small); line-height: 18px; }
.agreement-row { display: flex; align-items: flex-start; gap: 9px; margin-top: 18px; color: var(--muted); font-size: 12px; font-weight: 400; }
.agreement-row input { width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--surface-dark); }
.agreement-row a { color: var(--text); text-underline-offset: 2px; }
.form-message { min-height: 24px; margin-top: 10px; color: var(--danger); font-size: 12px; }
.primary-button, .quiet-button, .danger-button { min-height: 44px; border-radius: 12px; padding: 0 18px; font-weight: 650; transition: background .18s ease, border-color .18s ease, color .18s ease, opacity .18s ease; }
.primary-button { width: 100%; position: relative; border: 1px solid var(--surface-dark); background: var(--surface-dark); color: var(--surface-dark-text); }
.primary-button:hover { background: #2a2f31; }.primary-button:active { background: #0f1112; }.primary-button:disabled { cursor: not-allowed; opacity: .5; }
.primary-button.loading .button-label { opacity: 0; }.button-spinner { display: none; position: absolute; width: 18px; height: 18px; inset: 50% auto auto 50%; margin: -9px; border: 2px solid rgba(255,255,255,.35); border-top-color: white; border-radius: 50%; animation: spin .7s linear infinite; }.primary-button.loading .button-spinner { display: block; }
.login-footnote { margin: 14px 0 0; text-align: center; color: var(--muted); font: var(--ui-body-small); line-height: 18px; }
.auth-footer { position: relative; z-index: 1; min-height: 54px; display: flex; justify-content: center; align-items: flex-end; gap: 20px; color: var(--muted); font: var(--ui-body-small); }.auth-footer a { display: inline-flex; align-items: center; min-height: 40px; text-decoration: none; font: var(--ui-label-large); }.auth-footer a:hover { color: var(--text); }

/* Brand split login: presentation only, scoped away from account pages. */
#auth-view[data-login-layout="brand-split"] {
  --text: #29231e;
  --muted: #71685f;
  --online-m3-shell: #ffffff;
  --online-m3-card: #fcfbf9;
  --online-m3-raised: #f3ede6;
  --online-m3-outline: #e2ddd7;
  --online-m3-focus: #966044;
  --auth-page: #f7f7f5;
  --auth-art-surface: #ead4c0;
  --auth-action: #513b2b;
  --auth-action-ink: #fffaf5;
  --focus: var(--online-m3-focus);
  grid-template-rows: 1fr auto;
  padding: 24px clamp(24px, 3.4vw, 48px) 16px;
  color: var(--text);
  background: var(--auth-page);
}
html[data-theme="dark"] #auth-view[data-login-layout="brand-split"] {
  --text: #f4ece4;
  --muted: #beb1a4;
  --online-m3-shell: #25211d;
  --online-m3-card: #2d2823;
  --online-m3-raised: #3b3027;
  --online-m3-outline: #4d4339;
  --online-m3-focus: #edc8aa;
  --auth-page: #1c1916;
  --auth-art-surface: #0b202a;
  --auth-action: #edc8aa;
  --auth-action-ink: #33251b;
}
#auth-view[data-login-layout]::before { display: none; }
#auth-view[data-login-layout] .auth-layout {
  width: min(1248px, 100%);
  height: auto;
  min-height: min(720px, calc(100dvh - 104px));
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  align-items: stretch;
  align-self: center;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid var(--online-m3-outline);
  border-radius: 24px;
  background: var(--online-m3-shell);
  box-shadow: none;
  backdrop-filter: none;
}
#auth-view[data-login-layout] .auth-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: stretch;
  justify-content: safe center;
  justify-self: stretch;
  width: 100%;
  min-height: 0;
  overflow: visible;
  padding: 36px clamp(30px, 4.7vw, 68px);
  border: 0;
  border-radius: 0;
  background: var(--online-m3-shell);
  box-shadow: none;
  backdrop-filter: none;
}
#auth-view[data-login-layout] .auth-brand,
#auth-view[data-login-layout] .login-card { width: min(368px, 100%); flex-shrink: 0; }
#auth-view[data-login-layout] .auth-brand { display: flex; height: 42px; margin-bottom: 32px; }
#auth-view[data-login-layout] .auth-brand-name { gap: 12px; font-size: 24px; font-weight: 600; letter-spacing: -1px; }
#auth-view[data-login-layout] .auth-brand .brand-logo { width: 42px; height: 42px; border-radius: 12px; box-shadow: none; }
#auth-view[data-login-layout] .auth-brand .theme-toggle { width: 40px; min-width: 40px; height: 40px; min-height: 40px; flex: 0 0 40px; padding: 0; justify-content: center; border: 0; border-radius: 50%; background: transparent; box-shadow: none; }
#auth-view[data-login-layout] .auth-brand .theme-toggle:hover { background: var(--online-m3-raised); }
#auth-view[data-login-layout] .auth-brand .theme-toggle:focus-visible { outline: 2px solid var(--online-m3-focus); outline-offset: 2px; }
#auth-view[data-login-layout] .auth-brand [data-theme-label] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#auth-view[data-login-layout] .login-heading { display: block; margin-bottom: 22px; }
#auth-view[data-login-layout] .login-heading h2 { font-size: 28px; line-height: 1.4; font-weight: 500; letter-spacing: -.8px; }
#auth-view[data-login-layout] .mobile-brand-logo,
#auth-view[data-login-layout] .mobile-theme-toggle { display: none; }
#auth-view[data-login-layout] .auth-mode-tabs { display: flex; gap: 30px; min-height: 44px; margin: 0 0 22px; padding: 0; border: 0; border-bottom: 1px solid var(--online-m3-outline); border-radius: 0; background: transparent; }
#auth-view[data-login-layout] .auth-mode-tabs button { min-height: 44px; padding: 0 0 12px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); background: transparent; box-shadow: none; white-space: nowrap; }
#auth-view[data-login-layout] .auth-mode-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--auth-action); }
#auth-view[data-login-layout] .auth-mode-tabs button:hover { color: var(--text); background: transparent; }
#auth-view[data-login-layout] .form-field { margin-top: 18px; }
#auth-view[data-login-layout] .input-wrap,
#auth-view[data-login-layout] .code-wrap { border-color: var(--online-m3-outline); border-radius: 10px; background: var(--online-m3-card); }
#auth-view[data-login-layout] .form-field input::placeholder { color: var(--muted); opacity: 1; }
#auth-view[data-login-layout] .text-button { min-width: 102px; border-left: 0; color: var(--muted); }
#auth-view[data-login-layout] .password-toggle { min-width: 56px; }
#auth-view[data-login-layout] .auth-secondary-action { font-weight: 400; }
#auth-view[data-login-layout] #login-form .primary-button { min-height: 48px; border-radius: 10px; border-color: var(--auth-action); color: var(--auth-action-ink); background: var(--auth-action); }
#auth-view[data-login-layout] #login-form .primary-button:hover { filter: brightness(1.08); }
#auth-view[data-login-layout] .agreement-row { line-height: 1.9; }
#auth-view[data-login-layout] .agreement-row input { accent-color: var(--auth-action); }
#auth-view[data-login-layout] .auth-story { display: flex; flex-direction: column; width: 100%; height: auto; min-height: 0; padding: 0; align-self: stretch; overflow: hidden; }
#auth-view[data-login-layout] .auth-story::before,
#auth-view[data-login-layout] .auth-story::after { display: none; }
#auth-view[data-login-layout] .story-canvas { position: relative; flex: 1; width: 100%; height: auto; min-height: 0; aspect-ratio: auto; margin: 0; align-self: stretch; background: var(--auth-art-surface); }
#auth-view[data-login-layout] .auth-brand-art { position: absolute; top: 50%; left: 0; display: block; width: 100%; height: auto; transform: translateY(-50%); mask-image: linear-gradient(to bottom, transparent, #000 12%, #000 88%, transparent); }
#auth-view[data-login-layout] .auth-brand-art-night { display: none; }
html[data-theme="dark"] #auth-view[data-login-layout] .auth-brand-art-day { display: none; }
html[data-theme="dark"] #auth-view[data-login-layout] .auth-brand-art-night { display: block; }
#auth-view[data-login-layout] .auth-footer { display: flex; align-items: center; flex-wrap: wrap; padding-top: 18px; gap: 4px 24px; }
#auth-view[data-login-layout] .auth-footer a { font: var(--ui-body-small); min-height: 44px; }
@media (min-width: 761px) and (max-width: 1050px) {
  #auth-view[data-login-layout] .auth-panel { padding: 32px; }
}
@media (min-width: 761px) and (max-height: 820px) {
  #auth-view[data-login-layout] .auth-panel { padding-block: 24px; }
  #auth-view[data-login-layout] .auth-brand { margin-bottom: 24px; }
  #auth-view[data-login-layout] .login-heading { margin-bottom: 18px; }
  #auth-view[data-login-layout] .auth-mode-tabs { margin-bottom: 18px; }
  #auth-view[data-login-layout] .form-field { margin-top: 16px; }
}
@media (max-width: 760px) {
  #auth-view[data-login-layout="brand-split"] { padding: 20px 16px 14px; }
  #auth-view[data-login-layout] .auth-layout { width: min(460px, 100%); height: auto; min-height: 0; display: flex; flex-direction: column; border-radius: 18px; }
  #auth-view[data-login-layout] .auth-story { order: -1; height: 140px; min-height: 140px; flex: 0 0 140px; }
  #auth-view[data-login-layout] .story-canvas { width: 100%; height: 140px; min-height: 140px; aspect-ratio: auto; }
  #auth-view[data-login-layout] .auth-brand-art { inset: 0; height: 100%; transform: none; mask-image: none; object-fit: cover; object-position: 50% 43%; }
  #auth-view[data-login-layout] .auth-panel { padding: 26px 25px 30px; overflow: visible; }
  #auth-view[data-login-layout] .auth-brand { margin-bottom: 26px; }
  #auth-view[data-login-layout] .auth-brand-name { font-size: 22px; gap: 10px; }
  #auth-view[data-login-layout] .auth-brand .brand-logo { width: 36px; height: 36px; border-radius: 10px; }
  #auth-view[data-login-layout] .login-heading h2 { font-size: 25px; }
  #auth-view[data-login-layout] .login-heading p { text-wrap: initial; }
  #auth-view[data-login-layout] .auth-mode-tabs { gap: 26px; }
  #auth-view[data-login-layout] .agreement-row { font-size: 12px; }
  #auth-view[data-login-layout] .auth-footer { gap: 4px 18px; }
}
@media (max-width: 760px) and (max-height: 900px) {
  #auth-view[data-login-layout] .auth-story { height: 100px; min-height: 100px; flex-basis: 100px; }
  #auth-view[data-login-layout] .story-canvas { height: 100px; min-height: 100px; }
  #auth-view[data-login-layout] .auth-panel { padding-block: 22px 26px; }
  #auth-view[data-login-layout] .auth-brand { margin-bottom: 20px; }
  #auth-view[data-login-layout] .login-heading { margin-bottom: 18px; }
  #auth-view[data-login-layout] .auth-mode-tabs { margin-bottom: 18px; }
  #auth-view[data-login-layout] .form-field { margin-top: 16px; }
}

/* Authenticated app */
.app-shell { min-height: 100dvh; }
.app-header { position: sticky; top: 0; z-index: 30; height: 66px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.88); backdrop-filter: blur(14px); }
.app-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 750; }
.header-actions { position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; }
.quiet-button { border: 1px solid var(--border); background: var(--surface); color: var(--text); }.quiet-button:hover { border-color: var(--border-strong); background: var(--surface-soft); }
.profile-chip { min-height: 44px; display: flex; align-items: center; gap: 9px; padding: 4px 11px 4px 5px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.profile-avatar, .side-avatar { display: grid; place-items: center; border-radius: 50%; background: var(--surface-dark); color: var(--surface-dark-text); font-size: 11px; font-weight: 700; }.profile-avatar { width: 32px; height: 32px; }.chevron { color: var(--muted); }
.profile-menu { position: absolute; right: 0; top: 52px; width: 180px; padding: 6px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); }
.profile-menu button, .profile-menu a { width: 100%; min-height: 38px; display: flex; align-items: center; border: 0; border-radius: 8px; padding: 0 10px; background: transparent; text-decoration: none; color: var(--text); font-size: 13px; text-align: left; }.profile-menu button:hover, .profile-menu a:hover { background: var(--surface-soft); }.profile-menu .danger-text { color: var(--danger); }
.app-layout { min-height: calc(100dvh - 66px); display: grid; grid-template-columns: 240px minmax(0, 1fr); }
.side-nav { position: sticky; top: 66px; height: calc(100dvh - 66px); display: flex; flex-direction: column; padding: 24px 16px; border-right: 1px solid var(--border); background: #fafbfb; }
.side-profile { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; }.side-avatar { width: 38px; height: 38px; }.side-profile div { min-width: 0; display: grid; }.side-profile b { overflow: hidden; text-overflow: ellipsis; font-size: 13px; }.side-profile span { color: var(--muted); font-size: 11px; }
.side-profile .side-avatar { color: var(--surface-dark-text); }
.side-nav nav { display: grid; gap: 4px; }.nav-item { min-height: 44px; display: flex; align-items: center; gap: 11px; border: 0; border-radius: 9px; padding: 0 12px; background: transparent; color: var(--muted); text-align: left; font-size: 13px; }.nav-item:hover { color: var(--text); background: var(--surface-soft); }.nav-item.active { color: var(--text); background: #e9ecee; font-weight: 650; }.nav-item svg { width: 18px; height: 18px; flex: 0 0 auto; stroke-width: 1.7; }
.side-help { margin-top: auto; display: grid; gap: 4px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }.side-help b { font-size: 12px; }.side-help span { color: var(--muted); font-size: 11px; }.side-help a { margin-top: 5px; font-size: 12px; font-weight: 650; }
.app-main { width: min(1200px, 100%); margin: 0 auto; padding: 46px clamp(28px, 5vw, 64px) 72px; outline: none; }
.app-main:focus,
.app-main:focus-visible { outline: none; box-shadow: none; }
.app-view-panel { display: none; }.app-view-panel.active { display: block; animation: panelIn .22s ease-out; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }.page-heading h1 { margin: 7px 0 6px; font-size: clamp(28px, 3vw, 40px); line-height: 1.15; letter-spacing: -.04em; }.page-heading p { margin: 0; color: var(--muted); font-size: 14px; }.page-heading .compact { width: auto; min-width: 132px; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }.summary-card { min-height: 134px; display: grid; align-content: space-between; padding: 20px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); }.summary-card > span { color: var(--muted); font-size: 12px; }.summary-card b { margin: 5px 0; font-size: 25px; font-variant-numeric: tabular-nums; }.summary-card button { justify-self: start; border: 0; padding: 0; background: none; color: var(--muted); font-size: 11px; text-decoration: underline; text-underline-offset: 3px; }
.content-heading { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 32px 0 12px; }.content-heading h2 { margin: 0; font-size: 18px; }.content-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }.project-card { min-height: 190px; display: flex; flex-direction: column; padding: 14px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); }.project-preview { height: 88px; position: relative; overflow: hidden; border-radius: 10px; background-color: #f0f2f3; background-image: radial-gradient(#c8cdd0 1px, transparent 1px); background-size: 14px 14px; }.project-preview::after { content: ""; position: absolute; width: 52px; height: 44px; left: 50%; top: 50%; border: 1px solid #c4c9cc; border-radius: 7px; background: rgba(255,255,255,.88); transform: translate(-50%,-50%) rotate(-3deg); box-shadow: 22px 8px 0 -5px rgba(255,255,255,.9), 22px 8px 0 -4px #d1d5d7; }.project-meta { display: grid; gap: 4px; margin-top: 13px; }.project-meta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }.project-meta span { color: var(--muted); font-size: 11px; }.project-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 12px; }.project-actions a, .project-actions button { min-height: 36px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 8px; padding: 0 12px; background: var(--surface); color: var(--text); text-decoration: none; font-size: 12px; }.project-actions a { flex: 1; background: var(--surface-dark); color: var(--surface-dark-text); border-color: var(--surface-dark); }.project-actions button:hover { background: var(--surface-soft); }
.empty-state { grid-column: 1 / -1; min-height: 260px; display: grid; place-items: center; text-align: center; border: 1px dashed var(--border-strong); border-radius: 16px; background: rgba(255,255,255,.5); }.empty-state div { max-width: 320px; }.empty-state b { display: block; margin-bottom: 6px; }.empty-state p { margin: 0 0 18px; color: var(--muted); font-size: 13px; }.empty-state .primary-button { width: auto; }
.membership-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(250px, .75fr); gap: 16px; }.plan-card { padding: 28px; border-radius: 20px; background: var(--surface-dark); color: var(--surface-dark-text); box-shadow: var(--shadow-md); }.plan-top { display: flex; justify-content: space-between; gap: 16px; }.status-badge, .verified-badge { display: inline-flex; align-items: center; min-height: 26px; padding: 0 9px; border-radius: 999px; font-size: 11px; }.status-badge { color: #d3d8da; background: rgba(255,255,255,.1); }.status-badge.active { color: #aee1cc; background: rgba(73,159,119,.2); }.plan-price { display: flex; align-items: baseline; gap: 8px; margin: 26px 0 10px; }.plan-price b { font-size: 46px; line-height: 1; letter-spacing: -.05em; }.plan-price span, .plan-card p { color: #b9c0c3; }.plan-card p { max-width: 620px; font-size: 13px; }.plan-card ul { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 22px; margin: 24px 0; padding: 0; list-style: none; font-size: 12px; }.plan-card li::before { content: "✓"; margin-right: 7px; color: #8ed2b6; }.plan-card .primary-button { max-width: 220px; color: var(--text); background: white; border-color: white; }.wallet-column { display: grid; gap: 16px; }.wallet-card, .expiry-card { display: grid; align-content: center; min-height: 160px; padding: 22px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }.wallet-card > span, .expiry-card > span { color: var(--muted); font-size: 12px; }.wallet-card b, .expiry-card b { margin: 6px 0; font-size: 30px; }.wallet-card p, .expiry-card p { margin: 0; color: var(--muted); font-size: 11px; }
.card-surface { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); overflow: hidden; }.record-row, .order-row { display: grid; align-items: center; gap: 14px; min-height: 58px; padding: 12px 18px; border-bottom: 1px solid var(--border); font-size: 12px; }.record-row:last-child, .order-row:last-child { border: 0; }.record-row { grid-template-columns: 1fr auto; }.record-row div, .order-row div { display: grid; }.record-row span, .order-row span { color: var(--muted); font-size: 11px; }.delta-positive { color: var(--success); }.delta-negative { color: var(--text); }.order-head, .order-row { grid-template-columns: 1.4fr .8fr .8fr .7fr; }.order-head { min-height: 42px; display: grid; align-items: center; padding: 0 18px; background: var(--surface-soft); color: var(--muted); font-size: 11px; }.order-status { justify-self: start; padding: 3px 8px; border-radius: 99px; background: var(--surface-soft); }.order-status.paid { color: var(--success); background: var(--success-soft); }.record-empty { padding: 28px; color: var(--muted); text-align: center; font-size: 13px; }
.settings-stack { display: grid; gap: 12px; }.setting-card { min-height: 112px; display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 22px 24px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }.setting-card > div { display: grid; }.setting-card span { color: var(--muted); font-size: 11px; }.setting-card b { margin-top: 4px; font-size: 15px; }.setting-card p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }.verified-badge { color: var(--success) !important; background: var(--success-soft); }.link-button { display: inline-grid; place-items: center; text-decoration: none; white-space: nowrap; }.danger-card { border-color: #ecd2cf; }.danger-button { border: 1px solid #e1b5b1; background: var(--danger-soft); color: var(--danger); }.danger-button:hover { background: #f6dfdc; }.sessions-card { display: block; }.setting-card-head { display: flex !important; justify-content: space-between; gap: 20px; } .setting-card-head > div { display: grid; align-content: start; gap: 4px; } .setting-card-head > div > b, .setting-card-head > div > p { margin: 0; }.session-list { display: grid; margin-top: 18px; border-top: 1px solid var(--border); }.session-row { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--border); }.session-row:last-child { border: 0; }.session-row div { display: grid; }.session-row b { font-size: 13px; }.session-row span { font-size: 11px; }.current-session { color: var(--success) !important; }

/* Dialogs and feedback */
dialog { width: min(440px, calc(100% - 28px)); border: 0; border-radius: 20px; padding: 0; color: var(--text); background: var(--surface); box-shadow: 0 28px 90px rgba(0,0,0,.24); } dialog::backdrop { background: rgba(17,20,21,.55); backdrop-filter: blur(3px); }.dialog-body { position: relative; padding: 30px; text-align: center; }.dialog-body h2 { margin: 7px 0 8px; font-size: 23px; }.dialog-body > p { margin: 0 0 20px; color: var(--muted); font-size: 13px; }.dialog-close { position: absolute; right: 15px; top: 15px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--surface-soft); font-size: 21px; }.pay-code { min-height: 245px; display: grid; place-items: center; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: #fafafa; }.pay-code img { width: 220px; height: 220px; max-width: 100%; object-fit: contain; }.pay-status { margin: 12px 0; color: var(--muted); font-size: 12px; }.wide { width: 100%; margin-top: 9px; }
.confirm-layer { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(17,20,21,.55); backdrop-filter: blur(3px); }.confirm-card { width: min(390px, 100%); padding: 24px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-md); }.confirm-card h2 { margin: 0 0 8px; font-size: 19px; }.confirm-card p { margin: 0 0 22px; color: var(--muted); font-size: 13px; }.confirm-card > div { display: flex; justify-content: flex-end; gap: 9px; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 120; max-width: min(430px, calc(100% - 32px)); padding: 11px 16px; border-radius: 10px; background: var(--surface-dark); color: var(--surface-dark-text); box-shadow: var(--shadow-md); font-size: 12px; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: opacity .2s ease, transform .2s ease; }.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes panelIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (max-width: 980px) {
  .auth-layout { grid-template-columns: minmax(0, .9fr) minmax(390px, 1.1fr); }.story-copy h1 { font-size: 38px; }.story-canvas { width: 95%; }
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }.summary-grid { grid-template-columns: 1fr 1fr; }.summary-card:last-child { grid-column: 1 / -1; }
  .membership-layout { grid-template-columns: 1fr; }.wallet-column { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .auth-shell { padding: 18px; }.auth-brand { display: none; }.auth-footer { flex-wrap: wrap; align-items: center; gap: 4px 16px; padding-top: 12px; }.auth-layout { min-height: calc(100dvh - 36px); grid-template-columns: 1fr; border-radius: 22px; }.auth-story { display: none; }.auth-panel { padding: 34px 24px; }.mobile-brand-mark { display: grid; }.login-heading { margin-bottom: 26px; }.form-field input { font-size: 16px; }
  .app-header { height: 60px; padding: 0 14px; }.app-brand > span:not(.brand-mark), #open-canvas-header, #profile-phone, .chevron { display: none; }.profile-chip { border: 0; padding: 2px; }
  .app-layout { display: block; min-height: calc(100dvh - 60px); }.side-nav { position: fixed; inset: auto 0 0; z-index: 25; width: 100%; height: 66px; display: block; padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); border: 0; border-top: 1px solid var(--border); background: rgba(255,255,255,.94); backdrop-filter: blur(14px); }.side-profile, .side-help { display: none; }.side-nav nav { grid-template-columns: repeat(4, 1fr); gap: 2px; }.nav-item { min-height: 48px; justify-content: center; flex-direction: column; gap: 2px; padding: 2px; font-size: 10px; }.nav-item svg { width: 17px; height: 17px; }
  .app-main { padding: 28px 16px calc(94px + env(safe-area-inset-bottom)); }.page-heading { align-items: flex-start; }.page-heading h1 { font-size: 30px; }.page-heading p { font-size: 13px; }.page-heading .compact { min-width: 44px; padding: 0 13px; }.page-heading .compact > span:not(:first-child) { display: none; }
  .summary-grid { grid-template-columns: 1fr 1fr; }.summary-card { min-height: 116px; padding: 16px; }.summary-card:last-child { grid-column: 1 / -1; }.project-grid { grid-template-columns: 1fr; }
  .plan-card { padding: 22px; }.plan-card ul { grid-template-columns: 1fr; }.plan-card .primary-button { max-width: none; }.wallet-column { grid-template-columns: 1fr 1fr; }.wallet-card, .expiry-card { min-height: 132px; padding: 17px; }.wallet-card b, .expiry-card b { font-size: 24px; }
  .order-head { display: none; }.order-row { grid-template-columns: 1fr auto; gap: 8px; }.order-row > *:nth-child(2), .order-row > *:nth-child(3) { grid-column: 1; }.order-row > *:last-child { grid-column: 2; grid-row: 1; }
  .setting-card { align-items: flex-start; padding: 18px; }.setting-card-head { align-items: flex-start; }.setting-card .quiet-button, .setting-card .danger-button { min-width: 94px; padding: 0 11px; }.session-row { align-items: flex-start; padding: 13px 0; }
}

@media (max-width: 430px) {
  .login-heading h2 { font-size: 24px; }.login-heading p { font-size: 12px; }.text-button { min-width: 105px; }
  .summary-grid, .wallet-column { grid-template-columns: 1fr; }.summary-card:last-child { grid-column: auto; }.page-heading { display: grid; }.page-heading .compact { width: 100%; }.membership-layout { gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Lovable visual system ----------------------------------------------------
   Warm paper surfaces, quiet hierarchy and compact creator-first controls.
   This layer intentionally leaves the existing routes and interactions intact. */
:root {
  --bg: #f7f4ed;
  --surface: #fcfbf8;
  --surface-soft: rgba(28, 28, 28, .045);
  --surface-dark: #1c1c1c;
  --text: #1c1c1c;
  --muted: #5f5f5d;
  --border: #eceae4;
  --border-strong: rgba(28, 28, 28, .4);
  --success: #256b50;
  --success-soft: rgba(37, 107, 80, .09);
  --danger: #a6443e;
  --danger-soft: rgba(166, 68, 62, .08);
  --focus: rgba(59, 130, 246, .5);
  --shadow-sm: inset 0 .5px 0 rgba(255, 255, 255, .72), 0 2px 8px rgba(28, 28, 28, .035);
  --shadow-md: inset 0 .5px 0 rgba(255, 255, 255, .76), 0 12px 34px rgba(28, 28, 28, .075);
  font-family: Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", ui-sans-serif, system-ui, -apple-system, sans-serif;
}

body {
  font-weight: 400;
  background:
    radial-gradient(circle at 7% 4%, rgba(255, 255, 255, .82), transparent 28rem),
    radial-gradient(circle at 91% 92%, rgba(222, 205, 184, .18), transparent 31rem),
    var(--bg);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .1);
}

.brand-mark,
.mobile-brand-mark {
  border-radius: 8px;
  font-weight: 600;
  box-shadow: inset 0 .5px 0 rgba(255, 255, 255, .2);
}

.environment-badge {
  border-color: rgba(37, 107, 80, .2);
  color: #285d49;
  background: rgba(37, 107, 80, .07);
  font-weight: 600;
}

.eyebrow,
.dialog-kicker {
  font-weight: 600;
}

/* Login */
.auth-shell {
  padding: 22px clamp(18px, 3.6vw, 52px);
}

.auth-shell::before {
  opacity: .2;
  background-image: radial-gradient(rgba(28, 28, 28, .16) .7px, transparent .7px);
  background-size: 30px 30px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .35), transparent 76%);
}

.auth-brand {
  font-weight: 600;
}

.auth-layout {
  width: min(1160px, 100%);
  min-height: 640px;
  grid-template-columns: minmax(0, 1.04fr) minmax(410px, .96fr);
  border-color: var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  backdrop-filter: none;
}

.auth-story {
  padding: clamp(42px, 5vw, 68px);
  background: #1c1c1c;
}

.auth-story::before {
  width: 620px;
  height: 620px;
  left: -270px;
  bottom: -340px;
  background: radial-gradient(circle, rgba(222, 205, 184, .2), transparent 68%);
}

.auth-story::after {
  width: 540px;
  height: 540px;
  right: -260px;
  top: -270px;
  background: radial-gradient(circle, rgba(174, 190, 181, .12), transparent 68%);
}

.story-copy .eyebrow,
.story-copy p,
.story-points {
  color: rgba(252, 251, 248, .62);
}

.story-copy h1 {
  margin: 22px 0 20px;
  max-width: 560px;
  font-size: clamp(36px, 4vw, 56px);
  font-weight: 600;
  letter-spacing: -.04em;
}

.story-copy p {
  line-height: 1.8;
}

.story-card {
  border-color: rgba(252, 251, 248, .2);
  border-radius: 12px;
  background: rgba(252, 251, 248, .055);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .15);
  backdrop-filter: blur(7px);
}

.story-card::before {
  border-radius: 6px;
  background:
    radial-gradient(circle at 22% 25%, rgba(252, 251, 248, .38), transparent 30%),
    linear-gradient(135deg, rgba(201, 192, 173, .5), rgba(131, 145, 139, .27) 60%, rgba(195, 166, 148, .34));
}

.story-points i {
  background: rgba(252, 251, 248, .72);
}

.auth-panel {
  padding: clamp(32px, 5vw, 68px);
  background: var(--surface);
}

.login-heading {
  margin-bottom: 30px;
}

.login-heading h2 {
  font-weight: 600;
  letter-spacing: -.03em;
}

.auth-mode-tabs {
  min-height: 46px;
  padding: 3px;
  border-radius: 8px;
  background: rgba(28, 28, 28, .04);
}

.auth-mode-tabs button {
  min-height: 38px;
  border-radius: 6px;
  font-weight: 600;
}

.auth-mode-tabs button[aria-selected="true"] {
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.form-field {
  font-weight: 600;
}

.input-wrap,
.code-wrap {
  border-color: var(--border);
  border-radius: 6px;
  background: #f7f4ed;
}

.input-wrap:hover,
.code-wrap:hover {
  border-color: rgba(28, 28, 28, .22);
}

.input-wrap:focus-within,
.code-wrap:focus-within {
  border-color: rgba(28, 28, 28, .4);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, .18), 0 4px 12px rgba(0, 0, 0, .06);
}

.form-field input::placeholder {
  color: rgba(28, 28, 28, .42);
}

.text-button {
  font-weight: 600;
}

.demo-notice {
  border-color: rgba(37, 107, 80, .18);
  border-radius: 8px;
  color: #285d49;
  background: rgba(37, 107, 80, .055);
}

.demo-notice span {
  color: #4c665b;
}

.primary-button,
.quiet-button,
.danger-button {
  min-height: 44px;
  border-radius: 12px;
  font-weight: 500;
}

.primary-button {
  border-radius: 999px;
  box-shadow: none;
}

.primary-button:hover {
  background: #292929;
}

/* Account center */
.app-header {
  height: 64px;
  border-color: var(--border);
  background: rgba(247, 244, 237, .9);
  backdrop-filter: blur(16px);
}

.app-brand {
  font-weight: 600;
}

.quiet-button,
.profile-chip,
.profile-menu {
  background: var(--surface);
}

#open-canvas-header, .profile-avatar, .chevron { flex-shrink: 0; }
#profile-phone { min-width: 0; max-width: min(32vw, 320px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#account-phone { overflow-wrap: anywhere; }
.setting-card > div { min-width: 0; max-width: 100%; }
.profile-chip {
  min-width: 0;
  border-color: var(--border);
}

.profile-menu {
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

.profile-menu button,
.profile-menu a {
  min-height: 42px;
  border-radius: 6px;
}

.app-layout {
  min-height: calc(100dvh - 64px);
  grid-template-columns: 228px minmax(0, 1fr);
}

.side-nav {
  top: 64px;
  height: calc(100dvh - 64px);
  padding: 28px 14px 20px;
  border-color: var(--border);
  background: rgba(247, 244, 237, .72);
}

.side-profile b,
.nav-item.active,
.side-help b {
  font-weight: 600;
}

.nav-item {
  border-radius: 6px;
}

.nav-item.active {
  background: rgba(28, 28, 28, .07);
}

.side-help {
  border-radius: 12px;
  background: rgba(252, 251, 248, .66);
}

.app-main {
  width: min(1160px, 100%);
  padding-top: 52px;
}

.app-view-panel.active {
  animation-duration: .28s;
}

.page-heading {
  margin-bottom: 34px;
}

.page-heading h1 {
  font-weight: 600;
  letter-spacing: -.04em;
}

.summary-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(0, .825fr) minmax(0, .825fr);
  gap: 12px;
}

.summary-card,
.project-card,
.wallet-card,
.expiry-card,
.card-surface,
.setting-card {
  border-color: var(--border);
  border-radius: 12px;
  background: rgba(252, 251, 248, .72);
  box-shadow: none;
}

.summary-card {
  min-height: 142px;
  padding: 22px;
}

.summary-card:first-child {
  background: #fcfbf8;
}

.summary-card b,
.wallet-card b,
.expiry-card b {
  font-weight: 600;
  letter-spacing: -.025em;
}

.project-grid {
  gap: 12px;
}

.project-card {
  padding: 12px;
}

.canvas-heading-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.canvas-heading-actions > button, #view-trash .quiet-button { min-height: 44px; }
#new-canvas { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px; white-space: nowrap; }
#view-trash .page-heading > div { min-width: 0; }
#view-trash .page-heading p { max-width: 600px; }
.trash-feedback { min-height: 24px; margin: 0 0 16px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.trash-feedback.is-error { color: var(--danger); }
.trash-card .project-meta { gap: 8px; }
.trash-card .project-meta .trash-expiry { color: var(--text); }
.trash-card .project-meta .trash-expiry.is-expired { color: var(--danger); }
.trash-card .project-actions button { min-height: 44px; flex: 1; }
.trash-card button:disabled { color: var(--muted); background: var(--surface-soft); cursor: not-allowed; opacity: 1; }
.trash-card .project-actions .danger-button { border-color: #e1b5b1; background: var(--danger-soft); color: var(--danger); }
.trash-card .project-actions .danger-button:hover:not(:disabled) { background: #f6dfdc; }
.trash-card .project-actions .danger-button:disabled { color: var(--muted); background: var(--surface-soft); }
.trash-purge-card .project-actions button { flex: 0 0 auto; }
.trash-purge-card .trash-purge-state { color: var(--text); }
.trash-pagination { display: flex; justify-content: center; padding: 24px 0; }
.trash-pagination [hidden] { display: none !important; }
@media (max-width: 600px) {
  .page-heading { grid-template-columns: minmax(0, 1fr); justify-content: stretch; }
  .canvas-heading-actions { width: 100%; min-width: 0; }
  .canvas-heading-actions > button { flex: 1 1 auto; min-width: max-content; white-space: nowrap; }
  #view-trash .page-heading { align-items: flex-start; gap: 16px; }
  #view-trash .page-heading > button { flex-shrink: 0; }
}

.project-preview {
  height: 96px;
  border-radius: 8px;
  background-color: #f7f4ed;
  background-image: radial-gradient(rgba(28, 28, 28, .16) .7px, transparent .7px);
  background-size: 15px 15px;
}

.project-preview::after {
  border-color: #dedbd3;
  border-radius: 6px;
  background: rgba(252, 251, 248, .9);
  box-shadow: 22px 8px 0 -5px rgba(252, 251, 248, .92), 22px 8px 0 -4px #dedbd3;
}

.project-preview[data-preview-count] {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
  gap: 2px;
}

.project-preview[data-preview-count]:not([data-preview-count="0"]) {
  border: 1px solid var(--border);
  background: var(--border);
}

.project-preview[data-preview-count]:not([data-preview-count="0"])::after {
  display: none;
}

.project-preview > img,
.project-preview > .project-preview-pending {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: cover;
  background: var(--surface-soft);
}

.project-preview[data-preview-count="1"] {
  grid-template-columns: minmax(0, 1fr);
}

.project-preview[data-preview-count="3"],
.project-preview[data-preview-count="4"] {
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.project-preview[data-preview-count="3"] > :first-child {
  grid-row: span 2;
}

.project-actions a,
.project-actions button {
  min-height: 38px;
  border-radius: 12px;
}

.empty-state {
  border-radius: 12px;
  background: rgba(252, 251, 248, .42);
}

.plan-card {
  border: 1px solid rgba(28, 28, 28, .95);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.plan-price b {
  font-weight: 600;
}

.wallet-card,
.expiry-card {
  border-radius: 12px;
}

.order-head {
  background: rgba(28, 28, 28, .035);
}

.setting-card {
  min-height: 106px;
}

dialog,
.confirm-card {
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(73, 55, 32, .12);
}

.pay-code {
  border-radius: 12px;
  background: var(--bg);
}

.toast {
  border-radius: 6px;
  box-shadow: 0 10px 28px rgba(28, 28, 28, .16);
}

@media (max-width: 980px) {
  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .auth-layout {
    border-radius: 16px;
  }

  .auth-panel {
    background: rgba(252, 251, 248, .94);
  }

  .app-header {
    height: 60px;
  }

  .side-nav {
    top: auto;
    height: 66px;
    background: rgba(247, 244, 237, .94);
  }

  .app-main {
    padding-top: 30px;
  }
}

@media (max-width: 430px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }
}

/* MC-004 login theme and brand banner ------------------------------------- */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.brand-logo {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 9px;
  object-fit: cover;
  box-shadow: 0 5px 18px rgba(28, 28, 28, .09);
}

.auth-brand {
  justify-content: space-between;
}

.auth-brand-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 13px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  box-shadow: inset 0 .5px 0 rgba(255, 255, 255, .64);
  font-size: 12px;
  font-weight: 600;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.theme-toggle:hover {
  border-color: var(--border-strong);
  background: var(--surface);
}

.theme-toggle:active {
  transform: scale(.97);
}

.theme-toggle-icon {
  font-size: 17px;
  line-height: 1;
}

.mobile-theme-toggle {
  display: none;
  margin-left: auto;
  width: 38px;
  padding: 0;
  justify-content: center;
}

.story-canvas {
  isolation: isolate;
}

.story-brand-logo {
  position: absolute;
  z-index: 4;
  width: clamp(122px, 12vw, 164px);
  height: clamp(122px, 12vw, 164px);
  left: 50%;
  top: 50%;
  border-radius: 24%;
  object-fit: cover;
  transform: translate(-50%, -50%) rotate(-2deg);
  box-shadow: 0 24px 60px rgba(28, 28, 28, .2);
}

.story-logo-halo {
  position: absolute;
  z-index: 1;
  width: 66%;
  aspect-ratio: 1;
  left: 50%;
  top: 50%;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: .12;
  transform: translate(-50%, -50%);
}

html[data-theme="light"] .auth-story {
  color: #25231f;
  background:
    radial-gradient(circle at 84% 14%, rgba(255, 255, 255, .7), transparent 31%),
    linear-gradient(145deg, #e6ddcc, #d7c9b5);
}

html[data-theme="light"] .story-copy .eyebrow,
html[data-theme="light"] .story-copy p,
html[data-theme="light"] .story-points {
  color: rgba(37, 35, 31, .64);
}

html[data-theme="light"] .story-card {
  border-color: rgba(37, 35, 31, .15);
  background: rgba(255, 255, 255, .18);
}

html[data-theme="light"] .story-points i {
  background: rgba(37, 35, 31, .68);
}

html[data-theme="light"] .story-line {
  background: rgba(37, 35, 31, .25);
}

html[data-theme="light"] .story-dot {
  background: #25231f;
  box-shadow: 0 0 0 5px rgba(37, 35, 31, .09);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111211;
  --surface: #1b1c1a;
  --surface-soft: rgba(255, 255, 255, .055);
  --surface-dark: #f2efe7;
  --surface-dark-text: #171816;
  --text: #f2efe7;
  --muted: #aaa9a3;
  --border: rgba(242, 239, 231, .12);
  --border-strong: rgba(242, 239, 231, .32);
  --success: #8dccb1;
  --success-soft: rgba(78, 151, 113, .13);
  --danger: #e48f86;
  --danger-soft: rgba(194, 91, 82, .12);
  --shadow-sm: inset 0 .5px 0 rgba(255, 255, 255, .08), 0 3px 12px rgba(0, 0, 0, .2);
  --shadow-md: inset 0 .5px 0 rgba(255, 255, 255, .08), 0 18px 46px rgba(0, 0, 0, .34);
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 7% 4%, rgba(255, 255, 255, .045), transparent 28rem),
    radial-gradient(circle at 91% 92%, rgba(152, 130, 101, .08), transparent 31rem),
    var(--bg);
}

html[data-theme="dark"] .auth-shell::before {
  background-image: radial-gradient(rgba(242, 239, 231, .16) .7px, transparent .7px);
}

html[data-theme="dark"] .auth-layout,
html[data-theme="dark"] .auth-panel,
html[data-theme="dark"] .auth-mode-tabs button[aria-selected="true"],
html[data-theme="dark"] .summary-card,
html[data-theme="dark"] .project-card,
html[data-theme="dark"] .wallet-card,
html[data-theme="dark"] .expiry-card,
html[data-theme="dark"] .card-surface,
html[data-theme="dark"] .setting-card {
  background: var(--surface);
}

html[data-theme="dark"] .auth-story {
  color: #f2efe7;
  background:
    radial-gradient(circle at 78% 17%, rgba(177, 149, 104, .12), transparent 34%),
    #111311;
}

html[data-theme="dark"] .input-wrap,
html[data-theme="dark"] .code-wrap,
html[data-theme="dark"] .project-preview,
html[data-theme="dark"] .pay-code {
  background-color: #151614;
}

html[data-theme="dark"] .form-field input::placeholder {
  color: rgba(242, 239, 231, .36);
}

html[data-theme="dark"] .primary-button,
html[data-theme="dark"] .profile-avatar,
html[data-theme="dark"] .side-avatar {
  color: #171816;
  background: #f2efe7;
  border-color: #f2efe7;
}

html[data-theme="dark"] .primary-button:hover {
  background: #fffdf7;
}

html[data-theme="dark"] .app-header,
html[data-theme="dark"] .side-nav {
  background: rgba(17, 18, 17, .9);
}

html[data-theme="dark"] .nav-item.active {
  background: rgba(242, 239, 231, .09);
}

html[data-theme="dark"] .plan-card {
  color: #171816;
  background: #ece6da;
  border-color: rgba(255, 255, 255, .4);
}

html[data-theme="dark"] .plan-card p,
html[data-theme="dark"] .plan-price span {
  color: #5d5a54;
}

@media (max-width: 760px) {
  .login-heading {
    position: relative;
  }

  .mobile-brand-logo,
  .mobile-theme-toggle {
    display: flex;
  }

  html[data-theme="dark"] .auth-panel {
    background: rgba(27, 28, 26, .96);
  }
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle {
    transition: none;
  }
}

/* MC-004 concept r2: one continuous creator workspace -------------------- */
.auth-shell {
  min-height: 100dvh;
  padding: 22px clamp(22px, 4vw, 58px) 18px;
}

.auth-shell::before {
  opacity: .13;
  mask-image: radial-gradient(circle at 34% 48%, #000 0, transparent 66%);
}

.auth-layout {
  width: min(1220px, 100%);
  min-height: 610px;
  grid-template-columns: minmax(0, 1fr) minmax(390px, 430px);
  gap: clamp(46px, 6vw, 92px);
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.auth-story {
  min-width: 0;
  min-height: 610px;
  padding: 48px 0 18px;
  color: var(--text);
  background: transparent !important;
  overflow: visible;
}

.auth-story::before {
  width: 540px;
  height: 540px;
  left: -190px;
  bottom: -210px;
  background: radial-gradient(circle, rgba(227, 168, 124, .2), transparent 68%);
}

.auth-story::after {
  width: 480px;
  height: 480px;
  right: -130px;
  top: -190px;
  background: radial-gradient(circle, rgba(139, 169, 203, .13), transparent 68%);
}

.story-copy {
  max-width: 660px;
}

.story-copy .eyebrow {
  color: var(--muted) !important;
  letter-spacing: .18em;
}

.story-copy h1 {
  max-width: 660px;
  margin: 18px 0 16px;
  color: var(--text);
  font-size: clamp(38px, 4.4vw, 62px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -.055em;
}

.story-copy p {
  max-width: 520px;
  color: var(--muted) !important;
  font-size: 15px;
  line-height: 1.75;
}

.story-canvas {
  width: min(660px, 100%);
  height: 300px;
  aspect-ratio: auto;
  margin: 8px 0 4px;
  align-self: flex-start;
}

.story-connections {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  color: var(--text);
}

.story-connections path {
  stroke: currentColor;
  stroke-width: 1.15;
  stroke-dasharray: 5 7;
  opacity: .18;
}

.story-connections circle {
  fill: var(--surface);
  stroke: currentColor;
  stroke-width: 1.2;
  opacity: .52;
}

.story-media {
  position: absolute;
  z-index: 2;
  overflow: hidden;
  margin: 0;
  border: 1px solid rgba(28, 28, 28, .11);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 42px rgba(86, 69, 50, .13);
}

.story-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.story-media figcaption {
  position: absolute;
  left: 10px;
  bottom: 10px;
  min-height: 24px;
  display: flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, .52);
  border-radius: 999px;
  padding: 0 9px;
  color: #fff;
  background: rgba(20, 20, 18, .38);
  backdrop-filter: blur(12px);
  font-size: 10px;
}

.story-media-main {
  width: 220px;
  height: 174px;
  left: 8px;
  top: 54px;
  transform: rotate(-2.5deg);
}

.story-media-side {
  width: 180px;
  height: 138px;
  right: 6px;
  top: 18px;
  transform: rotate(2deg);
}

.story-prompt-node {
  position: absolute;
  z-index: 4;
  left: 258px;
  bottom: 24px;
  width: min(340px, calc(100% - 270px));
  min-height: 76px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  border: 1px solid rgba(28, 28, 28, .1);
  border-radius: 15px;
  padding: 10px 11px;
  color: var(--text);
  background: rgba(252, 251, 248, .82);
  box-shadow: 0 18px 42px rgba(86, 69, 50, .14);
  backdrop-filter: blur(18px);
}

.story-prompt-brand {
  width: 44px;
  height: 44px;
  overflow: hidden;
  border-radius: 11px;
  box-shadow: 0 5px 15px rgba(28, 28, 28, .1);
}

.story-prompt-brand img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.story-prompt-node > div:nth-child(2) {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.story-prompt-node span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .14em;
}

.story-prompt-node strong {
  overflow: hidden;
  color: var(--text);
  font-size: 11px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-prompt-node i {
  min-height: 28px;
  display: flex;
  align-items: center;
  border-radius: 8px;
  padding: 0 10px;
  color: var(--surface);
  background: var(--text);
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
}

.story-points {
  gap: 24px;
  color: var(--muted) !important;
}

.story-points i,
html[data-theme="light"] .story-points i {
  background: var(--text);
  opacity: .54;
}

.auth-panel {
  width: 100%;
  align-self: center;
  justify-self: end;
  padding: 42px 40px;
  border: 1px solid rgba(28, 28, 28, .085);
  border-radius: 28px;
  background: rgba(252, 251, 248, .78);
  box-shadow: 0 10px 30px rgba(88, 68, 45, .09);
  backdrop-filter: blur(22px);
}

.login-card {
  width: 100%;
}

.login-heading {
  margin-bottom: 25px;
}

.login-heading .mobile-brand-logo {
  width: 92px;
  height: 92px;
  align-self: flex-start;
  border-radius: 20px;
}

.login-heading h2 {
  font-size: 25px;
}

.demo-notice {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
}

.demo-notice b {
  flex: 0 0 auto;
}

.demo-notice span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-theme="dark"] .auth-panel {
  border-color: rgba(242, 239, 231, .1);
  background: rgba(27, 28, 26, .78);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .22);
}

html[data-theme="dark"] .story-media {
  border-color: rgba(242, 239, 231, .12);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .3);
}

html[data-theme="dark"] .story-prompt-node {
  border-color: rgba(242, 239, 231, .11);
  background: rgba(31, 32, 30, .82);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .32);
}

html[data-theme="dark"] .story-prompt-node i {
  color: #171816;
  background: #f2efe7;
}

@media (max-width: 980px) {
  .auth-layout {
    grid-template-columns: minmax(0, 1fr) minmax(370px, 410px);
    gap: 34px;
  }

  .story-copy h1 {
    font-size: clamp(36px, 5vw, 50px);
  }

  .story-media-main {
    width: 190px;
    height: 150px;
  }

  .story-media-side {
    width: 155px;
    height: 120px;
  }

  .story-prompt-node {
    left: 215px;
    width: calc(100% - 220px);
  }
}

@media (max-width: 760px) {
  .auth-shell {
    padding: 14px;
  }

  .auth-layout {
    min-height: calc(100dvh - 28px);
    display: grid;
    grid-template-columns: 1fr;
  }

  .auth-panel {
    width: min(440px, 100%);
    justify-self: center;
    padding: 34px 25px;
    border-radius: 18px;
  }
}

/* MC-0409: keep the story geometry stable while auth forms grow. */
.auth-shell {
  overflow-x: hidden;
  overflow-y: auto;
}

.auth-layout {
  align-self: start;
  margin: 0 auto;
  background: transparent;
}

.auth-story {
  height: 610px;
  min-height: 610px;
  align-self: start;
}

html[data-theme="dark"] .auth-layout {
  background: transparent;
}

/* V0.2 points-only recharge packages */
.credit-package-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.credit-package-card {
  position: relative;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.credit-package-card.is-recommended { border-color: var(--online-m3-outline); background: var(--online-m3-raised); box-shadow: none; }
html[data-theme="dark"] .credit-package-card.is-recommended { border-color: var(--online-m3-outline); background: var(--online-m3-raised); }
.credit-package-head { min-height: 28px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 700; }
.credit-recommended { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; color: var(--online-m3-tonal-ink); background: var(--online-m3-tonal); font-size: 12px; font-weight: 500; }
.credit-recommended svg { width: 13px; height: 13px; }
.credit-package-price { margin: 24px 0 16px; font-size: 36px; line-height: 1; letter-spacing: -.04em; }
.credit-package-card p { display: grid; gap: 3px; margin: 0 0 16px; }
.credit-package-card p strong { font-size: 16px; }
.credit-package-card p span, .credit-package-card li { color: var(--muted); font-size: 11px; }
.credit-package-card ul { display: grid; gap: 7px; margin: 0 0 20px; padding-left: 18px; }
.credit-package-card .primary-button { width: 100%; margin-top: auto; }
.credit-package-skeleton { grid-column: 1 / -1; padding: 32px; border: 1px solid var(--border); border-radius: 16px; color: var(--muted); background: var(--surface); text-align: center; }
.wallet-only-layout { grid-template-columns: 1fr; }
.wallet-summary-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.expiry-card #member-state { font: var(--ui-title-medium); letter-spacing: normal; margin: 6px 0 8px; }
.sessions-card .setting-card-head { align-items: center; }
.sessions-card .setting-card-head > div { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; min-width: 0; }
.sessions-card .setting-card-head > div > span,
.sessions-card .setting-card-head > div > b,
.sessions-card .setting-card-head > div > p { display: block; grid-column: 1; margin: 0; }
.sessions-card .setting-card-head > div > b { font: var(--ui-title-medium); }
@media (max-width: 900px) { .credit-package-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .wallet-summary-column { grid-template-columns: 1fr; } }

.project-title-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.project-title-row .project-title { min-width: 0; flex: 1; }
.project-rename-button { flex: none; min-height: 40px; padding: 4px 6px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font: inherit; font-size: 12px; white-space: nowrap; cursor: pointer; }
.project-rename-button:hover { color: var(--text); background: var(--surface-soft); }
.project-rename-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 760px) { .project-rename-button { min-height: 44px; } .auth-footer a { min-height: 44px; } }
.project-rename-form { display: grid; gap: 10px; padding: 24px; text-align: left; }
.project-rename-form h2 { margin: 0 0 8px; font-size: 20px; }
.project-rename-form label { font-size: 13px; font-weight: 600; }
.project-rename-form input { width: 100%; min-width: 0; min-height: 42px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.project-rename-form input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.project-rename-form p { margin: 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
#project-rename-feedback { color: var(--text); line-height: 1.6; }
#project-rename-feedback:empty { display: none; }
#project-rename-reload[hidden] { display: none; }
.project-rename-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
#project-rename-dialog .project-rename-actions button { width: auto; flex: 0 0 auto; }
#project-rename-dialog { max-height: calc(100dvh - 32px); overflow: auto; }

/* M3 T7: user-page surfaces and states on the existing Web controls. */
:root {
  --online-m3-shell: #f8f3e9;
  --online-m3-raised: #faf6ee;
  --online-m3-card: #fffcf6;
  --online-m3-outline: #ded3c0;
  --online-m3-tonal: #e9dcc5;
  --online-m3-tonal-hover: #dcc9a8;
  --online-m3-tonal-ink: #3e3022;
  --online-m3-focus: #6d4f30;
  --focus: var(--online-m3-focus);
  --online-m3-disabled: #e9e4d9;
  --online-m3-disabled-ink: #61594d;
  --online-m3-badge: #e4f4ec;
  --online-m3-badge-ink: #205c45;
  --online-m3-badge-outline: #a9cbb9;
}
html[data-theme="dark"] {
  --online-m3-shell: #24211e;
  --online-m3-raised: #292724;
  --online-m3-card: #302c27;
  --online-m3-outline: #554b3e;
  --online-m3-tonal: #514637;
  --online-m3-tonal-hover: #685943;
  --online-m3-tonal-ink: #f5e8d1;
  --online-m3-focus: #ebd1a4;
  --online-m3-disabled: #37332e;
  --online-m3-disabled-ink: #b7ab98;
  --online-m3-badge: #31443a;
  --online-m3-badge-ink: #c5eed7;
  --online-m3-badge-outline: #577766;
}

.auth-panel,
.profile-menu,
dialog,
.confirm-card { border-color: var(--online-m3-outline); background: var(--online-m3-shell); }
.login-card,
.summary-card,
.project-card,
.wallet-card,
.expiry-card,
.card-surface,
.setting-card,
.credit-package-card { border-color: var(--online-m3-outline); background: var(--online-m3-card); }
.summary-card,
.project-card,
.wallet-card,
.expiry-card,
.setting-card,
.credit-package-card { border-radius: 16px; }
.app-header,
.side-nav { border-color: var(--online-m3-outline); }
.side-help { border-color: var(--online-m3-outline); color: var(--text); background: var(--online-m3-card); }
.environment-badge { border-color: var(--online-m3-badge-outline); color: var(--online-m3-badge-ink); background: var(--online-m3-badge); }

.auth-mode-tabs { border-color: var(--online-m3-outline); background: var(--online-m3-raised); }
.auth-mode-tabs button[aria-selected="true"],
.nav-item.active { color: var(--online-m3-tonal-ink); background: var(--online-m3-tonal); box-shadow: none; }
.auth-mode-tabs button:hover,
.nav-item:hover,
.profile-menu button:hover,
.profile-menu a:hover { color: var(--online-m3-tonal-ink); background: var(--online-m3-tonal-hover); }
.input-wrap,
.code-wrap,
#project-rename-input { border-color: var(--online-m3-outline); border-radius: 12px; background: var(--online-m3-card); }
.form-field input::placeholder { color: var(--muted); opacity: 1; }
.input-wrap:focus-within,
.code-wrap:focus-within,
#project-rename-input:focus-visible { border-color: var(--online-m3-focus); box-shadow: 0 0 0 2px var(--online-m3-focus); }
.form-message:not(:empty),
.trash-feedback.is-error,
#project-rename-feedback:not(:empty) { overflow-wrap: anywhere; line-height: 1.5; }
.form-message:not(:empty),
.trash-feedback.is-error { color: var(--danger); }
.primary-button:disabled,
.quiet-button:disabled,
.text-button:disabled { border-color: var(--online-m3-outline); color: var(--online-m3-disabled-ink); background: var(--online-m3-disabled); opacity: 1; }
html[data-theme="dark"] .primary-button:disabled { border-color: var(--online-m3-outline); color: var(--online-m3-disabled-ink); background: var(--online-m3-disabled); }
.primary-button.loading .button-spinner { border-color: color-mix(in srgb, var(--surface-dark-text) 30%, transparent); border-top-color: var(--surface-dark-text); }
.auth-secondary-action:focus-visible,
.project-rename-button:focus-visible,
.auth-mode-tabs button:focus-visible,
.nav-item:focus-visible,
.project-actions a:focus-visible,
.project-actions button:focus-visible,
.order-status button:focus-visible,
.quiet-button:focus-visible,
.primary-button:focus-visible,
.danger-button:focus-visible { outline: 2px solid var(--online-m3-focus); outline-offset: 2px; }

.summary-card:first-child,
.empty-state { background: var(--online-m3-raised); }
.project-card:hover { border-color: var(--border-strong); }
.project-actions button,
.quiet-button,
.profile-chip { border-color: var(--online-m3-outline); background: var(--online-m3-card); }
.project-actions button:hover,
.quiet-button:hover,
.profile-chip:hover { border-color: var(--border-strong); background: var(--online-m3-raised); }
.project-title-row .project-title { overflow-wrap: anywhere; }
.record-row,
.order-row,
.session-row { border-color: var(--online-m3-outline); }
.order-head { color: var(--online-m3-tonal-ink); background: var(--online-m3-tonal); }
.order-head,
.order-row,
.record-row,
.credit-package-price,
.wallet-card b,
.summary-card b { font-variant-numeric: tabular-nums; }
.order-row { min-width: 0; }
.order-row > *,
.record-row > *,
.session-row > * { min-width: 0; overflow-wrap: anywhere; }
.order-row .order-status { max-width: 100%; }
.danger-card { border-color: var(--online-m3-outline); }
.danger-button,
.trash-card .project-actions .danger-button { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.danger-button:hover,
.trash-card .project-actions .danger-button:hover:not(:disabled) { background: var(--danger-soft); }
.credit-package-skeleton { border-color: var(--online-m3-outline); color: var(--muted); background: var(--online-m3-card); }
#project-rename-dialog { border-radius: 28px; }

html[data-theme="dark"] :is(.auth-panel, .profile-menu, dialog, .confirm-card) { background: var(--online-m3-shell); }
html[data-theme="dark"] :is(.summary-card, .project-card, .wallet-card, .expiry-card, .card-surface, .setting-card, .credit-package-card) { background: var(--online-m3-card); }
html[data-theme="dark"] .summary-card:first-child { background: var(--online-m3-raised); }
html[data-theme="dark"] .auth-mode-tabs button[aria-selected="true"],
html[data-theme="dark"] .nav-item.active { color: var(--online-m3-tonal-ink); background: var(--online-m3-tonal); }
html[data-theme="dark"] .form-field input::placeholder { color: var(--online-m3-disabled-ink); opacity: 1; }

@media (max-width: 760px) {
  .side-nav { padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
  .order-row > * { min-width: 0; }
  .order-row > :last-child { white-space: normal; }
  .setting-card,
  .setting-card-head,
  .session-row { flex-wrap: wrap; }
  .setting-card-head { flex-direction: column; align-items: stretch; }
  .sessions-card .setting-card-head { align-items: stretch; }
  .setting-card-head .quiet-button { align-self: flex-start; }
}

/* Shared Material type roles, adapted to compact Chinese UI. Scene, legal and mono content opt out. */
:root {
  --ui-font: Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --ui-title-medium: 500 16px/24px var(--ui-font);
  --ui-body-large: 400 16px/24px var(--ui-font);
  --ui-body-medium: 400 14px/20px var(--ui-font);
  --ui-body-small: 400 12px/16px var(--ui-font);
  --ui-label-large: 500 14px/20px var(--ui-font);
}

/* Auth tabs, account menu, forms and dialog actions use the same role scale. */
button, input, select, textarea { font-family: inherit; }
.auth-mode-tabs button, .primary-button, .quiet-button, .danger-button,
.text-button, .auth-secondary-action, .nav-item, .profile-chip,
.project-actions button, .project-actions a, .order-status button,
.project-rename-button, .project-rename-actions button, .credit-package-card .primary-button,
.theme-toggle { font: var(--ui-label-large); }
.auth-mode-tabs button { min-height: 40px; border-radius: 12px; }
.profile-menu button, .profile-menu a { min-height: 40px; border-radius: 12px; font: var(--ui-body-medium); }
.form-field, .project-rename-form label { font: var(--ui-label-large); }
.form-field input, .project-rename-form input { font: var(--ui-body-large); }
.form-field small, .project-rename-form p, .dialog-kicker,
.pay-status, .summary-card > span, .credit-package-card li,
.credit-package-card p span, .setting-card > div > span,
.session-row span, .toast { font: var(--ui-body-small); }
.eyebrow, .dialog-kicker { font: var(--ui-body-small); font-weight: 500; letter-spacing: .04em; }
.login-heading h2, .content-heading h2, .confirm-card h2,
.dialog-body h2, .project-rename-form h2 { font: var(--ui-title-medium); }
.page-heading h1 { font: 400 24px/32px var(--ui-font); letter-spacing: -.02em; }
.login-heading p, .page-heading p, .confirm-card p,
.dialog-body > p, .credit-package-card p { font: var(--ui-body-medium); line-height: 22px; }
.credit-package-head { font: var(--ui-title-medium); }
.credit-recommended { font: var(--ui-body-small); font-weight: 500; }
dialog, .confirm-card { border-radius: 28px; }
.dialog-close { width: 40px; height: 40px; border-radius: 12px; font: var(--ui-label-large); }
.profile-menu { min-width: 196px; }
@media (max-width: 760px) {
  .side-nav .nav-item { font: var(--ui-body-small); font-weight: 500; }
  .page-heading h1 { font: 400 22px/28px var(--ui-font); }
}

/* Material Symbols Rounded paths are self-hosted in this document. */
.ui-symbol-defs { position:absolute; width:0; height:0; overflow:hidden; pointer-events:none; }
.ui-icon { width:20px; height:20px; display:inline-block; flex:none; fill:currentColor; stroke:none; }
.theme-toggle-icon { display:inline-flex; align-items:center; }
html[data-theme="dark"] .theme-toggle-icon .ui-icon:first-child,
html:not([data-theme="dark"]) .theme-toggle-icon .ui-icon:last-child { display:none; }
.chevron .ui-icon { width:20px; height:20px; }
.dialog-close .ui-icon { width:24px; height:24px; }
.credit-recommended .ui-icon { width:16px; height:16px; }

/* Selected navigation uses the same label weight as its peers. */
.nav-item.active { font-weight: 500; }

/* Auth visual consolidation: a single warm surface and a clear status region. */
.auth-panel,
html[data-theme="dark"] .auth-panel {
  border-color: var(--online-m3-outline);
  background: var(--online-m3-shell);
}
.login-card { background: transparent; }
.login-heading { margin-bottom: 20px; }
.login-heading h2 { font: var(--ui-title-medium); }
.login-heading .environment-badge { display: none; }
.auth-mode-tabs { margin-top: 4px; }
#login-message {
  min-height: 0;
  margin: 0;
  font: var(--ui-body-small);
}
#login-message:not(:empty) {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--online-m3-outline);
  border-radius: 12px;
  background: var(--online-m3-raised);
}
body[data-session-state="session_replaced"] #login-message { color: var(--text); }
#login-form .primary-button { min-height: 44px; border-radius: 999px; box-shadow: none; }
#login-form .agreement-row { margin-top: 16px; }
#login-form .login-footnote { margin-top: 12px; }
.auth-story::before { opacity: .48; }
.auth-story::after { opacity: .38; }
.story-connections { opacity: .48; }
.story-media { box-shadow: 0 8px 24px rgba(86, 69, 50, .1); }
html[data-theme="dark"] .story-media { box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.story-media-side figcaption { display: none; }
.story-prompt-node {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 64px;
  border-color: var(--online-m3-outline);
  border-radius: 16px;
  background: var(--online-m3-card);
  box-shadow: 0 8px 24px rgba(86, 69, 50, .1);
  backdrop-filter: none;
}
html[data-theme="dark"] .story-prompt-node {
  border-color: var(--online-m3-outline);
  background: var(--online-m3-card);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}
.story-prompt-node span { font: var(--ui-body-small); }
.story-prompt-node strong { font: var(--ui-body-medium); }
.story-prompt-node i { font: var(--ui-label-large); border-radius: 12px; }
@media (max-width: 760px) {
  .auth-panel,
  html[data-theme="dark"] .auth-panel { border-radius: 24px; background: var(--online-m3-shell); }
  .login-heading .environment-badge { display: inline-flex; }
}
@media (min-width: 761px) {
  .login-heading .mobile-brand-logo { display: none; }
}
@media (max-width: 760px) {
  .login-heading .mobile-brand-logo { width: 48px; height: 48px; border-radius: 12px; }
}
.story-media figcaption { font: var(--ui-body-small); }
.story-media-side figcaption { display: flex; }
#login-form .agreement-row { min-height: 40px; margin-bottom: 16px; padding-block: 4px; }
@media (max-width: 760px) {
  .login-heading { display: grid; grid-template-columns: 48px minmax(0, 1fr); column-gap: 14px; align-items: start; }
  .login-heading .mobile-brand-logo { grid-column: 1; }
  .login-heading > div { min-width: 0; grid-column: 2; }
  .login-heading .mobile-theme-toggle { position: absolute; top: 0; right: 0; }
  .login-heading p { text-wrap: balance; }
}
.story-media figcaption { font-weight: 500; }

/* MC-0568: account password form reuses the online M3 surface and field roles. */
#account-password-dialog { max-height: calc(100dvh - 32px); overflow: auto; }
.account-password-form { text-align: left; }
.account-password-form h2 { padding-right: 28px; }
.account-password-identity { display: grid; gap: 4px; }
.account-password-identity span { color: var(--muted); font: var(--ui-body-small); }
.account-password-identity b { overflow-wrap: anywhere; font: var(--ui-body-medium); }
.account-password-form .form-field { margin-top: 16px; }
.account-password-form #account-password-feedback { margin: 16px 0; min-height: 22px; color: var(--danger); }
.account-password-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.account-password-actions button { min-height: 44px; }
@media (max-width: 600px) { .account-password-form { padding: 26px 20px; } }

/* Invitation sharing stays on the account page's existing M3 surface. */
.referrals-card { display: grid; grid-template-columns: minmax(0, 1fr); justify-content: stretch; align-items: stretch; gap: 20px; min-width: 0; }
.referrals-card .setting-card-head { width: 100%; flex-direction: row; flex-wrap: nowrap; align-items: center; }
.referrals-card h2 { margin: 0; font: var(--ui-title-medium); color: var(--text); }
.referrals-card .text-button { min-width: 44px; min-height: 40px; padding: 0 6px; border: 0; align-self: center; color: var(--muted); font: var(--ui-label-large); }
.referrals-card .text-button:hover { color: var(--text); }
.referrals-card .referrals-note { margin: 0; color: var(--muted); font: var(--ui-body-medium); overflow-wrap: anywhere; }
.referrals-card .referrals-share { display: grid; grid-template-columns: minmax(0, 1fr) max-content; align-items: end; gap: 12px; min-width: 0; }
.referrals-link-field { display: grid; gap: 8px; min-width: 0; }
.referrals-link-field > span { color: var(--muted); font: var(--ui-body-small); }
.referrals-link-field input { width: 100%; min-width: 0; min-height: 48px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 12px; color: var(--text); background: var(--surface-soft); font: var(--ui-body-medium); text-overflow: ellipsis; }
.referrals-link-field input::selection { color: var(--surface-dark-text); background: var(--surface-dark); }
.referrals-share .primary-button { width: auto; min-height: 48px; white-space: nowrap; }
.referrals-card .referrals-code-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.referrals-code-row > span { color: var(--muted); font: var(--ui-body-small); }
.referrals-card .referrals-code { margin: 0; font: var(--ui-body-small); font-weight: 500; letter-spacing: .04em; overflow-wrap: anywhere; user-select: all; }
.referrals-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin: 0; }
.referrals-summary dt { color: var(--muted); font: var(--ui-body-small); }
.referrals-summary dd { margin: 6px 0 0; font: var(--ui-title-medium); font-variant-numeric: tabular-nums; }
.referrals-more { border-top: 1px solid var(--border); padding-top: 8px; }
.referrals-more details > summary { width: fit-content; min-height: 44px; padding: 12px 0; color: var(--text); font: var(--ui-body-medium); cursor: pointer; }
.referrals-more details[open] > summary { margin-bottom: 4px; }
.referrals-more details > p + p { margin-top: 8px; }
.referrals-records { min-width: 0; }
.referrals-records .record-row { gap: 16px; }
.referrals-records .record-row > div { min-width: 0; overflow-wrap: anywhere; }
.referrals-records .record-row > b { flex-shrink: 0; }
@media (max-width: 600px) {
  .referrals-card .referrals-share { grid-template-columns: minmax(0, 1fr); }
  .referrals-share .primary-button { width: 100%; }
}

/* Brand spelling is MoCanvas; Canvas retains the former Studio weight. */
.brand-wordmark-tail { font-weight: 400; }
