:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1020;
  --bg-alt: #10182c;
  --panel: linear-gradient(180deg, rgba(21, 31, 54, 0.96), rgba(28, 39, 68, 0.94));
  --panel-soft: rgba(13, 21, 39, 0.92);
  --surface: rgba(15, 23, 40, 0.94);
  --surface-strong: rgba(8, 12, 20, 0.92);
  --ink: #eef4ff;
  --muted: #9fb0d3;
  --border: #2a375d;
  --accent: #6ea8fe;
  --accent-strong: #4f92fb;
  --success: #28c76f;
  --warning: #ffb020;
  --danger: #ea5455;
  --cyan: #24c8db;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --font-body: "Sora", "Avenir Next", "Segoe UI", sans-serif;
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef3f8;
  --bg-alt: #f6f9fc;
  --panel: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 252, 0.96));
  --panel-soft: rgba(255, 255, 255, 0.92);
  --surface: rgba(255, 255, 255, 0.94);
  --surface-strong: rgba(247, 250, 255, 0.94);
  --ink: #182438;
  --muted: #5a708c;
  --border: rgba(24, 36, 56, 0.14);
  --accent: #2f68db;
  --accent-strong: #1f57cf;
  --success: #209b65;
  --warning: #c88417;
  --danger: #d25555;
  --cyan: #229eb0;
  --shadow: 0 18px 40px rgba(44, 72, 114, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 14%, rgba(110, 168, 254, 0.2), transparent 24%),
    radial-gradient(circle at 84% 18%, rgba(36, 200, 219, 0.14), transparent 16%),
    radial-gradient(circle at 50% 100%, rgba(234, 84, 85, 0.08), transparent 20%),
    linear-gradient(180deg, var(--bg), #08101b 60%, #060b14 100%);
  overflow-x: hidden;
}

html[data-theme="light"] body {
  background:
    radial-gradient(circle at 14% 14%, rgba(47, 104, 219, 0.12), transparent 24%),
    radial-gradient(circle at 84% 18%, rgba(34, 158, 176, 0.1), transparent 16%),
    linear-gradient(180deg, #f6f9fc 0%, #eef3f8 60%, #e7edf5 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 999px;
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
}

body::before {
  top: 10%;
  left: -110px;
  width: 320px;
  height: 320px;
  background: rgba(110, 168, 254, 0.16);
}

body::after {
  right: -110px;
  bottom: 8%;
  width: 360px;
  height: 360px;
  background: rgba(36, 200, 219, 0.14);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 1rem;
}

.portal-frame {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 20px 18px 56px;
}

.portal-background {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 12% 18%, rgba(110, 168, 254, 0.16), transparent 24%),
    radial-gradient(circle at 88% 20%, rgba(36, 200, 219, 0.12), transparent 18%),
    radial-gradient(circle at 50% 92%, rgba(234, 84, 85, 0.08), transparent 24%);
  pointer-events: none;
}

.topbar,
.main-nav,
.page-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  margin: 0 auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.topbar-title,
.hero-panel h1,
.settings-header h2,
.settings-section-head h3,
.sheet-header h2 {
  margin: 0;
  line-height: 1;
  letter-spacing: -0.04em;
}

.topbar-title {
  max-width: 640px;
  font-size: clamp(2rem, 3.4vw, 2.85rem);
  font-weight: 800;
  font-family: "Manrope", sans-serif;
}

.topbar-eyebrow {
  margin: 0 0 6px;
}

.topbar-subtitle {
  margin: 8px 0 0;
  max-width: 54ch;
  color: var(--muted);
  font-size: 0.96rem;
}

.topbar-side {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.theme-toggle-button {
  min-width: 118px;
}

.theme-floating-toggle {
  position: static;
  right: auto;
  top: auto;
  bottom: auto;
  z-index: auto;
  min-width: 118px;
  box-shadow: none;
}

.topbar-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 40, 0.9);
  color: var(--ink);
  white-space: nowrap;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(159, 176, 211, 0.7);
}

.status-dot.is-online {
  background: var(--success);
  box-shadow: 0 0 14px rgba(40, 199, 111, 0.55);
}

.tenant-chip {
  min-width: 220px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(15, 23, 40, 0.82);
  box-shadow: var(--shadow);
  color: var(--ink);
}

.tenant-chip span,
.tenant-chip strong,
.tenant-chip small {
  display: block;
}

.tenant-chip span,
.tenant-chip small {
  color: var(--muted);
}

