:root{
  --bg:#0b0f17;
  --panel:#101827;
  --panel2:#0e1624;
  --text:#e8eefc;
  --muted:#a7b4d1;
  --border:rgba(255,255,255,.08);
  --accent:#ff2d2d;
  --accent2:#ff5c5c;

  --radius:16px;
  --shadow:0 10px 30px rgba(0,0,0,.35);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: radial-gradient(1200px 700px at 10% 10%, rgba(255,45,45,.10), transparent 55%),
              radial-gradient(1200px 700px at 90% 30%, rgba(255,92,92,.08), transparent 55%),
              var(--bg);
  color:var(--text);
}

a{ color:inherit; text-decoration:none; }
.muted{ color:var(--muted); }
.small{ font-size:.92rem; }
.strong{ font-weight:700; }
.nowrap{ white-space:nowrap; }
.wrap{ white-space:normal; word-break:break-word; }
.mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; font-size:.92rem; }

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

.sidebar{
  position:sticky;
  top:0;
  height:100vh;
  padding:18px;
  border-right:1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent 40%);
}

.brand{
  display:flex;
  gap:12px;
  align-items:center;
  margin-bottom:18px;
}
.brand-mark{
  width:44px; height:44px;
  border-radius:14px;
  display:grid; place-items:center;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  font-weight:900;
}
.brand-title{ font-weight:800; letter-spacing:.2px; }
.brand-subtitle{ color:var(--muted); font-size:.9rem; margin-top:2px; }

.nav{ display:flex; flex-direction:column; gap:8px; margin-top:10px; }
.nav-link{
  padding:10px 12px;
  border-radius:12px;
  border:1px solid transparent;
  background: rgba(255,255,255,.03);
}
.nav-link:hover{
  border-color: rgba(255,45,45,.25);
  background: rgba(255,45,45,.08);
}

.sidebar-footer{ margin-top:18px; }
.pill{
  display:inline-block;
  padding:8px 10px;
  border-radius:999px;
  font-size:.9rem;
  color:var(--muted);
  border:1px solid var(--border);
  background: rgba(255,255,255,.02);
}

.main{
  padding:18px 18px 40px;
}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:8px 2px 12px;
}
.page-title{
  margin:0;
  font-size:1.35rem;
  letter-spacing:.2px;
}

.content{
  display:flex;
  flex-direction:column;
  gap:14px;
}

.flash-wrap{ display:flex; flex-direction:column; gap:10px; }
.flash{
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
}
.flash.success{ border-color: rgba(46,204,113,.35); }
.flash.error{ border-color: rgba(255,45,45,.35); }

.filters{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:flex-end;
  padding:14px;
  border-radius: var(--radius);
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  box-shadow: var(--shadow);
}
.field{ display:flex; flex-direction:column; gap:6px; min-width:160px; }
.field.grow{ flex:1; min-width:220px; }
label{ font-size:.9rem; color:var(--muted); }
input,select,textarea{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(10,14,22,.55);
  color: var(--text);
  outline:none;
}
textarea{ resize:vertical; }
.actions{ display:flex; gap:10px; align-items:center; }

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  color: var(--text);
}
.btn:hover{
  border-color: rgba(255,45,45,.25);
}
.btn.primary{
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent;
  font-weight:700;
}
.btn.primary:hover{ filter: brightness(1.03); }
.small-input{ width:96px; }

.grid{
  display:grid;
  gap:14px;
}
.grid.two{ grid-template-columns: 1fr 1fr; }
.grid.kpis{ grid-template-columns: 1fr 1fr; }

.card{
  border-radius: var(--radius);
  border:1px solid var(--border);
  background: rgba(255,255,255,.03);
  box-shadow: var(--shadow);
  padding:14px;
}
.card-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}
.card h3{ margin:0; font-size:1.05rem; }

.card-label{ color:var(--muted); font-size:.95rem; }
.card-value{ font-size:1.9rem; font-weight:900; margin-top:6px; }

.table-wrap{
  overflow-x: auto; /* just in case */
  -webkit-overflow-scrolling: touch;
}

.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  table-layout: auto;
}
.table-fixed{ table-layout: fixed; }

.table th, .table td{
  text-align:left;
  padding:10px 10px;
  border-bottom:1px solid var(--border);
  vertical-align:top;
  white-space:normal;         /* key: no forced nowrap */
  word-break:break-word;      /* key: wrap long strings */
}
.table th{
  font-size:.85rem;
  color:var(--muted);
  letter-spacing:.2px;
}
.table tr:hover td{
  background: rgba(255,255,255,.02);
}
.num{ text-align:right; }

