
:root {
  font-family: Arial, Helvetica, sans-serif;
  color: #172033;
  background: #f6f7fb;
  --blue: #2445a8;
  --blue-2: #5069b4;
  --red: #b71932;
  --green: #58a374;
  --mint: #83b8ad;
  --orange: #ef6d2f;
  --lime: #afc95b;
  --burgundy: #7e0f24;
  --yellow: #f2d22e;
  --ink: #172033;
  --muted: #6b7280;
  --line: #dfe3ea;
  --soft: #f8fafc;
  --white: #fff;
  --danger: #dc2626;
  --success: #16a34a;
  --slate: #475569;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 20px;
  background:
    radial-gradient(circle at 8% 10%, rgba(80,105,180,.14), transparent 22%),
    radial-gradient(circle at 92% 14%, rgba(183,25,50,.10), transparent 20%),
    linear-gradient(180deg, #f8f9fc, #eef1f6);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.admin-shell {
  padding: 22px;
  border-radius: 18px;
  background: var(--white);
  box-shadow: 0 18px 50px rgba(29, 40, 70, .10);
}

h1 {
  margin: 0 0 18px;
  font-size: clamp(26px, 4vw, 38px);
  letter-spacing: -.04em;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 120px auto;
  gap: 10px;
  margin-bottom: 14px;
}

.form-grid.missing {
  grid-template-columns: 1fr auto;
}

input,
select,
button {
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  font-size: 16px;
}

input {
  min-width: 0;
  background: #fff;
}

button {
  border: 0;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
}

button.secondary { background: var(--slate); }
button.danger { background: var(--danger); }
button.success { background: var(--success); }
button:disabled { opacity: .55; cursor: not-allowed; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}

.search {
  width: 100%;
  margin: 8px 0 12px;
}

.count {
  margin: 8px 0;
  color: #475569;
}

.small {
  color: var(--muted);
  font-size: 13px;
}

.error {
  display: none;
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: 10px;
  color: #991b1b;
  background: #fee2e2;
}

/* Compact matrix navigation */
.group-navigation {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 22px;
  margin: 16px 0 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 10px 32px rgba(30, 41, 59, .07);
}

.nav-all-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-all {
  min-height: 30px;
  padding: 5px 11px;
  border-radius: 999px;
  color: var(--blue);
  background: #edf2ff;
  font-size: 13px;
}

.nav-group {
  min-width: 0;
}

.nav-group-title {
  margin-bottom: 7px;
  color: #1f2937;
  font-size: 13px;
  font-weight: 900;
}

.nav-group-countries {
  display: grid;
  gap: 4px;
}

.country-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
  padding: 2px 4px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
}

.country-chip:hover {
  color: var(--blue);
  background: #f3f6ff;
}

.country-chip.active {
  color: var(--blue);
  background: #eaf0ff;
  font-weight: 900;
}

.country-chip.active::after {
  content: "✓";
  margin-left: auto;
  color: var(--blue);
  font-weight: 900;
}

.country-icon,
.country-icon-placeholder {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  object-fit: contain;
}

.country-icon-placeholder {
  display: grid;
  place-items: center;
  border-radius: 3px;
  color: #fff;
  background: var(--blue);
  font-size: 7px;
  font-weight: 900;
}

