:root {
  --ink: #1a2a36;
  --text: #22303b;
  --muted: rgba(34, 48, 59, 0.62);
  --blue: #116cb5;
  --blue-soft: #207fc3;
  --sky: #6ba4d9;
  --mint: #d7ebe8;
  --surface: #fdfefc;
  --surface-2: rgba(253, 254, 252, 0.82);
  --line: rgba(34, 48, 59, 0.1);
  --line-strong: rgba(34, 48, 59, 0.16);
  --ok: #2a8f6c;
  --warn: #b47a12;
  --danger: #c24141;
  --shadow: 0 18px 48px rgba(26, 42, 54, 0.08);
  --font: "Hanken Grotesk", "Avenir Next", ui-sans-serif, system-ui, sans-serif;
  --display: "Hedvig Letters Serif", "Iowan Old Style", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 55% at 12% 8%, rgba(107, 164, 217, 0.28) 0%, transparent 58%),
    radial-gradient(ellipse 55% 45% at 88% 12%, rgba(215, 235, 232, 0.9) 0%, transparent 55%),
    radial-gradient(ellipse 60% 50% at 70% 90%, rgba(17, 108, 181, 0.1) 0%, transparent 60%),
    linear-gradient(180deg, #f4faf9 0%, #fdfefc 42%, #eef5f8 100%);
}

.mist {
  position: absolute;
  border-radius: 50%;
  filter: blur(56px);
  opacity: 0.55;
  animation: drift 22s ease-in-out infinite;
}

.mist-a {
  width: 42vmax;
  height: 42vmax;
  top: -12%;
  left: -8%;
  background: radial-gradient(circle, rgba(157, 206, 232, 0.55) 0%, transparent 70%);
}

.mist-b {
  width: 36vmax;
  height: 36vmax;
  right: -10%;
  bottom: 10%;
  background: radial-gradient(circle, rgba(97, 172, 168, 0.28) 0%, transparent 70%);
  animation-delay: -9s;
}

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(2%, -2.5%) scale(1.04); }
}

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

.shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(253, 254, 252, 0.72);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 0.98rem;
}

.brand-logo {
  width: 30px;
  height: 30px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

body:not(.is-authed) .auth-only {
  display: none !important;
}

body.is-authed .guest-only {
  display: none !important;
}

.guest-auth {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sign-in-corner {
  min-height: 40px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line-strong);
  box-shadow: 0 8px 24px rgba(26, 42, 54, 0.08);
}

.sign-in-corner:hover {
  border-color: rgba(17, 108, 181, 0.35);
  color: var(--blue);
}

.profile-menu {
  position: relative;
}

.profile-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  font: inherit;
  color: var(--text);
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

.profile-btn:hover,
.profile-menu.is-open .profile-btn {
  border-color: rgba(17, 108, 181, 0.28);
  box-shadow: 0 8px 22px rgba(26, 42, 54, 0.08);
}

.profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, rgba(17, 108, 181, 0.2), rgba(215, 235, 232, 0.95));
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.profile-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  text-align: left;
  max-width: 140px;
}

.profile-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.profile-role {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.profile-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid rgba(34, 48, 59, 0.45);
  margin-right: 2px;
}

.profile-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(253, 254, 252, 0.96);
  border: 1px solid var(--line);
  box-shadow: 0 18px 48px rgba(26, 42, 54, 0.14);
  backdrop-filter: blur(16px);
  z-index: 50;
}

.profile-dropdown[hidden] {
  display: none !important;
}

.profile-item[hidden],
.admin-only[hidden] {
  display: none !important;
}

.profile-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  padding: 11px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 550;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
}

a.profile-item {
  justify-content: flex-start;
}

.profile-item:hover {
  background: rgba(17, 108, 181, 0.08);
}

.profile-item.danger {
  color: var(--danger);
}

.profile-sep {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 6px 4px;
}

.git-token-fallback {
  margin: 0 0 12px;
  font-size: 0.82rem;
}

.git-token-form {
  display: grid;
  grid-template-columns: minmax(7rem, 0.7fr) minmax(8rem, 1fr) minmax(8rem, 1fr) minmax(9rem, 1.2fr) auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 8px;
}

.git-token-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.git-token-form input,
.git-token-form select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  padding: 8px 10px;
  font: inherit;
  font-weight: 500;
  color: var(--ink);
}

.git-token-form .btn {
  min-height: 40px;
  padding: 8px 14px;
}

.git-tokens-table-wrap {
  margin-top: 12px;
}

.git-token-host {
  font-family: inherit;
  color: var(--muted);
}

.git-token-masked {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.82rem;
}

@media (max-width: 840px) {
  .git-token-form {
    grid-template-columns: 1fr 1fr;
  }

  .git-token-form .btn {
    grid-column: 1 / -1;
  }

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

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

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

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

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

.pending-badge {
  min-width: 1.3em;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--warn);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
}

.users-table-wrap,
.table-scroll {
  overflow: auto;
  max-height: min(50vh, 420px);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.drugbank-list-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  min-height: 0;
  max-height: none;
  height: 100%;
}

.drugbank-file-row {
  cursor: pointer;
}

.drugbank-file-row:hover {
  background: rgba(17, 108, 181, 0.06);
}

.drugbank-file-row.is-selected {
  background: rgba(17, 108, 181, 0.12);
}

.drugbank-file-row:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

.db-file-name {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  font: inherit;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  word-break: break-all;
}

