:root {
  --blue-950: #06193d;
  --blue-900: #0a2b67;
  --blue-800: #0e3f8f;
  --red-600: #d91f35;
  --red-700: #b9162a;
  --ink: #111827;
  --muted: #5b6577;
  --line: #dbe2ec;
  --soft: #f5f8fc;
  --paper: #ffffff;
  --shadow: 0 18px 48px rgba(8, 27, 63, 0.12);
  --radius: 8px;
  --max: 1180px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(135deg, #f7fbff 0%, #edf3fb 58%, #fff 100%);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

body,
button,
input,
select {
  font: inherit;
}

button,
input,
select {
  border-radius: var(--radius);
}

button {
  cursor: pointer;
}

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

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

.admin-page {
  min-height: 100vh;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--blue-900);
  color: white;
  font-size: 24px;
  letter-spacing: 0;
}

.brand strong {
  display: block;
  color: var(--blue-900);
  font-family: Outfit, Inter, sans-serif;
  font-size: 20px;
  line-height: 1;
}

.brand b {
  color: var(--red-600);
}

.brand small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.brand.compact .brand-mark {
  width: 44px;
  height: 44px;
  font-size: 19px;
}

.login-view {
  min-height: 100vh;
  width: min(100% - 32px, 1050px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: 48px;
  padding: 56px 0;
}

.login-brand h1,
.panel-heading h1 {
  margin: 22px 0 12px;
  color: var(--blue-900);
  font-family: Outfit, Inter, sans-serif;
  font-size: clamp(38px, 6vw, 64px);
  line-height: 0.95;
}

.login-brand p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 19px;
}

.login-card,
.editor-panel,
.tier-block,
.user-card,
.data-tools,
.data-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.login-card {
  display: grid;
  gap: 18px;
  padding: 28px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.login-card h2,
.tier-block h2 {
  margin: 0;
  color: var(--blue-900);
  font-family: Outfit, Inter, sans-serif;
  font-size: 30px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--blue-900);
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid #cfd8e6;
  background: white;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--blue-800);
  box-shadow: 0 0 0 3px rgba(14, 63, 143, 0.14);
}

input[type="file"] {
  min-height: 46px;
  padding: 7px;
  color: var(--muted);
}

input[type="file"]::file-selector-button {
  min-height: 30px;
  margin-right: 12px;
  border: 0;
  border-radius: 6px;
  background: var(--blue-900);
  color: #fff;
  padding: 6px 12px;
  font-weight: 800;
}

.button,
.file-button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radius);
  padding: 11px 16px;
  font-weight: 800;
  white-space: nowrap;
}

.button.primary {
  background: var(--red-600);
  color: white;
  box-shadow: 0 12px 26px rgba(217, 31, 53, 0.22);
}

.button.primary:hover {
  background: var(--red-700);
}

.button.ghost,
.file-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--blue-900);
}

.button.danger {
  background: #ffe9ed;
  color: var(--red-700);
}

.file-button input {
  display: none;
}

.form-status {
  min-height: 22px;
  margin: 0;
  color: var(--red-700);
  font-size: 13px;
  font-weight: 800;
}

.dashboard {
  min-height: 100vh;
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px max(18px, calc((100% - var(--max)) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.dashboard-shell {
  width: min(100% - 32px, var(--max));
  margin: 28px auto 72px;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 22px;
}

.admin-sidebar {
  position: sticky;
  top: 92px;
  height: fit-content;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: 0 14px 28px rgba(8, 27, 63, 0.06);
}

.tab-button {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 12px;
  text-align: left;
  font-weight: 800;
}

.tab-button.active {
  background: var(--blue-900);
  color: white;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.panel-heading h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 48px);
}

.editor-panel {
  padding: 22px;
  margin-bottom: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.sponsor-preview {
  min-height: 118px;
  display: grid;
  place-items: center;
  margin: 16px 0;
  border: 1px dashed #b9c5d6;
  border-radius: var(--radius);
  background: #fbfdff;
  color: #8995a8;
  font-weight: 800;
}

.sponsor-preview img {
  max-width: 260px;
  max-height: 96px;
  object-fit: contain;
}

.form-row,
.button-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.check {
  display: flex;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 9px;
}

.check input {
  width: 18px;
  min-height: 18px;
}

.tier-list {
  display: grid;
  gap: 18px;
}

.tier-block {
  padding: 18px;
  box-shadow: 0 14px 28px rgba(8, 27, 63, 0.06);
}

.tier-block h2 {
  margin-bottom: 14px;
  font-size: 22px;
}

.sponsor-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.sponsor-admin-card {
  display: grid;
  gap: 10px;
  min-height: 220px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdff;
}

.sponsor-admin-logo {
  min-height: 96px;
  display: grid;
  place-items: center;
  border: 1px solid #dbe2ec;
  border-radius: var(--radius);
  background: white;
}

.sponsor-admin-logo img {
  max-width: 180px;
  max-height: 76px;
  object-fit: contain;
}

.sponsor-admin-card h3 {
  margin: 0;
  color: var(--blue-900);
  font-size: 16px;
  line-height: 1.2;
}

.sponsor-admin-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  word-break: break-word;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.card-actions .button {
  min-height: 38px;
  flex: 1;
  padding: 8px 10px;
  font-size: 12px;
}

.empty-state {
  min-height: 96px;
  display: grid;
  place-items: center;
  border: 1px dashed #b9c5d6;
  border-radius: var(--radius);
  color: #8995a8;
  font-weight: 800;
}

.user-list {
  display: grid;
  gap: 14px;
}

.user-card {
  display: grid;
  grid-template-columns: 1fr 1fr 160px 1fr auto;
  gap: 12px;
  align-items: end;
  padding: 18px;
  box-shadow: 0 14px 28px rgba(8, 27, 63, 0.06);
}

.user-card .button {
  min-height: 46px;
}

.data-tools {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 20px;
  box-shadow: 0 14px 28px rgba(8, 27, 63, 0.06);
}

.data-preview {
  min-height: 320px;
  margin: 18px 0 0;
  padding: 18px;
  overflow: auto;
  color: #22304a;
  font-size: 13px;
  white-space: pre-wrap;
}

.server-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--blue-900);
  color: white;
  font-weight: 800;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .login-view,
  .dashboard-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tab-button {
    text-align: center;
  }

  .user-card {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .login-view {
    width: min(100% - 24px, 1050px);
    gap: 28px;
  }

  .login-brand h1,
  .panel-heading h1 {
    font-size: 38px;
  }

  .admin-header,
  .admin-actions,
  .panel-heading,
  .form-row,
  .button-row {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-shell {
    width: min(100% - 24px, var(--max));
  }

  .admin-sidebar,
  .form-grid,
  .user-card {
    grid-template-columns: 1fr;
  }

  .button,
  .file-button {
    width: 100%;
  }
}
