/* =========================================================================
   Dahmous · dashboard design system
   A playful, high-contrast UI for a kids safety game. Uses logical CSS
   properties everywhere so Arabic (RTL) needs no overrides.
   ========================================================================= */

:root {
  --font-display: "Baloo Bhaijaan 2", "Cairo", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", "Baloo Bhaijaan 2", "Cairo", system-ui, sans-serif;

  --navy: #1f2b5b;
  --navy-2: #2b3a7a;
  --blue: #3e8bff;
  --blue-dark: #2a63c9;
  --blue-soft: #e4efff;
  --yellow: #ffc93c;
  --yellow-dark: #e0a800;
  --yellow-soft: #fff3cc;
  --coral: #ff6b6b;
  --coral-dark: #d94c4c;
  --coral-soft: #ffe3e3;
  --mint: #2ec4b6;
  --mint-dark: #1f9a8f;
  --mint-soft: #d8f6f2;
  --purple: #8e5cf6;
  --purple-soft: #ece3ff;
  --orange: #ff9f43;
  --orange-soft: #ffe9d2;
  --pink: #ff8fab;
  --pink-soft: #ffe1ea;
  --sky: #4cc9f0;
  --sky-soft: #dcf5fc;

  --bg: #fff8ec;
  --surface: #ffffff;
  --surface-2: #fdf6e7;
  --line: #f0e6d3;
  --line-strong: #e3d7bf;
  --text: #1f2b5b;
  --text-muted: #6b7392;
  --text-soft: #9aa1bb;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --shadow-sm: 0 2px 6px rgba(31, 43, 91, 0.06);
  --shadow: 0 8px 24px rgba(31, 43, 91, 0.08);
  --shadow-lg: 0 16px 40px rgba(31, 43, 91, 0.14);

  --sidebar-w: 268px;
  --topbar-h: 76px;
  --gutter: clamp(16px, 3vw, 32px);
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(255, 201, 60, 0.18) 0, transparent 22rem),
    radial-gradient(circle at 92% 14%, rgba(76, 201, 240, 0.16) 0, transparent 20rem),
    radial-gradient(circle at 80% 92%, rgba(255, 143, 171, 0.14) 0, transparent 22rem);
  background-attachment: fixed;
  min-height: 100vh;
}

[dir="rtl"] body { font-family: var(--font-display); }

