:root {
  --header-h: 64px;
  --left-w: 248px;
  --right-w: 328px;
  --surface: #ffffff;
  --bg: #eef1f5;
  --text: #1d2431;
  --muted: #687183;
  --line: #e4e8ef;
  --accent: #c8243b;
  --accent-deep: #8e1424;
  --accent-soft: #ffe6ea;
  --ok: #0a8f58;
  --error: #c42637;
  --shadow-sm: 0 8px 18px rgba(24, 31, 42, 0.08);
  --shadow-md: 0 18px 38px rgba(24, 31, 42, 0.14);
  --radius: 14px;
  --radius-sm: 10px;
  --trans: 200ms ease;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Barlow", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 0 0, rgba(200, 36, 59, 0.08), transparent 30%),
    radial-gradient(circle at 100% 16%, rgba(200, 36, 59, 0.06), transparent 24%),
    var(--bg);
}

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

button,
input,
select {
  font: inherit;
}

.primary-btn,
.ghost-btn,
.mini-btn {
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--trans), background var(--trans), border-color var(--trans), color var(--trans);
}

.primary-btn {
  background: linear-gradient(120deg, #e24459, #c4233a);
  color: #fff;
  border-color: #b31f34;
  padding: 11px 16px;
  font-weight: 700;
}

.ghost-btn {
  background: #f7f8fb;
  color: #2a3140;
  border-color: #d9dee8;
  padding: 11px 16px;
  font-weight: 600;
}

.ghost-btn.ghost-light {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
}

.mini-btn {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.42);
  font-weight: 700;
  padding: 8px 12px;
  font-size: 0.9rem;
}

.primary-btn:hover,
.ghost-btn:hover,
.mini-btn:hover {
  transform: translateY(-1px);
}

.primary-btn:disabled,
.ghost-btn:disabled,
.mini-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.auth-locked {
  overflow: hidden;
}

.app-shell[hidden] {
  display: none !important;
}

.login-gate[hidden] {
  display: none !important;
}

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 14px;
  background:
    radial-gradient(circle at 14% 8%, rgba(255, 130, 145, 0.24), transparent 30%),
    radial-gradient(circle at 90% 16%, rgba(255, 106, 125, 0.2), transparent 24%),
    linear-gradient(145deg, #2f0b11, #68131f 58%, #87172a);
}

.login-card {
  width: min(100%, 620px);
  max-height: calc(100dvh - 28px);
  overflow: auto;
  background: rgba(17, 7, 9, 0.85);
  border: 1px solid rgba(255, 174, 184, 0.45);
  border-radius: 18px;
  box-shadow: 0 24px 48px rgba(8, 2, 3, 0.45);
  padding: 16px;
  color: #fef6f7;
}

.login-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #ffb8c0;
  font-size: 0.78rem;
  font-weight: 700;
}

.login-card h1 {
  margin: 6px 0 0;
  font-family: "Lexend", sans-serif;
  line-height: 1.08;
  font-size: clamp(1.4rem, 4.5vw, 2rem);
}

.login-copy {
  margin: 10px 0 0;
  color: #ffd4d9;
  line-height: 1.35;
}

.password-input {
  margin-top: 16px;
  display: grid;
  gap: 8px;
}

.password-input label {
  color: #ffd9dd;
  font-size: 0.95rem;
  font-weight: 600;
}

.password-input input[type="password"] {
  border: 1px solid rgba(255, 176, 186, 0.5);
  border-radius: 10px;
  background: rgba(14, 5, 7, 0.7);
  color: #fff;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: 'Barlow', sans-serif;
}

.password-input input[type="password"]:focus {
  outline: none;
  border-color: rgba(255, 176, 186, 0.8);
  background: rgba(14, 5, 7, 0.9);
}

.password-input input[type="password"]::placeholder {
  color: rgba(255, 217, 221, 0.4);
}

.login-status {
  margin: 12px 0 0;
  border: 1px solid rgba(255, 182, 192, 0.35);
  border-radius: 11px;
  padding: 9px 11px;
  background: rgba(255, 255, 255, 0.05);
  color: #ffdce1;
}

