:root {
  --aircash-red: #e40000;
  --aircash-red-deep: #8f0000;
  --aircash-white: #ffffff;
  --aircash-black: #0f1115;
  --aircash-gray: #5a5a5a;
  --aircash-light: #f8f8f8;
  --amazon-orange: #ff9900;
  --amazon-ink: #131921;
  --amazon-steel: #232f3e;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: rgba(255, 255, 255, 0.98);
  --line: rgba(15, 17, 21, 0.08);
  --text: #12151b;
  --muted: #667085;
  --success: #0d8f67;
  --danger: #c81f32;
  --warning: #b46900;
  --shadow-xl: 0 30px 80px rgba(15, 17, 21, 0.18);
  --shadow-lg: 0 18px 40px rgba(15, 17, 21, 0.12);
  --shadow-md: 0 10px 24px rgba(15, 17, 21, 0.08);
  --radius-xl: 32px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Space Grotesk", "Segoe UI", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(228, 0, 0, 0.24), transparent 24%),
    radial-gradient(circle at top right, rgba(255, 153, 0, 0.24), transparent 28%),
    radial-gradient(circle at bottom left, rgba(35, 47, 62, 0.18), transparent 22%),
    linear-gradient(135deg, #fff6f4 0%, #fff8ef 32%, #f7f9fc 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 70%);
}

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

.shell {
  max-width: 1380px;
  margin: 0 auto;
  padding: 28px 22px 52px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-card,
.panel,
.hero {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
}

.login-card {
  width: min(620px, 100%);
  padding: 34px;
  border-radius: 28px;
  position: relative;
  overflow: hidden;
}

.login-card::before,
.panel::before,
.hero::before,
.brand-stage::before,
.topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,0.38), transparent 45%);
}

.brand-stage {
  position: relative;
  overflow: hidden;
  padding: 28px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 10% 10%, rgba(228, 0, 0, 0.24), transparent 26%),
    radial-gradient(circle at 88% 16%, rgba(255, 153, 0, 0.28), transparent 22%),
    linear-gradient(135deg, #180407 0%, #2b0f12 24%, #161b23 58%, #232f3e 100%);
  color: var(--aircash-white);
  box-shadow: var(--shadow-xl);
  margin-bottom: 18px;
}

.brand-stage__surface {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 24px;
}

.brand-stage__top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.brand-stage__meta {
  display: grid;
  gap: 10px;
  max-width: 720px;
}

.brand-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.08);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.84);
}

.brand-kicker::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--aircash-red), var(--amazon-orange));
  box-shadow: 0 0 14px rgba(255,153,0,0.55);
}

.brand-title {
  margin: 0;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.brand-subtitle {
  margin: 0;
  max-width: 720px;
  color: rgba(255,255,255,0.76);
  font-size: 15px;
  line-height: 1.7;
}

.brand-logos {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.logo-card {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.16);
}

.logo-card--aircash {
  background: linear-gradient(135deg, rgba(228,0,0,0.95), rgba(143,0,0,0.95));
}

.logo-card__orb {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: rgba(255,255,255,0.16);
  color: #fff;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.logo-card__aircash {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.logo-card__amazon {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  line-height: 1;
  padding-bottom: 8px;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.03em;
  color: #ffffff;
}

.logo-card__amazon::after {
  content: "";
  position: absolute;
  left: 7px;
  right: 3px;
  bottom: 0;
  height: 10px;
  border-bottom: 4px solid var(--amazon-orange);
  border-radius: 0 0 24px 24px;
  transform: skewX(-12deg);
}

.brand-divider {
  width: 42px;
  height: 1px;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.34), rgba(255,255,255,0));
}

.topbar {
  position: sticky;
  top: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  margin-bottom: 20px;
  border-radius: 24px;
  overflow: hidden;
  background: rgba(255,255,255,0.78);
  border: 1px solid rgba(255,255,255,0.82);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-md);
}

.brand {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand small {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.nav a,
.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  background: rgba(15, 17, 21, 0.04);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(15, 17, 21, 0.08);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.nav a:hover,
.button:hover,
button:hover {
  transform: translateY(-1px);
  background: rgba(15, 17, 21, 0.08);
}

.nav a.active,
.button.primary,
button.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--aircash-red) 0%, #ff3c00 36%, var(--amazon-orange) 100%);
  box-shadow: 0 14px 28px rgba(228, 0, 0, 0.24);
}

.button.danger,
button.danger {
  color: #fff;
  background: linear-gradient(135deg, #9b1224, #dc2626);
  box-shadow: 0 14px 28px rgba(200, 31, 50, 0.22);
}

.user-chip {
  margin: 0 0 18px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.7);
  box-shadow: var(--shadow-md);
  color: var(--muted);
}

.user-chip strong {
  color: var(--text);
}

