/* document-editor — Quip / Notion / Google Docs flavour.
   Sans-serif chrome, serif body, generous whitespace, light-mode-first.
   The document IS the UI: headings act as structural cues, content sits
   on a centred page-shaped column. */

:root {
  --page:     #ffffff;
  --panel:    #fafafa;
  --subtle:   #f0f0ee;
  --line:     #e6e6e6;
  --line-2:   #ededed;
  --ink:      #1f1f1f;
  --dim:      #6b6b6b;
  --dimmer:   #9a9a9a;
  --accent:   #2563d9;
  --accent-2: #1d4ec0;
  --ok:       #1f8a4c;
  --fail:     #c0392b;
  --pending:  #b08006;
  --shadow:   0 1px 2px rgba(15,15,15,.06), 0 1px 3px rgba(15,15,15,.04);
  --radius:   6px;
}

html[data-theme="dark"] {
  --page:     #1c1c1d;
  --panel:    #232324;
  --subtle:   #2a2a2c;
  --line:     #313133;
  --line-2:   #2a2a2c;
  --ink:      #ececec;
  --dim:      #a0a0a0;
  --dimmer:   #707072;
  --accent:   #5a8df0;
  --accent-2: #88abff;
  --ok:       #4dbb78;
  --fail:     #e06b5e;
  --pending:  #d6a83a;
  --shadow:   0 1px 2px rgba(0,0,0,.4);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --page:     #1c1c1d;
    --panel:    #232324;
    --subtle:   #2a2a2c;
    --line:     #313133;
    --line-2:   #2a2a2c;
    --ink:      #ececec;
    --dim:      #a0a0a0;
    --dimmer:   #707072;
    --accent:   #5a8df0;
    --accent-2: #88abff;
    --ok:       #4dbb78;
    --fail:     #e06b5e;
    --pending:  #d6a83a;
    --shadow:   0 1px 2px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--subtle);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }

/* TOPBAR — like a doc editor's chrome */
.topbar {
  background: var(--page);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.topbar-inner {
  display: flex; align-items: center; gap: 1rem;
  padding: .65rem 1.25rem;
  max-width: 1100px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; }
.brand-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; background: var(--accent); color: #fff;
  border-radius: 5px; font-size: 1rem;
}
.brand-name { font-size: 1rem; }
.crumbs { display: flex; gap: .35rem; align-items: center; flex: 1; margin-left: .5rem; color: var(--dim); font-size: .9rem; }
.crumbs a { color: var(--ink); }
.crumbs span { color: var(--dimmer); }
.crumbs .current { color: var(--ink); font-weight: 500; }
.topbar-right { display: flex; gap: .5rem; align-items: center; }
.ghost-btn {
  background: transparent; color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px;
  padding: .35rem .75rem; font: inherit; font-size: .85rem; font-weight: 500; cursor: pointer;
}
.ghost-btn:hover { background: var(--subtle); }
.icon-btn {
  background: none; border: 1px solid transparent; color: var(--dim);
  width: 32px; height: 32px; border-radius: 6px; cursor: pointer;
  font-size: 1.1rem; display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--subtle); color: var(--ink); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: .75rem; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}

.subnav {
  border-top: 1px solid var(--line-2);
  display: flex; gap: .25rem;
  max-width: 1100px; margin: 0 auto;
  padding: 0 1.25rem;
}
.subnav a {
  color: var(--dim); font-size: .85rem; font-weight: 500;
  padding: .65rem .75rem;
  border-bottom: 2px solid transparent;
  text-decoration: none;
}
.subnav a:hover { color: var(--ink); text-decoration: none; }
.subnav a.active { color: var(--ink); border-bottom-color: var(--accent); }
.subnav .signout { margin-left: auto; }

/* THE DOCUMENT — page-shaped, centred, on a subtle workspace background */
.doc {
  background: var(--page);
  max-width: 760px;
  margin: 2rem auto;
  padding: 4rem 5rem;
  box-shadow: var(--shadow);
  border-radius: 4px;
}
@media (max-width: 760px) {
  .doc { margin: 0; padding: 2rem 1.25rem; box-shadow: none; border-radius: 0; }
}

