:root {
  --navy: #101d5d;
  --navy-2: #172a7a;
  --red: #d3131b;
  --red-dark: #ac0f16;
  --blue-soft: #eef2ff;
  --red-soft: #fff0f1;
  --green: #12815b;
  --green-soft: #e9f8f1;
  --amber: #aa6800;
  --amber-soft: #fff6df;
  --ink: #182033;
  --muted: #687086;
  --line: #dfe3ec;
  --surface: #ffffff;
  --canvas: #f4f6fa;
  --shadow: 0 12px 34px rgba(16, 29, 93, 0.09);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(420px, 0.95fr);
  background: var(--surface);
}

.auth-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  padding: 54px clamp(32px, 6vw, 88px);
  color: #fff;
  background: var(--navy);
}

.auth-brand::after {
  content: "";
  position: absolute;
  right: -120px;
  bottom: -160px;
  width: 480px;
  height: 480px;
  border: 90px solid rgba(255,255,255,.06);
  border-radius: 50%;
}

.auth-brand::before {
  content: "";
  position: absolute;
  left: -15%;
  bottom: 18%;
  width: 130%;
  height: 18px;
  transform: rotate(-12deg);
  background: var(--red);
}

.brand-lockup {
  position: relative;
  z-index: 1;
  display: inline-flex;
  width: 322px;
  height: 112px;
  overflow: hidden;
  border-radius: 8px;
  background: white;
}

.brand-lockup img {
  position: absolute;
  width: 505px;
  max-width: none;
  transform: translate(-89px, -199px);
}

.auth-copy { position: relative; z-index: 1; max-width: 590px; }
.eyebrow { margin: 0 0 12px; color: var(--red); font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.auth-brand .eyebrow { color: #ffb6b8; }
.auth-copy h1 { margin: 0; max-width: 560px; font-size: clamp(38px, 6vw, 72px); line-height: .98; letter-spacing: -.055em; }
.auth-copy p { max-width: 500px; margin: 24px 0 0; color: rgba(255,255,255,.78); font-size: 18px; line-height: 1.6; }
.auth-proof { position: relative; z-index: 1; display: flex; gap: 22px; color: rgba(255,255,255,.72); font-size: 13px; }
.auth-proof span { display: inline-flex; align-items: center; gap: 7px; }
.auth-proof span::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; }

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px clamp(24px, 6vw, 80px);
  background: #fff;
}

