/* KeepPaw design system — "field guide, not dashboard" (token system §5.2).
   Palette: ink/paper/pine/brass/bark/mist. Emails mirror these values in
   keeppaw/emailhtml.py — change both together. */

:root {
  --ink:        #26231F;   /* deep warm charcoal — text */
  --ink-soft:   #4a453e;
  --muted:      #6B6660;
  --paper:      #FAF7F2;   /* warm off-white — page bg */
  --surface:    #FFFFFF;   /* cards */
  --surface-2:  #F1EDE5;   /* tinted panels */
  --mist:       #DCE3DD;   /* quiet UI, dividers, empty paws */
  --mist-dark:  #b9c4bb;
  --brand:      #1F4D3A;   /* pine — primary, buttons, good news */
  --brand-dark: #163A2C;
  --brand-tint: #E4EFE9;
  --brass:      #B98A2F;   /* accents, paw rating — used sparingly */
  --good:       #1F4D3A;
  --good-tint:  #E4EFE9;
  --warn:       #B98A2F;
  --warn-tint:  #F6EDDA;
  --bad:        #A8442E;   /* bark — warm, serious, not alarm-panel red */
  --bad-tint:   #F6E4DE;
  --line:       #E2DCD0;
  --line-soft:  #EEE9DF;
  --shadow-sm:  0 1px 2px rgba(38,35,31,.06), 0 1px 3px rgba(38,35,31,.05);
  --shadow-md:  0 4px 12px rgba(38,35,31,.08), 0 2px 4px rgba(38,35,31,.04);
  --shadow-lg:  0 12px 32px rgba(38,35,31,.12), 0 4px 8px rgba(38,35,31,.05);
  --radius:     10px;
  --radius-sm:  7px;
  /* legacy aliases — older inline styles still reference these names */
  --accent:     #1F4D3A;
  --card:       #FFFFFF;
  --radius-pill: 999px;
  --maxw:       1040px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.15; letter-spacing: -.01em; color: var(--ink); }
h1 { font-family: var(--font-display); font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 1rem; font-weight: 700; }
h2 { font-family: var(--font-display); font-size: clamp(1.4rem, 3vw, 1.9rem); margin: 0 0 .75rem; font-weight: 700; }
h3 { font-size: 1.15rem; margin: 0 0 .5rem; font-weight: 700; }
p  { margin: 0 0 1rem; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }

/* ---------- layout ---------- */

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }
.narrow { max-width: 660px; margin-left: auto; margin-right: auto; }

main { display: block; }

section { padding: 3.5rem 0; }
section.tight { padding: 2rem 0; }

/* ---------- header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(253,249,243,.92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .bar {
  display: flex; align-items: center; gap: .65rem;
  max-width: var(--maxw); margin: 0 auto; padding: .7rem 1.25rem;
}
.site-header .logo { display: flex; align-items: center; gap: .55rem; font-weight: 800;
  font-size: 1.2rem; color: var(--ink); letter-spacing: -.02em; }
.site-header .logo:hover { text-decoration: none; }
.site-header .logo svg { width: 34px; height: 34px; flex-shrink: 0; }
.site-header .logo img { width: 34px; height: 34px; flex-shrink: 0; object-fit: contain; }

/* mascot art (PNG poses) */
.mascot { display: block; margin: 0 auto; width: auto; }
.mascot-hero { height: 175px; }
.mascot-md { height: 120px; }
.site-header .spacer { flex: 1; }
.site-header nav { display: flex; align-items: center; gap: 1.1rem; }
.site-header nav a { color: var(--ink-soft); font-weight: 600; font-size: .95rem; }
.site-header nav a:hover { color: var(--brand); text-decoration: none; }
.site-header .who { color: var(--muted); font-size: .85rem; max-width: 180px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-header form { display: inline; margin: 0; }

/* ---------- buttons ---------- */

.btn {
  display: inline-block; cursor: pointer; font: inherit; font-weight: 700;
  border: 1px solid transparent; border-radius: var(--radius-pill);
  padding: .7rem 1.4rem; text-decoration: none; text-align: center;
  transition: transform .06s ease, box-shadow .15s ease, background .15s ease;
  line-height: 1.2;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-dark); color: #fff; box-shadow: var(--shadow-md); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-block { display: block; width: 100%; }
.btn-lg { padding: .85rem 1.8rem; font-size: 1.05rem; }
.btn-sm { padding: .4rem .85rem; font-size: .85rem; font-weight: 600; }

/* ---------- cards ---------- */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 1rem; }
.card-feature { padding: 1.5rem 1.5rem 1.4rem; }
.card-pad-lg { padding: 2rem; }

