/* Reset and base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: #333;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  margin-bottom: 40px;
  color: white;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

header p {
  font-size: 1.1rem;
  opacity: 0.9;
}

.card {
  background: white;
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.card h2 {
  color: #2c3e50;
  margin-bottom: 20px;
  font-size: 1.8rem;
  border-bottom: 2px solid #ecf0f1;
  padding-bottom: 10px;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 2px solid #ecf0f1;
  padding-bottom: 10px;
  margin-bottom: 20px;
}

.card-header-row h2 {
  margin-bottom: 0;
  border-bottom: 0;
  padding-bottom: 0;
}

.tenant-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding: 2px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 0.9rem;
  margin-left: 8px;
}

.card h3 {
  color: #34495e;
  margin-bottom: 15px;
  font-size: 1.3rem;
}

.features ul {
  list-style: none;
  padding: 0;
}

.features li {
  padding: 8px 0;
  border-bottom: 1px solid #ecf0f1;
}

.features li:last-child {
  border-bottom: none;
}

.user-info {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.user-details p {
  margin-bottom: 10px;
  font-size: 1rem;
}

.user-details strong {
  color: #2c3e50;
  display: inline-block;
  width: 120px;
}

.json-container {
  background: #2d3748;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 20px;
  overflow-x: auto;
  margin-bottom: 15px;
}

.json-container pre {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}

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

.tenant-login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 100;
}

.tenant-login-form label {
  font-weight: 600;
  color: #2c3e50;
}

.tenant-login-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tenant-login-row input {
  flex: 1 1 240px;
  padding: 10px 12px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  font-size: 1rem;
}

.tenant-login-helper {
  font-size: 0.9rem;
  color: #6c757d;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-field label {
  font-weight: 600;
  color: #2c3e50;
}

.form-field input {
  padding: 10px 12px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  font-size: 0.95rem;
}

.form-field input[readonly] {
  background: #f8f9fa;
  color: #495057;
}

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

.input-with-button {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.input-with-button input {
  flex: 1 1 360px;
}

.form-helper {
  font-size: 0.85rem;
  color: #6c757d;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.status-panel {
  min-height: 80px;
  background: #f8f9fa;
  border-radius: 8px;
  padding: 16px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid transparent;
}

.status-idle {
  color: #6c757d;
}

.status-loading {
  color: #1f2d3d;
  border-color: #d0d7de;
}

.status-success {
  color: #0f5132;
  border-color: #badbcc;
  background: #d1e7dd;
}

.status-error {
  color: #842029;
  border-color: #f5c2c7;
  background: #f8d7da;
}

.tenant-table-wrapper {
  overflow-x: auto;
}

.tenant-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.tenant-table th,
.tenant-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #ecf0f1;
  vertical-align: top;
}

.tenant-table th {
  font-weight: 600;
  color: #2c3e50;
  background: #f8f9fa;
  position: sticky;
  top: 0;
  z-index: 1;
}

.tenant-table tbody tr:hover {
  background: #f4f6fb;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-pill-active {
  background: #d1e7dd;
  color: #0f5132;
}

.status-pill-error {
  background: #f8d7da;
  color: #842029;
}

/* Button styles */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background: #5a6268;
  transform: translateY(-1px);
}

.btn-danger {
  background: #dc3545;
  color: white;
}

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

