/* ============================================================
 * Maddie's Lab Portal v2 — design system (Elfsight-style)
 * Clean, minimal, blue-accented. No marketing copy on surfaces.
 * ============================================================ */
:root {
  --bg: #ffffff;
  --bg-soft: #f6f8fb;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --faint: #98a2b3;
  --line: #e4e9f2;
  --blue: #2f7bff;
  --blue-dark: #1d5fd6;
  --blue-soft: #eaf1fe;
  --green: #16a34a;
  --red: #e5484d;
  --amber: #f59e0b;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .07);
  --shadow-lg: 0 24px 64px rgba(16, 24, 40, .12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { letter-spacing: -.02em; line-height: 1.25; margin: 0 0 .5em; color: var(--ink); }
h1 { font-size: 2rem; font-weight: 800; }
h2 { font-size: 1.35rem; font-weight: 750; }
p { margin: 0 0 1em; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
main { min-height: 70vh; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 20px; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.1rem; color: var(--ink); }
.logo:hover { text-decoration: none; }
.logo img { width: 34px; height: 34px; border-radius: 9px; }
.main-nav { display: flex; gap: 4px; margin-left: 8px; }
.main-nav a {
  color: var(--ink-2); font-weight: 600; font-size: .95rem;
  padding: 9px 14px; border-radius: 10px;
}
.main-nav a:hover { background: var(--bg-soft); text-decoration: none; }
.main-nav a.active { background: var(--blue-soft); color: var(--blue-dark); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.quota-pill {
  font-weight: 700; font-size: .82rem; color: var(--blue-dark);
  background: var(--blue-soft); padding: 8px 14px; border-radius: 999px; white-space: nowrap;
}
.quota-pill:hover { text-decoration: none; background: #dbe8fd; }
.quota-pill.low { color: #b42318; background: #fee4e2; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px 6px 6px;
  background: #fff; cursor: pointer; font: 600 .85rem var(--font); color: var(--ink-2);
}
.user-chip .avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--blue);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700;
}
.user-menu {
  position: absolute; top: 58px; right: 20px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 220px; padding: 6px; z-index: 200;
}
.user-menu button {
  display: block; width: 100%; text-align: left; border: 0; background: none;
  padding: 10px 12px; border-radius: 8px; font: 500 .9rem var(--font); color: var(--ink-2); cursor: pointer;
}
.user-menu button:hover { background: var(--bg-soft); }
.nav-toggle { display: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--blue); color: #fff; border: 0; border-radius: 9999px;
  font: 700 1rem var(--font); padding: 13px 26px; cursor: pointer;
  transition: background .15s;
}
.btn:hover { background: var(--blue-dark); text-decoration: none; color: #fff; }
.btn:disabled { background: #c9d2e3; cursor: default; }
.btn.secondary { background: #fff; color: var(--ink); border: 1.5px solid var(--line); }
.btn.secondary:hover { border-color: var(--blue); color: var(--blue-dark); background: #fff; }
.btn.small { padding: 8px 18px; font-size: .88rem; border-radius: 9999px; }
.btn.block { width: 100%; }

/* ---------- catalog ---------- */
.catalog-hero { padding: 40px 0 8px; text-align: center; }
.catalog-hero h1 { margin-bottom: 6px; }
.catalog-hero .lede { color: var(--muted); font-size: 1.05rem; max-width: 560px; margin: 0 auto; }
.catalog-tools { padding: 20px 0 48px; }
.search-row { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.search-input {
  flex: 1; min-width: 220px; font: 500 1rem var(--font); color: var(--ink);
  padding: 13px 18px 13px 44px; border: 0; border-radius: 12px;
  background: #f5f5f7 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2398a2b3' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") 16px center no-repeat;
}
.search-input:focus { outline: none; box-shadow: 0 0 0 3px var(--blue-soft); background: #fff; }
.cat-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }
.cat-pill {
  border: 1.5px solid var(--line); background: #fff; border-radius: 999px;
  padding: 8px 18px; font: 600 .9rem var(--font); color: var(--muted); cursor: pointer;
}
.cat-pill:hover { border-color: var(--blue); color: var(--blue-dark); }
.cat-pill.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.section-title { font-size: 1.15rem; margin: 28px 0 14px; }
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.app-card {
  background: #fff; border: 0; border-radius: var(--radius-lg);
  overflow: hidden; display: flex; flex-direction: column; color: var(--ink);
  transition: background .15s;
}
.app-card:hover { text-decoration: none; background: var(--bg-soft); }
.app-thumb {
  height: 120px; background: none;
  display: flex; align-items: center; justify-content: flex-start; padding: 20px 18px 0;
}
.app-thumb img { width: 64px; height: 64px; object-fit: contain; }
.app-body { padding: 16px 18px 18px; }
.app-name { font-weight: 750; font-size: 1rem; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.app-desc { color: var(--muted); font-size: .88rem; line-height: 1.5; margin: 0; }
.pill { font-size: .62rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; border: 1px solid currentColor; background: transparent; }
.pill-best { color: var(--blue-dark); }
.pill-new { color: var(--green); }
.no-results { text-align: center; color: var(--muted); padding: 48px 0; }

/* ---------- tool runner ---------- */
.tool-head { padding: 36px 0 4px; }
.tool-head .crumb { color: var(--muted); font-size: .88rem; margin-bottom: 10px; }
.tool-head .crumb a { color: var(--muted); }
.tool-head h1 { display: flex; align-items: center; gap: 14px; }
.tool-head h1 img { width: 52px; height: 52px; }
.tool-head .lede { color: var(--muted); max-width: 640px; }
.tool-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 28px; margin: 20px 0 48px;
}
.dropzone {
  border: 2px dashed #c9d6ee; border-radius: var(--radius); background: var(--bg-soft);
  padding: 44px 24px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--blue); background: var(--blue-soft); }
.dropzone .dz-icon { font-size: 2.4rem; margin-bottom: 8px; }
.dropzone .dz-title { font-weight: 700; font-size: 1.05rem; }
.dropzone .dz-hint { color: var(--muted); font-size: .88rem; margin-top: 4px; }
.spinner {
  width: 40px; height: 40px; margin: 24px auto; border-radius: 50%;
  border: 4px solid var(--line); border-top-color: var(--blue);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.alert { border-radius: 12px; padding: 13px 18px; font-size: .93rem; margin-bottom: 18px; }
.alert.ok { background: #e7f6ec; color: #166534; }
.alert.err { background: #fee4e2; color: #b42318; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 18px; }
.field label { display: block; font-size: .78rem; font-weight: 700; color: var(--muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .04em; }
.field input, .field select {
  width: 100%; font: 500 .95rem var(--font); color: var(--ink);
  padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 9999px; background: #fff;
}
.field input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.field input.edited { border-color: var(--amber); background: #fffaeb; }
table.editable { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.editable th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 8px; border-bottom: 2px solid var(--line); }
table.editable td { padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.editable td.num { text-align: right; }
table.editable input { width: 100%; font: 500 .9rem var(--font); padding: 8px 10px; border: 1px solid transparent; border-radius: 8px; }
table.editable input:hover { border-color: var(--line); }
table.editable input:focus { outline: none; border-color: var(--blue); }
table.editable input.edited { border-color: var(--amber); background: #fffaeb; }
.row-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.consent { display: flex; gap: 10px; align-items: flex-start; margin-top: 18px; font-size: .88rem; color: var(--muted); }
.consent input { margin-top: 4px; }

/* ---------- auth page ---------- */
.auth-page { min-height: 70vh; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card { width: 100%; max-width: 400px; text-align: center; }
.auth-logo { width: 64px; height: 64px; border-radius: 16px; margin-bottom: 20px; }
.auth-card h1 { font-size: 1.65rem; margin-bottom: 24px; }
.provider-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%;
  background: #fff; border: 1.5px solid var(--line); border-radius: 9999px;
  padding: 14px; font: 600 1rem var(--font); color: var(--ink); cursor: pointer; margin-bottom: 12px;
}
.provider-btn:hover { border-color: var(--blue); background: var(--bg-soft); }
.provider-btn .pi { font-size: 1.3rem; }
.auth-email { margin-top: 4px; text-align: left; }
.auth-err { background: #fee4e2; color: #b42318; border-radius: 10px; padding: 11px 15px; font-size: .88rem; margin-bottom: 14px; }
.auth-label { display: block; font-size: .8rem; font-weight: 700; color: var(--muted); margin-bottom: 12px; }
.auth-input {
  display: block; width: 100%; margin-top: 6px; font: 500 1rem var(--font); color: var(--ink);
  padding: 13px 18px; border: 1.5px solid var(--line); border-radius: 9999px;
}
.auth-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.pass-wrap { position: relative; }
.pass-wrap .auth-input { padding-right: 52px; }
.eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: none; font-size: 1.25rem; cursor: pointer; padding: 10px; color: var(--muted);
}
.auth-switch { margin-top: 22px; color: var(--muted); font-size: .92rem; }
.auth-switch a { font-weight: 600; }
.auth-check { padding: 24px 0; }
.auth-check .big { font-size: 3rem; margin-bottom: 12px; }

/* ---------- pricing ---------- */
.price-hero { text-align: center; padding: 40px 0 8px; }
.bill-toggle { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 20px 0 28px; font-weight: 600; color: var(--faint); }
.bill-toggle .on { color: var(--ink); }
.switch { position: relative; width: 52px; height: 30px; background: #c9d2e3; border-radius: 999px; border: 0; cursor: pointer; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; background: #fff; border-radius: 50%; transition: left .18s; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.switch.annual { background: var(--blue); }
.switch.annual::after { left: 25px; }
.price-cols { display: grid; grid-template-columns: 210px 1fr; gap: 22px; align-items: start; max-width: 980px; margin: 0 auto; padding-bottom: 56px; }
.plan-rail { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 84px; }
.plan-btn {
  background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 14px;
  font: 600 1rem var(--font); color: var(--blue); cursor: pointer;
}
.plan-btn:hover { border-color: var(--blue); }
.plan-btn.sel { border-color: var(--ink); color: var(--ink); box-shadow: var(--shadow); }
.plan-btn .cur { display: block; font-size: .7rem; color: var(--green); font-weight: 700; margin-top: 2px; }
.plan-card { position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 36px 34px; overflow: hidden; }
.plan-deal { position: absolute; top: 0; right: 22px; background: var(--ink); color: #fff; font-size: .68rem; font-weight: 700; letter-spacing: .07em; padding: 6px 14px; border-radius: 0 0 10px 10px; }
.plan-ribbon { position: absolute; top: 22px; right: -6px; background: #f43f5e; color: #fff; font-size: .78rem; font-weight: 700; padding: 6px 20px 6px 14px; clip-path: polygon(10px 0, 100% 0, 100% 100%, 10px 100%, 0 50%); }
.plan-name { font-size: 1.5rem; font-weight: 800; margin: 0; }
.plan-aud { color: var(--muted); margin: 4px 0 20px; }
.plan-price { font-size: 3.4rem; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.plan-price .cur { font-size: 1.5rem; font-weight: 600; vertical-align: top; position: relative; top: 8px; }
.plan-price .per { font-size: 1.05rem; font-weight: 500; color: var(--faint); }
.plan-was { color: var(--faint); text-decoration: line-through; font-size: 1.4rem; font-weight: 600; margin-left: 10px; }
.plan-save { display: inline-block; background: var(--bg-soft); color: var(--ink-2); font-size: .82rem; font-weight: 600; padding: 7px 16px; border-radius: 999px; margin: 16px 0 4px; }
.plan-cta { width: 100%; margin: 20px 0 6px; }
.plan-feats { list-style: none; margin: 16px 0 0; padding: 0; }
.plan-feats li { padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: .97rem; }
.plan-feats li:last-child { border: none; }
.plan-feats li.off { color: var(--faint); text-decoration: line-through; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0; margin-top: 24px; }
.site-footer .wrap { display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: .88rem; flex-wrap: wrap; }
.site-footer nav { display: flex; gap: 16px; margin-left: auto; }
.site-footer a { color: var(--muted); }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 13px 22px; border-radius: 999px;
  font: 600 .9rem var(--font); box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 1000; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .main-nav { display: none; }
  .nav-toggle { display: inline-flex; margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 1.1rem; cursor: pointer; }
  .site-header .wrap.menu-open .main-nav {
    display: flex; position: absolute; top: 64px; left: 0; right: 0; background: #fff;
    flex-direction: column; padding: 12px 20px 20px; border-bottom: 1px solid var(--line); margin: 0;
  }
  .price-cols { grid-template-columns: 1fr; }
  .plan-rail { flex-direction: row; overflow-x: auto; position: static; padding-bottom: 4px; }
  .plan-btn { white-space: nowrap; }
  .tool-card { padding: 20px; }
  h1 { font-size: 1.6rem; }
}

/* ---------- usage stats (Elfsight dashboard pattern) ---------- */
.usage { display: flex; flex-direction: column; gap: 3px; text-decoration: none; min-width: 110px; }
.usage:hover { text-decoration: none; }
.usage .u-label { font-size: .68rem; font-weight: 700; letter-spacing: .06em; color: var(--muted); }
.usage .u-label b { color: var(--ink); }
.usage .u-bar { height: 4px; background: #eef1f7; border-radius: 999px; overflow: hidden; }
.usage .u-bar i { display: block; height: 100%; background: var(--blue); border-radius: 999px; }
.usage.low .u-bar i { background: var(--red); }