/* ---------- forms ---------- */

label.field { display: block; font-weight: 650; margin-bottom: .35rem; font-size: .95rem; }
input[type=email], input[type=url], input[type=text] {
  font: inherit; font-size: 1rem; width: 100%;
  padding: .75rem .9rem; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); transition: border-color .15s ease, box-shadow .15s ease;
}
input[type=email]:focus, input[type=url]:focus, input[type=text]:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
}
.form-row { margin-bottom: .9rem; }

.error { color: var(--bad); font-size: .92rem; margin-top: .5rem; }
.notice { background: var(--brand-tint); border: 1px solid var(--brand);
  border-radius: var(--radius-sm); padding: .9rem 1.1rem; margin-bottom: 1.25rem; }

/* ---------- hero ---------- */

.hero {
  background:
    radial-gradient(1200px 400px at 50% -10%, var(--surface-2), transparent),
    var(--paper);
  padding: 3rem 0 2.5rem;
  text-align: center;
}
.hero .eyebrow {
  display: inline-block; background: var(--brand-tint); color: var(--brand-dark);
  font-weight: 700; font-size: .8rem; letter-spacing: .04em; text-transform: uppercase;
  padding: .35rem .85rem; border-radius: var(--radius-pill); margin-bottom: 1.25rem;
}
.hero h1 { max-width: 14ch; margin-left: auto; margin-right: auto; }
.hero .sub { font-size: 1.2rem; color: var(--ink-soft); max-width: 34ch;
  margin: 0 auto 2rem; }
.hero-mascot { width: 132px; height: 132px; margin: 0 auto 1.25rem; display: block;
  filter: drop-shadow(0 8px 18px rgba(40,30,20,.12)); }

.signup-card { max-width: 480px; margin: 0 auto; text-align: left; }
.trust-row { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; justify-content: center;
  color: var(--muted); font-size: .9rem; margin-top: 1.25rem; }
.trust-row span { display: inline-flex; align-items: center; gap: .35rem; }

/* ---------- grids ---------- */

.grid { display: grid; gap: 1rem; }
@media (min-width: 720px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
}

.usecase .ic { font-size: 1.8rem; line-height: 1; margin-bottom: .6rem; display: block; }
.usecase h3 { margin-bottom: .35rem; }
.usecase p { margin: 0; color: var(--ink-soft); font-size: .97rem; }

/* ---------- steps ---------- */

.steps { counter-reset: step; max-width: 560px; margin: 0 auto; padding: 0; list-style: none; }
.steps li { counter-increment: step; position: relative; padding: 0 0 1.1rem 3rem; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: -2px;
  width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center; font-size: .95rem;
}
.steps li:not(:last-child)::after {
  content: ""; position: absolute; left: .97rem; top: 2rem; bottom: 0;
  width: 2px; background: var(--line);
}

/* ---------- status dots + badges ---------- */

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot-up { background: var(--good); }
.dot-down { background: var(--bad); }
.dot-pending { background: var(--muted); }
.dot-warn { background: var(--warn); }

.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: .2rem .6rem;
  border-radius: var(--radius-pill); }
.badge-up { background: var(--good-tint); color: var(--good); }
.badge-down { background: var(--bad-tint); color: var(--bad); }
.badge-pending { background: var(--surface-2); color: var(--muted); }
.badge-warn { background: var(--warn-tint); color: var(--warn); }

/* ---------- pricing ---------- */

