:root {
  --navy: #113f64;
  --blue: #0f5a92;
  --stan-blue: #154b73;
  --stan-blue-soft: #6f9ab8;
  --sky: #eaf5ff;
  --ink: #1d2033;
  --muted: #65758b;
  --line: #dfeaf4;
  --soft: #f6f9fc;
  --gold: #f2bd74;
  --ok: #1b9364;
  --danger: #c93d3d;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; color: var(--ink); background: #f4f8fc; }
a { color: var(--blue); text-decoration: none; }
button, input, textarea, select { font: inherit; }

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(circle at 12% 28%, rgba(242, 189, 116, .45), transparent 30%),
    radial-gradient(circle at 88% 72%, rgba(108, 185, 232, .38), transparent 34%),
    #f6fbff;
}

.login-shell {
  width: min(980px, 100%);
  min-height: 520px;
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  border-radius: 30px;
  overflow: hidden;
  background: rgba(255,255,255,.9);
  box-shadow: 0 28px 80px rgba(21, 61, 96, .18);
}

.login-brand {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 26px;
  padding: 42px;
  background:
    linear-gradient(180deg, #103b60 0%, #1f5f8d 52%, #7aa6c2 100%);
  color: #d7e8f8;
  text-align: center;
}

.login-brand img { width: min(300px, 74%); }
.login-brand p { max-width: 350px; margin: 0; font-size: 15px; line-height: 1.45; letter-spacing: 3px; text-transform: uppercase; }
.login-panel { padding: 58px 62px; display: flex; flex-direction: column; justify-content: center; }
.kicker { color: #3e75a7; font-weight: 800; text-transform: uppercase; letter-spacing: 4px; font-size: 14px; margin-bottom: 18px; }
.login-panel h1 { margin: 0; color: #211d35; font-size: clamp(46px, 5vw, 64px); line-height: .98; letter-spacing: 0; }
.page-head h1 { margin: 0; color: #211d35; font-size: clamp(44px, 6vw, 86px); line-height: .98; letter-spacing: 0; }
.login-panel p { max-width: 460px; color: #416f9e; font-size: 18px; line-height: 1.45; margin: 18px 0 24px; }
.pin-form { display: grid; gap: 18px; max-width: 500px; }
.admin-pin-form[hidden] { display: none; }
.dealer-login-block[hidden] { display: none; }
.dealer-login-form { display: grid; gap: 14px; max-width: 430px; }
.dealer-login-form label { display: grid; gap: 8px; color: #164b82; font-weight: 800; }
.dealer-login-form input:disabled { color: #5f7892; background: #f4f8fc; }
.pin-entry { display: grid; gap: 8px; }
.pin-entry > label { color: #164b82; font-weight: 800; }
.dealer-reset-form { margin: 0; }
.admin-toggle {
  width: fit-content;
  margin: 18px 0 14px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #6f8196;
  cursor: pointer;
  font-weight: 800;
}
.admin-toggle:hover,
.admin-toggle.is-open {
  color: var(--blue);
}
.dealer-toggle {
  margin-top: 0;
}
.pin-hidden { display: none; }
.pin-cells {
  display: grid;
  grid-template-columns: repeat(4, 62px);
  gap: 12px;
}
.pin-cell {
  width: 62px;
  height: 62px;
  border: 1px solid #dce7f1;
  border-radius: 16px;
  padding: 0;
  text-align: center;
  font-size: 24px;
  background: #fffaf3;
  outline: none;
  box-shadow: 0 10px 28px rgba(31, 66, 105, .08);
}
.pin-cell:focus { border-color: var(--gold); box-shadow: 0 0 0 5px rgba(242,189,116,.28); }
.pin-help { color: #8b8ba0; font-size: 15px; }
.login-submit { color: #1f2230; }

.app-body { display: grid; grid-template-columns: 284px 1fr; min-height: 100vh; }
.sidebar {
  min-height: 100vh;
  position: sticky;
  top: 0;
  padding: 24px 20px;
  background: linear-gradient(180deg, #0b3154 0%, #0f4f79 54%, #16486b 100%);
  color: #d6e7f8;
  overflow: hidden;
}
.brand {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  padding: 0 12px 18px;
  width: 100%;
}
.brand img { width: 100%; max-width: 230px; }
.brand p { font-size: 14px; line-height: 1.45; margin: 12px 0 0; text-align: center; color: #cfe7fa; }
.nav { position: relative; z-index: 1; display: grid; gap: 9px; margin-top: 18px; }
.nav a {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  min-height: 58px;
  padding: 8px 10px;
  border-radius: 16px;
  color: #dcecff;
  background: rgba(255,255,255,.075);
  border: 1px solid rgba(255,255,255,.07);
  font-size: 15px;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
  transition: transform .18s ease, background .18s ease, color .18s ease;
}
.nav a:hover { transform: translateX(3px); background: rgba(255,255,255,.13); }
.dealer-body .nav a {
  grid-template-areas:
    "icon title"
    "icon note";
  align-content: center;
  gap: 2px 10px;
}
.nav a span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255,255,255,.16);
  color: #fff;
  font-size: 16px;
}
.dealer-body .nav a span {
  grid-area: icon;
}
.dealer-body .nav a b {
  grid-area: title;
  align-self: end;
}
.dealer-body .nav a small {
  grid-area: note;
  align-self: start;
  color: currentColor;
  font-size: 12px;
  line-height: 1.25;
}
.nav a.active {
  background: linear-gradient(135deg, #f7ca80, #fff0ce);
  color: #064f9a;
  border-color: rgba(255,255,255,.28);
  box-shadow: 0 14px 30px rgba(4, 48, 82, .18);
}
.nav a.active span { background: rgba(255,255,255,.32); color: #064f9a; }
.dealer-push-toggle {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 78px;
  display: grid;
  grid-template-columns: 42px 1fr;
  grid-template-areas:
    "icon title"
    "icon note";
  align-content: center;
  gap: 2px 10px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 18px;
  color: #fff;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 16px 30px rgba(0,0,0,.16), inset 0 1px 0 rgba(255,255,255,.12);
  transition: transform .18s ease, filter .18s ease, box-shadow .18s ease;
}
.dealer-push-toggle:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}
.dealer-push-toggle span {
  grid-area: icon;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: rgba(255,255,255,.2);
}
.dealer-push-toggle b {
  grid-area: title;
  align-self: end;
  font-size: 15px;
}
.dealer-push-toggle small {
  grid-area: note;
  align-self: start;
  color: rgba(255,255,255,.82);
  font-size: 12px;
  line-height: 1.25;
}
.dealer-push-toggle.is-off {
  background: linear-gradient(135deg, #c93d3d, #ef705e);
}
.dealer-push-toggle.is-on {
  background: linear-gradient(135deg, #158457, #27b77b);
}
.dealer-push-toggle.is-pending {
  background: linear-gradient(135deg, #0f5a92, #2f8ac1);
}
.logout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  min-height: 58px;
  padding: 8px 10px;
  border-radius: 16px;
  margin-top: 10px;
  color: #fff4f1;
  background: linear-gradient(135deg, rgba(218, 91, 78, .34), rgba(255, 255, 255, .08));
  border: 1px solid rgba(255, 214, 205, .22);
  font-size: 15px;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.dealer-logout {
  grid-template-areas:
    "icon title"
    "icon note";
  align-content: center;
  gap: 2px 10px;
}
.logout:hover {
  background: linear-gradient(135deg, rgba(226, 98, 84, .48), rgba(255, 255, 255, .12));
  border-color: rgba(255, 214, 205, .36);
  transform: translateX(3px);
}
.logout i {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: rgba(255, 228, 222, .18);
  font-size: 16px;
}
.dealer-logout i {
  grid-area: icon;
}
.dealer-logout b {
  grid-area: title;
  align-self: end;
}
.dealer-logout small {
  grid-area: note;
  align-self: start;
  color: currentColor;
  font-size: 12px;
  line-height: 1.25;
  min-width: 0;
  overflow-wrap: anywhere;
}

.workspace {
  padding: 42px 42px 60px;
  overflow: hidden;
  background:
    radial-gradient(circle at 78% 7%, rgba(111,154,184,.16), transparent 26%),
    linear-gradient(180deg, #f7fbff 0%, #eef6fc 100%);
}
.page-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 30px; }
.page-head h1 { color: var(--blue); font-size: clamp(42px, 5vw, 72px); }
.btn {
  border: 0;
  border-radius: 999px;
  min-height: 54px;
  padding: 0 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 800;
}
.btn.primary { background: var(--blue); color: #fff; box-shadow: 0 14px 28px rgba(11,92,168,.2); }
.btn.muted-btn { background: #e8edf3; color: #143c64; }
.btn.danger-btn { background: #fff0f0; color: var(--danger); }
.btn.wide { width: 100%; }
.btn i { font-size: 16px; }
.link-btn { border: 0; background: transparent; color: var(--blue); cursor: pointer; font-weight: 700; }
.file-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--blue);
  font-weight: 800;
  white-space: nowrap;
}
.file-link i { color: #6d879d; }

.alert { padding: 14px 18px; border-radius: 14px; margin: 0 0 18px; background: #eaf7ef; color: #11633e; }
.alert.danger { background: #fff0f0; color: var(--danger); }
.alert.success { background: #eaf7ef; color: #11633e; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(160px, 1fr)); gap: 18px; margin-bottom: 24px; }
.metric-grid.compact { grid-template-columns: repeat(4, minmax(120px, 220px)); }
.metric {
  min-height: 116px;
  padding: 24px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid rgba(223,234,244,.72);
  box-shadow: 0 18px 42px rgba(22, 78, 124, .07);
}
.metric b { display: block; color: var(--blue); font-size: 34px; margin-bottom: 8px; }
.metric span { color: var(--muted); }

.grid-two { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); gap: 24px; margin-bottom: 24px; }
.panel {
  background: #fff;
  border-radius: 22px;
  padding: 28px;
  border: 1px solid rgba(223,234,244,.72);
  box-shadow: 0 20px 48px rgba(22, 78, 124, .08);
  margin-bottom: 24px;
}
.panel-title { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; margin-bottom: 22px; }
.panel-title.inner-title { margin-top: 34px; padding-top: 26px; border-top: 1px solid var(--line); }
.panel-title h2 { margin: 0; color: var(--blue); font-size: 28px; }
.panel-title span, .muted { color: var(--muted); }

.timeline { display: grid; gap: 18px; }
.timeline-item { display: grid; grid-template-columns: 18px 1fr; gap: 14px; align-items: start; }
.timeline-item strong { font-size: 19px; color: #19375b; }
.timeline-item p { margin: 6px 0 0; color: var(--muted); }
.dot { width: 12px; height: 12px; margin-top: 5px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 6px rgba(242,189,116,.2); }
.line-chart {
  min-height: 264px;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--line);
}
.line-chart svg { display: block; width: 100%; height: 230px; overflow: visible; }
.chart-grid line { stroke: #e6f0f8; stroke-width: 1; }
.chart-area { fill: url(#chartArea); }
.campaign-chart-area { fill: url(#campaignChartArea); }
.chart-line {
  fill: none;
  stroke: var(--blue);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 8px 12px rgba(15,90,146,.16));
}
.campaign-chart-line {
  stroke: #d28a24;
  filter: drop-shadow(0 8px 12px rgba(210,138,36,.16));
}
.chart-point circle {
  fill: #fff;
  stroke: var(--gold);
  stroke-width: 5;
}
.chart-point text {
  fill: var(--blue);
  font-size: 18px;
  font-weight: 800;
  text-anchor: middle;
}
.campaign-chart-point text { fill: #a36308; }
.chart-days {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #6a7d91;
  font-size: 12px;
}
.soft-note { padding: 16px 18px; border-radius: 16px; background: var(--sky); color: #315f89; line-height: 1.55; }

.queue-run-panel {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  border: 1px solid #dcebf7;
}
.queue-run-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(15, 90, 146, .08), transparent);
  transform: translateX(-100%);
}
.queue-run-panel.is-active::before { animation: queueSweep 3.2s ease-in-out infinite; }
.queue-run-copy { position: relative; z-index: 1; }
.queue-run-note { margin: -8px 0 0; color: #315f89; line-height: 1.5; }
.queue-flow {
  position: relative;
  width: min(560px, 100%);
  height: 54px;
  margin: 0 0 14px;
}
.queue-flow-line,
.queue-flow-fill {
  position: absolute;
  left: 24px;
  right: 24px;
  top: 25px;
  height: 8px;
  border-radius: 999px;
}
.queue-flow-line { background: #e5f0f8; }
.queue-flow-fill {
  width: calc(66% - 24px);
  right: auto;
  background:
    linear-gradient(90deg, rgba(15,90,146,.95), rgba(242,189,116,.95), rgba(15,90,146,.95));
  background-size: 200% 100%;
  box-shadow: 0 8px 18px rgba(15,90,146,.16);
  opacity: .45;
}
.queue-run-panel.is-active .queue-flow-fill {
  opacity: 1;
  animation: queueFlow 2.2s linear infinite;
}
.queue-flow-step {
  position: absolute;
  top: 5px;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: #6b8195;
  border: 1px solid #dceaf4;
  box-shadow: 0 12px 26px rgba(22, 78, 124, .12);
  z-index: 1;
}
.queue-flow-step.is-waiting { left: 0; color: #a36308; }
.queue-flow-step.is-active { left: calc(50% - 23px); color: var(--blue); }
.queue-flow-step.is-done { right: 0; color: var(--ok); }
.queue-run-panel.is-active .queue-flow-step.is-active {
  animation: queuePlanePulse 1.6s ease-in-out infinite;
}
.queue-run-panel.is-active .queue-flow-step.is-done {
  animation: queueDonePulse 2.4s ease-in-out infinite;
}
.queue-now-form {
  position: relative;
  z-index: 1;
  justify-content: end;
}
.queue-now-btn {
  min-width: 240px;
  min-height: 64px;
  box-shadow: 0 18px 34px rgba(11,92,168,.28), 0 0 0 0 rgba(15,90,146,.35);
  animation: queuePulse 1.8s ease-in-out infinite;
}
.queue-now-btn:disabled {
  cursor: not-allowed;
  opacity: .55;
  animation: none;
  box-shadow: none;
}
.queue-now-btn.is-loading {
  pointer-events: none;
  filter: saturate(.9);
}
.queue-row-pending { background: linear-gradient(90deg, rgba(242,189,116,.13), transparent 42%); }
.queue-row-sending { animation: queueRowGlow 1.4s ease-in-out infinite; }
.queue-pill-pending { background: #fff4df; color: #8a5c13; }
.queue-pill-sending { background: #e5f4ff; color: var(--blue); }
.queue-pill-sent { background: #e8f7ef; color: var(--ok); }
.queue-pill-failed { background: #fff0f0; color: var(--danger); }

.form-panel label { display: grid; gap: 8px; color: #164b82; font-weight: 800; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.wide-field { grid-column: 1 / -1; }
.form-submit-btn { margin-top: 24px; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 15px 18px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: #8bbce8; box-shadow: 0 0 0 4px rgba(139,188,232,.25); }
.recipient-actions-panel {
  position: relative;
  overflow: hidden;
  padding: 24px;
  background:
    radial-gradient(circle at 10% 12%, rgba(242,189,116,.2), transparent 30%),
    radial-gradient(circle at 96% 92%, rgba(15,90,146,.16), transparent 32%),
    #fff;
}
.recipient-actions-panel .panel-title {
  margin-bottom: 16px;
}
.recipient-action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.recipient-action-card {
  position: relative;
  min-height: 116px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  grid-template-areas:
    "icon title"
    "icon desc";
  align-content: center;
  gap: 5px 14px;
  padding: 18px;
  border: 1px solid #dceaf4;
  border-radius: 20px;
  background:
    radial-gradient(circle at 100% 0%, rgba(15,90,146,.11), transparent 34%),
    linear-gradient(135deg, #fff 0%, #f7fbff 100%);
  color: #113f64;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 14px 30px rgba(22,78,124,.06);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.recipient-action-card:hover {
  transform: translateY(-2px);
  border-color: #a8cdea;
  box-shadow: 0 20px 38px rgba(22,78,124,.11);
}
.recipient-action-card span {
  grid-area: icon;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--blue), #2f8ac1);
  color: #fff;
  box-shadow: 0 12px 24px rgba(15,90,146,.18);
}
.recipient-action-card strong {
  grid-area: title;
  align-self: end;
  min-width: 0;
  font-size: 19px;
  line-height: 1.15;
}
.recipient-action-card small {
  grid-area: desc;
  min-width: 0;
  color: #6e8195;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}
.modal {
  width: min(780px, calc(100% - 36px));
  max-height: calc(100vh - 40px);
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: transparent;
  box-shadow: 0 36px 110px rgba(6, 31, 54, .34);
}
.modal::backdrop {
  background:
    radial-gradient(circle at 22% 18%, rgba(242,189,116,.16), transparent 28%),
    rgba(5, 24, 43, .62);
  backdrop-filter: blur(8px);
}
.modal-panel {
  margin: 0;
  border-radius: 28px;
  background:
    radial-gradient(circle at 100% 0%, rgba(15,90,146,.1), transparent 32%),
    #fff;
}
.modal-panel .panel-title {
  align-items: center;
}
.modal-close {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: #edf3f8;
  color: #164b82;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}
.modal-close:hover {
  background: #dfeaf4;
  transform: rotate(6deg);
}
.upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.file-control {
  position: relative;
  display: inline-flex;
  max-width: 100%;
  cursor: pointer;
}
.file-control input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.upload-card {
  isolation: isolate;
  min-height: 132px;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 20px;
  border: 1px solid #dbe9f5;
  border-radius: 22px;
  background:
    radial-gradient(circle at 7% 0%, rgba(242, 189, 116, .18), transparent 34%),
    radial-gradient(circle at 100% 100%, rgba(15, 90, 146, .12), transparent 34%),
    linear-gradient(135deg, #ffffff 0%, #f6fbff 100%);
  box-shadow: 0 16px 34px rgba(17, 63, 100, .08);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.upload-card::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 21px;
  background: linear-gradient(135deg, rgba(255,255,255,.86), rgba(255,255,255,0));
  opacity: .7;
  pointer-events: none;
  z-index: -1;
}
.upload-card:hover {
  transform: translateY(-2px);
  border-color: #a8cdea;
  box-shadow: 0 22px 42px rgba(17, 63, 100, .13);
}
.upload-card:focus-within {
  border-color: #8bbce8;
  box-shadow: 0 0 0 4px rgba(139,188,232,.25), 0 20px 38px rgba(17, 63, 100, .12);
}
.upload-icon,
.upload-action {
  display: grid;
  place-items: center;
  border-radius: 18px;
}
.upload-icon {
  width: 58px;
  height: 58px;
  background: linear-gradient(135deg, var(--blue), #2f8ac1);
  color: #fff;
  box-shadow: 0 14px 28px rgba(15, 90, 146, .22);
}
.upload-icon i { font-size: 22px; }
.upload-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}
.upload-copy strong {
  color: #113f64;
  font-size: 20px;
  line-height: 1.1;
}
.upload-hint {
  color: #7890a6;
  font-size: 13px;
  font-weight: 700;
}
.upload-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #426b91;
  font-size: 14px;
  font-weight: 800;
}
.upload-action {
  width: 38px;
  height: 38px;
  background: #eaf4fd;
  color: var(--blue);
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.upload-card:hover .upload-action { transform: scale(1.05); }
.upload-card.has-file {
  border-color: rgba(27,147,100,.32);
  background:
    radial-gradient(circle at 8% 0%, rgba(27, 147, 100, .12), transparent 36%),
    linear-gradient(135deg, #ffffff 0%, #f4fff9 100%);
}
.upload-card.has-file .upload-icon,
.upload-card.has-file .upload-action {
  background: linear-gradient(135deg, var(--ok), #32b57f);
  color: #fff;
}
.file-button {
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 0 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--blue), #2f8ac1);
  color: #fff;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 12px 24px rgba(15, 90, 146, .18);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.file-control:hover .file-button { transform: translateY(-1px); box-shadow: 0 16px 30px rgba(15, 90, 146, .24); }
.file-control:focus-within .file-button { box-shadow: 0 0 0 4px rgba(139,188,232,.25), 0 12px 24px rgba(15, 90, 146, .18); }
.file-button i { font-size: 16px; }
.file-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.actions { display: flex; gap: 14px; margin-top: 22px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 16px; align-items: end; flex-wrap: wrap; }
.inline-form label { width: 220px; display: grid; gap: 8px; color: #164b82; font-weight: 800; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th, td { padding: 15px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: #164b82; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; }
td { color: #263c56; }
.pill { display: inline-flex; align-items: center; min-height: 30px; padding: 0 11px; border-radius: 999px; background: #e8f0f8; color: #164b82; font-weight: 800; font-size: 13px; }
.pill.ok { background: #e8f7ef; color: var(--ok); }
.pill.off { background: #edf0f4; color: #65758b; }
.pill.event-subscribed { background: #e8f7ef; color: var(--ok); }
.pill.event-unsubscribed { background: #fff0f0; color: var(--danger); }
.dealer-view-pill.is-new { background: #fff0f0; color: var(--danger); }
.dealer-view-pill.is-viewed { background: #e8f7ef; color: var(--ok); }
.dealer-view-status {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.dealer-view-source {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #eef5fb;
  color: #496983;
  font-size: 13px;
  font-weight: 800;
}
.dealer-view-source[hidden] {
  display: none;
}
.status-pill.status-sent,
.status-text.status-text-sent {
  background: #e8f7ef;
  color: var(--ok);
}
.status-pill.status-queued,
.status-pill.status-sending,
.status-text.status-text-queued,
.status-text.status-text-sending {
  background: #fff2dc;
  color: #a36308;
}
.status-pill.status-failed,
.status-text.status-text-failed {
  background: #fff0f0;
  color: var(--danger);
}
.status-pill.status-draft,
.status-pill.status-paused,
.status-text.status-text-draft,
.status-text.status-text-paused {
  background: #edf3f8;
  color: #496983;
}
.status-text {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
}

.campaign-list { display: grid; gap: 18px; }
.campaign-card {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  gap: 22px;
  align-items: center;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fbfdff;
}
.campaign-card > img { width: 180px; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 16px; }
.campaign-main h2 { margin: 10px 0 8px; color: var(--blue); }
.campaign-main p { color: var(--muted); line-height: 1.5; margin: 0 0 14px; }
.mini-stats { display: flex; flex-wrap: wrap; gap: 9px; color: #496983; font-size: 14px; }
.mini-stats span { padding: 7px 10px; border-radius: 10px; background: #edf5fc; }
.campaign-actions { display: grid; gap: 10px; }
.dealer-campaign-card {
  grid-template-columns: 180px 1fr auto;
}
.dealer-campaign-card:not(:has(> img)) {
  grid-template-columns: 1fr auto;
}
.dealer-filter-panel {
  padding: 20px;
}
.dealer-filter-form {
  display: flex;
  align-items: end;
  gap: 16px;
  flex-wrap: wrap;
}
.dealer-filter-form label {
  display: grid;
  gap: 8px;
  color: #164b82;
  font-weight: 800;
}
.dealer-filter-form select {
  min-width: 190px;
}
.dealer-notify-btn {
  gap: 8px;
}
.dealer-status-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: #eaf3fb;
}
.dealer-status-tabs label {
  display: inline-flex;
  cursor: pointer;
}
.dealer-status-tabs input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}
.dealer-status-tabs span {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border-radius: 999px;
  color: #496983;
  font-weight: 800;
}
.dealer-status-tabs input:checked + span {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 10px 22px rgba(22,78,124,.11);
}
.dealer-post {
  max-width: 820px;
  margin-inline: auto;
  padding: 0;
  overflow: hidden;
}
.dealer-post-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 26px 32px 0;
}
.dealer-post h2 {
  margin: 18px 32px 24px;
  color: var(--blue);
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.08;
}
.dealer-post-image {
  display: block;
  width: calc(100% - 64px);
  max-height: 520px;
  object-fit: contain;
  margin: 0 auto 28px;
  border-radius: 18px;
  background: #f4f8fc;
}
.dealer-post-text {
  padding: 0 32px 8px;
  color: #26324a;
  font-size: 18px;
  line-height: 1.7;
}
.dealer-post-file {
  margin: 26px 32px 34px;
}
.dealer-campaign-modal {
  width: min(780px, calc(100% - 48px));
  max-height: min(860px, calc(100vh - 48px));
  overflow: auto;
  border-radius: 22px;
}
.dealer-campaign-modal .dealer-modal-post {
  max-width: none;
  margin: 0;
  border-radius: 22px;
  box-shadow: none;
}
.dealer-campaign-modal .dealer-post-head {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 18px 22px 10px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.98) 0%, rgba(255,255,255,.92) 72%, rgba(255,255,255,0) 100%);
}
.dealer-modal-status {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.dealer-modal-close {
  flex: 0 0 auto;
  background: #eef5fb;
  color: var(--blue);
}
.dealer-campaign-modal .dealer-post h2,
.dealer-campaign-modal .dealer-modal-post h2 {
  margin: 8px 32px 22px;
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.14;
}
.dealer-campaign-modal .dealer-post-image {
  width: calc(100% - 64px);
  max-height: min(520px, 56vh);
  object-fit: contain;
  margin-bottom: 24px;
}
.dealer-campaign-modal .dealer-post-text {
  padding: 0 32px 6px;
  font-size: 17px;
  line-height: 1.65;
}
.dealer-campaign-modal .dealer-post-file {
  margin: 22px 32px 30px;
}
.dealer-profile-form {
  max-width: 900px;
}
.dealer-contract-note {
  margin-top: 20px;
}
.limit-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.limit-list div { padding: 18px; border-radius: 16px; background: #f4f8fc; border: 1px solid var(--line); }
.limit-list b { display: block; color: var(--blue); font-size: 20px; margin-bottom: 8px; }
.limit-list span { color: var(--muted); line-height: 1.5; }
.dns-check-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.dns-card {
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: 250px;
  padding: 18px;
  border-radius: 16px;
  background: #f8fbfe;
  border: 1px solid var(--line);
}
.dns-card.ok { border-color: rgba(27,147,100,.28); background: #f7fffb; }
.dns-card.warn { border-color: rgba(242,189,116,.65); background: #fffaf2; }
.dns-card h3 { margin: 0; color: var(--blue); font-size: 24px; }
.dns-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.dns-card code {
  display: block;
  margin-top: auto;
  padding: 12px;
  border-radius: 12px;
  background: #fff;
  color: #1f3857;
  white-space: normal;
  word-break: break-word;
  line-height: 1.45;
}
.dns-note { margin-top: 16px; }

.install-card {
  width: min(560px, 100%);
  padding: 42px;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(21, 61, 96, .18);
}
.install-card h1 { color: var(--blue); margin: 18px 0 10px; }
.install-card p { color: var(--muted); line-height: 1.55; }
.install-logo { width: 210px; }
.unsubscribe-body {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 17%, rgba(242, 189, 116, .26), transparent 24%),
    radial-gradient(circle at 72% 78%, rgba(62, 142, 200, .34), transparent 32%),
    radial-gradient(circle at 46% 45%, rgba(255, 255, 255, .1), transparent 22%),
    linear-gradient(135deg, #061b31 0%, #082b4b 46%, #124a72 100%);
}
.unsubscribe-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(300px, .86fr) minmax(420px, 1.14fr);
  width: min(960px, 100%);
  min-height: 360px;
  padding: 0;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 34px;
  box-shadow: 0 34px 110px rgba(0, 0, 0, .32);
}
.unsubscribe-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 255, 255, .5), transparent 24%),
    radial-gradient(circle at 100% 100%, rgba(242, 189, 116, .34), transparent 26%);
  pointer-events: none;
  z-index: 2;
}
.unsubscribe-logo-panel {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100%;
  padding: 48px;
  background:
    radial-gradient(circle at 22% 18%, rgba(242, 189, 116, .3), transparent 27%),
    radial-gradient(circle at 88% 82%, rgba(60, 139, 195, .28), transparent 32%),
    linear-gradient(160deg, #051a30 0%, #082844 56%, #0e3d61 100%);
}
.unsubscribe-logo-panel::after {
  content: "";
  position: absolute;
  inset: 26px;
  border-radius: 26px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .035);
}
.unsubscribe-logo-panel .install-logo {
  position: relative;
  z-index: 1;
  width: 310px;
  max-width: 92%;
  filter: drop-shadow(0 18px 32px rgba(0, 0, 0, .45));
}
.unsubscribe-content {
  position: relative;
  z-index: 3;
  display: grid;
  align-content: center;
  padding: 58px 64px;
  background:
    radial-gradient(circle at 100% 0%, rgba(15, 90, 146, .08), transparent 34%),
    radial-gradient(circle at 3% 100%, rgba(242, 189, 116, .16), transparent 30%),
    #fff;
}
.unsubscribe-content h1 {
  margin: 0 0 14px;
  color: var(--blue);
  font-size: 44px;
  line-height: 1.04;
  letter-spacing: 0;
}
.unsubscribe-content p {
  max-width: 470px;
  margin: 0;
  font-size: 19px;
}
.unsubscribe-actions {
  margin-top: 30px;
}
.unsubscribe-actions .btn {
  min-width: 246px;
  min-height: 58px;
  border-radius: 999px;
  box-shadow: 0 18px 40px rgba(15, 90, 146, .24);
}
.history-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 1100px) {
  .app-body { grid-template-columns: 1fr; }
  .sidebar { position: relative; min-height: auto; }
  .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-two, .login-shell { grid-template-columns: 1fr; }
  .recipient-action-grid { grid-template-columns: 1fr; }
  .unsubscribe-card { grid-template-columns: 1fr; max-width: 620px; }
  .unsubscribe-logo-panel { min-height: 250px; }
  .login-brand { min-height: 320px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .campaign-card { grid-template-columns: 1fr; }
  .campaign-card > img { width: 100%; }
  .queue-run-panel { grid-template-columns: 1fr; }
  .queue-now-form { justify-content: start; }
  .dns-check-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .auth-body, .workspace { padding: 18px; }
  .login-panel, .login-brand, .sidebar, .panel { padding: 24px; }
  .unsubscribe-card { border-radius: 26px; }
  .unsubscribe-logo-panel { min-height: 210px; padding: 34px; }
  .unsubscribe-content { padding: 34px 28px 38px; }
  .unsubscribe-content h1 { font-size: 34px; }
  .unsubscribe-content p { font-size: 17px; }
  .unsubscribe-actions .btn { width: 100%; min-width: 0; }
  .login-shell { border-radius: 24px; }
  .page-head { display: grid; }
  .form-grid, .metric-grid, .nav { grid-template-columns: 1fr; }
  .recipient-action-card { min-height: 98px; }
  .dealer-filter-form { display: grid; align-items: stretch; }
  .dealer-filter-form .btn { width: 100%; }
  .dealer-status-tabs { width: 100%; justify-content: space-between; }
  .dealer-status-tabs span { padding: 0 12px; }
  .upload-grid { grid-template-columns: 1fr; }
  .upload-card { min-height: 118px; grid-template-columns: 52px minmax(0, 1fr) 34px; padding: 18px; }
  .upload-icon { width: 52px; height: 52px; }
  .upload-action { width: 34px; height: 34px; }
  .limit-list { grid-template-columns: 1fr; }
  .queue-now-btn { width: 100%; min-width: 0; }
  .dealer-campaign-modal {
    width: 100%;
    max-width: none;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
  }
  .dealer-campaign-modal .dealer-modal-post {
    min-height: 100dvh;
    border-radius: 0;
  }
  .dealer-campaign-modal .dealer-post-head {
    padding: 14px 16px 10px;
  }
  .dealer-modal-status {
    gap: 8px;
    flex-wrap: wrap;
  }
  .dealer-modal-close {
    width: 42px;
    height: 42px;
  }
  .dealer-campaign-modal .dealer-modal-post h2 {
    margin: 10px 18px 18px;
    font-size: 26px;
  }
  .dealer-campaign-modal .dealer-post-image {
    width: calc(100% - 36px);
    max-height: none;
    margin-bottom: 20px;
  }
  .dealer-campaign-modal .dealer-post-text {
    padding: 0 18px 4px;
    font-size: 16px;
    line-height: 1.6;
  }
  .dealer-campaign-modal .dealer-post-file {
    width: calc(100% - 36px);
    margin: 20px 18px 28px;
  }
}

@keyframes queueSweep {
  0% { transform: translateX(-100%); }
  45%, 100% { transform: translateX(100%); }
}

@keyframes queueFlow {
  from { background-position: 200% 0; }
  to { background-position: 0 0; }
}

@keyframes queuePulse {
  0%, 100% { transform: translateY(0); box-shadow: 0 18px 34px rgba(11,92,168,.28), 0 0 0 0 rgba(15,90,146,.34); }
  50% { transform: translateY(-2px); box-shadow: 0 22px 40px rgba(11,92,168,.34), 0 0 0 9px rgba(15,90,146,0); }
}

@keyframes queueRowGlow {
  0%, 100% { background: rgba(15,90,146,.04); }
  50% { background: rgba(15,90,146,.13); }
}

@keyframes queuePlanePulse {
  0%, 100% { transform: scale(1); box-shadow: 0 12px 26px rgba(22, 78, 124, .12); }
  50% { transform: scale(1.08); box-shadow: 0 16px 34px rgba(15, 90, 146, .24); }
}

@keyframes queueDonePulse {
  0%, 70%, 100% { transform: scale(1); }
  85% { transform: scale(1.06); }
}
