/* microlab-web demo theme: plain CSS, light and dark, no build step. */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #1c2030;
  --muted: #6b7183;
  --border: #e3e6ee;
  --accent: #4f46e5;
  --accent-text: #ffffff;
  --accent-soft: #eef0ff;
  --danger: #dc2626;
  --ok: #15803d;
  --ok-soft: #e8f6ec;
  --error-soft: #fdecec;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1117;
    --surface: #171a23;
    --text: #e6e8ef;
    --muted: #9aa0b3;
    --border: #262a36;
    --accent: #818cf8;
    --accent-text: #0f1117;
    --accent-soft: #1f2340;
    --danger: #f87171;
    --ok: #4ade80;
    --ok-soft: #12261a;
    --error-soft: #2c1517;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.05rem; margin-top: .25rem; }
h3 { font-size: 1rem; }
code { font-size: .875em; background: var(--accent-soft); padding: .1em .35em; border-radius: 6px; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* Layout */
.container { width: 100%; max-width: 960px; margin: 0 auto; padding: 1.5rem 1rem 3rem; flex: 1; }
.footer { text-align: center; font-size: .8rem; padding: 1.5rem 1rem; }
.topbar {
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  padding: .75rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; color: var(--text); display: flex; align-items: center; gap: .5rem; }
.brand:hover { text-decoration: none; }
.logo { color: var(--accent); }
.nav { display: flex; gap: .25rem; }
.nav a { color: var(--muted); padding: .375rem .75rem; border-radius: 8px; }
.nav a:hover { background: var(--accent-soft); color: var(--text); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.account { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.avatar {
  width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-text); font-weight: 700; font-size: .875rem;
}
.who { font-size: .9rem; }
.page-head { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; overflow-wrap: anywhere; }
.grid { display: grid; gap: 1rem; margin-bottom: 1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

/* Surfaces */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.25rem;
}
.card + .card { margin-top: 1rem; }
.card.narrow { max-width: 520px; margin: 2rem auto; }
.hero { text-align: center; padding: 3rem 1rem 2rem; }
.hero h1 { font-size: 2.25rem; }
.lead { font-size: 1.125rem; color: var(--muted); max-width: 640px; margin: 0 auto 1.5rem; }
.features { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.features .card + .card { margin-top: 0; }
.empty { text-align: center; }

/* Forms and buttons */
input, textarea, select {
  width: 100%; font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: .55rem .75rem;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
select { width: auto; }
button, .button {
  font: inherit; font-weight: 600; cursor: pointer; border: 1px solid transparent; border-radius: 8px;
  padding: .55rem 1rem; background: var(--accent); color: var(--accent-text);
  display: inline-flex; align-items: center; gap: .4rem;
}
.button:hover { text-decoration: none; }
button:disabled { opacity: .6; cursor: progress; }
button.secondary { background: var(--accent-soft); color: var(--accent); }
button.ghost { background: transparent; color: var(--muted); border-color: var(--border); padding: .35rem .75rem; }
button.danger { background: var(--danger); color: #fff; }
button.icon { background: transparent; color: var(--muted); padding: .2rem .45rem; font-weight: 400; }
button.icon:hover { color: var(--danger); background: var(--error-soft); }
.compose { display: grid; gap: .6rem; margin-bottom: 1.25rem; }

/* Notes */
.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.note + .note { margin-top: 0; }
.note p { margin: .25rem 0 .5rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-head { display: flex; justify-content: space-between; align-items: start; gap: .5rem; }
.note-head h3 { margin: 0; overflow-wrap: anywhere; }
.note time { font-size: .8rem; }
.note.htmx-added { animation: appear .25s ease-out; }
@keyframes appear { from { opacity: 0; transform: translateY(-4px); } }

/* Data */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.pill, .chip, .status {
  display: inline-block; font-size: .8rem; font-weight: 600; padding: .15rem .6rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.chips { list-style: none; padding: 0; margin: 0 0 .75rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 500; }
.chip.small { font-size: .75rem; margin: 0 .2rem .2rem 0; }
.role-admin { background: #fff4e5; color: #b45309; }
.role-support { background: #fdeaf3; color: #be185d; }
@media (prefers-color-scheme: dark) {
  .role-admin { background: #2d2010; color: #fbbf24; }
  .role-support { background: #2d1422; color: #f472b6; }
}
.status.active { background: var(--ok-soft); color: var(--ok); }
.status.disabled { background: var(--error-soft); color: var(--danger); }
.table-wrap { overflow-x: auto; padding: 0; }
.table { width: 100%; border-collapse: collapse; font-size: .925rem; }
.table th, .table td { text-align: left; padding: .7rem 1rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.table tr:last-child td { border-bottom: 0; }
.rights { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.switch { display: flex; align-items: center; gap: .6rem; cursor: pointer; font-family: ui-monospace, Menlo, monospace; font-size: .9rem; }
.switch input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
.audit { margin: 0; padding-left: 1.25rem; display: grid; gap: .35rem; font-size: .925rem; }

/* Messages */
.alert { border-radius: 8px; padding: .7rem 1rem; margin-bottom: 1rem; font-weight: 500; }
.alert.error { background: var(--error-soft); color: var(--danger); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }

/* htmx (its own indicator styles are off: no inline styles under the CSP) */
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.spinner {
  width: .9rem; height: .9rem; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .who { display: none; }
  .account { margin-left: 0; }
  .hero h1 { font-size: 1.75rem; }
}
