/* Sofia v3 desktop application surface.
   Loaded only for screens wider than 760px. The goal is a contained app view:
   the page itself does not become a long document; dense areas scroll inside panels. */

body.page-v3-shell {
  --desktop-header-height: 64px;
  --desktop-gap: clamp(10px, 1vw, 16px);
  --desktop-radius: 22px;
  overflow-y: hidden;
  overflow-x: hidden;
  height: 100svh;
  font-size: clamp(13px, 0.72vw, 15px);
}

body.page-v3-shell .site-header {
  height: var(--desktop-header-height);
}

body.page-v3-shell .site-nav {
  min-height: var(--desktop-header-height);
  height: var(--desktop-header-height);
  padding: 0;
  gap: 16px;
}

body.page-v3-shell .brand {
  min-width: 150px;
  gap: 10px;
}

body.page-v3-shell .brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  font-size: 1rem;
}

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

body.page-v3-shell .nav-links,
body.page-v3-shell .nav-actions {
  gap: 7px;
}

body.page-v3-shell .nav-link,
body.page-v3-shell .button,
body.page-v3-shell .chip-button {
  min-height: 34px;
  padding: 0 13px;
  font-size: 0.8rem;
}

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

body.page-v3-shell.page-account .workspace-main,
body.page-v3-shell.page-account .page-main {
  height: calc(100svh - var(--desktop-header-height));
  min-height: calc(100svh - var(--desktop-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: min(1780px, calc(100vw - 28px));
}

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: var(--desktop-radius);
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

body.page-v3-shell .eyebrow {
  margin-bottom: 10px;
  padding: 6px 10px;
  font-size: 0.6rem;
}

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

body.page-v3-shell .chat-top p,
body.page-v3-shell .workspace-top p {
  margin: 6px 0 0;
  max-width: 66ch;
  font-size: 0.88rem;
  line-height: 1.35;
}

body.page-v3-shell .state-pill {
  min-height: 28px;
  padding: 0 10px;
  font-size: 0.72rem;
}

/* Normal chat: only the conversation surface remains prominent. Project extras stay away. */
.page-workspace:not(.page-projects) .workspace-layout {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(620px, 980px);
  gap: var(--desktop-gap);
  justify-content: center;
  align-items: stretch;
}

.page-workspace:not(.page-projects) .workspace-copilot-side {
  min-height: 0;
  padding: 16px;
  display: grid;
  align-content: start;
  gap: 12px;
}

.page-workspace:not(.page-projects) .workspace-copilot-title {
  margin: 0;
  font-size: 1.15rem;
}

.page-workspace:not(.page-projects) .workspace-copilot-copy {
  margin: 0;
  color: rgba(232, 239, 243, 0.74);
  font-size: 0.92rem;
  line-height: 1.35;
}

.page-workspace:not(.page-projects) .workspace-copilot-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.page-workspace:not(.page-projects) .workspace-copilot-kpi {
  border: 1px solid rgba(214, 231, 238, 0.11);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  gap: 4px;
}

.page-workspace:not(.page-projects) .workspace-copilot-kpi strong {
  color: #78eadf;
  font-size: 0.92rem;
}

.page-workspace:not(.page-projects) .workspace-copilot-kpi span {
  color: rgba(232, 239, 243, 0.72);
  font-size: 0.82rem;
}

.page-workspace:not(.page-projects) .workspace-copilot-signal {
  border-radius: 12px;
  border: 1px dashed rgba(70, 215, 208, 0.5);
  padding: 10px;
  color: rgba(232, 239, 243, 0.82);
  font-size: 0.84rem;
}

.page-workspace:not(.page-projects) .workspace-copilot-note {
  border: 1px solid rgba(214, 231, 238, 0.11);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
  display: grid;
  gap: 8px;
}

.page-workspace:not(.page-projects) .workspace-copilot-note strong {
  color: #f3b85a;
}

.page-workspace:not(.page-projects) .workspace-copilot-note span {
  color: rgba(232, 239, 243, 0.75);
  font-size: 0.9rem;
  line-height: 1.45;
}

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

.page-workspace:not(.page-projects) .workspace-top {
  padding: 18px 22px 10px;
}

.page-workspace:not(.page-projects) .workspace-access-note {
  margin: 0 22px 10px;
  padding: 12px 14px;
}

.page-workspace:not(.page-projects) .workspace-messages {
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding: 16px 22px;
}

.page-workspace:not(.page-projects) .workspace-form {
  padding: 12px 22px 16px;
  border-top: 1px solid rgba(214, 231, 238, 0.11);
}

.page-workspace:not(.page-projects) .workspace-form textarea {
  min-height: 78px;
  max-height: 104px;
}

/* Project desktop: three-column cockpit, no body scroll. Side information scrolls inside rails. */
.page-projects .project-mobile-rail {
  display: none !important;
}

.page-projects .project-drawer-close {
  display: none !important;
}

.page-projects .site-shell.project-board-layout {
  width: min(1880px, calc(100vw - 22px));
}

.page-projects .project-board-layout {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(220px, 285px) minmax(540px, 1fr) minmax(260px, 360px);
  gap: var(--desktop-gap);
  align-items: stretch;
}

.page-projects .project-side-panel {
  min-height: 0;
  overflow: hidden;
  display: grid;
  align-content: start;
  gap: var(--desktop-gap);
}

.page-projects .project-side-panel .workspace-side-card {
  min-height: 0;
  max-height: calc((100svh - var(--desktop-header-height) - 48px) / 2);
  overflow: auto;
  padding: 14px;
}

.page-projects .project-side-panel .workspace-side-card[open] {
  display: block;
}

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

.page-projects .project-chat-shell .workspace-top {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 10px;
  padding: 20px 28px 16px;
  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: 56ch;
}

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

.page-projects .project-chat-shell .workspace-messages {
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding: 16px 22px;
}

.page-workspace .workspace-messages,
.page-projects .workspace-messages {
  border-radius: 14px;
  border: 1px solid rgba(214, 231, 238, 0.10);
  background: rgba(3, 6, 13, 0.82);
}

.page-projects .project-chat-shell .workspace-form {
  padding: 12px 22px 16px;
  border-top: 1px solid rgba(214, 231, 238, 0.11);
}

.page-workspace .workspace-form,
.page-projects .workspace-form {
  border-radius: 14px;
  border: 1px solid rgba(214, 231, 238, 0.11);
  background: rgba(255, 255, 255, 0.035);
}

.page-projects .project-chat-shell .workspace-form textarea {
  min-height: 70px;
  max-height: 96px;
}

.page-workspace .workspace-form textarea,
.page-projects .workspace-form textarea {
  border-radius: 12px;
  border: 1px solid rgba(150, 170, 255, 0.25);
  background: rgba(0, 0, 0, 0.32);
}

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

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

.page-projects .workspace-side-list {
  max-height: 36vh;
  overflow: auto;
}

.page-projects .workspace-side-item,
.page-workspace .workspace-side-item {
  padding: 10px 12px;
  border-radius: 14px;
}

.page-projects .message,
.page-workspace .message {
  font-size: 0.92rem;
  line-height: 1.5;
}

/* Content pages get a composed card surface, but remain allowed to scroll internally if they are legal text. */
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(--desktop-header-height) - 34px);
  overflow: auto;
}

