
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300..900;1,9..144,300..900&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }
*::selection { background: var(--orange); color: #fff; }

:root {
  --paper: #FAF6F1;
  --paper-shaded: #F2EDE4;
  --ink: #0A0F1F;
  --navy: #1A2B4A;
  --navy-deep: #0F1A2E;
  --navy-100: #EBEEF4;
  --navy-200: #D8DEE8;
  --orange: #E86C3A;
  --orange-hover: #D55A2A;
  --orange-soft: #FCE8DD;
  --amber: #F4A261;
  --green: #10B981;
  --green-soft: #D1FAE5;
  --red: #DC2626;
  --red-soft: #FEE2E2;
  --text: #0A0F1F;
  --text-muted: #4A5468;
  --text-light: #8A93A6;
  --border: #E5E0D6;
  --border-strong: #C9C0B0;
  --card: #FFFFFF;
  --shadow-sm: 0 1px 0 rgba(15, 26, 46, 0.04), 0 1px 2px rgba(15, 26, 46, 0.05);
  --shadow-md: 0 4px 14px -2px rgba(15, 26, 46, 0.08);
  --shadow-lg: 0 14px 28px -10px rgba(15, 26, 46, 0.18);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 22px;
  --font: 'Fraunces', Georgia, 'Times New Roman', serif;
}

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

body {
  font-family: var(--font);
  font-variation-settings: 'opsz' 14, 'wght' 400;
  font-feature-settings: 'tnum' 1, 'cv11' 1, 'ss01' 1;
  background-color: var(--paper);
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 1200'><g fill='none' stroke='%231A2B4A' stroke-width='0.6' opacity='0.045'><path d='M-50,200 Q200,80 450,180 T950,170 T1250,200'/><path d='M-50,310 Q200,200 450,290 T950,280 T1250,310'/><path d='M-50,420 Q200,320 450,400 T950,395 T1250,420'/><path d='M-50,540 Q200,440 450,520 T950,510 T1250,540'/><path d='M-50,660 Q200,560 450,640 T950,635 T1250,660'/><path d='M-50,790 Q200,690 450,770 T950,765 T1250,790'/><path d='M-50,920 Q200,820 450,900 T950,895 T1250,920'/><path d='M-50,1050 Q200,960 450,1040 T950,1035 T1250,1060'/></g></svg>");
  background-attachment: fixed;
  background-size: 1200px 1200px;
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select { font-family: inherit; font-feature-settings: inherit; }
button { font-family: inherit; }

/* ──────────────────────────────────────────────
   LOGIN PAGE
─────────────────────────────────────────────── */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-container::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 18% 25%, rgba(232, 108, 58, 0.14) 0%, transparent 40%),
    radial-gradient(circle at 82% 78%, rgba(26, 43, 74, 0.10) 0%, transparent 38%);
  pointer-events: none;
}

.login-card {
  position: relative;
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 56px 44px 36px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(15, 26, 46, 0.04);
  text-align: center;
  z-index: 1;
  animation: card-in .6s cubic-bezier(.2,.7,.2,1) both;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.login-card .brand-mark {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 28px;
}

.login-card .brand-mark .glyph {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--navy);
  display: grid;
  place-items: center;
  color: var(--orange);
  font-family: var(--font);
  font-size: 28px;
  font-variation-settings: 'opsz' 96, 'wght' 600;
  letter-spacing: -0.02em;
  box-shadow: 0 0 0 6px var(--paper-shaded), 0 0 0 7px var(--border);
}

.login-card .eyebrow {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-variation-settings: 'wght' 600;
  margin-bottom: 8px;
}

.login-card h1 {
  font-family: var(--font);
  font-variation-settings: 'opsz' 96, 'wght' 500;
  color: var(--ink);
  font-size: 32px;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin-bottom: 10px;
}

.login-card h1 em {
  font-style: italic;
  color: var(--orange);
  font-variation-settings: 'opsz' 96, 'wght' 500 'ital' 1;
}

.login-card .subtitle {
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 15px;
  line-height: 1.45;
}

.login-card form { text-align: left; }

.login-card input[type="email"] {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 15px;
  margin-bottom: 14px;
  outline: none;
  background: var(--paper);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s, background .15s;
  font-variation-settings: 'wght' 400;
}

