/* TNG League — design tokens (xem docs/design-system.md) */
@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700&family=IBM+Plex+Sans:wght@400;500;600&family=Inter:wght@400;500;600&display=swap');

:root {
  --tng-ink: #2C2C2A;
  --tng-muted: #5C5C58;
  --tng-warn: #C0392B;
  --tng-win: #F2C94C;
  --tng-primary: #0079da;
  --tng-primary-soft: #2E94E8;

  --md-bg: #FAFAF7;
  --md-primary: var(--tng-primary);
  --md-primary-soft: var(--tng-primary-soft);
  --md-surface: #FFFFFF;
  --md-border: #E4E4DE;

  --fl-bg: #F1F2F4;
  --fl-brand: var(--tng-primary);
  --fl-approved: #2E7D5B;
  --fl-needs-fix: #B5651D;
  --fl-pending: #5B6B7C;
  --fl-border: #C8CDD4;
  --fl-surface: #FFFFFF;

  --lt-bg: #0E1A16;
  --lt-neon: #7DDE92;
  --lt-text: #FAFAF7;
  --lt-muted: #A8B5AE;
  --lt-surface: #15241E;
  --lt-border: #243830;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  --font-display: "Barlow Condensed", "Oswald", Impact, sans-serif;
  --font-body: Inter, system-ui, sans-serif;
  --font-admin: "IBM Plex Sans", Inter, system-ui, sans-serif;

  --radius-sm: 2px;
  --radius-md: 6px;
  --border-thin: 1px solid var(--fl-border);

  /* App shell chrome — brand-aligned light (không indigo/tím) */
  --shell-side-bg: #F5F7FA;
  --shell-side-border: #E2E6EC;
  --shell-active-bg: rgba(0, 121, 218, 0.1);
  --shell-ink: var(--tng-ink);
  --shell-muted: var(--tng-muted);
  --shell-main-bg: #F0F3F7;
  --shell-surface: #FFFFFF;
  --shell-accent: var(--tng-primary);
  --shell-accent-soft: var(--tng-primary-soft);

  /* Legacy aliases (site.css / layout.css) */
  --bacground-color: var(--tng-primary);
  --text-color: #F0F4F8;
}

/* —— Public: light shell page + Live ticket accents —— */
body.theme-public {
  --surface-bg: var(--shell-main-bg);
  --surface: var(--shell-surface);
  --text: var(--shell-ink);
  --text-muted: var(--shell-muted);
  --brand: var(--tng-primary);
  --border: var(--shell-side-border);
  --shell-accent: var(--tng-primary);
  --shell-accent-soft: var(--tng-primary-soft);
  --shell-active-bg: rgba(0, 121, 218, 0.1);
  --app-banner-h: clamp(8rem, 16vw, 11rem);
  --app-top-h: 64px;
  background: var(--surface-bg);
  background-image: none;
  color: var(--text);
  font-family: var(--font-body);
}

body.theme-public .site-content,
body.theme-public main,
body.theme-public .app-body {
  background: var(--shell-main-bg);
}

body.theme-public .app-main {
  background: var(--shell-main-bg);
}

/* Banner + top bar xuyên nền đè đáy; sticky + nền đặc khi đã scroll */
body.theme-public .app-banner {
  display: block;
  flex-shrink: 0;
  width: 100%;
  height: var(--app-banner-h);
  max-height: 300px;
  background: url("/images/nen-new.jpg") top / cover no-repeat;
}

body.theme-public .app-top {
  position: sticky;
  top: 0;
  z-index: 30;
  flex-shrink: 0;
  margin-top: calc(var(--app-top-h) * -1);
  min-height: var(--app-top-h);
  background: linear-gradient(180deg, rgba(0, 16, 40, 0.55) 0%, rgba(0, 20, 50, 0.72) 100%);
  border-bottom: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  color: #fff;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

body.theme-public .app-top.is-stuck {
  background:
    linear-gradient(180deg, rgba(0, 20, 50, 0.72) 0%, rgba(0, 30, 70, 0.78) 100%),
    url("/images/nen-new-1.jpg") bottom / cover no-repeat;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

body.theme-public .app-top__title {
  color: #fff;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.75);
}

body.theme-public .app-top__menu-btn {
  border-color: rgba(255, 255, 255, 0.7);
  color: #fff;
  background: transparent;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.75);
}

body.theme-public .app-top__chip {
  border-color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.75);
  backdrop-filter: none;
  font-weight: 600;
}