.btn-success {
  background: #198754;
  color: white;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.role-select {
  padding: 4px 8px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  font-size: 0.9rem;
  background: #fff;
  cursor: pointer;
}

/* Responsive design */
@media (max-width: 600px) {
  .container {
    padding: 10px;
  }

  header h1 {
    font-size: 2rem;
  }

  .card {
    padding: 20px;
  }

  .actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: ' ...';
  animation: dots 1.5s infinite;
}

@keyframes dots {
  0%, 20% { content: ' ...'; }
  40% { content: ' .'; }
  60% { content: ' ..'; }
  80% { content: ' ...'; }
}

/* Summary page: app choice on dashboard gradient background */
.summary-page {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.summary-container {
  max-width: 920px;
}

.summary-header {
  color: white;
}

.summary-header p {
  opacity: 0.8;
}

.summary-card {
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.app-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.app-choice-square {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 190px;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  text-decoration: none;
  color: #111827;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.app-choice-square:hover {
  transform: translateY(-3px);
  border-color: #c7d2fe;
  box-shadow: 0 12px 24px rgba(99, 102, 241, 0.12);
}

.app-choice-title {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
}

.app-choice-link {
  margin-top: 10px;
  font-size: 0.9rem;
  color: #4b5563;
  word-break: break-word;
}

/* Hymaia portal shell: scoped to non-admin views */
@font-face {
  font-family: 'Greycliff CF';
  src: url('/brand/GreycliffCF-Light.ttf') format('truetype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Greycliff CF';
  src: url('/brand/GreycliffCF-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Greycliff CF';
  src: url('/brand/GreycliffCF-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Greycliff CF';
  src: url('/brand/GreycliffCF-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Greycliff CF';
  src: url('/brand/GreycliffCF-ExtraBold.ttf') format('truetype');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

body.portal-shell {
  --portal-bg: #0d0d1a;
  --portal-surface: rgba(255, 255, 255, 0.92);
  --portal-surface-strong: #ffffff;
  --portal-ink: #1b1768;
  --portal-ink-soft: rgba(12, 18, 38, 0.72);
  --portal-line: rgba(209, 205, 251, 0.8);
  --portal-violet: #4a31ff;
  --portal-cyan: #05c7f2;
  --portal-cloud: #e9e9ff;
  --portal-glow: rgba(74, 49, 255, 0.22);
  font-family: 'Greycliff CF', 'Segoe UI', sans-serif;
  color: #f8f8ff;
  background:
    radial-gradient(circle at top left, rgba(74, 49, 255, 0.24), transparent 34%),
    radial-gradient(circle at top right, rgba(5, 199, 242, 0.2), transparent 24%),
    linear-gradient(180deg, #0d0d1a 0%, #16143a 55%, #0d0d1a 100%);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.portal-shell__backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.portal-shell__orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(10px);
  opacity: 0.7;
}

.portal-shell__orb--violet {
  top: 88px;
  left: -80px;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(74, 49, 255, 0.52), rgba(74, 49, 255, 0));
}

.portal-shell__orb--cyan {
  right: -120px;
  top: 180px;
  width: 340px;
  height: 340px;
  background: radial-gradient(circle, rgba(5, 199, 242, 0.45), rgba(5, 199, 242, 0));
}

.portal-shell__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(217, 217, 217, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(217, 217, 217, 0.06) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 85%);
}

.portal-shell__frame {
  position: relative;
  z-index: 1;
  width: min(1200px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(217, 217, 217, 0.18);
}

.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: #ffffff;
}

.portal-brand__logo {
  width: 118px;
  height: auto;
}

.portal-topbar__right {
  display: flex;
  align-items: center;
}

.portal-lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.portal-brand__text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.portal-brand__text strong {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.portal-brand__text span {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.72);
}

.portal-main {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.portal-footer {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid rgba(217, 217, 217, 0.14);
}

.portal-footer__note {
  font-size: 0.85rem;
  line-height: 1.4;
  color: rgba(248, 248, 255, 0.64);
  text-align: right;
}

.portal-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.9fr);
  gap: 24px;
  align-items: stretch;
}

.portal-hero__copy,
.portal-hero__meta {
  border-radius: 28px;
  backdrop-filter: blur(12px);
}

.portal-hero__copy {
  padding: 34px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 30px 80px rgba(7, 10, 28, 0.34);
}

.portal-hero__meta {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.portal-eyebrow {
  margin-bottom: 14px;
  color: #d9d9d9;
  font-size: 0.88rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.portal-headline {
  max-width: 12ch;
  font-size: clamp(2.6rem, 5vw, 4.6rem);
  line-height: 0.96;
  letter-spacing: -0.05em;
  font-weight: 800;
}

.portal-accent-chartreuse {
  color: rgb(220, 244, 47);
}

.portal-intro {
  max-width: 58ch;
  margin-top: 18px;
  color: rgba(248, 248, 255, 0.78);
  font-size: 1.05rem;
  line-height: 1.55;
}

.portal-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.portal-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.portal-metric {
  min-height: 124px;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 20px 44px rgba(7, 10, 28, 0.24);
}

.portal-metric--violet {
  background: linear-gradient(180deg, rgba(74, 49, 255, 0.94), rgba(37, 24, 129, 0.98));
}

.portal-metric--cyan {
  background: linear-gradient(180deg, rgba(5, 199, 242, 0.9), rgba(7, 103, 126, 0.98));
}

.portal-metric--white {
  color: var(--portal-ink);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(233, 233, 255, 0.94));
}

.portal-metric__label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  opacity: 0.74;
}

.portal-metric__value {
  font-size: clamp(1.1rem, 1.8vw, 1.28rem);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.portal-panel {
  padding: 24px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(209, 205, 251, 0.84);
  color: var(--portal-ink);
  box-shadow: 0 24px 50px rgba(7, 10, 28, 0.18);
}

.portal-panel--stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.portal-panel__kicker {
  color: rgba(27, 23, 104, 0.64);
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.portal-panel__title {
  font-size: 1.4rem;
  line-height: 1.1;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.portal-panel__body {
  color: rgba(12, 18, 38, 0.72);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.portal-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: rgba(12, 18, 38, 0.78);
}

.portal-list li {
  position: relative;
  padding-left: 20px;
  line-height: 1.45;
}

.portal-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--portal-cyan), var(--portal-violet));
}

.portal-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.portal-shell--login .portal-content {
  align-items: center;
}

.portal-shell--login .portal-main {
  gap: 28px;
}

.portal-shell--login .portal-hero {
  display: block;
}

.portal-shell--login .portal-hero__copy {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 0 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  text-align: left;
}

.portal-shell--login .portal-headline {
  max-width: none;
  font-size: clamp(2.8rem, 6vw, 4.9rem);
}

.portal-shell--summary .portal-headline {
  max-width: 14ch;
  font-size: clamp(2.4rem, 4.2vw, 4rem);
  line-height: 1;
  overflow-wrap: anywhere;
}

.portal-shell--summary .portal-headline br {
  display: block;
  content: '';
}

.portal-shell--login .portal-intro {
  margin-top: 12px;
  max-width: none;
  font-size: 1.15rem;
  line-height: 1.45;
}

.portal-grid {
  display: grid;
  gap: 20px;
}

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

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

.portal-grid--account {
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.75fr);
}

.portal-card,
.portal-app-card {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  padding: 28px;
  background: var(--portal-surface);
  border: 1px solid var(--portal-line);
  box-shadow: 0 26px 64px rgba(7, 10, 28, 0.16);
  color: var(--portal-ink);
  text-decoration: none;
}

.portal-card::before,
.portal-app-card::before {
  content: '';
  position: absolute;
  inset: auto -30% 0 auto;
  width: 180px;
  height: 180px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(74, 49, 255, 0.14), rgba(74, 49, 255, 0));
  pointer-events: none;
}

.portal-card__eyebrow,
.portal-app-card__badge {
  display: inline-flex;
  align-items: center;
  margin-bottom: 14px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(27, 23, 104, 0.62);
}

.portal-card__title,
.portal-app-card__title {
  font-size: clamp(1.5rem, 2.4vw, 2.15rem);
  line-height: 1;
  letter-spacing: -0.04em;
  font-weight: 800;
}

.portal-card__body,
.portal-app-card__body {
  margin-top: 14px;
  color: var(--portal-ink-soft);
  line-height: 1.55;
}

.portal-card--form,
.portal-card--spotlight {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(233, 233, 255, 0.96));
}

.portal-card--login {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 24px;
}

.portal-card--accent,
.portal-app-card--primary {
  background: linear-gradient(180deg, rgba(10, 15, 54, 0.96), rgba(33, 27, 109, 0.98));
  color: #f9faff;
  border-color: rgba(90, 82, 204, 0.7);
}

.portal-card--accent .portal-card__eyebrow,
.portal-card--accent .portal-card__body,
.portal-app-card--primary .portal-app-card__badge,
.portal-app-card--primary .portal-app-card__body {
  color: rgba(249, 250, 255, 0.78);
}

.portal-app-card--secondary {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(224, 251, 255, 0.94));
}

.portal-app-card {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.portal-app-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 34px 80px rgba(7, 10, 28, 0.22);
}

.portal-app-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 28px;
  font-weight: 700;
}

.portal-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 22px;
}