.db-file-name:hover {
  color: var(--blue-soft, #0b5cad);
}

.users-table,
.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.users-table th,
.users-table td,
.preview-table th,
.preview-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.users-table th,
.preview-table th {
  position: sticky;
  top: 0;
  background: rgba(244, 250, 249, 0.96);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.user-org-access {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
  max-width: 360px;
}

.user-org-access.is-admin {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.user-org-full {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(29, 29, 31, 0.08);
  color: #1d1d1f;
  font-size: 0.75rem;
  font-weight: 600;
}

.user-org-full-hint {
  font-size: 0.72rem;
}

.user-org-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.user-org-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 10px 4px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  color: var(--muted);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.12s ease;
}

.user-org-toggle img {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: contain;
  opacity: 0.72;
}

.user-org-toggle:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--org-accent, #0071e3) 35%, var(--line));
  color: #1d1d1f;
  transform: translateY(-1px);
}

.user-org-toggle.is-on {
  background: color-mix(in srgb, var(--org-accent, #0071e3) 14%, #ffffff);
  border-color: color-mix(in srgb, var(--org-accent, #0071e3) 40%, transparent);
  color: #1d1d1f;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--org-accent, #0071e3) 16%, transparent),
    0 6px 14px color-mix(in srgb, var(--org-accent, #0071e3) 14%, transparent);
}

.user-org-toggle.is-on img {
  opacity: 1;
}

.user-org-toggle:disabled {
  cursor: wait;
  opacity: 0.7;
}

.user-org-status {
  font-size: 0.7rem;
  color: var(--muted);
  min-height: 1em;
}

.user-org-status.is-ok {
  color: #0a7a4b;
}

.org-nav-empty {
  margin: 0;
  padding: 8px 12px;
  font-size: 0.9rem;
}

.btn-sm {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 0.8rem;
}

.status-pill,
.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pill {
  margin-left: 6px;
  background: rgba(17, 108, 181, 0.12);
  color: var(--blue);
}

.status-pending { background: rgba(180, 122, 18, 0.14); color: #9a6410; }
.status-approved { background: rgba(42, 143, 108, 0.14); color: #1f7a58; }
.status-rejected { background: rgba(194, 65, 65, 0.12); color: #a33333; }

.user-role {
  font: inherit;
  font-size: 0.84rem;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.drugbank-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(360px, 1.35fr);
  gap: 16px;
  flex: 1;
  min-height: 0;
  height: min(62vh, 720px);
}

.drugbank-preview-wrap {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.45);
}

.drugbank-preview-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.drugbank-preview-head input {
  flex: 1;
  min-width: 140px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font: inherit;
  font-size: 0.88rem;
}

.drugbank-preview {
  font-size: 0.86rem;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.drugbank-preview .table-scroll {
  max-height: none;
  height: 100%;
  border: 0;
}

.drugbank-card,
.users-card {
  width: 100%;
  max-width: none;
}

.drugbank-card {
  display: flex;
  flex-direction: column;
  max-height: min(92dvh, 960px);
  overflow: hidden;
}

.drugbank-card .modal-actions {
  flex-shrink: 0;
  margin-top: auto;
}

.btn, .btn-text {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  min-height: 44px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.connect-btn .label-short {
  display: none;
}

.btn-primary {
  background: var(--ink);
  color: #fafafa;
  box-shadow: 0 4px 22px rgba(26, 42, 54, 0.16);
}

.btn-primary:hover {
  transform: translateY(-1px);
  background: #243847;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--text);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.7);
}

a.btn-primary {
  color: #fafafa;
}

a.btn-ghost {
  color: var(--text);
}

.btn-danger {
  background: transparent;
  border: 1px solid rgba(194, 65, 65, 0.35);
  color: var(--danger);
}

.btn-danger:hover {
  background: rgba(194, 65, 65, 0.08);
  border-color: rgba(194, 65, 65, 0.55);
}

.btn-text {
  color: var(--blue);
  font-weight: 600;
  font-size: 0.84rem;
}

.store {
  max-width: 1080px;
  margin: 0 auto;
  padding: 56px 24px 88px;
}

.hero {
  margin-bottom: 56px;
  max-width: 720px;
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 18px;
  font-family: var(--display);
  font-size: clamp(3rem, 7vw, 4.6rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.02;
  color: var(--ink);
}

.hero-copy {
  margin: 0;
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.12rem;
  line-height: 1.65;
  font-weight: 400;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.hero-points {
  list-style: none;
  margin: 32px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
}

.hero-points li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 550;
}

.hero-point-mark {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(17, 108, 181, 0.14);
  flex-shrink: 0;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-right: 4px;
}

.site-nav a {
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--blue);
}

.story-section {
  margin: 0 0 56px;
  max-width: 1080px;
  animation: fadeUp 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.06s both;
}

.story-section .section-head {
  align-items: flex-end;
}

.story-section .section-head p.muted {
  margin: 8px 0 0;
  max-width: 40rem;
  line-height: 1.55;
}

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

.feature-card,
.branch-card {
  padding: 20px 18px;
  border-radius: 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.feature-card h3,
.branch-card h3,
.steps h3 {
  margin: 0 0 8px;
  font-size: 1.02rem;
  font-weight: 650;
  color: var(--ink);
}

.feature-card p,
.branch-card p,
.steps p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.steps li {
  display: flex;
  gap: 14px;
  padding: 20px 18px;
  border-radius: 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(17, 108, 181, 0.12);
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 700;
}

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

.branch-card img {
  display: block;
  width: 40px;
  height: 32px;
  object-fit: contain;
  margin-bottom: 12px;
}

.company-strip {
  padding: 28px 26px;
  border-radius: 22px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.company-strip h2 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.company-strip .muted {
  max-width: 42rem;
  margin: 0;
  line-height: 1.55;
}

.legal-body code {
  font-family: var(--mono);
  font-size: 0.88em;
  padding: 0.08em 0.35em;
  border-radius: 6px;
  background: rgba(17, 108, 181, 0.08);
  color: var(--ink);
}

.shelf-kicker {
  margin-bottom: 8px;
}

.landing-footer {
  position: relative;
  z-index: 1;
  padding: 28px 28px 40px;
  border-top: 1px solid var(--line);
}

.landing-footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}

.landing-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
}

.footer-links a {
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
}

.footer-links a:hover {
  color: var(--blue);
}

.footer-meta {
  max-width: 1080px;
  margin: 10px auto 0 !important;
  color: var(--muted);
  font-size: 0.82rem;
}

.footer-meta a {
  color: inherit;
}

.footer-meta a:hover {
  color: var(--blue);
}

.contact-section {
  margin-top: 56px;
  scroll-margin-top: 88px;
  animation: fadeUp 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}

.legal-page .contact-layout {
  margin-top: 36px;
}

.contact-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(280px, 1.2fr);
  gap: 22px;
  align-items: start;
}

.contact-card {
  padding: 22px;
  border-radius: 20px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.contact-kicker {
  margin: 0 0 16px;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.contact-line {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.contact-line span {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.contact-line strong {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.contact-line:hover strong {
  color: var(--blue);
}

.contact-note {
  margin: 16px 0 0;
  font-size: 0.84rem;
  line-height: 1.5;
}

.contact-form {
  padding: 22px;
  border-radius: 20px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.contact-form .btn {
  margin-top: 16px;
}

.contact-form-hint {
  margin: 12px 0 0;
  font-size: 0.82rem;
}

.contact-status {
  margin: 10px 0 0;
  font-size: 0.86rem;
}

.contact-status.is-error {
  color: var(--danger);
}

.legal-page h1 {
  margin: 0 0 18px;
  font-family: var(--display);
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.08;
  color: var(--ink);
}

.legal-body {
  max-width: 40rem;
  margin-top: 36px;
}

.legal-body h2 {
  margin: 28px 0 10px;
  font-size: 1.12rem;
  font-weight: 650;
  color: var(--ink);
}

.legal-body p,
.legal-body li {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.65;
}

.legal-body ul {
  margin: 0;
  padding-left: 1.2rem;
}

.legal-body a {
  color: var(--blue);
  font-weight: 600;
}

.org-nav-pill.is-locked {
  opacity: 0.72;
}

.org-nav-pill.is-locked:hover {
  opacity: 1;
}

.org-nav-lock {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.app-card.is-public {
  height: auto;
  min-height: 176px;
  max-height: none;
  cursor: default;
  gap: 12px;
  overflow: hidden;
}

.app-card.is-public .app-public-open {
  margin-top: auto;
  align-self: flex-start;
}

a.app-card.is-public {
  color: inherit;
  cursor: pointer;
}

a.app-card.is-public:hover {
  color: inherit;
}

.cluster-section {
  margin-bottom: 52px;
  animation: fadeUp 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.04s both;
}

.cluster-head {
  align-items: center;
}

.cluster-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.cluster-toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.cluster-toggle-ui {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: rgba(34, 48, 59, 0.16);
  position: relative;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.cluster-toggle-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(26, 42, 54, 0.2);
  transition: transform 0.2s ease;
}

.cluster-toggle input:checked + .cluster-toggle-ui {
  background: var(--blue);
}

.cluster-toggle input:checked + .cluster-toggle-ui::after {
  transform: translateX(18px);
}

.cluster-toggle input:focus-visible + .cluster-toggle-ui {
  outline: 2px solid rgba(17, 108, 181, 0.45);
  outline-offset: 2px;
}

.cluster-body {
  margin-top: 4px;
}

#clusterUpdated {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 1.25em;
}

#clusterUpdated.is-loading {
  color: var(--blue);
}

#clusterUpdated.is-error {
  color: #9a6410;
}

.cluster-spinner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(17, 108, 181, 0.22);
  border-top-color: var(--blue);
  animation: cluster-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes cluster-spin {
  to { transform: rotate(360deg); }
}

.cluster-reconnect {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 22px 18px;
  border: 1px dashed var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.cluster-reconnect strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
}

.cluster-reconnect .muted {
  margin: 0 0 4px;
}

.cluster-ping-board {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px 0 8px;
}

.cluster-ping-intro {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.cluster-ping-intro strong {
  display: block;
  color: var(--ink);
  margin-bottom: 2px;
}

.cluster-ping-intro .muted {
  margin: 0;
}

.cluster-ping-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cluster-ping-row {
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

.cluster-ping-row.active {
  border-color: rgba(17, 108, 181, 0.45);
  background: rgba(17, 108, 181, 0.06);
  transform: translateX(2px);
}

.cluster-ping-row.done {
  border-color: rgba(34, 140, 90, 0.35);
}

.cluster-ping-row.error {
  border-color: rgba(180, 70, 50, 0.35);
  background: rgba(180, 70, 50, 0.05);
}

.cluster-ping-row.waiting {
  opacity: 0.72;
}

.cluster-ping-row-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}

@media (max-width: 640px) {
  .cluster-ping-row-head {
    grid-template-columns: auto 1fr;
  }

  .cluster-ping-state {
    grid-column: 2;
    white-space: normal;
  }
}

.cluster-ping-rank {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--blue);
  min-width: 2.5rem;
}

.cluster-ping-row-head strong {
  display: block;
  color: var(--ink);
}

.cluster-ping-row-head .muted {
  margin: 2px 0 0;
  font-size: 0.85em;
}

.cluster-ping-state {
  font-size: 0.85rem;
  color: var(--muted, #667);
  white-space: nowrap;
}

.cluster-ping-row.active .cluster-ping-state {
  color: var(--blue);
}

.cluster-ping-dots {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.ping-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(17, 108, 181, 0.15);
  border: 1px solid rgba(17, 108, 181, 0.2);
}

.ping-dot.ok {
  background: #2f9e6b;
  border-color: #2f9e6b;
}

.ping-dot.fail {
  background: #c45c3e;
  border-color: #c45c3e;
}

.ping-dot.pulse {
  background: var(--blue);
  border-color: var(--blue);
  animation: ping-dot-pulse 0.9s ease-in-out infinite;
}

@keyframes ping-dot-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.55; }
}

.cluster-stat-skeleton .skeleton-line,
.cluster-node-skeleton .skeleton-line {
  display: block;
  height: 1em;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    rgba(17, 108, 181, 0.08),
    rgba(17, 108, 181, 0.18),
    rgba(17, 108, 181, 0.08)
  );
  background-size: 200% 100%;
  animation: cluster-shimmer 1.2s ease-in-out infinite;
}

.cluster-stat-skeleton .skeleton-line {
  width: 64%;
  height: 1.15rem;
}

.cluster-node-skeleton .skeleton-line.short {
  width: 48%;
  height: 1.1rem;
  margin-bottom: 6px;
}

.cluster-node-skeleton .skeleton-line.tiny,
.cluster-stat-skeleton .skeleton-line.tiny {
  width: 36%;
  height: 0.75rem;
}

.cluster-node-skeleton {
  pointer-events: none;
}

.cluster-node-skeleton .meter span {
  animation: cluster-shimmer 1.2s ease-in-out infinite;
  background: linear-gradient(
    90deg,
    rgba(17, 108, 181, 0.16),
    rgba(17, 108, 181, 0.32),
    rgba(17, 108, 181, 0.16)
  );
  background-size: 200% 100%;
}

@keyframes cluster-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.cluster-totals {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.cluster-stat {
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 6px;
}

.cluster-stat-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.cluster-stat strong {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink);
}

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

.cluster-node {
  padding: 14px 16px 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.cluster-node.offline {
  opacity: 0.78;
}

.cluster-node header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.cluster-node h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 500;
}

.cluster-node header .muted {
  margin: 2px 0 0;
  font-family: var(--mono);
  font-size: 0.75rem;
}

.node-tag {
  margin-left: 6px;
  font-family: var(--font);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blue);
}

.node-status {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}

.node-status.online { color: var(--ok); }
.node-status.offline { color: var(--danger); }

.node-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.node-metrics strong {
  display: block;
  font-family: var(--mono);
  font-size: 0.95rem;
  margin: 2px 0 6px;
}

.meter {
  height: 6px;
  background: rgba(34, 48, 59, 0.08);
  overflow: hidden;
  margin: 0 0 6px;
}

.meter span {
  display: block;
  height: 100%;
  background: var(--blue);
  transition: width 0.35s ease;
}

.meter.warm span { background: var(--warn); }
.meter.hot span { background: var(--danger); }

.gpu-list {
  display: grid;
  gap: 10px;
}

.gpu-row-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
  margin-bottom: 4px;
  font-family: var(--mono);
}

.gpu-mem {
  font-size: 0.75rem;
}

.node-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.88rem;
}

.cluster-hint {
  margin: 12px 0 0;
  font-size: 0.85rem;
}

.apps-section {
  animation: fadeUp 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.section-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.muted { color: var(--muted); font-size: 0.9rem; }

.apps-section {
  margin-top: 8px;
  scroll-margin-top: 88px;
}

.apps-section-head h2 {
  letter-spacing: -0.03em;
}

.org-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 28px;
  position: sticky;
  top: 12px;
  z-index: 20;
  padding: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

.org-nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 8px;
  border-radius: 999px;
  text-decoration: none;
  color: #1d1d1f;
  font-size: 0.92rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.org-nav-pill img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.org-nav-pill:hover {
  background: rgba(0, 0, 0, 0.04);
  transform: translateY(-1px);
}

.org-nav-pill.is-active {
  background: color-mix(in srgb, var(--org-accent, #0071e3) 14%, #ffffff);
  color: #1d1d1f;
  border-color: color-mix(in srgb, var(--org-accent, #0071e3) 35%, transparent);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--org-accent, #0071e3) 18%, transparent),
    0 8px 20px color-mix(in srgb, var(--org-accent, #0071e3) 16%, transparent);
}

.org-nav-pill.is-active .org-nav-name {
  color: #1d1d1f;
}

.org-nav-pill.is-active .org-nav-count {
  background: color-mix(in srgb, var(--org-accent, #0071e3) 18%, #ffffff);
  color: #1d1d1f;
}

.org-nav-count {
  min-width: 1.4em;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  font-size: 0.75rem;
  color: rgba(29, 29, 31, 0.72);
}

.apps-shelves {
  display: flex;
  flex-direction: column;
  gap: 36px;
  overflow: visible;
}

.org-shelf {
  scroll-margin-top: 88px;
  padding: 22px;
  border-radius: 28px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.88),
    rgba(245, 245, 247, 0.72)
  );
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.04);
  overflow: visible;
}

.org-shelf.is-sliding {
  opacity: 0;
  transform: translateX(28px);
}

.org-shelf.is-sliding.is-in {
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.32s ease, transform 0.32s ease;
}

.org-shelf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.org-shelf-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.org-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--org-accent, #1d1d1f) 28%, transparent);
}

.org-shelf-head h3 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.035em;
  color: #1d1d1f;
  font-family: var(--font);
}

.org-shelf-head .muted {
  margin: 2px 0 0;
  font-size: 0.9rem;
  color: rgba(29, 29, 31, 0.55);
}

.org-shelf-count {
  font-size: 0.85rem;
  color: rgba(29, 29, 31, 0.5);
  white-space: nowrap;
}

.org-empty {
  grid-column: 1 / -1;
  padding: 28px 18px;
  text-align: center;
  color: rgba(29, 29, 31, 0.45);
  font-size: 0.95rem;
  border: 1px dashed rgba(0, 0, 0, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.45);
}

.org-shelf .app-card {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 22px;
  border-color: rgba(0, 0, 0, 0.06);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.04);
}

.org-shelf .app-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.08);
}

@media (max-width: 720px) {
  .org-nav {
    border-radius: 22px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .org-shelf-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
  align-items: stretch;
  isolation: isolate;
}

.app-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 176px;
  min-height: 176px;
  max-height: 176px;
  padding: 20px;
  border-radius: 20px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  animation: fadeUp 0.55s ease both;
  overflow: visible;
  z-index: 1;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.app-card.menu-open {
  z-index: 100;
  transform: none !important;
}

.app-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    160deg,
    rgba(215, 235, 232, 0.45) 0%,
    transparent 42%
  );
  pointer-events: none;
  z-index: 0;
}

.app-card > * {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.app-card:hover {
  transform: translateY(-3px);
  border-color: rgba(17, 108, 181, 0.22);
  box-shadow: 0 22px 56px rgba(26, 42, 54, 0.1);
}

.app-card.menu-open:hover {
  transform: none;
}

.app-card-top {
  display: flex;
  gap: 14px;
  align-items: stretch;
  min-width: 0;
  width: 100%;
  flex: 1;
}

.app-icon {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, rgba(107, 164, 217, 0.28), rgba(215, 235, 232, 0.8));
  border: 1px solid var(--line);
  color: var(--blue);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.app-icon-dna {
  background: linear-gradient(160deg, rgba(45, 212, 191, 0.35), rgba(215, 235, 232, 0.85));
  color: #0f766e;
}

.app-icon-spark {
  background: linear-gradient(160deg, rgba(251, 191, 36, 0.35), rgba(215, 235, 232, 0.85));
  color: #b45309;
}

.app-icon-flask {
  background: linear-gradient(160deg, rgba(167, 139, 250, 0.3), rgba(215, 235, 232, 0.85));
  color: #6d28d9;
}

.app-icon-chip {
  background: linear-gradient(160deg, rgba(56, 189, 248, 0.35), rgba(215, 235, 232, 0.85));
  color: #0369a1;
}

.app-icon-atom {
  background: linear-gradient(160deg, rgba(244, 114, 182, 0.28), rgba(215, 235, 232, 0.85));
  color: #be185d;
}

.app-icon-image {
  padding: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.7);
}

.app-icon-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.app-meta {
  flex: 1;
  min-width: 0;
  overflow: visible;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 100%;
}

.app-meta-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  flex-shrink: 0;
}

.app-meta-head h3 {
  margin: 0;
  min-width: 0;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.25;
  max-height: calc(1.25em * 2);
}

.app-meta-body {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app-menu {
  position: relative;
  flex-shrink: 0;
  z-index: 2;
}

.app-menu-toggle {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.65);
  display: grid;
  place-content: center;
  gap: 3px;
  cursor: pointer;
  padding: 0;
}

.app-menu-toggle span {
  display: block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--ink);
}

.app-menu-toggle:hover {
  background: #fff;
  border-color: rgba(17, 108, 181, 0.35);
}

.app-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 168px;
  padding: 6px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px rgba(26, 42, 54, 0.16);
  display: none;
  z-index: 120;
}

.app-menu.open .app-menu-dropdown {
  display: grid;
}

.app-menu.open .app-menu-dropdown.flip-up {
  top: auto;
  bottom: calc(100% + 6px);
}

.app-menu-dropdown.is-portal {
  position: fixed;
  display: grid;
  z-index: 600;
  right: auto;
  bottom: auto;
}

.app-details-card {
  width: min(440px, 100%);
  max-width: 100%;
}

.app-details-list {
  margin: 0;
  display: grid;
  gap: 10px;
  min-width: 0;
}

.app-details-row {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.app-details-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.app-details-row dt {
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.app-details-row dd {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.app-details-row a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
}

.app-details-row a:hover {
  text-decoration: underline;
}

.app-menu-item {
  appearance: none;
  border: 0;
  background: transparent;
  text-align: left;
  text-decoration: none;
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.app-menu-item:hover:not(:disabled) {
  background: rgba(17, 108, 181, 0.08);
}

.app-menu-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.app-menu-danger {
  color: var(--danger);
}

.app-menu-danger:hover:not(:disabled) {
  background: rgba(194, 65, 65, 0.08);
}

.icon-upload-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon-preview {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(107, 164, 217, 0.28), rgba(215, 235, 232, 0.8));
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--blue);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.icon-preview.has-image {
  background: #fff;
  padding: 0;
}

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

.icon-upload input[type="file"] {
  flex: 1;
  min-width: 0;
  font-size: 0.86rem;
}

.field-hint {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

.env-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.env-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.env-section-head h4 {
  margin: 0 0 4px;
  font-size: 0.95rem;
  color: var(--ink);
}

.env-section-head .muted {
  margin: 0;
  font-size: 0.82rem;
}

.env-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.env-row {
  display: grid;
  grid-template-columns: minmax(7rem, 0.9fr) minmax(8rem, 1.2fr) auto;
  gap: 8px;
  align-items: center;
}

.env-row input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
  padding: 8px 10px;
  font: inherit;
  color: var(--ink);
}

.env-row input:focus {
  outline: 2px solid rgba(17, 108, 181, 0.25);
  border-color: var(--blue);
}

.env-row-remove {
  border: none;
  background: transparent;
  color: #9a3b2f;
  cursor: pointer;
  padding: 6px 8px;
  font: inherit;
  font-size: 0.85rem;
}

.env-row-remove:hover {
  text-decoration: underline;
}

.env-empty {
  margin: 0;
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .env-row {
    grid-template-columns: 1fr;
  }

  .env-row-remove {
    justify-self: start;
  }
}

.app-meta h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.app-meta-body > p,
.app-meta p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-height: calc(1.4em * 2);
  flex: 0 1 auto;
  min-width: 0;
  width: 100%;
}

.app-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.app-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  max-width: 100%;
  min-height: 1.35em;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  line-height: 1.35;
}

.app-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.app-status-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-status.running, .app-status.synced { color: var(--ok); }
.app-status.deploying { color: var(--warn); }
.app-status.error, .app-status.stopped { color: var(--danger); }

.app-status.deploying::before {
  animation: deploy-pulse 1.2s ease-in-out infinite;
}

.app-card.is-deploying {
  box-shadow: 0 0 0 1px rgba(180, 122, 18, 0.28);
}

@keyframes deploy-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.82); }
}

.app-actions {
  display: none;
}

.app-actions .btn-primary {
  background: var(--blue);
  box-shadow: 0 8px 20px rgba(17, 108, 181, 0.2);
}

.app-actions .btn-primary:hover {
  background: var(--blue-soft);
}

.modal {
  border: none;
  padding: 0;
  background: transparent;
  max-width: min(640px, calc(100vw - 32px));
  width: calc(100% - 32px);
  max-height: 90vh;
  max-height: min(90dvh, calc(100dvh - 24px));
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  margin: auto;
  /* Leave position to the UA. Safari top-layer breaks with inset:0 + flex. */
}

.modal.modal-wide {
  max-width: min(1120px, calc(100vw - 32px));
  width: min(1120px, calc(100vw - 32px));
}

.modal.modal-tall {
  max-height: 94vh;
  max-height: min(94dvh, 980px);
}

dialog.modal[open] {
  display: block;
}

.modal::backdrop {
  /* Blur on ::backdrop traps scroll and taps in Safari. Keep a flat dim. */
  background: rgba(26, 42, 54, 0.42);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.account-dialog {
  position: relative;
}

/* Stay in the dialog top-layer; fixed overlay matches login ceremony. */
.face-ceremony-local {
  z-index: 6;
}

.modal-card {
  margin: 0;
  padding: 28px;
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 28px 70px rgba(26, 42, 54, 0.18);
}

.modal-card header h3 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 400;
  color: var(--ink);
}

.modal-card header p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.modal-card header p a {
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
}

.modal-card header p a:hover {
  text-decoration: underline;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.form-grid label.full { grid-column: 1 / -1; }

.form-grid span {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--muted);
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  font: inherit;
  background: #fff;
  outline: none;
  color: var(--text);
}

.form-grid textarea {
  resize: vertical;
  min-height: 120px;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  border-color: rgba(17, 108, 181, 0.45);
  box-shadow: 0 0 0 3px rgba(17, 108, 181, 0.12);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.deploy-progress-dialog {
  max-width: min(720px, calc(100vw - 32px));
}

dialog.modal.deploy-progress-dialog[open] {
  display: block;
  max-height: 90vh;
  max-height: min(90dvh, calc(100dvh - 24px));
  overflow: hidden;
}

.deploy-progress-card {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  max-height: 90vh;
  max-height: min(90dvh, calc(100dvh - 24px));
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  flex: 1 1 auto;
  isolation: isolate;
  transform: translateZ(0);
}

.deploy-progress-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1;
  width: auto;
  height: 4px;
  pointer-events: none;
  background: linear-gradient(90deg, var(--blue), var(--sky), var(--mint), var(--blue));
  background-size: 220% 100%;
  animation: deploy-shimmer 2.8s linear infinite;
}

.deploy-progress-card.is-success::before {
  background: var(--ok);
  animation: none;
}

.deploy-progress-card.is-failed::before {
  background: var(--danger);
  animation: none;
}

.deploy-progress-x {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.deploy-progress-x:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.deploy-progress-hero {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 22px;
  align-items: center;
  margin-bottom: 18px;
  padding-right: 28px;
}

.deploy-ring {
  position: relative;
  width: 132px;
  height: 132px;
}

.deploy-ring svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 8px 18px rgba(17, 108, 181, 0.16));
}

.deploy-ring-track,
.deploy-ring-value {
  fill: none;
  stroke-width: 8;
}

.deploy-ring-track {
  stroke: rgba(17, 108, 181, 0.12);
}

.deploy-ring-value {
  stroke: url(#none);
  stroke: var(--blue);
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transform-box: fill-box;
  transition: stroke-dashoffset 0.45s ease;
}

.deploy-progress-card.is-live .deploy-ring::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 1px dashed rgba(17, 108, 181, 0.28);
  animation: deploy-spin 10s linear infinite;
}

.deploy-ring-core {
  position: absolute;
  inset: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff 0%, #eef6fb 100%);
  box-shadow: inset 0 0 0 1px rgba(17, 108, 181, 0.08);
}

.deploy-ring-core strong {
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.03em;
}

.deploy-ring-core span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.deploy-progress-kicker {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.deploy-progress-copy h3 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 400;
  color: var(--ink);
}

.deploy-progress-copy #deployProgressSubtitle {
  margin: 0 0 12px;
}

.deploy-progress-activity {
  position: relative;
  margin: 0;
  padding: 10px 12px 10px 28px;
  border-radius: 12px;
  background: rgba(17, 108, 181, 0.06);
  color: var(--ink);
  font-size: 0.86rem;
  line-height: 1.4;
  min-height: 2.6em;
  max-height: calc(1.4em * 4 + 20px);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
}

#deployProgressError {
  max-height: 7.5em;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  white-space: pre-wrap;
}

