@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Montserrat:wght@700;800;900&display=swap');

[hidden]{display:none!important}
:root{
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface2: #f1f5f9;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #059669;
  --primary-hover: #047857;
  --primary-light: #ecfdf5;
  --ocean: #0284c7;
  --ocean-dark: #0369a1;
  --dark: #0a1926;
  --dark-surface: #112638;
  --gold: #d97706;
  --gold-light: #fef3c7;
  --red: #ef4444;
  --shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 30px -10px rgba(10, 25, 38, 0.15);
  --radius: 18px;
}

*{box-sizing:border-box}
body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font-family:"Plus Jakarta Sans","Segoe UI",sans-serif;
  font-size:14px;
  text-rendering:optimizeLegibility;
  -webkit-font-smoothing:antialiased;
}
button,input,select,textarea{font:inherit}
button{cursor:pointer}

.app{min-height:100vh;display:grid;grid-template-columns:240px 1fr}

/* SIDEBAR (DESKTOP) */
.sidebar{
  position:fixed;
  inset:0 auto 0 0;
  width:240px;
  background:linear-gradient(180deg, #091824 0%, #0c2030 100%);
  color:#fff;
  padding:24px 16px;
  display:flex;
  flex-direction:column;
  z-index:10;
  border-right:1px solid rgba(255,255,255,0.06);
}

.logo-lockup{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  margin:0 0 26px;
  text-decoration:none;
}
.logo-circle-wrapper{
  width:96px;
  height:96px;
  border-radius:50%;
  padding:4px;
  background:linear-gradient(135deg, #10b981 0%, #0284c7 50%, #f59e0b 100%);
  box-shadow:0 0 20px rgba(16, 185, 129, 0.35);
  display:flex;
  align-items:center;
  justify-content:center;
  transition:transform 0.25s ease;
}
.logo-lockup:hover .logo-circle-wrapper{transform:scale(1.04)}
.logo-circle-wrapper img{
  width:100%;
  height:100%;
  object-fit:cover;
  border-radius:50%;
  background:#fff;
}

.sidebar nav{display:grid;gap:6px}
.nav-item{
  border:0;
  background:transparent;
  color:#94a3b8;
  border-radius:12px;
  padding:12px 14px;
  text-align:left;
  font-weight:600;
  display:flex;
  gap:12px;
  align-items:center;
  transition:all 0.18s ease;
}
.nav-item span{font-size:18px;width:22px;text-align:center}
.nav-item:hover{background:rgba(255,255,255,0.07);color:#fff}
.nav-item.active{
  background:linear-gradient(135deg, #059669 0%, #0284c7 100%);
  color:#fff;
  box-shadow:0 4px 14px rgba(5, 150, 105, 0.35);
}

.sidebar-foot{
  margin-top:auto;
  border-top:1px solid rgba(255,255,255,0.08);
  padding:18px 8px 2px;
  display:flex;
  gap:10px;
  align-items:center;
}
.sidebar-foot b,.sidebar-foot small{display:block;font-size:11px}
.sidebar-foot b{color:#f1f5f9}
.sidebar-foot small{color:#64748b;margin-top:2px}
.live-dot{
  width:9px;
  height:9px;
  background:#10b981;
  border-radius:50%;
  box-shadow:0 0 0 4px rgba(16, 185, 129, 0.2);
}

/* MAIN & TOPBAR (DESKTOP) */
main{grid-column:2;min-width:0}
.topbar{
  height:94px;
  padding:20px 34px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  background:rgba(255,255,255,0.88);
  position:sticky;
  top:0;
  z-index:8;
  backdrop-filter:blur(14px);
  border-bottom:1px solid var(--line);
}
h1,h2,h3,p{margin:0}
h1{font-size:22px;font-weight:800;letter-spacing:-0.5px}
.eyebrow{
  color:var(--primary);
  font-size:11px;
  letter-spacing:1.5px;
  font-weight:800;
  margin-bottom:4px;
  text-transform:uppercase;
}
.top-actions{display:flex;align-items:center;gap:10px}

.search{
  height:42px;
  width:260px;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:12px;
  display:flex;
  align-items:center;
  padding:0 12px;
  gap:8px;
  box-shadow:0 1px 2px rgba(0,0,0,0.03);
}
.search input{border:0;outline:0;background:transparent;width:100%}

.primary,.secondary,.icon-btn{
  border:0;
  border-radius:11px;
  height:42px;
  padding:0 17px;
  font-weight:700;
  transition:all 0.18s ease;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  white-space:nowrap;
}
.primary{
  background:linear-gradient(135deg, var(--primary) 0%, #047857 100%);
  color:#ffffff;
  box-shadow:0 4px 14px rgba(5, 150, 105, 0.3);
}
.primary:hover{
  background:linear-gradient(135deg, #047857 0%, #065f46 100%);
  box-shadow:0 6px 18px rgba(5, 150, 105, 0.4);
}
.secondary,.icon-btn{
  background:var(--surface);
  border:1px solid var(--line);
  color:var(--ink);
}
.secondary:hover,.icon-btn:hover{
  background:var(--surface2);
  border-color:#cbd5e1;
}
.icon-btn{width:42px;padding:0}

.admin-access{white-space:nowrap}
.admin-access.admin-active{background:#0a1926;color:#34d399;border-color:#0a1926}
.matchmaker-shortcut{background:#f0fdf4;color:#047857;border-color:#a7f3d0}
.matchmaker-shortcut:hover{background:#dcfce7}

.content{padding:28px 34px 44px;max-width:1540px;margin:auto}

/* ATP HERO BANNER */
.team-banner{
  width:100%;
  border-radius:24px;
  background:linear-gradient(135deg, #071724 0%, #092e3c 48%, #074737 100%);
  box-shadow:0 16px 36px rgba(9, 32, 48, 0.22);
  position:relative;
  overflow:hidden;
  margin-bottom:20px;
  padding:36px 40px;
  color:#fff;
  border:1px solid rgba(255,255,255,0.08);
}
.team-banner:before{
  content:"";
  position:absolute;
  right:-60px;
  top:-90px;
  width:380px;
  height:380px;
  border:40px solid rgba(16, 185, 129, 0.08);
  border-radius:50%;
}
.team-banner:after{
  content:"";
  position:absolute;
  left:35%;
  bottom:-140px;
  width:320px;
  height:320px;
  border:40px solid rgba(2, 132, 199, 0.07);
  border-radius:50%;
}
.atp-banner-content{
  position:relative;
  z-index:2;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:24px;
}
.atp-banner-text .badge-pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 12px;
  border-radius:999px;
  background:rgba(16, 185, 129, 0.16);
  border:1px solid rgba(16, 185, 129, 0.35);
  color:#6ee7b7;
  font-size:10px;
  font-weight:800;
  letter-spacing:1px;
  text-transform:uppercase;
  margin-bottom:14px;
}
.atp-banner-text h2{
  font-family:'Montserrat',sans-serif;
  font-size:32px;
  font-weight:900;
  letter-spacing:-0.5px;
  line-height:1.2;
  background:linear-gradient(90deg, #ffffff 0%, #d1fae5 60%, #bae6fd 100%);
  -webkit-background-clip:text;
  background-clip:text;
  -webkit-text-fill-color:transparent;
  margin-bottom:10px;
}
.atp-banner-text p{
  color:#cbd5e1;
  font-size:13px;
  max-width:580px;
  line-height:1.6;
}
.atp-banner-emblem{
  position:relative;
  flex:0 0 auto;
  display:flex;
  align-items:center;
  justify-content:center;
}
.atp-banner-emblem img{
  width:140px;
  height:140px;
  border-radius:50%;
  border:4px solid rgba(255,255,255,0.25);
  box-shadow:0 0 30px rgba(16, 185, 129, 0.4);
  background:#fff;
}

/* BIRTHDAY NOTIFICATION WIDGET */
.birthday-banner{
  margin-bottom:20px;
  padding:18px 22px;
  border-radius:20px;
  background:linear-gradient(135deg, #fffbeb 0%, #fef3c7 40%, #ecfdf5 100%);
  border:1px solid #fde68a;
  box-shadow:0 10px 25px -5px rgba(245, 158, 11, 0.16);
  display:flex;
  flex-direction:column;
  gap:12px;
  position:relative;
  overflow:hidden;
}
.dark .birthday-banner{
  background:linear-gradient(135deg, #241705 0%, #2e2008 50%, #063024 100%);
  border-color:#78350f;
}
.birthday-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.birthday-head-title{
  display:flex;
  align-items:center;
  gap:8px;
  font-weight:800;
  font-size:13px;
  color:#b45309;
  letter-spacing:0.6px;
  text-transform:uppercase;
}
.dark .birthday-head-title{color:#fcd34d}
.birthday-head-desc{
  font-size:12px;
  color:#92400e;
  font-weight:600;
}
.dark .birthday-head-desc{color:#fde68a}
.birthday-list{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(280px, 1fr));
  gap:12px;
}
.birthday-item{
  display:flex;
  align-items:center;
  gap:12px;
  padding:12px 16px;
  background:rgba(255,255,255,0.92);
  border:1px solid rgba(245, 158, 11, 0.28);
  border-radius:14px;
  backdrop-filter:blur(8px);
}
.dark .birthday-item{
  background:rgba(15, 23, 42, 0.7);
  border-color:rgba(245, 158, 11, 0.25);
}
.birthday-info b{display:block;font-size:13.5px;font-weight:800;color:var(--ink)}
.birthday-info span{display:block;font-size:11px;color:var(--muted);margin-top:2px}
.birthday-tag{
  margin-left:auto;
  padding:6px 12px;
  border-radius:999px;
  font-size:10.5px;
  font-weight:800;
  white-space:nowrap;
}
.birthday-tag.today{
  background:#ef4444;
  color:#ffffff;
  box-shadow:0 0 12px rgba(239, 68, 68, 0.45);
  animation:pulse-bday 1.6s infinite;
}
.birthday-tag.upcoming{
  background:#fef3c7;
  color:#b45309;
  border:1px solid #fde68a;
}
.dark .birthday-tag.upcoming{background:#78350f;color:#fef3c7;border-color:#92400e}
@keyframes pulse-bday{0%,100%{transform:scale(1)}50%{transform:scale(1.06)}}

.birthday-banner.is-quiet{
  padding:15px 20px;
  background:rgba(254, 243, 199, 0.45);
  border-color:#fde68a;
  box-shadow:none;
}
.dark .birthday-banner.is-quiet{background:rgba(36, 23, 5, 0.5);border-color:#78350f}
.birthday-quiet-body{font-size:12px;color:#92400e;line-height:1.55}
.dark .birthday-quiet-body{color:#fde68a}
.birthday-quiet-body b{color:var(--ink)}
.dark .birthday-quiet-body b{color:#fff}

/* METRICS */
.metric-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:16px;
  margin:20px 0;
}
.metric,.card{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}
.metric{
  padding:20px;
  transition:transform 0.18s ease,box-shadow 0.18s ease;
}
.metric:hover{transform:translateY(-2px);box-shadow:var(--shadow-lg)}
.metric-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  color:var(--muted);
  font-size:12px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:0.5px;
}
.metric-icon{
  width:38px;
  height:38px;
  border-radius:11px;
  background:var(--primary-light);
  color:var(--primary);
  display:grid;
  place-items:center;
  font-size:18px;
}
.metric strong{display:block;font-size:26px;font-weight:800;margin:12px 0 4px}
.metric small{color:var(--muted);font-size:11px}
.up{color:var(--primary)!important;font-weight:600}

/* DASHBOARD GRID */
.dashboard-grid{display:grid;grid-template-columns:1.25fr .85fr;gap:20px}
.card{padding:22px}
.card-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:18px}
.card-head h2{font-size:17px;font-weight:800}
.card-head p{font-size:12px;color:var(--muted);margin-top:4px}
.link-btn{border:0;background:transparent;color:var(--primary);font-weight:700}
.link-btn:hover{text-decoration:underline}

/* MATCH LIST */
.match-list{display:grid;gap:11px}
.match-row{
  display:grid;
  grid-template-columns:84px minmax(130px,1fr) 76px minmax(130px,1fr) 96px;
  align-items:center;
  gap:12px;
  padding:13px 16px;
  border:1px solid var(--line);
  border-radius:14px;
  background:var(--surface2);
  transition:all 0.15s ease;
}
.match-row:hover{border-color:#cbd5e1;background:#fff}
.match-date{color:var(--muted);font-size:11px;font-weight:600}
.team{font-weight:700}
.score{font-size:18px;font-weight:800;text-align:center}
.score em{font-style:normal;color:var(--primary)}
.badge{
  justify-self:center;
  padding:5px 10px;
  border-radius:99px;
  font-size:10px;
  font-weight:800;
  background:#e2e8f0;
  color:#475569;
  white-space:nowrap;
}
.badge.sink{background:#ffedd5;color:#c2410c}
.badge.draw{background:#e0f2fe;color:#0369a1}
.match-row.editable{
  grid-template-columns:84px minmax(130px,1fr) 76px minmax(130px,1fr) 140px;
}
.match-status{display:flex;align-items:center;justify-content:center;gap:6px}
.edit-badge{background:#ecfdf5;color:#059669;border:0;cursor:pointer}
.edit-badge:hover{background:#059669;color:#fff}

/* RANK LIST */
.rank-list{display:grid;gap:8px}
.rank-row{
  display:grid;
  grid-template-columns:30px 42px 1fr auto;
  gap:12px;
  align-items:center;
  padding:10px 8px;
  border-radius:12px;
  transition:background 0.15s ease;
}
.rank-row:hover{background:var(--surface2)}
.rank-no{font-weight:800;color:var(--muted)}
.avatar{
  width:40px;
  height:40px;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:linear-gradient(135deg, #a7f3d0, #34d399);
  color:#065f46;
  font-weight:800;
  border:2px solid #fff;
  box-shadow:0 2px 6px rgba(0,0,0,0.06);
  overflow:hidden;
  flex-shrink:0;
}
.avatar img{width:100%;height:100%;object-fit:cover;display:block}
.rank-name b,.rank-name small{display:block}
.rank-name b{font-size:13px}
.rank-name small{color:var(--muted);font-size:11px;margin-top:2px}
.rank-value{text-align:right}
.rank-value b,.rank-value small{display:block}
.rank-value b{color:var(--primary);font-size:14px}
.rank-value small{color:var(--muted);font-size:11px;margin-top:2px}

/* HALL OF FAME / HONOR */
.honor-section{
  position:relative;
  overflow:hidden;
  margin:0 0 22px;
  padding:26px 28px;
  border:1px solid rgba(16, 185, 129, 0.25);
  border-radius:22px;
  background:linear-gradient(135deg, #091c29 0%, #0d2e38 52%, #0a3d31 100%);
  color:#fff;
  box-shadow:0 16px 36px rgba(7, 26, 38, 0.25);
}
.honor-section:before{
  content:"";
  position:absolute;
  right:-70px;
  top:-110px;
  width:320px;
  height:320px;
  border:45px solid rgba(16, 185, 129, 0.08);
  border-radius:50%;
}
.honor-heading{
  position:relative;
  z-index:1;
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:18px;
  margin-bottom:20px;
}
.honor-heading .eyebrow{color:#34d399}
.honor-heading h2{font-size:22px;letter-spacing:-0.3px}
.honor-heading p:not(.eyebrow){margin-top:6px;color:#94a3b8;font-size:12px}
.honor-detail{color:#6ee7b7;font-weight:700;white-space:nowrap}

.honor-grid{
  position:relative;
  z-index:1;
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:14px;
}
.honor-card{
  position:relative;
  padding:20px 16px;
  border:1px solid rgba(255,255,255,0.12);
  border-radius:18px;
  background:rgba(255,255,255,0.06);
  text-align:center;
  backdrop-filter:blur(8px);
  transition:transform 0.2s ease,background 0.2s ease;
}
.honor-card:hover{
  transform:translateY(-3px);
  background:rgba(255,255,255,0.09);
}
.honor-card:first-child{
  background:linear-gradient(145deg, rgba(217, 119, 6, 0.22), rgba(255, 255, 255, 0.06));
  border-color:rgba(245, 158, 11, 0.4);
}
.honor-medal{
  position:absolute;
  top:12px;
  right:12px;
  font-size:22px;
}
.honor-avatar{display:flex;justify-content:center;margin:0 auto 12px}
.honor-avatar .avatar{
  width:72px;
  height:72px;
  border:3px solid #34d399;
  box-shadow:0 0 0 4px rgba(16, 185, 129, 0.2),0 10px 20px rgba(0,0,0,0.3);
}
.honor-copy small{
  display:block;
  color:#6ee7b7;
  font-size:10px;
  font-weight:800;
  letter-spacing:0.8px;
  text-transform:uppercase;
}
.honor-copy h3{
  margin:6px 0 6px;
  color:#fff;
  font-size:16px;
  font-weight:800;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.honor-copy b{display:block;color:#a7f3d0;font-size:12px}
.honor-copy p{margin-top:8px;color:#cbd5e1;font-size:11px;line-height:1.5}

/* DATA TABLE */
.data-table{width:100%;border-collapse:collapse}
.data-table th{
  text-align:left;
  color:var(--muted);
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:0.7px;
  padding:14px 12px;
  border-bottom:1px solid var(--line);
  font-weight:700;
  white-space:nowrap;
}
.data-table td{padding:14px 12px;border-bottom:1px solid var(--line);white-space:nowrap}
.data-table tr:last-child td{border-bottom:0}
.player-cell{display:flex;align-items:center;gap:10px}
.rate-win{color:var(--primary);font-weight:700}
.rate-loss{color:var(--red);font-weight:700}
.table-rank{font-size:18px;display:inline-grid;width:28px;height:28px;place-items:center}
.rank-move{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:3px;
  min-width:32px;
  padding:4px 6px;
  border-radius:99px;
  font-size:10px;
  font-weight:800;
}
.rank-move.up{background:#ecfdf5;color:#059669}
.rank-move.down{background:#fef2f2;color:#dc2626}
.rank-move.neutral{background:#f1f5f9;color:#64748b}

/* FORM BADGES */
.form-badges{display:flex;gap:4px}
.form-badges i{
  width:24px;
  height:24px;
  border-radius:6px;
  display:grid;
  place-items:center;
  font-size:10px;
  font-style:normal;
  font-weight:800;
  color:#fff;
}
.form-badges .w{background:#059669}
.form-badges .d{background:#0284c7}
.form-badges .l{background:#ef4444}

/* SECTION TOOLBAR & FILTERS */
.section-toolbar{
  display:flex;
  justify-content:space-between;
  gap:16px;
  align-items:center;
  margin-bottom:18px;
}
.section-toolbar h2{font-size:20px;font-weight:800}
.filter-group{display:flex;gap:10px;align-items:center}
.filter-group input,.filter-group select,.field input,.field select,.field textarea{
  border:1px solid var(--line);
  background:var(--surface);
  border-radius:11px;
  padding:10px 14px;
  outline:0;
  color:var(--ink);
  transition:all 0.15s ease;
}
.filter-group input:focus,.field input:focus,.field select:focus,.field textarea:focus{
  border-color:var(--primary);
  box-shadow:0 0 0 3px rgba(5, 150, 105, 0.15);
}

.ranking-formula{
  margin-bottom:18px;
  padding:14px 18px;
  border:1px solid #c7d2fe;
  border-radius:14px;
  background:#eef2ff;
  color:#3730a3;
  font-size:12px;
  line-height:1.6;
}

/* MEMBER GRID */
.member-grid,.pair-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}
.member-card{padding:20px;position:relative}
.member-top{display:flex;align-items:center;gap:12px}
.member-top .avatar{width:50px;height:50px}
.member-top h3{font-size:15px;font-weight:800}
.member-top p{font-size:12px;color:var(--muted);margin-top:3px}
.member-bday{font-size:11.5px;color:var(--muted);margin-top:6px}
.member-bday b{color:var(--ink)}
.member-achievement{
  margin-top:10px;
  padding:10px 12px;
  border-radius:10px;
  background:var(--surface2);
  color:var(--muted);
  font-size:11px;
  line-height:1.5;
}
.member-stats{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  margin-top:16px;
  border-top:1px solid var(--line);
  padding-top:14px;
}
.member-stats div{text-align:center}
.member-stats strong{display:block;font-size:17px;font-weight:800;color:var(--primary)}
.member-stats small{display:block;font-size:10px;color:var(--muted);margin-top:2px;font-weight:700}
.streak-strip{
  display:grid;
  grid-template-columns:1fr auto;
  gap:3px 8px;
  margin-top:14px;
  padding:10px 12px;
  border-radius:10px;
  background:var(--surface2);
  color:var(--muted);
  font-size:11px;
}
.streak-strip.hot{background:#fff7ed;color:#c2410c}
.streak-strip.hot b{color:#ea580c}

/* PAIR CHAMPIONS */
.pair-champions{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-bottom:20px}
.pair-champion{
  border-radius:20px;
  padding:24px;
  color:#fff;
  display:grid;
  grid-template-columns:auto 1fr auto;
  align-items:center;
  gap:18px;
  overflow:hidden;
  position:relative;
}
.pair-champion.winner{background:linear-gradient(135deg, #064e3b 0%, #059669 100%)}
.pair-champion.loser{background:linear-gradient(135deg, #7c2d12 0%, #c2410c 100%)}
.champion-icon{font-size:42px}
.pair-champion small{font-size:10px;letter-spacing:1px;font-weight:800;opacity:0.85}
.pair-champion h2{font-size:20px;margin:6px 0}
.pair-champion p{font-size:12px;opacity:0.9}
.pair-avatars{display:flex;margin:10px 0}
.pair-avatars .avatar+.avatar{margin-left:-8px}
.pair-leaderboards{display:grid;grid-template-columns:1fr 1fr;gap:20px}
.pair-rank-list{display:grid}
.pair-rank-row{
  display:grid;
  grid-template-columns:36px 58px 1fr auto;
  align-items:center;
  gap:10px;
  padding:12px 6px;
  border-bottom:1px solid var(--line);
}
.pair-rank-row:last-child{border-bottom:0}
.pair-mini-avatars{display:flex}
.pair-mini-avatars .avatar{width:32px;height:32px;font-size:11px}
.pair-mini-avatars .avatar+.avatar{margin-left:-8px}
.pair-rank-value{text-align:right}
.pair-rank-value b{font-size:16px;color:var(--primary)}

/* HEAD TO HEAD */
.h2h-section{margin-bottom:30px}
.h2h-section-title{display:flex;align-items:center;gap:12px;margin-bottom:14px}
.h2h-section-title>span{
  width:42px;
  height:42px;
  border-radius:12px;
  background:var(--primary-light);
  color:var(--primary);
  display:grid;
  place-items:center;
  font-size:20px;
}
.h2h-picker{display:grid;grid-template-columns:1fr 64px 1fr;align-items:end;gap:18px;margin-bottom:18px}
.h2h-vs{
  display:grid;
  place-items:center;
  width:52px;
  height:52px;
  margin:auto;
  border-radius:50%;
  background:var(--dark);
  color:#10b981;
  font-weight:900;
  font-size:16px;
}
.h2h-scoreboard{
  display:grid;
  grid-template-columns:1fr 1.2fr 1fr;
  align-items:center;
  text-align:center;
  background:linear-gradient(135deg, #091a27 0%, #0d3440 100%);
  color:#fff;
  margin-bottom:18px;
  padding:24px;
}
.h2h-player strong{font-size:42px;color:#34d399}
.h2h-center b{font-size:26px}
.h2h-month-filter{display:grid;gap:5px;margin-left:auto}
.h2h-month-filter select{min-width:190px}

/* FUND & TRANSACTIONS */
.fund-layout{display:grid;grid-template-columns:1.5fr .7fr;gap:20px;margin-bottom:20px}
.category-group+.category-group{margin-top:22px;padding-top:18px;border-top:1px solid var(--line)}
.category-title{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}
.category-list{display:flex;gap:8px;flex-wrap:wrap}
.category-chip{
  display:inline-flex;
  align-items:center;
  background:var(--surface2);
  border:1px solid var(--line);
  border-radius:99px;
  overflow:hidden;
  font-size:12px;
}
.category-chip.active{
  border-color:var(--primary);
  background:var(--primary-light);
  color:var(--primary);
  font-weight:700;
}
.category-filter{border:0;background:transparent;color:inherit;padding:7px 12px;cursor:pointer}
.category-remove{border:0;background:transparent;color:var(--red);padding:6px 10px 6px 0;cursor:pointer}
.status{padding:5px 9px;border-radius:99px;font-size:10px;font-weight:800;white-space:nowrap}
.status.paid{background:#dcfce7;color:#15803d}
.status.debt{background:#fee2e2;color:#b91c1c}
.payment-action{border:0;border-radius:99px;padding:7px 12px;font-size:10px;font-weight:800;white-space:nowrap}
.payment-action.debt{background:#fee2e2;color:#b91c1c}
.payment-action.paid{background:#dcfce7;color:#15803d}

/* MODALS & DIALOGS */
dialog{
  border:0;
  border-radius:22px;
  padding:0;
  width:min(820px,94vw);
  box-shadow:0 25px 60px -15px rgba(0,0,0,0.3);
  background:var(--surface);
  color:var(--ink);
}
dialog::backdrop{background:rgba(10, 25, 38, 0.65);backdrop-filter:blur(4px)}
.modal-head,.modal-actions{padding:20px 24px;display:flex;align-items:center;justify-content:space-between}
.modal-head{border-bottom:1px solid var(--line)}
.modal-actions{border-top:1px solid var(--line);gap:10px;justify-content:flex-end}
.close{
  border:0;
  background:var(--surface2);
  width:36px;
  height:36px;
  border-radius:50%;
  font-size:20px;
  color:var(--muted);
}
.modal-body{padding:22px 24px;display:grid;grid-template-columns:1fr 46px 1fr;gap:14px}
.modal-body.one-col{grid-template-columns:1fr}
.full{grid-column:1/-1}
.field{display:grid;gap:6px}
.field span{font-size:11px;color:var(--muted);font-weight:700;text-transform:uppercase;letter-spacing:0.5px}
.team-box{padding:16px;background:var(--surface2);border:1px solid var(--line);border-radius:16px;display:grid;gap:12px}
.team-a{border-top:3px solid var(--primary)}
.team-b{border-top:3px solid var(--ocean)}
.score-input input{height:54px;width:100%;border:0;border-radius:12px;background:var(--surface);font-size:24px;font-weight:800;text-align:center}
.special-row{display:flex;gap:10px}
.special-row label{flex:1}
.special-row input{display:none}
.special-row span{display:block;text-align:center;border:1px solid var(--line);border-radius:10px;padding:10px;font-weight:700}
.special-row input:checked+span{border-color:var(--primary);background:var(--primary-light);color:var(--primary)}
.calculation{background:#0a1926;color:#e2e8f0;border-radius:12px;padding:14px;font-size:12px;display:flex;justify-content:space-between}
.compact-modal{max-width:480px}
.danger{background:#fee2e2;color:#b91c1c;border:1px solid #fecaca;border-radius:11px;height:42px;padding:0 17px;font-weight:800}

/* MATCHMAKER DIALOG */
.matchmaker-dialog{width:min(1040px,96vw)}
.matchmaker-dialog-content{max-height:calc(88vh - 82px);padding:20px;overflow:auto}
.matchmaker-members{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}
.matchmaker-member input{display:none}
.matchmaker-member>span{
  display:grid;
  grid-template-columns:38px minmax(0,1fr);
  align-items:center;
  gap:2px 10px;
  padding:10px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--surface);
  cursor:pointer;
}
.matchmaker-member.selected>span{border-color:var(--primary);background:var(--primary-light)}
.matchmaker-actions{display:flex;align-items:center;justify-content:space-between;margin-top:16px}
.matchmaker-result{
  margin-top:18px;
  padding:20px;
  border-radius:18px;
  background:linear-gradient(135deg, #091a27 0%, #0d3840 100%);
  color:#fff;
}
.matchmaker-versus{display:grid;grid-template-columns:1fr 50px 1fr;align-items:center;text-align:center;margin:18px 0}

/* TOAST */
#toast{
  position:fixed;
  right:25px;
  bottom:25px;
  background:#091a27;
  color:#fff;
  border-radius:12px;
  padding:14px 20px;
  opacity:0;
  transform:translateY(15px);
  pointer-events:none;
  transition:0.25s;
  z-index:100;
  box-shadow:var(--shadow-lg);
  border:1px solid rgba(255,255,255,0.1);
}
#toast.show{opacity:1;transform:none}

/* DARK THEME */
.dark{
  --bg: #061019;
  --surface: #0a1a27;
  --surface2: #0f2436;
  --ink: #f1f5f9;
  --muted: #94a3b8;
  --line: #19354d;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}
.dark .topbar{background:rgba(10, 26, 39, 0.88)}
.dark .match-row{background:#0e2233}
.dark .match-row:hover{background:#122b40}
.dark .ranking-formula{background:#0c1f38;border-color:#1e3a5f;color:#93c5fd}

/* ==========================================================================
   MOBILE & TABLET RESPONSIVE OVERHAUL (Chuẩn đẹp, gọn gàng, không bị tràn)
   ========================================================================== */
@media(max-width: 1050px){
  .metric-grid{grid-template-columns:repeat(2,1fr)}
  .member-grid,.pair-grid{grid-template-columns:repeat(2,1fr)}
  .dashboard-grid{grid-template-columns:1fr}
  .search{display:none}
  .honor-grid{grid-template-columns:repeat(2,1fr)}
}

@media(max-width: 768px){
  /* LAYOUT CHUNG */
  .app{display:block}
  .content{padding:14px 12px 28px}
  main{padding-bottom:calc(76px + env(safe-area-inset-bottom, 0px))}

  /* TOPBAR MOBILE - Đẹp, không bị cụt hay gãy chữ */
  .topbar{
    height:auto;
    min-height:60px;
    padding:10px 14px;
    background:rgba(255,255,255,0.92);
    gap:8px;
  }
  .topbar>div:first-child{
    min-width:0;
    flex:1 1 auto;
  }
  .topbar .eyebrow{
    font-size:9px;
    letter-spacing:0.8px;
    margin-bottom:2px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  #pageTitle{
    font-size:16px;
    letter-spacing:-0.3px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  .top-actions{
    gap:6px;
    flex:0 0 auto;
  }
  /* Ẩn bớt các nút thừa ở header vì đã có nút nổi FAB dưới màn hình */
  .top-actions .search,
  .top-actions .primary,
  .top-actions .icon-btn,
  .matchmaker-shortcut{
    display:none!important;
  }
  .admin-access{
    height:34px;
    padding:0 10px;
    font-size:11px;
    white-space:nowrap;
    border-radius:9px;
  }

  /* BANNER TRANG CHỦ MOBILE */
  .team-banner{
    padding:18px 16px;
    border-radius:18px;
    margin-bottom:14px;
  }
  .atp-banner-content{
    flex-direction:column;
    align-items:flex-start;
    gap:12px;
  }
  .atp-banner-emblem{display:none}
  .atp-banner-text .badge-pill{
    font-size:9px;
    padding:4px 9px;
    margin-bottom:8px;
  }
  .atp-banner-text h2{
    font-size:20px!important;
    line-height:1.25;
    margin-bottom:6px;
    letter-spacing:-0.3px;
  }
  .atp-banner-text p{
    font-size:11px;
    line-height:1.5;
  }

  /* BẢNG VÀNG DANH DỰ (HONOR SECTION) TRÊN MOBILE */
  .honor-section{
    padding:18px 14px;
    border-radius:18px;
    margin-bottom:14px;
  }
  .honor-heading{
    flex-direction:column;
    align-items:flex-start;
    gap:6px;
    margin-bottom:14px;
  }
  .honor-heading h2{
    font-size:18px;
    line-height:1.3;
  }
  .honor-heading p:not(.eyebrow){
    font-size:11px;
    line-height:1.45;
  }
  .honor-detail{
    display:none!important; /* Ẩn chữ Xem bảng thành tích bị ép dọc bên phải */
  }
  /* Thẻ bảng vàng dạng hàng ngang cực gọn gàng */
  .honor-grid{
    grid-template-columns:1fr;
    gap:10px;
  }
  .honor-card{
    display:grid;
    grid-template-columns:60px minmax(0,1fr);
    align-items:center;
    gap:12px;
    padding:12px 14px;
    text-align:left;
    border-radius:15px;
  }
  .honor-medal{
    top:8px;
    right:10px;
    font-size:18px;
  }
  .honor-avatar{
    margin:0;
    justify-content:center;
  }
  .honor-avatar .avatar{
    width:56px;
    height:56px;
    border-width:2.5px;
    box-shadow:0 0 0 3px rgba(16, 185, 129, 0.2);
  }
  .honor-copy small{font-size:8.5px}
  .honor-copy h3{
    font-size:15px;
    margin:2px 0 3px;
  }
  .honor-copy b{font-size:11px}
  .honor-copy p{
    margin-top:4px;
    font-size:10px;
    line-height:1.4;
    display:-webkit-box;
    -webkit-box-orient:vertical;
    -webkit-line-clamp:2;
    overflow:hidden;
  }

  /* KHỐI SINH NHẬT TRÊN MOBILE */
  .birthday-banner{
    padding:14px 16px;
    border-radius:16px;
    margin-bottom:14px;
  }
  .birthday-head-title{font-size:12px}
  .birthday-head-desc{font-size:10.5px}
  .birthday-list{grid-template-columns:1fr;gap:8px}
  .birthday-item{padding:10px 12px;gap:10px}

  /* METRICS VÀ CARDS */
  .metric-grid{
    grid-template-columns:repeat(2,1fr);
    gap:9px;
    margin:14px 0;
  }
  .metric{
    padding:13px 12px;
    border-radius:14px;
  }
  .metric strong{font-size:18px;margin:8px 0 2px}
  .metric small{font-size:10px}
  .metric-icon{width:32px;height:32px;border-radius:9px;font-size:15px}

  .card{
    padding:16px 14px;
    border-radius:16px;
    overflow-x:auto;
  }
  .card-head{margin-bottom:14px}
  .card-head h2{font-size:15px}

  /* LỊCH SỬ TRẬN ĐẤU MOBILE */
  .match-row{
    grid-template-columns:56px minmax(70px, 1fr) 52px minmax(70px, 1fr);
    gap:6px;
    padding:10px 10px;
    border-radius:12px;
  }
  .match-row .badge{display:none} /* Ẩn nhãn chữ để dành chỗ cho tỉ số và tên cặp */
  .match-row.editable{
    grid-template-columns:56px minmax(70px, 1fr) 50px minmax(70px, 1fr);
  }
  .match-row.editable .badge.edit-badge{
    display:grid;
    grid-column:1/-1;
    margin-top:6px;
    justify-self:end;
  }
  .match-date{font-size:10px}
  .score{font-size:16px}
  .team{font-size:12px;line-height:1.3}

  /* BẢNG DỮ LIỆU CUỘN NGANG MƯỢT MÀ */
  .data-table{min-width:620px}

  /* CẶP ĐÔI & THÀNH VIÊN TRÊN MOBILE */
  .member-grid,.pair-grid{grid-template-columns:1fr;gap:12px}
  .pair-champions{grid-template-columns:1fr;gap:12px}
  .pair-champion{padding:18px;border-radius:16px}
  .pair-champion h2{font-size:17px}
  .pair-leaderboards{grid-template-columns:1fr;gap:14px}
  .fund-layout{grid-template-columns:1fr;gap:14px}

  /* ĐỐI ĐẦU TRỰC TIẾP TRÊN MOBILE */
  .h2h-picker{grid-template-columns:1fr;gap:12px}
  .h2h-vs{width:38px;height:38px;font-size:13px}
  .h2h-scoreboard{grid-template-columns:1fr 1fr;padding:16px 12px}
  .h2h-center{grid-column:1/-1;grid-row:2;margin-top:10px}
  .h2h-player strong{font-size:32px}
  .h2h-player .avatar{width:48px;height:48px}

  /* THANH ĐIỀU HƯỚNG DƯỚI ĐÁY MÀN HÌNH (BOTTOM NAV) */
  .sidebar{
    position:fixed;
    inset:auto 0 0 0;
    width:100%;
    height:calc(60px + env(safe-area-inset-bottom, 0px));
    padding:5px 4px calc(5px + env(safe-area-inset-bottom, 0px));
    z-index:99;
    flex-direction:row;
    background:#081622;
    border-top:1px solid rgba(255,255,255,0.1);
    box-shadow:0 -4px 18px rgba(0,0,0,0.3);
  }
  .sidebar nav{
    display:grid;
    grid-template-columns:repeat(7,1fr);
    width:100%;
    gap:1px;
    align-items:center;
  }
  .nav-item{
    padding:4px 1px;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:2px;
    text-align:center;
    font-size:8.5px;
    font-weight:700;
    border-radius:8px;
    color:#94a3b8;
    min-height:46px;
  }
  .nav-item span{font-size:15px;line-height:1;width:auto}
  .nav-item.active{
    background:linear-gradient(135deg, #059669 0%, #0284c7 100%);
    color:#fff;
    box-shadow:0 2px 6px rgba(5, 150, 105, 0.4);
  }

  /* NÚT NỔI THAO TÁC NHANH TRÊN MOBILE */
  .mobile-fab{
    display:grid;
    place-items:center;
    position:fixed;
    right:16px;
    bottom:calc(74px + env(safe-area-inset-bottom, 0px));
    width:48px;
    height:48px;
    border:0;
    border-radius:50%;
    background:linear-gradient(135deg, #059669 0%, #047857 100%);
    color:#fff;
    font-size:24px;
    font-weight:800;
    z-index:80;
    box-shadow:0 6px 16px rgba(5, 150, 105, 0.45);
  }
  .mobile-matchmaker-fab{
    display:grid;
    place-items:center;
    position:fixed;
    right:20px;
    bottom:calc(132px + env(safe-area-inset-bottom, 0px));
    width:40px;
    height:40px;
    border:1px solid rgba(16, 185, 129, 0.4);
    border-radius:50%;
    background:#0a1926;
    color:#34d399;
    font-size:17px;
    z-index:80;
    box-shadow:0 4px 12px rgba(0,0,0,0.3);
  }

  /* HỘP THOẠI MODAL TRÊN MOBILE */
  dialog{
    width:95vw;
    border-radius:18px;
    max-height:88vh;
  }
  .modal-head{padding:14px 16px}
  .modal-head h2{font-size:17px}
  .modal-body{
    padding:16px 14px;
    grid-template-columns:1fr;
    max-height:65vh;
    overflow-y:auto;
  }
  .modal-actions{padding:12px 14px}
  .special-row{flex-direction:column}
}