.login-status.is-success {
  border-color: rgba(62, 203, 143, 0.52);
  color: #b2ffd8;
}

.login-status.is-error {
  border-color: rgba(255, 121, 141, 0.56);
  color: #ffd0d8;
}

.qr-codes-panel {
  margin-top: 12px;
  border-radius: 11px;
  border: 1px solid rgba(255, 174, 184, 0.36);
  background: rgba(255, 255, 255, 0.05);
  padding: 10px;
}

.qr-codes-panel summary {
  cursor: pointer;
  font-weight: 700;
  color: #ffe6e9;
}

.qr-codes-panel p {
  margin: 10px 0;
  color: #ffd4d8;
  font-size: 0.9rem;
}

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

.qr-item {
  border: 1px solid rgba(255, 176, 186, 0.35);
  border-radius: 10px;
  background: rgba(16, 6, 8, 0.8);
  padding: 7px;
  display: grid;
  gap: 6px;
}

.qr-item img {
  width: 100%;
  max-width: 120px;
  aspect-ratio: 1;
  background: #fff;
  border-radius: 8px;
  justify-self: center;
}

.qr-item strong {
  font-size: 0.86rem;
}

.qr-item small {
  color: #ffcad0;
}

.mobile-backdrop {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  z-index: 65;
  opacity: 0;
  pointer-events: none;
  background: rgba(4, 8, 14, 0.46);
  transition: opacity var(--trans);
}

body.show-left .mobile-backdrop,
body.show-right .mobile-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  z-index: 120;
  background: linear-gradient(110deg, #8f1223, #d43047 52%, #be1f34);
  box-shadow: 0 11px 22px rgba(77, 8, 19, 0.35);
}

.topbar-inner {
  height: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: #fff;
  color: #8d1625;
  font-family: "Lexend", sans-serif;
  font-weight: 700;
}

.brand-text {
  font-family: "Lexend", sans-serif;
  font-size: 1.08rem;
  font-weight: 600;
}

.top-nav {
  display: flex;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.top-nav::-webkit-scrollbar {
  display: none;
}

.top-nav-link {
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 0.88rem;
}

.top-nav-link.active,
.top-nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
}

.top-actions {
  display: none;
  align-items: center;
  gap: 8px;
}

.user-pill {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 8px 12px;
  font-size: 0.9rem;
  font-weight: 700;
}

