:root {
  --color-header: #172321;
  --color-page: #f4f7f6;
  --color-surface: #ffffff;
  --color-surface-alt: #f7faf9;
  --color-text: #182421;
  --color-muted: #687571;
  --color-border: #dce5e2;
  --color-border-strong: #b9c9c4;
  --color-link: #0a6c63;
  --color-primary: #0f766e;
  --color-primary-hover: #0a5c56;
  --color-primary-soft: #e8f6f3;
  --color-accent: #ed765b;
  --color-success: #2f7d4f;
  --color-warning: #b26a00;
  --color-danger: #c0392b;
  --shadow-panel: 0 1px 2px rgba(17, 39, 34, 0.05), 0 10px 24px rgba(17, 39, 34, 0.05);
  --focus-ring: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-primary);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--color-page);
  color: var(--color-text);
  font-family: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.text-input:focus-visible {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.login-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 32px 18px;
  background: var(--color-page);
}

.login-shell {
  display: grid;
  gap: 18px;
  width: min(420px, 100%);
}

.login-card {
  display: grid;
  gap: 18px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 28px 30px 24px;
  background: var(--color-surface);
  box-shadow: var(--shadow-panel);
}

.google-icon svg {
  display: block;
}

.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-self: center;
  font-weight: 800;
}

.login-card h1 {
  margin-bottom: 8px;
  font-size: 26px;
}

.login-description {
  margin-bottom: 0;
  color: var(--color-muted);
  line-height: 1.55;
}

.login-form {
  display: grid;
  gap: 14px;
}

.google-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-color: var(--color-border-strong);
  background: #ffffff;
  color: var(--color-text);
}

.google-button:hover {
  border-color: var(--color-primary);
  color: var(--color-link);
}

.google-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
}

.provider-note {
  margin: -2px 0 0;
  color: var(--color-muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
}

.auth-footer {
  margin: 0;
  border-top: 1px solid var(--color-border);
  padding-top: 18px;
  color: var(--color-muted);
  text-align: center;
  line-height: 1.55;
}

.link-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--color-link);
  font-weight: 800;
}

.app-root {
  min-height: 100vh;
}

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

button {
  cursor: pointer;
}

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

h1 {
  margin-bottom: 6px;
  font-size: 30px;
  line-height: 1.2;
  font-weight: 700;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.3;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  min-height: 56px;
  padding: 8px 24px;
  background: var(--color-header);
  color: #ffffff;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: #ffffff;
  text-decoration: none;
}

.brand-symbol {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 8px;
  background: #fbfaf7;
}

.brand-symbol img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-account {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
  min-width: 0;
  color: #d5dbdb;
  font-size: 13px;
  font-weight: 700;
}

.friend-switcher {
  display: block;
  min-width: 0;
}

.friend-switcher select {
  width: min(240px, 30vw);
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  padding: 0 30px 0 10px;
  background: #ffffff;
  color: var(--color-text);
  font-weight: 800;
}

.header-icon-button,
.dialog-close {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  padding: 0;
  background: transparent;
  color: #ffffff;
  font-size: 21px;
  line-height: 1;
}

.header-icon-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.account-identity {
  max-width: 180px;
  overflow: hidden;
  border-left: 1px solid rgba(255, 255, 255, 0.22);
  padding-left: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-account .link-button {
  flex: 0 0 auto;
  color: #d5dbdb;
}

.app-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: calc(100vh - 56px);
}

.side-nav {
  border-right: 1px solid var(--color-border);
  background: #ffffff;
}

.side-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 52px;
  border-bottom: 1px solid var(--color-border);
  padding: 17px 22px 12px;
  font-size: 15px;
  font-weight: 800;
}

.side-toggle {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--color-muted);
  font-size: 20px;
  font-weight: 800;
}

.side-toggle:hover {
  color: var(--color-primary);
}

.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border-left: 4px solid transparent;
  padding: 12px 18px;
  color: var(--color-text);
  font-size: 14px;
  text-decoration: none;
}

.side-icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  color: var(--color-muted);
  font-weight: 900;
}

.side-link.active {
  border-left-color: var(--color-primary);
  background: var(--color-primary-soft);
  color: var(--color-primary-hover);
  font-weight: 700;
}

.app-main {
  min-width: 0;
  padding: 22px 32px 48px;
}

.sidebar-collapsed {
  grid-template-columns: 76px minmax(0, 1fr);
}

.sidebar-collapsed .side-title {
  justify-content: center;
  padding-inline: 12px;
}

.sidebar-collapsed .side-label {
  display: none;
}

.sidebar-collapsed .side-link {
  justify-content: center;
  padding-inline: 12px;
}

.breadcrumbs {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 28px;
  margin-bottom: 12px;
  color: var(--color-muted);
  font-size: 13px;
}

