/* legal-search — v0 minimal CSS. System font, single-column, no frameworks. */

:root {
  --fg: #1a1a1a;
  --muted: #666;
  --bg: #fafafa;
  --card: #ffffff;
  --border: #d8d8d8;
  --accent: #1f3b6a;
  --accent-hover: #2c528f;
  --error: #aa2222;
  --maybe: #d39c1a;
  --no: #888;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
}

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

header.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
header.topbar .brand a { font-weight: 600; color: var(--fg); }
header.topbar .userbar { font-size: 0.9em; color: var(--muted); }
header.topbar .userbar .user { margin-right: 0.75rem; }
header.topbar form.inline { display: inline; }
header.topbar form.inline button.link {
  background: none; border: 0; color: var(--accent); cursor: pointer;
  font: inherit; padding: 0;
}
header.topbar form.inline button.link:hover { color: var(--accent-hover); text-decoration: underline; }

main { padding: 1.5rem; max-width: 960px; margin: 0 auto; }

h1 { font-size: 1.5rem; margin-top: 0; }

.login {
  max-width: 320px; margin: 4rem auto; padding: 1.5rem;
  background: var(--card); border: 1px solid var(--border); border-radius: 4px;
}
.login form { display: flex; flex-direction: column; gap: 0.75rem; }
.login label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85em; color: var(--muted); }
.login input {
  padding: 0.5rem; font-size: 1em; border: 1px solid var(--border); border-radius: 3px;
}
.login button {
  padding: 0.5rem; background: var(--accent); color: #fff; border: 0; border-radius: 3px;
  font-size: 1em; cursor: pointer;
}
.login button:hover { background: var(--accent-hover); }

.error {
  padding: 0.5rem 0.75rem; background: #fbe9e9; border: 1px solid #f3c4c4;
  color: var(--error); border-radius: 3px; margin-bottom: 0.75rem;
}

.flash {
  padding: 0.5rem 0.75rem; border-radius: 3px; margin: 0.75rem 0;
}
.flash.ok { background: #e7f4e0; border: 1px solid #b7d8a4; color: #2c5b14; }

.muted { color: var(--muted); }
.crumbs { color: var(--muted); font-size: 0.9em; margin-top: 0; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--accent); }

h2 { font-size: 1.1rem; margin-top: 1.5rem; }

table.rows {
  width: 100%; border-collapse: collapse; margin-top: 0.5rem;
}
table.rows th, table.rows td {
  text-align: left; padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border); vertical-align: top;
}
table.rows th { font-size: 0.85em; color: var(--muted); font-weight: 500; }
table.rows .truncate { max-width: 320px; }

form.stacked { display: flex; flex-direction: column; gap: 0.75rem; max-width: 640px; margin-top: 0.5rem; }
form.stacked label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9em; color: var(--muted); }
form.stacked input[type="text"],
form.stacked textarea {
  padding: 0.5rem; font-size: 0.95em; border: 1px solid var(--border); border-radius: 3px;
  font-family: inherit;
}
form.stacked button {
  padding: 0.5rem 1rem; background: var(--accent); color: #fff; border: 0; border-radius: 3px;
  font-size: 0.95em; cursor: pointer; align-self: flex-start;
}
form.stacked button:hover { background: var(--accent-hover); }
form.stacked button:disabled { background: #b3b3b3; cursor: not-allowed; }

fieldset.inline-fieldset {
  display: flex; gap: 1rem; align-items: center;
  border: 1px solid var(--border); border-radius: 3px; padding: 0.5rem 0.75rem;
}
fieldset.inline-fieldset legend { font-size: 0.85em; color: var(--muted); padding: 0 0.25rem; }
label.radio { display: inline-flex; gap: 0.35rem; align-items: center; flex-direction: row; font-size: 0.95em; color: var(--fg); }

.badge {
  display: inline-block; padding: 0.1em 0.55em; border-radius: 3px;
  font-size: 0.8em; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-tm  { background: #e3eef9; color: #1f3b6a; }
.badge-pat { background: #f0e5f4; color: #5b2c75; }

section.card {
  margin-top: 1rem; padding: 1rem 1.25rem;
  background: var(--card); border: 1px solid var(--border); border-radius: 4px;
}
section.card h2 { margin-top: 0; }
.overview {
  white-space: pre-wrap; font-family: ui-serif, Georgia, serif; font-size: 0.95em;
}

/* HTMX indicator (default hidden, shown while a request is in flight) */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline; }
.htmx-request.htmx-indicator { display: inline; }
.spinner { margin-left: 0.5rem; color: var(--muted); font-size: 0.9em; font-style: italic; }

/* Tag editor */
table.tag-table { margin-top: 0.5rem; }
table.tag-table td { padding: 0.35rem 0.5rem; vertical-align: middle; }
table.tag-table select,
table.tag-table input[type="text"] {
  padding: 0.35rem 0.5rem; font-size: 0.95em; border: 1px solid var(--border); border-radius: 3px;
  font-family: inherit; width: 100%; min-width: 8rem;
}
table.tag-table .rationale { font-size: 0.85em; max-width: 22rem; }
table.tag-table button.link {
  background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0;
  font-size: 0.85em;
}
table.tag-table button.link:hover { text-decoration: underline; }

.tag-toolbar { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.75rem; flex-wrap: wrap; }
.tag-toolbar button {
  padding: 0.4rem 0.85rem; font-size: 0.9em; border-radius: 3px; cursor: pointer;
  border: 1px solid var(--border); background: var(--card); color: var(--fg);
}
.tag-toolbar button[type="submit"] {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.tag-toolbar button[type="submit"]:disabled { background: #b3b3b3; border-color: #b3b3b3; cursor: not-allowed; }
.tag-toolbar button.link {
  border: 0; background: none; color: var(--accent); padding: 0.4rem 0.5rem;
}
.tag-toolbar button.link:hover { text-decoration: underline; }

/* Run-result table */
.run-result h3 { margin-top: 0; }
.run-result h3 .muted { font-weight: 400; font-size: 0.9em; }
.candidates-table td { padding: 0.5rem 0.75rem; }
.candidates-table td:first-child { width: 4rem; text-align: right; }
.candidates-table td.small { font-size: 0.85em; }
.candidates-table td.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.85em; }
.candidates-table code { background: #f3f3f3; padding: 0.1em 0.3em; border-radius: 2px; font-size: 0.9em; }
.candidate-row { vertical-align: top; }
.error .small.mono {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.8em;
  background: #fff; border: 1px solid var(--border); border-radius: 3px;
  padding: 0.5rem; margin-top: 0.5rem; white-space: pre-wrap;
}