body.theme-public .app-top__chip:hover {
  border-color: #fff;
  color: #fff;
  background: rgba(0, 0, 0, 0.4);
}

body.theme-public .app-top__chip .material-icons {
  color: var(--tng-win);
  filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.65));
}

body.theme-public .app-top.is-stuck .app-top__title {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85), 0 0 12px rgba(0, 0, 0, 0.4);
}

body.theme-public .app-top.is-stuck .app-top__menu-btn {
  text-shadow: none;
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.75);
}

body.theme-public .app-top.is-stuck .app-top__chip {
  background: rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

body.theme-public .app-top.is-stuck .app-top__chip:hover {
  background: rgba(0, 0, 0, 0.5);
}

body.theme-public .app-top.is-stuck .app-top__chip .material-icons {
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.7));
}

body.theme-public .app-body {
  min-height: calc(100vh - var(--app-banner-h));
  padding: var(--space-5);
}

body.theme-public .app-side {
  background: var(--shell-side-bg);
}

body.theme-public .container#app,
body.theme-public #app {
  background-color: transparent !important;
  color: var(--text);
}

body.theme-public .blue-header,
body.theme-public .table-header {
  background: var(--tng-primary) !important;
  color: #fff !important;
}

body.theme-public table.striped>tbody>tr:nth-child(odd) {
  background-color: rgba(0, 121, 218, 0.04);
}

body.theme-public table td,
body.theme-public table th,
body.theme-public label,
body.theme-public p {
  color: inherit;
}

/* Ticket / live surfaces vẫn dùng palette tối lt-* */
body.theme-public .ticket-card {
  background: var(--lt-surface);
  border-color: var(--lt-border);
  color: var(--lt-text);
}

body.theme-public .ticket-card__stub {
  color: var(--lt-muted);
}

/* —— Admin: Federation ledger —— */
body.theme-admin {
  --surface-bg: var(--fl-bg);
  --surface: var(--fl-surface);
  --text: var(--tng-ink);
  --text-muted: var(--tng-muted);
  --brand: var(--fl-brand);
  --border: var(--fl-border);
  /* Shell chrome theo ledger */
  --shell-main-bg: var(--fl-bg);
  --shell-side-bg: var(--fl-surface);
  --shell-side-border: var(--fl-border);
  --shell-surface: var(--fl-surface);
  --shell-ink: var(--tng-ink);
  --shell-muted: var(--tng-muted);
  --shell-accent: var(--fl-brand);
  --shell-accent-soft: var(--tng-primary-soft);
  --shell-active-bg: rgba(0, 121, 218, 0.1);
  --app-top-h: 64px;
  background: var(--surface-bg);
  background-image: none;
  color: var(--text);
  font-family: var(--font-admin);
  font-variant-numeric: tabular-nums;
}

body.theme-admin .nav-admin {
  background-color: var(--fl-brand) !important;
}

body.theme-admin .site-content .container#app,
body.theme-admin #app {
  background-color: var(--fl-surface) !important;
  border: var(--border-thin);
  box-shadow: none !important;
}

body.theme-admin .btn,
body.theme-admin .btn-large {
  background-color: var(--fl-brand) !important;
}

body.theme-admin .btn.green,
body.theme-admin .btn-small.green {
  background-color: var(--fl-approved) !important;
}

body.theme-admin .btn.orange,
body.theme-admin .btn-small.orange {
  background-color: var(--fl-needs-fix) !important;
}

body.theme-admin .btn.red,
body.theme-admin .btn-small.red {
  background-color: var(--tng-warn) !important;
}

