/* ============================================================================
   RCS Care — design system
   ----------------------------------------------------------------------------
   Subject: pest control for food manufacturing and corporate estates. The
   buyer is a QA head or facility manager who has to survive an FSSAI / AIB /
   BRC audit. So the product is not "spraying" — it is the evidence trail:
   which chemical, what quantity, which technician, confirmed by whom, when.

   The palette comes from that world rather than from consumer pest control:
   moss green (field + safety) as ground, inspection-tag amber as the single
   accent, coral only for live pest sightings. Mono type carries every number
   an auditor would check.
   ========================================================================= */

/* Faces are linked per page — fonts-app.css for the portals, fonts-site.css
   for the public site. Importing both from here made every marketing page
   fetch three families it never renders. */

:root {
  /* dark is the default ground — control rooms and field phones at dusk */
  --ink:        #0A0F0C;
  --surface:    #111815;
  --surface-2:  #18211D;
  --surface-3:  #1F2A25;
  --line:       #26332C;
  --line-soft:  #1B2621;

  --moss:       #1F7A4C;
  --moss-lift:  #2A9A61;
  --moss-dim:   #145033;

  --signal:     #E4A548;   /* inspection tag — the one loud thing */
  --signal-dim: #8A6524;

  --alert:      #E05C4B;   /* live sighting / overdue only */
  --alert-dim:  #7A3229;
  --info:       #4B9FE0;

  --text:       #E9EFEA;
  --muted:      #8B9C92;
  --faint:      #5C6B63;

  --radius:     14px;
  --radius-sm:  9px;
  --radius-lg:  22px;

  --shadow:     0 1px 2px rgba(0,0,0,.4), 0 8px 28px -12px rgba(0,0,0,.7);
  --shadow-lg:  0 2px 4px rgba(0,0,0,.3), 0 30px 70px -24px rgba(0,0,0,.8);

  --display: 'Bricolage Grotesque', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --body:    'Instrument Sans', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono:    'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --ease:    cubic-bezier(.22,.9,.28,1);
  --ease-in: cubic-bezier(.5,0,.75,0);
}

@media (prefers-color-scheme: light) {
  :root {
    --ink:       #F4F7F4;
    --surface:   #FFFFFF;
    --surface-2: #F0F4F1;
    --surface-3: #E5EBE6;
    --line:      #D5DED7;
    --line-soft: #E6ECE7;
    --moss:      #16663D;
    --moss-lift: #1F8A52;
    --moss-dim:  #C9E5D6;
    --signal:    #B87914;
    --signal-dim:#F0DDB8;
    --alert:     #C4402E;
    --alert-dim: #F5D5CF;
    --text:      #0D1611;
    --muted:     #56675D;
    --faint:     #8A9990;
    --shadow:    0 1px 2px rgba(13,22,17,.06), 0 8px 24px -14px rgba(13,22,17,.22);
    --shadow-lg: 0 2px 6px rgba(13,22,17,.07), 0 28px 60px -28px rgba(13,22,17,.3);
  }
}

/* The viewer's explicit toggle must beat the OS preference in both
   directions, so both are restated at token level. */
