/* BreachWatcher subscriber app.
 *
 * Styled to match breachwatcher.io: near-black ground, slate cards, one neon
 * green for anything interactive or "ours", Montserrat for text with small
 * uppercase letter-spaced labels, DM Serif Display for headings, and square
 * 3px corners throughout. Deliberately a single dark look — the brand is
 * dark, and a light variant would be a second brand.
 *
 * Within that system the semantic colours keep their jobs: exposure (a leaked
 * password) is the one warm colour, advisories are amber, and settled things
 * stay quiet. Locked findings are visible but flat — the free tier's
 * conversion hook is seeing the count, not a wall.
 */

:root {
  color-scheme: dark;

  --bg:        #0B0F0E;
  --bg-card:   #1F2A2E;
  --bg-sunk:   #151d20;
  --primary:   #39FF14;
  --primary-hover: #55ff33;
  --primary-glow:  rgba(57,255,20,.18);
  --primary-wash:  rgba(57,255,20,.07);
  --text:      #FFFFFF;
  --text-2:    #c9d1cf;
  --text-muted:#8a9694;
  --text-dim:  #5F6A6A;
  --border:    rgba(57,255,20,.14);
  --border-dim:rgba(255,255,255,.06);
  --border-mid:rgba(255,255,255,.12);

  --exposed:      #ef4444;
  --exposed-wash: rgba(239,68,68,.12);
  --advisory:     #f5b731;
  --advisory-wash:rgba(245,183,49,.12);
  --ok:           var(--primary);
  --ok-wash:      var(--primary-wash);

  --shadow: 0 16px 40px rgba(0,0,0,.45);
  --ring: 0 0 0 3px rgba(57,255,20,.30);

  --sans: 'Montserrat', ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: 'DM Serif Display', Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;
  --gutter: clamp(1rem, 5vw, 3rem);
  --nav-h: 72px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.7 var(--sans);
  letter-spacing: .3px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}
/* The marketing hero's faint grid, kept far below content contrast. */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(57,255,20,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57,255,20,.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 0%, black 0%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 0%, black 0%, transparent 100%);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
b, strong { font-weight: 700; }

/* Small uppercase label — the marketing site's signature. */
.label, .stat .lbl, .nav a, .channel legend, label:not(.switch-row), .chip, .whoami, .foot p {
  text-transform: uppercase; letter-spacing: 2px; font-weight: 600; font-size: .68rem;
}

.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--bg-card); color: var(--text); padding: .5rem 1rem; z-index: 10;
}
.skip:focus { left: .5rem; }

/* ------------------------------------------------------------- topbar -- */
.topbar {
  background: rgba(11,15,14,.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 1px 0 var(--border-dim);
  position: sticky; top: 0; z-index: 5;
}
.topbar-inner {
  max-width: 68rem; margin: 0 auto; padding: 0 var(--gutter);
  display: flex; align-items: center; gap: 2rem;
  min-height: var(--nav-h); flex-wrap: wrap;
}
.brand {
  display: flex; align-items: center; gap: 12px; color: var(--text); white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand img {
  height: 44px; width: 44px; object-fit: cover; border-radius: 50%;
  border: 1px solid rgba(57,255,20,.25);
}
.brand-text {
  font-weight: 800; font-size: 1.05rem; letter-spacing: 2px; text-transform: uppercase; line-height: 1.1;
}
.brand-text b, .brand b { color: var(--primary); font-weight: 800; }
.brand-tag {
  display: block; font-size: .56rem; color: var(--text-dim);
  letter-spacing: 2.5px; text-transform: uppercase; line-height: 1; margin-top: 4px; font-weight: 600;
}
.nav { display: flex; gap: 1.6rem; flex-wrap: wrap; }
.nav a {
  color: var(--text-muted); position: relative; padding: .35rem 0; transition: color .2s;
}
.nav a::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px;
  background: var(--primary); transform: scaleX(0); transition: transform .2s;
}
.nav a:hover { color: var(--text); text-decoration: none; }
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }
.nav a[aria-current="page"] { color: var(--text); }
.whoami {
  margin-left: auto; color: var(--text-dim); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; max-width: 18rem; white-space: nowrap;
  text-transform: none; letter-spacing: .5px; font-size: .78rem;
}

