:root {
  color-scheme: light;
  --bg: #f2efe8;
  --bg-strong: #e4ddcf;
  --panel: rgba(255, 251, 245, 0.92);
  --panel-strong: #fffaf2;
  --border: rgba(56, 44, 23, 0.18);
  --ink: #1f1b16;
  --muted: #695f53;
  --accent: #9f3a22;
  --accent-dark: #6e2415;
  --ok: #2d6f43;
  --warn: #b86d14;
  --bad: #b11f1f;
  --shadow: 0 16px 48px rgba(73, 43, 24, 0.12);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(159, 58, 34, 0.16), transparent 26%),
    radial-gradient(circle at top right, rgba(45, 111, 67, 0.12), transparent 22%),
    linear-gradient(180deg, #f7f3ec 0%, var(--bg) 48%, #ece6da 100%);
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
}

a {
  color: var(--accent-dark);
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) minmax(280px, 1.4fr) auto minmax(220px, 1fr);
  gap: 1rem;
  align-items: end;
  padding: 1rem 1.5rem;
  background: rgba(247, 243, 236, 0.86);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.brand-block {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.brand-kicker,
.header-label,
.column-kicker,
.summary-meta,
.inline-note {
  font-family: "Avenir Next Condensed", "Franklin Gothic Medium", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--muted);
}

.brand {
  font-family: Georgia, serif;
  font-size: 1.85rem;
  color: var(--accent-dark);
}

.admin-key-wrap,
.principal-wrap,
.field-stack {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.key-input-row {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.key-input-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.icon-button,
button,
input,
select,
textarea {
  border-radius: 12px;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
}

textarea,
pre {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

button {
  border: 1px solid transparent;
  background: linear-gradient(180deg, #b3472d 0%, var(--accent) 100%);
  color: #fffaf4;
  padding: 0.72rem 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(159, 58, 34, 0.16);
}

button.secondary,
.icon-button {
  background: rgba(255, 255, 255, 0.7);
  color: var(--accent-dark);
  border-color: rgba(159, 58, 34, 0.22);
  box-shadow: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.auth-lock {
  width: 0.95rem;
  height: 0.95rem;
  flex: 0 0 auto;
  border-radius: 999px;
  display: inline-block;
  background: #b0a99e;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.65);
}

.auth-lock.ok {
  background: var(--ok);
}

.auth-lock.fail {
  background: var(--bad);
}

.health-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  justify-content: center;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink);
  box-shadow: none;
}

.dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  background: #b0a99e;
}

.dot.ok {
  background: var(--ok);
}

.dot.bad {
  background: var(--bad);
}

.dot.warn {
  background: var(--warn);
}

.admin-auth-error {
  margin: 0;
  padding: 0.85rem 1.5rem;
  background: rgba(177, 31, 31, 0.12);
  color: var(--bad);
  border-bottom: 1px solid rgba(177, 31, 31, 0.2);
}

.page-shell {
  padding: 1.2rem 1.3rem 2.5rem;
}

.page-intro {
  max-width: 68rem;
  margin: 0 auto 1.2rem;
  color: var(--muted);
  font-size: 1.03rem;
}

.column-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.app-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.column-header {
  position: sticky;
  top: 5.2rem;
  z-index: 5;
  padding: 1rem 1.05rem;
  background: linear-gradient(180deg, rgba(247, 243, 236, 0.94), rgba(247, 243, 236, 0.78));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.column-header h1 {
  margin: 0.2rem 0;
  font-size: 1.4rem;
  color: var(--accent-dark);
}

.column-header p {
  margin: 0;
  color: var(--muted);
}

.section-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: clip;
}

.section-card summary {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.95rem 1rem;
  cursor: pointer;
  list-style: none;
  font-family: "Avenir Next Condensed", "Franklin Gothic Medium", sans-serif;
  letter-spacing: 0.03em;
  font-size: 1rem;
}

.section-card summary::-webkit-details-marker {
  display: none;
}

.section-card summary::after {
  content: "+";
  font-size: 1.15rem;
  color: var(--accent);
}

.section-card[open] summary::after {
  content: "-";
}

.section-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid rgba(56, 44, 23, 0.08);
}

.actions,
.failure-toolbar {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.compact-form,
.field-grid {
  display: grid;
  gap: 0.8rem;
}

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

.single-column {
  grid-template-columns: 1fr;
}

.status-rows {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.status-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid rgba(56, 44, 23, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.58);
}

.status-row-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.status-row strong {
  font-size: 1rem;
}

.status-row-meta {
  color: var(--muted);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.badge {
  align-self: start;
  max-width: 100%;
  border-radius: 999px;
  padding: 0.28rem 0.55rem;
  font-size: 0.72rem;
  font-family: "Avenir Next Condensed", "Franklin Gothic Medium", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge.ok {
  background: rgba(45, 111, 67, 0.12);
  color: var(--ok);
}

.badge.warn {
  background: rgba(184, 109, 20, 0.12);
  color: var(--warn);
}

.badge.error {
  background: rgba(177, 31, 31, 0.12);
  color: var(--bad);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.6rem;
}

th,
td {
  padding: 0.72rem 0.45rem;
  border-top: 1px solid rgba(56, 44, 23, 0.1);
  text-align: left;
  vertical-align: top;
}

th {
  font-family: "Avenir Next Condensed", "Franklin Gothic Medium", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: var(--muted);
}

.principal-scopes {
  margin-top: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.scope-chip {
  display: inline-block;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: rgba(159, 58, 34, 0.08);
  color: var(--accent-dark);
  font-size: 0.74rem;
}

.project-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.project-card {
  border-radius: 16px;
  border: 1.5px solid rgba(56, 44, 23, 0.16);
  background: rgba(255, 255, 255, 0.65);
  box-shadow: 0 2px 10px rgba(56, 44, 23, 0.07);
  overflow: clip;
}

.project-card-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: start;
  padding: 0.85rem 0.95rem 0.7rem;
  border-bottom: 2px solid rgba(159, 58, 34, 0.2);
  background: linear-gradient(180deg, rgba(159, 58, 34, 0.07), rgba(159, 58, 34, 0.02));
}

.project-card-head h3 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--accent-dark);
  font-weight: 700;
}

.project-card > .project-scope,
.project-card > table,
.project-card > .add-member-row,
.project-card > .inline-status {
  margin-left: 0.95rem;
  margin-right: 0.95rem;
}

.add-member-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.75rem;
  margin-bottom: 0.55rem;
}

.add-member-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.add-member-row button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.project-card-meta {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

.project-scope {
  margin: 0.55rem 0 0;
  color: var(--muted);
}

.inline-status,
.status-banner {
  margin: 0.55rem 0 0;
  color: var(--muted);
}

.status-banner {
  padding: 0.8rem 0.9rem;
  border-radius: 14px;
  background: rgba(56, 44, 23, 0.05);
}

.status-banner.ok {
  background: rgba(45, 111, 67, 0.1);
  color: var(--ok);
}

.status-banner.warn {
  background: rgba(184, 109, 20, 0.1);
  color: var(--warn);
}

.status-banner.error {
  background: rgba(177, 31, 31, 0.1);
  color: var(--bad);
}

.step-card {
  margin-top: 1rem;
  padding: 0.9rem;
  border-radius: 16px;
  border: 1px solid rgba(56, 44, 23, 0.08);
  background: rgba(255, 255, 255, 0.54);
}

.step-heading {
  font-family: "Avenir Next Condensed", "Franklin Gothic Medium", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-dark);
  font-size: 0.8rem;
}

.mini-table {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.35rem;
}

.mini-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  background: rgba(56, 44, 23, 0.05);
  color: var(--muted);
}