.tenant-chip span {
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tenant-chip strong {
  margin-top: 6px;
  font-size: 1.02rem;
}

.topbar-cta {
  min-width: 168px;
}

.main-nav {
  margin-top: 0;
  margin-bottom: 28px;
}

.main-nav-shell {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(8, 12, 20, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 12px 15px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 40, 0.9);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.nav-link:hover {
  transform: translateY(-1px);
  border-color: rgba(110, 168, 254, 0.4);
  color: var(--ink);
}

.nav-link.is-active {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: #08101b;
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(110, 168, 254, 0.22);
}

.page-shell {
  display: block;
}

.badge,
.hero-kicker,
.settings-kicker {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.2rem;
  padding: 0 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.brand-name {
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
  letter-spacing: -0.01em;
}

.ghost-button,
.icon-button,
.resource-button,
.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 1.08rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.ghost-button:hover,
.icon-button:hover,
.resource-button:hover,
.button-secondary:hover {
  transform: translateY(-1px);
  border-color: rgba(110, 168, 254, 0.4);
  background: rgba(18, 28, 49, 0.96);
}

.chat-main {
  display: flex;
  justify-content: center;
  padding: 0 0 1.4rem;
}

.chat-stage {
  width: min(100%, 960px);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-stage.is-empty {
  justify-content: center;
  min-height: calc(100vh - 144px);
}

.chat-toolbar {
  display: flex;
  justify-content: flex-end;
}

.chat-clear-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.chat-clear-button:hover {
  transform: translateY(-1px);
  border-color: rgba(110, 168, 254, 0.4);
  background: rgba(18, 28, 49, 0.96);
}

.hero-panel {
  max-width: 860px;
  margin: 0 auto;
  padding: 1.6rem 1rem 1.8rem;
  text-align: center;
}

.hero-panel h1 {
  margin: 1rem 0 0.8rem;
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 5vw, 4.8rem);
  font-weight: 600;
  letter-spacing: -0.055em;
  line-height: 0.95;
  color: var(--ink);
}

.hero-copy {
  max-width: 720px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  padding: 0.4rem 0 10.2rem;
}

.message {
  max-width: min(860px, 100%);
  width: fit-content;
  white-space: pre-wrap;
  line-height: 1.65;
}

.message.user {
  align-self: flex-end;
  width: min(100%, 36rem);
  padding: 1rem 1.18rem;
  border-radius: 1.4rem 1.4rem 0.6rem 1.4rem;
  color: #08101b;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  box-shadow: 0 16px 32px rgba(110, 168, 254, 0.22);
}

.message.assistant {
  align-self: stretch;
  width: 100%;
  padding: 1.2rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 1.6rem;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--ink);
  backdrop-filter: blur(18px);
}

.chat-form {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background:
    linear-gradient(180deg, rgba(11, 16, 32, 0), rgba(11, 16, 32, 0.9) 36%, #08101b 100%);
  padding-top: 1.4rem;
  padding-bottom: calc(0.4rem + env(safe-area-inset-bottom));
}

.input-shell {
  display: flex;
  align-items: flex-end;
  gap: 0.9rem;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 1.7rem;
  background: linear-gradient(180deg, rgba(21, 31, 54, 0.96), rgba(28, 39, 68, 0.94));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

#promptInput {
  width: 100%;
  min-height: 28px;
  max-height: 220px;
  padding: 0.55rem 0.2rem;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.6;
}

#promptInput::placeholder {
  color: rgba(159, 176, 211, 0.7);
}

.send-button {
  min-height: 48px;
  padding: 0 1.25rem;
  border: none;
  border-radius: 1rem;
  font-weight: 700;
  color: #08101b;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  box-shadow: 0 14px 26px rgba(110, 168, 254, 0.22);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.send-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(110, 168, 254, 0.28);
}

.send-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.status-label {
  min-height: 1.3rem;
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.resource-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.85rem;
  padding-bottom: 1rem;
}

.resource-button {
  position: relative;
  overflow: hidden;
  font-weight: 600;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 11, 20, 0.68);
  backdrop-filter: blur(10px);
  z-index: 30;
}

.settings-panel,
.content-sheet {
  position: fixed;
  z-index: 40;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(21, 31, 54, 0.98), rgba(28, 39, 68, 0.96));
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(20px);
}

.settings-panel {
  top: 0;
  right: 0;
  width: min(92vw, 540px);
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.settings-header,
.content-sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.45rem;
  border-bottom: 1px solid var(--border);
}

