:root {
  --brand-orange: #f68b1f;
  --brand-orange-dark: #df7510;
  --brand-blue: #0a67b4;
  --brand-blue-dark: #084d87;
  --brand-bg: #f5f7fb;
  --brand-card: #ffffff;
  --brand-text: #102238;
  --brand-muted: #66758a;
  --brand-border: #d9e1ec;
}

* { box-sizing: border-box; }
body.body-bg {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, #f7f9fc 0%, #eef4fb 100%);
  color: var(--brand-text);
}

.navbar-brand360 {
  background: linear-gradient(90deg, #07121d 0%, #0d243b 60%, #11314f 100%);
  border-bottom: 3px solid var(--brand-orange);
}
.brand-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
}
.brand-title {
  color: #fff;
  font-weight: 700;
  letter-spacing: .2px;
}
.user-chip {
  display: flex;
  flex-direction: column;
  color: #fff;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  padding: .45rem .8rem;
  line-height: 1.1;
}
.user-chip-name { font-weight: 700; }
.user-chip small { opacity: .85; }

.main-card,
.main-container,
.auth-card {
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-radius: 22px;
  box-shadow: 0 14px 35px rgba(17, 49, 79, .08);
}
.main-container,
.auth-card { padding: 1.35rem; }
.auth-wrapper {
  min-height: calc(100vh - 180px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-card {
  width: 100%;
  max-width: 470px;
}
.auth-logo {
  width: 120px;
  height: auto;
  margin-bottom: .85rem;
}
.auth-subtitle,
.page-subtitle,
.text-soft { color: var(--brand-muted); }

h1, h2, h3, h4, h5 { color: var(--brand-text); font-weight: 700; }
.section-title { margin-bottom: .3rem; }

.btn-primary {
  background: linear-gradient(90deg, var(--brand-blue), var(--brand-blue-dark));
  border: none;
}
.btn-primary:hover { background: linear-gradient(90deg, #095a9d, #063f70); }
.btn-success {
  background: linear-gradient(90deg, #0a9b61, #067246);
  border: none;
}
.btn-warning {
  background: linear-gradient(90deg, #ffb142, #f68b1f);
  border: none;
  color: #1f2937;
}
.btn-outline-brand {
  border: 1px solid var(--brand-orange);
  color: var(--brand-orange-dark);
}
.btn-outline-brand:hover {
  background: var(--brand-orange);
  color: #fff;
}

.form-control, .form-select {
  border-radius: 12px;
  border-color: #cfd8e3;
  padding: .75rem .9rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 .2rem rgba(10,103,180,.15);
}

.table {
  --bs-table-bg: transparent;
  margin-bottom: 0;
}
.table thead th {
  background: linear-gradient(90deg, var(--brand-blue-dark), var(--brand-blue));
  color: #fff;
  border: 0;
  font-size: .92rem;
}
.table tbody td {
  vertical-align: middle;
  border-color: #e6edf6;
}
.table tbody tr:hover { background: #f8fbff; }
.table-responsive {
  border-radius: 18px;
  overflow: hidden;
}

.score-inputs {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
}
.score-inputs input {
  width: 64px;
  text-align: center;
}
.flag {
  width: 24px;
  height: 18px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.08);
}
.match-teams {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
  font-weight: 600;
}
.match-status {
  font-size: .82rem;
  color: var(--brand-muted);
}

.dashboard-grid .btn {
  min-height: 88px;
  border-radius: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ranking-highlight {
  background: #ecf8f1 !important;
}
.site-footer {
  color: var(--brand-muted);
}
.site-footer a {
  color: var(--brand-blue);
  text-decoration: none;
}
.site-footer a:hover { text-decoration: underline; }

.badge-soft {
  background: #eef5ff;
  color: var(--brand-blue-dark);
  border: 1px solid #d8e7fb;
}
.card-header-brand {
  background: linear-gradient(90deg, var(--brand-orange), #ffb142);
  color: #102238;
  font-weight: 700;
}


.group-title {
  font-weight: 700;
  color: var(--brand-blue-dark);
  padding-bottom: .45rem;
  border-bottom: 2px solid #e7eef8;
}
.desktop-only { display: block; }
.mobile-only { display: none; }
.match-card {
  border: 1px solid #dfe8f3;
  border-radius: 18px;
  padding: 1rem;
  background: #fff;
  box-shadow: 0 8px 22px rgba(17,49,79,.06);
  margin-bottom: .85rem;
}
.match-card-top {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.match-card-team-line {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-weight: 700;
}
.match-card-vs {
  color: var(--brand-muted);
  font-weight: 700;
}
.match-card-meta,
.match-card-section {
  margin-top: .7rem;
}
.score-inputs-mobile-friendly input,
.score-inputs-mobile-card input {
  height: 44px;
  font-size: 1rem;
}
.score-inputs-mobile-card {
  display: flex;
  align-items: center;
  gap: .6rem;
}
.score-inputs-mobile-card input {
  width: 100%;
  min-width: 0;
  text-align: center;
}
@media (max-width: 768px) {
  .desktop-only { display: none; }
  .mobile-only { display: block; }
  .brand-logo { height: 42px; }
  .brand-title { font-size: .95rem; }
  .main-container, .auth-card { padding: 1rem; border-radius: 18px; }
  .score-inputs input { width: 54px; }
  .dashboard-grid .btn { min-height: 72px; }
  .table-responsive { border-radius: 14px; }
}

.group-separator { margin-top: 1.25rem; }
.group-title {
  display: inline-block;
  padding: .35rem .8rem;
  border-radius: 999px;
  background: #eef5ff;
  border: 1px solid #d7e4fb;
  color: var(--brand-blue-dark);
  font-weight: 700;
  margin-bottom: .85rem;
}
.mobile-match-list { display: grid; gap: .9rem; }
.mobile-match-card {
  border: 1px solid #dbe5f0;
  border-radius: 18px;
  padding: .9rem;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 8px 18px rgba(17, 49, 79, .05);
}
.mobile-match-head { display: grid; gap: .35rem; margin-bottom: .65rem; }
.mobile-team-row { display: flex; align-items: center; gap: .45rem; font-weight: 700; }
.mobile-vs { font-size: .82rem; color: var(--brand-muted); text-transform: uppercase; }
.mobile-match-meta { display: grid; gap: .18rem; font-size: .92rem; margin-bottom: .75rem; }
.mobile-score-box { padding-top: .35rem; }
.mobile-result-line { margin-top: .75rem; font-size: .95rem; }
.audit-pre { white-space: pre-wrap; font-size: .8rem; max-width: 420px; }
.matches-table td, .matches-table th { white-space: nowrap; }
.matches-table td:first-child, .matches-table th:first-child { white-space: normal; min-width: 280px; }

@media (max-width: 768px) {
  .brand-logo { height: 42px; }
  .brand-title { font-size: .95rem; }
  .main-container, .auth-card { padding: 1rem; border-radius: 18px; }
  .score-inputs input { width: 54px; }
  .dashboard-grid .btn { min-height: 72px; }
  .score-inputs-mobile {
    width: 100%;
    justify-content: center;
    gap: .65rem;
  }
  .score-inputs-mobile input {
    width: calc(50% - 18px);
    min-width: 0;
    font-size: 1.05rem;
    padding: .85rem .35rem;
  }
}


/* ===== Mobile hardening ===== */
@media (max-width: 991.98px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: block !important; }

  main.container {
    padding-left: .65rem !important;
    padding-right: .65rem !important;
  }

  .main-card,
  .main-container,
  .auth-card {
    border-radius: 16px;
  }

  .card-header-brand {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    font-size: 1.05rem;
  }

  .group-title {
    display: block;
    width: 100%;
    border-radius: 14px;
    margin-bottom: .8rem;
  }

  .match-card {
    padding: .9rem;
    border-radius: 16px;
    overflow: hidden;
  }

  .match-card-team-line {
    align-items: flex-start;
    font-size: 1.05rem;
    line-height: 1.3;
    word-break: break-word;
  }

  .match-card-team-line span:last-child {
    display: inline-block;
    min-width: 0;
  }

  .match-card-meta {
    font-size: .97rem;
    line-height: 1.4;
  }

  .match-card-section strong {
    display: block;
    margin-bottom: .35rem;
  }

  .score-inputs-mobile-card {
    display: grid !important;
    grid-template-columns: 1fr auto 1fr;
    gap: .55rem;
    width: 100%;
    align-items: center;
  }

  .score-inputs-mobile-card input,
  .score-inputs-mobile-friendly input,
  input[type="number"] {
    min-width: 0;
  }

  .score-inputs-mobile-card input {
    width: 100% !important;
    max-width: 100%;
    height: 48px;
    padding: .65rem .35rem;
    font-size: 1.1rem;
    text-align: center;
  }

  .score-inputs-mobile-card span {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 700;
    min-width: 14px;
  }

  .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table {
    font-size: .92rem;
  }

  .table th,
  .table td {
    white-space: normal;
  }

  .navbar .user-chip {
    width: 100%;
    margin-top: .35rem;
  }

  .navbar-collapse {
    padding-bottom: .5rem;
  }
}