/* --------------------------------------------------------------- main -- */
.main {
  flex: 1;
  width: 100%; max-width: 68rem; margin: 0 auto;
  padding: 2.5rem var(--gutter) 4rem;
}
.foot {
  border-top: 1px solid var(--border-dim);
  color: var(--text-dim);
  max-width: 68rem; margin: 0 auto; width: 100%;
  padding: 1.5rem var(--gutter) 2rem;
}
.foot p { margin: 0; font-size: .62rem; letter-spacing: 1.5px; line-height: 1.8; }

h1, h2, h3 { font-family: var(--serif); font-weight: 400; color: var(--text); }
h1 { font-size: clamp(1.9rem, 3.5vw, 2.6rem); line-height: 1.15; letter-spacing: 2px; margin: 0 0 .6rem; }
h2 { font-size: 1.45rem; letter-spacing: 1.5px; margin: 2.25rem 0 1rem; }
h3 { font-size: 1.15rem; letter-spacing: 1px; margin: 0; }
.sub { color: var(--text-muted); margin: 0 0 1.75rem; font-size: .9rem; letter-spacing: 1px; line-height: 1.85; }
.sub b { color: var(--text); }

/* -------------------------------------------------------------- cards -- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 3px;
  padding: 1.4rem 1.6rem;
  position: relative;
}
.card > p:first-child, .card > .desc:first-child { margin-top: 0; }
.card > p:last-child { margin-bottom: 0; }
.stack > * + * { margin-top: 1rem; }

/* Stat tiles on the dashboard, after the marketing hero's stat boxes. */
.stats {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  margin-bottom: 1.75rem;
}
.stat {
  background: rgba(31,42,46,.85);
  border-top: 1px solid rgba(57,255,20,.12);
  padding: 1.25rem 1.35rem;
}
.stat .num {
  font-family: var(--serif); font-size: 2.2rem; line-height: 1;
  color: var(--primary); margin-bottom: .45rem;
  font-variant-numeric: tabular-nums;
}
.stat .lbl { color: var(--text-muted); font-size: .62rem; }
.stat.exposed .num { color: var(--exposed); }
.stat.exposed { border-top-color: rgba(239,68,68,.35); }
.stat.advisory .num { color: var(--advisory); }
.stat.advisory { border-top-color: rgba(245,183,49,.35); }
.stat.ok .num { color: var(--primary); }

/* ------------------------------------------------------------ exposures -- */
.exposure { position: relative; overflow: hidden; }
.exposure::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, var(--primary), transparent);
  transform: scaleX(0); transform-origin: left; transition: transform .3s;
}
.exposure:hover::before { transform: scaleX(1); }
.exposure.unseen { border-left: 2px solid var(--primary); }
.exposure-head {
  display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap;
}
.exposure-head .breach { font-weight: 700; font-size: 1rem; letter-spacing: 1px; }
.exposure-head .when { color: var(--text-dim); font-size: .72rem; margin-left: auto; letter-spacing: 1px; }
.exposure .addr { color: var(--text-muted); font-family: var(--mono); font-size: .82rem; letter-spacing: 0; }

.chiprow { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .9rem; }
.detail-toggle { margin-top: 1rem; }
.chip {
  padding: .2rem .6rem; border-radius: 2px;
  background: rgba(255,255,255,.04); color: var(--text-muted);
  border: 1px solid var(--border-dim); font-size: .6rem;
}
.chip.exposed { background: var(--exposed-wash); color: var(--exposed); border-color: rgba(239,68,68,.3); font-weight: 700; }
.chip.ok { background: var(--ok-wash); color: var(--primary); border-color: var(--border); }

/* A leaked credential. Monospace, and loud. */
.credline {
  display: flex; align-items: center; gap: .9rem; flex-wrap: wrap;
  margin-top: .9rem; padding: .7rem .9rem;
  background: var(--bg); border: 1px solid var(--border-dim); border-radius: 3px;
  font-family: var(--mono); font-size: .9rem; letter-spacing: 0;
}
.credline .secret { color: var(--exposed); font-weight: 600; word-break: break-all; }
.credline .plain {
  user-select: all;   /* one click selects the whole password */
}