:root[data-theme="dark"] {
  --ink:#0A0F0C; --surface:#111815; --surface-2:#18211D; --surface-3:#1F2A25;
  --line:#26332C; --line-soft:#1B2621;
  --moss:#1F7A4C; --moss-lift:#2A9A61; --moss-dim:#145033;
  --signal:#E4A548; --signal-dim:#8A6524;
  --alert:#E05C4B; --alert-dim:#7A3229;
  --text:#E9EFEA; --muted:#8B9C92; --faint:#5C6B63;
  --shadow:0 1px 2px rgba(0,0,0,.4), 0 8px 28px -12px rgba(0,0,0,.7);
  --shadow-lg:0 2px 4px rgba(0,0,0,.3), 0 30px 70px -24px rgba(0,0,0,.8);
}
:root[data-theme="light"] {
  --ink:#F4F7F4; --surface:#FFFFFF; --surface-2:#F0F4F1; --surface-3:#E5EBE6;
  --line:#D5DED7; --line-soft:#E6ECE7;
  --moss:#16663D; --moss-lift:#1F8A52; --moss-dim:#C9E5D6;
  --signal:#B87914; --signal-dim:#F0DDB8;
  --alert:#C4402E; --alert-dim:#F5D5CF;
  --text:#0D1611; --muted:#56675D; --faint:#8A9990;
  --shadow:0 1px 2px rgba(13,22,17,.06), 0 8px 24px -14px rgba(13,22,17,.22);
  --shadow-lg:0 2px 6px rgba(13,22,17,.07), 0 28px 60px -28px rgba(13,22,17,.3);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1,h2,h3,h4 { font-family: var(--display); font-weight: 800; letter-spacing: -.03em;
              line-height: 1.05; margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 4px; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.eyebrow {
  font-family: var(--mono); font-size: .68rem; text-transform: uppercase;
  letter-spacing: .18em; color: var(--signal); font-weight: 500;
}
.muted { color: var(--muted); }
.wrap { width: min(1240px, 100% - 3rem); margin-inline: auto; }

/* ── buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .72rem 1.25rem; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: .875rem; cursor: pointer;
  transition: transform .18s var(--ease), background .18s, border-color .18s, box-shadow .18s;
  background: transparent;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--moss); color: #fff; box-shadow: 0 6px 18px -8px var(--moss); }
.btn-primary:hover { background: var(--moss-lift); }
.btn-signal { background: var(--signal); color: #17120A; }
.btn-signal:hover { filter: brightness(1.08); }
.btn-ghost { border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--moss); background: color-mix(in srgb, var(--moss) 10%, transparent); }
.btn-sm { padding: .45rem .85rem; font-size: .8rem; }

/* ── surfaces ──────────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.pad { padding: 1.25rem; }

/* ── status pills: state must read as shape + colour, not colour alone ─── */
.pill {
  display: inline-flex; align-items: center; gap: .38rem;
  padding: .2rem .6rem .22rem; border-radius: 999px;
  font-family: var(--mono); font-size: .68rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; white-space: nowrap;
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 2px; background: currentColor; }
.pill-done    { color: var(--moss-lift); background: color-mix(in srgb, var(--moss) 16%, transparent); }
.pill-live    { color: var(--signal);    background: color-mix(in srgb, var(--signal) 16%, transparent); }
.pill-live::before { border-radius: 999px; animation: blip 1.6s infinite; }
.pill-wait    { color: var(--muted);     background: color-mix(in srgb, var(--muted) 14%, transparent); }
.pill-alert   { color: var(--alert);     background: color-mix(in srgb, var(--alert) 16%, transparent); }
.pill-alert::before { border-radius: 999px; }

@keyframes blip { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }

/* ── scroll reveal ─────────────────────────────────────────────────────── */
/* Scroll-reveal hides content until JS unhides it, so it is gated on JS being
   alive. Ungated, a script error or a blocked file leaves a marketing page
   blank rather than merely unanimated — the visitor sees nothing at all. */
.js .reveal { opacity: 0; transform: translateY(18px);
              transition: opacity .7s var(--ease), transform .7s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }
/* Nothing scrolls on a printed page, so without this the whole document
   comes out blank. Same for anyone who has asked for less motion. */
@media print { .js .reveal { opacity: 1 !important; transform: none !important; } }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ── shared app chrome (portals) ───────────────────────────────────────── */
.app { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }
.rail {
  background: var(--surface); border-right: 1px solid var(--line);
  padding: 1.4rem 1rem; display: flex; flex-direction: column; gap: 1.5rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.rail-nav { display: flex; flex-direction: column; gap: .15rem; }
.rail-nav a {
  display: flex; align-items: center; gap: .7rem; padding: .58rem .7rem;
  border-radius: var(--radius-sm); color: var(--muted); font-size: .875rem;
  font-weight: 500; transition: background .16s, color .16s;
}
.rail-nav a:hover { background: var(--surface-2); color: var(--text); }
.rail-nav a.on { background: color-mix(in srgb, var(--moss) 18%, transparent); color: var(--text); font-weight: 600; }
.rail-nav a.on .ic { color: var(--moss-lift); }
/* Nav icons are inline SVG, sized in one place so a stroke tweak does not
   need eleven edits. currentColor lets the .on state recolour them. */
.ic { width: 18px; height: 18px; color: var(--faint); flex: none; }
.rail-label {
  font-family: var(--mono); font-size: .62rem; text-transform: uppercase;
  letter-spacing: .16em; color: var(--faint); padding: 0 .7rem; margin-bottom: .4rem;
}
.main { padding: 1.6rem 2rem 4rem; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.6rem; flex-wrap: wrap;
}

/* ── brand mark ────────────────────────────────────────────────────────── */
.brand { display: inline-flex; align-items: center; gap: .6rem; font-family: var(--display);
         font-weight: 800; letter-spacing: -.035em; font-size: 1.1rem; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: linear-gradient(145deg, var(--moss-lift), var(--moss-dim));
  display: grid; place-items: center; color: #fff; font-size: .78rem;
  font-family: var(--mono); font-weight: 600; letter-spacing: -.04em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22);
}

/* ── data table ────────────────────────────────────────────────────────── */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .85rem; min-width: 640px; }
th {
  text-align: left; padding: .7rem .9rem; font-family: var(--mono); font-weight: 500;
  font-size: .66rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--faint); border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: .78rem .9rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .14s; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ── metric tiles ──────────────────────────────────────────────────────── */
.metrics { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
          padding: 1rem 1.1rem; position: relative; overflow: hidden; }
.metric::after {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--accent-bar, var(--moss));
}
.metric .k { font-family: var(--mono); font-size: .64rem; text-transform: uppercase;
             letter-spacing: .13em; color: var(--faint); }
.metric .v { font-family: var(--display); font-size: 2rem; font-weight: 800;
             letter-spacing: -.04em; margin-top: .3rem; font-variant-numeric: tabular-nums; }
.metric .d { font-size: .76rem; color: var(--muted); margin-top: .15rem; }

/* ── forms ─────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { font-size: .78rem; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input {
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--radius-sm); padding: .6rem .75rem; font-size: .875rem;
  transition: border-color .16s, background .16s; width: 100%;
}
.input:focus { border-color: var(--moss); background: var(--surface); outline: none; }
.input::placeholder { color: var(--faint); }

/* ── service code (OTP) ────────────────────────────────────────────────── */
.otp { display: flex; gap: .5rem; }
.otp input {
  width: 46px; height: 56px; text-align: center; font-family: var(--mono);
  font-size: 1.35rem; font-weight: 600; background: var(--surface-2);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); color: var(--text);
  transition: border-color .18s, transform .18s var(--ease), background .18s;
}
.otp input:focus { outline: none; border-color: var(--signal); background: var(--surface); }
.otp input.filled { border-color: var(--moss); background: color-mix(in srgb, var(--moss) 12%, var(--surface-2)); transform: translateY(-2px); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important;
                           transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; align-items: center;
          overflow-x: auto; border-right: none; border-bottom: 1px solid var(--line); }
  .rail-nav { flex-direction: row; }
  .rail-label, .rail .only-wide { display: none; }
  .main { padding: 1.2rem 1rem 3rem; }
}
