/* ============================================================
   PhoneFlippers design system — same tokens as the training portal
   (pulled from phoneflippers.com):
   Font:      Poppins 400/700 (Google Fonts)
   BG:        fixed vertical gradient #6dc7ff -> #234ecd
   Text:      #fff primary; rgba(255,255,255,.9)/.8 secondary
   Cards:     rgba(255,255,255,.10) bg, 1px rgba(255,255,255,.22) border,
              radius 22-32px, shadow, hover lift
   Primary:   white pill button, dark #0f172a text
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --text: #ffffff;
  --text-90: rgba(255, 255, 255, 0.9);
  --text-80: rgba(255, 255, 255, 0.8);
  --card-bg: rgba(255, 255, 255, 0.1);
  --card-border: rgba(255, 255, 255, 0.22);
  --card-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  --btn-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  --dark: #0f172a;
  --radius-card: 26px;
  --radius-btn: 16px;
  --ok: #6cf0a8;
  --bad: #ff9c9c;
}

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

body {
  font-family: "Poppins", ui-sans-serif, system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  font-weight: 400;
  color: var(--text);
  min-height: 100vh;
  background: linear-gradient(180deg, #6dc7ff, #234ecd) fixed;
}

h1, h2, h3 { font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; }
h1 { font-size: clamp(1.7rem, 5vw, 2.6rem); }
h2 { font-size: clamp(1.25rem, 4vw, 1.7rem); }
h3 { font-size: 1.05rem; }
p { color: var(--text-90); }
a { color: inherit; }

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

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 clamp(16px, 4vw, 40px);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.wordmark {
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: clamp(1rem, 3.6vw, 1.3rem);
  white-space: nowrap;
}
.wordmark .dotcom { font-weight: 400; color: var(--text-80); }

.nav { display: flex; gap: clamp(8px, 2vw, 20px); overflow-x: auto; }
.nav a {
  text-decoration: none;
  color: var(--text-80);
  font-size: 0.92rem;
  padding: 8px 4px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.nav a.active { color: var(--text); border-bottom-color: rgba(255, 255, 255, 0.7); }

/* ---------- login screen ---------- */

.login-wrap { min-height: 80vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; }
.login-brand { text-align: center; font-weight: 700; letter-spacing: -0.03em; font-size: 1.5rem; }

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

.page { max-width: 1060px; margin: 0 auto; padding: clamp(16px, 4vw, 32px) clamp(14px, 4vw, 32px) 96px; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1 1 auto; }
.center { text-align: center; }
.muted { color: var(--text-80); font-size: 0.92rem; }
.small { font-size: 0.85rem; }

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

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: clamp(18px, 4vw, 28px);
}

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

.btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-btn);
  padding: 14px 24px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn:not(:disabled):active { transform: scale(0.97); }

.btn-primary { background: #fff; color: var(--dark); box-shadow: var(--btn-shadow); }
.btn-primary:not(:disabled):hover { transform: translateY(-1px) scale(1.03); }

.btn-ghost { background: transparent; color: var(--text); border: 1px solid rgba(255, 255, 255, 0.4); }
.btn-ghost:not(:disabled):hover { background: rgba(255, 255, 255, 0.1); }

.btn-sm { padding: 9px 16px; font-size: 0.88rem; border-radius: 12px; }
.btn-block { width: 100%; }

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

label.field { display: block; }
label.field > span { display: block; font-size: 0.85rem; color: var(--text-80); margin-bottom: 6px; }

input, select, textarea {
  font-family: inherit;
  font-size: 1rem;
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  outline: none;
}
input::placeholder, textarea::placeholder { color: rgba(255, 255, 255, 0.55); }
input:focus, select:focus, textarea:focus { border-color: rgba(255, 255, 255, 0.6); }

/* ---------- tabs (date filters) ---------- */

.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.tab.active { background: #fff; color: var(--dark); border-color: #fff; }

/* ---------- stat tiles (like the portal quote boxes) ---------- */

.quote-numbers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.quote-box {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 16px;
  text-align: center;
}
.quote-box .qb-label { font-size: 0.78rem; color: var(--text-80); }
.quote-box .qb-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.03em; }
.quote-box .qb-sub { font-size: 0.78rem; color: var(--text-80); margin-top: 2px; }
.quote-box.hero { background: #fff; color: var(--dark); box-shadow: var(--btn-shadow); }
.quote-box.hero .qb-label, .quote-box.hero .qb-sub { color: rgba(15, 23, 42, 0.6); }

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

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td {
  text-align: left;
  padding: 10px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  vertical-align: middle;
}
th { color: var(--text-80); font-weight: 700; font-size: 0.8rem; white-space: nowrap; }
th.sortable { cursor: pointer; user-select: none; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }

.adname { font-weight: 700; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adsub { font-size: 0.8rem; color: var(--text-80); max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dim { color: var(--text-80); }
.conv-good { color: var(--ok); font-weight: 700; }

.bar-track { min-width: 110px; height: 14px; }
.bar { height: 14px; border-radius: 0 4px 4px 0; background: rgba(255, 255, 255, 0.85); min-width: 2px; }

/* ---------- badges / pills ---------- */

.pill {
  display: inline-block;
  font-family: inherit;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-80);
  cursor: pointer;
}
.pill.pass { color: var(--ok); border-color: rgba(108, 240, 168, 0.5); }

/* ---------- banners / misc ---------- */

.error-banner {
  background: rgba(180, 30, 30, 0.35);
  border: 1px solid rgba(255, 156, 156, 0.5);
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 0.92rem;
}
.notice-banner {
  background: rgba(30, 140, 90, 0.3);
  border: 1px solid rgba(150, 240, 200, 0.5);
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 0.92rem;
}
.empty { color: var(--text-80); text-align: center; padding: 28px 0; }
.linkish {
  background: none; border: none; padding: 0;
  color: #fff; font: inherit; text-decoration: underline; cursor: pointer;
}

/* code blocks on the setup page */
pre, code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.85rem;
}
pre {
  background: rgba(20, 40, 90, 0.55);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 12px 14px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
code {
  background: rgba(20, 40, 90, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  padding: 1px 6px;
}

#toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 40, 90, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--card-border);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 0.92rem;
  box-shadow: var(--card-shadow);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  z-index: 100;
}
#toast.show { opacity: 1; }
#toast.bad { background: rgba(180, 30, 30, 0.75); border-color: rgba(255, 156, 156, 0.5); }

footer { font-size: 0.85rem; color: var(--text-80); text-align: center; }