/* —— Portal: Match day —— */
body.theme-portal {
  --surface-bg: var(--md-bg);
  --surface: var(--md-surface);
  --text: var(--tng-ink);
  --text-muted: var(--tng-muted);
  --brand: var(--md-primary);
  --border: var(--md-border);
  --shell-main-bg: var(--md-bg);
  --shell-side-bg: var(--md-surface);
  --shell-side-border: var(--md-border);
  --shell-surface: var(--md-surface);
  --shell-ink: var(--tng-ink);
  --shell-muted: var(--tng-muted);
  --shell-accent: var(--md-primary);
  --shell-accent-soft: var(--md-primary-soft);
  --shell-active-bg: rgba(0, 121, 218, 0.1);
  --app-top-h: 64px;
  background: var(--surface-bg);
  background-image: none;
  color: var(--text);
  font-family: var(--font-body);
}

body.theme-portal .portal-side {
  background: var(--md-primary) !important;
}

body.theme-portal .portal-side a.active,
body.theme-portal .portal-side a:hover {
  background: var(--md-primary-soft) !important;
}

body.theme-portal .portal-main {
  background: var(--md-bg) !important;
}

body.theme-portal .portal-top {
  border-bottom: 1px solid var(--md-border);
  box-shadow: none !important;
}

body.theme-portal .btn.blue,
body.theme-portal .btn.blue.darken-3,
body.theme-portal .blue.darken-3 {
  background-color: var(--md-primary) !important;
}

body.theme-portal .portal-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--md-border);
  border-radius: var(--radius-md);
  background: var(--md-surface);
  margin-bottom: var(--space-5);
}

body.theme-portal .portal-banner--open {
  border-left: 4px solid var(--md-primary-soft);
}

body.theme-portal .portal-banner--closed {
  border-left: 4px solid var(--tng-muted);
}

body.theme-portal .portal-banner--reject {
  border-left: 4px solid var(--tng-warn);
}

body.theme-portal .portal-banner--approved {
  border-left: 4px solid var(--fl-approved);
}

body.theme-portal .portal-banner h6 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  letter-spacing: 0.03em;
}

body.theme-portal .portal-banner p {
  margin: 0;
  color: var(--tng-muted);
  font-size: 0.92rem;
}

body.theme-portal .dk-stepper {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--md-border);
}

body.theme-portal .dk-step {
  flex: 1;
  min-width: 120px;
  text-align: center;
  padding: var(--space-3) var(--space-2);
  border-radius: var(--radius-md);
  color: var(--tng-muted);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.2s ease, color 0.2s ease;
}

body.theme-portal .dk-step:hover {
  background: rgba(0, 121, 218, 0.08);
  color: var(--md-primary);
}

body.theme-portal .dk-step.active {
  background: var(--md-primary);
  color: #fff;
}

body.theme-portal .dk-step .num {
  font-family: var(--font-display);
  font-size: 1.25rem;
  display: block;
}

body.theme-portal .dk-panel {
  background: var(--md-surface);
  border: 1px solid var(--md-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  margin-bottom: 5.5rem;
}

body.theme-portal .dk-footer {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--md-surface);
  border-top: 1px solid var(--md-border);
  margin: 0 calc(-1 * var(--space-5)) calc(-1 * var(--space-5));
  box-shadow: 0 -4px 16px rgba(44, 44, 42, 0.06);
}

body.theme-portal .dk-footer .meta {
  color: var(--tng-muted);
  font-size: 0.9rem;
}

body.theme-portal .dk-footer .meta strong {
  color: var(--md-primary);
  font-family: var(--font-display);
  font-size: 1.15rem;
}

body.theme-portal .dk-check {
  list-style: none;
  padding: 0;
  margin: var(--space-4) 0 0;
}

body.theme-portal .dk-check li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--md-border);
}

body.theme-portal .dk-check .ok {
  color: var(--fl-approved);
}

body.theme-portal .dk-check .wait {
  color: var(--tng-muted);
}