.deploy-progress-activity::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 15px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 4px rgba(180, 122, 18, 0.14);
  animation: deploy-pulse 1.2s ease-in-out infinite;
}

.deploy-progress-card.is-success .deploy-progress-activity::before {
  background: var(--ok);
  animation: none;
}

.deploy-progress-card.is-failed .deploy-progress-activity::before {
  background: var(--danger);
  animation: none;
}

.deploy-progress-meter {
  position: relative;
  height: 8px;
  margin: 0 0 18px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(17, 108, 181, 0.1);
}

.deploy-progress-meter span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--sky));
  transition: width 0.4s ease;
}

.deploy-progress-card.is-live .deploy-progress-meter span {
  background-image:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent),
    linear-gradient(90deg, var(--blue), var(--sky));
  background-size: 42% 100%, 100% 100%;
  animation: deploy-bar-shine 1.6s linear infinite;
}

.deploy-phases {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
}

.deploy-phases li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 10px 11px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
}

.deploy-phases em {
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.deploy-phases span {
  font-size: 0.88rem;
  font-weight: 650;
  color: inherit;
}

.deploy-phases small {
  color: inherit;
  opacity: 0.72;
  font-size: 0.7rem;
}

.deploy-phases li.is-active {
  border-color: rgba(180, 122, 18, 0.4);
  background: rgba(180, 122, 18, 0.1);
  color: #8a5a10;
  box-shadow: 0 0 0 3px rgba(180, 122, 18, 0.08);
}

.deploy-phases li.is-done {
  border-color: rgba(17, 108, 181, 0.28);
  background: rgba(17, 108, 181, 0.08);
  color: var(--blue);
}

.deploy-phases li.is-failed {
  border-color: rgba(176, 62, 62, 0.4);
  background: rgba(176, 62, 62, 0.08);
  color: var(--danger);
}

.deploy-progress-log-wrap {
  margin: 0 0 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #12202a;
  color: #e8f1f4;
}

.deploy-progress-log-wrap summary {
  cursor: pointer;
  padding: 10px 14px;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  color: #9ec3d6;
  list-style: none;
}

.deploy-progress-log-wrap summary::-webkit-details-marker {
  display: none;
}

.deploy-progress-log {
  max-height: min(28vh, 240px);
  overflow: auto;
  margin: 0;
  padding: 0 14px 14px;
  background: transparent;
  color: inherit;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.deploy-dock {
  position: fixed;
  left: 22px;
  bottom: 22px;
  z-index: 41;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
  max-width: min(360px, calc(100vw - 108px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 16px 40px rgba(26, 42, 54, 0.16);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.deploy-dock:hover {
  border-color: rgba(17, 108, 181, 0.35);
}

.deploy-dock-meter {
  position: relative;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  background:
    conic-gradient(var(--blue) calc(var(--dock-pct, 0) * 1%), rgba(17, 108, 181, 0.12) 0);
}

.deploy-dock-meter i {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--surface);
}

.deploy-dock-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.deploy-dock-copy strong {
  font-size: 0.9rem;
  font-weight: 650;
}

.deploy-dock-copy small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deploy-dock-pct {
  margin-left: auto;
  font-family: var(--display);
  font-size: 1.05rem;
  color: var(--blue);
}

.app-status.is-watchable {
  cursor: pointer;
}

@keyframes deploy-shimmer {
  0% { background-position: 0 0; }
  100% { background-position: 220% 0; }
}

@keyframes deploy-spin {
  to { transform: rotate(360deg); }
}

@keyframes deploy-bar-shine {
  0% { background-position: -40% 0, 0 0; }
  100% { background-position: 140% 0, 0 0; }
}

.deploy-progress-ask,
.deploy-progress-guide {
  margin: 0 0 8px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.deploy-progress-ask p,
.deploy-progress-guide p {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.5;
}

.deploy-progress-ask .modal-actions {
  margin-top: 8px;
}

.deploy-progress-card > #deployProgressFooter,
.deploy-progress-card .modal-actions {
  position: static;
}

.deploy-progress-guide-title {
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 400;
}

.deploy-progress-guide-repo {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--blue);
  word-break: break-all;
}

.deploy-progress-guide ol,
.deploy-progress-guide ul {
  margin: 0 0 14px;
  padding-left: 1.2rem;
}

.deploy-progress-guide li {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.45;
}

.deploy-progress-guide-git {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #12202a;
  color: #e8f1f4;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-x: auto;
}

.error {
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 0.88rem;
}

.hidden { display: none !important; }

.empty {
  padding: 48px 32px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.45);
}

/* Floating Labs Assistant */
.labs-assistant {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.labs-assistant-fab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  min-width: 64px;
  min-height: 64px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  aspect-ratio: 1 / 1;
  overflow: visible;
  background: var(--ink);
  color: #fafafa;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 36px rgba(26, 42, 54, 0.22);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: fabFloat 4.8s ease-in-out infinite;
}

.labs-assistant-fab:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 18px 44px rgba(17, 108, 181, 0.32);
  animation-play-state: paused;
}

.labs-assistant-fab.is-open {
  animation: none;
  transform: scale(0.94);
  box-shadow: 0 8px 24px rgba(26, 42, 54, 0.2);
}

.labs-assistant-fab.is-open:hover {
  transform: scale(0.97);
}

.fab-glow {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(107, 164, 217, 0.5), transparent 68%);
  opacity: 0.7;
  z-index: 0;
  animation: fabPulse 3.2s ease-in-out infinite;
  pointer-events: none;
}

.fab-ring {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  z-index: 0;
  pointer-events: none;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    rgba(107, 164, 217, 0.95) 12%,
    rgba(215, 235, 232, 0.7) 22%,
    transparent 38%
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 100%);
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 100%);
  animation: fabSpin 7s linear infinite;
}