.login-card input[type="email"]::placeholder { color: var(--text-light); }

.login-card input[type="email"]:focus {
  border-color: var(--orange);
  background: var(--card);
  box-shadow: 0 0 0 4px rgba(232, 108, 58, 0.14);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: var(--radius);
  font-size: 15px;
  font-variation-settings: 'wght' 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: -0.005em;
  transition: background .15s, transform .12s, box-shadow .15s, color .15s;
  color: #fff;
  background: var(--navy);
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--navy);
  color: #fff;
  width: 100%;
  position: relative;
  overflow: hidden;
  z-index: 0;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--orange) 0%, var(--amber) 100%);
  opacity: 0;
  transition: opacity .25s;
  z-index: -1;
}

.btn-primary:hover::before { opacity: 1; }
.btn-primary:disabled { opacity: .65; cursor: not-allowed; }
.btn-primary:disabled::before { opacity: 0; }

.btn-secondary {
  background: var(--navy-100);
  color: var(--navy);
  padding: 9px 14px;
  font-size: 13px;
}

.btn-secondary:hover { background: var(--navy-200); }

.btn-small {
  padding: 8px 14px;
  font-size: 12.5px;
  border-radius: 10px;
}

.message {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  text-align: left;
  line-height: 1.45;
}

.message.success { background: var(--green-soft); color: #065F46; }
.message.error { background: var(--red-soft); color: #991B1B; }

.login-footnote {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px dashed var(--border);
  font-size: 12.5px;
  color: var(--text-light);
  text-align: center;
  letter-spacing: 0.02em;
}

.login-footnote::before {
  content: '✦';
  margin-right: 6px;
  color: var(--orange);
}

/* ──────────────────────────────────────────────
   DASHBOARD LAYOUT
─────────────────────────────────────────────── */

.dashboard {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 28px 64px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  margin-bottom: 24px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.header-left { display: flex; align-items: center; gap: 14px; min-width: 0; }

.header-mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--navy);
  display: grid;
  place-items: center;
  color: var(--orange);
  font-family: var(--font);
  font-variation-settings: 'opsz' 96, 'wght' 600;
  font-size: 20px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.header-titles { min-width: 0; }

.header-eyebrow {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.20em;
  text-transform: uppercase;
  font-variation-settings: 'wght' 600;
  margin-bottom: 3px;
}

.partner-name {
  font-family: var(--font);
  font-variation-settings: 'opsz' 60, 'wght' 500;
  font-size: 21px;
  color: var(--ink);
  letter-spacing: -0.018em;
  line-height: 1.1;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.partner-name:empty::before {
  content: 'Welcome';
  color: var(--text-light);
  font-variation-settings: 'opsz' 60, 'wght' 400 'ital' 1;
  font-style: italic;
}

.header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

#logoutBtn {
  background: transparent;
  border: 1px solid var(--border-strong);
  padding: 9px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  font-family: inherit;
  font-variation-settings: 'wght' 500;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

#logoutBtn:hover { color: var(--ink); border-color: var(--ink); background: var(--paper-shaded); }

#logoutBtn::before {
  content: '';
  width: 14px; height: 14px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9'/></svg>") center/contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9'/></svg>") center/contain no-repeat;
}

/* ── Tabs (desktop pill strip) ── */
.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 5px;
  border-radius: 12px;
  background: var(--paper-shaded);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}

.tab.tab-desktop {
  padding: 9px 18px;
  cursor: pointer;
  font-size: 13.5px;
  font-variation-settings: 'wght' 500;
  color: var(--text-muted);
  border-radius: 8px;
  transition: all .18s ease;
  user-select: none;
  letter-spacing: -0.005em;
  white-space: nowrap;
}

.tab.tab-desktop:hover:not(.active) { color: var(--ink); }

.tab.tab-desktop.active {
  background: var(--card);
  color: var(--navy);
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(15, 26, 46, 0.06);
  font-variation-settings: 'wght' 600;
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fade-up .35s ease both; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ── Section eyebrows (small caps labels above section titles) ── */
.section-eyebrow {
  display: block;
  font-size: 10px;
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: 0.20em;
  font-variation-settings: 'wght' 600;
  margin-bottom: 4px;
}

/* ── KPI grid ── */
.kpi-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  grid-template-areas:
    "hero clicks"
    "hero conv"
    "hero rate";
  gap: 14px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 22px 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  animation: fade-up .42s ease both;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 92px;
}

.kpi-card.k-clicks { grid-area: clicks; animation-delay: .04s; }
.kpi-card.k-conv   { grid-area: conv;   animation-delay: .08s; }
.kpi-card.k-rate   { grid-area: rate;   animation-delay: .12s; }
.kpi-card.hero     { grid-area: hero; }

.kpi-card .label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-variation-settings: 'wght' 600;
}

