:root {
  --primary: #6366f1;
  --primary2: #ec4899;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --sidebar: #0f172a;
  --radius: 18px;
}
* { font-family: 'Prompt', sans-serif; }
body { background: var(--bg); color: var(--text); }

/* ===== Buttons ===== */
.btn { border-radius: 12px; font-weight: 500; }
.btn-gradient {
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: #fff; border: 0; padding: .6rem 1.2rem;
  box-shadow: 0 8px 20px -6px rgba(99,102,241,.55);
  transition: transform .15s, box-shadow .15s;
}
.btn-gradient:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 12px 24px -6px rgba(236,72,153,.5); }
.btn-icon { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; }

/* ===== Auth ===== */
.auth-bg {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(circle at 10% 20%, #818cf8 0, transparent 40%),
              radial-gradient(circle at 90% 80%, #f472b6 0, transparent 40%),
              radial-gradient(circle at 80% 10%, #fbbf24 0, transparent 30%),
              #1e1b4b;
}
.auth-card {
  width: 100%; max-width: 420px; background: rgba(255,255,255,.95); backdrop-filter: blur(10px);
  border-radius: 24px; padding: 2.5rem 2rem; box-shadow: 0 30px 60px -15px rgba(0,0,0,.45);
}
.auth-logo {
  width: 76px; height: 76px; margin: -4.5rem auto 1rem; border-radius: 22px; font-size: 2.2rem; color: #fff;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  box-shadow: 0 14px 30px -8px rgba(236,72,153,.6);
}
.form-control, .form-select { border-radius: 12px; padding: .6rem .9rem; border-color: #e2e8f0; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 .2rem rgba(99,102,241,.15); }
.form-label { font-weight: 500; font-size: .9rem; color: #475569; }

/* ===== Layout ===== */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 260px; background: var(--sidebar); color: #cbd5e1;
  padding: 1.25rem 1rem; overflow-y: auto; z-index: 1040; transition: transform .25s;
}
.brand { display: flex; align-items: center; gap: .75rem; color: #fff; font-weight: 600; font-size: 1.05rem; margin-bottom: 1.5rem; padding: 0 .5rem; text-decoration: none; }
.brand-icon { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
  background: linear-gradient(135deg, var(--primary), var(--primary2)); }
.nav-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #64748b; margin: 1.2rem .75rem .4rem; }
.side-link { display: flex; align-items: center; gap: .75rem; padding: .65rem .85rem; border-radius: 12px; color: #cbd5e1; text-decoration: none; margin-bottom: 2px; transition: background .15s, color .15s; }
.side-link i { font-size: 1.1rem; }
.side-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-link.active { background: linear-gradient(135deg, var(--primary), var(--primary2)); color: #fff; box-shadow: 0 8px 18px -8px rgba(236,72,153,.7); }

.main { margin-left: 260px; min-height: 100vh; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.75rem; background: rgba(244,246,251,.85); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 1030; }
.content { padding: .5rem 1.75rem 2rem; }
.page-title { font-weight: 700; margin: 0; font-size: 1.45rem; }
.year-badge { background: #fff; border-radius: 999px; padding: .4rem .9rem; font-size: .85rem; box-shadow: 0 2px 8px rgba(15,23,42,.06); }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 600;
  background: linear-gradient(135deg, var(--primary), var(--primary2)); }
.menu-toggle { display: none; }
.overlay { display: none; }

@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: none; }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .overlay.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1035; }
  .topbar, .content { padding-left: 1rem; padding-right: 1rem; }
}

/* ===== Cards ===== */
.card-x { background: var(--card); border: 0; border-radius: var(--radius); box-shadow: 0 4px 24px -8px rgba(15,23,42,.08); }
.card-x .card-header { background: transparent; border-bottom: 1px solid #f1f5f9; padding: 1rem 1.25rem; font-weight: 600; }
.card-x .card-body { padding: 1.25rem; }

.stat { border-radius: var(--radius); padding: 1.25rem; color: #fff; position: relative; overflow: hidden; }
.stat::after { content: ''; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.15); }
.stat .num { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat .lbl { opacity: .9; font-size: .9rem; }
.stat i { position: absolute; right: 18px; bottom: 12px; font-size: 2.4rem; opacity: .35; }
.g1 { background: linear-gradient(135deg,#6366f1,#8b5cf6); }
.g2 { background: linear-gradient(135deg,#ec4899,#f43f5e); }
.g3 { background: linear-gradient(135deg,#10b981,#14b8a6); }
.g4 { background: linear-gradient(135deg,#f59e0b,#f97316); }

/* ===== Table ===== */
.table-x { margin: 0; }
.table-x thead th { background: #f8fafc; color: var(--muted); font-weight: 500; font-size: .85rem; border: 0; padding: .8rem 1rem; white-space: nowrap; }
.table-x td { padding: .75rem 1rem; vertical-align: middle; border-color: #f1f5f9; }
.table-x tbody tr:hover { background: #fafbff; }

.color-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: middle; box-shadow: 0 0 0 3px rgba(0,0,0,.05); }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 500; background: #eef2ff; color: #4f46e5; }
.chip.pink { background: #fdf2f8; color: #db2777; }
.chip.green { background: #ecfdf5; color: #059669; }
.chip.gray { background: #f1f5f9; color: #475569; }

/* ===== Color team cards ===== */
.team-card { border-radius: var(--radius); background: #fff; overflow: hidden; box-shadow: 0 4px 24px -8px rgba(15,23,42,.08); transition: transform .2s; }
.team-card:hover { transform: translateY(-4px); }
.team-card .band { height: 8px; }
.team-card .body { padding: 1.1rem 1.25rem; }

/* ===== Committee ===== */
.committee-card { text-align: center; padding: 1.25rem 1rem; border-radius: var(--radius); background: #fff; box-shadow: 0 4px 24px -8px rgba(15,23,42,.08); height: 100%; position: relative; }
.committee-card .pic { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto .75rem; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; color: #fff; }
.committee-card .role { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.committee-card .name { font-weight: 600; margin-top: .25rem; }
.committee-card.empty { border: 2px dashed #e2e8f0; box-shadow: none; background: transparent; color: #94a3b8; }

/* ===== Sport ===== */
.sport-icon { width: 46px; height: 46px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.35rem; color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary2)); }
.progress { height: 8px; border-radius: 99px; background: #f1f5f9; }
.progress-bar { border-radius: 99px; }

/* ===== Photo (หน้าตรง 3:4) ===== */
.photo { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 10px; overflow: hidden; background: #f1f5f9; color: #fff; font-weight: 600; box-shadow: 0 2px 8px -2px rgba(15,23,42,.18); }
.photo img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; transition: transform .2s; }
a.photo:hover img { transform: scale(1.06); }
.photo-empty { opacity: .9; }
.committee-card .photo { display: flex; margin: 0 auto .75rem; border-radius: 14px; border: 3px solid #fff; }
.photo-pick { display: flex; gap: 1rem; align-items: center; }
.photo-preview { width: 90px; height: 120px; border-radius: 14px; border: 2px dashed #cbd5e1; display: flex; align-items: center; justify-content: center; color: #94a3b8; font-size: 2rem; overflow: hidden; flex-shrink: 0; background: #f8fafc; cursor: pointer; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.athlete-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 1rem; padding: 1.25rem; }
.athlete-tile { text-align: center; position: relative; }
.athlete-tile .photo { width: 100% !important; height: auto !important; aspect-ratio: 3/4; border-radius: 14px; }
.athlete-tile .nm { font-weight: 600; font-size: .85rem; margin-top: .4rem; line-height: 1.3; }
.athlete-tile .sub { font-size: .72rem; color: var(--muted); }
.athlete-tile .acts { position: absolute; top: 6px; right: 6px; display: flex; flex-direction: column; gap: 4px; opacity: 0; transition: opacity .15s; }
.athlete-tile:hover .acts, .athlete-tile:focus-within .acts { opacity: 1; }
.athlete-tile .acts .btn { width: 30px; height: 30px; padding: 0; border-radius: 9px; background: rgba(255,255,255,.92); }
.athlete-tile.empty .slot { aspect-ratio: 3/4; border: 2px dashed #e2e8f0; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: #cbd5e1; font-size: 1.8rem; }
.no-photo-badge { position: absolute; left: 6px; top: 6px; }
@media (hover: none) { .athlete-tile .acts { opacity: 1; } }

.modal-content { border: 0; border-radius: 20px; }
.modal-header { border-bottom: 1px solid #f1f5f9; }
.modal-footer { border-top: 1px solid #f1f5f9; }
.alert { border: 0; border-radius: 14px; }
.empty-state { text-align: center; color: #94a3b8; padding: 2.5rem 1rem; }
.empty-state i { font-size: 2.5rem; display: block; margin-bottom: .5rem; }
