/* ==========================================================================
   Viking Sports Club — Academy Management System
   Clean SaaS/admin design system
   ========================================================================== */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-alt: #fafbfc;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-secondary: #475467;
  --text-muted: #667085;
  --text-faint: #98a2b3;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-text: #4338ca;

  --success: #12b76a;
  --success-light: #ecfdf3;
  --success-text: #027a48;

  --warning: #f79009;
  --warning-light: #fffaeb;
  --warning-text: #b54708;

  --danger: #f04438;
  --danger-light: #fef3f2;
  --danger-text: #b42318;

  --info: #0ba5ec;
  --info-light: #f0f9ff;
  --info-text: #026aa2;

  --violet: #7a5af8;
  --violet-light: #f4f3ff;
  --violet-text: #5925dc;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.1), 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, 0.1), 0 2px 4px -2px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 16px -4px rgba(16, 24, 40, 0.08), 0 4px 6px -2px rgba(16, 24, 40, 0.03);

  --sidebar-w: 248px;
  --topbar-h: 64px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
input, select, textarea { font-family: inherit; font-size: 14px; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d0d5dd; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #111827;
  color: #d1d5db;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 40;
  transition: transform .2s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand .logo-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #7a5af8);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 14px; flex-shrink: 0;
}
.sidebar-brand .brand-text { line-height: 1.2; }
.sidebar-brand .brand-text strong { display: block; color: #fff; font-size: 13.5px; font-weight: 700; }
.sidebar-brand .brand-text span { display: block; color: #9ca3af; font-size: 11px; margin-top: 1px; }

.sidebar-centre {
  margin: 12px 16px 4px;
  padding: 9px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; color: #cbd5e1; cursor: pointer;
}
.sidebar-centre:hover { background: rgba(255,255,255,0.1); }
.sidebar-centre .lbl { color: #9ca3af; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; display: block; margin-bottom: 2px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 12px; }
.sidebar-section-title {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: #6b7280; padding: 14px 10px 6px;
}
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: 13.3px; color: #cbd5e1; margin-bottom: 2px;
  font-weight: 500;
}
.sidebar-nav a .ic { width: 18px; height: 18px; flex-shrink: 0; opacity: .8; }
.sidebar-nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-nav a.active { background: var(--primary); color: #fff; }
.sidebar-nav a.active .ic { opacity: 1; }
.sidebar-nav a .badge-count {
  margin-left: auto; background: rgba(255,255,255,0.15); color: #fff;
  font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 10px;
}
.sidebar-nav a.active .badge-count { background: rgba(255,255,255,0.25); }

.sidebar-foot {
  padding: 12px; border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm);
}
.sidebar-user:hover { background: rgba(255,255,255,0.06); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary-text);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12.5px; flex-shrink: 0;
}
.sidebar-user .who { line-height: 1.25; min-width: 0; }
.sidebar-user .who strong { display: block; color: #fff; font-size: 12.8px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user .who span { display: block; color: #9ca3af; font-size: 11px; }
.sidebar-user .exit-link { margin-left: auto; color: #9ca3af; font-size: 15px; }

/* ---------- Main column ---------- */
.main-col { margin-left: var(--sidebar-w); flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 30;
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-title { font-size: 17px; font-weight: 700; }
.topbar-crumb { font-size: 12.5px; color: var(--text-muted); }
.topbar-crumb a:hover { color: var(--primary); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); position: relative;
}
.icon-btn:hover { background: var(--surface-alt); border-color: var(--border-strong); }
.icon-btn .dot { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); border: 1.5px solid var(--surface); }
.search-box {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 12px; width: 260px; color: var(--text-faint); background: var(--surface-alt);
  font-size: 13px;
}
.search-box:focus-within { border-color: var(--primary); }
.search-box input {
  border: none; background: transparent; outline: none; width: 100%;
  font-size: 13px; font-family: inherit; color: var(--text);
}
.search-box input::placeholder { color: var(--text-faint); }

.content { padding: 24px; flex: 1; }
.content-narrow { max-width: 880px; }

/* ---------- Responsive app shell (tablet / phone) ---------- */
.sidebar-toggle-btn { display: none; }
.sidebar-backdrop { display: none; }
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); z-index: 50; box-shadow: var(--shadow-lg); }
  .sidebar.open-mobile { transform: translateX(0); }
  .main-col { margin-left: 0; }
  .sidebar-toggle-btn { display: flex; }
  .sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(16, 24, 40, 0.45);
    z-index: 45;
  }
  .sidebar-backdrop.show { display: block; }
  .topbar { padding: 0 16px; }
  .search-box { display: none; }
  .content { padding: 16px; }
}
@media (max-width: 640px) {
  .page-head-actions { width: 100%; }
  .page-head-actions .btn { flex: 1; }
}

