:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --line: #dde2dc;
  --ink: #1d231e;
  --ink-low: #68716a;
  --green: #1d9e55;
  --green-dark: #157a40;
  --red: #c0392b;
  --amber-bg: #fdf3dd;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
main { max-width: 1100px; margin: 0 auto; padding: 16px; }

header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-style: italic; font-size: 20px; color: var(--green); text-decoration: none; }
.brand span, h1 span, .login-card h1 span { color: var(--ink); }
nav { display: flex; gap: 16px; align-items: center; }
nav a { color: var(--ink); }
nav form { margin: 0; }

a { color: var(--green-dark); }
h2 { margin: 20px 0 10px; }
h3 { margin: 0 0 10px; }

table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--ink-low); font-weight: 600; font-size: 13px; }
td form { margin: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin: 12px 0; }
.cols { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 16px; align-items: start; }
@media (max-width: 800px) { .cols { grid-template-columns: 1fr; } }

fieldset { border: none; margin: 0 0 12px; padding: 0; min-width: 0; }
legend { font-weight: 700; margin-bottom: 8px; }
/* A fieldset or details that is its own card. The legend floats so it sits
   inside the card's padding instead of straddling the border. */
fieldset.card { border: 1px solid var(--line); padding: 16px; margin: 12px 0; }
fieldset.card legend { float: left; width: 100%; padding: 0; }
fieldset.card legend + * { clear: both; }
form.narrow { max-width: 420px; }
details.card summary { font-weight: 700; cursor: pointer; }
details.card summary .muted { font-weight: 400; margin-left: 6px; }
details.card[open] summary { margin-bottom: 8px; }

.dial { margin: 12px 0; }
.dial dt { margin-top: 10px; }
.dial dd { margin: 2px 0 0; color: var(--ink-low); font-size: 13px; }
code {
  font: 600 15px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px;
}
label { display: block; margin: 10px 0; color: var(--ink-low); font-size: 13px; }
label.check { color: var(--ink); font-size: 15px; }
input:not([type=checkbox]), select {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; font: inherit; color: var(--ink); background: var(--bg);
}

button {
  font: inherit; font-weight: 700; color: #fff; background: var(--green);
  border: none; border-radius: 8px; padding: 9px 16px; cursor: pointer;
}
button:hover { background: var(--green-dark); }
button.link {
  background: none; color: var(--ink); font-weight: 400; padding: 0; border-radius: 0;
}
button.link:hover { background: none; text-decoration: underline; }
button.danger { background: var(--red); padding: 4px 10px; font-size: 13px; }

.muted { color: var(--ink-low); }
.ok { color: var(--green-dark); }
.error { color: var(--red); background: var(--amber-bg); padding: 8px 12px; border-radius: 8px; }
p.muted a { color: var(--green-dark); }

.hint { display: block; margin-top: 6px; font-size: 13px; min-height: 1.2em; }

.addrow { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.addrow label { flex: 1 1 220px; margin: 0; }

.totals { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 18px; display: flex; flex-direction: column; min-width: 140px;
}
.tile strong { font-size: 20px; font-variant-numeric: tabular-nums; }

.center { text-align: center; }
.bigcode {
  font: 700 36px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 4px; margin: 18px 0;
}

body.login { display: grid; place-items: center; min-height: 100vh; }
.login-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 40px 44px 44px; text-align: center; width: min(380px, calc(100vw - 32px));
  box-shadow: 0 10px 30px rgba(29, 35, 30, 0.06);
}
.login-card h1 { font-style: italic; color: var(--green); margin: 0 0 6px; font-size: 28px; }
.login-card .muted { margin: 0 0 8px; }
.login-card .g_id_signin { display: flex; justify-content: center; margin-top: 22px; min-height: 44px; }
/* If Google's script can't dress the button (blocked network, bad origin),
   its fallback markup must not blow up the card. */
.login-card .g_id_signin img { max-height: 40px; width: auto; }

td.actions { white-space: nowrap; text-align: right; }
td.actions form { display: inline-block; margin-left: 10px; }
td .error { padding: 2px 8px; }
h3.sub { margin-top: 22px; }
.addrow { margin-bottom: 14px; }