body.theme-portal .stat-tile {
  background: var(--md-surface);
  border: 1px solid var(--md-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

body.theme-portal .stat-tile small {
  color: var(--tng-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.75rem;
}

body.theme-portal .stat-tile h5 {
  margin: var(--space-2) 0 0;
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--md-primary);
}

body.theme-portal .roster-table img.crest-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  margin-right: 8px;
  border: 1px solid var(--md-border);
}

body.theme-portal .portal-modal .modal-content {
  padding-bottom: var(--space-2);
}

body.theme-portal .portal-lock-hint {
  background: #f3f1ea;
  border: 1px solid var(--md-border);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  color: var(--tng-muted);
}

/* Public registration form (light surface on theme-public) */
.dk-public {
  color: var(--tng-ink);
  width: 100%;
  max-width: min(1480px, 100%);
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
  padding: var(--space-5, 1.25rem) var(--space-5, 1.25rem) 5.5rem;
  font-size: 0.875rem;
}

/* Override Materialize .container when paired with .dk-public */
.dk-public.container {
  width: 100%;
  max-width: min(1480px, 100%);
}

.dk-public-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: var(--space-4, 1rem);
  flex-wrap: wrap;
}

.dk-public-card {
  background: #fff;
  color: var(--tng-ink);
  border: 1px solid var(--md-border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.1rem;
  margin-bottom: var(--space-3, 0.75rem);
}

.dk-public-card--compact {
  min-height: auto;
  padding: 0.75rem 0.95rem;
}

.dk-public-card input,
.dk-public-card textarea,
.dk-public-card select {
  color: var(--tng-ink) !important;
}

.dk-section-title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

.dk-flash {
  margin: 0 0 0.75rem;
}

.dk-reject-banner {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  background: #fff5f2;
  border: 1px solid #f0c4b8;
  border-left: 4px solid var(--tng-warn, #C0392B);
  border-radius: var(--radius-md, 4px);
  color: var(--tng-ink);
}

.dk-reject-banner strong {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--tng-warn, #C0392B);
}

.dk-reject-banner p {
  margin: 0;
  font-size: 0.9rem;
}

.dk-team-row {
  margin-bottom: 0;
}

.dk-logo-col {
  margin-bottom: 0.75rem;
}

/* Materialize input-field — denser on this form */
.dk-public .input-field {
  margin-top: 0.5rem;
  margin-bottom: 0.35rem;
}

.dk-public .input-field input,
.dk-public .input-field textarea {
  font-size: 0.875rem !important;
  margin-bottom: 4px !important;
  height: 2.4rem;
}

.dk-public .input-field:not(.dk-if-compact)>label {
  /* Always floated — Materialize removes .active on empty blur */
  font-size: 1rem !important;
  transform: translateY(-14px) scale(0.8) !important;
  transform-origin: 0 0;
}

/* Native select — look like Materialize input underline */
.dk-public select.browser-default {
  display: block;
  width: 100%;
  height: 2.4rem;
  margin: 0 0 4px;
  padding: 0 1.75rem 0 0;
  font-size: 0.875rem;
  line-height: 2.4rem;
  color: var(--tng-ink);
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%239e9e9e' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.35rem center;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid #9e9e9e;
  box-shadow: none;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.dk-public select.browser-default:focus {
  border-bottom: 1px solid var(--tng-primary);
  box-shadow: 0 1px 0 0 var(--tng-primary);
}

.dk-public select.browser-default:disabled {
  color: rgba(0, 0, 0, 0.42);
  border-bottom-style: dotted;
  cursor: default;
}

.dk-public .input-field>select.browser-default {
  margin-top: 0.5rem;
}

/* Compact input-field inside roster cells */
.dk-public .dk-if-compact {
  margin: 0 !important;
  padding: 0;
}

.dk-public .dk-if-compact input,
.dk-public .dk-if-compact select.browser-default {
  height: 32px !important;
  margin: 0 !important;
  font-size: 0.8125rem !important;
  line-height: 32px !important;
}

.dk-public .dk-if-compact input[type="date"] {
  min-width: 7.5rem;
}

.dk-input--ao {
  width: 44px !important;
  text-align: center;
  padding: 0 0.25rem !important;
}

.dk-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.dk-add-btn {
  height: 32px;
  line-height: 32px;
  padding: 0 0.5rem;
}

.dk-add-btn .material-icons {
  font-size: 18px;
  margin-right: 2px;
}

.dk-table-wrap {
  overflow-x: auto;
  margin: 0 -0.25rem;
}

.dk-public .dk-roster {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 0.8125rem;
}

.dk-public .dk-roster th,
.dk-public .dk-roster td {
  padding: 0.3rem 0.35rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--md-border);
  white-space: nowrap;
}

.dk-public .dk-roster th {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--tng-muted);
  background: #f7f7f4;
}

.dk-public .dk-roster .input-field,
.dk-public .dk-roster .dk-if-compact {
  margin: 0 !important;
}

.dk-col-num {
  width: 28px;
  text-align: center;
}

.dk-col-avatar {
  width: 48px;
}

.dk-col-ao {
  width: 52px;
}

.dk-col-pos,
.dk-col-role {
  min-width: 96px;
}

.dk-col-cccd {
  min-width: 110px;
}

.dk-col-dob {
  min-width: 128px;
}

.dk-col-act {
  width: 36px;
  text-align: center;
}

.dk-col-act .material-icons {
  font-size: 18px;
  vertical-align: middle;
}

.dk-avatar {
  position: relative;
  display: inline-block;
  line-height: 0;
}

.dk-avatar--lg {
  margin-bottom: 0.35rem;
}

.dk-avatar .crest-sm,
.dk-avatar .crest {
  display: block;
}

.dk-avatar__btn {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--md-border);
  border-radius: 50%;
  background: #fff;
  color: var(--tng-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}

.dk-avatar--lg .dk-avatar__btn {
  width: 28px;
  height: 28px;
  right: 4px;
  bottom: 4px;
}

.dk-avatar__btn .material-icons {
  font-size: 14px;
  line-height: 1;
}

.dk-avatar__btn:hover {
  background: var(--tng-primary);
  color: #fff;
  border-color: var(--tng-primary);
}

.dk-file-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

.dk-hint {
  margin-top: 0.65rem;
  padding: 0.5rem 0.75rem;
  background: #e8f4fc;
  border-radius: var(--radius-sm, 4px);
  font-size: 0.8125rem;
  color: var(--tng-ink);
}

.dk-info-row {
  margin-bottom: 0;
}

.dk-public-footer {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid var(--md-border);
  border-radius: var(--radius-md);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, .08);
}