.mobile-controls {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.mobile-controls .mini-btn {
  min-width: 38px;
  padding: 8px 10px;
}

.icon-menu,
.icon-ticket {
  font-size: 1.1rem;
  line-height: 1;
}

.user-pill-mobile {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 6px 10px;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-left,
.sidebar-right {
  position: fixed;
  top: var(--header-h);
  bottom: 0;
  width: min(88vw, 340px);
  padding: 12px 10px 20px;
  overflow-y: auto;
  z-index: 80;
  background: #f9fbfd;
  transition: transform var(--trans);
}

.sidebar-left {
  left: 0;
  border-right: 1px solid var(--line);
  box-shadow: 8px 0 22px rgba(16, 23, 34, 0.14);
  transform: translateX(-104%);
}

.sidebar-right {
  right: 0;
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 22px rgba(16, 23, 34, 0.14);
  transform: translateX(104%);
}

body.show-left .sidebar-left {
  transform: translateX(0);
}

body.show-right .sidebar-right {
  transform: translateX(0);
}

.content-area {
  margin-top: calc(var(--header-h) + 10px);
  padding: 0 10px 24px;
}

.hero-head,
.group-section,
.panel-card,
.sidebar-block,
.filter-bar,
.top-card,
.board-empty {
  background: var(--surface);
  border: 1px solid #e8edf4;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.hero-head {
  display: grid;
  gap: 8px;
  padding: 14px;
  margin-bottom: 12px;
}

.hero-kicker {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
  font-weight: 700;
}

.hero-head h1 {
  margin: 3px 0 0;
  font-family: "Lexend", sans-serif;
  line-height: 1.1;
  font-size: clamp(1.26rem, 5vw, 1.9rem);
}

.hero-subline {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.cards-section {
  margin-bottom: 12px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 0 2px;
}

.section-head h2 {
  margin: 0;
  font-size: 1.02rem;
}

.section-link {
  color: var(--accent);
  font-weight: 700;
}

.cards-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(230px, 84vw);
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  padding: 2px 2px 8px;
}

.top-card {
  min-height: 160px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 12px;
  scroll-snap-align: start;
  transition: transform var(--trans), box-shadow var(--trans);
}

.top-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.top-card-badge {
  justify-self: start;
  background: var(--accent-soft);
  color: var(--accent-deep);
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.top-card h3 {
  margin: 0;
  font-family: "Lexend", sans-serif;
  font-size: 0.98rem;
  line-height: 1.22;
}

.top-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.33;
}

.top-card a {
  margin-top: auto;
  color: var(--accent);
  font-weight: 700;
}

.filter-bar {
  position: sticky;
  top: calc(var(--header-h) + 8px);
  z-index: 55;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(6px);
}

.filter-item {
  display: grid;
  gap: 5px;
}

.filter-item span {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #657084;
  font-weight: 700;
}

.filter-item select {
  border: 1px solid #d7dde6;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  min-height: 40px;
  padding: 9px 10px;
}

.data-board {
  display: grid;
  gap: 10px;
}

.group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fcfdff;
}

.group-head h3 {
  margin: 0;
  font-size: 0.97rem;
}

.group-count {
  color: var(--muted);
  font-size: 0.84rem;
}

.data-row {
  padding: 10px 11px;
  border-bottom: 1px solid #edf1f6;
  display: grid;
  gap: 9px;
}

.row-values {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.data-row:last-child {
  border-bottom: 0;
}

.meta-time {
  color: #6d7688;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  margin-bottom: 2px;
}

.meta-title {
  font-size: 0.99rem;
  font-weight: 700;
  line-height: 1.2;
}

.meta-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.28;
}

.odd-btn {
  border: 1px solid #d6dce6;
  background: #f5f7fa;
  border-radius: 11px;
  min-height: 56px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  padding: 7px 8px;
  cursor: pointer;
}

.odd-btn:hover {
  border-color: #c2c9d6;
  background: #edf1f6;
}

.odd-btn.is-selected {
  border-color: var(--accent);
  background: #ffe8eb;
  color: var(--accent-deep);
}

.odd-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.76rem;
  color: #656e80;
}

.odd-value {
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.row-values .odd-btn {
  width: 100%;
}

.board-empty {
  min-height: 144px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  padding: 16px;
}

.sidebar-block,
.panel-card {
  padding: 10px;
  margin-bottom: 10px;
}

.sidebar-block h3,
.panel-card h3 {
  margin: 0 0 9px;
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #5c667b;
}

.nav-search {
  width: 100%;
  border: 1px solid #d7dde8;
  border-radius: 10px;
  min-height: 40px;
  padding: 9px 10px;
  margin-bottom: 9px;
}

.nav-list,
.quick-list,
.rank-list,
.ticket-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list,
.quick-list {
  display: grid;
  gap: 6px;
}

.nav-item,
.quick-item {
  width: 100%;
  border: 0;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border-radius: 10px;
  padding: 9px 10px;
  background: transparent;
  color: #273143;
}

.nav-item:hover,
.quick-item:hover {
  background: #f0f3f8;
}

.nav-item.active {
  background: #ffe8eb;
  color: #a7182c;
  font-weight: 700;
}

.nav-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #eef2f7;
  color: #596276;
  font-size: 0.73rem;
  font-weight: 700;
}

.nav-count {
  color: #6d7485;
  font-variant-numeric: tabular-nums;
}

.ticket-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 8px;
}

.stake-field {
  width: 100%;
  border: 1px solid #d8dde8;
  border-radius: 10px;
  padding: 9px 10px;
}

