/* The operator site: the sign-in pages (body.signin) look like the console's;
   the dashboard (body.app) is a plain, dense view of the platform. */
:root {
  --bg: #fbfaf8;
  --surface: #ffffff;
  --surface-2: #f4f2ee;
  --text: #1d1b18;
  --text-2: #4f4b45;
  --text-3: #6b665e;
  --border: #d5d0c7;
  --line: #e8e4dd;
  --accent: #2c6a53;
  --on-accent: #ffffff;
  --ink: #1d1b18;
  --on-ink: #ffffff;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #8a5a00;
  --warn-soft: #fbf1dc;
  --ok-soft: #e4f2ec;
  --shadow: 0 1px 2px rgb(29 27 24 / 0.04), 0 16px 48px -20px rgb(29 27 24 / 0.22);
  color-scheme: light dark;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1a18;
    --surface: #242320;
    --surface-2: #2c2a27;
    --text: #eeece8;
    --text-2: #cdc8c0;
    --text-3: #a39d94;
    --border: #47443e;
    --line: #36332f;
    --accent: #84c9ad;
    --on-accent: #10221b;
    --ink: #eeece8;
    --on-ink: #1b1a18;
    --danger: #f2a197;
    --danger-soft: #3a2421;
    --warn: #e9c46a;
    --warn-soft: #362d1a;
    --ok-soft: #1e3029;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 16px 48px -20px rgb(0 0 0 / 0.7);
  }
}

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

body {
  margin: 0;
  background: var(--bg);
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  line-height: 1.25;
}

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

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9375em;
}

input,
select {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}

.hint,
.muted {
  margin: 0;
  color: var(--text-3);
  font-size: 0.875rem;
}

.error {
  margin: 0 0 20px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.9375rem;
}

[hidden] {
  display: none !important;
}

/* Sign-in and setup */

.signin {
  min-height: 100dvh;
  padding: calc(48px + env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px));
}

.card {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 24px;
  border-radius: 13px;
  background: var(--accent);
  color: var(--on-accent);
}

.signin h1 {
  font-family: ui-serif, "New York", "Iowan Old Style", "Apple Garamond", Georgia, Cambria, serif;
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.015em;
}

.lead {
  margin: 8px 0 28px;
  color: var(--text-2);
  font-size: 1.0625rem;
}

.signin form {
  display: grid;
  gap: 8px;
}

.signin label {
  font-size: 0.9375rem;
  font-weight: 500;
}

.signin label:not(:first-of-type) {
  margin-top: 10px;
}

.signin input {
  width: 100%;
  min-height: 50px;
  padding: 0 16px;
  border-radius: 14px;
  font-size: 1rem;
}

.signin form > button:not(.link) {
  min-height: 50px;
  margin-top: 20px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.signin form.quiet {
  margin-top: 12px;
  justify-items: center;
}

.qr {
  display: block;
  width: 200px;
  height: 200px;
  margin: 0 auto 16px;
  border-radius: 12px;
  background: #ffffff;
}

.key {
  margin-bottom: 24px;
  color: var(--text-2);
  font-size: 0.9375rem;
}

.key summary {
  cursor: pointer;
  text-align: center;
}

.key code {
  font-size: 1.0625rem;
  letter-spacing: 0.04em;
  word-break: break-word;
}

@media (min-width: 640px) {
  .signin {
    display: grid;
    place-items: center;
    padding-top: 24px;
  }

  .card {
    padding: 40px;
    border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
    border-radius: 24px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-ink);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.button.secondary {
  border-color: var(--border);
  background: transparent;
  color: var(--text);
}

.button.small {
  min-height: 32px;
  padding: 0 12px;
  font-size: 0.875rem;
}

.button:disabled {
  opacity: 0.5;
  cursor: default;
}

.button:focus-visible,
.link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-3);
  font: inherit;
  font-size: 0.9375rem;
  text-decoration: underline;
  cursor: pointer;
}

/* Dashboard */

.bar {
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
}

.bar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 16px;
}

.brand {
  font-size: 1rem;
}

#nav {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 4px;
}

/* Phone: the sections on a row of their own, scrolling sideways. */
@media (max-width: 639px) {
  .bar-inner {
    justify-content: space-between;
  }

  #nav {
    flex: 1 0 100%;
    order: 3;
    flex-wrap: nowrap;
    margin: 0 -16px;
    padding: 0 12px;
    overflow-x: auto;
  }
}

#nav a {
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 0.9375rem;
  text-decoration: none;
}

#nav a:hover {
  background: var(--surface-2);
}

#nav a[aria-current="page"] {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.page h2 {
  font-size: 1.375rem;
}

.page h3 {
  margin-top: 32px;
  margin-bottom: 4px;
  font-size: 1.0625rem;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 4px;
}

.back {
  display: inline-block;
  margin-bottom: 12px;
  font-size: 0.9375rem;
  text-decoration: none;
}

.summary {
  margin: 4px 0 20px;
  color: var(--text-2);
}

.notice {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 3;
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--on-ink);
  box-shadow: var(--shadow);
  font-size: 0.9375rem;
}

.notice.bad {
  background: var(--danger-soft);
  color: var(--danger);
}

.panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.panel-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel p {
  margin: 0;
}

/* Tables scroll sideways on their own, never the page. */
.table-wrap {
  margin-top: 8px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: 0;
}

th {
  color: var(--text-3);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.nowrap {
  white-space: nowrap;
}

.title-cell {
  min-width: 220px;
  max-width: 420px;
}

td input,
td select {
  min-height: 32px;
  padding: 0 8px;
  font-size: 0.875rem;
}

td input[type="number"] {
  width: 72px;
}

.chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.8125rem;
  white-space: nowrap;
}

.chip.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.chip.bad {
  background: var(--danger-soft);
  color: var(--danger);
}

.chip.ok {
  background: var(--ok-soft);
  color: var(--accent);
}

/* Limit forms */

.limits {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px 20px;
  margin-top: 8px;
}

.field {
  display: grid;
  gap: 4px;
  align-content: start;
}

.field label {
  font-size: 0.9375rem;
  font-weight: 600;
}

.field input,
.field select {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.invite-link {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding: 16px;
  border-radius: 14px;
  background: var(--ok-soft);
}

.invite-link code {
  word-break: break-all;
}

details.more {
  margin-top: 16px;
}

details.more summary {
  cursor: pointer;
  font-weight: 600;
}