.dk-public-footer .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.dk-public .crest-sm {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  border: 1px solid var(--md-border);
}

@media (max-width: 600px) {
  body.theme-portal .dk-footer {
    flex-direction: column;
    align-items: stretch;
  }

  body.theme-portal .dk-footer .actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  body.theme-portal .dk-footer .btn,
  body.theme-portal .dk-footer .btn-flat {
    width: 100%;
    text-align: center;
  }

  .dk-public {
    padding-bottom: 6rem;
  }

  .dk-public-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .dk-public-footer .actions {
    flex-direction: column;
  }

  .dk-public-footer .btn,
  .dk-public-footer .btn-flat {
    width: 100%;
    text-align: center;
  }
}

/* —— Shared components —— */
.font-display,
.score-display,
.rank-display,
.jersey-num {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

.crest {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--brand, var(--md-primary));
  background: #fff;
}

.crest--lg {
  width: 140px;
  height: 140px;
  border-width: 3px;
}

@media (max-width: 600px) {
  .crest--lg {
    width: 96px;
    height: 96px;
  }
}

.result-pips {
  display: inline-flex;
  gap: 3px;
  vertical-align: middle;
}

.result-pip {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

.result-pip--T {
  background: var(--tng-primary-soft);
}

.result-pip--H {
  background: #9E9E9A;
}

.result-pip--B {
  background: var(--tng-warn);
}

body.theme-public .result-pip--T {
  background: var(--lt-neon);
}

.doc-stamp {
  display: inline-block;
  border: 1px solid currentColor;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-family: var(--font-admin);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: var(--radius-sm);
}

.doc-stamp--approved {
  color: var(--fl-approved);
  border-color: var(--fl-approved);
}

.doc-stamp--pending {
  color: var(--fl-pending);
  border-color: var(--fl-pending);
}

.doc-stamp--needs {
  color: var(--fl-needs-fix);
  border-color: var(--fl-needs-fix);
}

.doc-meta-stamp {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.ticket-card {
  background: var(--surface, var(--lt-surface));
  border: 1px solid var(--border, var(--lt-border));
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
}

.ticket-card__stub {
  border-top: 1px dashed var(--border, var(--lt-border));
  padding: var(--space-3) var(--space-4);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--lt-neon);
}

.live-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lt-neon);
  animation: tng-live-pulse 1.4s ease-in-out infinite;
}