.page-login .login-main {
  height: calc(100svh - var(--desktop-header-height));
  overflow: hidden;
}

.page-login .register-layout {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 0.65fr);
  gap: var(--desktop-gap);
  align-items: stretch;
}

.page-login .hero-card,
.page-login .login-panel {
  min-height: 0;
  max-height: 100%;
  overflow: auto;
}

.page-login .login-panel {
  align-self: stretch;
  display: grid;
  align-content: center;
}

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

@media (min-width: 2200px), (min-width: 1900px) and (min-aspect-ratio: 2/1) {
  body.page-v3-shell {
    --desktop-header-height: 66px;
  }

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

  .page-projects .project-board-layout {
    grid-template-columns: minmax(250px, 330px) minmax(680px, 1fr) minmax(300px, 410px);
  }
}

/* Account page: premium cockpit layout. */
.page-account .account-main {
  min-height: calc(100svh - var(--desktop-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: var(--desktop-gap);
}

.page-account .account-hero {
  min-height: 176px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  align-items: stretch;
  gap: var(--desktop-gap);
  padding: clamp(20px, 1.5vw, 28px);
  border: 1px solid rgba(214, 231, 238, 0.13);
  border-radius: 28px;
  background:
    radial-gradient(circle at 10% 5%, rgba(70, 215, 208, 0.18), transparent 34%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.018)),
    rgba(7, 17, 27, 0.76);
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.055);
  overflow: hidden;
}

