:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2f3d;
  --text: #e8eaef;
  --muted: #9aa3b2;
  --accent: #7c6cf0;
  --accent-dim: #5a4fd4;
  --danger: #e85d6a;
  --ok: #4ade80;
  --header-bg: rgba(15, 17, 23, 0.92);
  --input-bg: #12151c;
  --danger-text: #fecaca;
  --radius: 12px;
  --font: "Segoe UI", system-ui, sans-serif;
}

:root[data-theme="light"] {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --border: #d9dde5;
  --text: #1a1d27;
  --muted: #5a6473;
  --accent: #6a5af0;
  --accent-dim: #4f3fd1;
  --danger: #d23a4a;
  --ok: #15a657;
  --header-bg: rgba(255, 255, 255, 0.92);
  --input-bg: #ffffff;
  --danger-text: #1a1d27;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.theme-toggle:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.theme-toggle .theme-toggle-icon {
  font-size: 1rem;
  line-height: 1;
}
.theme-toggle .theme-toggle-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.admin-dashboard-hero {
  background: var(--surface);
  padding: 30px;
  border-radius: 12px;
  margin-bottom: 30px;
  border: 1px solid var(--border);
  text-align: center;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.admin-card-btn {
  display: block;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: bold;
  transition: all 0.2s;
}

.admin-card-btn:hover {
  background: #e9ecef;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.add-btn {
  background: #28a745;
  color: white;
  border-color: #28a745;
}

.add-btn:hover {
  background: #218838;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}
.admin-table th,
.admin-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.admin-table thead th {
  background: rgba(124, 108, 240, 0.08);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.admin-table tbody tr:hover {
  background: rgba(124, 108, 240, 0.05);
}
.admin-table tbody tr:last-child td {
  border-bottom: none;
}
.admin-table a {
  color: var(--accent);
}
.btn-danger {
  background: #ff4d4d;
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
}
.btn-danger:hover {
  background: #cc0000;
}
.brand {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}
.brand a {
  color: var(--text);
  text-decoration: none;
}
.brand a:hover {
  color: var(--accent);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  align-items: center;
}

.nav a {
  color: var(--muted);
  font-size: 0.95rem;
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
}
.nav a:hover,
.nav a.active {
  color: var(--text);
  text-decoration: none;
  border-bottom-color: var(--accent);
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

h1 {
  font-size: 1.75rem;
  font-weight: 650;
  margin: 0 0 1rem;
}

h2 {
  font-size: 1.25rem;
  margin: 1.5rem 0 0.75rem;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 560px) {
  .grid.cols-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover {
  border-color: #3d4455;
}
.card.clickable {
  cursor: pointer;
}
.card.clickable:hover {
  transform: translateY(-2px);
}

.card-title {
  font-weight: 600;
  font-size: 1.05rem;
  margin: 0 0 0.35rem;
}

.watchlist-tickets {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 0.4rem;
}

.watchlist-paused {
  color: #e57373;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--border);
  color: var(--muted);
}
.badge.warn {
  background: rgba(232, 93, 106, 0.2);
  color: #fca5a5;
}
.badge.ok {
  background: rgba(74, 222, 128, 0.15);
  color: var(--ok);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  font-size: 0.95rem;
  font-family: inherit;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-dim);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--muted);
}

.btn-danger {
  background: rgba(232, 93, 106, 0.15);
  border-color: var(--danger);
  color: var(--danger-text);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(232, 93, 106, 0.3);
}

.form-row {
  margin-bottom: 1rem;
}
.form-row label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.form-row-check {
  display: flex;
  align-items: center;
}
.form-row-check .check-label {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  font-size: 0.95rem;
  color: var(--text);
  cursor: pointer;
}

/* ── Панель фильтров для админских таблиц ───────────────────────── */
.admin-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin: 1rem 0 0.5rem;
  padding: 0.75rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.admin-filters input[type="search"] {
  flex: 1 1 260px;
  min-width: 200px;
  max-width: none;
  margin: 0;
}
.admin-filters select {
  flex: 0 0 auto;
  width: auto;
  min-width: 150px;
  max-width: none;
  margin: 0;
}
.admin-filters .btn {
  flex: 0 0 auto;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  width: 100%;
  max-width: 420px;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0;
}
textarea {
  min-height: 100px;
  max-width: 100%;
}

.error-box {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: rgba(232, 93, 106, 0.12);
  border: 1px solid rgba(232, 93, 106, 0.35);
  color: #fecaca;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.success-box {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.35);
  color: #bbf7d0;
  margin-bottom: 1rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th,
td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  background: #141821;
  color: var(--muted);
  font-weight: 500;
}
tr:last-child td {
  border-bottom: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.hero {
  margin-bottom: 1.5rem;
}

.empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
}

footer.app-footer {
  text-align: left;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

/* ----- Filter panel ----- */
.filter-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.filter-row + .filter-row {
  margin-top: 0.6rem;
}

.filter-input {
  max-width: 100% !important;
}

.filter-row > input[type="text"] {
  flex: 1 1 100%;
  max-width: 100% !important;
}

.filter-selects > select,
.filter-selects > input[type="date"] {
  flex: 1 1 140px;
  max-width: 100% !important;
  min-width: 0;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* ----- Concert groups ----- */
.concert-groups {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.concert-groups.detail {
  margin-bottom: 0.75rem;
}

.groups-label {
  font-size: 0.78rem;
  color: var(--muted);
  flex-shrink: 0;
}

.group-tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--accent);
  white-space: nowrap;
}

/* ----- Modal overlay ----- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 440px;
  width: 100%;
  text-align: center;
  animation: modal-in 0.18s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.94) translateY(8px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);   }
}

.modal-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.modal-title {
  font-size: 1.25rem;
  margin: 0 0 0.75rem;
}

.modal-text {
  color: var(--muted);
  margin: 0 0 1.5rem;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ----- Checkout page ----- */
.checkout-timer-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.checkout-timer-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.checkout-timer {
  font-size: 1.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ok);
  letter-spacing: 0.03em;
}

.checkout-timer.checkout-timer-urgent {
  color: var(--danger);
  animation: pulse-timer 0.8s ease infinite alternate;
}

@keyframes pulse-timer {
  from { opacity: 1; }
  to   { opacity: 0.5; }
}

.checkout-summary {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin-top: 0.5rem;
}

.checkout-summary td {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
}

.checkout-summary td:first-child {
  color: var(--muted);
  width: 40%;
}

.checkout-total td {
  padding-top: 0.75rem;
  border-bottom: none;
  font-size: 1.05rem;
}

.checkout-total td:last-child {
  color: var(--accent);
}

/* ── Карта зала (выбор мест) ─────────────────────────────────────────── */

.seatmap-info {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin: 1rem 0;
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
}

.seatmap-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.4rem;
  margin: 0.5rem 0 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
}

.seatmap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow-x: auto;
}

.seatmap-stage {
  text-align: center;
  letter-spacing: 0.3em;
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0.6rem 0;
  margin: 0 auto 1.25rem;
  max-width: 70%;
  border-radius: 40px 40px 4px 4px;
  background: linear-gradient(180deg, rgba(124, 108, 240, 0.18), transparent);
  border: 1px solid var(--border);
  border-bottom: 2px solid var(--accent);
}

.seatmap-zone {
  margin-bottom: 1.5rem;
}

.seatmap-zone-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  margin-bottom: 0.6rem;
  text-align: center;
}