.nav-special {
  grid-column: 1 / -1;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.nav-special .nav-group-countries {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
}

.content {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.group-section {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(30, 41, 59, .07);
}

.group-header {
  padding: 11px 16px;
  color: #fff;
  background: linear-gradient(90deg, var(--blue), var(--blue-2));
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.country-section + .country-section {
  border-top: 1px solid var(--line);
}

.country-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  background: #fbfcff;
  border-bottom: 1px solid var(--line);
}

.country-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.country-crest,
.country-placeholder {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.country-crest {
  object-fit: contain;
  padding: 3px;
  background: #fff;
  border: 1px solid var(--line);
}

.country-placeholder {
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.country-name {
  font-size: 17px;
  font-weight: 900;
}

.country-code {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.country-count {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--blue);
  background: #eaf0ff;
  font-size: 13px;
  font-weight: 900;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 11px;
  padding: 13px;
}

.card-item {
  display: grid;
  gap: 9px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background:
    linear-gradient(135deg, #fff, #f7f8fc);
}

.card-number {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue-2));
  font-weight: 900;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.qty {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  color: #7a4d00;
  background: #fff4cb;
  border: 1px solid #f8dda1;
  font-weight: 900;
}

.actions {
  display: grid;
  gap: 8px;
}

.actions button {
  width: 100%;
}

.empty {
  padding: 32px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--muted);
  background: #fff;
  text-align: center;
}

/* Public index page */
.album-hero {
  position: relative;
  overflow: hidden;
  min-height: 340px;
  padding: 34px;
  border-radius: 30px;
  color: #fff;
  box-shadow: 0 26px 70px rgba(30, 41, 59, .24);
  margin-bottom:40px;
  background:
    linear-gradient(90deg, rgba(24,38,95,.76), rgba(24,38,95,.32)),
    linear-gradient(135deg,
      var(--orange) 0 10%,
      var(--mint) 10% 21%,
      var(--blue-2) 21% 34%,
      var(--green) 34% 47%,
      var(--burgundy) 47% 58%,
      var(--lime) 58% 71%,
      var(--red) 71% 82%,
      var(--blue) 82% 100%);
}

.album-hero::before,
.album-hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: saturate(1.1);
}

.album-hero::before {
  width: 310px;
  height: 310px;
  right: 7%;
  top: 8%;
  background:
    radial-gradient(circle at center, rgba(255,255,255,.96) 0 38%, transparent 39%),
    conic-gradient(from 45deg,
      var(--orange),
      var(--green),
      var(--blue-2),
      var(--burgundy),
      var(--lime),
      var(--red),
      var(--orange));
  opacity: .86;
}

.album-hero::after {
  width: 420px;
  height: 420px;
  left: -180px;
  bottom: -230px;
  background: rgba(255,255,255,.10);
}

.hero-kicker {
  position: relative;
  z-index: 2;
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.34);
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.hero-title {
  position: relative;
  z-index: 2;
  max-width: 680px;
  margin: 22px 0 12px;
  font-size: clamp(48px, 8vw, 92px);
  line-height: .82;
  letter-spacing: -.07em;
  text-transform: uppercase;
}

.hero-title .year {
  display: block;
  font-size: 1.1em;
}

.hero-subtitle {
  position: relative;
  z-index: 2;
  max-width: 600px;
  margin: 0;
  color: rgba(255,255,255,.86);
  font-size: 18px;
  line-height: 1.5;
}

.album-cover {
  position: absolute;
  z-index: 2;
  right: 24px;
  bottom: -22px;
  width: min(260px, 30vw);
  max-height: 330px;
  object-fit: contain;
  filter: drop-shadow(0 20px 24px rgba(0,0,0,.25));
  transform: rotate(2deg);
}

.public-panel {
  position: relative;
  z-index: 4;
  margin-top: -24px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 18px 50px rgba(30, 41, 59, .16);
}

.public-search {
  width: 100%;
  min-height: 58px;
  padding: 14px 16px;
  border: 2px solid transparent;
  border-radius: 15px;
  background: #f8fafc;
  font-size: 18px;
  outline: none;
}

.public-search:focus {
  border-color: rgba(36,69,168,.48);
  box-shadow: 0 0 0 5px rgba(36,69,168,.10);
  background: #fff;
}

.public-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.public-stat {
  padding: 13px 14px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.public-stat-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.public-stat-value {
  margin-top: 4px;
  font-size: 24px;
  font-weight: 900;
}

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

  .album-cover {
    opacity: .35;
    right: 0;
  }
}

@media (max-width: 680px) {
  body { padding: 10px; }

  .admin-shell { padding: 16px; }

  .form-grid,
  .form-grid.missing {
    grid-template-columns: 1fr;
  }

  .form-grid button,
  .toolbar button {
    width: 100%;
  }

  .group-navigation {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 14px;
    padding: 12px;
  }

  .nav-special {
    grid-column: 1 / -1;
  }

  .country-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .country-count {
    width: 100%;
    text-align: center;
  }

  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px;
  }

  .album-hero {
    min-height: 320px;
    padding: 24px 20px 46px;
  }

  .album-cover {
    width: 190px;
    right: -22px;
    bottom: -8px;
  }

  .hero-title {
    font-size: clamp(44px, 16vw, 68px);
  }

  .hero-subtitle {
    max-width: 74%;
    font-size: 16px;
  }

  .public-panel {
    margin-top: -18px;
    padding: 14px;
  }

  .public-stats {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .group-navigation {
    grid-template-columns: 1fr;
  }

  .nav-special {
    grid-column: 1;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }
}