h1, h2, h3, h4, h5, .display { font-family: var(--font-display); font-weight: 700; color: var(--navy); margin: 0; line-height: 1.2; }
h1 { font-size: clamp(1.6rem, 2.4vw, 2.1rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }
p { margin: 0 0 0.75rem; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
small, .text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.76rem; }
.text-lg { font-size: 1.1rem; }
.text-xl { font-size: 1.35rem; }
.text-muted { color: var(--text-muted); }
.text-soft { color: var(--text-soft); }
.text-navy { color: var(--navy); }
.text-blue { color: var(--blue); }
.text-coral { color: var(--coral); }
.text-mint { color: var(--mint-dark); }
.text-yellow { color: var(--yellow-dark); }
.text-purple { color: var(--purple); }
.text-orange { color: var(--orange); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.upper { text-transform: uppercase; letter-spacing: 0.06em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.text-start { text-align: start; }
.text-end { text-align: end; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
[x-cloak] { display: none !important; }

/* ---------- layout ---------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  border-start-end-radius: 32px;
  border-end-end-radius: 32px;
  box-shadow: 8px 0 30px rgba(31, 43, 91, 0.18);
  z-index: 60;
  transition: transform 0.25s ease;
  overflow-y: auto;
  scrollbar-width: thin;
}
[dir="rtl"] .sidebar { box-shadow: -8px 0 30px rgba(31, 43, 91, 0.18); }

.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 18px; color: #fff; text-decoration: none; }
.sidebar-brand:hover { text-decoration: none; }
.brand-mark {
  width: 48px; height: 48px; border-radius: 16px;
  background: var(--yellow);
  display: grid; place-items: center;
  font-size: 26px;
  box-shadow: 0 4px 0 var(--yellow-dark);
  flex-shrink: 0;
}
.brand-name { font-family: var(--font-display); font-size: 1.45rem; font-weight: 800; line-height: 1; }
.brand-tag { font-size: 0.72rem; color: rgba(255, 255, 255, 0.65); letter-spacing: 0.08em; text-transform: uppercase; }

.nav-section { font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255, 255, 255, 0.45); padding: 16px 14px 6px; font-weight: 700; }

.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin: 2px 0;
  border-radius: 14px;
  color: rgba(255, 255, 255, 0.86);
  text-decoration: none;
  font-weight: 600;
  font-family: var(--font-display);
  font-size: 0.98rem;
  transition: background 0.15s ease, transform 0.15s ease;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.1); color: #fff; text-decoration: none; transform: translateX(2px); }
[dir="rtl"] .nav-link:hover { transform: translateX(-2px); }
.nav-link.is-active { background: var(--yellow); color: var(--navy); box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15); }
.nav-link.is-active .nav-icon { background: rgba(31, 43, 91, 0.12); color: var(--navy); }
.nav-icon {
  width: 34px; height: 34px; border-radius: 11px; flex-shrink: 0;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.1);
}
.nav-icon svg { width: 18px; height: 18px; }
.nav-badge { margin-inline-start: auto; background: var(--coral); color: #fff; font-size: 0.7rem; padding: 1px 8px; border-radius: 999px; font-weight: 800; }
.nav-link.is-active .nav-badge { background: var(--navy); }

.sidebar-footer { margin-top: auto; padding-top: 16px; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 16px; background: rgba(255, 255, 255, 0.08); }
.sidebar-user .avatar { width: 38px; height: 38px; }
.sidebar-user .name { font-weight: 700; font-size: 0.9rem; line-height: 1.1; }
.sidebar-user .role { font-size: 0.72rem; color: rgba(255, 255, 255, 0.6); }

.main { flex: 1; min-width: 0; margin-inline-start: var(--sidebar-w); display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding-inline: var(--gutter);
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 248, 236, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.topbar .spacer { flex: 1; }
.topbar-title { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; color: var(--navy); }
.search-box { position: relative; width: min(340px, 100%); }
.topbar .search-box input[type="search"] { padding-inline-start: 42px; background: #fff; }
.search-box svg { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-soft); }

.icon-btn {
  width: 42px; height: 42px; border-radius: 14px; border: 2px solid var(--line);
  background: #fff; color: var(--navy); display: grid; place-items: center;
  cursor: pointer; position: relative; transition: transform 0.12s ease, box-shadow 0.12s ease; text-decoration: none;
}
.icon-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); text-decoration: none; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .dot { position: absolute; top: -4px; inset-inline-end: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--coral); color: #fff; font-size: 0.7rem; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--bg); }

.lang-switch { display: inline-flex; border: 2px solid var(--line); border-radius: 999px; background: #fff; padding: 3px; }
.lang-switch a { padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 0.82rem; color: var(--text-muted); text-decoration: none; font-family: var(--font-display); }
.lang-switch a.is-active { background: var(--navy); color: #fff; }

.content { padding: 8px var(--gutter) 48px; flex: 1; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 10px 0 24px; }
.page-head .lead { color: var(--text-muted); margin: 4px 0 0; max-width: 60ch; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 10px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.8rem; color: var(--text-soft); margin-bottom: 4px; }
.crumbs a { color: var(--text-muted); }

.menu-toggle { display: none; }

@media (max-width: 1023px) {
  .sidebar { transform: translateX(-105%); }
  [dir="rtl"] .sidebar { transform: translateX(105%); }
  .sidebar.is-open { transform: translateX(0); }
  .main { margin-inline-start: 0; }
  .menu-toggle { display: grid; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(31, 43, 91, 0.45); z-index: 55; backdrop-filter: blur(2px); }
  .search-box { display: none; }
}

/* ---------- cards ---------- */

.card {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 18px 22px 0; }
.card-head h2, .card-head h3 { font-size: 1.12rem; }
.card-head .sub { color: var(--text-muted); font-size: 0.83rem; margin: 2px 0 0; }
.card-body { padding: 18px 22px 22px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 12px 22px 18px; border-top: 1.5px solid var(--line); }
.card.tint-blue { background: linear-gradient(135deg, #f2f7ff, #e4efff); border-color: #d6e5ff; }
.card.tint-yellow { background: linear-gradient(135deg, #fff9e6, #fff1c7); border-color: #f5e3a8; }
.card.tint-mint { background: linear-gradient(135deg, #eafaf8, #d8f6f2); border-color: #bfebe4; }
.card.tint-coral { background: linear-gradient(135deg, #fff1f1, #ffe3e3); border-color: #ffc9c9; }
.card.tint-purple { background: linear-gradient(135deg, #f4efff, #ece3ff); border-color: #d9c8ff; }
.card.tint-navy { background: linear-gradient(135deg, var(--navy), var(--navy-2)); border-color: var(--navy); color: #fff; }
.card.tint-navy h1, .card.tint-navy h2, .card.tint-navy h3, .card.tint-navy h4 { color: #fff; }
.card.tint-navy .text-muted { color: rgba(255, 255, 255, 0.7); }

.stat {
  position: relative; overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 16px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-icon {
  width: 56px; height: 56px; border-radius: 18px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 26px;
  background: var(--yellow-soft);
}
.stat-icon svg { width: 26px; height: 26px; }
.stat-value { font-family: var(--font-display); font-size: 1.8rem; font-weight: 800; line-height: 1; color: var(--navy); }
.stat-label { color: var(--text-muted); font-size: 0.82rem; margin-top: 4px; font-weight: 600; }
.stat-delta { font-size: 0.76rem; font-weight: 700; margin-top: 6px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); }
.stat-delta.up { color: var(--mint-dark); background: var(--mint-soft); }
.stat-delta.down { color: var(--coral-dark); background: var(--coral-soft); }
.stat.blue { background: linear-gradient(135deg, #f2f7ff, #e4efff); border-color: #d6e5ff; }
.stat.blue .stat-icon { background: #fff; }
.stat.yellow { background: linear-gradient(135deg, #fff9e6, #fff1c7); border-color: #f5e3a8; }
.stat.yellow .stat-icon { background: #fff; }
.stat.mint { background: linear-gradient(135deg, #eafaf8, #d8f6f2); border-color: #bfebe4; }
.stat.mint .stat-icon { background: #fff; }
.stat.coral { background: linear-gradient(135deg, #fff1f1, #ffe3e3); border-color: #ffc9c9; }
.stat.coral .stat-icon { background: #fff; }
.stat.purple { background: linear-gradient(135deg, #f4efff, #ece3ff); border-color: #d9c8ff; }
.stat.purple .stat-icon { background: #fff; }
.stat.sky { background: linear-gradient(135deg, #eefafd, #dcf5fc); border-color: #bde9f6; }
.stat.sky .stat-icon { background: #fff; }
.stat.pink { background: linear-gradient(135deg, #fff2f6, #ffe1ea); border-color: #ffc6d6; }
.stat.pink .stat-icon { background: #fff; }
.stat.orange { background: linear-gradient(135deg, #fff5eb, #ffe9d2); border-color: #ffd7ae; }
.stat.orange .stat-icon { background: #fff; }

/* ---------- grid & spacing utilities ---------- */

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-side { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid-auto-lg { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
@media (max-width: 1280px) {
  .grid-4, .grid-5, .grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-3, .span-4 { grid-column: span 2; }
}
@media (max-width: 760px) {
  .grid-2, .grid-3, .grid-4, .grid-5, .grid-6, .grid-main, .grid-side { grid-template-columns: minmax(0, 1fr); }
  .span-2, .span-3, .span-4 { grid-column: span 1; }
}

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.col { flex-direction: column; }
.wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 6px; }
.gap-2 { gap: 10px; }
.gap-3 { gap: 16px; }
.gap-4 { gap: 24px; }
.grow { flex: 1; min-width: 0; }
.shrink-0 { flex-shrink: 0; }
.ms-auto { margin-inline-start: auto; }
.w-100 { width: 100%; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 28px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; } .mb-4 { margin-bottom: 28px; }
.p-0 { padding: 0; }
.hide { display: none !important; }
@media (max-width: 760px) { .hide-sm { display: none !important; } }
@media (min-width: 761px) { .only-sm { display: none !important; } }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  background: var(--blue);
  color: #fff;
  box-shadow: 0 4px 0 var(--blue-dark);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.05); text-decoration: none; color: #fff; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--blue-dark); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; }
.btn-sm { padding: 7px 14px; font-size: 0.85rem; }
.btn-sm svg { width: 16px; height: 16px; }
.btn-lg { padding: 13px 26px; font-size: 1.05rem; }
.btn-yellow { background: var(--yellow); color: var(--navy); box-shadow: 0 4px 0 var(--yellow-dark); }
.btn-yellow:hover, .btn-yellow:active { color: var(--navy); }
.btn-yellow:active { box-shadow: 0 1px 0 var(--yellow-dark); }
.btn-mint { background: var(--mint); box-shadow: 0 4px 0 var(--mint-dark); }
.btn-mint:active { box-shadow: 0 1px 0 var(--mint-dark); }
.btn-coral { background: var(--coral); box-shadow: 0 4px 0 var(--coral-dark); }
.btn-coral:active { box-shadow: 0 1px 0 var(--coral-dark); }
.btn-navy { background: var(--navy); box-shadow: 0 4px 0 #101a3d; }
.btn-navy:active { box-shadow: 0 1px 0 #101a3d; }
.btn-ghost { background: #fff; color: var(--navy); border: 2px solid var(--line-strong); box-shadow: 0 3px 0 var(--line-strong); }
.btn-ghost:hover { color: var(--navy); background: var(--surface-2); }
.btn-ghost:active { box-shadow: 0 1px 0 var(--line-strong); }
.btn-soft { background: var(--blue-soft); color: var(--blue-dark); box-shadow: none; }
.btn-soft:hover { color: var(--blue-dark); }
.btn-soft:active { transform: translateY(1px); box-shadow: none; }
.btn-soft.coral { background: var(--coral-soft); color: var(--coral-dark); }
.btn-soft.mint { background: var(--mint-soft); color: var(--mint-dark); }
.btn-soft.yellow { background: var(--yellow-soft); color: var(--yellow-dark); }
.btn-link { background: none; box-shadow: none; color: var(--blue); padding: 6px 8px; }
.btn-link:hover { color: var(--blue-dark); text-decoration: underline; }
.btn-link:active { transform: none; box-shadow: none; }
.btn-icon { padding: 8px; width: 38px; height: 38px; border-radius: 12px; }
.btn-icon svg { width: 17px; height: 17px; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ---------- badges & chips ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 0.74rem; font-weight: 800; letter-spacing: 0.02em;
  background: var(--surface-2); color: var(--text-muted);
  white-space: nowrap; line-height: 1.5;
}
.badge.blue { background: var(--blue-soft); color: var(--blue-dark); }
.badge.yellow { background: var(--yellow-soft); color: #9a7200; }
.badge.mint { background: var(--mint-soft); color: var(--mint-dark); }
.badge.coral { background: var(--coral-soft); color: var(--coral-dark); }
.badge.purple { background: var(--purple-soft); color: #6a3fd1; }
.badge.orange { background: var(--orange-soft); color: #c26a10; }
.badge.pink { background: var(--pink-soft); color: #c94f74; }
.badge.sky { background: var(--sky-soft); color: #1b8bb0; }
.badge.navy { background: var(--navy); color: #fff; }
.badge.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-lg { font-size: 0.85rem; padding: 5px 13px; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: #fff; border: 1.5px solid var(--line); font-size: 0.82rem; font-weight: 600; color: var(--text-muted); text-decoration: none; }
.chip:hover { border-color: var(--line-strong); color: var(--navy); text-decoration: none; }
.chip.is-active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- avatars ---------- */

.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--yellow-soft); display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; color: var(--navy); flex-shrink: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 30px; height: 30px; font-size: 0.8rem; }
.avatar.lg { width: 64px; height: 64px; font-size: 1.5rem; }
.avatar.xl { width: 96px; height: 96px; font-size: 2.4rem; border: 4px solid #fff; box-shadow: var(--shadow); }
.avatar.boy { background: var(--sky-soft); }
.avatar.girl { background: var(--pink-soft); }
.avatar.emoji { font-size: 1.3em; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid #fff; margin-inline-start: -10px; }
.avatar-stack .avatar:first-child { margin-inline-start: 0; }

.emoji-box { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; background: var(--surface-2); font-size: 24px; flex-shrink: 0; }
.emoji-box.lg { width: 64px; height: 64px; font-size: 34px; border-radius: 20px; }
.emoji-box.sm { width: 36px; height: 36px; font-size: 18px; border-radius: 12px; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }
.table { width: 100%; border-collapse: collapse; min-width: 640px; }
.table th { text-align: start; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-soft); font-weight: 800; padding: 14px 16px; border-bottom: 1.5px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fffdf7; }
.table .cell-main { font-weight: 700; color: var(--navy); }
.table .cell-sub { font-size: 0.78rem; color: var(--text-muted); }
.table .num { text-align: end; font-variant-numeric: tabular-nums; }
.table .actions { text-align: end; white-space: nowrap; }
.table .actions .btn-icon { margin-inline-start: 4px; }
.table.compact th, .table.compact td { padding: 9px 12px; }
.table-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-top: 1.5px solid var(--line); font-size: 0.85rem; color: var(--text-muted); }

/* ---------- forms ---------- */

.field { margin-bottom: 16px; }
.field label, .label { display: block; font-weight: 700; font-size: 0.85rem; color: var(--navy); margin-bottom: 6px; font-family: var(--font-display); }
.field .hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 5px; }
.field .error { font-size: 0.78rem; color: var(--coral-dark); margin-top: 5px; font-weight: 700; }
.req { color: var(--coral); }

.input, .select, .textarea,
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"],
input[type="tel"], input[type="url"], input[type="date"], input[type="datetime-local"], input[type="time"], select, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: #fff;
  border: 2px solid var(--line-strong);
  border-radius: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 44px;
}
input:focus, select:focus, textarea:focus, .input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(62, 139, 255, 0.18); }
input.is-invalid, select.is-invalid, textarea.is-invalid { border-color: var(--coral); }
textarea { min-height: 110px; resize: vertical; }
select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b7392' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 16px; padding-inline-end: 40px; }
[dir="rtl"] select { background-position: left 14px center; }
input[type="file"] { padding: 8px; }
input[type="file"]::file-selector-button { font: inherit; font-family: var(--font-display); font-weight: 700; border: 0; border-radius: 999px; padding: 6px 14px; background: var(--blue-soft); color: var(--blue-dark); margin-inline-end: 12px; cursor: pointer; }
input[type="range"] { padding: 0; min-height: auto; border: 0; accent-color: var(--blue); }
input[type="color"] { padding: 4px; width: 60px; min-height: 44px; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; accent-color: var(--blue); vertical-align: middle; }
.input-sm { min-height: 38px; padding: 6px 12px; font-size: 0.88rem; border-radius: 12px; }
.input-group { display: flex; align-items: stretch; }
.input-group > * { border-radius: 0; }
.input-group > :first-child { border-start-start-radius: 14px; border-end-start-radius: 14px; }
.input-group > :last-child { border-start-end-radius: 14px; border-end-end-radius: 14px; }
.input-addon { display: grid; place-items: center; padding: 0 14px; border: 2px solid var(--line-strong); background: var(--surface-2); font-weight: 700; color: var(--text-muted); border-inline-end: 0; }
.input-group .input-addon:last-child { border-inline-start: 0; border-inline-end: 2px solid var(--line-strong); }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 18px; }
@media (max-width: 760px) { .form-row, .form-row-3 { grid-template-columns: minmax(0, 1fr); } }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding-top: 8px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 46px; height: 26px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background 0.2s ease; flex-shrink: 0; }
.switch .track::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.2s ease; }
.switch input:checked + .track { background: var(--mint); }
.switch input:checked + .track::after { transform: translateX(20px); }
[dir="rtl"] .switch input:checked + .track::after { transform: translateX(-20px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px rgba(62, 139, 255, 0.25); }

.lang-tabs { display: inline-flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 999px; margin-bottom: 12px; }
.lang-tabs button { border: 0; background: transparent; padding: 5px 14px; border-radius: 999px; font: inherit; font-family: var(--font-display); font-weight: 700; color: var(--text-muted); cursor: pointer; }
.lang-tabs button.is-active { background: #fff; color: var(--navy); box-shadow: var(--shadow-sm); }

.emoji-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-picker button { width: 40px; height: 40px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-size: 20px; cursor: pointer; }
.emoji-picker button.is-active { border-color: var(--blue); background: var(--blue-soft); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 18px; }
.filters .field { margin-bottom: 0; min-width: 160px; }
.filters input, .filters select { min-height: 40px; padding: 6px 12px; border-radius: 12px; }

/* ---------- alerts & flash ---------- */

.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; border-radius: var(--radius); border: 1.5px solid; margin-bottom: 18px; font-weight: 600; }
.notice.success { background: var(--mint-soft); border-color: #a9e4dc; color: var(--mint-dark); }
.notice.info { background: var(--blue-soft); border-color: #bdd6ff; color: var(--blue-dark); }
.notice.warning { background: var(--yellow-soft); border-color: #f0dc9a; color: #8a6400; }
.notice.danger { background: var(--coral-soft); border-color: #ffbcbc; color: var(--coral-dark); }
.notice ul { margin: 4px 0 0; padding-inline-start: 18px; font-weight: 500; }

.toasts { position: fixed; bottom: 20px; inset-inline-end: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: center; font-weight: 600; animation: pop 0.25s ease; }
.toast.success { background: var(--mint-dark); }
.toast.danger { background: var(--coral-dark); }
.toast.warning { background: #b27b00; }
@keyframes pop { from { transform: translateY(12px) scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- progress, stars, meters ---------- */

.progress { height: 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--blue), var(--sky)); transition: width 0.4s ease; }
.progress.mint > span { background: linear-gradient(90deg, var(--mint), #7ee3d9); }
.progress.yellow > span { background: linear-gradient(90deg, var(--orange), var(--yellow)); }
.progress.coral > span { background: linear-gradient(90deg, var(--coral), var(--pink)); }
.progress.purple > span { background: linear-gradient(90deg, var(--purple), #b899ff); }
.progress.lg { height: 18px; }
.progress.sm { height: 8px; }

.stars { display: inline-flex; gap: 2px; font-size: 1rem; line-height: 1; color: var(--line-strong); }
.stars .on { color: var(--yellow); text-shadow: 0 1px 0 var(--yellow-dark); }
.stars.lg { font-size: 1.5rem; }

.score-ring { --v: 0; --c: var(--blue); width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--v) * 1%), var(--line) 0); position: relative; flex-shrink: 0; }
.score-ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: #fff; }
.score-ring span { position: relative; font-family: var(--font-display); font-weight: 800; color: var(--navy); font-size: 1.05rem; }
.score-ring.lg { width: 110px; height: 110px; }
.score-ring.lg span { font-size: 1.6rem; }
.score-ring.lg::before { inset: 10px; }

.meter-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.meter-row:last-child { border-bottom: 0; }
.meter-row .meter-label { width: 42%; min-width: 120px; font-weight: 700; font-size: 0.86rem; display: flex; align-items: center; gap: 8px; }
.meter-row .progress { flex: 1; }
.meter-row .meter-value { width: 48px; text-align: end; font-weight: 800; font-family: var(--font-display); font-size: 0.9rem; }

/* ---------- lists ---------- */

.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .title { font-weight: 700; color: var(--navy); }
.list-item .meta { font-size: 0.78rem; color: var(--text-muted); }
.list-item .end { margin-inline-start: auto; text-align: end; flex-shrink: 0; }
.list-item.unread { background: linear-gradient(90deg, rgba(255, 201, 60, 0.12), transparent); margin-inline: -12px; padding-inline: 12px; border-radius: 12px; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; inset-block: 8px; inset-inline-start: 19px; width: 2px; background: var(--line); }
.timeline li { position: relative; display: flex; gap: 14px; padding: 8px 0; }
.timeline .t-dot { width: 40px; height: 40px; border-radius: 14px; background: #fff; border: 2px solid var(--line); display: grid; place-items: center; font-size: 18px; flex-shrink: 0; position: relative; z-index: 1; }

/* ---------- empty state ---------- */

.empty { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty .big { font-size: 52px; line-height: 1; margin-bottom: 12px; }
.empty h3 { color: var(--navy); margin-bottom: 4px; }

/* ---------- tabs ---------- */

.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1.5px solid var(--line); margin-bottom: 18px; }
.tabs a, .tabs button { padding: 10px 16px; border: 0; background: none; font: inherit; font-family: var(--font-display); font-weight: 700; color: var(--text-muted); border-bottom: 3px solid transparent; margin-bottom: -1.5px; cursor: pointer; text-decoration: none; }
.tabs a.is-active, .tabs button.is-active { color: var(--navy); border-color: var(--yellow); }

/* ---------- modal ---------- */

.modal-backdrop { position: fixed; inset: 0; background: rgba(31, 43, 91, 0.5); backdrop-filter: blur(4px); z-index: 90; display: grid; place-items: center; padding: 20px; }
.modal { background: #fff; border-radius: var(--radius-xl); width: min(560px, 100%); max-height: 90vh; overflow: auto; box-shadow: var(--shadow-lg); animation: pop 0.2s ease; }
.modal.lg { width: min(820px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px 0; }
.modal-body { padding: 18px 24px 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 24px 24px; flex-wrap: wrap; }

/* ---------- dropdown ---------- */

.dropdown { position: relative; }
.dropdown-menu { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; min-width: 220px; background: #fff; border: 1.5px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 8px; z-index: 80; }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 12px; border: 0; background: none; font: inherit; font-weight: 600; color: var(--navy); text-align: start; cursor: pointer; text-decoration: none; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); text-decoration: none; }
.dropdown-menu svg { width: 18px; height: 18px; color: var(--text-muted); }
.dropdown-menu hr { border: 0; border-top: 1.5px solid var(--line); margin: 6px 0; }

/* ---------- pagination ---------- */

.pagination { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.pagination a, .pagination span { display: grid; place-items: center; min-width: 38px; height: 38px; padding: 0 10px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-weight: 700; color: var(--navy); text-decoration: none; font-size: 0.88rem; }
.pagination a:hover { border-color: var(--line-strong); text-decoration: none; }
.pagination .is-active span { background: var(--navy); color: #fff; border-color: var(--navy); }
.pagination .disabled span { color: var(--text-soft); background: var(--surface-2); }

/* ---------- level / product cards ---------- */

.level-card { display: flex; gap: 16px; align-items: flex-start; padding: 18px; border-radius: var(--radius-lg); background: #fff; border: 1.5px solid var(--line); position: relative; overflow: hidden; }
.level-card::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 8px; background: var(--accent, var(--blue)); }
.level-card .level-icon { width: 60px; height: 60px; border-radius: 20px; display: grid; place-items: center; font-size: 30px; background: color-mix(in srgb, var(--accent, var(--blue)) 18%, #fff); flex-shrink: 0; }
.level-card h3 { font-size: 1.05rem; }

.product-card { border-radius: var(--radius-lg); background: #fff; border: 1.5px solid var(--line); overflow: hidden; display: flex; flex-direction: column; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.product-card .thumb { aspect-ratio: 1 / 1; background: var(--surface-2); display: grid; place-items: center; font-size: 56px; position: relative; }
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-card .thumb .badge { position: absolute; top: 10px; inset-inline-start: 10px; }
.product-card .body { padding: 14px 16px 16px; }
.product-card .price { font-family: var(--font-display); font-weight: 800; color: var(--navy); font-size: 1.1rem; }

.rarity-common { color: var(--text-muted); }
.rarity-rare { color: var(--blue); }
.rarity-epic { color: var(--purple); }
.rarity-legendary { color: var(--orange); }

.kid-card { border-radius: var(--radius-lg); background: #fff; border: 1.5px solid var(--line); padding: 20px; text-align: center; position: relative; box-shadow: var(--shadow-sm); transition: transform 0.15s ease, box-shadow 0.15s ease; }
.kid-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.kid-card .avatar { margin: 0 auto 10px; }
.kid-card .kid-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.kid-card .kid-stat { background: var(--surface-2); border-radius: 14px; padding: 8px 4px; }
.kid-card .kid-stat b { display: block; font-family: var(--font-display); font-size: 1.1rem; color: var(--navy); }
.kid-card .kid-stat span { font-size: 0.7rem; color: var(--text-muted); font-weight: 700; }

.family-code { display: inline-flex; align-items: center; gap: 10px; background: #fff; border: 2px dashed var(--yellow-dark); border-radius: 16px; padding: 10px 18px; font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; letter-spacing: 0.15em; color: var(--navy); direction: ltr; }

.code-block { background: var(--navy); color: #d7e3ff; border-radius: 14px; padding: 14px 16px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.82rem; overflow: auto; direction: ltr; text-align: left; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 0.9rem; }
.kv dt { color: var(--text-muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 700; color: var(--navy); }

.chart-box { position: relative; width: 100%; height: 280px; }
.chart-box.sm { height: 200px; }
.chart-box.lg { height: 340px; }

.hero {
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  background: linear-gradient(120deg, var(--navy) 0%, var(--navy-2) 60%, #3a4d9a 100%);
  color: #fff; position: relative; overflow: hidden;
  margin-bottom: 24px;
}
.hero::after { content: "🦸"; position: absolute; inset-inline-end: 28px; bottom: -12px; font-size: 120px; opacity: 0.18; transform: rotate(-8deg); }
.hero h1 { color: #fff; }
.hero p { color: rgba(255, 255, 255, 0.75); max-width: 60ch; }
.hero .btn-yellow { box-shadow: 0 4px 0 var(--yellow-dark); }

.divider { border: 0; border-top: 1.5px solid var(--line); margin: 18px 0; }

/* ---------- auth pages ---------- */

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-art { background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 50%, #3a4d9a 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art .blob { position: absolute; border-radius: 50%; filter: blur(2px); opacity: 0.55; }
.auth-art .blob.b1 { width: 320px; height: 320px; background: var(--yellow); top: -120px; inset-inline-end: -80px; opacity: 0.35; }
.auth-art .blob.b2 { width: 260px; height: 260px; background: var(--pink); bottom: -100px; inset-inline-start: -60px; opacity: 0.35; }
.auth-art .blob.b3 { width: 180px; height: 180px; background: var(--mint); bottom: 120px; inset-inline-end: 60px; opacity: 0.3; }
.auth-art h1 { color: #fff; font-size: clamp(2rem, 3.4vw, 3rem); }
.auth-art p { color: rgba(255, 255, 255, 0.78); font-size: 1.05rem; max-width: 48ch; }
.auth-art .feature { display: flex; gap: 14px; align-items: center; background: rgba(255, 255, 255, 0.08); border-radius: 18px; padding: 12px 16px; margin-bottom: 10px; position: relative; }
.auth-art .feature .emoji { font-size: 26px; }
.auth-art .feature b { display: block; font-family: var(--font-display); }
.auth-art .feature span { font-size: 0.85rem; color: rgba(255, 255, 255, 0.7); }
.auth-form { display: grid; place-items: center; padding: 40px var(--gutter); }
.auth-card { width: min(440px, 100%); }
.auth-card h2 { font-size: 1.7rem; }
@media (max-width: 900px) {
  .auth-shell { grid-template-columns: minmax(0, 1fr); }
  .auth-art { display: none; }
}

/* ---------- hosted payment page ---------- */

.pay-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px var(--gutter); }
.pay-card { width: min(480px, 100%); }
.pay-summary { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 18px; background: var(--surface-2); margin-bottom: 18px; }
.pay-total { display: flex; justify-content: space-between; align-items: center; font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; padding: 12px 4px; border-top: 1.5px solid var(--line); }

/* ---------- print ---------- */

@media print {
  .sidebar, .topbar, .no-print, .toasts { display: none !important; }
  .main { margin: 0 !important; }
  body { background: #fff; }
  .card, .stat { box-shadow: none; break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