.portal-form[hidden] {
  display: none;
}

.portal-form--compact {
  margin-top: 18px;
}

.portal-form__panel {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 14px;
  padding-top: 6px;
}

.portal-form__panel[hidden] {
  display: none;
}

.portal-form__panel .portal-field {
  flex: 1 1 320px;
}

.portal-form__panel .portal-form__actions {
  flex: 1 1 100%;
}

.portal-form__panel .portal-field__error {
  flex: 1 1 100%;
  text-align: left;
}

.portal-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.portal-field__label {
  font-size: 0.92rem;
  font-weight: 700;
  color: rgba(27, 23, 104, 0.78);
}

.portal-field__error {
  font-size: 0.88rem;
  font-weight: 600;
  color: #c0392b;
  margin: 0;
}

.portal-field input {
  width: 100%;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(209, 205, 251, 0.96);
  background: rgba(255, 255, 255, 0.84);
  color: var(--portal-ink);
  font: inherit;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.portal-field input:focus {
  outline: none;
  border-color: var(--portal-violet);
  box-shadow: 0 0 0 4px rgba(74, 49, 255, 0.12);
  transform: translateY(-1px);
}

.portal-form__actions,
.portal-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
  justify-content: flex-start;
  align-items: stretch;
}

.portal-form__actions > *,
.portal-inline-actions > * {
  flex: 1 1 180px;
}

