:root {
  color-scheme: light;
  --bg: #eef4fb;
  --card: #ffffff;
  --ink: #142033;
  --muted: #64748b;
  --blue: #0f4c81;
  --blue-2: #1e6aa5;
  --border: #d7e2ee;
  --soft: #f6f9fc;
  --ok: #0f766e;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(15, 76, 129, 0.12);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: radial-gradient(circle at top left, #dceeff, transparent 34rem), var(--bg);
  color: var(--ink);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1.25rem clamp(1rem, 3vw, 2.5rem);
  background: linear-gradient(135deg, var(--blue), #17324d);
  color: white;
  box-shadow: var(--shadow);
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .35rem; font-size: clamp(1.8rem, 4vw, 3rem); }
h2 { font-size: 1.2rem; margin-bottom: .4rem; }
h3 { margin-bottom: 0; }
.subtitle { margin-bottom: 0; color: #dbeafe; max-width: 55rem; }
.eyebrow { margin-bottom: .2rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; color: #9bbfe4; font-weight: 700; }
.status-card { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); border-radius: 1rem; padding: 1rem 1.2rem; min-width: 8rem; text-align: center; }
.status-card strong { display: block; font-size: 2rem; }
.status-card span { color: #dbeafe; }

.shell { padding: clamp(1rem, 3vw, 2.5rem); display: grid; gap: 1.25rem; }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: 1.25rem; padding: clamp(1rem, 2vw, 1.5rem); box-shadow: var(--shadow); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.section-title { display: flex; justify-content: space-between; gap: 1rem; align-items: start; margin-bottom: 1rem; }
.muted { color: var(--muted); }
.empty { padding: 1rem; background: var(--soft); border: 1px dashed var(--border); border-radius: .9rem; color: var(--muted); }

.stack { display: grid; gap: .75rem; }
.stack.compact { margin-top: .75rem; }
label { display: grid; gap: .35rem; font-weight: 700; color: #24344d; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: .8rem;
  padding: .7rem .8rem;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
textarea { resize: vertical; }
button, .link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  text-decoration: none;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  padding: .62rem .9rem;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
}
button:hover, .link-button:hover { transform: translateY(-1px); box-shadow: 0 10px 25px rgba(15, 76, 129, .12); }
.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.danger-button { background: #fff1f0; border-color: #fecaca; color: var(--danger); }

.versions { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 1rem; }
.version-card { border: 1px solid var(--border); border-radius: 1.1rem; padding: 1rem; background: linear-gradient(180deg, #fff, #f9fbfe); display: grid; gap: .9rem; }
.version-card.running { border-color: rgba(15,118,110,.35); box-shadow: 0 0 0 3px rgba(15,118,110,.08); }
.card-head { display: flex; justify-content: space-between; gap: 1rem; }
.pill { border-radius: 999px; padding: .35rem .65rem; font-size: .75rem; font-weight: 800; text-transform: uppercase; height: fit-content; }
.pill.running { background: #ccfbf1; color: #115e59; }
.pill.stopped { background: #e2e8f0; color: #475569; }
.notes { color: var(--muted); margin: 0; min-height: 1.5rem; }
.facts { display: grid; gap: .45rem; margin: 0; font-size: .86rem; }
.facts div { display: grid; grid-template-columns: 5.5rem minmax(0,1fr); gap: .5rem; }
.facts dt { color: var(--muted); font-weight: 700; }
.facts dd { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.danger { color: var(--danger); }
.actions { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; }
.inline-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: 0; }
.inline-form input[type=number] { max-width: 8rem; }
.checkbox { display: inline-flex; grid-template-columns: auto; align-items: center; gap: .35rem; font-weight: 600; color: var(--muted); }
.checkbox input { width: auto; }
details { background: var(--soft); border: 1px solid var(--border); border-radius: .9rem; padding: .75rem; }
summary { cursor: pointer; font-weight: 800; }
.danger-zone { margin-top: .75rem; border-top: 1px solid var(--border); padding-top: .75rem; }
.smallprint { color: var(--muted); font-size: .92rem; }
.smallprint p { margin-bottom: .35rem; word-break: break-all; }

@media (max-width: 760px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .grid-2 { grid-template-columns: 1fr; }
  .versions { grid-template-columns: 1fr; }
  .facts div { grid-template-columns: 1fr; gap: .1rem; }
  .section-title { flex-direction: column; }
}

.flash {
  border-radius: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #eef6ff;
  color: #12345a;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}
.flash.error { background: #fff1f2; color: #7f1d1d; border-color: rgba(220, 38, 38, 0.25); }
.flash.warning { background: #fffbeb; color: #78350f; border-color: rgba(245, 158, 11, 0.35); }
.flash.success { background: #ecfdf5; color: #064e3b; border-color: rgba(16, 185, 129, 0.25); }
.diagnostics { display: grid; gap: 14px; }
.diagnostic-card { border: 1px solid rgba(15, 23, 42, 0.1); border-radius: 16px; padding: 14px; background: #f8fafc; }
.diagnostic-card pre { white-space: pre-wrap; overflow-wrap: anywhere; background: #0f172a; color: #e5e7eb; border-radius: 12px; padding: 12px; font-size: 12px; max-height: 320px; overflow: auto; }
.ok { color: #166534; font-weight: 700; }
code { background: rgba(15, 23, 42, 0.08); border-radius: 6px; padding: 1px 5px; }

.actions-row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

.release-panel { border-color: rgba(15, 76, 129, .28); }
.inline-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.release-checkbox { align-self: end; min-height: 44px; }
.history-list { display: grid; gap: .6rem; margin-top: .75rem; }
.history-item { display: grid; gap: .15rem; padding: .7rem; border: 1px solid var(--border); border-radius: .8rem; background: #fff; }
.history-item span, .history-item small { color: var(--muted); overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .inline-grid { grid-template-columns: 1fr; }
}


/* v0.1.10 readability + wrapping patch */
button, .link-button, .case-nav a, .actions-row a, .actions a {
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: normal;
  min-width: 0;
  max-width: 100%;
  text-align: center;
}
.version-card, .panel, .card-head, .facts, .notes, .smallprint, .flash, .diagnostic-card {
  min-width: 0;
  overflow-wrap: anywhere;
}
.facts dd {
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
}
.pill, .case-pill {
  white-space: normal !important;
  line-height: 1.25;
  text-align: center;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.case-table td, .case-table th, code {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.case-next-action {
  display: inline-block;
  background: #f0ece2;
  color: #111827;
  border: 1px solid #d6d0c4;
  border-radius: .75rem;
  padding: .35rem .55rem;
  font-weight: 800;
  line-height: 1.25;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.dual-track-panel {
  border: 2px solid rgba(12,10,9,.16);
}

/* v0.2.55 host portal: public front page plus protected internal manager. */
.portal-body {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(255,250,240,.92), rgba(232,222,207,.92)),
    #f6efe4;
  color: #0d0c0a;
}

.portal-shell {
  min-height: 100vh;
  padding: clamp(16px, 3vw, 38px);
  display: grid;
}

.portal-hero {
  width: min(1180px, 100%);
  min-height: calc(100vh - clamp(32px, 6vw, 76px));
  margin: auto;
  border: 1px solid rgba(20, 18, 14, .16);
  border-radius: 28px;
  background: #fffaf0;
  box-shadow: 0 34px 90px rgba(20, 18, 14, .16);
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: minmax(0, 1.08fr) minmax(310px, .62fr);
  overflow: hidden;
}

.portal-nav {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px clamp(18px, 3vw, 36px);
  border-bottom: 1px solid rgba(20, 18, 14, .12);
}

.portal-nav strong {
  font-size: 1.04rem;
  letter-spacing: -.01em;
}

.portal-nav div,
.portal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.portal-nav a,
.portal-primary,
.portal-secondary {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 999px;
  padding: 10px 16px;
  border: 1px solid rgba(20, 18, 14, .18);
  font-weight: 850;
  color: #0d0c0a;
  background: rgba(255,255,255,.62);
}

.portal-nav a.quiet,
.portal-secondary {
  color: #62594b;
}

.portal-primary {
  background: #0d0c0a;
  color: #fffaf0;
  border-color: #0d0c0a;
}

.portal-primary.disabled {
  background: #756b5c;
  border-color: #756b5c;
}

.portal-copy {
  padding: clamp(28px, 7vw, 88px) clamp(24px, 6vw, 76px);
  align-self: center;
}

.portal-copy .eyebrow,
.auth-card .eyebrow {
  color: #756b5c;
  letter-spacing: .16em;
}

.portal-copy h1 {
  max-width: 860px;
  margin: 0 0 20px;
  font-size: clamp(4rem, 10vw, 9.7rem);
  line-height: .84;
  letter-spacing: -.055em;
}

.portal-lede {
  max-width: 680px;
  margin-bottom: 26px;
  color: #4d453b;
  font-size: clamp(1.05rem, 1.55vw, 1.32rem);
  line-height: 1.55;
  font-weight: 650;
}

.portal-brief {
  margin: clamp(20px, 4vw, 48px);
  padding: clamp(22px, 3vw, 34px);
  align-self: center;
  min-height: 430px;
  border-radius: 24px;
  background: #0d0c0a;
  color: #fffaf0;
  display: grid;
  align-content: end;
  gap: 14px;
  box-shadow: inset 6px 0 0 #d7bd6d;
}

.portal-brief span {
  font-size: clamp(4rem, 9vw, 8rem);
  line-height: .78;
  font-weight: 950;
}

.portal-brief strong {
  font-size: clamp(1.8rem, 4vw, 3.4rem);
  letter-spacing: -.04em;
}

.portal-brief p {
  color: #ded4c2;
  font-weight: 650;
}

.portal-mini-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.portal-mini-grid em {
  font-style: normal;
  border: 1px solid rgba(255,250,240,.2);
  border-radius: 12px;
  padding: 10px;
  color: #fffaf0;
  background: rgba(255,250,240,.06);
  font-size: .86rem;
  font-weight: 800;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(460px, 100%);
  border: 1px solid rgba(20, 18, 14, .14);
  border-radius: 22px;
  padding: clamp(22px, 4vw, 34px);
  background: #fffaf0;
  box-shadow: 0 24px 70px rgba(20, 18, 14, .14);
}

.auth-card h1 {
  color: #0d0c0a;
}

.auth-card .hint a {
  color: #62594b;
  font-weight: 800;
}

@media (max-width: 860px) {
  .portal-hero {
    grid-template-columns: 1fr;
  }
  .portal-copy h1 {
    font-size: clamp(3.4rem, 18vw, 7rem);
  }
  .portal-brief {
    min-height: 290px;
    margin-top: 0;
  }
}

@media (max-width: 560px) {
  .portal-shell {
    padding: 0;
  }
  .portal-hero {
    min-height: 100vh;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
  .portal-nav {
    align-items: flex-start;
    flex-direction: column;
  }
  .portal-actions,
  .portal-actions a {
    width: 100%;
  }
}