.subtext{
  color:var(--muted);
  font-size:.88rem;
  margin-top:4px;
}

.link{
  color: #ffd2d2;
  text-decoration: none;
}
.link:hover{ text-decoration: underline; }

.chips{ display:flex; gap:6px; flex-wrap:wrap; margin-top:6px; }
.chip{
  font-size:.78rem;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid rgba(255,45,45,.20);
  background: rgba(255,45,45,.08);
  color: #ffe3e3;
}

.details summary{
  cursor:pointer;
  color:#ffd2d2;
}
.details-body{
  margin-top:8px;
  padding:10px;
  border-radius:12px;
  border:1px solid var(--border);
  background: rgba(10,14,22,.35);
  color: var(--muted);
  max-width: 560px;
}

.badge{
  display:inline-flex;
  padding:4px 8px;
  border-radius:999px;
  font-size:.8rem;
  border:1px solid var(--border);
}
.badge.queued{ border-color: rgba(255,255,255,.18); }
.badge.sent{ border-color: rgba(46,204,113,.35); }
.badge.failed{ border-color: rgba(255,45,45,.35); }
.badge.skipped{ border-color: rgba(241,196,15,.35); }

.stats{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap:10px;
  margin:12px 0;
}
.stat{
  padding:10px;
  border-radius:14px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.02);
}
.stat-label{ color:var(--muted); font-size:.85rem; }
.stat-val{ font-size:1.2rem; font-weight:900; margin-top:6px; }

.pre{
  margin:0;
  padding:12px;
  border-radius:14px;
  border:1px solid var(--border);
  background: rgba(10,14,22,.35);
  color: var(--text);
  overflow:auto;
}

.kv{
  display:grid;
  grid-template-columns: 140px 1fr;
  gap:10px 12px;
}
.k{ color:var(--muted); }
.v{ color:var(--text); }

.clamp{
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* column widths for the fixed table */
.w-date{ width:140px; }
.w-order{ width:210px; }
.w-contact{ width:260px; }
.w-child{ width:220px; }
.w-by{ width:70px; }
.w-gender{ width:90px; }
.w-club{ width:180px; }
.w-items{ width:320px; }
.w-mods{ width:140px; }
.w-total{ width:110px; }

@media (max-width: 980px){
  .app{ grid-template-columns: 1fr; }
  .sidebar{
    position:relative;
    height:auto;
    border-right:none;
    border-bottom:1px solid var(--border);
  }
  .grid.two{ grid-template-columns: 1fr; }
  .grid.kpis{ grid-template-columns: 1fr 1fr; }
  .stats{ grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px){
  .grid.kpis{ grid-template-columns: 1fr; }
  .filters{ padding:12px; }
  .field{ min-width: 100%; }
  .actions{ flex-wrap:wrap; }
  .kv{ grid-template-columns: 1fr; }
}

/* GOAT GRID */

.player-grid{
display:grid;
grid-template-columns:repeat(auto-fill,minmax(260px,1fr));
gap:25px;
margin-top:30px;
}

.player-card{
background:#0f1724;
border-radius:14px;
overflow:hidden;
text-decoration:none;
color:white;
transition:all .25s ease;
box-shadow:0 6px 16px rgba(0,0,0,.4);
}

.player-card:hover{
transform:translateY(-6px);
box-shadow:0 12px 30px rgba(0,0,0,.6);
}

.card-image img{
width:100%;
height:220px;
object-fit:cover;
}

.card-body{
padding:18px;
}

.player-name{
font-size:20px;
margin-bottom:8px;
}

.player-meta{
display:flex;
gap:6px;
margin-bottom:12px;
}

.tag{
background:#1e293b;
padding:4px 8px;
border-radius:6px;
font-size:12px;
}

.club-info{
font-size:13px;
opacity:.9;
margin-bottom:10px;
}

.positions{
margin-bottom:10px;
}

.badge{
padding:5px 8px;
border-radius:6px;
font-size:12px;
margin-right:6px;
}

.badge.futsal{
background:#ef4444;
}

.badge.soccer{
background:#2563eb;
}

.instagram{
font-size:13px;
opacity:.8;
}

/* PROFILE PAGE */

.player-profile{
display:flex;
gap:40px;
margin-top:30px;
}

.profile-left{
width:280px;
text-align:center;
}

.profile-photo{
width:260px;
height:260px;
object-fit:cover;
border-radius:12px;
margin-bottom:15px;
}

.profile-tags span{
background:#1e293b;
padding:6px 10px;
border-radius:8px;
margin-right:6px;
font-size:12px;
}

.profile-right{
flex:1;
}

.profile-section{
margin-bottom:30px;
background:#0f1724;
padding:20px;
border-radius:12px;
}

.position-row{
margin-top:10px;
}

/* LOGIN PAGE */

.login-body{
background: var(--bg);
font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto;
display:flex;
align-items:center;
justify-content:center;
height:100vh;
color:var(--text);
}

.login-card{
background: var(--panel);
padding:40px;
width:320px;
border-radius:16px;
box-shadow: var(--shadow);
border:1px solid var(--border);
text-align:center;
}

.login-title{
margin-bottom:25px;
font-weight:700;
font-size:20px;
}

.login-card input{
width:100%;
padding:12px;
margin-bottom:15px;
border:1px solid var(--border);
border-radius:10px;
background:rgba(10,14,22,.55);
color:var(--text);
font-size:14px;
}

.login-card input:focus{
outline:none;
border-color:rgba(255,45,45,.4);
}

.login-card button{
width:100%;
padding:12px;
background:linear-gradient(135deg, var(--accent), var(--accent2));
color:#fff;
border:none;
border-radius:10px;
font-weight:700;
cursor:pointer;
}

.login-card button:hover{
filter:brightness(1.05);
}

/* USERS PAGE */

.users-container{
max-width:900px;
margin:auto;
}

.users-container .card{
background:rgba(255,255,255,.03);
border:1px solid var(--border);
border-radius:var(--radius);
padding:20px;
margin-bottom:25px;
box-shadow:var(--shadow);
}

.card h2{
margin-bottom:15px;
font-size:18px;
font-weight:600;
}

.users-table{
width:100%;
border-collapse:collapse;
}

.users-table th,
.users-table td{
padding:10px;
border-bottom:1px solid #eee;
text-align:left;
font-size:14px;
}

.users-table input,
.users-table select,
.card input,
.card select{
padding:8px 10px;
border:1px solid #d1d5db;
border-radius:6px;
margin-right:8px;
}

.card button,
.users-table button{
background:#111;
color:#fff;
border:none;
padding:8px 14px;
border-radius:6px;
cursor:pointer;
}

.card button:hover,
.users-table button:hover{
background:#333;
}

.role-admin{
color:#e11d48;
font-weight:600;
}

.role-staff{
color:#374151;
}
.menu-divider{
margin:15px 0;
border-top:1px solid #e5e7eb;
}

.logout{
color:#ef4444;
font-weight:500;
}

.logout:hover{
color:#dc2626;
}

/* Program Enrollment */
.enrollment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 220px));
  gap: 14px;
  padding: 4px 0;
}