.seatmap-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  justify-content: center;
  margin-bottom: 0.35rem;
}

.seatmap-row-label {
  min-width: 54px;
  font-size: 0.72rem;
  color: var(--muted);
  text-align: right;
  padding-right: 0.4rem;
}

.seat {
  width: 28px;
  height: 28px;
  border-radius: 6px 6px 3px 3px;
  border: 1px solid rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  transition: transform 0.08s ease, box-shadow 0.12s ease;
}

.seat:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.seat-occupied {
  background: #3b3f4d !important;
  color: #6b7280;
  cursor: not-allowed;
  opacity: 0.55;
}

.seat-selected {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(124, 108, 240, 0.25);
}

.seatmap-dance-holder {
  display: flex;
  justify-content: center;
  padding: 1rem 0;
}

.dance-circle {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.35);
  color: #fff;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: transform 0.12s ease, box-shadow 0.15s ease;
  box-shadow: 0 6px 24px rgba(124, 108, 240, 0.25) inset;
}

.dance-circle:hover:not(:disabled) {
  transform: scale(1.03);
  box-shadow: 0 8px 30px rgba(124, 108, 240, 0.45);
}

.dance-circle-label {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.dance-circle-sub {
  font-size: 0.8rem;
  opacity: 0.85;
}

.dance-circle-sold {
  opacity: 0.45;
  cursor: not-allowed;
}

.dance-counter {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  justify-content: center;
  margin: 0.5rem 0;
}

.dance-counter input {
  width: 80px;
  text-align: center;
  font-size: 1.1rem;
  padding: 0.5rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.dance-counter .btn {
  min-width: 44px;
  padding: 0.45rem 0.8rem;
  font-size: 1.2rem;
}
