/* Sofia v3 mobile application surface.
   Loaded only up to 760px. Mobile is not a stacked desktop page: navigation and project rails
   become drawers so the primary task stays readable. */

body.page-v3-shell {
  --mobile-header-height: 58px;
  --mobile-rail-height: 48px;
  overflow-y: hidden;
  overflow-x: hidden;
  min-height: 100svh;
  height: 100svh;
  font-size: 14px;
  background:
    radial-gradient(circle at 8% 8%, rgba(70, 215, 208, 0.18), transparent 34%),
    radial-gradient(circle at 92% 0%, rgba(243, 184, 90, 0.14), transparent 30%),
    linear-gradient(160deg, #030a12 0%, #071623 52%, #02070d 100%);
}

body.page-v3-shell .site-header {
  height: var(--mobile-header-height);
  background: rgba(3, 10, 18, 0.78);
  backdrop-filter: blur(18px);
}

body.page-v3-shell .site-header .site-shell.site-nav {
  width: calc(100vw - 20px);
}

body.page-v3-shell .site-nav {
  min-height: var(--mobile-header-height);
  height: var(--mobile-header-height);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 0;
  align-items: center;
}

body.page-v3-shell .brand {
  min-width: 0;
  gap: 9px;
}

body.page-v3-shell .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  font-size: 0.94rem;
}

body.page-v3-shell .brand-copy strong {
  font-size: 1rem;
  letter-spacing: 0.2em;
}

body.page-v3-shell .brand-copy span {
  display: none;
}

body.page-v3-shell .nav-toggle {
  display: inline-flex;
  grid-column: 2;
  grid-row: 1;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  border-color: rgba(214, 231, 238, 0.16);
  background: rgba(255, 255, 255, 0.055);
}

body.page-v3-shell .nav-links,
body.page-v3-shell .nav-actions {
  position: fixed;
  left: 10px;
  right: 10px;
  z-index: 80;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  padding: 12px;
  border: 1px solid rgba(214, 231, 238, 0.14);
  border-radius: 22px;
  background: rgba(5, 14, 24, 0.86);
  backdrop-filter: blur(22px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

body.page-v3-shell .nav-links {
  top: calc(var(--mobile-header-height) + 8px);
}

body.page-v3-shell .nav-actions {
  top: calc(var(--mobile-header-height) + 190px);
}

body.page-v3-shell .site-nav.nav-open .nav-links,
body.page-v3-shell .site-nav.nav-open .nav-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

body.page-v3-shell .nav-link,
body.page-v3-shell .button,
body.page-v3-shell .chip-button {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 14px;
  font-size: 0.82rem;
  white-space: nowrap;
}

body.page-v3-shell .workspace-main,
body.page-v3-shell .page-main {
  height: calc(100svh - var(--mobile-header-height));
  padding: 10px 0;
  overflow: hidden;
}

body.page-v3-shell.page-account .workspace-main,
body.page-v3-shell.page-account .page-main {
  height: calc(100svh - var(--mobile-header-height));
  min-height: calc(100svh - var(--mobile-header-height));
  overflow: hidden;
}

body.page-v3-shell.page-account .account-main {
  overflow: auto;
}

body.page-v3-shell .site-shell,
body.page-v3-shell .workspace-main .site-shell {
  width: calc(100vw - 20px);
}

body.page-v3-shell .chat-shell,
body.page-v3-shell .workspace-side-card,
body.page-v3-shell .login-panel,
body.page-v3-shell .doc-card,
body.page-v3-shell .pricing-card,
body.page-v3-shell .surface-note,
body.page-v3-shell .info-card,
body.page-v3-shell .health-card {
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    rgba(7, 17, 27, 0.80);
}

body.page-v3-shell .eyebrow {
  margin-bottom: 8px;
  padding: 5px 9px;
  font-size: 0.58rem;
}

body.page-v3-shell .chat-top h1,
body.page-v3-shell .workspace-top h1 {
  font-size: clamp(1.35rem, 8vw, 2rem);
  line-height: 1.02;
}

body.page-v3-shell .chat-top p,
body.page-v3-shell .workspace-top p {
  margin: 5px 0 0;
  font-size: 0.82rem;
  line-height: 1.35;
}

body.page-v3-shell .state-pill {
  min-height: 26px;
  padding: 0 9px;
  font-size: 0.68rem;
}

.page-workspace .workspace-layout,
.page-projects .project-board-layout {
  height: 100%;
  display: block;
}

.page-workspace:not(.page-projects) .workspace-copilot-side {
  display: none;
}

.page-workspace:not(.page-projects) .workspace-chat-shell,
.page-projects .project-chat-shell {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(214, 231, 238, 0.15);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018)),
    rgba(8, 17, 29, 0.84);
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.34);
}