.kpi-card .value {
  font-family: var(--font);
  font-size: 30px;
  font-variation-settings: 'opsz' 96, 'wght' 500;
  color: var(--ink);
  letter-spacing: -0.028em;
  line-height: 1;
  margin: 12px 0 6px;
}

.kpi-card .sub {
  font-size: 11.5px;
  color: var(--text-light);
  font-variation-settings: 'wght' 400;
  letter-spacing: 0.01em;
}

/* Hero KPI: the commission card */
.kpi-card.hero {
  background:
    radial-gradient(ellipse 80% 60% at 88% 18%, rgba(232, 108, 58, 0.30) 0%, transparent 55%),
    radial-gradient(ellipse 70% 60% at 12% 100%, rgba(244, 162, 97, 0.12) 0%, transparent 55%),
    linear-gradient(135deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: #fff;
  padding: 30px 30px 28px;
  min-height: 280px;
  border: 1px solid var(--navy-deep);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(15,26,46,0.04);
}

.kpi-card.hero::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 280px; height: 280px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 280 280'><g fill='none' stroke='%23E86C3A' stroke-width='1' opacity='0.30'><circle cx='200' cy='80' r='40'/><circle cx='200' cy='80' r='75'/><circle cx='200' cy='80' r='110'/><circle cx='200' cy='80' r='150'/><circle cx='200' cy='80' r='195'/></g></svg>");
  background-size: contain;
  background-repeat: no-repeat;
  pointer-events: none;
}

.kpi-card.hero .hero-inner { position: relative; z-index: 1; }

.kpi-card.hero .label {
  color: rgba(255,255,255,0.65);
  margin-bottom: 0;
}

.kpi-card.hero .value {
  font-size: 68px;
  color: #fff;
  font-variation-settings: 'opsz' 144, 'wght' 400;
  margin: 18px 0 6px;
  letter-spacing: -0.035em;
}

.kpi-card.hero .value::first-letter {
  font-size: 0.42em;
  vertical-align: 0.42em;
  color: var(--orange);
  margin-right: 4px;
  font-variation-settings: 'opsz' 36, 'wght' 500;
  letter-spacing: 0;
}

.kpi-card.hero .sub {
  color: rgba(255,255,255,0.55);
  font-size: 13px;
}

.kpi-card.hero .hero-foot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  padding: 6px 12px 6px 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  font-size: 11.5px;
  color: rgba(255,255,255,0.72);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-variation-settings: 'wght' 600;
  position: relative;
  z-index: 1;
  width: fit-content;
  border: 1px solid rgba(255,255,255,0.08);
}

.kpi-card.hero .hero-foot::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.30);
  animation: pulse 2.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.30); }
  50%      { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0.08); }
}

/* Payouts tab: 3-column grid with outstanding as hero */
.kpi-grid.kpi-grid-payouts {
  grid-template-columns: 1.4fr 1fr 1fr;
  grid-template-areas: none;
  grid-template-rows: auto;
}

.kpi-grid.kpi-grid-payouts .kpi-card { grid-area: auto; min-height: 140px; }

.kpi-grid.kpi-grid-payouts .payout-hero {
  background:
    radial-gradient(ellipse 80% 70% at 92% 8%, rgba(255, 255, 255, 0.22) 0%, transparent 55%),
    linear-gradient(135deg, var(--orange) 0%, var(--amber) 100%);
  color: #fff;
  border-color: transparent;
  overflow: hidden;
}