.kicker { font-size: .8rem; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin: 0 0 1rem; }
.kicker a { color: var(--accent-2); }

h1 {
  font-family: "Source Sans 3", sans-serif;
  font-weight: 700; font-size: 2.25rem; line-height: 1.2;
  letter-spacing: -.01em;
  margin: .25rem 0 .5rem;
}
h2 {
  font-family: "Source Sans 3", sans-serif;
  font-weight: 600; font-size: 1.4rem; line-height: 1.3;
  margin: 2rem 0 .75rem;
  letter-spacing: -.005em;
  border-top: 1px solid var(--line);
  padding-top: 1.5rem;
}
h3 {
  font-family: "Source Sans 3", sans-serif;
  font-weight: 600; font-size: 1.05rem; margin: 1rem 0 .35rem;
}
.subhead { font-size: 1.05rem; color: var(--dim); margin: 0 0 1.5rem; }

/* Body text is SERIF — the "document content" voice */
p, .doc dd { font-family: "Source Serif 4", "Iowan Old Style", Georgia, serif; font-size: 17px; line-height: 1.6; }
.kicker, .subhead, .label, .micro, .muted, .small,
.card, .badge, .btn, .ghost-btn, .empty, .data, .settings dt,
.dialog-body strong, .crumbs, .subnav, .topbar, .site-footer,
.status-list, .empty-title, .empty-sub {
  font-family: "Source Sans 3", sans-serif;
}

.muted { color: var(--dim); }
.small { font-size: .85rem; }

/* CARDS */
.cards { list-style: none; padding: 0; margin: 1rem 0; display: flex; flex-direction: column; gap: .25rem; }
.card {
  display: flex; gap: 1rem; align-items: flex-start;
  padding: 1rem .25rem;
  border-bottom: 1px solid var(--line-2);
}
.card:last-child { border-bottom: none; }
.card-l { flex: 1; min-width: 0; }
.card-source { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); font-weight: 600; margin-bottom: .15rem; }
.card-title { margin: .15rem 0; font-size: 1.05rem; font-weight: 600; line-height: 1.35; }
.card-title a { color: var(--ink); text-decoration: none; }
.card-title a:hover { color: var(--accent-2); }
.card-summary { margin: .25rem 0; font-size: 15px !important; color: var(--dim); font-family: "Source Serif 4", Georgia, serif; }
.card-meta { font-size: .8rem; color: var(--dimmer); }
.card-r { display: flex; flex-direction: column; gap: .35rem; flex-shrink: 0; }

/* FORMS */
.form { display: flex; flex-direction: column; gap: 1rem; margin: 1rem 0; }
.form label { display: block; }
.label {
  display: block; font-size: .8rem; font-weight: 600;
  color: var(--ink); margin-bottom: .25rem;
}
.form input, .form select {
  display: block; width: 100%;
  font-family: "Source Sans 3", sans-serif; font-size: .95rem;
  background: var(--page); color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px;
  padding: .55rem .75rem;
  transition: border-color .15s, box-shadow .15s;
}
.form input:focus, .form select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

/* BUTTONS */
.button-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.btn {
  font: inherit; font-size: .85rem; font-weight: 500;
  padding: .5rem 1rem;
  border-radius: 6px; cursor: pointer;
  border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); }
.btn-secondary { background: var(--page); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--subtle); }
.btn-danger { background: transparent; color: var(--fail); border-color: color-mix(in srgb, var(--fail) 35%, var(--line)); }
.btn-danger:hover { background: color-mix(in srgb, var(--fail) 8%, transparent); }
.btn-ghost { background: transparent; color: var(--dim); border: 1px solid transparent; }
.btn-ghost:hover { background: var(--subtle); color: var(--ink); }

/* BADGES */
.badge {
  display: inline-flex; align-items: center;
  font-size: .7rem; font-weight: 600; letter-spacing: .02em;
  padding: .15rem .5rem; border-radius: 999px;
  background: var(--subtle); color: var(--dim);
}
.badge-ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.badge-fail { background: color-mix(in srgb, var(--fail) 16%, transparent); color: var(--fail); }
.badge-pending { background: color-mix(in srgb, var(--pending) 18%, transparent); color: var(--pending); }