.breadcrumbs a {
  color: var(--color-link);
  text-decoration: none;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.page-description,
.help-text {
  margin-bottom: 0;
  color: var(--color-muted);
  line-height: 1.55;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.container {
  min-width: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 18px;
  padding: 20px;
  background: var(--color-surface);
  box-shadow: var(--shadow-panel);
}

.container-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.legal-checklist {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.legal-checklist label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  line-height: 1.6;
}

.legal-checklist input {
  margin-top: 5px;
}

.ai-builder {
  border-color: rgba(15, 118, 110, 0.34);
  background: #ffffff;
}

.first-run-intro {
  display: none;
  max-width: 760px;
  margin-bottom: 26px;
}

.first-run-intro h1 {
  margin-bottom: 12px;
  font-size: 34px;
}

.first-run-intro p:last-child {
  margin: 0;
  color: var(--color-muted);
  font-size: 17px;
  line-height: 1.75;
}

.builder-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.builder-submit {
  gap: 8px;
  min-width: 148px;
  min-height: 104px;
}

.app-root.is-first-run .app-layout,
.app-root.is-generating .app-layout {
  grid-template-columns: minmax(0, 1fr);
}

.app-root.is-first-run .side-nav,
.app-root.is-first-run .breadcrumbs,
.app-root.is-first-run #editView > .page-header,
.app-root.is-generating .side-nav,
.app-root.is-generating .breadcrumbs {
  display: none;
}

.app-root.is-first-run .app-main,
.app-root.is-generating .app-main {
  width: min(860px, 100%);
  margin-inline: auto;
  padding-top: 64px;
}

.app-root.is-first-run .ai-builder {
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.app-root.is-first-run .first-run-intro {
  display: block;
}

.app-root.is-first-run .builder-secondary-header {
  display: none;
}

.app-root.is-first-run .builder-form {
  grid-template-columns: minmax(0, 1fr);
  max-width: 760px;
}

.app-root.is-first-run .builder-submit {
  min-height: 46px;
  justify-self: start;
}

.app-root.is-generating #editView > :not(#generationView) {
  display: none !important;
}

.generation-view {
  display: grid;
  gap: 26px;
  padding-bottom: 40px;
}

.generation-visual {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-panel);
}

.generation-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: generation-drift 12s ease-in-out infinite alternate;
}

.generation-scan {
  position: absolute;
  inset: 0;
  width: 18%;
  background: rgba(15, 118, 110, 0.09);
  transform: skewX(-10deg) translateX(-140%);
  animation: generation-scan 3.6s ease-in-out infinite;
}

.generation-copy {
  max-width: 700px;
}

.generation-copy h1 {
  margin-bottom: 12px;
}

.generation-stage {
  margin-bottom: 14px;
  color: var(--color-primary-hover);
  font-size: 18px;
  font-weight: 700;
}

.generation-progress {
  width: min(520px, 100%);
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--color-border);
}

.generation-progress span {
  display: block;
  width: 38%;
  height: 100%;
  border-radius: inherit;
  background: var(--color-primary);
  animation: generation-progress 1.8s ease-in-out infinite;
}

.generation-note {
  margin: 14px 0 0;
  color: var(--color-muted);
  font-size: 14px;
  line-height: 1.6;
}

@keyframes generation-drift {
  from {
    transform: scale(1.01) translate3d(-0.2%, 0, 0);
  }
  to {
    transform: scale(1.045) translate3d(0.8%, -0.4%, 0);
  }
}

@keyframes generation-scan {
  0%,
  20% {
    transform: skewX(-10deg) translateX(-140%);
  }
  80%,
  100% {
    transform: skewX(-10deg) translateX(680%);
  }
}

@keyframes generation-progress {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(360%);
  }
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--color-border-strong);
  border-radius: 8px;
  padding: 6px 18px;
  background: #ffffff;
  color: var(--color-link);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

.button:active {
  transform: scale(0.98);
}

.button:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  color: var(--color-primary-hover);
}

.button-primary {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #ffffff;
}

.button-primary:hover {
  border-color: var(--color-primary-hover);
  background: var(--color-primary-hover);
  color: #ffffff;
}

.usage-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.usage-grid-single {
  grid-template-columns: minmax(220px, 360px);
}

.usage-card {
  display: grid;
  gap: 6px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 16px;
  background: var(--color-surface-alt);
}

.usage-card span,
.usage-card small {
  color: var(--color-muted);
  font-weight: 800;
}

.usage-card strong {
  font-size: 26px;
  line-height: 1.1;
}

.usage-card.highlight {
  border-color: rgba(15, 118, 110, 0.34);
  background: var(--color-primary-soft);
}

.usage-meter {
  height: 10px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe8e5;
}

.usage-meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--color-primary);
}

.billing-note {
  margin: 12px 0 0;
  color: var(--color-muted);
  font-size: 14px;
  line-height: 1.55;
}

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