.kpi-grid.kpi-grid-payouts .payout-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'><g fill='none' stroke='white' stroke-width='1' opacity='0.18'><circle cx='160' cy='30' r='30'/><circle cx='160' cy='30' r='55'/><circle cx='160' cy='30' r='85'/></g></svg>");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: top right;
  pointer-events: none;
}

.kpi-grid.kpi-grid-payouts .payout-hero > * { position: relative; z-index: 1; }
.kpi-grid.kpi-grid-payouts .payout-hero .label { color: rgba(255,255,255,0.85); }
.kpi-grid.kpi-grid-payouts .payout-hero .value { color: #fff; font-size: 42px; }
.kpi-grid.kpi-grid-payouts .payout-hero .value::first-letter {
  font-size: 0.5em;
  vertical-align: 0.35em;
  color: rgba(255,255,255,0.85);
  margin-right: 3px;
}
.kpi-grid.kpi-grid-payouts .payout-hero .sub { color: rgba(255,255,255,0.78); font-size: 12px; }

/* ── Chart ── */
.chart-container {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px 26px 22px;
  margin-bottom: 26px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  animation: fade-up .42s .16s ease both;
}

.chart-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 12px;
}

.chart-heading h3,
.table-header h3,
.link-section h3 {
  font-family: var(--font);
  font-variation-settings: 'opsz' 60, 'wght' 500;
  font-size: 19px;
  color: var(--ink);
  letter-spacing: -0.015em;
  line-height: 1.1;
}

.chart-legend {
  display: flex;
  gap: 18px;
  font-size: 12px;
  color: var(--text-muted);
  font-variation-settings: 'wght' 500;
  letter-spacing: 0.02em;
}

.chart-legend > span { display: inline-flex; align-items: center; gap: 7px; }

.chart-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.chart-legend .dot-orange { background: linear-gradient(180deg, var(--orange), var(--amber)); }
.chart-legend .dot-green { background: var(--green); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18); }

.chart {
  display: flex;
  align-items: stretch;
  gap: 3px;
  height: 184px;
  border-bottom: 1px solid var(--border);
  padding: 16px 0 4px;
  position: relative;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' preserveAspectRatio='none'><line x1='0' y1='25' x2='100' y2='25' stroke='%23E5E0D6' stroke-width='1' stroke-dasharray='2,4'/><line x1='0' y1='50' x2='100' y2='50' stroke='%23E5E0D6' stroke-width='1' stroke-dasharray='2,4'/><line x1='0' y1='75' x2='100' y2='75' stroke='%23E5E0D6' stroke-width='1' stroke-dasharray='2,4'/></svg>");
  background-size: 100% 100%;
  background-repeat: no-repeat;
}

.chart-day {
  flex: 1;
  min-width: 6px;
  position: relative;
  display: flex;
  align-items: flex-end;
  cursor: default;
  border-radius: 4px 4px 0 0;
  transition: background .12s;
}

.chart-day:hover { background: rgba(232, 108, 58, 0.08); }

.chart-bar {
  width: 100%;
  background: linear-gradient(180deg, var(--orange) 0%, var(--amber) 100%);
  border-radius: 3px 3px 0 0;
  transition: filter .15s;
  height: 0;
  position: relative;
  box-shadow: inset 0 -2px 0 rgba(15, 26, 46, 0.08);
  animation: bar-rise .6s cubic-bezier(.2,.7,.2,1) both;
}

@keyframes bar-rise {
  from { transform: scaleY(0); transform-origin: bottom; }
  to   { transform: scaleY(1); }
}

.chart-bar.empty {
  height: 2px;
  background: var(--border-strong);
  border-radius: 0;
  align-self: flex-end;
  box-shadow: none;
  animation: none;
}

.chart-bar.converted {
  background: linear-gradient(180deg, var(--orange) 0%, var(--amber) 100%);
}

.chart-bar.converted::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 7px;
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  box-shadow:
    0 0 0 2.5px var(--card),
    0 0 0 4px var(--green),
    0 0 0 8px rgba(16, 185, 129, 0.25);
  animation: marker-in .5s .3s cubic-bezier(.2,.7,.2,1) both;
}