/* STATUS LIST */
.status-list { list-style: none; padding: 0; margin: .5rem 0; display: flex; flex-direction: column; gap: .25rem; }
.status-list li {
  display: flex; align-items: center; gap: .65rem;
  padding: .65rem 0; border-bottom: 1px solid var(--line-2);
  font-size: .9rem;
}
.status-list li:last-child { border-bottom: none; }
.status-name { font-weight: 500; }
.status-meta { margin-left: auto; color: var(--dim); font-size: .8rem; font-variant-numeric: tabular-nums; }

/* SETTINGS */
.settings { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.5rem; margin: .5rem 0; }
.settings dt { color: var(--dim); font-size: .9rem; padding-top: .15rem; }
.settings dd { margin: 0; font-size: 15px !important; }
.settings a { color: var(--accent-2); }

/* TABLE */
.data { width: 100%; border-collapse: collapse; font-size: .9rem; margin: .5rem 0; }
.data th { text-align: left; font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--dim); padding: .5rem .35rem; border-bottom: 2px solid var(--line); }
.data td { padding: .55rem .35rem; border-bottom: 1px solid var(--line-2); font-variant-numeric: tabular-nums; }
.data tbody tr:last-child td { border-bottom: none; }
.num-ok { color: var(--ok); font-weight: 600; }
.num-fail { color: var(--fail); font-weight: 600; }

/* DIALOG */
.dialog {
  display: flex; gap: 1rem;
  background: color-mix(in srgb, var(--pending) 8%, var(--page));
  border: 1px solid color-mix(in srgb, var(--pending) 25%, var(--line));
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: .5rem 0;
}
.dialog-icon {
  width: 28px; height: 28px; border-radius: 50%;
  background: color-mix(in srgb, var(--pending) 25%, transparent);
  color: var(--pending);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .9rem; flex-shrink: 0;
}
.dialog-body { flex: 1; }
.dialog-body strong { display: block; margin-bottom: .25rem; }
.dialog-body p { margin: .25rem 0 .75rem; font-size: 15px !important; }

/* CODE */
code, .mono { font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace; font-size: .85rem; }
.code {
  background: var(--subtle);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1rem 1.25rem; overflow-x: auto;
  font-size: .85rem;
  margin: .5rem 0;
  font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace !important;
}
code:not(.code code) { background: var(--subtle); padding: 1px 5px; border-radius: 3px; color: var(--ink); font-size: .9em; }

/* EMPTY */
.empty {
  background: var(--subtle);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--dim);
  margin: .5rem 0;
}
.empty-icon { font-size: 1.6rem; margin-bottom: .5rem; }
.empty-title { font-weight: 600; color: var(--ink); margin: .25rem 0; font-size: 1rem; font-family: "Source Sans 3", sans-serif !important; }
.empty-sub { font-size: 14px !important; margin: 0 0 1rem; font-family: "Source Sans 3", sans-serif !important; }

/* SWATCHES */
.swatches { display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: .5rem; margin: .5rem 0; }
.sw {
  padding: 1rem .75rem; border-radius: 6px;
  display: flex; flex-direction: column; gap: .25rem;
  font-size: .8rem;
}
.sw b { font-weight: 600; }
.sw span { font-family: "JetBrains Mono", monospace; font-size: .7rem; opacity: .85; }

/* TYPE */
.type-sample > * { margin: .35em 0; }
.t-h1 { font-size: 2.25rem; font-weight: 700; }
.t-h2 { font-size: 1.4rem; font-weight: 600; }
.t-h3 { font-size: 1.05rem; font-weight: 600; }
.t-body { font-family: "Source Serif 4", Georgia, serif; font-size: 17px; line-height: 1.6; }
.t-meta { font-family: "Source Sans 3", sans-serif !important; font-size: 13px !important; color: var(--dim); }

/* FOOTER */
.site-footer {
  background: var(--page);
  border-top: 1px solid var(--line);
  margin-top: 2rem;
  padding: 1rem 0;
}
.site-footer .topbar-inner { justify-content: space-between; }