.hero,
.panel {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
}

.hero {
  display: grid;
  grid-template-columns: 1.45fr 0.95fr;
  gap: 20px;
  padding: 28px;
  margin-bottom: 24px;
}

.hero h1,
.panel h2,
.login-card h1 {
  margin: 0 0 12px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.hero h1 {
  font-size: clamp(34px, 4vw, 56px);
}

.panel h2,
.login-card h1 {
  font-size: clamp(22px, 2vw, 30px);
}

.hero p,
.muted {
  color: var(--muted);
}

.hero code {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,153,0,0.12);
  color: #8f4700;
}

.stats,
.fields-2,
.fields-3,
.fields-5 {
  display: grid;
  gap: 14px;
}

.stats {
  grid-template-columns: repeat(3, 1fr);
}

.fields-2 {
  grid-template-columns: 1fr 1fr;
}

.fields-3 {
  grid-template-columns: repeat(3, 1fr);
}

.fields-5 {
  grid-template-columns: repeat(5, 1fr);
}

.stat {
  padding: 18px;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.94), rgba(255,255,255,0.78)),
    linear-gradient(135deg, rgba(228,0,0,0.06), rgba(255,153,0,0.06));
  border: 1px solid rgba(255,255,255,0.84);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.42);
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(26px, 3vw, 38px);
  letter-spacing: -0.05em;
}

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

.panel {
  padding: 24px;
}

.table-wrap,
.preview-wrap,
.analytics-table-wrap {
  overflow: auto;
  border-radius: 22px;
  border: 1px solid rgba(15,17,21,0.06);
  background: rgba(255,255,255,0.72);
}

.preview-wrap,
.analytics-table-wrap {
  max-height: 70vh;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid rgba(15,17,21,0.06);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

tbody tr:hover {
  background: rgba(255, 153, 0, 0.05);
}

.inline-form {
  margin: 0;
}

.export-cards {
  display: grid;
  gap: 16px;
}

.export-card {
  border: 1px solid rgba(15,17,21,0.06);
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(255,153,0,0.14), transparent 30%),
    linear-gradient(160deg, rgba(255,255,255,0.96), rgba(255,247,241,0.82));
  box-shadow: var(--shadow-md);
  padding: 20px;
}

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

.export-card__meta strong,
.export-card__meta span {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.export-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.mail-status {
  margin-top: 10px;
  line-height: 1.5;
}

.inline-edit {
  display: grid;
  grid-template-columns: 90px 1.3fr 1.3fr auto;
  gap: 10px;
  align-items: center;
}

.table-action {
  white-space: nowrap;
}

form.stack,
.stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(15,17,21,0.1);
  border-radius: 16px;
  padding: 14px 15px;
  background: rgba(255,255,255,0.96);
  color: var(--text);
  font: inherit;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(228, 0, 0, 0.34);
  box-shadow: 0 0 0 4px rgba(228, 0, 0, 0.1);
}

textarea {
  min-height: 210px;
  resize: vertical;
}

.flash {
  padding: 15px 18px;
  border-radius: 18px;
  margin-bottom: 16px;
  border: 1px solid rgba(255,255,255,0.6);
  box-shadow: var(--shadow-md);
}

.flash.success {
  background: rgba(13, 143, 103, 0.1);
  color: #0d6c54;
}

.flash.error {
  background: rgba(200, 31, 50, 0.09);
  color: var(--danger);
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(255, 153, 0, 0.14);
  color: #7b4a00;
  font-size: 12px;
  font-weight: 700;
}

.compact-top {
  margin-top: 18px;
}

.preview-table th,
.preview-table td,
.analytics-table th,
.analytics-table td {
  white-space: nowrap;
  font-size: 13px;
}

.analytics-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 16px;
}

.analytics-search {
  width: min(360px, 100%);
}

.analytics-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.analytics-table th.sortable::after {
  content: " <>";
  font-size: 11px;
  color: var(--muted);
}

.analytics-table th[data-order="asc"]::after {
  content: " ^";
}

.analytics-table th[data-order="desc"]::after {
  content: " v";
}

@media (max-width: 1100px) {
  .hero,
  .grid,
  .fields-2,
  .fields-3,
  .fields-5,
  .stats,
  .export-card__meta {
    grid-template-columns: 1fr;
  }

  .topbar,
  .brand-stage__top,
  .analytics-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .nav,
  .actions,
  .export-card__actions {
    width: 100%;
  }

  .export-card__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .analytics-search {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .shell {
    padding: 18px 14px 34px;
  }

  .brand-stage,
  .panel,
  .hero,
  .login-card {
    border-radius: 24px;
    padding: 18px;
  }

  .logo-card__amazon {
    font-size: 18px;
  }

  .inline-edit {
    grid-template-columns: 1fr;
  }
}