.fab-logo,
.fab-label {
  position: relative;
  z-index: 1;
}

.fab-logo {
  width: 30px;
  height: 30px;
  object-fit: contain;
  animation: fabLogoBreathe 3.4s ease-in-out infinite;
}

.fab-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes fabPulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.9; transform: scale(1.08); }
}

@keyframes fabFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes fabSpin {
  to { transform: rotate(360deg); }
}

@keyframes fabLogoBreathe {
  0%, 100% { transform: scale(1); opacity: 0.92; }
  50% { transform: scale(1.08); opacity: 1; }
}

@media (min-width: 1440px) {
  .labs-assistant-fab {
    width: 72px;
    height: 72px;
    min-width: 72px;
    min-height: 72px;
  }

  .fab-logo {
    width: 34px;
    height: 34px;
  }
}

.labs-assistant-panel {
  width: min(400px, calc(100vw - 28px));
  height: min(560px, calc(100vh - 110px));
  display: flex;
  flex-direction: column;
  background: rgba(253, 254, 252, 0.94);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 28px 70px rgba(26, 42, 54, 0.18);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  overflow: hidden;
  animation: fadeUp 0.28s ease;
}

.labs-assistant-panel[hidden] {
  display: none !important;
}

.assistant-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(215, 235, 232, 0.55), transparent);
}

