:root {
  --tryton-red: #DC143C;
  --tryton-red-soft: rgba(220, 20, 60, 0.08);
  --tryton-black: #0B0C10;
  --tryton-grey: #6B7280;
  --tryton-bg: #FFFFFF;
  --tryton-card-bg: #FFFFFF;
  --tryton-border: #E5E7EB;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* === GLOBAL LAYOUT === */
#tryton-aff-dashboard {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--tryton-black);
  background-color: var(--tryton-bg);
  padding: 20px;
  line-height: 1.5;
  box-sizing: border-box;
}

#tryton-aff-dashboard *, #tryton-aff-dashboard *::before, #tryton-aff-dashboard *::after {
  box-sizing: inherit;
}

.tryton-card-wrap {
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

/* === TYPOGRAPHY === */
#tryton-aff-dashboard .tryton-title {
  font-size: 32px;
  font-weight: 800;
  color: var(--tryton-black);
  text-align: center;
  margin: 0 0 8px 0;
  letter-spacing: -0.025em;
}

#tryton-aff-dashboard .tryton-subtitle {
  text-align: center;
  color: var(--tryton-grey);
  font-size: 15px;
  margin-bottom: 32px;
}

/* === STATS GRID === */
.tryton-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.tryton-stats .stat {
  background: var(--tryton-card-bg);
  border: 1px solid var(--tryton-border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.tryton-stats .stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--tryton-red);
}

.tryton-stats .label {
  font-size: 13px;
  text-transform: uppercase;
  color: var(--tryton-grey);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.tryton-stats .val {
  font-size: 32px;
  font-weight: 800;
  color: var(--tryton-red);
  margin-top: 8px;
  line-height: 1;
}

/* === COUPON BOX === */
.tryton-coupon-box {
  background: var(--tryton-card-bg);
  border: 1px dashed var(--tryton-red);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  margin: 0 auto 30px;
  display: block;
  max-width: 400px;
  background-color: var(--tryton-red-soft);
}

.tryton-coupon-label {
  color: var(--tryton-red);
  font-size: 13px;
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}

.tryton-coupon-code {
  font-family: monospace;
  font-weight: 700;
  font-size: 20px;
  color: var(--tryton-black);
  letter-spacing: 1px;
}

/* === LINKS & NAV === */
.tryton-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 30px;
}

.tryton-link {
  color: var(--tryton-grey);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 20px;
  background: white;
  border: 1px solid var(--tryton-border);
  transition: all 0.2s;
}

.tryton-link:hover, .tryton-link.active {
  color: var(--tryton-red);
  border-color: var(--tryton-red);
  background: var(--tryton-red-soft);
  text-decoration: none;
}

/* === DATA TABLE === */
.tryton-table-wrapper {
  background: var(--tryton-card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--tryton-border);
  overflow: hidden;
  overflow-x: auto;
  width: 100%;
}

.tryton-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.tryton-table thead th {
  background: #f3f4f6;
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  color: var(--tryton-grey);
  font-weight: 700;
  padding: 16px 20px;
  letter-spacing: 0.5px;
}

.tryton-table tbody tr {
  background: #fff;
  border-bottom: 1px solid var(--tryton-border);
  transition: background 0.1s;
}

.tryton-table tbody tr:last-child {
  border-bottom: none;
}

.tryton-table tbody tr:hover {
  background-color: #fafafa;
}

.tryton-table td {
  padding: 16px 20px;
  font-size: 14px;
  color: #374151;
}

/* === MODERN POPUP / MODAL === */
.tryton-popup {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 20px;
}

.tryton-popup.show {
  display: flex;
  opacity: 1;
}

.tryton-popup .inner {
  background: #fff;
  width: 100%;
  max-width: 500px;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 85vh;
}

.tryton-popup.show .inner {
  transform: translateY(0);
}

.tryton-popup h3 {
  margin: 0;
  padding: 24px;
  background: #fff;
  color: var(--tryton-black);
  font-size: 18px;
  font-weight: 700;
  border-bottom: 1px solid var(--tryton-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tryton-popup .inner::before {
  content: '';
  display: block;
  height: 6px;
  background: var(--tryton-red);
  width: 100%;
}

.tryton-popup .content {
  padding: 0 24px 24px;
  overflow-y: auto;
}

.tryton-popup .content .row {
  padding: 14px 0;
  border-bottom: 1px dashed var(--tryton-border);
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}

.tryton-popup .content .row span:first-child {
  color: var(--tryton-grey);
}

.tryton-popup .content .row span:last-child {
  font-weight: 600;
  color: var(--tryton-black);
}

.tryton-popup button.close {
  width: 100%;
  padding: 16px;
  border: none;
  background: #f9fafb;
  color: var(--tryton-grey);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border-top: 1px solid var(--tryton-border);
  transition: all 0.2s;
}

.tryton-popup button.close:hover {
  background: var(--tryton-red);
  color: #fff;
}

@media (max-width: 768px) {
  #tryton-aff-dashboard { padding: 10px; }
  #tryton-aff-dashboard .tryton-title { font-size: 24px; }
  .tryton-stats { grid-template-columns: 1fr; gap: 16px; }
  .tryton-stats .stat { padding: 20px; display: flex; justify-content: space-between; align-items: center; text-align: left; }
  .tryton-stats .val { margin-top: 0; font-size: 24px; }
  .tryton-table-wrapper { border-radius: 12px; }
  .tryton-link { flex: 1; text-align: center; white-space: nowrap; }
}