@keyframes marker-in {
  from { transform: translateX(-50%) scale(0); opacity: 0; }
  to   { transform: translateX(-50%) scale(1); opacity: 1; }
}

.chart-day:hover .chart-bar { filter: brightness(1.10); }
.chart-day:hover .chart-bar.empty { background: var(--text-muted); }

.chart-day .tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy-deep);
  color: #fff;
  padding: 11px 13px;
  border-radius: 10px;
  font-size: 11.5px;
  white-space: nowrap;
  min-width: 188px;
  z-index: 10;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  font-variation-settings: 'wght' 400;
}

.chart-day .tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--navy-deep);
}

.chart-day:nth-child(-n+4) .tooltip { left: 0; transform: none; }
.chart-day:nth-child(-n+4) .tooltip::after { left: 16px; transform: none; }
.chart-day:nth-last-child(-n+4) .tooltip { left: auto; right: 0; transform: none; }
.chart-day:nth-last-child(-n+4) .tooltip::after { left: auto; right: 16px; transform: none; }

.chart-day .tooltip .ttl-date {
  font-family: var(--font);
  font-variation-settings: 'opsz' 36, 'wght' 600;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  padding-bottom: 7px;
  margin-bottom: 6px;
  letter-spacing: -0.005em;
}

.chart-day .tooltip .ttl-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  line-height: 1.75;
}

.chart-day .tooltip .ttl-row span { color: rgba(255,255,255,0.5); font-variation-settings: 'wght' 400; }
.chart-day .tooltip .ttl-row strong { font-variation-settings: 'wght' 600; }

.chart-day:hover .tooltip { display: block; animation: tooltip-in .14s ease both; }
@keyframes tooltip-in { from { opacity: 0; } to { opacity: 1; } }

.chart-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--text-light);
  margin-top: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  font-variation-settings: 'wght' 600;
}

/* ── Tables ── */
.table-container {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 22px;
  overflow: hidden;
  animation: fade-up .42s .2s ease both;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 18px 24px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 14px;
}

.filters {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.filters input[type="date"] {
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  font-size: 13px;
  font-family: inherit;
  background: var(--paper);
  color: var(--text);
  outline: none;
  font-variation-settings: 'wght' 500;
  cursor: pointer;
}

.filters input[type="date"]:focus { border-color: var(--orange); background: var(--card); }

table { width: 100%; border-collapse: collapse; }

th, td {
  padding: 13px 24px;
  text-align: left;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
  font-variation-settings: 'tnum' 1, 'wght' 400;
}

th {
  background: var(--paper);
  font-variation-settings: 'wght' 600;
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding-top: 12px;
  padding-bottom: 12px;
}

td { color: var(--text); }
td:first-child { font-variation-settings: 'wght' 500, 'tnum' 1; }

tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--paper); }
tbody tr:last-child td { border-bottom: none; }

th.num, td.num { text-align: right; }

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  background: var(--paper);
}

.pagination > div { display: flex; gap: 8px; }

.pagination button {
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--card);
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  font-variation-settings: 'wght' 500;
  transition: all .12s;
}

.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination button:hover:not(:disabled) { border-color: var(--ink); }

/* ── Links Tab ── */
.link-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px 28px 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}

.link-section p {
  color: var(--text-muted);
  font-size: 14.5px;
  margin: 10px 0 22px;
  max-width: 60ch;
  line-height: 1.55;
}

.link-display {
  display: flex;
  gap: 8px;
  align-items: stretch;
  position: relative;
}

.link-display + .link-display { margin-top: 12px; }

.link-display input {
  flex: 1;
  padding: 13px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 13.5px;
  font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  background: var(--paper-shaded);
  color: var(--text);
  outline: none;
  letter-spacing: -0.01em;
  transition: border-color .15s, background .15s;
}

.link-display input:focus { border-color: var(--ink); background: var(--card); }

.link-display .btn { padding: 0 20px; min-width: 92px; font-size: 13.5px; }

.copy-feedback {
  position: absolute;
  right: 12px;
  bottom: calc(100% + 8px);
  background: var(--green);
  color: #fff;
  padding: 5px 11px 5px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-variation-settings: 'wght' 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity .2s ease, transform .2s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 4px 12px -2px rgba(16, 185, 129, 0.35);
}