.settings-header h2,
.content-sheet-header h2 {
  margin: 0.45rem 0 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.settings-body {
  overflow-y: auto;
  padding: 1.3rem 1.45rem 1.8rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.05rem;
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  background: rgba(13, 21, 39, 0.58);
}

.settings-section-head {
  display: grid;
  gap: 0.8rem;
}

.settings-section-head h3 {
  margin: 0.45rem 0 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.settings-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.65;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.field input,
.field textarea {
  padding: 0.92rem 1rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: rgba(15, 23, 40, 0.96);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.field textarea[readonly] {
  background: rgba(10, 17, 30, 0.92);
  color: rgba(238, 244, 255, 0.9);
}

.generated-prompt-textarea {
  min-height: 170px;
  max-height: 240px;
  overflow-y: auto;
}

.generated-prompt-textarea.is-expanded {
  min-height: 320px;
  max-height: 520px;
}

.field input:focus,
.field textarea:focus,
#promptInput:focus {
  outline: none;
}

.field input:focus,
.field textarea:focus {
  border-color: rgba(110, 168, 254, 0.42);
  box-shadow:
    0 0 0 4px rgba(110, 168, 254, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.field textarea {
  resize: vertical;
}

.field textarea.compact-textarea {
  min-height: 52px;
  max-height: 180px;
  resize: none;
  overflow-y: hidden;
}

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

.range-value {
  font-size: 0.86rem;
  color: var(--muted);
}

.settings-actions {
  display: flex;
  justify-content: flex-start;
}

.settings-status {
  min-height: 1.3rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.settings-status[data-state="success"] {
  color: var(--success);
}

.settings-status[data-state="error"] {
  color: var(--danger);
}

.asset-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.assets-list {
  display: grid;
  gap: 0.9rem;
}

.asset-empty,
.asset-card {
  border: 1px solid var(--border);
  border-radius: 1.15rem;
  background: rgba(10, 17, 30, 0.86);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.asset-empty {
  padding: 1rem;
  color: var(--muted);
  line-height: 1.6;
}

.asset-card {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
}

.asset-card.is-error {
  border-color: rgba(234, 84, 85, 0.45);
}

.asset-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
}

.asset-card-title {
  display: grid;
  gap: 0.28rem;
  min-width: 0;
}

.asset-card-title strong {
  font-size: 0.98rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.asset-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.asset-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(15, 23, 40, 0.92);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.asset-status-pill[data-state="ready"] {
  color: var(--success);
}

.asset-status-pill[data-state="processing"] {
  color: var(--warning);
}

.asset-status-pill[data-state="error"] {
  color: var(--danger);
}

.asset-rename-row,
.asset-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.asset-rename-input {
  flex: 1 1 14rem;
  min-width: 0;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.95rem;
  background: rgba(15, 23, 40, 0.96);
  color: var(--ink);
}

.asset-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 1rem;
  border: 1px solid var(--border);
  border-radius: 0.95rem;
  background: rgba(15, 23, 40, 0.96);
  color: var(--ink);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}

.asset-action-button:hover {
  transform: translateY(-1px);
  border-color: rgba(110, 168, 254, 0.4);
}

.asset-action-button.is-danger:hover {
  border-color: rgba(234, 84, 85, 0.45);
}

.asset-action-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.asset-summary {
  margin: 0;
  color: rgba(238, 244, 255, 0.92);
  font-size: 0.9rem;
  line-height: 1.65;
  white-space: pre-wrap;
}

.asset-summary[data-state="error"] {
  color: #ffb2b2;
}

.content-sheet {
  left: 50%;
  bottom: 1.2rem;
  transform: translateX(-50%);
  width: min(980px, calc(100vw - 2rem));
  max-height: calc(100vh - 2.4rem);
  border-radius: 1.7rem;
  overflow: hidden;
}

.content-sheet-body {
  margin: 0;
  padding: 1.2rem 1.45rem 1.6rem;
  overflow-y: auto;
  max-height: calc(100vh - 9rem);
  background: rgba(13, 21, 39, 0.82);
  color: var(--ink);
  font-family: var(--font-body);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.7;
}

[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .topbar {
    width: calc(100% - 1.25rem);
    margin-top: 0.75rem;
    padding: 0.9rem 0.95rem;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .brand-lockup {
    flex: 1 1 16rem;
    min-width: 0;
  }

  .chat-main {
    padding: 1rem 1rem 1.15rem;
  }

  .chat-stage.is-empty {
    min-height: calc(100dvh - 122px);
  }

  .hero-panel {
    padding-inline: 0.35rem;
  }

  .resource-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .resource-button {
    width: 100%;
    text-align: center;
  }

  .content-sheet {
    width: calc(100vw - 1rem);
    bottom: 0.5rem;
  }

  .content-sheet-body {
    max-height: calc(100dvh - 8rem);
  }
}

@media (max-width: 720px) {
  .main-nav {
    width: calc(100% - 0.85rem);
    margin-bottom: 18px;
    overflow-x: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .main-nav-shell {
    display: inline-flex;
    gap: 0.6rem;
    min-width: 100%;
    width: max-content;
    grid-template-columns: none;
    padding: 0.6rem;
    overflow: visible;
  }

  .main-nav::-webkit-scrollbar {
    height: 7px;
  }

  .main-nav::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(110, 168, 254, 0.34);
  }

  .main-nav::-webkit-scrollbar-track {
    background: rgba(15, 23, 40, 0.3);
  }

  .nav-link {
    flex: 0 0 auto;
    min-height: 46px;
    padding: 0 1rem;
  }

  .topbar {
    width: calc(100% - 0.85rem);
    margin-top: 0.45rem;
    padding: 0.78rem 0.8rem;
    gap: 0.75rem;
  }

  .brand-lockup {
    gap: 0.55rem;
    flex-wrap: wrap;
  }

  .topbar > * {
    width: 100%;
  }

  .ghost-button,
  .resource-button,
  .icon-button,
  .send-button {
    width: 100%;
  }

  .chat-main {
    padding: 0.45rem 0.75rem 1rem;
  }

  .chat-stage {
    gap: 0.85rem;
  }

  .chat-stage.is-empty {
    min-height: calc(100dvh - 148px);
  }

  .chat-toolbar {
    justify-content: stretch;
  }

  .chat-clear-button {
    width: 100%;
  }

  .hero-panel {
    padding: 0.15rem 0 0.55rem;
    text-align: left;
  }

  .hero-panel h1 {
    margin: 0.72rem 0 0.6rem;
    font-size: clamp(2.15rem, 12vw, 3.2rem);
    line-height: 0.98;
  }

  .hero-copy {
    margin: 0;
    font-size: 0.96rem;
  }

  .chat-log {
    gap: 1rem;
    padding-bottom: 9rem;
  }

  .message,
  .message.user,
  .message.assistant {
    width: 100%;
    max-width: 100%;
  }

  .message.assistant {
    padding: 1rem;
    border-radius: 1.35rem;
  }

  .input-shell {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.78rem;
    border-radius: 1.35rem;
  }

  #promptInput {
    min-height: 52px;
    padding: 0.25rem 0;
  }

  .resource-actions {
    grid-template-columns: 1fr;
    gap: 0.7rem;
    padding-bottom: 0.2rem;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .asset-card-head,
  .asset-rename-row,
  .asset-actions,
  .asset-toolbar {
    flex-direction: column;
  }

  .asset-status-pill,
  .asset-action-button,
  .asset-rename-input {
    width: 100%;
  }

  .settings-panel {
    width: 100vw;
    max-width: none;
  }

  .settings-header,
  .content-sheet-header {
    padding: 1rem 1rem 0.9rem;
  }

  .settings-body {
    padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
  }

  .content-sheet {
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;
    width: 100%;
    max-height: min(100dvh, 100%);
    border-radius: 1.4rem 1.4rem 0 0;
  }

  .content-sheet-body {
    padding: 1rem 1rem calc(1.15rem + env(safe-area-inset-bottom));
    max-height: calc(100dvh - 6rem);
  }
}

@media (max-width: 420px) {
  .badge,
  .hero-kicker,
  .settings-kicker {
    font-size: 0.66rem;
    letter-spacing: 0.08em;
  }

  .brand-name {
    font-size: 0.88rem;
  }

  .hero-panel h1 {
    font-size: 2rem;
  }
}

html[data-theme="light"] .portal-background {
  background:
    radial-gradient(circle at 12% 18%, rgba(47, 104, 219, 0.1), transparent 24%),
    radial-gradient(circle at 88% 20%, rgba(34, 158, 176, 0.08), transparent 18%),
    radial-gradient(circle at 50% 92%, rgba(210, 85, 85, 0.06), transparent 24%);
}

html[data-theme="light"] .topbar,
html[data-theme="light"] .main-nav,
html[data-theme="light"] .tenant-chip,
html[data-theme="light"] .topbar-status-pill,
html[data-theme="light"] .button-secondary,
html[data-theme="light"] .ghost-button,
html[data-theme="light"] .resource-button,
html[data-theme="light"] .input-shell,
html[data-theme="light"] .message.assistant,
html[data-theme="light"] .settings-panel,
html[data-theme="light"] .settings-section,
html[data-theme="light"] .content-sheet,
html[data-theme="light"] .field input,
html[data-theme="light"] .field textarea {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(24, 36, 56, 0.12);
  color: var(--ink);
}

html[data-theme="light"] .button-secondary:hover,
html[data-theme="light"] .ghost-button:hover,
html[data-theme="light"] .resource-button:hover,
html[data-theme="light"] .nav-link:hover,
html[data-theme="light"] .nav-link.is-active {
  background: rgba(47, 104, 219, 0.1);
  border-color: rgba(47, 104, 219, 0.18);
  color: var(--accent-strong);
}

html[data-theme="light"] .chat-stage,
html[data-theme="light"] .settings-panel,
html[data-theme="light"] .content-sheet {
  color: var(--ink);
}

html[data-theme="light"] .hero-copy,
html[data-theme="light"] .settings-copy,
html[data-theme="light"] .status-label,
html[data-theme="light"] .tenant-chip span,
html[data-theme="light"] .tenant-chip small,
html[data-theme="light"] .topbar-subtitle {
  color: var(--muted);
}
