/**
 * Portal-only layout.
 *
 * Hakban's colours, typography, density, controls, header, blocks, code rows,
 * and icons come from demo/styles.css through /dashboard.css. Keep only the
 * authenticated portal's composition rules here so the two surfaces cannot
 * drift into separate themes.
 */

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font: var(--text)/var(--lead) var(--font);
}

.portal-bar {
  background: var(--bg);
}

main {
  width: 100%;
}

main.portal-auth {
  max-width: 36rem;
  margin: 0 auto;
  padding: 32px 28px 48px;
}

main.portal-page {
  min-height: calc(100vh - 36px);
  margin: 0;
  padding: 0 0 40px;
}

h1 {
  margin: 0;
  font-size: var(--title);
  line-height: var(--lead);
  font-weight: 650;
}

p {
  margin: 0 0 16px;
}

.muted {
  color: var(--muted);
}

label {
  display: block;
  margin: 20px 0 var(--lbl-control-gap);
  color: var(--muted);
}

input[type="email"] {
  width: 100%;
  height: var(--field-height);
  padding: var(--field-pad-y) var(--field-pad-x);
  border: 0;
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--fg);
}

input[type="email"]:focus {
  background: var(--field-focus-fill);
}

form > .inference-auth__btn {
  margin-top: 12px;
}

.portal-page__head {
  justify-content: flex-start;
}

.portal-page__lead {
  margin: 0;
  color: var(--muted);
}

.portal-section {
  border-top: 0;
}

.portal-section + .portal-section {
  border-top: 1px solid var(--line);
}

.portal-section__head h2 {
  flex: 1;
}

.portal-section__meta {
  color: var(--muted);
  font-size: 0.6875rem;
  line-height: var(--field-line);
}

.portal-code-row--secret .desk-code__pre {
  color: var(--good);
}

.portal-key-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--gap);
  min-height: 36px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--line);
}

.portal-key-row__identity {
  display: flex;
  align-items: baseline;
  min-width: 0;
  gap: 10px;
}

.portal-key-row__identity code {
  flex-shrink: 0;
  font: 0.6875rem/var(--field-line) ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

.portal-key-row__identity time {
  min-width: 0;
  color: var(--muted);
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
}

.portal-key-row__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.portal-key-row--empty {
  color: var(--muted);
}

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

@media (max-width: 640px) {
  main.portal-auth {
    padding: 24px 16px 40px;
  }

  .portal-page__head {
    height: auto;
    min-height: var(--col-head);
    flex-wrap: wrap;
    padding-top: 5px;
    padding-bottom: 5px;
  }

  .portal-key-row,
  .portal-key-row__identity {
    align-items: flex-start;
  }

  .portal-key-row__identity {
    flex-direction: column;
    gap: 1px;
  }
}

/* Sign-in and invitation controls only; desk density remains unchanged. */
main#app.portal-auth .inference-auth__btn:focus-visible, main#app.portal-auth input:focus-visible, main#app.portal-auth a:focus-visible {
  box-shadow: inset 0 0 0 2px var(--bronze);
}
.portal-auth button[aria-busy="true"] { cursor: progress; }

.portal-auth > .inference-auth__btn + .inference-auth__btn { margin-left: 8px; }
