/*
 * Hardscape Source — Pristine Acres identity.
 * Exact tokens from Theme.swift / Pristine Console (plan section 10):
 *   Background #F3EFE6 · Surface #FFFDF8 · Accent green #3F6F4A
 *   Deep green #172A1D · Sage #74866F
 *   Georgia serif headings, Inter body.
 */

:root {
  --bg: #F3EFE6;
  --surface: #FFFDF8;
  --accent: #3F6F4A;
  --accent-dark: #335C3D;
  --deep: #172A1D;
  --sage: #74866F;
  --line: #E5DECF;
  --line-soft: #EEE8DA;
  --danger: #8A3A3A;
  --warn: #B07A2E;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(23, 42, 29, 0.05), 0 8px 24px rgba(23, 42, 29, 0.04);
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--deep);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--serif); color: var(--deep); font-weight: 600; letter-spacing: -0.01em; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

/* ── Top nav ─────────────────────────────────────────────────────────────── */
.topnav {
  background: var(--deep);
  color: #fff;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 56px;
}
.topnav .brand {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-right: 0.5rem;
}
.topnav .brand .logo { width: 22px; height: 22px; }
.topnav nav { display: flex; gap: 0.25rem; flex: 1; flex-wrap: wrap; }
.topnav nav a {
  color: rgba(255, 255, 255, 0.72);
  padding: 0.4rem 0.7rem;
  border-radius: 7px;
  font-size: 0.92rem;
  font-weight: 500;
}
.topnav nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.topnav nav a.active { color: #fff; background: var(--accent); }
.topnav .operator { color: rgba(255, 255, 255, 0.85); font-size: 0.9rem; display: flex; align-items: center; gap: 0.6rem; }
.topnav .operator form { margin: 0; }
.topnav .operator button {
  background: transparent; border: 1px solid rgba(255,255,255,0.25); color: rgba(255,255,255,0.85);
  border-radius: 6px; padding: 0.25rem 0.6rem; font-size: 0.8rem; cursor: pointer;
}
.topnav .operator button:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* ── Page shell ──────────────────────────────────────────────────────────── */
.page { max-width: 1240px; margin: 0 auto; padding: 1.6rem 1.5rem 4rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.3rem; }
.page-head h1 { font-size: 1.7rem; margin: 0; }

/* ── Flash ───────────────────────────────────────────────────────────────── */
.flash { padding: 0.7rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.92rem; }
.flash.notice { background: #E7F0E8; color: var(--accent-dark); border: 1px solid #CDE2D1; }
.flash.alert  { background: #F6E7E5; color: var(--danger); border: 1px solid #E8CFCB; }

/* ── Stat cards ──────────────────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.4rem; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat .num { font-family: var(--serif); font-size: 2.1rem; font-weight: 700; line-height: 1; }
.stat .label { color: var(--sage); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 0.4rem; }
.stat .link { font-size: 0.82rem; margin-top: 0.7rem; display: inline-block; }
.stat.accent { background: var(--accent); border-color: var(--accent); }
.stat.accent .num, .stat.accent .link { color: #fff; }
.stat.accent .label { color: rgba(255,255,255,0.8); }
.stat.accent .link { color: rgba(255,255,255,0.92); }
.stat.danger .num { color: var(--danger); }

/* ── Panels ──────────────────────────────────────────────────────────────── */
.cols { display: grid; grid-template-columns: 2fr 1fr; gap: 1.2rem; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1.2rem; }
.panel > h2 { font-size: 1.05rem; margin: 0; padding: 0.85rem 1.1rem; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 0.5rem; }
.panel .body { padding: 0.4rem 1.1rem 1rem; }
.panel .empty { padding: 1.4rem 1.1rem; text-align: center; color: var(--sage); }

/* ── Tables ──────────────────────────────────────────────────────────────── */
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th {
  text-align: left; color: var(--sage); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
  font-weight: 600; padding: 0.6rem 0.6rem; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td { padding: 0.6rem 0.6rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--sage); }
.money { font-variant-numeric: tabular-nums; }

/* ── Badges / pills ──────────────────────────────────────────────────────── */
.pill { display: inline-block; padding: 0.12rem 0.55rem; border-radius: 999px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em; }
.pill.active, .pill.synced, .pill.paid, .pill.final { background: #E7F0E8; color: var(--accent-dark); }
.pill.pending, .pill.draft, .pill.unexported, .pill.review { background: #F3ECD9; color: var(--warn); }
.pill.invoiced, .pill.sent, .pill.exported { background: #E5EAF0; color: #3A5573; }
.pill.reorder, .pill.voided { background: #F6E7E5; color: var(--danger); }
.pill.on_hold, .pill.completed { background: #ECE8DE; color: var(--sage); }

/* ── Quick-info list ─────────────────────────────────────────────────────── */
.kv { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 0; border-bottom: 1px solid var(--line-soft); font-size: 0.9rem; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--deep); }
.kv .v { color: var(--sage); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn { display: inline-block; background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 0.55rem 1rem; font-size: 0.92rem; font-weight: 600; cursor: pointer; font-family: var(--sans); }
.btn:hover { background: var(--accent-dark); color: #fff; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--line-soft); }
.btn.block { display: block; width: 100%; text-align: center; }

/* ── Auth (sign-in) ──────────────────────────────────────────────────────── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem;
  background: radial-gradient(circle at 50% 0%, #F8F5EE 0%, var(--bg) 60%); }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  width: 100%; max-width: 400px; padding: 2.2rem 2rem; text-align: center; }
.auth-card .logo { width: 54px; height: 54px; margin: 0 auto 1rem; display: block; }
.auth-card h1 { font-size: 1.5rem; margin: 0 0 0.3rem; }
.auth-card .sub { color: var(--sage); font-size: 0.92rem; margin-bottom: 1.4rem; }
.auth-card label { display: block; text-align: left; font-size: 0.8rem; color: var(--sage); text-transform: uppercase;
  letter-spacing: 0.05em; font-weight: 600; margin-bottom: 0.4rem; }
.auth-card input[type="text"], .auth-card input[type="password"] {
  width: 100%; padding: 0.7rem 0.8rem; border: 1px solid var(--line); border-radius: 9px; font-size: 1rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; background: #fff; margin-bottom: 1rem; }
.auth-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(63, 111, 74, 0.12); }
.auth-card .footer-note { margin-top: 1.4rem; color: var(--sage); font-size: 0.8rem; }

/* ── Field-capture form ──────────────────────────────────────────────────── */
.capture-shell { max-width: 520px; margin: 0 auto; padding: 1.2rem; }
.capture-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 1.4rem; }
.capture-card label { display: block; font-size: 0.82rem; color: var(--sage); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; margin: 0.9rem 0 0.4rem; }
.capture-card input, .capture-card textarea, .capture-card select {
  width: 100%; padding: 0.7rem 0.8rem; border: 1px solid var(--line); border-radius: 9px; font-size: 1rem; font-family: var(--sans); background: #fff; }
.capture-card textarea { min-height: 90px; resize: vertical; }
.photo-input { display: block; width: 100%; padding: 1.4rem; border: 2px dashed var(--line); border-radius: 12px; text-align: center; background: #fff; color: var(--sage); }

@media (max-width: 880px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .cols { grid-template-columns: 1fr; }
  .topnav { flex-wrap: wrap; height: auto; padding: 0.6rem 1rem; }
}