.page-account .account-hero-copy {
  align-self: center;
  max-width: 820px;
}

.page-account .account-hero h1 {
  margin: 0;
  color: #fff3e8;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.25rem, 3.4vw, 4.4rem);
  line-height: 0.92;
  letter-spacing: -0.055em;
}

.page-account .account-hero p {
  max-width: 62ch;
  margin: 12px 0 0;
  color: rgba(232, 239, 243, 0.76);
  font-size: clamp(0.9rem, 0.82vw, 1.02rem);
  line-height: 1.55;
}

.page-account .account-hero-status {
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 22px;
  border: 1px solid rgba(243, 184, 90, 0.24);
  border-radius: 24px;
  background:
    radial-gradient(circle at 100% 0%, rgba(243, 184, 90, 0.2), transparent 44%),
    rgba(255, 255, 255, 0.045);
}

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

.page-account .account-hero-status strong {
  display: block;
  color: #ffffff;
  font-size: clamp(1.5rem, 2vw, 2.2rem);
  line-height: 1.05;
}

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

.page-account .account-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.72fr);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas:
    "profile usage"
    "actions danger";
  gap: var(--desktop-gap);
}

.page-account .account-card {
  min-height: 0;
  padding: 20px;
  border: 1px solid rgba(214, 231, 238, 0.13);
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.052), rgba(255, 255, 255, 0.018)),
    rgba(7, 17, 27, 0.74);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.page-account .account-card-primary { grid-area: profile; }
.page-account .account-card-usage { grid-area: usage; }
.page-account .account-card-adults { grid-area: adults; }
.page-account .account-card-actions { grid-area: actions; }
.page-account .account-card-api { grid-area: api; }
.page-account .account-card-danger { grid-area: danger; border-color: rgba(255, 119, 105, 0.24); }

.page-account .account-card-head h2 {
  margin: 6px 0 0;
  color: #fff3e8;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 1.7vw, 2.05rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.page-account .account-card-copy {
  margin: 10px 0 16px;
  color: rgba(232, 239, 243, 0.70);
  line-height: 1.45;
}

.page-account .account-data-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: 100%;
  overflow: auto;
}

.page-account .account-data-grid-compact {
  grid-template-columns: 1fr;
}

.page-account .account-data-item {
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid rgba(214, 231, 238, 0.11);
  border-radius: 18px;
  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.88rem;
}

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

.page-account .account-action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

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

.page-account .account-inline-status {
  margin-top: 12px;
  min-height: 20px;
}

.page-account .account-grid {
  grid-template-rows: minmax(0, 1fr) auto auto auto;
  grid-template-areas:
    "profile usage"
    "adults adults"
    "api api"
    "actions danger";
}

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

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

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

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

.page-account .account-api-scopes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.page-account .account-scope-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  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.82rem;
}

.page-account .account-api-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.page-account .account-api-secret {
  margin-top: 16px;
  padding: 16px;
  border-radius: 20px;
  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.84rem;
}

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

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

.page-account .account-api-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(214, 231, 238, 0.11);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
}

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

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

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

@media (max-height: 820px) and (min-width: 761px) {
  .page-account .account-hero {
    min-height: 142px;
    padding: 18px 22px;
  }

  .page-account .account-hero h1 {
    font-size: clamp(2rem, 2.9vw, 3.6rem);
  }

  .page-account .account-card {
    padding: 16px;
  }

  .page-account .account-data-item {
    min-height: 62px;
    padding: 11px 13px;
  }
}
