:root {
  color-scheme: dark;
  --violet: 183, 42, 255;
  --text: #f5f5fa;
  --muted: #a2a0ad;
  --line: rgba(183, 42, 255, .20);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #000; }
body { margin: 0; min-height: 100dvh; color: var(--text); font-family: var(--mono); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
a, button { touch-action: manipulation; }
a:focus-visible, button:focus-visible { outline: 2px solid #cf8bff; outline-offset: 5px; }
button:disabled { cursor: not-allowed; }
::selection { background: rgba(var(--violet), .4); color: #fff; }

.preview-banner {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 12px 20px;
  border-bottom: 1px solid #694281;
  background: #21112b;
  color: #e6c6ff;
  font-size: 11px;
  line-height: 1.6;
  letter-spacing: .06em;
  text-align: center;
}

/* The original black field, scale and slight optical lift of the gorilla are preserved. */
.login-page { background: #000; }
.entrance {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 40px 22px;
}
.preview-banner + .entrance { min-height: calc(100dvh - 43px); }
.mark-slot { display: grid; justify-items: center; transform: translateY(-2vh); width: min(100%, 760px); }
.emblem {
  width: clamp(290px, 52vmin, 700px);
  max-width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 0 18px rgba(var(--violet), .08)) drop-shadow(0 0 44px rgba(var(--violet), .035));
}
.brand-wordmark {
  margin: clamp(7px, 1.1vmin, 12px) 0 0;
  padding-left: .40em;
  color: #85818d;
  font-size: clamp(10px, 1.1vmin, 12px);
  font-weight: 500;
  line-height: 1.7;
  letter-spacing: .40em;
  text-align: center;
  text-transform: uppercase;
}
.entrance-controls { margin-top: 30px; display: grid; justify-items: center; }
.sign-in-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  min-height: 46px;
  min-width: 154px;
  border: 1px solid rgba(var(--violet), .38);
  border-radius: 7px;
  padding: 12px 18px;
  background: rgba(var(--violet), .045);
  color: #cfbfdc;
  font: 12px var(--mono);
  line-height: 1.6;
  text-decoration: none;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}
.sign-in-button span { color: #bf75e8; font-size: 18px; line-height: 1; }
a.sign-in-button:hover { color: #fff; border-color: #bd71eb; background: rgba(var(--violet), .11); }
.sign-in-button:disabled { border-color: #403347; background: #100c13; color: #a29aa7; }
.sign-in-button:disabled span { color: #83768c; }
.account-switch-link { margin-top: 17px; }
.signin-unavailable { margin: 18px 0 0; color: #a2a0ad; font-size: 11px; line-height: 1.8; text-align: center; }
.login-notice { width: min(100%, 430px); margin-top: 26px; border-left: 2px solid #9656b9; padding: 1px 0 1px 18px; }
.login-notice h2 { font-size: 12px; font-weight: 600; margin: 0 0 8px; }
.login-notice p { color: var(--muted); font-size: 12px; line-height: 1.8; margin: 0 0 12px; overflow-wrap: anywhere; }
.quiet-link { color: #cfb4e3; font-size: 12px; line-height: 1.7; text-underline-offset: 4px; }
.quiet-link:hover { color: #fff; }

.home-page { background: radial-gradient(ellipse at 38% -20%, rgba(var(--violet), .10), transparent 48%), #050406; }
.portal-shell { width: min(1180px, calc(100% - 64px)); margin: 0 auto; }
.portal-header { display: flex; justify-content: space-between; align-items: center; gap: 28px; min-height: 134px; padding: 24px 0; border-bottom: 1px solid rgba(194, 176, 207, .13); }
.portal-brand { display: inline-flex; align-items: center; gap: 15px; text-decoration: none; }
.portal-brand img { width: 62px; height: 62px; object-fit: contain; filter: drop-shadow(0 0 14px rgba(var(--violet), .10)); }
.portal-brand span { font-size: 12px; font-weight: 600; line-height: 1.6; letter-spacing: .08em; }
.account-panel { display: flex; gap: 15px; align-items: center; }
.account-copy { display: grid; gap: 6px; max-width: 220px; }
.account-caption { color: #97909f; font-size: 9px; text-transform: uppercase; letter-spacing: .12em; }
.account-copy strong { font-size: 12px; font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; }
.role-badge { border: 1px solid #583969; background: #1a1020; border-radius: 5px; padding: 6px 9px; color: #d8bae9; font-size: 10px; line-height: 1.5; }
.signout-actions { display: grid; justify-items: start; gap: 4px; padding-left: 14px; border-left: 1px solid #312437; }
.text-button { background: none; border: 0; color: #b4a4c0; font-size: 10px; line-height: 1.7; padding: 7px 0; cursor: pointer; text-align: left; }
.text-button:hover { color: #fff; }
.text-button:disabled { color: #776a80; }
.global-signout { font-size: 9px; color: #a396ad; }
.workspace-intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; padding: 54px 0 44px; }
.eyebrow { margin: 0 0 14px; color: #b276d1; font-size: 10px; letter-spacing: .17em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(27px, 3.7vw, 43px); line-height: 1.2; letter-spacing: -.055em; font-weight: 500; }
.intro-copy { margin: 15px 0 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.access-note { margin: 0 0 3px; color: #9b919f; font-size: 10px; line-height: 1.9; text-align: right; }
.app-section + .app-section { margin-top: 37px; }
.section-title { margin: 0 0 16px; color: #aaa0b2; font-size: 10px; letter-spacing: .17em; line-height: 1.7; text-transform: uppercase; font-weight: 500; }
.service-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.service-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 222px;
  padding: 23px;
  border: 1px solid rgba(var(--violet), .21);
  border-radius: 12px;
  background: linear-gradient(140deg, rgba(var(--violet), .035), transparent 55%), #0e0b12;
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}
a.service-card:hover { border-color: rgba(var(--violet), .60); background-color: #151019; transform: translateY(-2px); }
.card-meta { display: flex; gap: 12px; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.service-tag { color: #aa98b6; font-size: 9px; letter-spacing: .13em; line-height: 1.7; text-transform: uppercase; overflow-wrap: anywhere; }
.service-status { color: #c5a6d8; background: #211329; border: 1px solid #493054; border-radius: 99px; padding: 4px 7px; font-size: 8px; line-height: 1.5; white-space: nowrap; }
.service-title { font-size: clamp(18px, 1.9vw, 22px); font-weight: 600; letter-spacing: -.035em; line-height: 1.3; margin: 0 0 10px; overflow-wrap: anywhere; }
.service-description { color: #a69bab; font-size: 11px; line-height: 1.8; margin: 0; }
.card-bottom { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: auto; padding-top: 25px; }
.app-access-note { color: #a68ab8; font-size: 9px; line-height: 1.6; }
.card-arrow { color: #be70ec; font-size: 20px; line-height: 1; }
.is-unavailable { border-color: #302736; background: #0b090e; }
.is-unavailable .service-title { color: #b9aebf; }
.is-unavailable .service-description, .is-unavailable .app-access-note { color: #928599; }
.status-inactive { color: #a898b2; border-color: #44384b; background: #1a151e; }
.is-unavailable .card-arrow { color: #76657f; }
.status-panel { display: flex; gap: 18px; padding: 30px; border: 1px solid #4c305c; border-radius: 12px; background: #110c16; min-height: 150px; }
.status-marker { flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; background: #b667e1; margin-top: 6px; }
.status-panel h2 { font-size: 15px; line-height: 1.5; margin: 0 0 9px; font-weight: 500; }
.status-panel p { max-width: 590px; margin: 0; color: #b3a7ba; font-size: 12px; line-height: 1.9; }
.status-actions { display: flex; align-items: center; gap: 20px; margin-top: 20px; flex-wrap: wrap; }
.recovery-button { display: inline-block; border: 1px solid #744291; border-radius: 6px; color: #e1c9ef; background: #21112c; padding: 10px 14px; font-size: 11px; line-height: 1.6; text-decoration: none; cursor: pointer; }
.recovery-button:hover { background: #351b47; border-color: #b768e3; }
.noscript-notice { color: #b9a6c4; font-size: 12px; line-height: 1.8; }
.portal-footer { display: flex; justify-content: space-between; gap: 30px; padding: 27px 0 34px; margin-top: 48px; border-top: 1px solid rgba(194, 176, 207, .13); color: #97869f; font-size: 9px; line-height: 1.8; }
.portal-footer span { white-space: nowrap; }
.portal-footer p { margin: 0; text-align: right; }
.skip-link { position: fixed; top: 12px; left: 16px; z-index: 5; transform: translateY(-200%); padding: 12px; color: #fff; background: #392145; }
.skip-link:focus { transform: translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; padding: 0; margin: -1px; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 960px) {
  .portal-header { align-items: flex-start; }
  .account-panel { flex-wrap: wrap; justify-content: flex-end; max-width: 310px; }
  .account-copy { max-width: 190px; }
  .service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .portal-shell { width: calc(100% - 36px); }
  .portal-header { flex-direction: column; gap: 23px; padding: 23px 0; }
  .portal-brand { gap: 11px; }
  .portal-brand img { width: 47px; height: 47px; }
  .portal-brand span { font-size: 11px; }
  .account-panel { justify-content: flex-start; gap: 13px; max-width: none; width: 100%; }
  .account-copy { max-width: 180px; }
  .signout-actions { margin-left: auto; padding-left: 12px; }
  .text-button { font-size: 9px; }
  .global-signout { font-size: 8px; }
  .workspace-intro { display: block; padding: 34px 0 30px; }
  .access-note { text-align: left; margin-top: 20px; font-size: 9px; }
  .service-grid { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .service-card { min-height: 207px; padding: 22px; }
  .service-title { font-size: 22px; }
  .portal-footer { display: block; margin-top: 34px; }
  .portal-footer p { margin-top: 11px; text-align: left; max-width: 350px; }
  .status-panel { padding: 24px 20px; gap: 13px; }
  .preview-banner { font-size: 9px; padding: 10px 14px; }
  .brand-wordmark { letter-spacing: .27em; padding-left: .27em; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* Owner layout controls share the portal palette; editing never opens an app. */
input, select { font: inherit; }
input:focus-visible, select:focus-visible { outline: 2px solid #cf8bff; outline-offset: 3px; }
.layout-toolbar { margin: -14px 0 30px; }
.layout-edit-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.layout-help, .layout-message, .empty-section { color: #b3a7ba; font-size: 11px; line-height: 1.8; margin: 0; overflow-wrap: anywhere; }
.layout-message { margin-top: 12px; color: #d5b5e8; max-width: 760px; }
#reloadLayoutButton { margin-top: 12px; }
.layout-buttons { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.layout-button { min-height: 44px; min-width: 44px; border: 1px solid #594167; border-radius: 6px; background: #17101d; color: #d3c0dd; padding: 9px 12px; font-size: 11px; line-height: 1.6; cursor: pointer; }
.layout-button:hover:enabled { background: #291936; border-color: #9d61be; }
.layout-button:disabled, .recovery-button:disabled { color: #8b7d93; border-color: #3d3045; background: #100c14; opacity: .8; }
.layout-section { padding: 22px; border: 1px solid rgba(var(--violet), .25); border-radius: 12px; background: #0e0b12; }
.layout-section + .layout-section { margin-top: 20px; }
.layout-section-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 19px; }
.layout-title-field { flex: 1; max-width: 640px; min-width: 0; }
.layout-title-field .section-title { display: block; margin-bottom: 8px; }
.layout-input, .layout-select { width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px; color: #eee4f4; background: #08060b; border: 1px solid #594167; border-radius: 6px; font-size: 12px; line-height: 1.6; }
.layout-input:disabled, .layout-select:disabled { opacity: .65; }
.layout-app-list { list-style: none; padding: 0; margin: 0; }
.layout-app-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 0; border-top: 1px solid #302238; }
.layout-app-copy { min-width: 0; flex: 1; display: grid; gap: 7px; }
.layout-app-title { font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.layout-app-status { font-size: 10px; color: #a895b3; }
.layout-app-controls { display: flex; align-items: flex-end; gap: 14px; max-width: 60%; }
.layout-app-controls > .layout-buttons { flex-wrap: nowrap; }
.layout-destination { display: grid; gap: 6px; width: 260px; min-width: 0; }
.layout-field-label { color: #ab9bb6; font-size: 10px; line-height: 1.6; }
.layout-create { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-top: 24px; padding: 22px; border: 1px dashed #594167; border-radius: 12px; }
.layout-create > label, .layout-create > p { grid-column: 1 / -1; }
.empty-section { padding: 10px 0; }
@media (max-width: 620px) {
  .layout-toolbar { margin-top: 0; }
  .layout-section { padding: 18px; }
  .layout-section-header { flex-wrap: wrap; gap: 12px; }
  .layout-title-field { flex-basis: 100%; }
  .layout-app-row { flex-wrap: wrap; gap: 12px; }
  .layout-app-copy { flex-basis: 100%; }
  .layout-app-controls { width: 100%; max-width: none; gap: 10px; }
  .layout-destination { flex: 1; width: auto; }
  .layout-create { grid-template-columns: minmax(0, 1fr); padding: 18px; }
  .layout-create > label, .layout-create > p { grid-column: 1; }
}