.clear-ticket {
  border: 1px solid #d8dce5;
  border-radius: 10px;
  background: #f6f8fb;
  padding: 9px 11px;
  cursor: pointer;
}

.clear-ticket:hover {
  background: #eef2f7;
}

.ticket-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 9px;
}

.metric {
  border-radius: 9px;
  background: #f7f9fc;
  padding: 8px;
}

.metric span {
  display: block;
  color: #6a7284;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.72rem;
}

.metric strong {
  display: block;
  margin-top: 2px;
  font-size: 0.96rem;
  font-variant-numeric: tabular-nums;
}

.metric .accent {
  color: var(--accent);
}

.ticket-list {
  display: grid;
  gap: 7px;
  max-height: 230px;
  overflow-y: auto;
}

.ticket-row {
  border: 1px solid #e2e8f1;
  border-radius: 9px;
  padding: 7px;
  display: grid;
  gap: 2px;
}

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

.ticket-empty {
  border: 1px dashed #d8dee9;
  border-radius: 9px;
  min-height: 90px;
  padding: 10px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.empty-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #f2f5fa;
  color: #7b8498;
  display: grid;
  place-items: center;
  margin: 0 auto 6px;
}

.rank-list {
  display: grid;
  gap: 7px;
}

.rank-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  background: #f7f9fc;
  border-radius: 9px;
  padding: 7px;
}

.rank-position {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #ffe7eb;
  color: #ae1b31;
  display: grid;
  place-items: center;
  font-size: 0.74rem;
  font-weight: 700;
}

.rank-item strong {
  font-size: 0.88rem;
}

.rank-item span {
  color: var(--muted);
  font-size: 0.8rem;
}

.feature-grid {
  display: grid;
  gap: 8px;
}

.feature-box {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  background: #f7f9fc;
  border-radius: 10px;
  padding: 8px;
}

.feature-icon {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: #ffe8eb;
  color: #b21b31;
  display: grid;
  place-items: center;
  font-size: 0.76rem;
  font-weight: 700;
}

.feature-box p {
  margin: 0;
  color: #606a7c;
  font-size: 0.84rem;
  line-height: 1.25;
}

@media (min-width: 760px) {
  .login-card {
    padding: 18px;
  }

  .login-actions {
    grid-template-columns: 1fr 1fr;
  }

  .content-area {
    padding: 0 14px 28px;
  }

  .cards-strip {
    grid-auto-columns: minmax(260px, 320px);
  }

  .filter-bar {
    grid-template-columns: repeat(4, minmax(130px, 1fr));
  }

  .data-row {
    grid-template-columns: minmax(220px, 1.2fr) minmax(320px, 1fr);
    align-items: center;
    gap: 8px;
  }

  .ticket-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1099px) {
  .top-nav {
    display: none;
  }

  .mobile-controls {
    grid-column: 3;
    justify-self: end;
  }
}

@media (min-width: 1100px) {
  .mobile-controls {
    display: none;
  }

  .top-actions {
    display: inline-flex;
  }

  .topbar-inner {
    grid-template-columns: auto 1fr auto;
    gap: 18px;
    padding: 0 16px;
  }

  .top-nav {
    overflow: visible;
  }

  .sidebar-left,
  .sidebar-right {
    top: var(--header-h);
    transform: none;
    z-index: 60;
    width: auto;
    padding: 14px 12px 24px;
    box-shadow: none;
  }

  .sidebar-left {
    left: 0;
    width: var(--left-w);
  }

  .sidebar-right {
    right: 0;
    width: var(--right-w);
  }

  .content-area {
    margin-top: calc(var(--header-h) + 12px);
    margin-left: calc(var(--left-w) + 14px);
    margin-right: calc(var(--right-w) + 14px);
    max-width: 1120px;
    padding: 0 8px 30px;
  }

  .mobile-backdrop {
    display: none;
  }

  body.show-left,
  body.show-right {
    overflow: auto;
  }
}

@media (min-width: 1400px) {
  :root {
    --left-w: 256px;
    --right-w: 336px;
  }

  .content-area {
    max-width: 1200px;
  }
}