.plan-card {
  display: grid;
  gap: 10px;
  align-content: start;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 16px;
  background: var(--color-surface);
}

.plan-card.current {
  border-color: rgba(15, 118, 110, 0.55);
  box-shadow: inset 0 0 0 2px rgba(15, 118, 110, 0.1);
}

.plan-card h3,
.plan-card p {
  margin: 0;
}

.plan-card strong {
  font-size: 22px;
}

.button-compact {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 13px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 3px 11px;
  background: #ffffff;
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge.success {
  border-color: rgba(3, 127, 12, 0.28);
  background: #f2fcf3;
  color: var(--color-success);
}

.status-badge.warning {
  border-color: rgba(178, 106, 0, 0.3);
  background: #fff8e6;
  color: var(--color-warning);
}

.kv-grid {
  display: grid;
  margin: 0;
}

.kv-grid div {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 20px;
  border-top: 1px solid var(--color-border);
  padding: 14px 0;
}

.kv-grid div:first-child {
  border-top: 0;
  padding-top: 0;
}

.kv-grid div:last-child {
  padding-bottom: 0;
}

.kv-grid dt {
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 800;
}

.kv-grid dd {
  margin: 0;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

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

.form-grid.dense {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.research-grid > div {
  min-width: 0;
  border-top: 1px solid var(--color-border);
  padding: 14px 0;
}

.research-grid > div:nth-child(-n + 2) {
  border-top: 0;
  padding-top: 0;
}

.research-grid > .wide {
  grid-column: 1 / -1;
}

.research-grid h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.research-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 20px;
  color: var(--color-text);
  line-height: 1.55;
}

.source-list a {
  color: var(--color-link);
  overflow-wrap: anywhere;
}

.line-credential-form {
  margin: 4px 0 20px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 20px;
}

.credential-note {
  margin: 0;
  color: var(--color-muted);
  font-size: 13px;
  line-height: 1.55;
}

.credential-note.wide,
.credential-actions.wide {
  grid-column: 1 / -1;
}

.credential-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

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

.field span {
  color: var(--color-text);
  font-size: 13px;
  font-weight: 800;
}

.text-input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--color-border-strong);
  border-radius: 8px;
  padding: 7px 10px;
  background: #ffffff;
  color: var(--color-text);
}

.textarea {
  min-height: 104px;
  resize: vertical;
}

.textarea.small {
  min-height: 76px;
}

.input-suffix {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.input-suffix span {
  color: var(--color-muted);
}

.time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.time-window-control {
  display: grid;
  gap: 10px;
}

.time-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.time-window-track {
  position: relative;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe8e5;
}

.time-window-track span {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 75%;
  width: 16.666%;
  border-radius: inherit;
  background: var(--color-primary);
}

.time-window-control small {
  color: var(--color-muted);
  font-weight: 700;
}

.field > small {
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 48px;
  height: 26px;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  width: 100%;
  border-radius: 999px;
  background: #879596;
  transition: background 0.2s ease;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: var(--shadow-panel);
  transition: transform 0.2s ease;
}

.switch input:checked + span {
  background: var(--color-primary);
}

.switch input:checked + span::after {
  transform: translateX(22px);
}

.segmented-control {
  display: inline-flex;
  gap: 4px;
  min-height: 38px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 3px;
  background: #e8eeec;
}

.segmented-control button {
  border: 0;
  border-radius: 6px;
  padding: 6px 14px;
  background: transparent;
  color: var(--color-text);
  font-weight: 800;
}

.segmented-control button.active {
  background: #ffffff;
  color: var(--color-link);
  box-shadow: 0 1px 2px rgba(0, 7, 22, 0.12);
}

.test-surface {
  margin-top: 14px;
}

.test-chat {
  display: grid;
  align-content: start;
  gap: 10px;
  height: 282px;
  overflow: auto;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 12px;
  background: var(--color-surface-alt);
}

.test-message {
  max-width: 88%;
  margin: 0;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 14px;
  line-height: 1.5;
}

.test-message.fan {
  justify-self: end;
  background: var(--color-primary-soft);
  color: var(--color-primary-hover);
}

.test-message.ai {
  justify-self: start;
  border: 1px solid var(--color-border);
  background: #ffffff;
}

.chat-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 10px;
}

.button.chat-send-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
}