.auth-box { width: 100%; max-width: 460px; }
.language-switch { display: inline-flex; gap: 3px; margin-bottom: 18px; padding: 3px; border-radius: 10px; background: var(--canvas); }
.language-switch button { min-width: 40px; border: 0; border-radius: 7px; padding: 7px 9px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 850; }
.language-switch button.active { color: #fff; background: var(--navy); }
.auth-box h2 { margin: 0 0 8px; font-size: 30px; letter-spacing: -.035em; }
.auth-box > p { margin: 0 0 28px; color: var(--muted); line-height: 1.55; }

.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 28px; padding: 5px; border-radius: 14px; background: var(--canvas); }
.auth-tab { border: 0; border-radius: 10px; padding: 11px; color: var(--muted); background: transparent; font-weight: 750; }
.auth-tab.active { color: var(--navy); background: #fff; box-shadow: 0 2px 10px rgba(16,29,93,.08); }

.form-grid { display: grid; gap: 17px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.field { display: grid; gap: 7px; }
.field span { color: #41495d; font-size: 13px; font-weight: 700; }
.field small { color: var(--muted); line-height: 1.4; }
input, select, textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid #ccd2df;
  border-radius: 11px;
  padding: 11px 13px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color .16s, box-shadow .16s;
}
input:focus, select:focus, textarea:focus { border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(23,42,122,.12); }
textarea { min-height: 95px; resize: vertical; }

.btn {
  display: inline-flex;
  min-height: 43px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 15px;
  color: var(--ink);
  background: #fff;
  font-weight: 750;
  text-decoration: none;
  transition: transform .12s, border-color .12s, background .12s;
}
.btn:hover { border-color: #aeb6c7; }
.btn:active { transform: translateY(1px); }
.btn.primary { border-color: var(--navy); color: #fff; background: var(--navy); }
.btn.primary:hover { background: var(--navy-2); }
.btn.danger { border-color: var(--red); color: #fff; background: var(--red); }
.btn.ghost { border-color: transparent; color: var(--navy); background: var(--blue-soft); }
.btn.small { min-height: 35px; padding: 7px 11px; border-radius: 9px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn:disabled { cursor: not-allowed; opacity: .5; }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.login-submit { margin-top: 5px; }
.demo-box { margin-top: 24px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--canvas); }
.demo-box strong { display: block; margin-bottom: 9px; font-size: 13px; }
.demo-box .button-row { display: grid; grid-template-columns: 1fr 1fr; }
.microcopy { color: var(--muted); font-size: 12px; line-height: 1.45; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 264px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 25px 18px 20px; background: var(--navy); color: #fff; }
.sidebar-logo { display: flex; align-items: center; gap: 11px; padding: 2px 8px 24px; }
.sidebar-logo img { width: 42px; height: 42px; border-radius: 12px; background: #fff; }
.sidebar-logo strong { display: block; font-size: 14px; letter-spacing: .02em; }
.sidebar-logo span { color: rgba(255,255,255,.6); font-size: 11px; }
.nav-list { display: grid; gap: 4px; }
.nav-button { display: flex; width: 100%; align-items: center; gap: 12px; border: 0; border-radius: 11px; padding: 12px 13px; color: rgba(255,255,255,.72); background: transparent; text-align: left; font-weight: 650; }
.nav-button:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav-button.active { color: #fff; background: rgba(255,255,255,.14); }
.nav-icon { display: grid; width: 23px; height: 23px; place-items: center; border-radius: 7px; color: inherit; font-size: 16px; }
.sidebar-user { margin-top: auto; padding: 14px; border-radius: 14px; background: rgba(255,255,255,.08); }
.sidebar-user strong { display: block; font-size: 13px; }
.sidebar-user span { display: block; margin-top: 3px; color: rgba(255,255,255,.6); font-size: 11px; }
.sidebar-user button { margin-top: 12px; border: 0; padding: 0; color: #fff; background: transparent; font-size: 12px; font-weight: 700; }

.main-area { min-width: 0; }
.topbar { display: flex; height: 72px; align-items: center; justify-content: space-between; gap: 20px; padding: 0 clamp(20px, 4vw, 54px); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); }
.topbar-title { min-width: 0; }
.topbar-title strong { display: block; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.topbar-title span { color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-actions .language-switch { margin: 0; }
.role-chip { flex: none; border: 0; border-radius: 999px; padding: 7px 11px; color: var(--navy); background: var(--blue-soft); font-size: 12px; font-weight: 800; }

.content { width: 100%; max-width: 1480px; margin: 0 auto; padding: 38px clamp(20px, 4vw, 54px) 70px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.page-head h1 { margin: 0; font-size: clamp(27px, 3vw, 39px); letter-spacing: -.045em; }
.page-head p { max-width: 720px; margin: 8px 0 0; color: var(--muted); line-height: 1.5; }

.hero-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 26px;
  margin-bottom: 24px;
  padding: clamp(25px, 4vw, 42px);
  border-radius: 24px;
  color: #fff;
  background: var(--navy);
  box-shadow: var(--shadow);
}
.hero-card::after { content: ""; position: absolute; right: -55px; top: -130px; width: 310px; height: 310px; border: 55px solid rgba(255,255,255,.07); border-radius: 50%; }
.hero-card > * { position: relative; z-index: 1; }
.hero-card h2 { margin: 3px 0 11px; font-size: clamp(27px, 4vw, 46px); line-height: 1.03; letter-spacing: -.05em; }
.hero-card p { max-width: 620px; margin: 0; color: rgba(255,255,255,.72); line-height: 1.6; }
.hero-card .button-row { margin-top: 24px; }
.hero-card .btn.primary { border-color: #fff; color: var(--navy); background: #fff; }
.hero-card .btn.ghost { color: #fff; background: rgba(255,255,255,.12); }
.deadline-block { align-self: center; padding: 19px 20px; border: 1px solid rgba(255,255,255,.15); border-radius: 16px; background: rgba(255,255,255,.08); }
.deadline-block span { display: block; color: rgba(255,255,255,.66); font-size: 12px; }
.deadline-block strong { display: block; margin: 7px 0 3px; font-size: 26px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card, .panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 5px 18px rgba(16,29,93,.035); }
.stat-card { padding: 20px; }
.stat-card span { display: block; color: var(--muted); font-size: 12px; font-weight: 650; }
.stat-card strong { display: block; margin-top: 8px; font-size: 29px; letter-spacing: -.04em; }
.stat-card small { display: block; margin-top: 6px; color: var(--muted); }
.stat-card.attention { border-color: #f0dcae; background: var(--amber-soft); }

.layout-2 { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(290px, .7fr); gap: 18px; }
.layout-equal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.panel { min-width: 0; margin-bottom: 18px; padding: 22px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.panel-head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.panel > h2, .panel > h3 { margin-top: 0; }

.status { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 9px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.pending, .status.to_schedule { color: var(--amber); background: var(--amber-soft); }
.status.approved, .status.active, .status.scheduled { color: var(--green); background: var(--green-soft); }
.status.pending_approval, .status.group_stage { color: var(--navy-2); background: var(--blue-soft); }
.status.cancelled, .status.suspended { color: var(--red); background: var(--red-soft); }

.list { display: grid; gap: 10px; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.list-item:first-child { padding-top: 0; }
.list-item:last-child { padding-bottom: 0; border-bottom: 0; }
.list-main { min-width: 0; }
.list-main strong { display: block; font-size: 14px; }
.list-main span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.avatar { flex: none; display: grid; width: 41px; height: 41px; place-items: center; border-radius: 13px; color: var(--navy); background: var(--blue-soft); font-size: 12px; font-weight: 850; }
.user-line { display: flex; min-width: 0; align-items: center; gap: 11px; }
.empty { padding: 27px 15px; color: var(--muted); text-align: center; }
.empty strong { display: block; margin-bottom: 5px; color: var(--ink); }

.match-list { display: grid; gap: 12px; }
.match-card { border: 1px solid var(--line); border-radius: 15px; padding: 17px; background: #fff; }
.match-top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.match-meta { color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.match-teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 13px; }
.match-team { min-width: 0; }
.match-team:last-child { text-align: right; }
.match-team strong { display: block; font-size: 14px; }
.match-team span { display: block; overflow: hidden; margin-top: 4px; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.versus { color: #9da4b5; font-size: 12px; font-weight: 850; }
.score { display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 14px; }
.score-set { min-width: 37px; border-radius: 8px; padding: 7px; color: var(--navy); background: var(--blue-soft); text-align: center; font-weight: 850; }
.match-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 10px 9px; color: var(--muted); font-size: 11px; font-weight: 750; text-align: left; text-transform: uppercase; }
td { padding: 12px 9px; border-top: 1px solid var(--line); font-size: 13px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.position { display: inline-grid; width: 25px; height: 25px; place-items: center; border-radius: 8px; color: var(--navy); background: var(--blue-soft); font-weight: 800; }
tr.mine td { background: #f7f8ff; }

.deadline-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 15px; }
.deadline-card + .deadline-card { margin-top: 11px; }
.deadline-card h3 { margin: 0 0 5px; font-size: 16px; }
.deadline-card p { margin: 0; color: var(--muted); font-size: 12px; }
.inline-form { display: flex; align-items: end; gap: 8px; }
.inline-form input { min-width: 150px; }

.notice { margin-bottom: 18px; border-left: 4px solid var(--navy); border-radius: 0 13px 13px 0; padding: 15px 17px; background: var(--blue-soft); color: #38405c; font-size: 13px; line-height: 1.55; }
.notice.warning { border-left-color: var(--amber); background: var(--amber-soft); }
.notice.success { border-left-color: var(--green); background: var(--green-soft); }

.availability-card { padding: 20px; border: 1px solid var(--line); border-radius: 17px; background: #fff; }
.availability-card + .availability-card { margin-top: 14px; }
.availability-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; margin-top: 18px; }
.suggestions { display: grid; gap: 8px; margin-top: 15px; }
.suggestion { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 13px; border-radius: 12px; background: var(--green-soft); }
.suggestion strong { display: block; font-size: 13px; }
.suggestion span { color: #3f6f5e; font-size: 11px; }

.sets-grid { display: grid; gap: 10px; margin: 16px 0; }
.set-row { display: grid; grid-template-columns: 78px 1fr auto 1fr; align-items: center; gap: 9px; }
.set-row strong { font-size: 12px; }
.set-row input { min-width: 0; text-align: center; font-weight: 800; }

.bracket { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 24px; overflow-x: auto; padding: 8px 2px 14px; }
.bracket-round { display: grid; align-content: center; gap: 15px; min-width: 180px; }
.bracket-round h3 { margin: 0 0 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.bracket-match { border-left: 3px solid var(--navy); border-radius: 0 11px 11px 0; padding: 12px; background: var(--canvas); }
.bracket-match div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: 12px; }
.bracket-match .tbd { color: var(--muted); }

.season-steps { display: grid; gap: 11px; }
.season-step { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 15px; }
.season-step > div:first-child { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; }
.season-step h3 { margin: 0; font-size: 15px; }
.season-step p { grid-column: 2; margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.step-index { grid-row: 1 / span 2; display: grid; width: 40px; height: 40px; place-items: center; border-radius: 12px; color: #fff; background: var(--navy); font-weight: 850; }
.live-bracket { display: grid; grid-template-columns: repeat(3, minmax(250px, 1fr)); gap: 20px; overflow-x: auto; padding-bottom: 8px; }
.live-round { display: grid; min-width: 250px; align-content: center; gap: 12px; }
.live-round h3 { margin: 0 0 3px; color: var(--muted); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; }
.live-round .match-card { margin: 0; }
.password-form { max-width: 620px; grid-template-columns: repeat(3, minmax(0,1fr)); align-items: end; }

.profile-card { display: grid; grid-template-columns: auto 1fr; gap: 17px; align-items: center; }
.profile-avatar { display: grid; width: 74px; height: 74px; place-items: center; border-radius: 22px; color: #fff; background: var(--navy); font-size: 22px; font-weight: 850; }
.profile-card h2 { margin: 0; }
.profile-card p { margin: 5px 0 0; color: var(--muted); }
.key-value { display: grid; grid-template-columns: 160px 1fr; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.key-value:last-child { border: 0; }
.key-value span { color: var(--muted); }
.key-value strong { text-align: right; }

.mobile-nav { display: none; }
.toast-region { position: fixed; z-index: 1000; right: 20px; bottom: 20px; display: grid; gap: 10px; width: min(380px, calc(100vw - 40px)); }
.toast { border-radius: 13px; padding: 14px 16px; color: #fff; background: var(--navy); box-shadow: 0 12px 40px rgba(0,0,0,.18); font-size: 13px; line-height: 1.45; animation: toast-in .22s ease-out; }
.toast.error { background: var(--red-dark); }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }

.loading { min-height: 100vh; display: grid; place-items: center; color: var(--navy); }
.loader { width: 38px; height: 38px; border: 4px solid #dce1ef; border-top-color: var(--navy); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 980px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-brand { min-height: 430px; padding: 35px; }
  .auth-copy h1 { max-width: 640px; }
  .auth-proof { display: none; }
  .auth-panel { padding: 42px 24px 60px; }
  .app-shell { grid-template-columns: 84px minmax(0,1fr); }
  .sidebar { padding: 22px 12px; }
  .sidebar-logo { justify-content: center; padding-inline: 0; }
  .sidebar-logo div, .nav-button span:last-child, .sidebar-user strong, .sidebar-user span { display: none; }
  .nav-button { justify-content: center; padding: 12px; }
  .sidebar-user { padding: 10px; text-align: center; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .hero-card { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .auth-brand { min-height: 340px; padding: 25px 22px; }
  .brand-lockup { width: 247px; height: 86px; }
  .brand-lockup img { width: 388px; transform: translate(-68px,-153px); }
  .auth-copy h1 { font-size: 39px; }
  .auth-copy p { margin-top: 15px; font-size: 15px; }
  .form-grid.two { grid-template-columns: 1fr; }
  .app-shell { display: block; }
  .sidebar { display: none; }
  .topbar { height: 60px; padding: 0 18px; }
  .content { padding: 25px 16px 100px; }
  .page-head { align-items: flex-start; flex-direction: column; margin-bottom: 21px; }
  .page-head h1 { font-size: 29px; }
  .hero-card { border-radius: 19px; padding: 25px 21px; }
  .hero-card h2 { font-size: 31px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
  .stat-card { padding: 15px; }
  .stat-card strong { font-size: 24px; }
  .layout-2, .layout-equal { grid-template-columns: 1fr; }
  .panel { padding: 18px; }
  .match-teams { gap: 8px; }
  .deadline-card { grid-template-columns: 1fr; }
  .inline-form { align-items: stretch; flex-direction: column; }
  .availability-form { grid-template-columns: 1fr; }
  .season-step { align-items: stretch; flex-direction: column; }
  .password-form { grid-template-columns: 1fr; }
  .set-row { grid-template-columns: 60px 1fr auto 1fr; }
  .key-value { grid-template-columns: 1fr; gap: 4px; }
  .key-value strong { text-align: left; }
  .mobile-nav {
    position: fixed;
    z-index: 100;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 7px 5px calc(7px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255,255,255,.97);
    box-shadow: 0 -7px 24px rgba(16,29,93,.08);
  }
  .mobile-nav button { display: grid; justify-items: center; gap: 3px; border: 0; padding: 5px 2px; color: var(--muted); background: transparent; font-size: 9px; font-weight: 700; }
  .mobile-nav button b { font-size: 17px; line-height: 1; }
  .mobile-nav button.active { color: var(--navy); }
}

@media (max-width: 430px) {
  .auth-tabs, .demo-box .button-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .match-card { padding: 14px; }
}