.claims-grid {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.claim-card {
  padding: 0.75rem 0.85rem;
  border-radius: 14px;
  background: rgba(56, 44, 23, 0.05);
}

.claim-key {
  font-family: "Avenir Next Condensed", "Franklin Gothic Medium", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--accent-dark);
  font-size: 0.72rem;
}

.claim-value {
  margin: 0.25rem 0 0.35rem;
  word-break: break-word;
}

.claim-explanation {
  color: var(--muted);
  margin: 0;
}

.deliver-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 0.9rem;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 0.9rem;
  border-radius: 14px;
  background: rgba(29, 23, 18, 0.9);
  color: #f4efe7;
  min-height: 6rem;
}

.failure-list {
  display: grid;
  gap: 0.7rem;
}

.failure-card {
  border-radius: 15px;
  border: 1px solid rgba(56, 44, 23, 0.08);
  background: rgba(255, 255, 255, 0.58);
  padding: 0.85rem 0.95rem;
}

.failure-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: start;
}

.failure-title {
  margin: 0;
  font-size: 1rem;
}

.failure-meta,
.failure-copy {
  color: var(--muted);
  margin: 0.35rem 0 0;
}

.timeline {
  margin: 0.75rem 0;
  padding-left: 1.15rem;
  color: var(--muted);
}

.about-card summary {
  background: rgba(45, 111, 67, 0.07);
}

.about-list {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
}

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

@media (max-width: 1100px) {
  .app-header {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

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

  .column-header {
    position: static;
  }
}

@media (max-width: 760px) {
  .page-shell {
    padding: 1rem 0.8rem 2rem;
  }

  .compact-form,
  .field-grid,
  .deliver-grid {
    grid-template-columns: 1fr;
  }

  .status-row,
  .failure-head {
    grid-template-columns: 1fr;
    display: grid;
  }
}
