/* Factory house style, version 1.
   One stylesheet shared by every app the factory builds, so they look like
   one family. It styles plain HTML elements directly: a page that uses
   <header>, <main>, <h1>, <form>, <label>, <input>, <button>, <table> and
   <footer> looks right without any class names. Works on phones and desktops,
   in light and dark mode. No fonts, images or anything else from the internet.
   Agents: copy this file unchanged to static/house-style.css. Put anything
   special to one app in a separate static/app.css, loaded after this one. */

:root {
  --bg: #f5f6f8; --surface: #ffffff; --text: #1d2530; --muted: #5a6573; --line: #d9dee5;
  --accent: #1f5fbf; --accent-text: #ffffff; --accent-soft: #e6eefb;
  --good: #1a7f4b; --good-soft: #e5f4ec; --warn: #9a5800; --warn-soft: #fdf1dc; --bad: #b42318; --bad-soft: #fde8e6;
  --radius: 8px; --space: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c; --surface: #1b2129; --text: #e8ecf1; --muted: #9aa6b5; --line: #2e3744;
    --accent: #7fb0ff; --accent-text: #0e1420; --accent-soft: #172a47;
    --good: #5fd39a; --good-soft: #143424; --warn: #f0b35a; --warn-soft: #3a2a0f; --bad: #ff8a80; --bad-soft: #401a17;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--font); }
header, main, footer { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 var(--space); }
header { padding-top: calc(var(--space) * 1.5); padding-bottom: 4px; }
main { padding-bottom: calc(var(--space) * 2); }
footer { padding-top: var(--space); padding-bottom: calc(var(--space) * 2); color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--line); }

h1, h2, h3 { line-height: 1.25; margin: 1.4em 0 0.5em; text-wrap: balance; }
h1 { font-size: 1.75rem; margin-top: 0.4em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
p, ul, ol, dl, table, form, pre, blockquote { margin: 0 0 var(--space); }
ul, ol { padding-left: 1.3em; }
li + li { margin-top: 4px; }
small, .muted { color: var(--muted); font-size: 0.9rem; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
hr { border: 0; border-top: 1px solid var(--line); margin: calc(var(--space) * 1.5) 0; }
img, svg, video { max-width: 100%; height: auto; }
code, pre, kbd { font-family: var(--mono); font-size: 0.9em; }
pre { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; overflow-x: auto; }

nav ul { list-style: none; padding: 0; margin: 0 0 var(--space); display: flex; flex-wrap: wrap; gap: 4px 18px; }
nav li + li { margin-top: 0; }

/* Cards: <section> and <article> directly inside <main>, and forms, sit on a surface. */
main > section, main > article, form, .card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--space); margin-bottom: var(--space);
}
main > section > :last-child, main > article > :last-child, form > :last-child, .card > :last-child { margin-bottom: 0; }
main > section > h2:first-child, main > article > h2:first-child { margin-top: 0; }
form form, td form, li form { background: none; border: 0; padding: 0; margin: 0; display: inline; }

/* Forms */
label { display: block; font-weight: 600; margin: 0 0 6px; }
label + small, .hint { display: block; margin: -2px 0 8px; }
input, select, textarea, button { font: inherit; color: inherit; }
input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]):not([type=reset]):not([type=range]):not([type=color]),
select, textarea {
  display: block; width: 100%; min-height: 44px; padding: 9px 11px; margin: 0 0 var(--space);
  background: var(--surface); border: 1px solid var(--muted); border-radius: var(--radius);
}
textarea { min-height: 110px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 1.15em; height: 1.15em; margin: 0 8px 0 0; vertical-align: -2px; accent-color: var(--accent); }
label:has(> input[type=checkbox]), label:has(> input[type=radio]) { font-weight: 400; margin-bottom: 10px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px var(--space); margin: 0 0 var(--space); }
legend { font-weight: 600; padding: 0 6px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
:is(input, select, textarea)[aria-invalid=true] { border-color: var(--bad); border-width: 2px; }

button, input[type=submit], input[type=button], input[type=reset], a.button {
  display: inline-block; min-height: 44px; padding: 9px 18px; border-radius: var(--radius); cursor: pointer;
  background: var(--accent); color: var(--accent-text); border: 1px solid var(--accent); font-weight: 600; text-decoration: none;
}
button:hover, input[type=submit]:hover, a.button:hover { filter: brightness(0.93); }
button.secondary, input[type=reset], a.button.secondary { background: var(--surface); color: var(--accent); }
button.danger, a.button.danger { background: var(--surface); color: var(--bad); border-color: var(--bad); }
button:disabled, input:disabled, select:disabled, textarea:disabled { opacity: 0.55; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Messages: <p class="notice">, plus success, warning and error. role="alert" counts as an error. */
.notice, .success, .warning, .error, [role=alert], [role=status] {
  padding: 11px 14px; border-radius: var(--radius); border: 1px solid var(--line); border-left-width: 5px;
  background: var(--accent-soft); border-left-color: var(--accent); margin: 0 0 var(--space);
}
.success, [role=status] { background: var(--good-soft); border-left-color: var(--good); }
.warning { background: var(--warn-soft); border-left-color: var(--warn); }
.error, [role=alert] { background: var(--bad-soft); border-left-color: var(--bad); }

/* Tables fill the width; on a narrow screen they scroll sideways inside themselves instead of widening the page. */
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); }
@media (max-width: 600px) { table { display: block; overflow-x: auto; } }
th, td { text-align: left; padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: top; }
thead th { border-top: 0; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); white-space: nowrap; }
td.number, th.number { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Lists of items with actions: <ul class="items"><li>text <button>...</button></li></ul> */
ul.items { list-style: none; padding: 0; }
ul.items > li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 8px; }
ul.items > li.done { color: var(--muted); text-decoration: line-through; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.empty { color: var(--muted); text-align: center; padding: calc(var(--space) * 1.5) var(--space); border: 1px dashed var(--line); border-radius: var(--radius); }

@media (max-width: 480px) {
  h1 { font-size: 1.45rem; }
  button, input[type=submit], a.button { width: 100%; text-align: center; }
  .actions > *, ul.items button { width: auto; }
}
@media (prefers-reduced-motion: no-preference) { button, a.button, input, select, textarea { transition: filter 0.12s, border-color 0.12s; } }
@media print { body { background: #fff; } header, main, footer { max-width: none; } button, nav { display: none; } }