.copy-feedback::before {
  content: '';
  width: 12px; height: 12px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>") center/contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>") center/contain no-repeat;
}

.copy-feedback::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 14px;
  border: 4px solid transparent;
  border-top-color: var(--green);
}

.copy-feedback.show { opacity: 1; transform: translateY(0); }

.link-builder-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.link-builder-row select {
  padding: 13px 38px 13px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 14px;
  flex: 1;
  min-width: 200px;
  background: var(--paper);
  color: var(--text);
  font-family: inherit;
  font-variation-settings: 'wght' 500;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231A2B4A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  cursor: pointer;
  outline: none;
  transition: border-color .15s, background-color .15s;
}

.link-builder-row select:focus { border-color: var(--orange); background-color: var(--card); }
.link-builder-row .btn { padding: 0 22px; }

.coming-soon {
  color: var(--text-light) !important;
  font-size: 13px !important;
  font-style: italic;
  margin: 22px 0 0 !important;
  padding-top: 18px;
  border-top: 1px dashed var(--border);
  font-variation-settings: 'opsz' 24, 'wght' 400 'ital' 1;
}

.coming-soon::before {
  content: '✦';
  margin-right: 6px;
  color: var(--orange);
  font-style: normal;
}

/* ── Loading / empty / shimmer ── */
.loading {
  text-align: center;
  padding: 36px;
  color: transparent;
  font-size: 0;
  position: relative;
}

.loading::after {
  content: '';
  position: absolute;
  inset: 16px 28px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--paper-shaded) 0%, var(--navy-100) 45%, var(--paper-shaded) 90%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Mobile bottom navigation ── */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  z-index: 50;
  box-shadow: 0 -10px 30px -10px rgba(15,26,46,0.10);
  backdrop-filter: saturate(140%) blur(6px);
  -webkit-backdrop-filter: saturate(140%) blur(6px);
}

.mobile-nav-inner {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  max-width: 540px;
  margin: 0 auto;
}

.tab.tab-mobile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px 6px;
  font-size: 10.5px;
  color: var(--text-light);
  cursor: pointer;
  border-radius: 10px;
  transition: color .15s, background .15s, transform .15s;
  font-variation-settings: 'wght' 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.tab.tab-mobile .nav-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
}

.tab.tab-mobile .nav-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  fill: none;
}

.tab.tab-mobile:active { background: var(--paper-shaded); transform: scale(0.97); }

.tab.tab-mobile.active { color: var(--orange); }
.tab.tab-mobile.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 30%;
  right: 30%;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--orange);
}

