@font-face {
  font-family: 'YearHandicrafts';
  src: url('/fonts/TheYearofHandicrafts-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'YearHandicrafts';
  src: url('/fonts/TheYearofHandicrafts-Medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'YearHandicrafts';
  src: url('/fonts/TheYearofHandicrafts-SemiBold.otf') format('opentype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'YearHandicrafts';
  src: url('/fonts/TheYearofHandicrafts-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'YearHandicrafts';
  src: url('/fonts/TheYearofHandicrafts-Black.otf') format('opentype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* Clean white theme — flat surfaces, soft shadows, one strong black accent. */
:root {
  --bg: #fafafa;
  --card: #ffffff;
  --border: #e8e8ec;
  --text: #0b0b0e;
  --muted: #77777f;
  --primary: #4f46e5;
  --primary-2: #7c3aed;
  --primary-hover: #4338ca;
  --focus: #3b82f6;
  --ink: #0b0b0e;
  --ink-hover: #242429;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --radius: 18px;
  --shadow-sm: 0 1px 2px rgba(16,16,20,.04), 0 1px 3px rgba(16,16,20,.05);
  --shadow-md: 0 8px 24px rgba(16,16,20,.06), 0 2px 6px rgba(16,16,20,.04);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  font-family: 'YearHandicrafts', "Segoe UI", Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.hidden { display: none !important; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d8d8dd; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #c2c2c9; }

/* ---- Gate (admin-key.html) ---- */
.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--bg);
}
.gate-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px 36px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.gate-box h1 { font-size: 1.3rem; margin: 0 0 6px; font-weight: 800; }
.gate-box p { color: var(--muted); margin: 0 0 20px; font-size: .9rem; }
.gate-box input {
  width: 100%;
  padding: 13px 14px;
  margin-bottom: 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font-size: .95rem;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.gate-box input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(11,11,14,.08);
}
.gate-box button { width: 100%; padding: 14px; font-size: .95rem; }
.error { color: var(--danger); font-size: 0.85rem; min-height: 1.2em; margin: 10px 0 0; }

.link-btn {
  display: block;
  background: none;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 12px 0 0;
  width: 100%;
  text-align: center;
  text-decoration: none;
  transition: color .15s;
}
.link-btn:hover { color: var(--text); }
.admin-link {
  display: block;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 500;
  text-align: center;
  margin-top: 10px;
}
.admin-link:hover { color: var(--text); text-decoration: underline; }

/* ---- Photo placeholder — swap for a real image later ---- */
.photo-placeholder {
  position: relative;
  border-radius: 20px;
  border: 1.5px dashed #d8d8dd;
  background: repeating-linear-gradient(135deg, #f2f2f4 0 12px, transparent 12px 24px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color .2s;
}
.photo-placeholder-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: #a6a6ae;
  font-size: .78rem;
  font-weight: 600;
}
.photo-placeholder-label .icon { font-size: 1.6rem; opacity: .7; }
.photo-placeholder:hover { border-color: #b8b8c0; }

/* ---- Logo marks ---- */
.brand-logo { height: 34px; width: auto; display: block; }
.gate-logo { height: 72px; width: auto; margin: 0 auto 8px; display: block; }
.hero-logo {
  height: 300px;
  width: auto;
  max-width: 88%;
  animation: float-logo 5s ease-in-out infinite;
}
@keyframes float-logo {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-logo { animation: none; }
}

/* ---- Login page (login-page.html) ---- */
.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Step 1: phone entry */
.screen-dark {
  background: var(--bg);
  color: var(--text);
}
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  padding: 20px 20px 0;
}
.hero-title {
  margin: 0;
  font-size: clamp(1.5rem, 6vw, 2.2rem);
  font-weight: 900;
  color: var(--text);
  min-height: 1.3em;
  max-width: 100%;
}
.hero-title::after {
  content: '';
  display: inline-block;
  width: 3px;
  height: .9em;
  margin-inline-start: 4px;
  background: var(--text);
  vertical-align: -.15em;
  animation: caret-blink 1s step-end infinite;
}
.hero-title.done::after { animation: caret-blink 1s step-end 4; }
@keyframes caret-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}
@media (max-width: 420px) {
  .hero-logo { height: 190px; }
}
.sheet {
  color: var(--text);
  padding: 0 28px 40px;
  text-align: center;
}
.sheet h1 { font-size: 1.3rem; margin: 0 0 6px; font-weight: 800; }
.sheet p { color: var(--muted); margin: 0 0 20px; font-size: .88rem; }
.sheet input {
  width: 50%;
  padding: 14px;
  margin-bottom: 14px;
  border: 1.5px solid transparent;
  border-radius: 14px;
  background: #f0f0f2;
  color: var(--text);
  font-size: .95rem;
  font-family: inherit;
  text-align: center;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.sheet input:focus {
  outline: none;
  background: var(--card);
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(11,11,14,.08);
}
.sheet button[type="submit"] {
  width: 50%;
  padding: 14px;
  font-size: .95rem;
  border-radius: 14px;
}
.tg-hint { color: var(--muted); font-size: .85rem; margin: 4px 0 14px; }
.tg-link-btn {
  display: block;
  width: 100%;
  padding: 14px;
  margin-bottom: 10px;
  border-radius: 14px;
  background: #229ED9;
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
  text-decoration: none;
  text-align: center;
  transition: background .15s;
}
.tg-link-btn:hover { background: #1b87ba; }

/* Step 2: OTP entry */
.screen-light {
  background: var(--bg);
  color: var(--text);
  position: relative;
}
.back-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 999px;
  transition: background .15s;
}
.back-btn:hover { background: #f0f0f2; }
.otp-content {
  flex: 1;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 90px 24px 24px;
  text-align: center;
}
.otp-content h1 { font-size: 1.3rem; margin: 0 0 8px; font-weight: 800; }
.otp-content p { color: var(--muted); margin: 0; font-size: .88rem; }
.phone-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 22px 0;
  font-size: .88rem;
}
.phone-row-label { color: var(--muted); }
.phone-row-value { font-weight: 700; }
.change-link {
  background: none;
  border: none;
  color: var(--primary);
  font-family: inherit;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  transition: color .15s;
}
.change-link:hover { color: var(--primary-hover); text-decoration: underline; }
.otp-boxes {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 24px 0;
}
.otp-box {
  width: 44px;
  height: 54px;
  text-align: center;
  font-size: 1.4rem;
  font-family: inherit;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.otp-box:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(11,11,14,.08);
  transform: translateY(-2px);
}
.resend-row { margin-top: 20px; font-size: .85rem; color: var(--muted); }
.link-inline {
  background: none;
  border: none;
  color: var(--primary);
  font-family: inherit;
  font-size: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  transition: color .15s;
}
.link-inline:hover:not(:disabled) { color: var(--primary-hover); text-decoration: underline; }
.link-inline:disabled { color: var(--muted); cursor: default; }
.submit-fixed {
  width: calc(100% - 48px);
  max-width: 372px;
  margin: 0 auto 28px;
  display: block;
  padding: 15px;
  font-size: .95rem;
  border-radius: 999px;
}
.submit-fixed:disabled {
  background: #ececef;
  color: var(--muted);
  cursor: default;
}

/* ---- Shell / sidebar layout ---- */
.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--card);
  border-left: 1px solid var(--border);
  color: var(--muted);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 22px;
}
.brand-name { font-weight: 800; font-size: 1.1rem; color: var(--text); }

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.tab-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  color: var(--muted);
  padding: 11px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-size: .9rem;
  font-family: inherit;
  text-align: right;
  transition: background .2s, color .2s, transform .2s;
}
.tab-btn:hover { background: var(--bg); color: var(--text); transform: translateX(-2px); }
.tab-btn.active {
  background: var(--ink);
  color: #fff;
  font-weight: 700;
}
.tab-btn.active:hover { transform: none; }
.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-icon svg { width: 18px; height: 18px; }

.logout {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 11px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-size: .85rem;
  font-family: inherit;
  transition: background .2s, color .2s;
}
.logout:hover { background: var(--bg); color: var(--text); }

.main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 32px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 { font-size: 1.25rem; margin: 0; font-weight: 800; }
.logout-topbar {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.logout-topbar svg { width: 18px; height: 18px; }
.logout-topbar:hover { background: #f0f0f2; }

main {
  max-width: 1100px;
  width: 100%;
  padding: 28px 32px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-panel.active > * {
  animation: rise-in .4s cubic-bezier(.16,1,.3,1) backwards;
}
.tab-panel.active > *:nth-child(1) { animation-delay: .02s; }
.tab-panel.active > *:nth-child(2) { animation-delay: .07s; }
.tab-panel.active > *:nth-child(3) { animation-delay: .12s; }
.tab-panel.active > *:nth-child(4) { animation-delay: .17s; }
.tab-panel.active > *:nth-child(n+5) { animation-delay: .22s; }
@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .tab-panel.active > * { animation: none !important; }
}

h2 { font-size: 1rem; margin: 24px 0 10px; font-weight: 700; color: var(--muted); }
h2:first-child { margin-top: 0; }
h3 { font-size: .95rem; margin: 20px 0 10px; color: var(--muted); font-weight: 700; }

/* ---- Home / overview tab ---- */
.home-greeting { margin-bottom: 22px; }
.home-greeting h2 {
  font-size: 1.5rem;
  margin: 0 0 4px;
  font-weight: 900;
  color: var(--text);
}
.home-subtitle { color: var(--muted); font-size: .9rem; margin: 0; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}
.stat-card { padding: 20px; }
.stat-card-label { color: var(--muted); font-size: .8rem; font-weight: 600; margin-bottom: 8px; }
.stat-card-value {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat-card-value.small-text { font-size: 1rem; font-weight: 700; line-height: 1.4; }
.stat-card-unit { font-size: .95rem; font-weight: 600; color: var(--muted); }

/* ---- Cards ---- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  margin-bottom: 18px;
  transition: box-shadow .2s, transform .2s, border-color .2s;
}
.card:hover {
  box-shadow: var(--shadow-md);
  border-color: #dcdce1;
  transform: translateY(-2px);
}
.table-card { padding: 0; overflow: hidden; }

.hero-stat {
  position: relative;
  border-radius: var(--radius);
  padding: 30px 30px 34px;
  margin-bottom: 18px;
  overflow: hidden;
  background: var(--ink);
  box-shadow: var(--shadow-md);
  transition: transform .2s;
}
.hero-stat:hover { transform: translateY(-2px); }
.hero-stat-label {
  position: relative;
  font-size: .85rem;
  color: rgba(255,255,255,.6);
  margin-bottom: 10px;
  font-weight: 600;
}
.hero-stat-value {
  position: relative;
  font-size: 3.2rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.hero-stat-unit {
  position: relative;
  font-size: 1.1rem;
  font-weight: 600;
  color: rgba(255,255,255,.6);
  margin-right: 6px;
}

/* ---- Forms ---- */
.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1 1 150px;
}
.field label {
  font-size: .78rem;
  color: var(--muted);
  font-weight: 600;
}
.inline-form input, .inline-form select {
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: .88rem;
  transition: border-color .15s, box-shadow .15s;
}
.inline-form input:focus, .inline-form select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(11,11,14,.08);
}

button {
  position: relative;
  overflow: hidden;
  background: var(--ink);
  color: #fff;
  border: none;
  padding: 11px 20px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.87rem;
  font-family: inherit;
  font-weight: 700;
  transition: background .15s, transform .15s, box-shadow .2s;
}
button::after {
  content: '';
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,.18), transparent);
  transform: skewX(-20deg);
  transition: left .55s ease;
  pointer-events: none;
}
button:hover::after { left: 130%; }
button:hover { background: var(--ink-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
button:active { transform: scale(.97); }
button.small {
  padding: 7px 14px;
  font-size: 0.78rem;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}
button.small:hover { background: var(--bg); box-shadow: none; transform: translateY(-1px); }
button.small + button.small { margin-inline-start: 6px; }
button.small.danger { color: var(--danger); border-color: rgba(220,38,38,.3); }
button.small.danger:hover { background: rgba(220,38,38,.08); }

.dinner-admin-card { background: var(--bg); border-style: dashed; }
.dinner-import-result { color: var(--muted); font-size: .85rem; margin: 10px 0 0; }

.team-cell { display: flex; align-items: center; gap: 8px; }
.team-logo { width: 22px; height: 22px; object-fit: contain; flex-shrink: 0; }

.hilal-matches-card { border-color: #1c3f94; box-shadow: 0 0 0 1px rgba(28,63,148,.15), var(--shadow-sm); }
.home-hilal-card { background: #1c3f94; }
.home-hilal-card .stat-card-label { color: rgba(255,255,255,.7); }
.home-hilal-card .stat-card-value { color: #fff; }

.edit-input {
  width: 100%;
  padding: 7px 9px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: .85rem;
  transition: border-color .15s, box-shadow .15s;
}
.edit-input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(11,11,14,.08);
}

/* ---- Tables ---- */
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  text-align: right;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.87rem;
}
th {
  color: var(--muted);
  font-weight: 700;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .02em;
  background: var(--bg);
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .15s; }
tbody tr:hover td { background: var(--bg); }
tr.clickable { cursor: pointer; }

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 700;
}
.badge-success { background: rgba(22,163,74,.1); color: var(--success); }
.badge-warning {
  background: rgba(217,119,6,.1);
  color: var(--warning);
  animation: pulse-badge 2.2s ease-in-out infinite;
}
@keyframes pulse-badge {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217,119,6,.25); }
  50% { box-shadow: 0 0 0 5px rgba(217,119,6,0); }
}
.badge-danger  { background: rgba(220,38,38,.1); color: var(--danger); }
.badge-neutral { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }

/* ---- Responsive: floating bottom nav capsule on mobile ---- */
@media (max-width: 860px) {
  .shell { display: block; }
  .sidebar {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    top: auto;
    height: auto;
    width: auto;
    max-width: calc(100vw - 24px);
    flex-direction: row;
    align-items: center;
    gap: 2px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255,255,255,.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-md);
    overflow-x: auto;
    z-index: 50;
  }
  .brand { display: none; }
  .nav { flex-direction: row; flex: none; gap: 2px; }
  .tab-btn { padding: 11px; border-radius: 999px; }
  .tab-btn span:last-child { display: none; }
  .logout-sidebar { display: none; }
  .logout-topbar { display: inline-flex; }
  main { padding: 18px; padding-bottom: 100px; }
  .topbar { padding: 16px 18px; }
  .hero-stat-value { font-size: 2.4rem; }
}