.price-grid { display: grid; gap: 1.25rem; }
@media (min-width: 820px) { .price-grid { grid-template-columns: repeat(3, 1fr); align-items: start; } }
.plan { position: relative; }
.plan.featured { border-color: var(--brand); box-shadow: var(--shadow-md); }
.plan .ribbon { position: absolute; top: -.7rem; left: 50%; transform: translateX(-50%);
  background: var(--brand); color: #fff; font-size: .72rem; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; padding: .25rem .8rem;
  border-radius: var(--radius-pill); }
.plan .price { font-size: 2.2rem; font-weight: 800; margin: .25rem 0; }
.plan .price .per { font-size: .95rem; font-weight: 500; color: var(--muted); }
.plan ul { list-style: none; padding: 0; margin: 1rem 0 1.25rem; }
.plan ul li { padding: .35rem 0 .35rem 1.6rem; position: relative; color: var(--ink-soft); }
.plan ul li::before { content: "🐾"; position: absolute; left: 0; font-size: .85rem; }

/* ---------- tables ---------- */

table.kp { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.kp th { text-align: left; color: var(--muted); font-weight: 600;
  padding: .55rem .4rem; border-bottom: 1px solid var(--line); }
table.kp td { padding: .5rem .4rem; border-bottom: 1px solid var(--line-soft); }

/* ---------- score (lead magnet) ---------- */

.score-ring { width: 110px; height: 110px; border-radius: 50%; margin: 0 auto;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  font-weight: 800; }
.score-A, .score-B { background: var(--good-tint); color: var(--good); }
.score-C { background: var(--warn-tint); color: var(--warn); }
.score-D, .score-F { background: var(--bad-tint); color: var(--bad); }
.score-ring .g { font-size: 2.6rem; line-height: 1; }
.score-ring .n { font-size: .8rem; font-weight: 600; opacity: .8; }

/* ---------- paw rating (signature element) ---------- */

.paw-rating { display: inline-flex; gap: .35rem; align-items: center; }
.paw-rating svg { display: block; }
@media (prefers-reduced-motion: no-preference) {
  .paw-rating svg { opacity: 0; animation: paw-in .35s ease forwards; }
  .paw-rating svg:nth-child(1) { animation-delay: .05s; }
  .paw-rating svg:nth-child(2) { animation-delay: .15s; }
  .paw-rating svg:nth-child(3) { animation-delay: .25s; }
  .paw-rating svg:nth-child(4) { animation-delay: .35s; }
  .paw-rating svg:nth-child(5) { animation-delay: .45s; }
  @keyframes paw-in { from { opacity: 0; transform: translateY(4px) rotate(-6deg); }
                      to   { opacity: 1; transform: none; } }
}

/* ---------- dashboard per-site monitor checklist ---------- */

.dim-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .65rem; }
.dim {
  display: inline-flex; align-items: center; gap: .32rem;
  font-size: .8rem; font-weight: 600; line-height: 1.25;
  padding: .2rem .6rem; border: 1px solid transparent;
  border-radius: var(--radius-pill); white-space: nowrap;
}
.dim-mark { font-weight: 800; font-size: .72rem; }
.dim-note { font-weight: 700; opacity: .9; }
/* good = calm: hairline outline on the card, recedes so a healthy row reads serene */
.dim-good    { background: var(--surface); color: var(--good); border-color: var(--mist-dark); }
.dim-good .dim-mark { color: var(--brand); }
/* warn / bad = filled, so a problem advances and catches the eye first */
.dim-warn    { background: var(--warn-tint); color: var(--warn); }
.dim-bad     { background: var(--bad-tint);  color: var(--bad); }
.dim-pending { background: var(--surface-2); color: var(--muted); }

/* ---------- "what the schnauzer watches" grid ---------- */

.watch-grid { display: grid; gap: .75rem; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) { .watch-grid { grid-template-columns: repeat(3, 1fr); } }
.watch-grid .tile {
  background: var(--mist); border-radius: var(--radius-sm);
  padding: .9rem 1rem; font-weight: 650; font-size: .95rem; color: var(--ink-soft);
}
.watch-grid .tile span { display: block; font-weight: 400; font-size: .85rem;
  color: var(--muted); margin-top: .15rem; }