.chat-send-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auto-result {
  min-height: 92px;
  margin-top: 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 12px;
  background: var(--color-surface-alt);
  line-height: 1.55;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.app-dialog {
  width: min(440px, calc(100vw - 32px));
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 24px 70px rgba(0, 7, 22, 0.28);
}

.legal-dialog {
  width: min(680px, calc(100vw - 32px));
}

.app-dialog::backdrop {
  background: rgba(8, 18, 16, 0.55);
}

.dialog-form {
  display: grid;
  gap: 20px;
  padding: 22px;
}

.dialog-header,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-header h2 {
  margin: 0;
}

.dialog-close {
  border-color: var(--color-border);
  color: var(--color-muted);
}

.dialog-actions {
  justify-content: flex-end;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  min-width: 220px;
  max-width: min(380px, calc(100vw - 44px));
  min-height: 42px;
  border-radius: 8px;
  padding: 11px 14px;
  background: var(--color-header);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(0, 7, 22, 0.24);
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  background: #1f6b3f;
}

.toast.warning {
  background: #8a5400;
}

.toast.error {
  background: var(--color-danger);
}

/* Flow hint */
.flow-hint {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin: 0 0 18px;
  border: 1px solid rgba(15, 118, 110, 0.28);
  border-radius: 8px;
  padding: 11px 14px;
  background: var(--color-primary-soft);
  color: var(--color-primary-hover);
  font-size: 13px;
  line-height: 1.55;
}

.flow-hint b {
  font-weight: 700;
}

/* Usage warning */
.usage-card.highlight.warning {
  border-color: rgba(192, 57, 43, 0.4);
  background: #fdecea;
}

.usage-card.highlight.warning strong {
  color: var(--color-danger);
}

.usage-meter span.warning {
  background: var(--color-danger);
}

/* Advanced disclosure (native details) */
.advanced-disclosure {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  margin-top: 16px;
  padding: 0 16px;
  background: var(--color-surface-alt);
}

.advanced-disclosure > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 2px;
  color: var(--color-text);
  font-size: 14px;
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}

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

.advanced-disclosure > summary::before {
  content: "›";
  display: inline-grid;
  place-items: center;
  width: 18px;
  color: var(--color-primary);
  font-size: 18px;
  transition: transform 0.15s ease;
}

.advanced-disclosure[open] > summary::before {
  transform: rotate(90deg);
}

.advanced-disclosure[open] > summary {
  border-bottom: 1px solid var(--color-border);
}

.advanced-disclosure .form-grid {
  padding: 16px 0 18px;
}

/* Billing list */
.billing-list {
  display: grid;
  gap: 0;
}

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

.billing-row:first-child {
  border-top: 0;
}

.billing-row .billing-primary {
  font-weight: 700;
}

.billing-row .billing-sub {
  color: var(--color-muted);
  font-size: 13px;
}

.billing-amount {
  font-weight: 700;
  white-space: nowrap;
}

.link-action {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--color-link);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.link-action.danger {
  color: var(--color-danger);
}

/* Connection detail rows */
.connection-detail {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: var(--color-muted);
  font-size: 13px;
}

.connection-detail div {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.connection-detail dt {
  min-width: 92px;
  font-weight: 700;
}

.connection-detail dd {
  min-width: 0;
  margin: 0;
  color: var(--color-text);
  overflow-wrap: anywhere;
}

@media (max-width: 1100px) {
  .form-grid.dense {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .usage-grid,
  .plan-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .app-header {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    padding: 8px 14px;
  }

  .app-account {
    justify-self: end;
    max-width: 100%;
    font-size: 12px;
  }

  .friend-switcher select {
    width: min(180px, 34vw);
  }

  .account-identity {
    display: none;
  }

  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .side-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--color-border);
  }

  .side-title {
    border-bottom: 0;
    white-space: nowrap;
  }

  .side-toggle {
    display: none;
  }

  .sidebar-collapsed .side-label {
    display: inline;
  }

  .side-link {
    border-left: 0;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
  }

  .side-link.active {
    border-bottom-color: var(--color-primary);
  }

  .app-main {
    padding: 16px 14px 34px;
  }

  .page-header,
  .container-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .kv-grid div,
  .form-grid,
  .form-grid.dense,
  .builder-form,
    .research-grid,
    .usage-grid,
    .plan-grid,
    .time-row {
    grid-template-columns: 1fr;
  }

  .research-grid > div:nth-child(2) {
    border-top: 1px solid var(--color-border);
    padding-top: 14px;
  }

  .button {
    width: 100%;
  }

  .segmented-control {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .billing-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .billing-row .billing-amount {
    grid-column: 2;
  }

  .link-action {
    width: auto;
  }

  h1 {
    font-size: 28px;
  }

  .app-root.is-first-run .app-main,
  .app-root.is-generating .app-main {
    padding-top: 34px;
  }

  .first-run-intro h1 {
    font-size: 30px;
  }

  .first-run-intro p:last-child {
    font-size: 15px;
  }

  .builder-submit {
    min-height: 44px;
  }

  .generation-view {
    gap: 20px;
  }
}

@media (max-width: 600px) {
  .app-brand strong {
    display: none;
  }

  .app-header,
  .app-account {
    gap: 8px;
  }

  .friend-switcher select {
    width: min(142px, 38vw);
  }
}
