/* Moon Mission — design system (modern card language, shared with merv's palette) */
:root {
  /* Black + gold — themed to the Golden State Power Co. seal. */
  --ink: #1C1A15;         /* warm near-black text */
  --ink-2: #4A4437;       /* secondary warm ink */
  --black: #0C0C0D;       /* dark chrome: nav, hero, footer */
  --black-2: #17161A;     /* slightly lifted dark surface */
  --paper: #FFFFFF;
  --bg: #F5F2EA;          /* warm cream canvas (cards float on it) */
  --surface: #FBF8F1;     /* warm inset surfaces */
  --gold: #D4A74C;        /* brand gold, sampled from the logo */
  --gold-hi: #E6C079;     /* lighter gold (on dark) */
  --gold-deep: #A67C25;   /* deeper gold */
  --gold-ink: #7A5A12;    /* gold-toned text on light surfaces (AA) */
  /* legacy aliases so existing rules keep working */
  --copper: #A67C25;
  --copper-deep: #7A5A12;
  --ok: #1E7A46;
  --warn: #C08219;
  --crit: #AE2E1C;
  --muted: #8A857A;
  --line: #E8E2D4;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(20,35,58,.06), 0 1px 3px rgba(20,35,58,.08);
  --shadow-md: 0 4px 12px rgba(20,35,58,.08), 0 2px 4px rgba(20,35,58,.06);
  --shadow-lg: 0 12px 32px rgba(20,35,58,.14);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--ui);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}