.locked {
  border-style: dashed; border-color: var(--border-mid);
  color: var(--text-muted);
}
.locked .lock-title { font-weight: 700; color: var(--text); letter-spacing: 1px; }

.detail {
  margin-top: 1.1rem; padding-top: 1.1rem;
  border-top: 1px solid var(--border-dim);
  font-size: .88rem; color: var(--text-2); line-height: 1.8;
}
.detail p { margin: 0; }
.detail dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1.25rem; margin: .9rem 0 0; }
.detail dt { color: var(--text-dim); text-transform: uppercase; letter-spacing: 1.5px; font-size: .62rem; font-weight: 600; padding-top: .25rem; }
.detail dd { margin: 0; }

/* ------------------------------------------------------------- buttons -- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--sans); font-weight: 700; font-size: .7rem;
  letter-spacing: 2.5px; text-transform: uppercase;
  padding: .8rem 1.4rem; border-radius: 3px;
  border: 1.5px solid rgba(57,255,20,.3); background: transparent;
  color: var(--text); cursor: pointer;
  transition: all .2s; -webkit-appearance: none; appearance: none;
}
.btn:hover {
  border-color: var(--primary); color: var(--primary);
  transform: translateY(-1px); box-shadow: 0 0 20px rgba(57,255,20,.08);
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: #000; font-weight: 800; }
.btn.primary:hover { background: var(--primary-hover); color: #000; box-shadow: 0 0 32px var(--primary-glow); }
.btn.danger { color: var(--exposed); border-color: rgba(239,68,68,.4); }
.btn.danger:hover { border-color: var(--exposed); background: var(--exposed-wash); box-shadow: none; }
.btn.ghost { background: var(--primary-wash); color: var(--primary); border: 1px solid rgba(57,255,20,.22); }
.btn.ghost:hover { background: rgba(57,255,20,.13); color: var(--primary); box-shadow: 0 0 24px rgba(57,255,20,.1); }
.btn.small { padding: .45rem .8rem; font-size: .62rem; letter-spacing: 2px; }
.btn:disabled { opacity: .45; cursor: default; transform: none; box-shadow: none; }
.btn:focus-visible, input:focus-visible, a:focus-visible, .switch:focus-visible { outline: none; box-shadow: var(--ring); }

/* --------------------------------------------------------------- forms -- */
label { display: block; color: var(--text-muted); margin: 1.25rem 0 .5rem; }
form > label:first-child, .modal-body > label:first-child { margin-top: 0; }
input[type="email"], input[type="text"], input:not([type]) {
  display: block; width: 100%; max-width: 24rem;
  font: .92rem/1.4 var(--sans); letter-spacing: .3px;
  padding: .75rem .9rem;
  border: 1px solid var(--border-dim); border-radius: 3px;
  background: var(--bg); color: var(--text);
  transition: border-color .2s;
}
input::placeholder { color: var(--text-dim); }
input:focus { border-color: var(--primary); }
#stepup-code, .code-input {
  font-family: var(--mono); letter-spacing: .4em; font-size: 1.3rem;
  max-width: 11rem; text-align: center; color: var(--primary);
}

.form-actions { margin-top: 1.4rem; }
.error { color: var(--exposed); font-size: .85rem; margin: .9rem 0 0; }
.notice { color: var(--text-muted); font-size: .85rem; margin: .9rem 0 0; }
.error[hidden], .notice[hidden] { display: none; }
.muted { color: var(--text-dim); }
.mono { font-family: var(--mono); letter-spacing: 0; }
.ok { color: var(--primary); }

/* Sign-in page: the hero, in miniature. */
.auth-wrap { max-width: 28rem; margin: 10vh auto 0; }
.auth-wrap h1 { font-size: clamp(2.2rem, 5vw, 3rem); letter-spacing: 3px; }
.auth-wrap h1 b { color: var(--primary); font-weight: 400; }
.auth-wrap .sub { margin-bottom: 1.5rem; }
.auth-wrap .card { padding: 1.75rem 1.85rem; border-top: 1px solid rgba(57,255,20,.18); }
.auth-wrap .auth-note { font-size: .8rem; letter-spacing: .5px; line-height: 1.8; margin: 1.25rem 0 0; }