.page-projects .project-chat-shell {
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: calc(100% - var(--mobile-rail-height) - 8px);
}

.page-workspace .workspace-top,
.page-projects .project-chat-shell .workspace-top {
  padding: 14px 14px 10px;
}

.page-projects .project-chat-shell .workspace-top {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 9px;
  text-align: center;
}

.page-projects .project-chat-shell .workspace-top > div {
  display: grid;
  justify-items: center;
}

.page-projects .project-chat-shell .workspace-top p {
  max-width: 34ch;
}

.page-workspace .workspace-top-state,
.page-projects .workspace-top-state {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.page-projects .project-chat-shell .workspace-top-state {
  justify-content: center;
  flex-wrap: wrap;
  overflow-x: visible;
}

.page-workspace .workspace-access-note {
  margin: 0 14px 8px;
  padding: 10px 12px;
  font-size: 0.82rem;
}

.page-workspace .workspace-messages,
.page-projects .workspace-messages {
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(214, 231, 238, 0.10);
  background: rgba(3, 6, 13, 0.84);
}

.page-workspace .message,
.page-projects .message {
  max-width: 94%;
  font-size: 0.9rem;
  line-height: 1.48;
}

.page-workspace .workspace-form,
.page-projects .workspace-form {
  padding: 10px 14px 12px;
  border-top: 1px solid rgba(214, 231, 238, 0.11);
  border-radius: 12px;
  border: 1px solid rgba(214, 231, 238, 0.10);
  background: rgba(255, 255, 255, 0.032);
}

.page-workspace .workspace-form label,
.page-projects .workspace-form label {
  font-size: 0.74rem;
}

.page-workspace .workspace-form textarea,
.page-projects .workspace-form textarea {
  min-height: 74px;
  max-height: 90px;
  border-radius: 12px;
  border: 1px solid rgba(150, 170, 255, 0.25);
  background: rgba(0, 0, 0, 0.32);
  font-size: 0.9rem;
}

.page-workspace .workspace-top h1,
.page-projects .workspace-top h1 {
  font-size: clamp(1.05rem, 5.5vw, 1.3rem);
  letter-spacing: 0.01em;
  line-height: 1.12;
}

.page-workspace .workspace-top p,
.page-projects .workspace-top p {
  font-size: 0.84rem;
}

.page-workspace .quick-prompts,
.page-workspace .composer-tools,
.page-projects .quick-prompts,
.page-projects .composer-tools {
  display: none;
}

.page-workspace:not(.page-projects) #workspace-premium-panel {
  display: none !important;
}

.project-mobile-rail {
  position: sticky;
  top: 0;
  z-index: 45;
  display: flex;
  width: calc(100vw - 20px);
  height: var(--mobile-rail-height);
  margin: 0 auto 8px;
  gap: 8px;
}

.project-drawer-toggle {
  flex: 1 1 0;
  min-height: 40px;
  border: 1px solid rgba(214, 231, 238, 0.16);
  border-radius: 999px;
  color: #f7ffff;
  background: rgba(7, 17, 27, 0.72);
  backdrop-filter: blur(16px);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 900;
}