.enrollment-card {
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.enrollment-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e5e7eb;
  line-height: 1.3;
}

.enrollment-count {
  font-size: 1.6rem;
  font-weight: 700;
  color: #a78bfa;
}

.enrollment-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.btn.small {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 5px;
}

/* Campaign channel badges */
.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}
.badge.email {
  background: #1e3a5f;
  color: #93c5fd;
}
.badge.sms {
  background: #1a3a2a;
  color: #4ade80;
}

/* CSV Drop Zone */
.csv-drop {
  border: 2px dashed #333;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}
.csv-drop:hover,
.csv-drop.drag-over {
  border-color: #a78bfa;
  background: #1a1a2e;
}
.csv-drop-inner {
  pointer-events: none;
}
.csv-drop .link {
  pointer-events: all;
  cursor: pointer;
}

/* Status badges for campaign_view */
.badge.queued  { background:#2a2a2a; color:#9ca3af; }
.badge.sent    { background:#1a3a2a; color:#4ade80; }
.badge.failed  { background:#3a1a1a; color:#f87171; }
.badge.skipped { background:#2a2a2a; color:#6b7280; }

/* Inline actions in card-head */
.actions-inline {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* GID Badge */
.gid-badge {
  display: inline-block;
  margin-top: 10px;
  background: #1e1b4b;
  color: #a78bfa;
  font-family: monospace;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid #4c1d95;
}

/* Awards */
.awards-section {
  margin-top: 24px;
}

.awards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.award-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #111;
  border: 1px solid #222;
  border-radius: 8px;
  padding: 10px 14px;
}

.award-icon {
  font-size: 1.4rem;
}

.award-type {
  font-weight: 600;
  color: #e5e7eb;
  font-size: 0.9rem;
}

.award-meta {
  margin-top: 2px;
}

/* User Cards */
.user-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.user-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid #1f1f1f;
}

.user-card-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #e5e7eb;
  margin-bottom: 4px;
}

.user-card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-card-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.field-label {
  font-size: 0.8rem;
  color: #6b7280;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 120px;
}