@keyframes tng-live-pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.35;
    transform: scale(0.85);
  }
}

@media (prefers-reduced-motion: reduce) {
  .live-badge::before {
    animation: none;
  }
}

.ledger-panel {
  background: var(--fl-surface);
  border: 1px solid var(--fl-border);
  border-radius: var(--radius-sm);
  padding: var(--space-5);
  box-shadow: none;
  position: relative;
}

.table-scoreboard td:first-child,
.table-scoreboard .jersey-num,
.table-scoreboard .rank-display {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
}

/* —— Shared app shell (Public / Portal / Admin) — light chrome —— */
.app-shell {
  display: flex;
  width: 100%;
  min-height: 100vh;
  height: 100vh;
  margin: 0;
  overflow: hidden;
  background: var(--shell-main-bg);
}

.app-side {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: var(--space-4) 0;
  z-index: 40;
  height: 100%;
  background: var(--shell-side-bg);
  border-right: 1px solid var(--shell-side-border);
  color: var(--shell-ink);
}

.app-side__brand {
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-3);
  border-bottom: 1px solid var(--shell-side-border);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  line-height: 1.2;
  color: var(--shell-ink);
}

.app-side__brand small {
  display: block;
  margin-top: var(--space-1);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--shell-muted);
  opacity: 1;
  text-transform: none;
}

.app-side__nav {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  overflow-y: auto;
  height: auto;
  line-height: normal;
  background: transparent;
  box-shadow: none;
}

.app-side__nav a,
.app-side a.app-side__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.7rem var(--space-5);
  color: var(--shell-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.app-side__nav a .material-icons,
.app-side a.app-side__link .material-icons {
  font-size: 1.15rem;
  width: 1.25rem;
  text-align: center;
  color: inherit;
  opacity: 1;
}

.app-side__nav a:hover,
.app-side a.app-side__link:hover {
  background: rgba(0, 121, 218, 0.06);
  color: var(--shell-ink);
}

.app-side__nav a.active,
.app-side a.app-side__link.active {
  background: var(--shell-active-bg);
  color: var(--shell-accent);
  border-left-color: var(--shell-accent);
  font-weight: 600;
}

.app-side__footer {
  padding: var(--space-3) 0;
  border-top: 1px solid var(--shell-side-border);
  margin-top: auto;
}

.app-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--shell-main-bg);
  overflow-x: hidden;
  overflow-y: auto;
}

.app-banner {
  display: none;
}

.app-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 25;
  padding: var(--space-4) var(--space-5);
  background: var(--shell-side-bg);
  border-bottom: 1px solid var(--shell-side-border);
  min-height: 64px;
  box-shadow: 0 1px 0 rgba(26, 28, 46, 0.03);
}

.app-top__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--shell-ink);
  line-height: 1.2;
}