/* ---------- Print (invoices/receipts) ---------- */
@media print {
  .sidebar, .sidebar-backdrop, .topbar, .no-print { display: none !important; }
  .main-col { margin-left: 0 !important; }
  .content { padding: 0 !important; }
  body { background: #fff; }
  .card { border: 1px solid #ddd !important; box-shadow: none !important; }
}

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head .sub { color: var(--text-muted); font-size: 13.3px; margin-top: 4px; }
.page-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  border-radius: var(--radius-sm); padding: 9px 15px; font-size: 13.3px; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-alt); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-alt); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #d92d20; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Cards / grids ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-head h3 { font-size: 14.5px; }
.card-head .link { font-size: 12.5px; color: var(--primary); font-weight: 600; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-5 { grid-template-columns: repeat(3,1fr);} .grid-3 { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Stat tiles ---------- */
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; }
.stat-tile .stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.stat-tile .stat-label { font-size: 12.3px; color: var(--text-muted); font-weight: 600; }
.stat-tile .stat-ic { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.stat-tile .stat-value { font-size: 25px; font-weight: 700; letter-spacing: -0.02em; }
.stat-tile .stat-delta { font-size: 12px; font-weight: 600; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.stat-tile .stat-delta.up { color: var(--success-text); }
.stat-tile .stat-delta.down { color: var(--danger-text); }
.stat-tile .stat-delta.flat { color: var(--text-muted); }

.ic-bg-primary { background: var(--primary-light); color: var(--primary-text); }
.ic-bg-success { background: var(--success-light); color: var(--success-text); }
.ic-bg-warning { background: var(--warning-light); color: var(--warning-text); }
.ic-bg-danger { background: var(--danger-light); color: var(--danger-text); }
.ic-bg-info { background: var(--info-light); color: var(--info-text); }
.ic-bg-violet { background: var(--violet-light); color: var(--violet-text); }

/* ---------- Badges / pills ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 100px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; }
.badge-primary { background: var(--primary-light); color: var(--primary-text); }
.badge-success { background: var(--success-light); color: var(--success-text); }
.badge-warning { background: var(--warning-light); color: var(--warning-text); }
.badge-danger { background: var(--danger-light); color: var(--danger-text); }
.badge-info { background: var(--info-light); color: var(--info-text); }
.badge-violet { background: var(--violet-light); color: var(--violet-text); }
.badge-gray { background: #f2f4f7; color: var(--text-secondary); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.3px; }
.data-table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); font-weight: 600; padding: 10px 16px; border-bottom: 1px solid var(--border);
  background: var(--surface-alt); white-space: nowrap;
}
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-alt); }
.data-table .cell-main { font-weight: 600; color: var(--text); }
.data-table .cell-sub { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.row-avatar { display: flex; align-items: center; gap: 10px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.8px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.field .hint { font-size: 11.8px; color: var(--text-faint); margin-top: 5px; }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 13.5px; color: var(--text); background: var(--surface);
}
.input:focus, select.input:focus, textarea.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
textarea.input { resize: vertical; min-height: 80px; }
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }

/* 12-hour time picker (see time_select() in app_helper.php) */
.time-select { display: flex; align-items: center; gap: 6px; }
.time-select select.input { padding: 9px 6px; text-align: center; }
.time-select select.input:nth-of-type(3) { flex: 0 0 68px; }
.time-select-sep { font-weight: 700; color: var(--text-faint); }

/* Emoji icon picker (see icon_picker() in app_helper.php) */
.icon-picker { display: flex; align-items: flex-start; gap: 12px; position: relative; }
.icon-picker-toggle, .icon-picker-value { flex: 0 0 44px; text-align: center; font-size: 20px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; display: inline-flex; align-items:center; justify-content:center; }
.icon-picker-toggle { width: 44px; height: 44px; }
.icon-picker-value { display: none; }

.icon-opts { position: absolute; left: 0; top: 52px; right: 0; display: grid; grid-template-columns: repeat(auto-fill, 44px); gap: 10px; align-items: start; background: transparent; padding: 8px; box-sizing: border-box; }

/* Collapsed by default: hide options */
.icon-picker-collapsed .icon-opts { display: none; }

/* Expanded state: show options in a constrained, scrollable panel */
.icon-picker.open .icon-opts { display: grid; max-height: 220px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg); padding: 10px; z-index: 150; }
.icon-opt {
  width: 44px; height: 44px; font-size: 20px; line-height: 1; cursor: pointer; display:flex;align-items:center;justify-content:center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; transition: all .12s ease;
}
.icon-opt:hover { background: var(--surface-alt); border-color: var(--border-strong); transform: translateY(-2px); }
.icon-opt.active { border-color: var(--primary); box-shadow: 0 6px 18px rgba(12, 74, 255, 0.08); transform: translateY(-2px); }
.icon-opt:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Allow the modal to be resized vertically by the user */
.modal {
  resize: vertical;
  overflow: auto;
}

/* Visual hint: header is draggable/double-clickable to maximize */
.modal-head { cursor: ns-resize; }

/* Maxed modal state (double-click header to toggle) */
.modal-max {
  width: calc(100% - 40px) !important;
  max-width: none !important;
  height: calc(100vh - 40px) !important;
  max-height: none !important;
  border-radius: 8px;
}

/* Resize grip visual */
.modal::after {
  content: '';
  display: block;
  width: 12px; height: 12px;
  position: absolute; right: 12px; bottom: 12px; z-index: 120;
  background: linear-gradient(135deg, rgba(0,0,0,0.06) 25%, transparent 25%);
  border-radius: 2px; pointer-events: none;
}
.checkbox-row { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--text-secondary); margin-bottom: 10px; }
.checkbox-row input { margin-top: 3px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-btn { background: none; border: none; padding: 10px 4px; margin-right: 22px; font-size: 13.5px; font-weight: 600; font-family: inherit; color: var(--text-muted); border-bottom: 2px solid transparent; cursor: pointer; }
.tab-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.tab-btn.active { color: var(--primary); border-color: var(--primary); }
.tab-btn:hover:not(.active) { color: var(--text); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Kanban (Enquiry CRM) ---------- */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { flex: 0 0 268px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; max-height: calc(100vh - 220px); }
.kanban-col-head { padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.kanban-col-head .name { font-size: 12.8px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.kanban-col-body { padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.kanban-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow-sm); }
.kanban-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.kanban-card .kc-name { font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.kanban-card .kc-meta { font-size: 11.5px; color: var(--text-muted); margin-bottom: 8px; }
.kanban-card .kc-foot { display: flex; align-items: center; justify-content: space-between; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: 18px; }
.timeline-item::before { content: ""; position: absolute; left: -22px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); border: 2px solid var(--surface); box-shadow: 0 0 0 2px var(--primary); }
.timeline-item .t-time { font-size: 11px; color: var(--text-faint); margin-bottom: 2px; }
.timeline-item .t-body { font-size: 13px; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(16,24,40,0.45); backdrop-filter: blur(1px);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal { background: var(--surface); border-radius: var(--radius-lg); width: min(760px, calc(100% - 40px)); max-width: 760px; box-shadow: var(--shadow-lg); max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-sizing: border-box; }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 15.5px; }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1 1 auto; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; flex-shrink: 0; position: sticky; bottom: 0; background: linear-gradient(180deg, rgba(255,255,255,0), rgba(255,255,255,0)); }
.modal-close { color: var(--text-faint); font-size: 20px; line-height: 1; }

/* Make the modal wider on larger screens */
@media (min-width: 1100px) {
  .modal { max-width: 760px; }
}

/* Small viewport tweak: allow modal to align near top so it's easier to reach on short screens */
@media (max-height: 720px) {
  .modal-overlay { align-items: flex-start; padding-top: 14px; padding-bottom: 14px; }
  .modal { max-height: calc(100vh - 28px); }
}

/* Tweak the modal close 'X' to be a visible clickable control */
.modal-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 8px; cursor: pointer; user-select: none;
  border: 1px solid transparent; background: transparent; color: var(--text-faint);
}
.modal-close:hover { background: var(--surface-alt); color: var(--text); border-color: var(--border-strong); }
.modal-close:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Ensure footer always visible by keeping modal as a column flex container
   and letting .modal-body grow/shrink to available space. This avoids the
   Save/Cancel being pushed off-screen on smaller viewports. */

/* ---------- Progress / meters ---------- */
.meter { height: 8px; border-radius: 100px; background: #eef0f3; overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 100px; background: var(--primary); }
.skill-bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.skill-bar-row .skill-name { width: 130px; flex-shrink: 0; font-size: 12.8px; font-weight: 600; color: var(--text-secondary); }
.skill-bar-row .meter { flex: 1; }
.skill-bar-row .skill-val { width: 34px; text-align: right; font-size: 12px; font-weight: 700; color: var(--text-muted); }

/* ---------- Inline SVG line charts ---------- */
.chart-svg { width: 100%; height: auto; display: block; }
.chart-grid-line { stroke: var(--border); stroke-width: 1; }
.chart-axis-label { fill: var(--text-faint); font-size: 10.5px; font-family: inherit; }
.chart-line { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart-dot { fill: var(--primary); stroke: var(--surface); stroke-width: 2; }
.chart-area { fill: var(--primary-light); opacity: .6; }
.chart-value-label { fill: var(--text); font-size: 11px; font-weight: 700; font-family: inherit; }
.chart-point-tag { fill: var(--text-secondary); font-size: 10px; font-family: inherit; }

/* ---------- Calendar / timetable grid ---------- */
.tt-grid { display: grid; grid-template-columns: 76px repeat(6, 1fr); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.tt-grid .tt-head { background: var(--surface-alt); padding: 10px 8px; font-size: 11.5px; font-weight: 700; text-align: center; border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); color: var(--text-secondary); }
.tt-grid .tt-head:first-child { border-left: none; }
.tt-time { padding: 10px 8px; font-size: 11px; color: var(--text-faint); text-align: right; border-top: 1px solid var(--border); }
.tt-cell { border-top: 1px solid var(--border); border-left: 1px solid var(--border); min-height: 64px; padding: 5px; position: relative; }
.tt-block { border-radius: 7px; padding: 6px 8px; font-size: 11px; font-weight: 600; margin-bottom: 4px; line-height: 1.3; }

/* ---------- Empty / misc ---------- */
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 6px 12px; border-radius: 100px; border: 1px solid var(--border-strong); font-size: 12.5px; font-weight: 600; color: var(--text-secondary); background: var(--surface); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.list-simple li { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.list-simple li:last-child { border-bottom: none; }

.notif-item { display: flex; gap: 10px; padding: 12px; border-radius: var(--radius); }
.notif-item:hover { background: var(--surface-alt); }
.notif-item .n-ic { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.notif-item .n-title { font-size: 12.8px; font-weight: 600; }
.notif-item .n-time { font-size: 11px; color: var(--text-faint); margin-top: 2px; }

/* ---------- Login page ---------- */
.login-wrap { min-height: 100vh; display: flex; }
.login-side {
  flex: 1; background: linear-gradient(160deg, #081026, #0e2a63 130%);
  display: flex; align-items: center; justify-content: center; padding: 60px;
  color: #fff; position: relative; overflow: hidden;
}
.login-side::before {
  content: ""; position: absolute; width: 480px; height: 480px; border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,0.35), transparent 70%);
  top: -140px; right: -140px;
}
.login-side-inner { max-width: 380px; position: relative; z-index: 1; }
.login-side .logo-mark { width: 46px; height: 46px; border-radius: 12px; background: linear-gradient(135deg, var(--primary), #7a5af8); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; margin-bottom: 26px; }
.login-side h2 { font-size: 26px; line-height: 1.3; margin-bottom: 12px; }
.login-side p { color: #cbd5e1; font-size: 14px; line-height: 1.6; }
.login-side .stat-strip { display: flex; gap: 26px; margin-top: 36px; }
.login-side .stat-strip div strong { display: block; font-size: 20px; }
.login-side .stat-strip div span { font-size: 11.5px; color: #9ca3af; }

.login-form-col { width: 460px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--surface); padding: 40px; }
.login-form-inner { width: 100%; max-width: 340px; }
.login-form-inner h1 { font-size: 22px; margin-bottom: 6px; }
.login-form-inner .sub { color: var(--text-muted); font-size: 13.3px; margin-bottom: 26px; }

.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 24px; }
.role-card {
  border: 1.5px solid var(--border); border-radius: var(--radius); padding: 14px 12px;
  text-align: center; transition: all .12s ease;
}
.role-card:hover { border-color: var(--primary); background: var(--primary-light); }
.role-card .r-ic { font-size: 20px; margin-bottom: 6px; }
.role-card .r-name { font-size: 12.3px; font-weight: 700; }
.role-card .r-desc { font-size: 10.8px; color: var(--text-muted); margin-top: 2px; }

@media (max-width: 900px) { .login-side { display: none; } .login-form-col { width: 100%; } }

/* ==========================================================================
   Kid-friendly theme — used on parent-facing health & diet pages
   ========================================================================== */

.health-hero {
  background: linear-gradient(120deg, #eef2ff 0%, #f4f3ff 55%, #fff7ed 100%);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 28px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  overflow: hidden;
  margin-bottom: 20px;
}
.health-hero-text h1 { font-size: 25px; margin-bottom: 8px; }
.health-hero-text p { font-size: 13.5px; color: var(--text-secondary); max-width: 440px; line-height: 1.6; }
.health-hero-text .btn { margin-top: 16px; }
.health-hero-img { width: 300px; flex-shrink: 0; border-radius: 16px; }
@media (max-width: 900px) { .health-hero { flex-direction: column; text-align: center; } .health-hero-text p { max-width: none; } .health-hero-img { width: 220px; } }

/* Playful pastel card variants */
.kid-card { border-radius: 20px; border: 1px solid transparent; padding: 20px; }
.kid-card-blue { background: var(--info-light); }
.kid-card-violet { background: var(--violet-light); }
.kid-card-green { background: var(--success-light); }
.kid-card-orange { background: var(--warning-light); }
.kid-card-pink { background: #fdf2f8; }
.kid-card h3 { font-size: 14.5px; margin-bottom: 4px; }

/* Big friendly stat tiles with emoji icon roundels */
.kid-stat { border-radius: 18px; padding: 16px; text-align: center; }
.kid-stat .ks-emoji {
  width: 46px; height: 46px; border-radius: 50%; background: rgba(255,255,255,.65);
  display: flex; align-items: center; justify-content: center; font-size: 22px; margin: 0 auto 10px;
}
.kid-stat .ks-value { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.kid-stat .ks-label { font-size: 11.5px; font-weight: 600; color: var(--text-secondary); margin-top: 2px; }

/* BMI horizontal zone gauge */
.bmi-gauge { position: relative; margin: 30px 4px 10px; }
.bmi-gauge-track { display: flex; height: 16px; border-radius: 100px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.04); }
.bmi-gauge-seg { height: 100%; }
.bmi-gauge-seg.under { background: linear-gradient(90deg,#7dd3fc,#38bdf8); }
.bmi-gauge-seg.healthy { background: linear-gradient(90deg,#4ade80,#16a34a); }
.bmi-gauge-seg.over { background: linear-gradient(90deg,#fbbf24,#f59e0b); }
.bmi-gauge-seg.obese { background: linear-gradient(90deg,#fb7185,#e11d48); }
.bmi-gauge-pointer { position: absolute; top: -30px; transform: translateX(-50%); text-align: center; white-space: nowrap; }
.bmi-gauge-pointer .val { background: var(--text); color: #fff; font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 100px; }
.bmi-gauge-pointer .arrow { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid var(--text); margin: 2px auto 0; }
.bmi-gauge-labels { display: flex; margin-top: 8px; font-size: 10.8px; color: var(--text-faint); font-weight: 600; }
.bmi-gauge-labels span { flex: 1; text-align: center; }

/* Health history rows as friendly icon cards */
.health-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.health-row:last-child { border-bottom: none; }
.health-row .hr-ic { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.health-row .hr-label { font-size: 11.5px; color: var(--text-muted); font-weight: 600; }
.health-row .hr-value { font-size: 13px; font-weight: 600; margin-top: 1px; }

/* Prominent alert banner — used for allergy / safety-critical info that
   needs to outrank routine stats in the page hierarchy */
.health-alert { display: flex; align-items: center; gap: 16px; border-radius: 18px; padding: 18px 22px; border: 1.5px solid; margin-bottom: 20px; }
.health-alert .ha-ic { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 23px; flex-shrink: 0; background: rgba(255,255,255,.7); }
.health-alert h3 { font-size: 15px; margin-bottom: 3px; }
.health-alert p { font-size: 12.5px; color: var(--text-secondary); }
.health-alert .btn { flex-shrink: 0; }
.health-alert.safe { background: var(--success-light); border-color: #b3f0d0; }
.health-alert.warn { background: var(--warning-light); border-color: #fde8b0; }
.health-alert.danger { background: var(--danger-light); border-color: #fecdc9; }

/* Food chips — bigger, friendlier than the standard .chip */
.food-chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.food-chip { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 100px; font-size: 12.8px; font-weight: 700; }
.food-chip-yes { background: #ecfdf3; color: #027a48; border: 1.5px solid #b3f0d0; }
.food-chip-no { background: #fef3f2; color: #b42318; border: 1.5px solid #fecdc9; }

/* Meal plan timeline */
.meal-timeline { display: flex; flex-direction: column; gap: 12px; }
.meal-card { display: flex; align-items: flex-start; gap: 14px; border-radius: 16px; padding: 14px 16px; border: 1px solid var(--border); }
.meal-card .mc-emoji { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.meal-card .mc-name { font-size: 13.5px; font-weight: 700; }
.meal-card .mc-time { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 100px; background: rgba(255,255,255,.7); margin-left: 8px; }
.meal-card .mc-desc { font-size: 12.8px; color: var(--text-secondary); margin-top: 4px; line-height: 1.5; }
.meal-card.m-breakfast { background: #fffbeb; border-color: #fde8b0; }
.meal-card.m-snack1 { background: #ecfdf3; border-color: #c3f0d8; }
.meal-card.m-lunch { background: #eef2ff; border-color: #d6dcfb; }
.meal-card.m-snack2 { background: #fff7ed; border-color: #fbe0c0; }
.meal-card.m-recovery { background: #f0f9ff; border-color: #bfe6fa; }
.meal-card.m-dinner { background: #f4f3ff; border-color: #ded9fc; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); }
  .main-col { margin-left: 0; }
  .search-box { display: none; }
}
