:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #f4eeee;
  --ink: #231719;
  --muted: #75676a;
  --line: #e4d8da;
  --brand-red: #d93946;
  --brand-red-dark: #a9192b;
  --brand-red-soft: #fff0f2;
  --red: #c4463a;
  --amber: #d89d20;
  --blue: #2368a2;
  --green: #2f8f5f;
  --green-soft: #edf8f1;
  --green-line: #b9dfc7;
  --shadow: 0 18px 40px rgba(74, 24, 29, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(217, 57, 70, 0.06) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, rgba(217, 57, 70, 0.045) 0 1px, transparent 1px 100%),
    var(--bg);
  background-size: 36px 36px;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 460px);
}

.login-art {
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: clamp(28px, 6vw, 72px);
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(140deg, rgba(106, 14, 25, 0.95), rgba(217, 57, 70, 0.86)),
    url("data:image/svg+xml,%3Csvg width='900' height='900' viewBox='0 0 900 900' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='900' height='900' fill='%23a9192b'/%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.20' stroke-width='8'%3E%3Crect x='78' y='88' width='744' height='580' rx='8'/%3E%3Cline x1='450' y1='88' x2='450' y2='668'/%3E%3Ccircle cx='450' cy='379' r='92'/%3E%3Crect x='78' y='245' width='128' height='246'/%3E%3Crect x='694' y='245' width='128' height='246'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  isolation: isolate;
}

.login-art h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(42px, 7vw, 88px);
  line-height: 0.96;
}

.login-subtitle {
  max-width: 520px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 18px;
}

.login-logo {
  position: absolute;
  top: 38px;
  right: 46px;
  width: min(230px, 34vw);
  height: auto;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 30px rgba(74, 24, 29, 0.18);
}

.pitch-lines {
  position: absolute;
  inset: 12%;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: clamp(28px, 5vw, 58px);
  background: var(--surface);
}

.panel-head,
.summary-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand-red);
  box-shadow: 0 0 0 5px rgba(217, 57, 70, 0.12);
}

.login-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(35, 104, 162, 0.24);
  outline-offset: 2px;
}

.demo-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.credit-line,
.app-footer {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.credit-line {
  margin: 8px 0 0;
}

.app-footer {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 42px) 26px;
  text-align: center;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(250px, 1fr) auto minmax(210px, auto);
  gap: 18px;
  align-items: center;
  padding: 16px clamp(18px, 4vw, 42px);
  border-bottom: 1px solid var(--line);
  background: rgba(244, 246, 245, 0.94);
  backdrop-filter: blur(18px);
}

.brand,
.user-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 96px;
  height: 48px;
  object-fit: contain;
  padding: 5px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.brand h1,
.content-head h2,
.rules-box h2,
.groups-box h2,
.standings-panel h3 {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
}

.eyebrow {
  margin: 0 0 4px;
  color: currentColor;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  opacity: 0.68;
}

.tabs,
.button-row,
.group-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tab,
.ghost-btn,
.secondary-btn,
.primary-btn,
.group-chip {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--surface);
  font-weight: 800;
}

.tab.is-active,
.group-chip.is-active {
  border-color: rgba(217, 57, 70, 0.34);
  color: var(--brand-red-dark);
  background: var(--brand-red-soft);
}

.group-chip.is-locked {
  border-style: dashed;
  color: var(--brand-red-dark);
}

.primary-btn {
  border-color: var(--brand-red);
  color: #fff;
  background: var(--brand-red);
}

.primary-btn:hover {
  background: var(--brand-red-dark);
}

.secondary-btn:hover,
.ghost-btn:hover,
.tab:hover,
.group-chip:hover {
  border-color: rgba(217, 57, 70, 0.42);
}

.full {
  width: 100%;
}

.user-box {
  justify-content: flex-end;
  color: var(--muted);
  font-weight: 800;
}

.user-box span {
  display: grid;
  gap: 2px;
  line-height: 1.1;
}

.user-box strong {
  color: var(--ink);
}

