/* Jiu Jitsu Martial Arts Qatar — main styles */
/* ===== Invoice alert cards (dashboard) ===== */
.invoice-alerts { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
@media (max-width: 640px) { .invoice-alerts { grid-template-columns: 1fr; } }
.alert-card { border-radius: var(--radius-lg); padding: 1rem 1.25rem; }
.alert-card.danger  { background: rgba(220,38,38,0.07); border: 1px solid rgba(220,38,38,0.22); }
.alert-card.warning { background: rgba(245,158,11,0.07); border: 1px solid rgba(245,158,11,0.22); }
.alert-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.alert-card-title { font-weight: 600; font-size: 14px; flex: 1; }
.alert-card-title.danger  { color: #dc2626; }
.alert-card-title.warning { color: #d97706; }
:root[data-theme="dark"] .alert-card-title.danger  { color: #f87171; }
:root[data-theme="dark"] .alert-card-title.warning { color: #fbbf24; }
.alert-badge { border-radius: 99px; padding: 2px 9px; font-size: 12px; font-weight: 700; }
.alert-badge.danger  { background: rgba(220,38,38,0.15); color: #dc2626; }
.alert-badge.danger:empty { display:none; }
.alert-badge.warning { background: rgba(245,158,11,0.15); color: #d97706; }
:root[data-theme="dark"] .alert-badge.danger  { color: #f87171; }
:root[data-theme="dark"] .alert-badge.warning { color: #fbbf24; }
.alert-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 0.5px solid var(--border-tertiary); cursor: pointer; }
.alert-row:last-child { border-bottom: none; }
.alert-row:hover { opacity: 0.8; }
.alert-row-name { font-size: 13px; font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-row-sub  { font-size: 11px; color: var(--text-tertiary); }
.alert-row-amt  { font-size: 13px; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
:root {
  --bg: #FAFAF7;
  --bg-card: #FFFFFF;
  --bg-secondary: #F4F2EC;
  --bg-tertiary: #EBE9E2;
  --text-primary: #1A1A19;
  --text-secondary: #5F5E5A;
  --text-tertiary: #888780;
  --border-tertiary: rgba(0,0,0,0.10);
  --border-secondary: rgba(0,0,0,0.20);
  --info-bg: #E6F1FB; --info-text: #0C447C;
  --success-bg: #EAF3DE; --success-text: #27500A; --success-border: #97C459;
  --warning-bg: #FAEEDA; --warning-text: #633806;
  --danger-bg: #FCEBEB; --danger-text: #791F1F;
  --radius-md: 8px; --radius-lg: 12px; --radius-xl: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,0.04);
}
/* Dark theme variables — reused by both the system-preference fallback (when
   no explicit choice is saved) and the manual [data-theme="dark"] override. */
:root[data-theme="dark"] {
  --bg: #131312; --bg-card: #1D1D1B; --bg-secondary: #252522; --bg-tertiary: #2E2E2A;
  --text-primary: #F1EFE8; --text-secondary: #B4B2A9; --text-tertiary: #888780;
  --border-tertiary: rgba(255,255,255,0.10); --border-secondary: rgba(255,255,255,0.20);
  --info-bg: rgba(55,138,221,0.15); --info-text: #B5D4F4;
  --success-bg: rgba(29,158,117,0.15); --success-text: #9FE1CB; --success-border: rgba(29,158,117,0.4);
  --warning-bg: rgba(239,159,39,0.15); --warning-text: #FAC775;
  --danger-bg: rgba(226,75,74,0.15); --danger-text: #F7C1C1;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #131312; --bg-card: #1D1D1B; --bg-secondary: #252522; --bg-tertiary: #2E2E2A;
    --text-primary: #F1EFE8; --text-secondary: #B4B2A9; --text-tertiary: #888780;
    --border-tertiary: rgba(255,255,255,0.10); --border-secondary: rgba(255,255,255,0.20);
    --info-bg: rgba(55,138,221,0.15); --info-text: #B5D4F4;
    --success-bg: rgba(29,158,117,0.15); --success-text: #9FE1CB; --success-border: rgba(29,158,117,0.4);
    --warning-bg: rgba(239,159,39,0.15); --warning-text: #FAC775;
    --danger-bg: rgba(226,75,74,0.15); --danger-text: #F7C1C1;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg); color: var(--text-primary);
  font-size: 14px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
input, textarea, select { font-family: inherit; color: var(--text-primary); }

.app { max-width: 1280px; margin: 0 auto; padding: 1.5rem 1.5rem 4rem; }
@media (max-width: 720px) { .app { padding: 1rem 1rem 3rem; } }

/* Header */
.app-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 500; }
.brand i { font-size: 24px; color: var(--info-text); }
.brand-logo { height: 38px; width: 38px; object-fit: contain; flex-shrink: 0; }
.brand-name { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.brand-sub { color: var(--text-secondary); font-size: 13px; font-weight: 400; margin-left: 4px; }
.cta { display: flex; gap: 8px; align-items: center; }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 0.5px solid var(--border-tertiary); margin-bottom: 1.5rem; overflow-x: auto; }
.tab { background: transparent; border: none; padding: 12px 16px; font-size: 14px; color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.tab i { font-size: 18px; }
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--text-primary); border-bottom-color: var(--text-primary); font-weight: 500; }
.tab-badge { background: var(--danger-bg); color: var(--danger-text); font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 500; }

/* Panels */
.panel { display: block; }
.panel.hidden { display: none; }

/* Cards */
.card { background: var(--bg-card); border: 0.5px solid var(--border-tertiary); border-radius: var(--radius-lg); padding: 1.25rem 1.5rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; gap: 12px; flex-wrap: wrap; }
.card-title { font-size: 15px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.card-link { font-size: 13px; color: var(--info-text); cursor: pointer; background: none; border: none; font-family: inherit; }
.card-link:hover { text-decoration: underline; }

/* Metric cards */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 1rem; }
@media (max-width: 800px) { .metrics { grid-template-columns: repeat(2, 1fr); } }
.rank-badge { width: 24px; height: 24px; border-radius: 50%; background: var(--bg-tertiary); color: var(--text-primary); font-weight: 600; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 24px; }
.metric { background: var(--bg-secondary); border-radius: var(--radius-md); padding: 14px 16px; }
.metric-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.metric-value { font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; }
.metric-delta { font-size: 12px; margin-top: 4px; display: inline-flex; align-items: center; gap: 3px; }
.up { color: var(--success-text); } .down { color: var(--danger-text); }

/* Grids */
.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 800px) { .twocol { grid-template-columns: 1fr; } }
.chartwrap { position: relative; height: 260px; }
.chartwrap-sm { position: relative; height: 200px; }
.compare-summary-strip { display: flex; align-items: center; gap: 0; margin-top: 14px; background: var(--bg-secondary); border-radius: var(--radius-md); padding: 12px 20px; }
.compare-summary-item { display: flex; align-items: center; gap: 10px; flex: 1; }
.compare-summary-divider { width: 1px; height: 36px; background: var(--border); margin: 0 20px; flex-shrink: 0; }
.compare-summary-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; min-width: 44px; }
.compare-summary-nums { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.compare-summary-prev { font-size: 13px; font-weight: 400; color: var(--text-secondary); }
.compare-summary-badge { font-size: 13px; font-weight: 600; padding: 3px 8px; border-radius: 20px; white-space: nowrap; }
.compare-summary-up   { color: var(--success-text); background: var(--success-bg); }
.compare-summary-down { color: var(--danger-text);  background: var(--danger-bg); }
.compare-summary-flat { color: var(--text-secondary); background: var(--border); }
.compare-summary-item--total { border-left: none; }
.compare-summary-item--total .compare-summary-label { color: var(--text-primary); }
.compare-summary-item--total .compare-summary-nums { font-size: 22px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 500; color: var(--text-secondary); font-size: 11px; padding: 10px 12px; border-bottom: 0.5px solid var(--border-tertiary); text-transform: uppercase; letter-spacing: 0.05em; }
.table td { padding: 12px; border-bottom: 0.5px solid var(--border-tertiary); }
.table tr:last-child td { border-bottom: none; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td { background: var(--bg-tertiary); }
.table-wrap { background: var(--bg-card); border: 0.5px solid var(--border-tertiary); border-radius: var(--radius-lg); overflow: hidden; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill-s { background: var(--success-bg); color: var(--success-text); }
.pill-w { background: var(--warning-bg); color: var(--warning-text); }
.pill-d { background: var(--danger-bg); color: var(--danger-text); }
.pill-i { background: var(--info-bg); color: var(--info-text); }
.pill-n { background: var(--bg-secondary); color: var(--text-secondary); }
.belt { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; text-transform: capitalize; }
.stripes { display: inline-flex; gap: 2px; margin-left: 2px; }
.stripe { width: 5px; height: 12px; border-radius: 1px; background: rgba(255,255,255,0.5); }
.stripe.off { background: rgba(0,0,0,0.18); }

/* Avatar */
.av { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 500; flex-shrink: 0; object-fit: cover; }
.av-m { background: var(--info-bg); color: var(--info-text); }
.av-f { background: #FBEAF0; color: #72243E; }
:root[data-theme="dark"] .av-f { background: rgba(212,83,126,0.25); color: #F4C0D1; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .av-f { background: rgba(212,83,126,0.25); color: #F4C0D1; }
}
.av-xl { width: 144px; height: 144px; font-size: 48px; position: relative; }
.av-cam { position: absolute; bottom: 4px; right: 4px; width: 38px; height: 38px; background: var(--bg-card); border: 0.5px solid var(--border-tertiary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--text-secondary); cursor: pointer; }
.av-cam:hover { background: var(--bg-secondary); color: var(--text-primary); }

/* Chips */
.chips { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.chip { padding: 6px 14px; border-radius: 999px; border: 0.5px solid var(--border-tertiary); background: transparent; font-size: 13px; cursor: pointer; color: var(--text-secondary); font-family: inherit; }
.chip:hover { color: var(--text-primary); }
.chip.active { background: var(--text-primary); color: var(--bg-card); border-color: var(--text-primary); }
.search { flex: 1; min-width: 160px; padding: 8px 12px; font-size: 13px; height: 34px; border: 0.5px solid var(--border-tertiary); border-radius: var(--radius-md); background: var(--bg-card); }
.search:focus { outline: none; border-color: var(--info-text); }

/* Buttons */
.btn { background: transparent; border: 0.5px solid var(--border-secondary); padding: 7px 14px; border-radius: var(--radius-md); font-size: 13px; cursor: pointer; color: var(--text-primary); font-family: inherit; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: var(--bg-secondary); }
.btn.primary { background: var(--text-primary); color: var(--bg-card); border-color: var(--text-primary); }
.btn.primary:hover { opacity: 0.9; }
.btn.wa { background: var(--success-bg); color: var(--success-text); border-color: var(--success-border); }
.btn.wa.primary { background: #1D9E75; color: white; border-color: #1D9E75; }
.btn.danger { background: rgba(220,38,38,0.08); color: #dc2626; border-color: rgba(220,38,38,0.3); }
.btn.danger:hover { background: rgba(220,38,38,0.15); }
:root[data-theme="dark"] .btn.danger { color: #f87171; border-color: rgba(248,113,113,0.3); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.btn-ghost { background: transparent; border-color: var(--border-secondary); color: var(--text-secondary); }
.btn.btn-ghost:hover { background: var(--bg-secondary); color: var(--text-primary); }
.btn.btn-danger { background: var(--danger-bg, #fee2e2); color: var(--danger-text, #b91c1c); border-color: var(--danger-border, #fca5a5); }
.btn.btn-danger:hover { background: var(--danger-text, #b91c1c); color: #fff; }
.btn.btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }

/* Recent / row items */
.row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 0.5px solid var(--border-tertiary); font-size: 14px; }
.row:last-child { border-bottom: none; }
.row.clickable { cursor: pointer; border-radius: var(--radius-md); margin: 0 -8px; padding: 12px 8px; }
.row.clickable:hover { background: var(--bg-tertiary); }
.row-name { font-weight: 500; }
.row-time { color: var(--text-secondary); font-size: 12px; }
.name-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amount { font-weight: 500; font-variant-numeric: tabular-nums; }
.meta { font-size: 12px; color: var(--text-tertiary); }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--text-secondary); }

/* Profile detail */
.profile-head { display: flex; gap: 24px; align-items: center; margin-bottom: 24px; }
@media (max-width: 600px) { .profile-head { flex-direction: column; text-align: center; } }
.profile-name { font-size: 24px; font-weight: 500; margin-bottom: 8px; }
.profile-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.profile-sub { font-size: 13px; color: var(--text-secondary); }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
@media (max-width: 600px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-card { background: var(--bg-secondary); border-radius: var(--radius-md); padding: 14px 16px; }
.detail-label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.detail-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; padding: 6px 0; gap: 8px; }
.detail-row > span:first-child { color: var(--text-secondary); flex-shrink: 0; }
.detail-row > span:last-child, .detail-row > strong { font-weight: 500; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.input { height: 32px; padding: 6px 10px; font-size: 13px; min-width: 0; width: 65%; text-align: right; border: 0.5px solid var(--border-secondary); border-radius: var(--radius-md); background: var(--bg-card); }
.input:focus { outline: none; border-color: var(--info-text); }
.input.full { width: 100%; text-align: left; }
.notes { width: 100%; min-height: 100px; padding: 12px 14px; font-size: 14px; line-height: 1.7; resize: vertical; border: 0.5px solid var(--border-secondary); border-radius: var(--radius-md); background: var(--bg-card); }
.notes:focus { outline: none; border-color: var(--info-text); }
.notes-meta { font-size: 11px; color: var(--text-tertiary); margin-top: 6px; display: flex; align-items: center; gap: 4px; }

/* Promotion */
.promo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 1rem; }
@media (max-width: 600px) { .promo-grid { grid-template-columns: 1fr; } }
.promo-stat { background: var(--bg-secondary); border-radius: var(--radius-md); padding: 14px 16px; border-left: 4px solid; }
.promo-stat.r { border-color: #1D9E75; }
.promo-stat.a { border-color: #EF9F27; }
.promo-stat.n { border-color: #888780; }
.promo-stat-num { font-size: 24px; font-weight: 500; font-variant-numeric: tabular-nums; }
.promo-stat-lbl { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.promo-row { display: grid; grid-template-columns: 1fr 180px auto; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 0.5px solid var(--border-tertiary); font-size: 14px; cursor: pointer; border-radius: var(--radius-md); margin: 0 -8px; padding: 12px 8px; }
.promo-row:last-child { border-bottom: none; }
.promo-row:hover { background: var(--bg-tertiary); }
@media (max-width: 600px) { .promo-row { grid-template-columns: 1fr; gap: 6px; } }
.bar { height: 10px; border-radius: 5px; background: var(--bg-secondary); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; transition: width 0.4s ease; }
.bar-fill.r { background: #1D9E75; }
.bar-fill.a { background: #EF9F27; }
.bar-fill.n { background: #B4B2A9; }

/* ===== Grading readiness traffic-light card ===== */
.grading-card .detail-label { margin-bottom: 0; }
.grading-criteria {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.gc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
}
.gc-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.gc-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.75;
  line-height: 1.2;
}
.gc-val {
  font-weight: 600;
  font-size: 15px;
  margin-top: 2px;
}
.gc-green { background: #E3F5EE; color: #145C3F; }
.gc-green .gc-dot { background: #1D9E75; }
.gc-amber { background: #FFF3DC; color: #7A4A00; }
.gc-amber .gc-dot { background: #EF9F27; }
.gc-red   { background: #FFEEED; color: #8B1E1A; }
.gc-red   .gc-dot { background: #D44035; }

[data-theme="dark"] .gc-green { background: #0E3326; color: #5DD6A6; }
[data-theme="dark"] .gc-amber { background: #3D2800; color: #F5C36A; }
[data-theme="dark"] .gc-red   { background: #3D0E0D; color: #F07B76; }

/* ===== Documents / indemnity card ===== */
.docs-card .meta { font-size: 12px; }
.doc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 0.5px solid var(--border-tertiary);
}
.doc-row:last-child { border-bottom: none; }
.doc-name { flex: 1; min-width: 0; overflow: hidden; }
.doc-name a {
  color: var(--info-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.doc-name a:hover { text-decoration: underline; }
.doc-name .meta { display: block; margin-top: 2px; }
.bar-meta { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }

/* Notifications */
.notif { display: flex; align-items: flex-start; gap: 14px; padding: 16px 0; border-bottom: 0.5px solid var(--border-tertiary); }
.notif:last-child { border-bottom: none; }
.notif-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 18px; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.notif-sub { font-size: 13px; color: var(--text-secondary); margin-bottom: 10px; }
.notif-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* WA template card */
.wa-card { background: var(--success-bg); border: 0.5px solid var(--success-border); border-radius: var(--radius-lg); padding: 14px 16px; }
.wa-meta { font-size: 12px; color: var(--success-text); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; font-weight: 500; }
.wa-text { font-size: 14px; color: var(--success-text); line-height: 1.7; white-space: pre-wrap; }

/* Toast */
.toast { background: var(--success-bg); border: 0.5px solid var(--success-border); color: var(--success-text); padding: 12px 16px; border-radius: var(--radius-md); font-size: 14px; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.toast.error { background: var(--danger-bg); color: var(--danger-text); border-color: var(--danger-text); }

/* Legend */
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-secondary); margin-top: 10px; flex-wrap: wrap; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: middle; }

/* Login */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card { background: var(--bg-card); border: 0.5px solid var(--border-tertiary); border-radius: var(--radius-xl); padding: 2rem; max-width: 400px; width: 100%; box-shadow: var(--shadow); }
.login-logo-wrap { display: flex; justify-content: center; margin-bottom: 1rem; }
.login-logo { width: 96px; height: 96px; object-fit: contain; }
.login-card h1 { font-size: 22px; font-weight: 500; margin: 0 0 6px; text-align: center; }
.login-card h1 i { color: var(--info-text); }
.login-card p { color: var(--text-secondary); margin: 0 0 1.5rem; font-size: 14px; text-align: center; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.field input { width: 100%; padding: 10px 12px; font-size: 14px; border: 0.5px solid var(--border-secondary); border-radius: var(--radius-md); background: var(--bg-card); height: 40px; }
.field input:focus { outline: none; border-color: var(--info-text); }

.link-name { text-decoration: none; color: inherit; }
.link-name:hover { text-decoration: underline; }

/* Modal (used by "Add student") */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 9998;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  animation: modal-fade 0.15s ease-out;
}
.modal-card {
  background: var(--bg-card); border: 0.5px solid var(--border-tertiary);
  border-radius: var(--radius-xl); padding: 1.25rem 1.5rem;
  width: 100%; max-width: 440px; box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  animation: modal-pop 0.18s ease-out;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 1.25rem; }
.modal-card .field { margin-bottom: 14px; }
.modal-card .field label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.modal-card .field input { width: 100%; padding: 10px 12px; font-size: 14px; height: 40px; border: 0.5px solid var(--border-secondary); border-radius: var(--radius-md); background: var(--bg-card); color: var(--text-primary); }
.modal-card .field input:focus { outline: none; border-color: var(--info-text); }
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* Segmented control (used inside modal) */
.seg { display: flex; gap: 6px; }
.seg-btn {
  flex: 1; padding: 8px 12px; border-radius: var(--radius-md);
  border: 0.5px solid var(--border-tertiary); background: transparent;
  color: var(--text-secondary); font-family: inherit; font-size: 13px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.seg-btn:hover { color: var(--text-primary); background: var(--bg-secondary); }
.seg-btn.active { background: var(--text-primary); color: var(--bg-card); border-color: var(--text-primary); }

/* Import box */
.import-box { background: var(--info-bg); border: 0.5px solid var(--border-tertiary); border-radius: var(--radius-lg); padding: 16px 18px; margin-bottom: 12px; }
.import-box h4 { margin: 0 0 8px; font-size: 15px; font-weight: 500; color: var(--info-text); }
.import-box ol { margin: 0 0 12px; padding-left: 20px; font-size: 13px; color: var(--info-text); line-height: 1.8; }
.import-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Import preview table */
.import-preview-table { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.import-preview-table th { background: var(--surface-secondary,var(--bg)); font-weight: 500; font-size: 0.82em; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.03em; }
.import-preview-table tbody tr:hover { background: var(--hover-bg, rgba(0,0,0,0.03)); }
.import-preview-table tbody tr { border-bottom: 1px solid var(--border-light, var(--border)); }
.import-row-blank { opacity: 0.45; }

/* Report filters */
.report-filters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 14px; align-items: end; }
@media (max-width: 800px) { .report-filters { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .report-filters { grid-template-columns: 1fr; } }
.rf-group label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.rf-group .input { width: 100%; height: 36px; text-align: left; }
.rf-group .seg { flex-wrap: wrap; }
.rf-group .seg-btn { font-size: 12px; padding: 7px 10px; }
.report-by-cat { display: flex; gap: 8px; padding: 0 0 12px; flex-wrap: wrap; }
.report-by-cat .cat-chip { background: var(--bg-secondary); padding: 6px 12px; border-radius: 999px; font-size: 12px; display: inline-flex; gap: 8px; align-items: center; }
.report-by-cat .cat-chip strong { font-variant-numeric: tabular-nums; }

/* Shop */
.qty-ctrl { display: inline-flex; align-items: center; gap: 4px; }
.qty-ctrl input { width: 48px; text-align: center; height: 28px; padding: 4px 6px; border: 0.5px solid var(--border-secondary); border-radius: var(--radius-md); background: var(--bg-card); font-size: 13px; }
.qty-ctrl button { width: 28px; height: 28px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-md); border: 0.5px solid var(--border-tertiary); background: var(--bg-card); cursor: pointer; color: var(--text-primary); }
.qty-ctrl button:hover { background: var(--bg-secondary); }
.low-stock { color: var(--danger-text); font-weight: 500; }
.stock-ok { color: var(--text-secondary); }
.modal-card.wide { max-width: 640px; }
.modal-card .sale-list { max-height: 320px; overflow-y: auto; border: 0.5px solid var(--border-tertiary); border-radius: var(--radius-md); }
.modal-card .sale-list .sale-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 0.5px solid var(--border-tertiary); font-size: 13px; }
.modal-card .sale-list .sale-row:last-child { border-bottom: none; }
.modal-card .sale-list .sale-row .meta { font-size: 11px; }
.modal-card .sale-total { display: flex; justify-content: space-between; align-items: center; padding: 10px 4px 0; font-size: 15px; font-weight: 500; }

/* Icon button */
.icon-btn { background: transparent; border: none; padding: 6px; cursor: pointer; color: var(--text-secondary); border-radius: 4px; font-size: 16px; line-height: 1; }
.icon-btn:hover { background: var(--bg-secondary); color: var(--text-primary); }

/* Refresh status indicator */
.refresh-status {
  font-size: 12px; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; background: var(--bg-secondary);
}
.refresh-status::before {
  content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #1D9E75; box-shadow: 0 0 0 0 rgba(29,158,117,0.5); animation: pulse 2.5s infinite;
}
.refresh-status.stale::before { background: #B4B2A9; animation: none; }
.refresh-status.refreshing::before { background: #EF9F27; animation: pulse 0.8s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(29,158,117,0.5); }
  70% { box-shadow: 0 0 0 6px rgba(29,158,117,0); }
  100% { box-shadow: 0 0 0 0 rgba(29,158,117,0); }
}
.btn-spinning i { animation: spin 0.6s linear infinite; }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* Horizontal scroll on narrow tables */
.table-wrap { overflow-x: auto; }

/* Mobile polish */
@media (max-width: 720px) {
  .app-head { gap: 8px; }
  .brand { font-size: 16px; }
  .brand-sub { display: none; }
  .cta .btn:not(.primary) { padding: 7px 10px; }
  .cta .btn:not(.primary) span, .refresh-status { display: none; }
  .av-xl { width: 110px; height: 110px; font-size: 38px; }
  .av-cam { width: 32px; height: 32px; font-size: 16px; }
  .profile-name { font-size: 20px; }
  .chartwrap { height: 220px; }
  .chartwrap-sm { height: 180px; }
  .metrics { gap: 8px; }
  .metric { padding: 10px 12px; }
  .metric-value { font-size: 18px; }
  .table th, .table td { padding: 10px 8px; font-size: 13px; }
  .card { padding: 1rem 1.1rem; }
}
@media (max-width: 480px) {
  .app { padding: 0.75rem 0.75rem 3rem; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .tabs { font-size: 12px; }
  .tab { padding: 10px 12px; }
  .tab i { font-size: 16px; }
  .promo-row { grid-template-columns: 1fr !important; }
  .row { grid-template-columns: 1fr auto; }
  .row > :nth-last-child(2) { display: none; }
}

/* ===== Attendance bulk check-in ===== */
.att-suggest { background: var(--bg-card); border: 0.5px solid var(--border-secondary); border-radius: var(--radius-lg); margin-top: 6px; max-height: 320px; overflow-y: auto; box-shadow: 0 4px 16px rgba(0,0,0,0.12); z-index: 100; }
.att-suggest-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 14px; cursor: pointer; border-bottom: 0.5px solid var(--border-tertiary); color: var(--text-primary); }
.att-suggest-row:last-child { border-bottom: none; }
.att-suggest-row:hover { background: var(--bg-tertiary); }
.att-suggest-row i.ti-plus { color: var(--text-secondary); font-size: 18px; }
.att-picked { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; min-height: 0; }
.att-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 4px; background: var(--info-bg, #E6F0FB); color: var(--info-text, #0C447C); border-radius: 999px; font-size: 13px; font-weight: 500; }
.att-chip .av { width: 22px; height: 22px; font-size: 10px; }
.att-chip-name { padding-right: 2px; }
.att-chip-x { background: transparent; border: none; color: inherit; opacity: 0.7; cursor: pointer; padding: 0 4px; display: inline-flex; align-items: center; }
.att-chip-x:hover { opacity: 1; }
.av.sm { width: 24px; height: 24px; font-size: 10px; }
.av.md { width: 40px; height: 40px; font-size: 15px; }

/* Class schedule day-checkbox labels */
.cs-day-label { display:inline-flex; align-items:center; gap:4px; cursor:pointer; font-size:13px; padding:4px 10px; border:1px solid var(--border-secondary); border-radius:var(--radius-sm); user-select:none; }
.cs-day-label:has(input:checked) { background:var(--info-bg); color:var(--info-text); border-color:var(--info-text); font-weight:600; }
.cs-day-label input { display:none; }

/* ===== Rank promotion blink animation ===== */
@keyframes rank-blink {
  0%, 100% { opacity: 1; }
  25%, 75%  { opacity: 0.15; }
  50%       { opacity: 1; }
}
.rank-blink { animation: rank-blink 0.55s ease-in-out 3; }

/* ===== Belt name text (colored) ===== */
.belt-name { font-weight: 600; }
.belt-name-white { text-shadow: 0 0 1px rgba(0,0,0,0.25); }
.belt-name-yellow { text-shadow: 0 0 1px rgba(0,0,0,0.15); }
:root[data-theme="dark"] .belt-name-black { color: #E8E8E5 !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .belt-name-black { color: #E8E8E5 !important; }
  :root:not([data-theme]) .belt-name-brown { color: #C98C4A !important; }
  :root:not([data-theme]) .belt-name-white { color: #C8C6BE !important; text-shadow: none; }
}
