/*
 * Minimal application styles. Propshaft serves this file as-is (no preprocessing).
 */

:root {
  --text: #1f2933;
  --muted: #6b7280;
  --border: #e5e7eb;
  --bg-subtle: #f9fafb;
  --accent: #2563eb;
  --danger: #b91c1c;
  --success: #15803d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: var(--accent); }

h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 2rem 0 0.75rem; }

main {
  max-width: 60rem;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* Navigation */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.site-header nav {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  max-width: 60rem;
  margin: 0 auto;
  padding: 0.75rem 1rem;
}

.site-header a { text-decoration: none; color: var(--muted); }
.site-header a:hover, .site-header a.active { color: var(--text); }
.site-header a.active { font-weight: 600; }
.site-header .brand { color: var(--text); font-weight: 700; margin-right: 1rem; }
.site-header .push-right { margin-left: auto; }
.site-header form { margin: 0; }

/* Flash messages */
.flash { margin: 0 0 1rem; padding: 0.5rem 0.75rem; border-radius: 4px; }
.flash.notice { color: var(--success); background: #f0fdf4; }
.flash.alert { color: var(--danger); background: #fef2f2; }

/* Page header with actions */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.page-header h1 { margin: 0; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.5rem; text-align: left; border-bottom: 1px solid var(--border); }
th { font-size: 0.85rem; color: var(--muted); font-weight: 600; }

/* Detail lists */
dl.details { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1.5rem; margin: 0 0 1.5rem; }
dl.details dt { color: var(--muted); }
dl.details dd { margin: 0; }

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }

/* Buttons & actions */
.actions { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.actions form { margin: 0; }

.button, button, input[type="submit"] {
  font: inherit;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}
.button.secondary, button.secondary { background: #fff; color: var(--accent); }
button.danger, .button.danger { background: #fff; color: var(--danger); border-color: var(--danger); }

/* Forms */
form .field { margin-bottom: 0.9rem; }
form label { display: block; font-size: 0.9rem; margin-bottom: 0.2rem; }
form input[type="text"], form input[type="email"], form input[type="tel"], form input[type="password"], form select {
  width: 100%;
  max-width: 28rem;
  font: inherit;
  padding: 0.4rem 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
}
.field_with_errors { display: contents; }
.field_with_errors input, .field_with_errors select { border-color: var(--danger); }

.form-errors { color: var(--danger); background: #fef2f2; padding: 0.5rem 0.75rem; border-radius: 4px; margin-bottom: 1rem; }
.form-errors h2 { font-size: 1rem; margin: 0 0 0.25rem; }
.form-errors ul { margin: 0; padding-left: 1.25rem; }

/* Dashboard */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-subtle);
  color: var(--text);
  text-decoration: none;
}
.stat:hover { border-color: var(--accent); }
.stat-value { font-size: 2rem; font-weight: 700; line-height: 1.2; }
.stat-label { color: var(--muted); font-size: 0.9rem; }

/* History */
.changes { list-style: none; margin: 0; padding: 0; }
.changes li { margin-bottom: 0.15rem; }
.history details { margin-top: 0.35rem; }
.history summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; }
.history pre { margin: 0.35rem 0 0; padding: 0.5rem; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 4px; overflow-x: auto; font-size: 0.85rem; }

/* State badges */
.badge { display: inline-block; padding: 0 0.5rem; border-radius: 999px; font-size: 0.8rem; background: var(--border); }
.badge.state-sent { background: #dbeafe; color: #1e40af; }
.badge.state-paid { background: #dcfce7; color: #166534; }
.badge.state-void { background: #fee2e2; color: #991b1b; }
