:root {
  --bg: #0b0b0c;
  --panel: #141417;
  --panel2: #18181c;
  --muted: #a1a1aa;
  --gold: #f3c969;
  --gold-strong: #ffd76e;
  --border: #24242b;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: #fff;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial, Apple Color Emoji, Segoe UI Emoji;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: .3px;
}

.brand img {
  width: 36px;
  height: 36px;
}

.brand .title {
  font-size: 18px;
}

.btn {
  background: transparent;
  color: #fff;
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.btn-gold {
  background: var(--gold);
  color: #111;
  border: none;
}

.btn-gold:hover {
  background: var(--gold-strong);
}

.badge {
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
}

.badge.gold {
  color: #111;
  background: var(--gold);
  border-color: var(--gold);
}

.card {
  background: linear-gradient(180deg, var(--panel), var(--panel2));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.tab {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--muted);
}

.tab.active {
  border-color: var(--gold);
  color: var(--gold);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.table th {
  color: var(--muted);
  font-weight: 600;
}

.table .actions {
  display: flex;
  gap: 8px;
}

.row-muted {
  color: var(--muted);
}

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

.kv label {
  color: var(--muted);
}

.kv input {
  background: #0e0e10;
  color: #fff;
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 10px;
  outline: none;
  min-width: 280px;
}

.kv input:focus {
  border-color: var(--gold);
}

/* ===== Mobile (≤ 640px) ===== */
@media (max-width: 640px) {
  .container {
    padding: 16px;
  }

  .navbar {
    padding: 12px 0;
  }

  .brand .title {
    font-size: 16px;
  }

  .btn {
    padding: 12px 14px;
    font-weight: 700;
  }

  .btn-gold {
    border-radius: 10px;
  }

  /* Tabs: allow horizontal scroll */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
  }

  .tab {
    flex: 0 0 auto;
  }

  /* Convert table to stacked cards */
  .table {
    display: block;
    width: 100%;
    border-collapse: separate;
    /* avoid border glitches */
  }

  .table thead {
    display: none;
  }

  .table tbody {
    display: grid;
    gap: 12px;
  }

  .table tr {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px;
    background: linear-gradient(180deg, var(--panel), var(--panel2));
    border: 1px solid var(--border);
    border-radius: 14px;
  }

  .table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: none;
    padding: 6px 0;
  }

  /* Show the header label via data-label on each cell */
  .table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    margin-right: 16px;
    text-transform: none;
    letter-spacing: 0;
  }

  /* Actions span full width at bottom */
  .table .actions {
    margin-top: 4px;
    gap: 10px;
    justify-content: stretch;
  }

  .table .actions .btn,
  .table .actions .btn-gold {
    width: 100%;
  }

  /* Smaller thumbnails on mobile */
  .table img {
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
  }
}

@media (max-width: 640px) {
  .brand {
    gap: 8px;
  }

  .brand img {
    width: 28px;
    height: 28px;
  }

  .badge {
    display: none;
  }

  /* hide the "Live" badge to save space */
}

/* --- Mobile header/layout fixes --- */
@media (max-width: 640px) {
  .navbar {
    display: flex;
    flex-wrap: wrap;
    /* allow wrapping */
    gap: 8px;
    /* breathing room between rows */
    align-items: center;
  }

  .brand {
    flex: 1 1 100%;
    /* brand on its own row */
    min-width: 0;
  }

  #authArea {
    flex: 1 1 100%;
    /* auth area on its own row */
  }

  #authArea .btn {
    width: 100%;
    /* big, tappable button */
    display: block;
    text-align: center;
  }

  /* tighten typography a bit on phones */
  .brand .title {
    font-size: 16px;
  }

  .btn {
    padding: 12px 14px;
  }
}

.btn[disabled],
.btn.busy {
  opacity: .6;
  cursor: not-allowed;
  pointer-events: none;
}

/* Make link buttons on mobile full-width tappable areas */
@media (max-width: 640px) {

  a.btn,
  a.btn-gold {
    display: block;
    text-align: center;
  }
}

/* === Queue Pass input styling === */
.card input[type="text"],
.card input[type="url"],
#linkInput {
  background: #121215;
  /* darker than panel */
  border: 1px solid var(--border);
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  outline: none;
  flex: 1;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.card input[type="text"]::placeholder,
.card input[type="url"]::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

.card input[type="text"]:focus,
.card input[type="url"]:focus,
#linkInput:focus {
  border-color: var(--gold);
  background: #16161a;
  /* slightly lighter for contrast */
}

/* Make the Add Pass button align visually with input */
#addQueuePass.btn-gold {
  border-radius: 10px;
  font-weight: 600;
  padding: 10px 18px;
}

.card input[type="text"],
.card input[type="url"],
#linkInput {
  background: rgba(18, 18, 21, 0.8);
  backdrop-filter: blur(6px);
}

/* === License Dropdown Styling === */
.kv select {
  background: #0e0e10;
  border: 1px solid var(--border);
  color: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  outline: none;
  min-width: 280px;
  font-size: 14px;
  appearance: none;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease;
}

/* Add dropdown arrow */
.kv select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23a1a1aa' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 10px;
}

/* hover */
.kv select:hover {
  border-color: var(--gold);
}

/* focus */
.kv select:focus {
  border-color: var(--gold);
  background: #16161a;
}

/* option styling */
.kv select option {
  background: #0e0e10;
  color: #fff;
}

.table td .truncate {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}

td[data-label="Event ID"] {
  max-width: 220px;
  word-break: break-all;
  white-space: normal;
}