/* ──────────────────────────────────────────────
   RESPONSIVE
─────────────────────────────────────────────── */
@media (max-width: 920px) {
  .dashboard { padding: 18px 18px 64px; }
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "hero hero"
      "clicks conv"
      "rate rate";
  }
  .kpi-card.hero { min-height: 220px; padding: 26px; }
  .kpi-card.hero .value { font-size: 56px; }
  .header { padding: 14px 18px; }
  .kpi-grid.kpi-grid-payouts { grid-template-columns: 1fr 1fr; }
  .kpi-grid.kpi-grid-payouts .payout-hero { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .dashboard { padding: 14px 14px 112px; }
  .header { padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; }
  .header h1, .partner-name { font-size: 17px; }
  .header-mark { width: 36px; height: 36px; font-size: 17px; }
  .header-eyebrow { font-size: 9px; letter-spacing: 0.16em; }

  #logoutBtn { padding: 0; width: 38px; height: 38px; justify-content: center; gap: 0; }
  #logoutBtn span { display: none; }
  #logoutBtn::before { width: 16px; height: 16px; }

  .tabs.tab-strip-desktop { display: none; }
  .mobile-nav { display: block; }

  .kpi-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "hero"
      "clicks"
      "conv"
      "rate";
    gap: 10px;
    margin-bottom: 20px;
  }
  .kpi-card.hero { min-height: 192px; padding: 22px; }
  .kpi-card.hero .value { font-size: 52px; margin: 14px 0 4px; }
  .kpi-card.hero .hero-foot { margin-top: 16px; }
  .kpi-card { padding: 16px 18px; min-height: auto; }
  .kpi-card .value { font-size: 26px; margin: 10px 0 4px; }

  .kpi-grid.kpi-grid-payouts {
    grid-template-columns: 1fr;
  }
  .kpi-grid.kpi-grid-payouts .payout-hero { grid-column: auto; min-height: 160px; }
  .kpi-grid.kpi-grid-payouts .payout-hero .value { font-size: 40px; }

  /* Section heads */
  .chart-container { padding: 18px 16px; border-radius: 12px; }
  .chart-heading { margin-bottom: 16px; }
  .chart-heading h3, .table-header h3, .link-section h3 { font-size: 17px; }
  .chart { height: 140px; }
  .chart-legend { font-size: 11px; gap: 12px; }

  /* Tables → stacked cards */
  .table-container {
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
  }
  .table-header {
    background: var(--card);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 14px 16px;
    margin-bottom: 10px;
  }
  table { border-collapse: separate; border-spacing: 0; }
  table thead { position: absolute; left: -9999px; clip: rect(0 0 0 0); }
  table tbody { display: block; }
  table tr {
    display: block;
    padding: 14px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 8px;
    box-shadow: var(--shadow-sm);
  }
  table tr:hover { background: var(--card); }
  table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    border: none;
    font-size: 13.5px;
    text-align: right;
  }
  table td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-variation-settings: 'wght' 600;
    margin-right: 12px;
    text-align: left;
    flex-shrink: 0;
  }
  /* nth-child label injection (JS doesn't emit data-label) */
  .tbl-conversions td:nth-child(1)::before { content: 'Date'; }
  .tbl-conversions td:nth-child(2)::before { content: 'Order'; }
  .tbl-conversions td:nth-child(3)::before { content: 'Products'; }
  .tbl-conversions td:nth-child(4)::before { content: 'Revenue'; }
  .tbl-conversions td:nth-child(5)::before { content: 'Commission'; }
  .tbl-payouts td:nth-child(1)::before { content: 'Date'; }
  .tbl-payouts td:nth-child(2)::before { content: 'Amount'; }
  .tbl-payouts td:nth-child(3)::before { content: 'Method'; }
  .tbl-payouts td:nth-child(4)::before { content: 'Reference'; }
  .tbl-payouts td:nth-child(5)::before { content: 'Notes'; }

  /* Make the first row cell pop as the card's lead */
  table tbody tr td:first-child {
    margin-bottom: 4px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--border);
  }
  table tbody tr td:first-child::before {
    color: var(--orange);
  }

  /* Right-side value emphasis */
  table tbody tr td:nth-child(4),
  table tbody tr td:nth-child(5) {
    font-variation-settings: 'wght' 600, 'tnum' 1;
  }

  /* Loading / empty span the whole card */
  table td.loading, table td[colspan] {
    padding: 24px 12px;
    justify-content: center;
    text-align: center;
  }
  table td.loading::before, table td[colspan]::before { display: none; }

  .pagination {
    background: var(--card);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 12px 14px;
    margin-top: 8px;
  }

  .filters { width: 100%; }
  .filters input[type="date"] { flex: 1; min-width: 0; }
  .filters .btn { flex: 1 1 calc(50% - 4px); }

  .link-section { padding: 22px 20px 20px; border-radius: 12px; }
  .link-section p { margin: 8px 0 18px; font-size: 14px; }
  .link-display { flex-direction: column; align-items: stretch; }
  .link-display input { font-size: 13px; padding: 12px 14px; }
  .link-display .btn { width: 100%; padding: 12px; }
  .copy-feedback { bottom: auto; top: -34px; right: 0; }

  .link-builder-row { flex-direction: column; }
  .link-builder-row .btn { width: 100%; padding: 12px; }

  .login-card { padding: 40px 28px 28px; }
  .login-card h1 { font-size: 26px; }
  .login-card .brand-mark .glyph { width: 46px; height: 46px; font-size: 24px; }
}

/* ── Accessibility ── */
:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
  border-radius: 4px;
}

.btn:focus-visible,
input:focus-visible,
select:focus-visible,
button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(232, 108, 58, 0.32);
}

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