.project-drawer-close {
  display: flex;
  width: 100%;
  min-height: 38px;
  margin: 0 0 8px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(214, 231, 238, 0.16);
  border-radius: 16px;
  color: #f7ffff;
  background: rgba(255, 255, 255, 0.06);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 900;
}

.page-projects .project-side-panel {
  position: fixed;
  top: calc(var(--mobile-header-height) + 10px);
  bottom: 12px;
  z-index: 70;
  width: min(370px, calc(100vw - 28px));
  overflow: auto;
  padding: 8px;
  border: 1px solid rgba(214, 231, 238, 0.13);
  border-radius: 24px;
  background: rgba(5, 14, 24, 0.76);
  backdrop-filter: blur(22px);
  box-shadow: 0 24px 76px rgba(0, 0, 0, 0.46);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.page-projects .project-side-left {
  left: 10px;
  transform: translateX(calc(-100% - 16px));
}

.page-projects .project-side-right {
  right: 10px;
  transform: translateX(calc(100% + 16px));
}

.page-projects .project-side-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.page-projects .project-side-panel .workspace-side-card {
  margin-bottom: 10px;
  padding: 13px;
}

.page-projects .workspace-side-list {
  max-height: 58svh;
  overflow: auto;
}

body.page-v3-shell:not(.page-workspace) .page-main {
  overflow: auto;
}

body.page-v3-shell:not(.page-workspace) .doc-card,
body.page-v3-shell:not(.page-workspace) .login-panel {
  max-height: calc(100svh - var(--mobile-header-height) - 22px);
  overflow: auto;
}

.page-login {
  overflow: auto;
}

.page-login .login-main {
  height: auto;
  min-height: calc(100svh - var(--mobile-header-height));
  padding: 10px 0 14px;
  overflow: visible;
}

.page-login .register-layout {
  min-height: calc(100svh - var(--mobile-header-height) - 24px);
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto;
  gap: 10px;
  align-items: start;
}

.page-login .hero-copy {
  display: none;
}

.page-login .login-panel {
  min-height: auto;
  max-height: none;
  overflow: visible;
  padding: 18px;
}

.page-login .login-panel h1 {
  margin-bottom: 6px;
  font-size: clamp(1.7rem, 10vw, 2.5rem);
  line-height: 0.98;
}

.page-login .login-panel p {
  margin-bottom: 14px;
  font-size: 0.86rem;
  line-height: 1.42;
}

.page-login .login-panel form {
  display: grid;
  gap: 9px;
}

.page-login .login-panel input {
  min-height: 46px;
  font-size: 16px;
}

.page-login .login-panel .button {
  min-height: 46px;
}

.page-workspace .workspace-messages,
.page-projects .workspace-messages,
.page-account .account-grid,
.page-projects .project-side-panel {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.page-workspace .message,
.page-projects .message {
  overflow-wrap: anywhere;
  contain: content;
}

@media (prefers-reduced-motion: no-preference) {
  .page-workspace .message,
  .page-projects .message {
    content-visibility: auto;
    contain-intrinsic-size: 140px;
  }
}

@supports not (height: 100svh) {
  body.page-v3-shell,
  body.page-v3-shell .workspace-main,
  body.page-v3-shell .page-main {
    height: 100vh;
  }
}

/* Account page: mobile-first account cockpit with compact cards. */
.page-account .account-main {
  min-height: calc(100svh - var(--mobile-header-height));
  height: auto;
  overflow: auto;
}

.page-account .account-dashboard {
  height: auto;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.page-account .account-hero {
  padding: 16px;
  border: 1px solid rgba(214, 231, 238, 0.13);
  border-radius: 22px;
  background:
    radial-gradient(circle at 8% 0%, rgba(70, 215, 208, 0.18), transparent 36%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.062), rgba(255, 255, 255, 0.02)),
    rgba(7, 17, 27, 0.82);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.page-account .account-hero h1 {
  margin: 0;
  color: #fff3e8;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.75rem, 9vw, 2.6rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.page-account .account-hero p {
  margin: 8px 0 0;
  color: rgba(232, 239, 243, 0.72);
  font-size: 0.86rem;
  line-height: 1.42;
}

.page-account .account-hero-status {
  margin-top: 12px;
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(243, 184, 90, 0.22);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.045);
}

.page-account .account-status-label,
.page-account .account-card-kicker {
  color: var(--v3-gold);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.page-account .account-hero-status strong {
  color: #ffffff;
  font-size: 1.25rem;
  line-height: 1.05;
}

.page-account .account-hero-status span:last-child {
  color: rgba(232, 239, 243, 0.70);
  font-size: 0.82rem;
  font-weight: 750;
}

.page-account .account-grid {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 10px;
  padding-bottom: 2px;
}

.page-account .account-card {
  padding: 14px;
  border: 1px solid rgba(214, 231, 238, 0.13);
  border-radius: 20px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.058), rgba(255, 255, 255, 0.02)),
    rgba(7, 17, 27, 0.82);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.page-account .account-card-danger {
  border-color: rgba(255, 119, 105, 0.24);
}

.page-account .account-card-head h2 {
  margin: 5px 0 0;
  color: #fff3e8;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
  line-height: 1.04;
  letter-spacing: -0.04em;
}

.page-account .account-card-copy {
  margin: 9px 0 12px;
  color: rgba(232, 239, 243, 0.70);
  font-size: 0.84rem;
  line-height: 1.42;
}

.page-account .account-data-grid {
  display: grid;
  gap: 8px;
}

.page-account .account-data-item {
  display: grid;
  gap: 5px;
  padding: 11px 12px;
  border: 1px solid rgba(214, 231, 238, 0.11);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.035);
}

.page-account .account-data-item strong,
.page-account .account-data-item span {
  display: block;
}

.page-account .account-data-item strong {
  color: #fff8ef;
  font-size: 0.82rem;
}

.page-account .account-data-item span {
  color: rgba(232, 239, 243, 0.68);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.page-account .account-action-grid {
  display: grid;
  gap: 8px;
}

.page-account .account-action,
.page-account .account-delete-button {
  width: 100%;
}

.page-account .account-inline-status {
  margin-top: 10px;
  min-height: 20px;
  font-size: 0.8rem;
}

.page-account .account-api-form {
  display: grid;
  gap: 12px;
}

.page-account .account-api-field {
  display: grid;
  gap: 7px;
}

.page-account .account-api-field span {
  color: #fff8ef;
  font-size: 0.8rem;
  font-weight: 700;
}

.page-account .account-api-input {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(214, 231, 238, 0.14);
  background: rgba(255, 255, 255, 0.038);
  color: #fff8ef;
  padding: 11px 12px;
}

.page-account .account-api-scopes {
  display: grid;
  gap: 8px;
}

.page-account .account-scope-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 14px;
  border: 1px solid rgba(214, 231, 238, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(232, 239, 243, 0.78);
  font-size: 0.8rem;
}

.page-account .account-api-actions {
  display: grid;
  gap: 8px;
}

.page-account .account-api-secret {
  margin-top: 14px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(89, 197, 180, 0.28);
  background: linear-gradient(145deg, rgba(89, 197, 180, 0.08), rgba(255, 255, 255, 0.025));
}

.page-account .account-api-secret strong {
  display: block;
  margin-bottom: 8px;
  color: #d6fff8;
}

.page-account .account-api-secret p {
  margin: 10px 0 0;
  color: rgba(232, 239, 243, 0.72);
  font-size: 0.8rem;
  line-height: 1.45;
}

.page-account .account-api-secret-code {
  display: block;
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(6, 15, 24, 0.8);
  color: #fff8ef;
  overflow-wrap: anywhere;
}

.page-account .account-api-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.page-account .account-api-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(214, 231, 238, 0.11);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
}

.page-account .account-api-meta {
  display: grid;
  gap: 5px;
}

.page-account .account-api-meta strong {
  color: #fff8ef;
  font-size: 0.84rem;
}

.page-account .account-api-meta span {
  color: rgba(232, 239, 243, 0.68);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}