.assistant-kicker {
  margin: 0 0 4px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blue);
}

.assistant-header h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.assistant-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(34, 48, 59, 0.06);
  color: var(--ink);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.assistant-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px 0;
}

.assistant-suggestions button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 7px 11px;
  font: inherit;
  font-size: 0.76rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.assistant-suggestions button:hover {
  border-color: rgba(17, 108, 181, 0.35);
  background: rgba(215, 235, 232, 0.45);
}

.assistant-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.assistant-msg {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.assistant-msg.user {
  align-self: flex-end;
  background: var(--ink);
  color: #fafafa;
  border-bottom-right-radius: 4px;
}

.assistant-msg.assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.assistant-msg.assistant.streaming::after {
  content: "▋";
  margin-left: 2px;
  opacity: 0.45;
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.assistant-msg.status {
  align-self: stretch;
  max-width: 100%;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 2px 4px;
  font-style: italic;
}

.assistant-msg.assistant-org-choices {
  align-self: stretch;
  max-width: 100%;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
}

.assistant-org-prompt {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
}

.assistant-org-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.assistant-org-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 7px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--org-accent, #116cb5) 28%, var(--line));
  background: color-mix(in srgb, var(--org-accent, #116cb5) 10%, #fff);
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 650;
  cursor: pointer;
}

.assistant-org-btn img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  border-radius: 7px;
}

.assistant-org-btn:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--org-accent, #116cb5) 45%, transparent);
  background: color-mix(in srgb, var(--org-accent, #116cb5) 18%, #fff);
}

.assistant-msg.assistant-deploy-fix {
  align-self: stretch;
  max-width: 100%;
  white-space: normal;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink);
}

.assistant-deploy-fix-title {
  margin: 0 0 6px;
  font-weight: 650;
  font-size: 0.92rem;
}

.assistant-deploy-fix-lead,
.assistant-deploy-fix-next {
  margin: 0 0 10px;
  color: var(--text);
}

.assistant-deploy-fix-repo {
  display: inline-block;
  margin: 0 0 10px;
  color: var(--ink);
  word-break: break-all;
}

.assistant-deploy-fix-item {
  margin: 10px 0 4px;
  font-weight: 600;
}

.assistant-msg.assistant-deploy-fix ul {
  margin: 0 0 8px;
  padding-left: 1.2rem;
}

.assistant-msg.assistant-deploy-fix li {
  margin: 0 0 4px;
}

.assistant-org-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.assistant-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
}

.assistant-composer textarea {
  resize: none;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.9rem;
  outline: none;
  background: #fff;
  color: var(--text);
}

.assistant-composer textarea:focus {
  border-color: rgba(17, 108, 181, 0.4);
  box-shadow: 0 0 0 3px rgba(17, 108, 181, 0.1);
}

.assistant-composer .btn {
  align-self: end;
  padding: 10px 14px;
}

.account-card {
  width: min(520px, 100%);
}

.password-manage {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.password-manage .field,
.face-enroll .field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.password-manage .field span,
.face-enroll .field span {
  font-size: 0.78rem;
  color: var(--muted);
}

.password-manage .field input,
.face-enroll .field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-size: 16px;
  background: #fff;
}

.password-manage .field input:focus,
.face-enroll .field input:focus {
  outline: 2px solid rgba(17, 108, 181, 0.28);
  outline-offset: 1px;
}

.face-manage-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.face-manage-head h4 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 500;
}

