@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 650;
  font-display: swap;
  src: url('assets/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('assets/fonts/inter-latin-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f7f9fc;
  --surface: #fbfcff;
  --line: #e7ecf3;
  --line-strong: #d8dee8;
  --text: #020407;
  --muted: #5a6472;
  --charcoal: #20242b;
  --blue: #2255c6;
  --blue-soft: #eef4ff;
  --focus: rgba(34, 85, 198, 0.12);
  --success: #067647;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

/* Login screen */

.login-shell {
  display: grid;
  min-height: 100vh;
  align-items: center;
  justify-items: center;
  padding: 24px;
}

.login-card {
  display: grid;
  gap: 16px;
  width: 100%;
  max-width: 380px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 32px;
  box-shadow: 0 12px 32px rgba(17, 24, 39, 0.06);
}

.login-card img {
  width: 132px;
  height: auto;
  margin-bottom: 4px;
}

.login-card h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.login-card p.login-hint {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.login-card label {
  display: grid;
  gap: 7px;
}

.login-card label span {
  color: #344054;
  font-size: 12px;
  font-weight: 650;
}

.login-card input {
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  padding: 0 12px;
  font: 14px Inter, Arial, sans-serif;
  color: var(--text);
}

.login-card input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--focus);
  outline: 0;
}

.login-card button {
  min-height: 46px;
  border: 1px solid var(--charcoal);
  border-radius: 6px;
  background: var(--charcoal);
  color: #f8fafc;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}

.login-card p.login-status {
  min-height: 18px;
  margin: 0;
  color: #b00000;
  font-size: 13px;
  font-weight: 650;
}

/* App shell (single dashboard page, no sidebar) */

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 252, 255, 0.96);
  backdrop-filter: blur(6px);
  padding: 16px 28px;
}

.app-brand {
  display: inline-flex;
  align-items: center;
}

.app-brand img {
  display: block;
  width: 124px;
  height: auto;
}

.app-user {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-user span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.app-logout {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--charcoal);
  border-radius: 6px;
  background: var(--charcoal);
  color: #f8fafc;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.app-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 28px 60px;
}

/* Stat tiles */

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.metric {
  display: grid;
  gap: 10px;
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.metric strong {
  color: var(--text);
  font-size: 25px;
  font-weight: 650;
}

.metric-promo-code {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.metric-copy-link {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  padding: 0;
}

.panel-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 20px;
  margin-bottom: 18px;
}

.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.panel-section h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.25;
}

/* Tabulator theme alignment */

.affiliate-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.tabulator {
  border: 0;
  background: #fff;
  font-family: Inter, Arial, Helvetica, sans-serif;
  font-size: 13px;
}

.tabulator .tabulator-header {
  background: #f3f6fb;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.tabulator .tabulator-header .tabulator-col {
  background: transparent;
  border-right: 0;
}

.tabulator-row {
  border-bottom: 1px solid var(--line);
}

.tabulator-row.tabulator-row-even {
  background: #fbfcff;
}

.tabulator-row:hover {
  background: var(--blue-soft);
}

.tabulator .tabulator-footer {
  background: #f3f6fb;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.tabulator-empty {
  padding: 24px 14px;
  color: var(--muted);
  font-size: 13px;
}

/* Buttons */

.section-action {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--charcoal);
  border-radius: 6px;
  background: var(--charcoal);
  color: #f8fafc;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.section-action.secondary-action {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--text);
}

.table-copy-link,
.table-deactivate,
.table-reactivate {
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-right: 6px;
}

.table-deactivate {
  border-color: #d94b4b;
  color: #a40000;
}

.table-reactivate {
  border-color: #1a9a4c;
  color: #0f7a3a;
}

/* Create-promo-code modal */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(15, 20, 30, 0.55);
  padding: 24px;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 24px;
  box-shadow: 0 24px 60px rgba(10, 14, 22, 0.28);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
}

.modal-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

.modal-field {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
}

.modal-field span {
  color: #344054;
  font-size: 12px;
  font-weight: 650;
}

.modal-field input {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  padding: 0 12px;
  font: 14px Inter, Arial, sans-serif;
  color: var(--text);
}

.modal-field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--focus);
  outline: 0;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.modal-grid .modal-field {
  margin-bottom: 0;
}

/* Discount / commission pool sliders */

.pool-row {
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.pool-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.pool-row-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.pool-numbers {
  display: flex;
  gap: 18px;
}

.pool-number {
  display: grid;
  justify-items: center;
  gap: 2px;
}

.pool-number strong {
  font-size: 22px;
  font-weight: 750;
  line-height: 1;
}

.pool-number small {
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.pool-discount strong {
  color: #c22626;
}

.pool-commission strong {
  color: #16833f;
}

.pool-row input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(to right, #c22626 var(--pool-fill, 0%), #16833f var(--pool-fill, 0%));
  appearance: none;
  cursor: pointer;
}

.pool-row input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--charcoal);
  cursor: pointer;
}

.pool-row input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--charcoal);
  cursor: pointer;
}


.modal-status {
  min-height: 18px;
  margin: 0 0 12px;
  color: #b00000;
  font-size: 13px;
  font-weight: 650;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 900px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-header,
  .app-main {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 560px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }
}