.user-box small {
  color: var(--muted);
  font-size: 12px;
}

.notice {
  max-width: min(1180px, calc(100vw - 32px));
  margin: 18px auto 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 22px rgba(28, 42, 34, 0.08);
}

.notice.success {
  border-left-color: var(--brand-red);
}

.notice.error {
  border-left-color: var(--red);
}

.workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px clamp(16px, 4vw, 42px) 42px;
}

.content-only {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px clamp(16px, 4vw, 42px) 42px;
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 16px;
}

.summary-band {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.summary-band strong {
  color: var(--brand-red-dark);
  font-size: 18px;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metric {
  display: grid;
  gap: 6px;
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.metric span,
.match-meta,
.match-foot,
.admin-row span,
.leader-row span,
.standings-row span {
  color: var(--muted);
}

.metric strong {
  font-size: 30px;
  line-height: 1;
}

.rules-box,
.groups-box,
.deadline-box {
  display: grid;
  gap: 10px;
}

.rules-box h2,
.groups-box h2,
.deadline-box h2,
.standings-panel h3 {
  font-size: 15px;
}

.deadline-box {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.deadline-box strong {
  color: var(--brand-red-dark);
}

.deadline-box span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.deadline-box.is-closed {
  border-color: rgba(196, 70, 58, 0.36);
  background: #fff4f2;
}

.rules-box p {
  margin: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.rules-box p:last-child {
  border-bottom: 0;
}

.group-chip {
  width: 42px;
  padding: 0;
}

.content-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.content-head h2 {
  font-size: clamp(20px, 3vw, 30px);
  line-height: 1.15;
}

.team-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.team-strip span {
  min-height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  font-weight: 850;
  text-align: center;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  align-items: start;
}

.match-list {
  display: grid;
  gap: 12px;
}

.daily-list,
.daily-date-group {
  display: grid;
  gap: 14px;
}

.daily-date-group {
  padding-bottom: 4px;
}

.daily-date-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.daily-date-head strong {
  color: var(--brand-red-dark);
}

.daily-date-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.daily-empty {
  min-height: 160px;
  display: grid;
  place-items: center;
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  font-weight: 850;
  text-align: center;
}

.match-row {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.match-row.is-locked {
  background: #f7f3ea;
}

.match-meta,
.match-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  font-weight: 800;
}

.match-status {
  color: var(--blue);
}

.score-grid {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 54px 12px 54px minmax(120px, 1fr);
  gap: 10px;
  align-items: center;
}

.score-grid input,
.admin-score input {
  min-height: 48px;
  padding: 0;
  text-align: center;
  font-size: 22px;
  font-weight: 900;
}

.team-name {
  min-width: 0;
  font-weight: 850;
}

.team-name.away {
  text-align: right;
}

.score-separator {
  text-align: center;
  color: var(--muted);
  font-weight: 900;
}

.match-foot strong {
  color: var(--brand-red-dark);
}

.result-detail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(217, 57, 70, 0.2);
  border-radius: 8px;
  background: var(--brand-red-soft);
}

.result-detail div {
  display: grid;
  gap: 3px;
}

.result-detail span,
.result-detail p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.result-detail strong {
  color: var(--ink);
}

.result-detail p {
  grid-column: 1 / -1;
  margin: 0;
}

.match-actions {
  display: flex;
  justify-content: flex-end;
}

.match-actions button {
  min-width: 160px;
}

.standings-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.standings-table,
.leaderboard-table,
.admin-table {
  display: grid;
  gap: 8px;
}

.leaderboard-empty {
  min-height: 80px;
  display: grid;
  place-items: center;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  font-weight: 800;
  text-align: center;
}

.standings-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px 42px 42px;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  font-size: 13px;
}

.standings-row span:first-child {
  color: var(--ink);
  font-weight: 800;
}

.standings-head,
.leader-head,
.admin-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 140px 180px;
  gap: 14px;
  align-items: center;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.admin-row > div:first-child {
  display: grid;
  gap: 4px;
}

.admin-score {
  display: grid;
  grid-template-columns: 1fr 12px 1fr;
  gap: 8px;
  align-items: center;
}

.admin-score span {
  text-align: center;
  font-weight: 900;
}

.date-results-list {
  display: grid;
  gap: 8px;
}

.date-result-row {
  display: grid;
  grid-template-columns: 76px minmax(260px, 1fr) 140px 190px;
  gap: 14px;
  align-items: center;
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.date-result-row.has-result {
  border-color: var(--green-line);
  background: var(--green-soft);
}

.date-result-order,
.date-result-match,
.date-result-status {
  display: grid;
  gap: 4px;
}

.date-result-order strong {
  color: var(--brand-red-dark);
  font-size: 18px;
}

.date-result-row.has-result .date-result-order strong {
  color: var(--green);
}

.date-result-order span,
.date-result-match span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.result-pill {
  width: max-content;
  min-height: 26px;
  display: inline-grid;
  place-items: center;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 900;
}

.result-pill.is-saved {
  border-color: var(--green-line);
  color: var(--green);
  background: #fff;
}

.leader-row {
  display: grid;
  grid-template-columns: 52px minmax(180px, 1fr) repeat(5, minmax(80px, 0.4fr));
  gap: 12px;
  align-items: center;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.leader-row strong:nth-child(3) {
  color: var(--brand-red-dark);
}

.employee-search {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.employee-search label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.employee-search input {
  min-height: 44px;
}

.viewer-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.employee-list,
.quiniela-view,
.prediction-view-list {
  display: grid;
  gap: 10px;
}

.employee-list {
  max-height: 640px;
  overflow: auto;
}

.employee-option {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 58px;
  padding: 10px 12px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.employee-option.is-active {
  border-color: rgba(217, 57, 70, 0.48);
  background: var(--brand-red-soft);
}

.employee-option span,
.employee-option small,
.viewer-head span,
.viewer-head small,
.prediction-view-row span,
.quiniela-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.viewer-head,
.quiniela-summary,
.prediction-view-row,
.viewer-empty {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.viewer-head > div {
  display: grid;
  gap: 4px;
}

.quiniela-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.quiniela-summary div {
  display: grid;
  gap: 4px;
}

.quiniela-summary strong {
  color: var(--brand-red-dark);
  font-size: 20px;
}

.prediction-view-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 100px 100px 60px;
  gap: 12px;
  align-items: center;
}

.prediction-view-row > div {
  display: grid;
  gap: 4px;
}

.viewer-empty {
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.viewer-empty.large {
  min-height: 180px;
  display: grid;
  place-items: center;
}

@media (max-width: 1080px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .user-box {
    justify-content: flex-start;
  }

  .workspace,
  .split-grid,
  .viewer-layout {
    grid-template-columns: 1fr;
  }

  .side-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-band,
  .groups-box {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .login-screen {
    grid-template-columns: 1fr;
  }

  .login-art {
    min-height: 42vh;
  }

  .login-logo {
    width: min(180px, 48vw);
    right: 28px;
  }

  .tabs,
  .button-row {
    width: 100%;
  }

  .tab,
  .button-row button {
    flex: 1 1 120px;
  }

  .side-panel {
    grid-template-columns: 1fr;
  }

  .team-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-head {
    flex-direction: column;
  }

  .score-grid {
    grid-template-columns: 1fr 48px 10px 48px 1fr;
  }

  .result-detail {
    grid-template-columns: 1fr;
  }

  .match-actions button {
    width: 100%;
  }

  .team-name {
    font-size: 13px;
  }

  .admin-row,
  .date-result-row {
    grid-template-columns: 1fr;
  }

  .employee-search,
  .quiniela-summary,
  .prediction-view-row {
    grid-template-columns: 1fr;
  }

  .leader-row {
    grid-template-columns: 40px minmax(120px, 1fr) 70px;
  }

  .leader-row span:nth-child(n + 4),
  .leader-row strong:nth-child(n + 4),
  .leader-head span:nth-child(n + 4) {
    display: none;
  }
}
