/* Selra portal layout — navy+cyan tokens from ../styles.css */

.portal-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.portal-main {
  flex: 1;
  padding: 48px 0 72px;
}

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

/* Config banner */
.config-banner {
  margin-bottom: 20px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(34, 211, 238, 0.35);
  background: rgba(34, 211, 238, 0.08);
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.config-banner code {
  font-size: 0.85em;
  color: var(--cyan);
}

.config-banner.access-gated {
  border-color: rgba(34, 211, 238, 0.55);
  background: rgba(15, 23, 42, 0.72);
  color: var(--ink);
}
.config-banner.access-gated strong {
  color: var(--cyan);
}

/* Login */
.portal-login {
  max-width: 520px;
  margin: 0 auto;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 36px 36px;
  text-align: left;
}

.login-card .mark-md {
  display: block;
  margin-bottom: 12px;
  border-radius: 10px;
}

.login-card h1 {
  margin: 8px 0 12px;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.login-card h1 em {
  font-style: normal;
  color: var(--cyan);
}

.login-lede {
  color: var(--ink-soft);
  margin: 0 0 24px;
  font-size: 0.98rem;
}

.login-form label {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.login-form input[type="email"],
.chat-form textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--panel-2);
  color: var(--ink);
  margin-bottom: 14px;
}

.login-form input:focus,
.chat-form textarea:focus {
  outline: 2px solid var(--cyan);
  outline-offset: 1px;
}

.login-form .button {
  width: 100%;
  justify-content: center;
}

.login-status {
  margin: 16px 0 0;
  font-size: 0.92rem;
  color: var(--ink-soft);
  min-height: 1.4em;
}

.login-status.ok { color: var(--ok); }
.login-status.err { color: #f87171; }

.dev-fallback {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
}

.dev-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
  margin: 0 0 8px;
}

.dev-copy {
  margin: 0 0 12px;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.api-probe {
  margin: 12px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.2em;
}

.api-probe.ok { color: var(--ok); }
.api-probe.err { color: #f87171; }

/* Dashboard */
.portal-dash {
  max-width: var(--max);
}

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.dash-identity {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dash-identity .mark-sm {
  border-radius: 8px;
}

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

.dash-workspace {
  margin: 0;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.dash-email {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.api-error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  margin-bottom: 20px;
  color: #fecaca;
}

/* Tabs */
.portal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.portal-tabs .tab {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.portal-tabs .tab:hover {
  border-color: var(--cyan);
  color: var(--ink);
}

.portal-tabs .tab.active {
  background: linear-gradient(135deg, var(--blue), var(--cyan-deep));
  border-color: transparent;
  color: #fff;
}

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

.console-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font: 11px ui-monospace, "DM Mono", monospace;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}

.live-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--cyan);
}

.live-label i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.25);
}

.panel-meta {
  padding: 12px 14px;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 0.9rem;
}

.panel-meta p { margin: 0; }

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

.section-head h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.section-lede {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 40rem;
}

.section-meta {
  margin: 0;
  font: 11px ui-monospace, "DM Mono", monospace;
  color: var(--faint);
}

/* Home panels */
.home-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
}

.home-panel {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 14px;
  min-height: 140px;
  display: flex;
  flex-direction: column;
}

.home-panel h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.home-panel .source-note {
  margin: 0 0 12px;
  font-size: 0.72rem;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.home-panel .count-pill {
  align-self: flex-start;
  font: 700 11px ui-monospace, "DM Mono", monospace;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.12);
  border-radius: 999px;
  padding: 2px 8px;
  margin-bottom: 10px;
}

.home-item {
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.home-item:first-of-type {
  border-top: 0;
}

.home-item-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
}

.home-item-detail {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.home-empty {
  margin: auto 0 0;
  font-size: 0.85rem;
  color: var(--faint);
  line-height: 1.4;
}

/* Work buckets */
.bucket-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.bucket-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px;
  min-height: 160px;
}

.bucket-card h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.bucket-card .bucket-count {
  font: 700 11px ui-monospace, "DM Mono", monospace;
  color: var(--cyan);
  margin: 0 0 12px;
}

.work-item {
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.work-item:first-of-type { border-top: 0; }

.work-item-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.work-item-meta {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.bucket-empty {
  color: var(--faint);
  font-size: 0.88rem;
  margin-top: 8px;
}

/* Chat */
.chat-shell {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 420px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  max-height: min(55vh, 520px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

.chat-bubble {
  padding: 12px 14px;
  border-radius: 12px;
  max-width: 92%;
  font-size: 0.92rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-bubble.user {
  align-self: flex-end;
  background: rgba(26, 107, 255, 0.22);
  border: 1px solid rgba(26, 107, 255, 0.35);
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.chat-bubble .who {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--faint);
  margin-bottom: 4px;
}

.chat-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--warn);
}

.chat-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-form textarea {
  flex: 1;
  margin-bottom: 0;
  resize: vertical;
  min-height: 52px;
}

.chat-form .button {
  flex-shrink: 0;
}

.chat-empty {
  margin: auto;
  color: var(--faint);
  text-align: center;
  font-size: 0.95rem;
}

/* Cost metrics */
.portal-metric-row {
  display: flex;
  flex-wrap: wrap;
  gap: 28px 36px;
  padding: 22px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.portal-metric-row > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.portal-metric-row strong {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.portal-metric-row span {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.portal-metric-row .metric-accent strong {
  color: var(--cyan);
}

.cost-detail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.55;
}

.cost-detail ul {
  margin: 0;
  padding-left: 1.2em;
}

/* Health */
.health-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 20px;
}

.health-status {
  margin: 0 0 12px;
  font-size: 1.05rem;
  font-weight: 700;
}

.health-status.ok { color: var(--ok); }
.health-status.err { color: #f87171; }

.health-json {
  margin: 0;
  padding: 14px;
  background: var(--panel-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  overflow-x: auto;
  font: 12px ui-monospace, "DM Mono", monospace;
  color: var(--ink-soft);
  max-height: 360px;
}

.portal-generated {
  margin: 22px 0 0;
  font-size: 0.8rem;
  color: var(--faint);
  text-align: right;
}

@media (max-width: 900px) {
  .home-grid,
  .bucket-grid {
    grid-template-columns: 1fr 1fr;
  }
  .portal-metric-row {
    gap: 20px 24px;
  }
}

@media (max-width: 560px) {
  .home-grid,
  .bucket-grid {
    grid-template-columns: 1fr;
  }
  .login-card {
    padding: 28px 22px;
  }
  .portal-main {
    padding: 28px 0 48px;
  }
  .dash-header {
    flex-direction: column;
    align-items: stretch;
  }
  .dash-actions {
    width: 100%;
  }
  .dash-actions .button {
    flex: 1;
    justify-content: center;
  }
  .chat-form {
    flex-direction: column;
    align-items: stretch;
  }
  .portal-metric-row strong {
    font-size: 1.25rem;
  }
  .portal-tabs .tab {
    flex: 1 1 auto;
    text-align: center;
  }
}

/* Live app sign-in — distinct from marketing product-chip */
.app-sign-in-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--cyan);
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.status-dot.pulse {
  animation: selra-dot-pulse 1.8s ease-in-out infinite;
}
@keyframes selra-dot-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18); opacity: 1; }
  50% { box-shadow: 0 0 0 6px rgba(34, 211, 238, 0.08); opacity: 0.85; }
}