.face-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.face-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
}

.face-list-item strong {
  display: block;
  color: var(--ink);
  font-size: 0.95rem;
}

.face-list-item .muted {
  font-size: 0.78rem;
}

.face-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
  background: #0d1a22;
  border: 1px solid var(--line);
  margin-bottom: 10px;
}

.face-stage-sm {
  max-width: 360px;
}

.face-stage video,
.face-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.face-stage video,
.face-stage canvas {
  transform: scaleX(-1);
}

.face-stage canvas {
  pointer-events: none;
}

.face-enroll-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.face-status {
  min-height: 1.1em;
  margin: 0 0 6px;
  font-size: 0.85rem;
}

/* Mobile / compact layouts */
@media (max-width: 720px) {
  .topbar {
    padding: 12px 14px;
    padding-top: max(12px, env(safe-area-inset-top));
    gap: 10px;
  }

  .brand span {
    font-size: 0.9rem;
  }

  .brand-logo {
    width: 26px;
    height: 26px;
  }

  .top-actions {
    gap: 8px;
    flex-shrink: 0;
  }

  .connect-btn {
    padding: 10px 14px;
    font-size: 0.84rem;
  }

  .connect-btn .label-full {
    display: none;
  }

  .connect-btn .label-short {
    display: inline;
  }

  .profile-meta {
    display: none;
  }

  .profile-btn {
    padding: 6px;
  }

  .modal.modal-wide,
  .modal.modal-tall,
  .deploy-progress-dialog {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    max-height: min(92dvh, calc(100dvh - env(safe-area-inset-top, 0px)));
  }

  .drugbank-card {
    max-height: min(94dvh, 100%);
  }

  .drugbank-layout {
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
    flex: 1;
    min-height: 0;
    overflow: auto;
  }

  .drugbank-list-wrap {
    max-height: 28vh;
  }

  .drugbank-preview-wrap {
    min-height: 36vh;
    height: auto;
  }

  .users-table-wrap {
    max-height: 36vh;
  }

  .store {
    padding: 28px 16px calc(96px + env(safe-area-inset-bottom));
  }

  .hero-actions {
    margin-top: 22px;
  }

  .hero-points {
    margin-top: 22px;
    flex-direction: column;
    gap: 8px;
  }

  .site-nav {
    gap: 12px;
  }

  .site-nav a {
    font-size: 0.82rem;
  }

  .story-section {
    margin-bottom: 36px;
  }

  .feature-grid,
  .steps,
  .branch-grid {
    grid-template-columns: 1fr;
  }

  .company-strip {
    padding: 22px 16px;
  }

  .landing-footer {
    padding: 22px 16px calc(28px + env(safe-area-inset-bottom));
  }

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

  .contact-section {
    margin-top: 36px;
  }

  .hero h1 {
    font-size: clamp(2.4rem, 11vw, 3.2rem);
  }

  .hero-copy {
    font-size: 1.02rem;
    line-height: 1.55;
  }

  .section-head {
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-bottom: 16px;
  }

  .section-head h2 {
    font-size: 1.28rem;
  }

  .cluster-section {
    margin-bottom: 36px;
  }

  .cluster-totals {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .cluster-nodes {
    grid-template-columns: 1fr;
  }

  .node-metrics {
    grid-template-columns: 1fr;
  }

  .apps-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .app-card {
    height: 168px;
    min-height: 168px;
    max-height: 168px;
    padding: 16px;
    border-radius: 18px;
  }

  .app-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }

  .app-card-top {
    gap: 12px;
  }

  .app-card.is-public {
    height: auto;
    min-height: 168px;
    max-height: none;
  }

  .app-card:hover {
    transform: none;
  }

  .app-card:active {
    transform: scale(0.995);
  }

  .app-actions {
    flex-wrap: wrap;
  }

  .app-actions .btn {
    flex: 1 1 auto;
    min-width: calc(50% - 6px);
  }

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

  /* Bottom sheet. Avoid inset shorthand — Safari dialogs mishandle it. */
  dialog.modal[open] {
    display: block;
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 92vh;
    max-height: min(92dvh, calc(100dvh - env(safe-area-inset-top, 0px)));
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 22px 22px 0 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .modal::backdrop {
    background: rgba(26, 42, 54, 0.45);
  }

  .modal-card,
  .account-card,
  .app-details-card {
    width: 100%;
    max-width: 100%;
    border-radius: 22px 22px 0 0;
    max-height: none;
    overflow: visible;
    padding: 20px 16px max(16px, env(safe-area-inset-bottom));
    box-shadow: 0 -12px 48px rgba(26, 42, 54, 0.18);
  }

  dialog.modal.deploy-progress-dialog[open] {
    overflow: hidden;
  }

  .modal-card.deploy-progress-card {
    max-height: 92vh;
    max-height: min(92dvh, calc(100dvh - env(safe-area-inset-top, 0px)));
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .app-details-card {
    display: flex;
    flex-direction: column;
  }

  .app-details-card header {
    flex-shrink: 0;
    padding-right: 4px;
  }

  .app-details-card header h3 {
    font-size: 1.28rem;
    overflow-wrap: anywhere;
  }

  .app-details-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 2px;
  }

  .app-details-row {
    grid-template-columns: minmax(5.75rem, 34%) minmax(0, 1fr);
    gap: 4px 12px;
    align-items: start;
  }

  .app-details-row dt {
    padding-top: 2px;
    line-height: 1.35;
  }

  .app-details-row dd {
    font-size: 0.9rem;
  }

  .modal-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    flex-wrap: wrap;
    justify-content: stretch;
    background: linear-gradient(180deg, transparent, var(--surface) 28%);
    padding-top: 16px;
    margin-top: 8px;
  }

  .modal-actions .btn {
    flex: 1 1 auto;
    min-width: min(100%, 132px);
  }

  .face-stage-sm {
    max-width: none;
  }

  .face-enroll-actions .btn {
    flex: 1;
  }

  .labs-assistant {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
  }

  .fab-label {
    display: none;
  }

  .labs-assistant-fab {
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
    padding: 0;
  }

  .labs-assistant-panel {
    position: fixed;
    inset: max(10px, env(safe-area-inset-top)) 10px max(72px, env(safe-area-inset-bottom)) 10px;
    width: auto;
    height: auto;
    max-height: none;
    border-radius: 18px;
  }

  .assistant-suggestions {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .assistant-suggestions::-webkit-scrollbar {
    display: none;
  }

  .assistant-composer {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 640px) {
  .deploy-progress-card {
    display: block;
    overflow: auto;
    padding: 16px 14px max(14px, env(safe-area-inset-bottom));
  }

  .deploy-progress-x {
    top: 10px;
    right: max(10px, env(safe-area-inset-right));
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
  }

  .deploy-progress-hero {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 12px;
    justify-items: stretch;
    align-items: start;
    text-align: left;
    padding-right: 28px;
    margin-bottom: 12px;
  }

  .deploy-ring {
    width: 88px;
    height: 88px;
  }

  .deploy-ring-core {
    inset: 14px;
  }

  .deploy-ring-core strong {
    font-size: 1.1rem;
  }

  .deploy-ring-core span {
    font-size: 0.64rem;
  }

  .deploy-progress-copy {
    min-width: 0;
  }

  .deploy-progress-copy h3 {
    font-size: 1.2rem;
    margin-bottom: 6px;
    overflow-wrap: anywhere;
  }

  .deploy-progress-copy #deployProgressSubtitle {
    margin-bottom: 8px;
    font-size: 0.84rem;
  }

  .deploy-progress-activity {
    text-align: left;
    padding: 8px 10px 8px 26px;
    font-size: 0.8rem;
    min-height: 0;
  }

  .deploy-progress-activity::before {
    top: 13px;
    left: 10px;
  }

  .deploy-progress-meter {
    margin-bottom: 12px;
  }

  .deploy-phases {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 12px;
  }

  .deploy-phases li {
    padding: 8px 8px 9px;
  }

  .deploy-progress-log-wrap {
    flex: 1 1 auto;
    min-height: 72px;
    margin-bottom: 10px;
  }

  .deploy-progress-log {
    max-height: min(16vh, 120px);
  }

  .deploy-progress-ask,
  .deploy-progress-guide {
    padding: 12px 12px 4px;
  }

  .deploy-progress-ask .modal-actions,
  #deployProgressFooter.modal-actions {
    flex-direction: column-reverse;
    justify-content: stretch;
  }

  .deploy-progress-ask .modal-actions .btn,
  #deployProgressFooter .btn {
    width: 100%;
    min-width: 0;
  }

  .deploy-dock {
    left: max(12px, env(safe-area-inset-left));
    right: max(80px, calc(56px + 16px + env(safe-area-inset-right)));
    bottom: max(16px, env(safe-area-inset-bottom));
    max-width: none;
    min-width: 0;
    padding: 10px 12px;
  }
}

@media (max-width: 420px) {
  .cluster-totals {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    font-size: 0.98rem;
  }

  .topbar .btn-text:last-child {
    /* Keep Sign out reachable but compact */
    padding-left: 6px;
    padding-right: 6px;
  }

  .app-details-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .deploy-progress-hero {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 10px;
    padding-right: 24px;
  }

  .deploy-ring {
    width: 76px;
    height: 76px;
  }

  .deploy-ring-core {
    inset: 12px;
  }

  .deploy-ring-core strong {
    font-size: 0.98rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mist, .hero, .apps-section, .app-card, .fab-glow, .fab-ring, .fab-logo, .labs-assistant-fab, .labs-assistant-panel,
  .deploy-progress-card::before, .deploy-progress-card.is-live .deploy-ring::after,
  .deploy-progress-card.is-live .deploy-progress-meter span, .deploy-progress-activity::before {
    animation: none;
  }
}

@media (hover: none) {
  .app-card:hover,
  .btn-primary:hover,
  .labs-assistant-fab:hover {
    transform: none;
  }
}