a { color: var(--gold-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--ink); line-height: 1.2; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

/* -- layout ------------------------------------------------------------- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.section { padding: 40px 0; }
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 820px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
}

/* -- top nav ------------------------------------------------------------ */
.nav {
  position: sticky; top: 0; z-index: 20;
  background: var(--black);
  border-bottom: 1px solid rgba(212,167,76,.28);
}
.nav .wrap { display: flex; align-items: center; gap: 18px; height: 66px; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; color: #F3ECD9; letter-spacing: .01em; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 40px; height: 40px; display: block; }
.brand .mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  display: grid; place-items: center; color: var(--black); font-size: 16px;
}
.nav .spacer { flex: 1; }
.nav a.navlink { color: #CFC7B4; font-weight: 500; padding: 6px 4px; }
.nav a.navlink:hover { color: var(--gold-hi); text-decoration: none; }
@media (max-width: 680px) { .nav a.navlink.hide-sm { display: none; } }

/* -- buttons / pills ---------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid transparent; border-radius: 99px;
  padding: 9px 18px; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--surface); color: var(--ink); text-decoration: none;
  transition: transform .05s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { text-decoration: none; box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--gold); color: var(--black); font-weight: 700; }
.btn.primary:hover { background: var(--gold-hi); }
.btn.dark { background: var(--black); color: var(--gold-hi); border-color: rgba(212,167,76,.4); }
.btn.dark:hover { background: #1c1b1e; }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn:focus-visible { outline: 3px solid rgba(212,167,76,.55); outline-offset: 2px; }
/* buttons sitting on the dark nav */
.nav .btn.ghost { background: transparent; border-color: rgba(212,167,76,.5); color: var(--gold-hi); }
.nav .btn.ghost:hover { background: rgba(212,167,76,.12); }

/* -- cards -------------------------------------------------------------- */
.card {
  background: var(--paper); border-radius: var(--radius);
  box-shadow: var(--shadow-md); padding: 22px;
}
.card h3 { margin: 0 0 4px; }
.card.tight { padding: 16px; }

/* KPI stat cards */
.stat { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px; }
.stat .k { font-family: var(--mono); font-size: 26px; font-weight: 700; color: var(--ink); }
.stat .l { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-top: 4px; }

/* -- badges ------------------------------------------------------------- */
.badge {
  display: inline-block; border-radius: 99px; padding: 3px 11px;
  font-size: 12px; font-weight: 600; background: var(--surface); color: var(--ink-2);
}
.badge.ok { background: rgba(30,122,70,.12); color: var(--ok); }
.badge.warn { background: rgba(192,130,25,.14); color: var(--warn); }
.badge.crit { background: rgba(174,46,28,.12); color: var(--crit); }
.badge.info { background: rgba(212,167,76,.18); color: var(--gold-ink); }
.badge.muted { background: var(--surface); color: var(--muted); }

/* -- progress bar ------------------------------------------------------- */
.bar { height: 10px; background: #ECE5D5; border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--gold), var(--gold-deep)); }
.bar.ok > span { background: linear-gradient(90deg, #2f9e5e, var(--ok)); }

/* -- tables ------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.table th { background: var(--surface); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table td.num, .table th.num { text-align: right; font-family: var(--mono); }
.table tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); -webkit-overflow-scrolling: touch; }

/* -- forms -------------------------------------------------------------- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 12px 0 5px; }
input, select, textarea {
  width: 100%; font: inherit; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--paper); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(0,93,170,.25); border-color: var(--copper); }
textarea { min-height: 96px; resize: vertical; }
.form-row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 620px) { .form-row { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.check input { width: auto; }

/* -- hero --------------------------------------------------------------- */
.hero {
  padding: 64px 0 68px; background: var(--black);
  background-image: radial-gradient(120% 90% at 82% -10%, rgba(212,167,76,.16), transparent 55%);
  border-bottom: 1px solid rgba(212,167,76,.3);
}
.hero h1 { font-size: clamp(32px, 5vw, 54px); margin: 0 0 14px; letter-spacing: -.02em; color: #FBF4E2; }
.hero .eyebrow { color: var(--gold-hi); }
.hero p.lead { font-size: 19px; color: #C9C2B2; max-width: 640px; }
.hero .cta { margin-top: 26px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
/* ghost/secondary buttons sitting on the dark hero need light text + outline */
.hero .btn.ghost { color: #F3ECD9; border-color: rgba(243,236,217,.45); background: transparent; }
.hero .btn.ghost:hover { color: #fff; border-color: rgba(243,236,217,.8); background: rgba(243,236,217,.1); }
.hero-logo { width: 132px; height: 132px; margin-bottom: 22px; display: block; filter: drop-shadow(0 6px 18px rgba(0,0,0,.5)); }
@media (min-width: 821px) {
  .hero .wrap { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 36px; }
  .hero-logo { width: 190px; height: 190px; margin: 0; grid-column: 2; grid-row: 1 / span 4; }
}
.eyebrow { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--gold-ink); font-weight: 700; }

/* -- flash -------------------------------------------------------------- */
.flashes { margin: 16px 0; display: grid; gap: 8px; }
.flash { padding: 12px 16px; border-radius: var(--radius-sm); font-weight: 500; box-shadow: var(--shadow-sm); }
.flash.ok { background: rgba(30,122,70,.1); color: var(--ok); }
.flash.warn { background: rgba(192,130,25,.12); color: var(--warn); }

/* -- misc --------------------------------------------------------------- */
.photo-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.photo { border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow-sm); background: var(--surface); }
.photo img { width: 100%; height: 160px; object-fit: cover; display: block; }
.photo .cap { padding: 8px 10px; font-size: 13px; color: var(--ink-2); }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 14px 0 14px 20px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 18px; width: 12px; height: 12px; border-radius: 50%; background: var(--copper); box-shadow: 0 0 0 4px var(--bg); }
.timeline .when { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.foot { padding: 30px 0; color: #B7AE99; font-size: 13px; text-align: center; background: var(--black); margin-top: 40px; line-height: 1.9; }
.foot a { color: var(--gold-hi); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.pill-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.pill-tabs a { border-radius: 99px; padding: 7px 16px; background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 14px; }
.pill-tabs a.active { background: var(--gold); color: var(--black); }
.pill-tabs a:hover { text-decoration: none; }

/* file attachments (receipts / permits / documents) */
.file-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.file { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.file-thumb { display: block; height: 110px; background: #ECE5D5; }
.file-thumb img { width: 100%; height: 110px; object-fit: cover; display: block; }
.file-thumb .doc-ico {
  height: 110px; display: grid; place-items: center; font-family: var(--mono); font-weight: 700;
  font-size: 20px; letter-spacing: .05em; color: var(--gold-deep);
  background: linear-gradient(135deg, rgba(212,167,76,.22), rgba(212,167,76,.06));
}
.file-meta { padding: 8px 10px; font-size: 13px; }
.file-name { display: block; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-sub { font-size: 12px; color: var(--muted); }
.upload { display: grid; gap: 10px; }
.upload-row { display: grid; gap: 8px; }
.upload-row2 { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.upload-row2 .check { margin-top: 0; }

.svc-icon {
  display: inline-grid; place-items: center; width: 44px; height: 44px; margin-bottom: 10px;
  border-radius: 12px; font-size: 22px; color: var(--gold-deep);
  background: linear-gradient(135deg, rgba(212,167,76,.2), rgba(212,167,76,.08));
  border: 1px solid rgba(212,167,76,.35);
}
.card.svc h3 { font-size: 17px; }

/* -- phone polish ------------------------------------------------------- */
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .section { padding: 28px 0; }
  .card { padding: 18px; }
  .card.tight { padding: 14px; }
  .hero { padding: 40px 0 44px; }
  .hero p.lead { font-size: 17px; }
  .stat { padding: 15px; }
  .stat .k { font-size: 22px; }
  .grid { gap: 14px; }
  .nav .wrap { gap: 12px; height: 60px; }
  .brand { font-size: 15px; gap: 9px; }
  .brand .logo { width: 34px; height: 34px; }
  .table th, .table td { padding: 8px 10px; }
  /* stack the lead-status inline form so the select + button don't cramp */
  .table form { flex-wrap: wrap; }
  h1 { font-size: 28px; }
  /* full-width primary actions read better under the thumb */
  .hero .cta .btn, .card > form .btn.primary { min-height: 44px; }
}
/* wide content (tables) scrolls inside its own .table-wrap, never the body.
   (Deliberately NOT using overflow-x:hidden on html/body — it breaks the
   position:sticky nav by turning overflow-y into a scroll container.) */
img { max-width: 100%; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