/* Upsell strip for the free tier — the marketing site's "featured" card. */
.upsell {
  background: var(--bg-card);
  border: 1px solid rgba(57,255,20,.3);
  border-radius: 3px;
  box-shadow: 0 0 40px rgba(57,255,20,.05);
  padding: 1.1rem 1.4rem;
  font-size: .88rem; color: var(--text-muted); line-height: 1.8;
}
.upsell b { color: var(--primary); }

/* --------------------------------------------------------------- modal -- */
.modal {
  border: 1px solid rgba(57,255,20,.2); border-radius: 3px;
  background: var(--bg-card); color: var(--text);
  box-shadow: 0 24px 60px rgba(0,0,0,.6), 0 0 40px rgba(57,255,20,.06); padding: 0;
  width: min(92vw, 26rem);
}
.modal::backdrop { background: rgba(11,15,14,.75); backdrop-filter: blur(6px); }
.modal-body { padding: 1.6rem 1.75rem 1.75rem; }
.modal-body h2 { margin-top: 0; }
.modal-body p { color: var(--text-muted); font-size: .88rem; }
.modal-body p b { color: var(--text); }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.4rem; }

/* ------------------------------------------------------------ settings -- */
.setting-row {
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
  justify-content: space-between;
}
.desc > b { display: block; font-weight: 700; letter-spacing: 1.5px; font-size: .88rem; }
.setting-row .desc { max-width: 36rem; }
.desc p { margin: .35rem 0 0; color: var(--text-muted); font-size: .84rem; line-height: 1.75; }
.erase-row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; margin-top: 1.1rem; }
.erase-row input { flex: 1 1 16rem; max-width: 24rem; }

/* Notification preferences: one fieldset per channel, a switch per row. */
.channels {
  display: grid; gap: 1rem; margin-top: 1.1rem;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
}
.channel {
  border: 1px solid var(--border-dim); border-radius: 3px; background: var(--bg);
  padding: 1.1rem 1.2rem .5rem; margin: 0; min-width: 0;
}
/* A floated legend renders inside the box instead of straddling its border. */
.channel legend { float: left; width: 100%; padding: 0; margin: 0 0 .5rem; color: var(--primary); }
.channel .hint { clear: both; margin: 0 0 .6rem; color: var(--text-muted); font-size: .8rem; line-height: 1.7; }
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem 0; margin: 0; border-top: 1px solid var(--border-dim); cursor: pointer;
  color: var(--text); font-size: inherit; letter-spacing: .3px;
}
.switch-row:first-of-type { border-top: 0; }
.switch-row .switch-text { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.switch-row b { font-size: .8rem; letter-spacing: 1px; }
.switch-row small { color: var(--text-muted); font-size: .76rem; line-height: 1.6; }
.switch-row.off { opacity: .45; cursor: default; }
.switch {
  appearance: none; -webkit-appearance: none; flex: none; margin: 0;
  width: 2.7rem; height: 1.5rem; border-radius: 2px; position: relative;
  background: var(--bg-sunk); border: 1px solid var(--border-mid); cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.switch::after {
  content: ''; position: absolute; top: .18rem; left: .18rem;
  width: 1rem; height: 1rem; border-radius: 2px;
  background: var(--text-dim);
  transition: transform .15s, background .15s;
}
.switch:checked { background: var(--primary-wash); border-color: var(--primary); box-shadow: 0 0 12px rgba(57,255,20,.15); }
.switch:checked::after { transform: translateX(1.2rem); background: var(--primary); }
.switch:disabled { cursor: default; }

.pager { display: flex; justify-content: center; margin-top: 1.5rem; }

@media (max-width: 40rem) {
  .whoami { display: none; }
  .topbar-inner { gap: 1rem; padding-top: .6rem; padding-bottom: .6rem; }
  .nav { gap: 1rem; }
  .brand-tag { display: none; }
  .exposure-head .when { margin-left: 0; width: 100%; }
}
