/* Merritt console.
 *
 * The design brief is the product's own rule: a client profile holds business
 * facts you may edit and deployment infrastructure you may not even see. So the
 * page is built as a RECORD with a sealed section — the withheld part is drawn,
 * labelled, and explained, rather than omitted (invisible) or greyed out
 * (which would imply the values are here, merely disabled).
 *
 * Two accents with two jobs, never decorative:
 *   --live    teal    this is yours, it is editable, it is in the database now
 *   --sealed  violet  this is held elsewhere and is not sent to the browser
 */

:root {
  --paper:   #EDF1F7;
  --surface: #FFFFFF;
  --ink:     #121722;
  --muted:   #5A6478;
  --line:    #C7D0E0;
  --live:    #0B6E62;
  --live-bg: #E2F1EE;
  --sealed:  #5B4CA0;
  --sealed-bg: #ECE9F8;
  --warn:    #A3231C;
  --warn-bg: #FBE9E7;

  --display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --step: 0.5rem;
  --rule: 1px solid var(--line);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:   #0E1219;
    --surface: #161C26;
    --ink:     #E7ECF5;
    --muted:   #98A3B8;
    --line:    #2B3444;
    --live:    #5FD3C0;
    --live-bg: #102C29;
    --sealed:  #A99BF0;
    --sealed-bg: #1D1A33;
    --warn:    #FF9C93;
    --warn-bg: #2E1614;
  }
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--display);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* --- masthead ----------------------------------------------------------- */
/* The tenant is stated as a specimen label, not a page title: on a fleet
 * console, WHICH client you are editing is the single most consequential fact
 * on screen, and mistaking it is the expensive mistake. */

.masthead {
  border-bottom: var(--rule);
  background: var(--surface);
  padding: calc(var(--step) * 3) calc(var(--step) * 3) calc(var(--step) * 2);
}

.masthead__inner,
.sheet { max-width: 60rem; margin: 0 auto; }

.wordmark {
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 calc(var(--step) * 1.5);
}

.tenant-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: calc(var(--step) * 2);
}

.tenant-bar__label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

select, input, textarea {
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: var(--rule);
  border-radius: 2px;
  padding: calc(var(--step) * 0.75) var(--step);
}

select {
  font-family: var(--mono);
  font-size: 1.05rem;
  border: 0;
  border-bottom: 2px solid var(--live);
  border-radius: 0;
  padding-left: 0;
  background: transparent;
}

:focus-visible {
  outline: 2px solid var(--live);
  outline-offset: 2px;
}

/* --- the record --------------------------------------------------------- */

.sheet { padding: calc(var(--step) * 4) calc(var(--step) * 3) calc(var(--step) * 10); }

.section { margin-bottom: calc(var(--step) * 5); }

.section__head {
  display: flex;
  align-items: baseline;
  gap: var(--step);
  border-bottom: var(--rule);
  padding-bottom: var(--step);
  margin-bottom: calc(var(--step) * 2);
}

.section__title {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

.section__note {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  margin-left: auto;
}

.field {
  display: grid;
  grid-template-columns: 14rem 1fr;
  gap: calc(var(--step) * 2);
  align-items: start;
  padding: calc(var(--step) * 1.5) 0;
  border-bottom: 1px dotted var(--line);
}

.field:last-child { border-bottom: 0; }

.field__label {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  padding-top: calc(var(--step) * 1.1);
}

.field__hint {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  opacity: 0.85;
}

.field input, .field textarea { width: 100%; }
.field textarea { min-height: 5rem; resize: vertical; }

/* Entrance: one quiet orchestrated moment on load, so a long record reads as
 * arriving in order rather than appearing all at once. */
.field, .sealed {
  animation: rise 420ms cubic-bezier(0.2, 0.7, 0.3, 1) backwards;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .field, .sealed { animation: none; }
  * { transition: none !important; }
}

/* --- the signature: what this console will not show you ------------------ */

.sealed {
  border: 1px solid var(--sealed);
  border-left-width: 4px;
  background: var(--sealed-bg);
  border-radius: 2px;
  padding: calc(var(--step) * 2.5);
}

.sealed__title {
  font-size: 0.95rem;
  margin: 0 0 calc(var(--step) * 0.5);
  color: var(--sealed);
}

.sealed__body {
  margin: 0 0 calc(var(--step) * 2);
  font-size: 0.9rem;
  color: var(--muted);
  max-width: 46ch;
}

.sealed__list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--mono);
  font-size: 0.78rem;
}

.sealed__list li {
  display: flex;
  justify-content: space-between;
  gap: var(--step);
  padding: calc(var(--step) * 0.75) 0;
  border-top: 1px solid color-mix(in srgb, var(--sealed) 25%, transparent);
}

.sealed__where { color: var(--sealed); }

/* --- actions ------------------------------------------------------------ */

.actionbar {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: var(--rule);
  padding: calc(var(--step) * 1.5) calc(var(--step) * 3);
  display: flex;
  align-items: center;
  gap: calc(var(--step) * 2);
}

.actionbar__inner {
  max-width: 60rem;
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  gap: calc(var(--step) * 2);
}

button {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 2px;
  padding: calc(var(--step) * 1.1) calc(var(--step) * 2.5);
  background: var(--live);
  color: var(--surface);
  cursor: pointer;
}
button:disabled { opacity: 0.45; cursor: default; }
button.ghost {
  background: transparent;
  color: var(--muted);
  border: var(--rule);
}

.status {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  margin-left: auto;
  text-align: right;
}
.status[data-tone="live"] { color: var(--live); }
.status[data-tone="warn"] { color: var(--warn); }

.banner {
  border: 1px solid var(--warn);
  background: var(--warn-bg);
  color: var(--warn);
  border-radius: 2px;
  padding: calc(var(--step) * 1.5) calc(var(--step) * 2);
  margin-bottom: calc(var(--step) * 3);
  font-size: 0.9rem;
}
.banner[hidden] { display: none; }

.signin {
  max-width: 28rem;
  margin: 18vh auto;
  padding: calc(var(--step) * 4);
  background: var(--surface);
  border: var(--rule);
  border-radius: 2px;
  text-align: center;
}

@media (max-width: 44rem) {
  .field { grid-template-columns: 1fr; gap: calc(var(--step) * 0.5); }
  .field__label { padding-top: 0; }
  .status { width: 100%; text-align: left; margin-left: 0; }
  .actionbar__inner { flex-wrap: wrap; }
}