.app-top__start {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.app-top__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.app-top__chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--shell-side-border);
  border-radius: var(--radius-md);
  background: var(--shell-main-bg);
  color: var(--shell-ink);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  max-width: min(320px, 70vw);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.app-top__chip:hover {
  border-color: var(--shell-accent);
  color: var(--shell-accent);
}

.app-top__chip .material-icons {
  font-size: 1rem;
  flex-shrink: 0;
  color: var(--shell-accent);
}

.app-top__menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--shell-side-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--shell-ink);
  cursor: pointer;
  padding: 0;
}

.app-top__menu-btn .material-icons {
  font-size: 1.5rem;
}

.app-top__meta {
  color: var(--shell-muted);
  font-size: 0.875rem;
}

.app-top__logout {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--shell-side-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--tng-warn);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
}

.app-top__logout:hover {
  background: rgba(192, 57, 43, 0.06);
}

/* Content fills viewport below header; footer luôn cuối trang (mép dưới khi content ngắn) */
.app-body {
  flex: 1 0 auto;
  min-height: calc(100vh - var(--app-top-h, 64px));
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  overflow: visible;
  background: var(--shell-main-bg);
  color: var(--shell-ink);
}

.app-body>.container,
.app-main .app-body .container {
  width: 100% !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Footer luôn sau content — cuối trang */
.app-main>.page-footer,
.app-main>footer.page-footer {
  flex-shrink: 0;
  margin-top: auto;
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  margin-bottom: 0;
  padding: 1.25rem var(--space-5) 1.5rem !important;
  background: var(--tng-primary) !important;
  border-top: none;
  color: #fff;
}

.app-main>.page-footer .row {
  margin-bottom: 0 !important;
}

.app-main>.page-footer h5,
.app-main>.page-footer .white-text {
  color: #fff !important;
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
}

.app-main>.page-footer .grey-text,
.app-main>.page-footer p {
  color: rgba(255, 255, 255, 0.82) !important;
  margin: 0 0 0.35rem;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.45;
}

.app-main>.page-footer .col {
  float: left;
  padding: 0 0.75rem;
}

.app-shell-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 28, 46, 0.35);
  z-index: 35;
}

.app-shell.is-drawer-open .app-shell-backdrop {
  display: block;
}

/* Theme bodies: Admin/Portal clear legacy image; Public giữ banner sân */
body.theme-admin,
body.theme-portal {
  background-image: none;
  background-color: var(--surface-bg, var(--shell-main-bg));
}

body.theme-public .app-body,
body.theme-public .app-body label,
body.theme-public .app-body p,
body.theme-public .app-body td,
body.theme-public .app-body th {
  color: var(--text, var(--shell-ink));
}

body.theme-admin .app-top__title {
  font-family: var(--font-admin);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0;
}

body.theme-admin .app-body#app,
body.theme-admin #app.app-body {
  background: var(--shell-main-bg) !important;
  border: none;
  box-shadow: none !important;
  margin: 0;
  width: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
}

/* Portal login dùng trang độc lập (auth-login.css); giữ class để tương thích cũ */
body.theme-portal .portal-login {
  max-width: none;
  margin: 0;
  width: 100%;
}

@media (max-width: 992px) {
  .app-shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .app-side {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100vh;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 2px 0 16px rgba(26, 28, 46, 0.12);
  }

  .app-shell.is-drawer-open .app-side {
    transform: translateX(0);
  }

  .app-main {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .app-body {
    overflow: visible;
    flex: 1 0 auto;
    min-height: calc(100vh - var(--app-top-h, 64px));
  }

  body.theme-public .app-body {
    min-height: calc(100vh - var(--app-banner-h, 8rem));
    padding: var(--space-4);
  }

  body.theme-public {
    --app-banner-h: 8rem;
  }

  .app-top__menu-btn {
    display: inline-flex;
  }

  .app-top__title {
    font-size: 1.25rem;
  }

  .app-body {
    padding: var(--space-4);
  }
}

@media (prefers-reduced-motion: reduce) {

  .app-side,
  .app-side__nav a,
  .app-side a.app-side__link,
  .app-top__chip {
    transition: none;
  }
}