.portal-login-actions {
  margin-top: 18px;
}

.portal-card--login .portal-card__title {
  margin-top: 6px;
}

.portal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.portal-btn:hover {
  transform: translateY(-2px);
}

.portal-btn--primary {
  color: white;
  background: linear-gradient(135deg, #05c7f2 0%, #4a31ff 100%);
  box-shadow: 0 18px 40px rgba(74, 49, 255, 0.24);
}

.portal-btn--secondary {
  color: var(--portal-ink);
  background: #ffffff;
  border-color: rgba(209, 205, 251, 0.96);
}

.portal-btn--ghost {
  color: white;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

.portal-btn--danger {
  color: white;
  background: #d94064;
  box-shadow: 0 18px 36px rgba(217, 64, 100, 0.24);
}

.portal-inline-actions[hidden] {
  display: none;
}

.portal-returning-actions {
  flex-direction: column;
  align-items: stretch;
}

.portal-returning-actions > * {
  flex: 0 0 auto;
}

.portal-btn--link {
  min-height: 0;
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: var(--portal-accent, #4a31ff);
  font-weight: 600;
  text-decoration: underline;
  box-shadow: none;
}

.portal-btn--link:hover {
  transform: none;
  text-decoration: none;
}

.portal-card__header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.portal-card--compact {
  display: flex;
  flex-direction: column;
}

.portal-card--full {
  grid-column: 1 / -1;
}

.portal-card--code pre {
  margin: 0;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.portal-json {
  margin-top: 22px;
  background: linear-gradient(180deg, #11162d 0%, #1a2044 100%);
  border: 1px solid rgba(74, 49, 255, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.portal-definition-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.portal-definition-list div {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(209, 205, 251, 0.76);
}

.portal-definition-list dt {
  margin-bottom: 6px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(27, 23, 104, 0.56);
}

.portal-definition-list dd {
  margin: 0;
  color: var(--portal-ink);
  line-height: 1.35;
  word-break: break-word;
}

.portal-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(74, 49, 255, 0.08);
  border: 1px solid rgba(74, 49, 255, 0.16);
}

.portal-note__label {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(74, 49, 255, 0.14);
  color: var(--portal-violet);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.portal-note a {
  color: var(--portal-ink);
  font-weight: 700;
}

.portal-card--danger {
  background: linear-gradient(180deg, rgba(255, 246, 249, 0.98), rgba(255, 235, 240, 0.98));
  border-color: rgba(217, 64, 100, 0.28);
}

.portal-field__hint {
  margin: 0;
  font-size: 0.88rem;
  color: rgba(12, 18, 38, 0.62);
}

.portal-status {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid transparent;
  font-weight: 600;
  line-height: 1.45;
}

.portal-status--loading {
  background: rgba(74, 49, 255, 0.08);
  border-color: rgba(74, 49, 255, 0.18);
  color: var(--portal-ink);
}

.portal-status--success {
  background: rgba(5, 199, 242, 0.09);
  border-color: rgba(5, 199, 242, 0.22);
  color: var(--portal-ink);
}

.portal-status--error {
  background: rgba(217, 64, 100, 0.1);
  border-color: rgba(217, 64, 100, 0.24);
  color: #8d1735;
}

@media (max-width: 980px) {
  .portal-hero,
  .portal-grid--login,
  .portal-grid--apps,
  .portal-grid--dashboard,
  .portal-grid--account {
    grid-template-columns: 1fr;
  }

  .portal-metric-grid {
    grid-template-columns: 1fr;
  }

  .portal-definition-list {
    grid-template-columns: 1fr;
  }

  .portal-headline {
    max-width: none;
  }
}

@media (max-width: 640px) {
  .portal-shell__frame {
    width: min(100vw - 18px, 100%);
    padding-top: 18px;
  }

  .portal-topbar {
    margin-bottom: 18px;
  }

  .portal-brand {
    align-items: flex-start;
    gap: 12px;
  }

  .portal-brand__logo {
    width: 92px;
  }

  .portal-hero__copy,
  .portal-card,
  .portal-app-card,
  .portal-panel {
    padding: 22px;
    border-radius: 22px;
  }

  .portal-card__header-row {
    flex-direction: column;
    align-items: stretch;
  }

  .portal-btn,
  .portal-inline-actions > * {
    width: 100%;
  }

  .portal-note {
    flex-direction: column;
    align-items: flex-start;
  }

  .portal-footer__note {
    text-align: left;
  }
}