/* ---------- footer ---------- */

.site-footer { border-top: 1px solid var(--line); margin-top: 2rem;
  padding: 2.5rem 0; color: var(--muted); font-size: .9rem; }
.site-footer .bar { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center;
  max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }
.site-footer a { color: var(--ink-soft); }
.site-footer .spacer { flex: 1; }

/* ---------- utility ---------- */

.stack-sm > * + * { margin-top: .5rem; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; align-items: center; gap: 1rem; }
.flex-wrap { flex-wrap: wrap; }
.gap-sm { gap: .5rem; }
hr.soft { border: none; border-top: 1px solid var(--line); margin: 2rem 0; }

/* ---------- mobile (≤640px) ----------
   The header had no breakpoint: logo + 4 nav items (plus the account email
   when signed in) overflowed narrow phones, scrolling the whole page
   sideways and making everything read as off-center. Fix the overflow at
   the source + a body guard so nothing else can reintroduce it. */
html, body { overflow-x: hidden; }
*, *::before, *::after { max-width: 100%; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .site-header .bar { gap: .4rem; padding: .6rem .85rem; }
  .site-header .logo { font-size: 1.05rem; gap: .4rem; }
  .site-header .logo img,
  .site-header .logo svg { width: 28px; height: 28px; }
  .site-header nav { gap: .75rem; }
  .site-header nav a { font-size: .85rem; }
  .site-header .who { display: none; }   /* email hogs width; it's on the dashboard anyway */
  section { padding: 2.5rem 0; }
  section.tight { padding: 1.5rem 0; }
  .hero { padding: 2rem 0 1.5rem; }
  .mascot-hero { height: 132px; }
  .card-pad-lg { padding: 1.4rem; }
  .wrap, .site-header .bar, .site-footer .bar { padding-left: 1rem; padding-right: 1rem; }
  .site-footer .bar { gap: .5rem 1rem; }
  .site-footer .spacer { flex-basis: 100%; height: 0; }  /* links drop to their own line, tidy */
}

/* The `* { max-width:100% }` guard must not crush fixed-size inline SVGs
   (e.g. the paw-rating). Restore intrinsic sizing where it matters. */
.paw-rating svg, .site-header .logo img, .site-header .logo svg { max-width: none; }

/* ---------- admin console ---------- */

.admin-subnav { display: flex; align-items: center; gap: 1.1rem;
  padding-bottom: .75rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
.admin-subnav strong { font-size: 1.05rem; letter-spacing: -.01em; }
.admin-subnav a { color: var(--muted); font-weight: 600; font-size: .92rem; }
.admin-subnav a.is-active { color: var(--ink); }

.stat-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem 1.1rem; }
.stat-label { display: block; font-size: .8rem; color: var(--muted); font-weight: 600; }
.stat-num { display: block; font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; margin: .15rem 0; }
.stat-sub { display: block; font-size: .78rem; color: var(--muted); }
.stat-alert { border-color: var(--bad); background: var(--bad-tint); }
.stat-alert .stat-num { color: var(--bad); }

.admin-cols { display: grid; gap: 1.25rem; grid-template-columns: 1fr; margin-top: 1.25rem; }
@media (min-width: 760px) { .admin-cols { grid-template-columns: 1fr 1fr; } }

.admin-list { list-style: none; padding: 0; margin: 0; }
.admin-list li { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding: .55rem 0; border-bottom: 1px solid var(--line-soft); }
.admin-list li:last-child { border-bottom: none; }
.admin-list a { font-weight: 600; word-break: break-all; }

.admin-search { display: flex; align-items: center; gap: .6rem; }
.admin-search input { flex: 1; }

.admin-table th, .admin-table td { vertical-align: middle; }
.admin-table form { margin: 0; }
@media (max-width: 640px) {
  .admin-table { display: block; overflow-x: auto; white-space: nowrap; }
}
