/* ============================================================================
   Irfon Bolalari ERP v6.0 — EdTech SaaS Design System
   Inspired by Najot Ta'lim ERP · Modme LMS · Linear · Stripe Dashboard
   Viewport regimes:
     A) Telegram Desktop Mini App popup / phones ........ 320px – 559px
     B) Tablet & laptop (sticky sidebar) ................. 768px – 1280px
     C) Wide desktop ...................................... > 1280px
   ============================================================================ */

/* ----------------------------------------------------------------------------
   0. DESIGN TOKENS
   ---------------------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* Brand — Islamic Warm Parchment & Emerald */
  --primary: #0E6B47;
  --primary-hover: #095236;
  --primary-soft: #ECFDF3;
  --primary-border: #A7EBC7;
  --primary-ring: rgba(14, 107, 71, 0.16);
  --gold: #C9963B;
  --gold-hover: #AE7E2B;
  --gold-soft: #FDF6E7;

  /* Surfaces */
  --bg: #F7F5EF;
  --surface: #FFFFFF;
  --surface-subtle: #F1EDE4;
  --surface-hover: #FAF8F3;
  --header-bg: rgba(255, 255, 255, 0.88);

  /* Text */
  --text: #10201A;
  --text-secondary: #43564E;
  --text-muted: #7C8B84;

  /* Lines */
  --border: #E7E2D8;
  --border-strong: #D3CCC0;
  --border-subtle: #F0ECE3;

  /* Status */
  --success: #15803D;
  --success-bg: #DCFCE7;
  --warning: #B45309;
  --warning-bg: #FEF3C7;
  --danger: #DC2626;
  --danger-bg: #FEE2E2;

  /* Shape */
  --radius-xl: 16px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 6px 16px -6px rgba(15, 23, 42, 0.10), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 24px 48px -16px rgba(15, 23, 42, 0.22);

  /* Layout */
  --sidebar-w: 240px;
  --header-h: 56px;
  --bottom-nav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --container: 1140px;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

body.dark-theme {
  color-scheme: dark;

  --primary: #10B981;
  --primary-hover: #34D399;
  --primary-soft: rgba(16, 185, 129, 0.13);
  --primary-border: rgba(16, 185, 129, 0.34);
  --primary-ring: rgba(16, 185, 129, 0.25);
  --gold: #D4A574;
  --gold-hover: #E0B88C;
  --gold-soft: rgba(212, 165, 116, 0.14);

  --bg: #0A100E;
  --surface: #111A17;
  --surface-subtle: #192521;
  --surface-hover: #15201C;
  --header-bg: rgba(17, 26, 23, 0.88);

  --text: #F0F5F2;
  --text-secondary: #B2C3BC;
  --text-muted: #6C8078;

  --border: #202E29;
  --border-strong: #2F423B;
  --border-subtle: #18231F;

  --success: #22C55E;
  --success-bg: rgba(34, 197, 94, 0.14);
  --warning: #F59E0B;
  --warning-bg: rgba(245, 158, 11, 0.14);
  --danger: #F87171;
  --danger-bg: rgba(248, 113, 113, 0.14);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 20px -8px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 48px -16px rgba(0, 0, 0, 0.7);
}

/* ----------------------------------------------------------------------------
   1. RESET & BASE
   ---------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: 'cv11', 'ss01', 'tnum' 0;
  background-color: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  -webkit-appearance: none;
  appearance: none;
}

a {
  color: var(--primary);
}

::selection {
  background: var(--primary-ring);
}

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

svg.icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex-shrink: 0;
}

/* Thin, unobtrusive scrollbars (desktop) */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

/* Print-only letterhead lives in index.html; hidden on screen */
.print-only {
  display: none;
}

/* ----------------------------------------------------------------------------
   2. AUTH SCREEN (Najot Ta'lim style)
   ---------------------------------------------------------------------------- */
.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 400px at 50% -10%, var(--primary-soft), transparent 70%),
    var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-box {
  width: 100%;
  max-width: 360px;
}

.auth-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 32px;
}

.auth-top-bar > :last-child {
  flex-shrink: 0;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.auth-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.auth-brand-text {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.auth-heading {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 22px;
  letter-spacing: -0.6px;
  line-height: 1.2;
}

.field-box {
  position: relative;
  margin-bottom: 14px;
}

.field-label {
  position: absolute;
  top: 8px;
  left: 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.15s;
}

.field-input {
  width: 100%;
  height: 54px;
  padding: 22px 14px 6px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field-input::placeholder {
  color: var(--text-muted);
  font-weight: 500;
}

.field-input:hover {
  border-color: var(--text-muted);
}

.field-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(186, 141, 91, 0.16);
}

.field-box:focus-within .field-label {
  color: var(--gold);
}

.auth-submit-btn {
  width: 100%;
  height: 48px;
  margin-top: 6px;
  border-radius: 12px;
  border: none;
  background: var(--primary);
  color: #FFFFFF;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset, var(--shadow-sm);
  transition: background 0.15s, transform 0.1s;
}

body.dark-theme .auth-submit-btn {
  color: #04120B;
}

.auth-submit-btn:hover {
  background: var(--primary-hover);
}

.auth-submit-btn:active {
  transform: translateY(1px);
}

.auth-forgot-link {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 16px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.auth-forgot-link:hover {
  color: var(--primary);
}

.demo-pills {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.demo-pill {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  transition: all 0.15s;
}

.demo-pill:hover {
  border-color: var(--primary-border);
  color: var(--primary);
  background: var(--primary-soft);
}

/* ----------------------------------------------------------------------------
   3. APP SHELL — header, bottom nav (mobile), sidebar (≥ 768px)
   ---------------------------------------------------------------------------- */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 8px);
}

.app-workspace {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: var(--header-h);
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.header-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.header-brand-info {
  min-width: 0;
  flex: 1 1 auto;
}

.header-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.header-subtitle {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.header-right {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  flex-shrink: 0;
  min-width: 0;
}

/* Language / sibling switcher — never wraps to 2 lines */
.lang-pills {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  padding: 2px;
  border-radius: 9px;
  gap: 2px;
  flex-shrink: 0;
  max-width: 46vw;
  overflow-x: auto;
  scrollbar-width: none;
}

.lang-pills::-webkit-scrollbar {
  display: none;
}

.lang-pill {
  border: none;
  background: transparent;
  height: 28px;
  padding: 0 8px;
  border-radius: 7px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.lang-pill:hover {
  color: var(--text);
}

.lang-pill.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.icon-btn:hover {
  background: var(--surface-subtle);
  border-color: var(--border-strong);
  color: var(--text);
}

.app-main {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 16px 12px;
  flex: 1;
  min-width: 0;
}

/* Bottom navigation (phones & narrow Telegram Mini App popup) */
.app-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: calc(var(--bottom-nav-h) + var(--safe-bottom));
  padding: 6px 6px calc(6px + var(--safe-bottom));
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 2px;
}

.nav-btn {
  position: relative;
  border: none;
  background: transparent;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  padding: 0 4px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.nav-btn span {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-btn:hover {
  color: var(--text-secondary);
}

.nav-btn.active {
  color: var(--primary);
}

.nav-btn.active svg.icon {
  stroke-width: 2.3;
}

/* Active pip on mobile bottom nav */
.nav-btn.active::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  width: 28px;
  height: 3px;
  margin-left: -14px;
  border-radius: 0 0 3px 3px;
  background: var(--primary);
}

/* ---- Regime B: tablet & laptop — sticky left sidebar ---- */
@media (min-width: 768px) {
  :root {
    --header-h: 64px;
  }

  .app-layout {
    flex-direction: row;
    padding-bottom: 0;
  }

  .app-nav {
    position: sticky;
    top: 0;
    width: var(--sidebar-w);
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 20px 12px;
    gap: 4px;
    background: var(--surface);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-top: none;
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    overflow-y: auto;
  }

  .nav-btn {
    flex-direction: row;
    justify-content: flex-start;
    flex: 0 0 auto;
    height: 42px;
    padding: 0 12px;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: 10px;
  }

  .nav-btn:hover {
    background: var(--surface-subtle);
    color: var(--text);
  }

  .nav-btn.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
  }

  /* Refined active indicator: left bar */
  .nav-btn.active::before {
    top: 10px;
    bottom: 10px;
    left: -12px;
    width: 3px;
    height: auto;
    margin-left: 0;
    border-radius: 0 3px 3px 0;
  }

  .app-header {
    height: var(--header-h);
    padding: 0 24px;
    gap: 12px;
  }

  .header-logo {
    width: 34px;
    height: 34px;
    border-radius: 9px;
  }

  .header-title {
    font-size: 15px;
  }

  .lang-pills {
    max-width: none;
  }

  .app-main {
    padding: 28px 28px 40px;
  }
}

/* ---- Regime C: wide desktop ---- */
@media (min-width: 1281px) {
  :root {
    --container: 1240px;
  }

  .app-header {
    padding: 0 32px;
  }

  .app-main {
    padding: 32px 40px 48px;
  }
}

/* ----------------------------------------------------------------------------
   4. PAGE HEADER, TOOLBAR, SEGMENTED TABS
   ---------------------------------------------------------------------------- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.25;
  color: var(--text);
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (min-width: 768px) {
  .page-title {
    font-size: 24px;
    letter-spacing: -0.6px;
  }
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}

.toolbar > .input,
.toolbar > .select {
  min-width: 0;
}

/* Segmented tabs: one line, momentum horizontal scroll on narrow screens */
.segmented-tabs {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  padding: 3px;
  border-radius: 11px;
  gap: 2px;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-padding: 0 8px;
  scrollbar-width: none;
}

.segmented-tabs::-webkit-scrollbar {
  display: none;
}

.seg-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  background: transparent;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  scroll-snap-align: start;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.16s ease;
}

.seg-tab svg {
  display: block;
  flex-shrink: 0;
}

.seg-tab:hover {
  color: var(--text);
}

.seg-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs), 0 0 0 1px var(--border-subtle);
}

/* ----------------------------------------------------------------------------
   5. CARDS & KPI
   ---------------------------------------------------------------------------- */
.surface-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  min-width: 0;
}

@media (min-width: 768px) {
  .surface-card {
    padding: 24px;
  }
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

@media (min-width: 768px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
  }
}

@media (min-width: 960px) {
  .kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 24px;
  }
}

@media (min-width: 1200px) {
  .kpi-grid {
    gap: 16px;
  }
}

.kpi-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.16s ease;
}

@media (min-width: 768px) {
  .kpi-card {
    padding: 16px 18px;
  }
}

@media (min-width: 1200px) {
  .kpi-card {
    padding: 18px 20px;
  }
}

.kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.1px;
  overflow-wrap: anywhere;
}

.kpi-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.6px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

@media (min-width: 768px) {
  .kpi-value {
    font-size: 28px;
    letter-spacing: -0.8px;
  }
}

.kpi-value.emerald {
  color: var(--primary);
}

/* ----------------------------------------------------------------------------
   6. DATA LIST / ROWS
   ---------------------------------------------------------------------------- */
.data-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.data-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.16s ease;
  flex-wrap: wrap;
  min-width: 0;
}

.data-row:last-child {
  border-bottom: none;
}

.data-row:hover {
  background: var(--surface-hover);
}

@media (min-width: 768px) {
  .data-row {
    padding: 16px 20px;
  }
}

@media (min-width: 1281px) {
  .data-row {
    padding: 18px 24px;
  }
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  object-fit: cover;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.row-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 240px;
}

.row-main > div:not(.avatar):not(.rank-badge) {
  min-width: 0;
}

.row-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.row-meta {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.row-meta b {
  color: var(--text-secondary);
  font-weight: 700;
}

.data-row > .toolbar,
.data-row > .journal-switch-group {
  flex: 0 1 auto;
  justify-content: flex-end;
}

/* ---- Regime A: stack row content on narrow screens (< 560px) ---- */
@media (max-width: 559px) {
  .data-row {
    gap: 12px;
    padding: 14px;
  }

  /* Rows carrying actions / switches stack: info on top, controls below */
  .data-row:has(> .toolbar),
  .data-row:has(> .journal-switch-group) {
    flex-direction: column;
    align-items: stretch;
  }

  .data-row:has(> .toolbar) > .row-main,
  .data-row:has(> .journal-switch-group) > .row-main {
    flex: 0 0 auto;
    flex-basis: auto;
    width: 100%;
  }

  .data-row > .toolbar,
  .data-row > .journal-switch-group {
    width: 100%;
    justify-content: flex-start;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
  }

  .data-row > .toolbar > .select:not(.status-select) {
    flex: 1 1 120px;
  }

  .data-row > .toolbar > .status-select {
    flex: 0 0 auto;
    width: auto;
  }

  /* Journal: attendance switches fill the row evenly */
  .data-row > .journal-switch-group {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 8px;
  }

  .journal-switch-group > .switch-pills:first-child {
    grid-column: 1 / -1;
  }

  .journal-switch-group .switch-pills {
    display: flex;
    width: 100%;
    min-width: 0;
  }

  .journal-switch-group .switch-pills:nth-child(2) {
    grid-column: 1 / 3;
  }

  .journal-switch-group .sw-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 6px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .journal-switch-group > .pill {
    align-self: center;
  }

  /* Page header toolbar takes full width so controls never crush the title */
  .page-header > .toolbar {
    width: 100%;
  }

  .page-header > .toolbar > .select,
  .page-header > .toolbar > .input {
    flex: 1 1 130px;
  }

  .toolbar > .segmented-tabs {
    width: 100%;
  }

  .toolbar > .input {
    flex: 1 1 100%;
  }
}

/* Status pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
}

.pill-green {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(21, 128, 61, 0.14);
}

.pill-amber {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: rgba(180, 83, 9, 0.14);
}

.pill-red {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.14);
}

.pill-slate {
  background: var(--surface-subtle);
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

/* ----------------------------------------------------------------------------
   7. BUTTONS & INPUTS
   ---------------------------------------------------------------------------- */
.input,
.select,
.textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

body:not(.dark-theme) .input,
body:not(.dark-theme) .select:not(.status-select),
body:not(.dark-theme) .textarea {
  border-color: #D5DCE5;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-muted);
  font-weight: 500;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--text-muted);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238492A6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  cursor: pointer;
  text-overflow: ellipsis;
}

.textarea {
  height: auto;
  min-height: 96px;
  padding: 10px 12px;
  line-height: 1.5;
  resize: vertical;
}

input[type='date'].input {
  min-width: 0;
}

.btn {
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.16s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn svg.icon {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset, var(--shadow-xs);
}

body.dark-theme .btn-primary {
  color: #04120B;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-gold {
  background: var(--gold);
  color: #FFFFFF;
}

.btn-gold:hover {
  background: var(--gold-hover);
}

.btn-outline {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

body:not(.dark-theme) .btn-outline {
  border-color: #D5DCE5;
}

.btn-outline:hover {
  background: var(--surface-subtle);
  border-color: var(--text-muted);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: #FFFFFF;
}

.btn-sm {
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.modal-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(125px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.modal-action-grid .btn {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  justify-content: center;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-block {
  width: 100%;
}

/* ----------------------------------------------------------------------------
   8. USTAZ JOURNAL
   ---------------------------------------------------------------------------- */
.journal-switch-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.switch-pills {
  display: inline-flex;
  flex-wrap: nowrap;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  padding: 3px;
  border-radius: 10px;
  gap: 3px;
}

.sw-btn {
  border: none;
  background: transparent;
  height: 32px;
  padding: 0 10px;
  border-radius: 7px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.16s ease;
}

.sw-btn:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface);
}

.sw-btn.on-present,
.sw-btn.on-excused,
.sw-btn.on-unexcused,
.sw-btn.on-passed,
.sw-btn.on-failed,
.sw-btn.on-grade-5,
.sw-btn.on-grade-4,
.sw-btn.on-grade-3,
.sw-btn.on-grade-2 {
  color: #FFFFFF;
  box-shadow: var(--shadow-xs);
}

.sw-btn.sw-grade {
  min-width: 34px;
  padding-left: 0;
  padding-right: 0;
  font-weight: 800;
}

.sw-btn.on-present { background: var(--primary); }
.sw-btn.on-excused { background: #D97706; }
.sw-btn.on-unexcused { background: #DC2626; }
.sw-btn.on-passed,
.sw-btn.on-grade-5 { background: #16A34A; }
.sw-btn.on-grade-4 { background: #0EA5E9; }
.sw-btn.on-grade-3 { background: #D97706; }
.sw-btn.on-failed,
.sw-btn.on-grade-2 { background: #475569; }

/* Т-метка: янтарный/золотой, без XP — визуально отличается от оценок */
.sw-btn.sw-t-mark {
  color: #92400E;
  background: #FEF3C7;
  border: 1.5px dashed #D97706;
  letter-spacing: 0;
  font-style: italic;
}
.sw-btn.sw-t-mark.on-grade-t {
  background: #D97706;
  color: #fff;
  border-color: #B45309;
  font-style: italic;
}
body.dark-theme .sw-btn.sw-t-mark {
  background: #3B2500;
  color: #FCD34D;
  border-color: #92400E;
}
body.dark-theme .sw-btn.sw-t-mark.on-grade-t {
  background: #B45309;
  color: #fff;
}

/* Т-метка в классическом журнале (popup) */
.cj-editor-opt.opt-grade-t {
  background: #FEF3C7;
  color: #92400E;
  border: 1.5px dashed #D97706;
  font-style: italic;
}
.cj-editor-opt.opt-grade-t.active,
.cj-editor-opt.opt-grade-t:hover {
  background: #D97706;
  color: #fff;
  border-style: solid;
}
body.dark-theme .cj-editor-opt.opt-grade-t {
  background: #3B2500;
  color: #FCD34D;
}
body.dark-theme .cj-editor-opt.opt-grade-t.active {
  background: #B45309;
  color: #fff;
}

body.dark-theme .sw-btn.on-present { color: #04120B; }

.sw-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.floating-save {
  position: sticky;
  bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 12px);
  z-index: 30;
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}

.floating-save > * {
  pointer-events: auto;
}

@media (max-width: 559px) {
  .floating-save > .btn {
    width: 100%;
    min-width: 0 !important;
  }
}

@media (min-width: 768px) {
  .floating-save {
    bottom: 20px;
  }
}

/* Rating badges */
.rank-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--surface-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  font-weight: 800;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.rank-badge.rank-1 {
  background: #FEF08A;
  color: #854D0E;
  border-color: #FDE047;
}

.rank-badge.rank-2 {
  background: #E2E8F0;
  color: #1E293B;
  border-color: #CBD5E1;
}

.rank-badge.rank-3 {
  background: #FFEDD5;
  color: #9A3412;
  border-color: #FED7AA;
}

/* ----------------------------------------------------------------------------
   9. MODALS, FORMS, TOASTS
   ---------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fade-in 0.18s ease both;
}

.modal-card {
  background: var(--surface);
  border-radius: 18px;
  max-width: 460px;
  width: 100%;
  max-height: calc(100dvh - 32px);
  max-height: 90vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@media (max-width: 420px) {
  .modal-backdrop {
    padding: 10px;
    align-items: flex-end;
  }

  .modal-card {
    padding: 18px 16px;
    border-radius: 18px 18px 14px 14px;
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.form-grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

@media (max-width: 440px) {
  .form-grid-2 {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
}

.form-item {
  margin-bottom: 12px;
  min-width: 0;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

#toast-container {
  position: fixed;
  top: 14px;
  right: 14px;
  left: 14px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  gap: 8px;
}

.toast {
  background: #0F172A;
  color: #FFFFFF;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 600;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  max-width: min(380px, 100%);
  text-align: center;
  overflow-wrap: anywhere;
  animation: modal-in 0.2s var(--ease);
}

body.dark-theme .toast {
  background: #1E293B;
}

.toast.error {
  background: var(--danger);
  color: #FFFFFF;
}

.offline-bar {
  background: var(--warning-bg);
  color: var(--warning);
  border-bottom: 1px solid rgba(180, 83, 9, 0.18);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  padding: 6px 14px;
}

/* ----------------------------------------------------------------------------
   10. REGIME A FINE-TUNING — Telegram Desktop popup (340px – 420px)
   ---------------------------------------------------------------------------- */
@media (max-width: 420px) {
  .app-header {
    padding: 8px 10px;
    gap: 6px;
  }

  .header-left {
    gap: 8px;
  }

  .header-logo {
    width: 30px;
    height: 30px;
  }

  .header-title {
    font-size: 13.5px;
  }

  .header-subtitle {
    font-size: 10.5px;
  }

  .header-right {
    gap: 4px;
  }

  .lang-pill {
    height: 26px;
    padding: 0 6px;
    font-size: 10.5px;
  }

  .icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }

  .icon-btn svg.icon {
    width: 16px;
    height: 16px;
  }

  .app-main {
    padding: 14px 10px;
  }

  .page-header {
    margin-bottom: 14px;
    gap: 10px;
  }

  .page-title {
    font-size: 18px;
  }

  .surface-card {
    padding: 14px;
    border-radius: 14px;
  }

  .data-list {
    border-radius: 14px;
  }

  .kpi-grid {
    gap: 8px;
  }

  .kpi-card {
    padding: 12px;
  }

  .kpi-value {
    font-size: 20px;
  }

  .btn {
    padding: 0 12px;
  }

  .seg-tab {
    padding: 0 10px;
  }

  .auth-heading {
    font-size: 23px;
  }

  .demo-pills {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (max-width: 339px) {
  .header-subtitle {
    display: none;
  }

  .lang-pill {
    padding: 0 5px;
  }

  .nav-btn {
    font-size: 10px;
  }

  .demo-pills {
    grid-template-columns: minmax(0, 1fr);
  }
}

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

/* ----------------------------------------------------------------------------
   11. PRINT — official document look (credential lists, attendance reports)
   ---------------------------------------------------------------------------- */
@media print {
  @page {
    size: A4;
    margin: 16mm 14mm 18mm;
  }

  :root,
  body.dark-theme {
    --primary: #0F5B33;
    --primary-soft: #FFFFFF;
    --primary-border: #0F5B33;
    --bg: #FFFFFF;
    --surface: #FFFFFF;
    --surface-subtle: #FFFFFF;
    --surface-hover: #FFFFFF;
    --text: #000000;
    --text-secondary: #1F2937;
    --text-muted: #4B5563;
    --border: #9CA3AF;
    --border-subtle: #D1D5DB;
    --success: #000000;
    --success-bg: #FFFFFF;
    --warning: #000000;
    --warning-bg: #FFFFFF;
    --danger: #000000;
    --danger-bg: #FFFFFF;
  }

  html,
  body {
    background: #FFFFFF !important;
    color: #000000 !important;
    font-size: 11pt;
    min-height: 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .app-nav,
  .app-header,
  .no-print,
  .floating-save,
  .offline-bar,
  #toast-container,
  .icon-btn,
  .lang-pills,
  .segmented-tabs,
  .btn,
  .select,
  .input {
    display: none !important;
  }

  *,
  *::before,
  *::after {
    box-shadow: none !important;
    text-shadow: none !important;
    animation: none !important;
    transition: none !important;
  }

  .app-layout,
  .app-workspace {
    display: block;
    padding: 0;
    min-height: 0;
  }

  .app-main {
    max-width: none;
    padding: 0;
    margin: 0;
  }

  /* Letterhead & signature block (static markup in index.html) */
  .print-only {
    display: block;
  }

  .print-letterhead {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 10px;
    margin-bottom: 16px;
    border-bottom: 2px solid #0F5B33;
  }

  .print-letterhead img {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
  }

  .print-letterhead-title {
    font-size: 16pt;
    font-weight: 800;
    color: #0F5B33;
    letter-spacing: -0.2px;
    line-height: 1.15;
  }

  .print-letterhead-sub {
    font-size: 9pt;
    color: #4B5563;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
  }

  .print-footer {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    margin-top: 28px;
    padding-top: 12px;
    font-size: 9pt;
    color: #374151;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .print-footer span {
    flex: 1;
    border-top: 1px solid #000000;
    padding-top: 4px;
    text-align: center;
  }

  .page-header {
    margin-bottom: 12px;
    border-bottom: 1px solid #D1D5DB;
    padding-bottom: 8px;
  }

  .page-title {
    font-size: 15pt;
    color: #000000;
  }

  .surface-card,
  .kpi-card,
  .data-list {
    border: 1px solid #9CA3AF !important;
    border-radius: 4px !important;
    background: #FFFFFF !important;
    transform: none !important;
  }

  .surface-card,
  .kpi-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .kpi-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 8px;
  }

  .data-list {
    overflow: visible;
  }

  .data-row {
    flex-direction: row !important;
    align-items: center !important;
    padding: 7px 10px !important;
    border-bottom: 1px solid #D1D5DB !important;
    break-inside: avoid;
    page-break-inside: avoid;
    background: #FFFFFF !important;
  }

  .row-title {
    font-size: 10.5pt;
    color: #000000;
  }

  .row-meta {
    font-size: 9pt;
    color: #1F2937;
  }

  .row-meta b {
    color: #000000;
    font-family: 'Courier New', ui-monospace, monospace;
    font-size: 10pt;
    letter-spacing: 0.5px;
    border: 1px solid #9CA3AF;
    border-radius: 3px;
    padding: 0 4px;
  }

  .avatar,
  .rank-badge {
    width: 28px;
    height: 28px;
    font-size: 9pt;
    border: 1px solid #6B7280 !important;
    background: #FFFFFF !important;
    color: #000000 !important;
  }

  .pill {
    border: 1px solid #6B7280 !important;
    background: #FFFFFF !important;
    color: #000000 !important;
  }

  /* Journal switches: print only the selected state as text badges */
  .journal-switch-group {
    border-top: none !important;
    padding-top: 0 !important;
  }

  .switch-pills {
    background: none !important;
    border: none !important;
    padding: 0;
  }

  .sw-btn {
    display: none;
  }

  .sw-btn[class*='on-'] {
    display: inline-flex;
    align-items: center;
    height: auto;
    padding: 2px 8px;
    border: 1px solid #000000;
    background: #FFFFFF !important;
    color: #000000 !important;
    font-size: 9pt;
  }

  /* When a modal (e.g. a student rank / credential card) is open, print it alone */
  body:has(#modal-root .modal-backdrop) #app,
  body:has(#modal-root .modal-backdrop) .print-footer {
    display: none !important;
  }

  .modal-backdrop {
    position: static;
    background: none !important;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    padding: 0;
    display: block;
  }

  .modal-card {
    max-width: 120mm;
    max-height: none;
    overflow: visible;
    margin: 0 auto;
    border: 1.5px solid #0F5B33;
    border-radius: 8px;
    padding: 10mm;
  }

  a[href]::after {
    content: '';
  }
}

/* ----------------------------------------------------------------------------
   12. PHASE 2 — Analytics, 360° Student Profile, Attendance Heatmap
   ---------------------------------------------------------------------------- */

/* Attendance heatmap: grid of day pills */
.att-heatmap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px;
  margin: 8px 0;
}

/* Compact dot (GitHub/Linear activity square) */
.att-dot {
  --dot-bg: var(--surface-subtle);
  --dot-fg: var(--text-muted);
  --dot-border: var(--border);
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--dot-bg);
  border: 1px solid var(--dot-border);
  vertical-align: middle;
  flex-shrink: 0;
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease);
}
.att-dot.present-passed { --dot-bg: #16A34A; --dot-border: #15803D; --dot-fg: #FFFFFF; }
.att-dot.present-failed { --dot-bg: #F59E0B; --dot-border: #D97706; --dot-fg: #1F1300; }
.att-dot.excused        { --dot-bg: #93C5FD; --dot-border: #60A5FA; --dot-fg: #0B2545; }
.att-dot.unexcused      { --dot-bg: #EF4444; --dot-border: #DC2626; --dot-fg: #FFFFFF; }

body.dark-theme .att-dot.present-passed { --dot-bg: #22C55E; --dot-border: #16A34A; --dot-fg: #04120B; }
body.dark-theme .att-dot.present-failed { --dot-bg: #FBBF24; --dot-border: #F59E0B; --dot-fg: #1F1300; }
body.dark-theme .att-dot.excused        { --dot-bg: #3B82F6; --dot-border: #2563EB; --dot-fg: #FFFFFF; }
body.dark-theme .att-dot.unexcused      { --dot-bg: #F87171; --dot-border: #EF4444; --dot-fg: #1F0505; }

.att-dot:hover {
  transform: scale(1.15);
  box-shadow: 0 0 0 2px var(--primary-ring);
}

/* Inline row of dots */
.att-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

/* Dots used as heatmap cells become labelled pills */
.att-heatmap > .att-dot,
.att-heatmap > .att-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: auto;
  height: auto;
  min-height: 44px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: var(--dot-fg, var(--text));
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.att-heatmap > .att-dot:hover { transform: translateY(-1px); }
.att-heatmap > .att-cell {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}
.att-heatmap .att-dot-date,
.att-heatmap small {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.85;
}

/* Legend */
.att-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 8px;
}
.att-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Progress bar (attendance rate %, payment completion %) */
.progress-bar {
  position: relative;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-subtle);
  box-shadow: inset 0 0 0 1px var(--border-subtle);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  max-width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #059669, #10B981 60%, #34D399);
  transition: width 0.6s var(--ease);
}
.progress-fill.warning { background: linear-gradient(90deg, #D97706, #F59E0B); }
.progress-fill.danger  { background: linear-gradient(90deg, #DC2626, #F87171); }
.progress-fill.gold    { background: linear-gradient(90deg, var(--gold-hover), var(--gold)); }
.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}
.progress-label strong { color: var(--text); font-weight: 700; }

/* Rate pill */
.rate-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--success-bg);
  color: var(--success);
}
.rate-pill.warning { background: var(--warning-bg); color: var(--warning); }
.rate-pill.danger  { background: var(--danger-bg);  color: var(--danger); }

/* Clickable student rows (open 360° modal) */
.row-clickable {
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
.row-clickable:hover {
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
}
.row-clickable:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}
.row-clickable:active { background: var(--surface-hover); }

/* Danger zone (Super Admin production reset) */
.danger-zone-card {
  border: 1.5px solid var(--danger);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--danger-bg), var(--surface) 70%);
  padding: 18px 20px;
  margin-top: 16px;
  box-shadow: var(--shadow-xs);
}
.danger-zone-card h3,
.danger-zone-card .danger-zone-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  color: var(--danger);
  font-size: 15px;
  font-weight: 700;
}
.danger-zone-card p {
  margin: 0 0 12px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

/* 360° profile modal helpers */
.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.profile-stat {
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}
.profile-stat .label { font-size: 12px; color: var(--text-muted); }
.profile-stat .value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 480px) {
  .att-heatmap { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
}

@media print {
  .att-dot { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .progress-fill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .row-clickable:hover { background: none; box-shadow: none; }
  .danger-zone-card { display: none; }
}

/* ----------------------------------------------------------------------------
   13. v5.0 — PILL STATUS SELECT, CLASSIC MATRIX JOURNAL, WEEKDAY PICKER,
       PARENT RATING HIGHLIGHT
   ---------------------------------------------------------------------------- */

/* 13.1 Sleek Pill-Shaped Status Select (replaces redundant pill + select pair) */
.status-select,
.select.status-select {
  width: auto;
  min-width: 112px;
  max-width: 100%;
  height: 32px;
  border-radius: 999px;
  padding: 0 26px 0 12px;
  font-size: 12px;
  font-weight: 700;
  line-height: 30px;
  letter-spacing: 0.05px;
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid var(--border-strong);
  background-color: var(--surface-subtle);
  color: var(--text-secondary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 12px 12px;
  cursor: pointer;
  outline: none;
  flex-shrink: 0;
  text-overflow: ellipsis;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.status-select option {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}

.status-select:hover,
.select.status-select:hover {
  filter: brightness(0.97);
}

body.dark-theme .status-select:hover,
body.dark-theme .select.status-select:hover {
  filter: brightness(1.08);
}

.status-select:focus,
.select.status-select:focus {
  box-shadow: 0 0 0 3px var(--primary-ring);
}

/* Status color variants */
.status-select.status-studying {
  background-color: var(--success-bg);
  color: var(--success);
  border-color: rgba(21, 128, 61, 0.24);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2315803D' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

body.dark-theme .status-select.status-studying {
  border-color: rgba(34, 197, 94, 0.34);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2322C55E' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.status-select.status-paused {
  background-color: var(--warning-bg);
  color: var(--warning);
  border-color: rgba(180, 83, 9, 0.24);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23B45309' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

body.dark-theme .status-select.status-paused {
  border-color: rgba(245, 158, 11, 0.34);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23F59E0B' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.status-select.status-graduated {
  background-color: var(--gold-soft);
  color: #92622E;
  border-color: rgba(186, 141, 91, 0.36);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2392622E' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

body.dark-theme .status-select.status-graduated {
  color: var(--gold);
  border-color: rgba(212, 165, 116, 0.36);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23D4A574' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.status-select.status-left {
  background-color: var(--surface-subtle);
  color: var(--text-secondary);
  border-color: var(--border-strong);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

body.dark-theme .status-select.status-left {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23B6C2D2' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

/* Keep student rows sleek & balanced */
.data-row > .toolbar {
  gap: 6px;
}

/* 13.2 Classic Matrix / Spreadsheet Journal Table */
.classic-journal-wrap {
  position: relative;
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
  margin-bottom: 16px;
}

.classic-journal-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.classic-journal-table thead th {
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.classic-journal-table tbody td {
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface);
  transition: background-color 0.12s var(--ease);
}

.classic-journal-table tbody tr:last-child td {
  border-bottom: none;
}

.classic-journal-table tbody tr:hover td {
  background: var(--surface-hover);
}

/* Sticky Left Student Column */
.classic-journal-table .sticky-col-name {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 184px;
  max-width: 240px;
  text-align: left;
  padding: 10px 14px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 12px -6px rgba(15, 23, 42, 0.12);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.classic-journal-table thead .sticky-col-name {
  z-index: 5;
  background: var(--surface-subtle);
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

.classic-journal-table tbody tr:hover .sticky-col-name {
  background: var(--surface-hover);
}

body.dark-theme .classic-journal-table .sticky-col-name {
  box-shadow: 4px 0 14px -4px rgba(0, 0, 0, 0.52);
}

/* Sticky Right Total XP Column */
.classic-journal-table .sticky-col-total {
  position: sticky;
  right: 0;
  z-index: 3;
  min-width: 68px;
  text-align: center;
  padding: 10px 10px;
  font-weight: 800;
  color: var(--primary);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 12px -6px rgba(15, 23, 42, 0.12);
  white-space: nowrap;
}

.classic-journal-table thead .sticky-col-total {
  z-index: 5;
  background: var(--surface-subtle);
  color: var(--text-secondary);
}

.classic-journal-table tbody tr:hover .sticky-col-total {
  background: var(--surface-hover);
}

body.dark-theme .classic-journal-table .sticky-col-total {
  box-shadow: -4px 0 14px -4px rgba(0, 0, 0, 0.52);
}

/* Student Name Inner Helpers */
.cj-student-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cj-student-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

.cj-student-name {
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Compact Date Column Headers */
.classic-journal-table .cj-th-date {
  min-width: 46px;
  width: 48px;
  padding: 8px 4px;
  text-align: center;
  vertical-align: middle;
  border-right: 1px solid var(--border-subtle);
  cursor: pointer;
  user-select: none;
  line-height: 1.2;
  transition: background-color 0.14s var(--ease), color 0.14s var(--ease);
}

.classic-journal-table .cj-th-date:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.cj-th-date .cj-day-num,
.cj-th-date strong,
.cj-th-date b {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.15;
}

.cj-th-date .cj-weekday,
.cj-th-date small,
.cj-th-date span {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.25px;
  margin-top: 2px;
}

/* Today Header Highlight */
.classic-journal-table .cj-th-date.is-today {
  background: var(--primary-soft);
  color: var(--primary);
  box-shadow: inset 0 -2px 0 var(--primary);
}

.classic-journal-table .cj-th-date.is-today .cj-day-num,
.classic-journal-table .cj-th-date.is-today .cj-weekday,
.classic-journal-table .cj-th-date.is-today strong,
.classic-journal-table .cj-th-date.is-today b,
.classic-journal-table .cj-th-date.is-today small,
.classic-journal-table .cj-th-date.is-today span {
  color: var(--primary);
}

/* Postponed Day Header */
.classic-journal-table .cj-th-date.is-postponed {
  background: repeating-linear-gradient(
    -45deg,
    var(--surface-subtle),
    var(--surface-subtle) 5px,
    var(--warning-bg) 5px,
    var(--warning-bg) 10px
  );
  color: var(--warning);
}

.classic-journal-table .cj-th-date.is-postponed .cj-day-num,
.classic-journal-table .cj-th-date.is-postponed .cj-weekday,
.classic-journal-table .cj-th-date.is-postponed strong,
.classic-journal-table .cj-th-date.is-postponed b,
.classic-journal-table .cj-th-date.is-postponed small,
.classic-journal-table .cj-th-date.is-postponed span {
  color: var(--warning);
}

/* Interactive Grade Cells */
.classic-journal-table td.cj-cell {
  min-width: 46px;
  height: 42px;
  padding: 4px;
  text-align: center;
  vertical-align: middle;
  border-right: 1px solid var(--border-subtle);
  font-size: 13px;
  font-weight: 800;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.16s ease;
}

button.cj-cell,
div.cj-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 36px;
  height: 34px;
  padding: 0 4px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.16s ease;
}

.classic-journal-table .cj-cell:hover:not(.cell-postponed):not(.cell-locked):not(.is-locked) {
  box-shadow: inset 0 0 0 2px var(--primary);
  z-index: 2;
}

.classic-journal-table .cj-cell.is-active,
.classic-journal-table .cj-cell.is-selected {
  box-shadow: inset 0 0 0 2px var(--primary);
  z-index: 2;
}

.classic-journal-table .cj-cell.is-today:not(.cell-passed):not(.cell-failed):not(.cell-excused):not(.cell-unexcused):not(.cell-postponed) {
  background: rgba(15, 91, 51, 0.04);
}

body.dark-theme .classic-journal-table .cj-cell.is-today:not(.cell-passed):not(.cell-failed):not(.cell-excused):not(.cell-unexcused):not(.cell-postponed) {
  background: rgba(16, 185, 129, 0.06);
}

/* Color-Coded Cell States */
.classic-journal-table .cj-cell.cell-passed,
.classic-journal-table tbody tr:hover .cj-cell.cell-passed,
.classic-journal-table .cj-cell.cell-grade-5,
.classic-journal-table tbody tr:hover .cj-cell.cell-grade-5 {
  background: var(--success-bg);
  color: var(--success);
  font-weight: 800;
}

.classic-journal-table .cj-cell.cell-grade-4,
.classic-journal-table tbody tr:hover .cj-cell.cell-grade-4 {
  background: rgba(14, 165, 233, 0.14);
  color: #0284C7;
  font-weight: 800;
}

body.dark-theme .classic-journal-table .cj-cell.cell-grade-4,
body.dark-theme .classic-journal-table tbody tr:hover .cj-cell.cell-grade-4 {
  background: rgba(56, 189, 248, 0.16);
  color: #38BDF8;
}

.classic-journal-table .cj-cell.cell-grade-3,
.classic-journal-table tbody tr:hover .cj-cell.cell-grade-3 {
  background: var(--warning-bg);
  color: var(--warning);
  font-weight: 800;
}

.classic-journal-table .cj-cell.cell-failed,
.classic-journal-table tbody tr:hover .cj-cell.cell-failed,
.classic-journal-table .cj-cell.cell-grade-2,
.classic-journal-table tbody tr:hover .cj-cell.cell-grade-2 {
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-weight: 800;
}

/* Т-метка в ячейке классического журнала */
.classic-journal-table .cj-cell.cell-grade-t,
.classic-journal-table tbody tr:hover .cj-cell.cell-grade-t {
  background: #FEF3C7;
  color: #92400E;
  font-weight: 800;
  font-style: italic;
  border: 1px dashed #D97706;
}
body.dark-theme .classic-journal-table .cj-cell.cell-grade-t,
body.dark-theme .classic-journal-table tbody tr:hover .cj-cell.cell-grade-t {
  background: #3B2500;
  color: #FCD34D;
  border-color: #92400E;
}

.classic-journal-table .cj-cell.cell-excused,
.classic-journal-table tbody tr:hover .cj-cell.cell-excused {
  background: var(--warning-bg);
  color: var(--warning);
}

.classic-journal-table .cj-cell.cell-unexcused,
.classic-journal-table tbody tr:hover .cj-cell.cell-unexcused {
  background: var(--danger-bg);
  color: var(--danger);
}

.classic-journal-table .cj-cell.cell-postponed,
.classic-journal-table tbody tr:hover .cj-cell.cell-postponed {
  background: repeating-linear-gradient(
    -45deg,
    var(--surface-subtle),
    var(--surface-subtle) 5px,
    var(--border-subtle) 5px,
    var(--border-subtle) 10px
  );
  color: var(--text-muted);
  cursor: default;
}

.classic-journal-table .cj-cell.cell-locked,
.classic-journal-table .cj-cell.is-locked,
.classic-journal-table .cj-cell[data-locked='1'] {
  cursor: default;
  opacity: 0.72;
}

/* Inline Cell Editor Popover */
.cj-editor-popover {
  position: fixed;
  z-index: 160;
  min-width: 216px;
  max-width: min(280px, calc(100vw - 20px));
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 8px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: modal-in 0.14s var(--ease);
}

.cj-editor-header,
.cj-editor-title {
  padding: 4px 8px 6px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cj-editor-popover button,
.cj-editor-opt {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.12s var(--ease), border-color 0.12s var(--ease), color 0.12s var(--ease);
}

.cj-editor-popover button:hover,
.cj-editor-opt:hover {
  background: var(--surface-subtle);
  border-color: var(--border);
}

.cj-editor-popover button.opt-passed:hover,
.cj-editor-popover button.cell-passed:hover,
.cj-editor-popover button.opt-passed.active,
.cj-editor-popover button.opt-grade-5:hover,
.cj-editor-popover button.opt-grade-5.active {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(21, 128, 61, 0.25);
}

.cj-editor-popover button.opt-grade-4:hover,
.cj-editor-popover button.opt-grade-4.active {
  background: rgba(14, 165, 233, 0.14);
  color: #0284C7;
  border-color: rgba(14, 165, 233, 0.28);
}

.cj-editor-popover button.opt-grade-3:hover,
.cj-editor-popover button.opt-grade-3.active {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: rgba(180, 83, 9, 0.25);
}

.cj-editor-popover button.opt-failed:hover,
.cj-editor-popover button.cell-failed:hover,
.cj-editor-popover button.opt-failed.active,
.cj-editor-popover button.opt-grade-2:hover,
.cj-editor-popover button.opt-grade-2.active {
  background: var(--surface-subtle);
  color: var(--text);
  border-color: var(--border-strong);
}

.cj-editor-popover button.opt-excused:hover,
.cj-editor-popover button.cell-excused:hover,
.cj-editor-popover button.opt-excused.active {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: rgba(180, 83, 9, 0.25);
}

.cj-editor-popover button.opt-unexcused:hover,
.cj-editor-popover button.cell-unexcused:hover,
.cj-editor-popover button.opt-unexcused.active {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.25);
}

/* Optional Compact Legend under Classic Journal */
.cj-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 8px 0 14px;
}

.cj-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cj-legend-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
}

.cj-legend-dot.cell-passed { background: var(--success-bg); color: var(--success); }
.cj-legend-dot.cell-failed { background: var(--surface-subtle); color: var(--text-secondary); }
.cj-legend-dot.cell-excused { background: var(--warning-bg); color: var(--warning); }
.cj-legend-dot.cell-unexcused { background: var(--danger-bg); color: var(--danger); }
.cj-legend-dot.cell-postponed { background: var(--surface-subtle); color: var(--text-muted); border: 1px dashed var(--border-strong); }

/* 13.3 Weekly Days Selector Pills (Mon–Sun) */
.weekday-picker {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}

.weekday-pill {
  height: 40px;
  min-width: 0;
  padding: 0 4px;
  border-radius: 999px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  user-select: none;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease), box-shadow 0.15s var(--ease), transform 0.1s;
}

.weekday-pill:hover {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--primary);
}

.weekday-pill:active {
  transform: scale(0.95);
}

.weekday-pill.active,
.weekday-pill.is-active,
.weekday-pill[aria-pressed='true'] {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 3px 10px -2px var(--primary-ring);
}

body.dark-theme .weekday-pill.active,
body.dark-theme .weekday-pill.is-active,
body.dark-theme .weekday-pill[aria-pressed='true'] {
  color: #04120B;
}

/* 13.4 Parent's Child Highlight in Rating */
.my-child-rank-banner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 16px 20px;
  margin-bottom: 16px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, #0F5B33 0%, #147342 58%, #A67B48 100%);
  border: 1px solid rgba(186, 141, 91, 0.45);
  color: #FFFFFF;
  box-shadow: 0 12px 26px -12px rgba(15, 91, 51, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

body.dark-theme .my-child-rank-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.24) 0%, rgba(15, 91, 51, 0.44) 60%, rgba(212, 165, 116, 0.24) 100%);
  border-color: rgba(16, 185, 129, 0.44);
  color: var(--text);
  box-shadow: 0 12px 28px -12px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.my-child-rank-banner .row-title,
.my-child-rank-banner strong {
  color: #FFFFFF;
}

.my-child-rank-banner .row-meta {
  color: rgba(255, 255, 255, 0.84);
}

body.dark-theme .my-child-rank-banner .row-title,
body.dark-theme .my-child-rank-banner strong {
  color: var(--text);
}

body.dark-theme .my-child-rank-banner .row-meta {
  color: var(--text-secondary);
}

.my-child-rank-banner .rank-badge {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.34);
  color: #FFFFFF;
  width: 40px;
  height: 40px;
  font-size: 15px;
}

body.dark-theme .my-child-rank-banner .rank-badge {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary);
}

.my-child-rank-banner .btn,
.my-child-rank-banner .btn-outline {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.36);
  color: #FFFFFF;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.my-child-rank-banner .btn:hover,
.my-child-rank-banner .btn-outline:hover {
  background: rgba(255, 255, 255, 0.26);
  border-color: rgba(255, 255, 255, 0.55);
}

body.dark-theme .my-child-rank-banner .btn,
body.dark-theme .my-child-rank-banner .btn-outline {
  background: rgba(16, 185, 129, 0.18);
  border-color: var(--primary-border);
  color: var(--text);
}

body.dark-theme .my-child-rank-banner .btn:hover,
body.dark-theme .my-child-rank-banner .btn-outline:hover {
  background: rgba(16, 185, 129, 0.28);
}

/* Highlighted Child Row in Rating Leaderboard */
.data-row.is-my-child {
  position: relative;
  z-index: 1;
  background: var(--primary-soft);
  border: 2px solid var(--primary);
  border-radius: 12px;
  box-shadow: 0 4px 16px -4px var(--primary-ring);
}

.data-row.is-my-child:last-child {
  border-bottom: 2px solid var(--primary);
}

.data-row.is-my-child:hover {
  background: var(--primary-soft);
}

.data-row.is-my-child .rank-badge:not(.rank-1):not(.rank-2):not(.rank-3) {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
}

body.dark-theme .data-row.is-my-child .rank-badge:not(.rank-1):not(.rank-2):not(.rank-3) {
  color: #04120B;
}

/* Glowing Gold/Emerald "My Child" Badge */
.pill-my-child {
  background: linear-gradient(135deg, var(--primary) 0%, #15803D 55%, var(--gold) 100%);
  color: #FFFFFF;
  border-color: rgba(186, 141, 91, 0.52);
  box-shadow: 0 2px 10px var(--primary-ring), inset 0 1px 0 rgba(255, 255, 255, 0.24);
  font-weight: 800;
  letter-spacing: 0.15px;
}

body.dark-theme .pill-my-child {
  background: linear-gradient(135deg, #10B981 0%, #059669 52%, #D4A574 100%);
  color: #04120B;
  border-color: rgba(212, 165, 116, 0.55);
  box-shadow: 0 2px 12px rgba(16, 185, 129, 0.36);
}

/* 13.5 Mobile & Print Refinement for v5.0 Components */
@media (max-width: 559px) {
  .classic-journal-wrap {
    border-radius: 14px;
  }

  .classic-journal-table .sticky-col-name {
    min-width: 136px;
    max-width: 168px;
    padding: 8px 10px;
    font-size: 12.5px;
  }

  .classic-journal-table .sticky-col-total {
    min-width: 54px;
    padding: 8px 6px;
    font-size: 12px;
  }

  .classic-journal-table .cj-th-date,
  .classic-journal-table td.cj-cell {
    min-width: 40px;
    width: 40px;
  }

  .classic-journal-table td.cj-cell {
    height: 38px;
    font-size: 12px;
  }

  .weekday-picker {
    gap: 4px;
  }

  .weekday-pill {
    height: 36px;
    font-size: 11px;
  }

  .my-child-rank-banner {
    padding: 14px;
    border-radius: 14px;
  }
}

@media print {
  .classic-journal-wrap {
    overflow: visible !important;
    border: 1px solid #9CA3AF !important;
    border-radius: 4px !important;
  }

  .classic-journal-table .sticky-col-name,
  .classic-journal-table .sticky-col-total {
    position: static !important;
    box-shadow: none !important;
  }

  .cj-editor-popover {
    display: none !important;
  }

  .my-child-rank-banner {
    background: #FFFFFF !important;
    color: #000000 !important;
    border: 1.5px solid #0F5B33 !important;
  }

  .my-child-rank-banner .row-title,
  .my-child-rank-banner .row-meta,
  .my-child-rank-banner strong {
    color: #000000 !important;
  }

  .data-row.is-my-child {
    border: 1.5px solid #0F5B33 !important;
    background: #FFFFFF !important;
  }

  .pill-my-child {
    background: #FFFFFF !important;
    color: #000000 !important;
    border: 1px solid #0F5B33 !important;
  }

  .status-select {
    display: inline-block !important;
    background: #FFFFFF !important;
    background-image: none !important;
    color: #000000 !important;
    border: 1px solid #6B7280 !important;
    padding: 1px 8px !important;
    height: auto !important;
    line-height: 1.3 !important;
  }
}

/* ----------------------------------------------------------------------------
   14. v6.0 — SMOOTH VIEW TRANSITIONS, MINIMALIST STUDENT CARDS,
       ICON-ONLY SEARCH BOX, SUBTLE DELETE ICON BUTTON
   ---------------------------------------------------------------------------- */

/* 14.1 Hardware-Accelerated View & Tab Content Entrance */
@keyframes viewFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-fade-in,
.app-main > * {
  animation: viewFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.cj-cell {
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.16s ease;
}

/* 14.2 Minimalist Student List Card */
.data-row.student-minimal-row {
  padding: 14px 20px;
  gap: 14px;
  flex-wrap: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.16s ease;
}

.data-row.student-minimal-row:hover {
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
  transform: translateX(2px);
}

.data-row.student-minimal-row:active {
  background: var(--surface-hover);
  transform: translateX(1px);
}

.data-row.student-minimal-row:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.data-row.student-minimal-row .row-main {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1 1 auto;
  min-width: 0;
}

.data-row.student-minimal-row .row-title,
.data-row.student-minimal-row .student-minimal-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.15px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-row.student-minimal-row > .toolbar,
.student-minimal-actions,
.student-minimal-right {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: nowrap;
  margin-left: auto;
}

.student-minimal-chevron,
.student-chevron,
.row-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--text-muted);
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.16s ease, transform 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

.data-row.student-minimal-row:hover .student-minimal-chevron,
.data-row.student-minimal-row:hover .student-chevron,
.data-row.student-minimal-row:hover .row-chevron {
  color: var(--primary);
  transform: translateX(2px);
}

/* 14.3 Icon-Only Expanding Search Box */
.search-icon-box {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 220px;
  max-width: 100%;
  flex-shrink: 0;
  transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-icon-box:focus-within {
  width: 300px;
}

.search-icon-box .search-svg-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.16s ease;
}

.search-icon-box svg.search-svg-icon,
.search-icon-box .search-svg-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
}

.search-icon-box:focus-within .search-svg-icon {
  color: var(--primary);
}

.search-icon-box .input,
.search-icon-box input {
  width: 100%;
  height: 40px;
  padding-left: 38px;
  padding-right: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

body:not(.dark-theme) .search-icon-box .input,
body:not(.dark-theme) .search-icon-box input {
  border-color: #D5DCE5;
}

.search-icon-box .input:hover,
.search-icon-box input:hover {
  border-color: var(--text-muted);
}

.search-icon-box .input:focus,
.search-icon-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

/* 14.4 Subtle Delete Icon Button */
.btn-icon-delete {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 9px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.16s ease;
}

.btn-icon-delete svg,
.btn-icon-delete svg.icon {
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.btn-icon-delete:hover:not(:disabled) {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.2);
}

body.dark-theme .btn-icon-delete:hover:not(:disabled) {
  border-color: rgba(248, 113, 113, 0.28);
}

.btn-icon-delete:active:not(:disabled) {
  transform: scale(0.94);
}

.btn-icon-delete:focus-visible {
  outline: 2px solid var(--danger);
  outline-offset: 2px;
}

.btn-icon-delete:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* 14.5 Mobile & Print Refinements for v6.0 Components */
@media (max-width: 559px) {
  .data-row.student-minimal-row,
  .data-row.student-minimal-row:has(> .toolbar) {
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    padding: 13px 14px;
    gap: 10px;
  }

  .data-row.student-minimal-row > .row-main,
  .data-row.student-minimal-row:has(> .toolbar) > .row-main {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
  }

  .data-row.student-minimal-row > .toolbar {
    width: auto;
    padding-top: 0;
    border-top: none;
    justify-content: flex-end;
  }

  .toolbar > .search-icon-box,
  .page-header > .toolbar > .search-icon-box {
    width: 100%;
    flex: 1 1 100%;
  }

  .search-icon-box:focus-within {
    width: 100%;
  }
}

@media print {
  .search-icon-box,
  .btn-icon-delete,
  .student-minimal-chevron,
  .student-chevron,
  .row-chevron {
    display: none !important;
  }

  .data-row.student-minimal-row:hover {
    background: #FFFFFF !important;
    box-shadow: none !important;
    transform: none !important;
  }
}

/* ----------------------------------------------------------------------------
   15. v7.0 — DESIGN POLISH, NOTIFICATION CENTER (🔔 ХАБАРНОМАЛАР),
       3-CHANNEL BADGES (TG / APK / WEB) & IPHONE PWA BANNER
   ---------------------------------------------------------------------------- */

/* Elevated Auth Card */
.auth-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 26px 22px 24px;
  box-shadow: 0 18px 42px -14px rgba(15, 91, 51, 0.14), var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.auth-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--gold) 100%);
}

/* Header & Bottom Nav Polish */
.app-header {
  box-shadow: 0 1px 0 var(--border-subtle), 0 4px 14px -6px rgba(15, 23, 42, 0.05);
}

.header-logo {
  box-shadow: 0 2px 6px rgba(15, 91, 51, 0.14);
}

@media (max-width: 767px) {
  .app-nav {
    box-shadow: 0 -4px 18px -6px rgba(15, 23, 42, 0.08);
  }
  .nav-btn.active {
    background: var(--primary-soft);
    font-weight: 700;
  }
}

/* Notification Bell & Unread Badge */
.notif-bell-btn {
  position: relative;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #DC2626;
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
  pointer-events: none;
}

/* Notification Feed Modal */
.notif-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 62vh;
  overflow-y: auto;
  padding-right: 2px;
}

.notif-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.notif-card.unread {
  border-color: var(--primary-border);
  background: var(--primary-soft);
}

.notif-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--surface-subtle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.notif-card.unread .notif-icon-wrap {
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.notif-content {
  flex: 1 1 auto;
  min-width: 0;
}

.notif-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.notif-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.3;
}

.notif-time {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.notif-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.48;
  white-space: pre-line;
  word-break: break-word;
}

/* iPhone / Web PWA Install Helper Banner */
.pwa-install-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary-soft) 0%, var(--gold-soft) 100%);
  border: 1px solid var(--primary-border);
}

.pwa-install-text {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
  font-weight: 600;
}

.pwa-install-text b {
  color: var(--primary);
  font-weight: 800;
}

/* Subtle Channel Pill (TG / APK / Web) */
.channel-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  vertical-align: middle;
}

/* ----------------------------------------------------------------------------
   16. ADMIN PANEL MOBILE & APK ERGONOMICS (CLEAN CARDS, FILTERS & BUTTON STATES)
   ---------------------------------------------------------------------------- */

/* Horizontal scrollable filter strip for Institutions */
.admin-filter-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.admin-filter-strip::-webkit-scrollbar {
  display: none;
}

.admin-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: all 0.15s ease;
}

.admin-filter-pill:hover {
  border-color: var(--primary-border);
  color: var(--text);
}

.admin-filter-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 4px 12px -2px rgba(15, 91, 51, 0.28);
}

body.dark-theme .admin-filter-pill.active {
  color: #04120B;
}

/* Admin Entity Card List (Institutions, Ustazs, Groups) */
.admin-card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.admin-card.is-head-card {
  border-color: rgba(217, 119, 6, 0.45);
  background: linear-gradient(180deg, rgba(254, 243, 199, 0.22) 0%, var(--surface) 60%);
}

body.dark-theme .admin-card.is-head-card {
  background: linear-gradient(180deg, rgba(217, 119, 6, 0.08) 0%, var(--surface) 60%);
}

.admin-card.is-suspended-card {
  opacity: 0.78;
  border-color: rgba(220, 38, 38, 0.35);
}

.admin-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.admin-card-identity {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
}

.admin-card-title {
  font-size: 15.5px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.3;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-card-code {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  padding: 1px 7px;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
}

.admin-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Tappable temporary password / credential chip */
.admin-cred-chip {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--primary-soft);
  border: 1px dashed var(--primary-border);
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: transform 0.12s ease, background-color 0.15s ease;
}

.admin-cred-chip:active {
  transform: scale(0.985);
}

/* Uniform Action Bar inside Admin Cards */
.admin-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.admin-actions-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1 1 auto;
}

.admin-actions-end {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.admin-card-actions .btn-sm {
  height: 36px;
  padding: 0 12px;
  font-size: 12.5px;
  border-radius: 10px;
}

.btn-head-toggle {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
}

.btn-head-toggle.is-active {
  background: #FEF3C7;
  border-color: #F59E0B;
  color: #B45309;
  font-weight: 800;
}

body.dark-theme .btn-head-toggle.is-active {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.45);
  color: #FBBF24;
}

.pill-gold {
  background: #FEF3C7;
  color: #B45309;
  border-color: rgba(245, 158, 11, 0.35);
}

body.dark-theme .pill-gold {
  background: rgba(245, 158, 11, 0.16);
  color: #FBBF24;
  border-color: rgba(245, 158, 11, 0.35);
}

/* Tactile button feedback on touch screens */
.btn:active:not(:disabled),
.seg-tab:active:not(:disabled),
.admin-filter-pill:active:not(:disabled) {
  transform: scale(0.97);
}

/* Anti-fraud 4-metric grid inside admin card */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

@media (max-width: 420px) {
  .admin-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.admin-stat-box {
  background: var(--surface-subtle);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-stat-val {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ----------------------------------------------------------------------------
   17. v8.0 — HIGH-CRAFT EDTECH REDESIGN (STUDENT PROFILE SHEET, TACTILE
       JOURNAL ROWS & MUROJAA MATRIX)
   ---------------------------------------------------------------------------- */

/* 17.1 Journal Section Headers & Tactile Rows */
.journal-section-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 10px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.journal-section-bar .section-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.journal-section-bar.is-quran {
  color: var(--primary);
  border-color: var(--primary-border);
  background: var(--primary-soft);
}

.journal-section-bar.is-quran .section-dot {
  background: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.journal-section-bar.is-muallim {
  color: var(--text-secondary);
}

.journal-section-bar .section-count {
  font-variant-numeric: tabular-nums;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  font-size: 11px;
}

body.dark-theme .journal-section-bar .section-count {
  background: rgba(255, 255, 255, 0.08);
}

.avatar.journal-num-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
  background: var(--surface-subtle);
  color: var(--text-secondary);
  border-color: var(--border);
}

.journal-row.is-marked .avatar.journal-num-badge {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary-border);
}

.quran-grade-strip {
  align-items: center;
  gap: 3px;
  padding: 3px 5px;
}

.quran-lines-inp {
  width: 60px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  text-align: center;
  font-weight: 800;
  font-size: 13px;
  padding: 0 4px;
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.quran-lines-inp:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.journal-clear-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.14s ease;
}

.journal-clear-btn:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.journal-xp-pill {
  min-width: 42px;
  justify-content: center;
  font-weight: 800;
}

/* 17.2 Student Profile Modal Overhaul */
.st-modal-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.st-modal-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.avatar.st-modal-avatar {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 4px 12px -2px var(--primary-ring);
}

.st-modal-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.35px;
  line-height: 1.25;
  color: var(--text);
  margin: 0 0 5px;
}

.st-modal-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.st-track-card {
  padding: 12px;
  border-radius: 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  margin-bottom: 14px;
}

.st-norm-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.st-norm-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.st-norm-pills {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.st-norm-chip {
  min-width: 32px;
  height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: all 0.14s ease;
}

.st-norm-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.st-norm-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 2px 6px var(--primary-ring);
}

body.dark-theme .st-norm-chip.active {
  color: #04120B;
}

/* Clean 2x2 Key-Value Grid replacing oversized 18px gray boxes */
.st-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
  margin-bottom: 14px;
}

.st-info-cell {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.st-info-cell:nth-child(2n) {
  border-right: none;
}

.st-info-cell:nth-last-child(-n+2) {
  border-bottom: none;
}

.st-info-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.st-info-val {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.st-info-val.is-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.4px;
  color: var(--primary);
}

.st-section-box {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 14px;
}

.st-modal-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.st-primary-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.st-secondary-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.st-secondary-actions > .btn {
  flex: 1 1 auto;
}

/* 17.3 Murojaa 30 Juz & 114 Surahs Tactile Grid */
.murojaa-juz-box {
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.murojaa-juz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.murojaa-juz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
  gap: 6px;
}

.murojaa-juz-tile {
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.14s ease;
}

.murojaa-juz-tile:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.murojaa-juz-tile .juz-num {
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.murojaa-juz-tile .juz-check {
  font-size: 9.5px;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
  margin-top: 2px;
}

.murojaa-juz-tile.is-done {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 2px 8px -2px var(--primary-ring);
}

.murojaa-surah-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 8px;
}

.murojaa-surah-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s ease;
}

.murojaa-surah-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}

.murojaa-surah-card.is-done {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.surah-num-chip {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.murojaa-surah-card.is-done .surah-num-chip {
  background: var(--primary);
  color: #FFFFFF;
}

body.dark-theme .murojaa-surah-card.is-done .surah-num-chip {
  color: #04120B;
}

.surah-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.surah-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.surah-m-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 26px;
  padding: 0 8px;
  border-radius: 7px;
  font-weight: 900;
  font-size: 11.5px;
  background: var(--surface-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.surah-m-badge.is-done {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
}

body.dark-theme .surah-m-badge.is-done {
  color: #04120B;
}

/* 17.4 Mobile-First Student Rows & Murojaa Cards (Zero Truncation, Crisp Hierarchy) */
.data-row.student-minimal-row .row-title.student-full-name {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.28;
  word-break: break-word;
}

.track-toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.track-toggle-pill .track-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.track-toggle-pill.is-quran {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary);
}

.track-toggle-pill.is-quran .track-dot {
  background: var(--primary);
}

.track-toggle-pill:active {
  transform: scale(0.95);
}

/* Murojaa Student List Cards (Clean 2-row native card layout) */
.murojaa-student-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.murojaa-student-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.14s ease;
}

.murojaa-student-row:hover {
  border-color: var(--primary-border);
  box-shadow: var(--shadow-sm);
}

.murojaa-student-row:active {
  transform: scale(0.99);
}

.murojaa-student-top {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.murojaa-student-name {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.2px;
  line-height: 1.3;
  word-break: break-word;
}

.murojaa-student-bottom {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 46px;
}

.murojaa-mini-bar {
  flex: 1;
  min-width: 48px;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-subtle);
  overflow: hidden;
}

.murojaa-mini-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), #22C55E);
  transition: width 0.3s ease;
}

.murojaa-student-pills {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.murojaa-student-pills .pill {
  height: 22px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 800;
}

.murojaa-recent-line {
  padding-left: 46px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 480px) {
  .seg-tab {
    padding: 0 10px;
    font-size: 11.5px;
  }

  .murojaa-student-row {
    padding: 13px 14px;
    gap: 8px;
  }

  .murojaa-student-bottom,
  .murojaa-recent-line {
    padding-left: 0;
  }
}

/* 17.5 Journal Progress Bar, 2-Tier Mobile Journal Rows & Parent Today/Week Strip */
.journal-progress-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.journal-progress-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.journal-progress-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.journal-progress-label strong {
  color: var(--primary);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.journal-progress-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-subtle);
  overflow: hidden;
}

.journal-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), #22C55E);
  transition: width 0.25s ease;
}

.journal-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 1 1 240px;
  min-width: 0;
}

.journal-row-meta-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

@media (max-width: 559px) {
  .data-row.journal-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 13px 14px;
  }

  .journal-row-top {
    width: 100%;
    flex: 0 0 auto;
  }

  .data-row.journal-row > .journal-switch-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
  }

  .data-row.journal-row .switch-pills {
    width: 100%;
    display: flex;
  }

  .data-row.journal-row .sw-btn {
    flex: 1 1 0;
    height: 34px;
  }

  .data-row.journal-row .quran-lines-inp {
    flex: 1.2 1 64px;
    height: 32px;
  }
}

/* Parent Today Hero Card */
.parent-today-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.15s ease;
}

.parent-today-card:active {
  transform: scale(0.99);
}

.parent-today-card.is-good {
  border-color: var(--primary-border);
  background: linear-gradient(135deg, var(--primary-soft) 0%, var(--surface) 75%);
}

.parent-today-card.is-warn {
  border-color: rgba(217, 119, 6, 0.35);
  background: linear-gradient(135deg, var(--warning-bg) 0%, var(--surface) 75%);
}

.parent-today-card.is-bad {
  border-color: rgba(220, 38, 38, 0.35);
  background: linear-gradient(135deg, var(--danger-bg) 0%, var(--surface) 75%);
}

.parent-today-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.parent-today-eyebrow {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.parent-today-status {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.3;
}

/* Parent 7-Day Attendance Circles */
.parent-week-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.week-circle-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.week-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  border: 1.5px solid transparent;
}

.week-circle.is-good {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(21, 128, 61, 0.25);
}

.week-circle.is-warn {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: rgba(180, 83, 9, 0.25);
}

.week-circle.is-excused {
  background: rgba(59, 130, 246, 0.14);
  color: #2563EB;
  border-color: rgba(59, 130, 246, 0.28);
}

body.dark-theme .week-circle.is-excused {
  color: #60A5FA;
}

.week-circle.is-bad {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.25);
}

.week-date {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* 17.6 Login Password Toggle, Journal Status Tint, Rating Podium & Empty States */
.field-eye-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}

.field-eye-btn:hover {
  color: var(--text);
  background: var(--surface-subtle);
}

.data-row.journal-row {
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.data-row.journal-row.is-present {
  background: rgba(21, 128, 61, 0.045);
  border-left: 3px solid var(--success);
}

.data-row.journal-row.is-absent {
  background: rgba(220, 38, 38, 0.045);
  border-left: 3px solid var(--danger);
}

body.dark-theme .data-row.journal-row.is-present {
  background: rgba(34, 197, 94, 0.075);
}

body.dark-theme .data-row.journal-row.is-absent {
  background: rgba(239, 68, 68, 0.075);
}

.rating-podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
  margin-bottom: 16px;
}

.podium-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 14px 8px 12px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.podium-card:active {
  transform: scale(0.98);
}

.podium-card.podium-1 {
  padding-top: 20px;
  padding-bottom: 16px;
  border-color: rgba(212, 165, 116, 0.55);
  background: linear-gradient(180deg, rgba(212, 165, 116, 0.16) 0%, var(--surface) 68%);
  box-shadow: var(--shadow-sm);
}

.podium-card.podium-2 {
  border-color: rgba(148, 163, 184, 0.45);
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.11) 0%, var(--surface) 72%);
}

.podium-card.podium-3 {
  border-color: rgba(180, 115, 70, 0.4);
  background: linear-gradient(180deg, rgba(180, 115, 70, 0.10) 0%, var(--surface) 72%);
}

.podium-card.is-my-child {
  box-shadow: 0 0 0 2px var(--primary);
}

.podium-medal {
  font-size: 20px;
  line-height: 1;
  margin-bottom: 6px;
}

.podium-1 .podium-medal {
  font-size: 24px;
}

.podium-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 16px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.podium-1 .podium-avatar {
  width: 46px;
  height: 46px;
  font-size: 18px;
  background: var(--primary);
  color: #FFFFFF;
}

.podium-name {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.25;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.podium-inst {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.podium-pts {
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.empty-state-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  gap: 10px;
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--surface-subtle);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.empty-state-icon svg {
  width: 24px;
  height: 24px;
}

.empty-state-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
}

/* 17.8 Mobile-First Native App Shell & Bottom Sheets (90% Smartphone Users) */
@keyframes sheet-up {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 767px) {
  .app-main {
    padding: 14px 12px calc(var(--bottom-nav-h) + var(--safe-bottom) + 22px);
  }

  .app-nav {
    height: calc(66px + var(--safe-bottom));
    padding: 6px 10px calc(6px + var(--safe-bottom));
    box-shadow: 0 -6px 24px rgba(16, 32, 26, 0.06);
  }

  .nav-btn {
    border-radius: 14px;
    gap: 4px;
    font-size: 11px;
  }

  .nav-btn.active {
    background: var(--primary-soft);
    font-weight: 700;
  }

  .nav-btn.active::before {
    display: none;
  }

  .page-header {
    gap: 10px;
    margin-bottom: 14px;
  }

  .page-header .btn {
    min-height: 40px;
    border-radius: 12px;
  }

  .btn {
    min-height: 42px;
    border-radius: 12px;
  }

  .btn-sm {
    min-height: 36px;
    padding: 0 12px;
    border-radius: 10px;
  }

  .input,
  .select {
    min-height: 44px;
    border-radius: 12px;
    font-size: 15px;
  }

  .data-list {
    background: transparent;
    border: none;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .data-row {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 13px 14px;
    box-shadow: var(--shadow-xs);
  }

  .data-row + .data-row {
    border-top: 1px solid var(--border);
  }

  .data-row.journal-row .sw-btn {
    height: 38px;
    font-size: 13.5px;
    border-radius: 10px;
  }

  .admin-card {
    border-radius: 18px;
    padding: 15px;
  }
}

@media (max-width: 640px) {
  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .modal-card {
    position: relative;
    max-width: 100%;
    width: 100%;
    max-height: 92dvh;
    border-radius: 24px 24px 0 0;
    padding: 20px 16px calc(22px + var(--safe-bottom));
    border-left: none;
    border-right: none;
    border-bottom: none;
    animation: sheet-up 0.24s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .modal-card::before {
    content: '';
    display: block;
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: var(--border-strong);
    margin: -6px auto 14px;
    opacity: 0.7;
  }
}

/* 17.7 Islamic EdTech Redesign: Emerald Hero Banner, Progress Ring & 30-Juz Heatmap */
.parent-hero-banner {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #0E6B47 0%, #094D33 100%);
  color: #FFFFFF;
  box-shadow: 0 12px 28px -10px rgba(14, 107, 71, 0.45);
}

.parent-hero-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.08;
  background-image: radial-gradient(circle at 85% 20%, #FFFFFF 1.5px, transparent 1.5px),
    radial-gradient(circle at 15% 80%, #C9963B 1.5px, transparent 1.5px);
  background-size: 26px 26px;
  pointer-events: none;
}

.parent-hero-top {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.parent-hero-info {
  min-width: 0;
  flex: 1;
}

.parent-hero-name {
  font-size: 19px;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.25;
  margin-bottom: 4px;
}

.parent-hero-meta {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.35;
}

.attendance-ring {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: conic-gradient(#F3D08A calc(var(--pct, 0) * 1%), rgba(255, 255, 255, 0.18) 0);
}

.attendance-ring-inner {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #0B583B;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
}

.attendance-ring-pct {
  font-size: 14px;
  font-weight: 800;
  color: #FFFFFF;
  font-variant-numeric: tabular-nums;
}

.attendance-ring-lbl {
  font-size: 8.5px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.78);
  text-transform: uppercase;
  margin-top: 2px;
}

.parent-hero-badges {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.hero-chip.is-gold {
  background: linear-gradient(135deg, #D9A54A, #B8832B);
  border-color: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
}

.juz-heatmap-card {
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
}

.juz-heatmap-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.juz-heatmap-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text);
}

.juz-heatmap-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

.juz-tile {
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--surface-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  transition: transform 0.12s ease;
}

.juz-tile.is-done {
  background: linear-gradient(135deg, #0E6B47, #158A5D);
  color: #FFFFFF;
  border-color: transparent;
}

.journal-progress-card {
  background: linear-gradient(135deg, #0E6B47 0%, #0A5337 100%);
  color: #FFFFFF;
  border-color: transparent;
  box-shadow: 0 8px 20px -8px rgba(14, 107, 71, 0.4);
}

.journal-progress-label {
  color: rgba(255, 255, 255, 0.85);
}

.journal-progress-label strong {
  color: #F3D08A;
}

.journal-progress-track {
  background: rgba(255, 255, 255, 0.18);
}

.journal-progress-fill {
  background: linear-gradient(90deg, #D9A54A, #F3D08A);
}








/* ===== Horizontal Date Strip & Live Day Summary (v54) ===== */
.journal-date-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.date-strip-nav {
  flex-shrink: 0;
  width: 34px;
  height: 52px;
  border: none;
  border-radius: 11px;
  background: var(--bg-soft, rgba(14, 107, 71, 0.06));
  color: var(--text-secondary);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.12s;
}

.date-strip-nav:active {
  transform: scale(0.94);
}

.date-strip-days {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.date-chip {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 52px;
  padding: 4px 2px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

.date-chip.has-lesson {
  color: var(--text-primary);
}

.date-chip-dow {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.date-chip-num {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.1;
}

.date-chip-dot {
  width: 5px;
  height: 5px;
  border-radius: 99px;
  background: transparent;
}

.date-chip.has-lesson .date-chip-dot {
  background: var(--primary);
  opacity: 0.55;
}

.date-chip.is-today:not(.is-active) {
  border-color: rgba(14, 107, 71, 0.35);
  background: rgba(14, 107, 71, 0.06);
}

.date-chip.is-active {
  background: linear-gradient(135deg, #0e6b47 0%, #094d33 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(14, 107, 71, 0.28);
}

.date-chip.is-active .date-chip-dow {
  color: rgba(255, 255, 255, 0.82);
}

.date-chip.is-active .date-chip-dot {
  background: #f5d07a;
  opacity: 1;
}

.journal-day-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.jstat-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 700;
}

.jstat-pill.is-present {
  background: rgba(14, 107, 71, 0.12);
  color: #0e6b47;
}

.jstat-pill.is-excused {
  background: rgba(201, 150, 59, 0.16);
  color: #9a6b16;
}

.jstat-pill.is-unexcused {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
}

body.dark-theme .jstat-pill.is-present {
  background: rgba(16, 185, 129, 0.16);
  color: #6ee7b7;
}

body.dark-theme .jstat-pill.is-excused {
  background: rgba(245, 158, 11, 0.16);
  color: #fcd34d;
}

body.dark-theme .jstat-pill.is-unexcused {
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
}

/* ===== Admin Pro Mobile Upgrades (v55) ===== */
.admin-search-wrap {
  position: relative;
  margin-bottom: 14px;
}

.admin-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0 12px;
  height: 46px;
  box-shadow: var(--shadow-sm);
}

.admin-search-icon {
  font-size: 16px;
  opacity: 0.7;
}

.admin-search-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  min-width: 0;
}

.admin-search-results {
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-height: 320px;
  overflow-y: auto;
}

.admin-search-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.admin-search-item:last-child {
  border-bottom: none;
}

.admin-search-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: rgba(14, 107, 71, 0.1);
  flex-shrink: 0;
}

.admin-search-name {
  font-weight: 700;
  font-size: 14px;
}

.admin-search-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.admin-search-empty {
  padding: 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.admin-quick-dock {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.admin-dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s, border-color 0.15s;
}

.admin-dock-btn:active {
  transform: scale(0.96);
}

.admin-dock-ico {
  font-size: 18px;
}

.admin-dock-lbl {
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.admin-more-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-card-badges-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.pulse-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 700;
}

.pulse-pill.is-done {
  background: rgba(14, 107, 71, 0.12);
  color: #0e6b47;
}

.pulse-pill.is-partial {
  background: rgba(201, 150, 59, 0.16);
  color: #9a6b16;
}

.pulse-pill.is-idle,
.pulse-pill.is-empty {
  background: rgba(100, 116, 139, 0.12);
  color: var(--text-muted);
}

body.dark-theme .pulse-pill.is-done {
  background: rgba(16, 185, 129, 0.16);
  color: #6ee7b7;
}

body.dark-theme .pulse-pill.is-partial {
  background: rgba(245, 158, 11, 0.16);
  color: #fcd34d;
}

/* ===== v56 Pro Vector Polish & Compact Admin ===== */
.kpi-value,
.date-chip-num,
.jstat-pill,
.pulse-pill,
.journal-xp-pill {
  font-variant-numeric: tabular-nums;
}

.pulse-pill svg.icon,
.quick-chip svg.icon,
.admin-more-btn svg.icon,
.sheet-action-btn svg.icon {
  width: 15px;
  height: 15px;
}

.page-title-count {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 16px;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-quick-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 12px;
  scrollbar-width: none;
}

.admin-quick-strip::-webkit-scrollbar {
  display: none;
}

.quick-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 13px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s, background 0.15s;
}

.quick-chip:active {
  transform: scale(0.97);
}

.kpi-grid-compact {
  gap: 10px;
}

.kpi-grid-compact .kpi-card {
  padding: 11px 13px;
}

.kpi-sub-slash {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 2px;
}

.admin-card-pro {
  cursor: pointer;
}

.inst-icon-box {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.inst-icon-box svg.icon {
  width: 20px;
  height: 20px;
}

.admin-card-info {
  min-width: 0;
  flex: 1;
}

.admin-card-meta-clean {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.admin-card-addr {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.sheet-title {
  font-weight: 800;
  font-size: 17px;
}

.sheet-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.sheet-actions-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sheet-action-btn {
  justify-content: flex-start;
  height: 46px;
  gap: 10px;
}

/* ===== v57 Parent Pro UI (Sibling Switcher, Hero SVG, Attendance Filters) ===== */
.hero-chip svg.icon {
  width: 14px;
  height: 14px;
}

.sibling-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 12px;
  scrollbar-width: none;
}

.sibling-strip::-webkit-scrollbar {
  display: none;
}

.sibling-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px 0 5px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.sibling-chip-av {
  width: 26px;
  height: 26px;
  border-radius: 99px;
  background: var(--surface-subtle);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

.sibling-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.sibling-chip.active .sibling-chip-av {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.parent-att-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 12px;
  scrollbar-width: none;
}

.parent-att-filters::-webkit-scrollbar {
  display: none;
}

.quick-chip.is-selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.att-row {
  border-left: 3.5px solid transparent;
}

.att-row.is-present {
  border-left-color: var(--primary);
}

.att-row.is-excused {
  border-left-color: var(--gold);
}

.att-row.is-unexcused {
  border-left-color: var(--danger);
}

/* ===== v59 Smooth Native-Like Transitions & Auth Admin Contact ===== */
@keyframes viewSlideFade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.view-fade-in {
  animation: viewSlideFade 0.22s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.modal-overlay {
  transition: opacity 0.2s ease;
}

.modal-card {
  animation: modalSlideUp 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.btn,
.quick-chip,
.admin-card,
.data-row,
.nav-btn,
.date-chip,
.sibling-chip {
  transition: transform 0.14s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.auth-admin-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 12px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.15s ease, transform 0.12s ease;
}

.auth-admin-link:active {
  transform: scale(0.98);
}

.notif-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.notif-del-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
}

.notif-del-btn:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

.notif-del-btn svg.icon {
  width: 14px;
  height: 14px;
}

/* ===== v60 UI Design Studio Final Polish & Reduced Motion ===== */
.jstat-pill svg.icon,
.juz-heatmap-title svg.icon {
  width: 13px;
  height: 13px;
  vertical-align: -2px;
}

.juz-heatmap-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@media (prefers-reduced-motion: reduce) {
  .view-fade-in,
  .modal-card {
    animation: none !important;
  }
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}

/* ===== Irfon Coins Shop (White Studio Marketplace Cards) ===== */
.shop-balance-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, #0e6b47 0%, #094d33 100%);
  color: #ffffff;
  margin-bottom: 14px;
  box-shadow: var(--shadow-md);
}

.shop-balance-val {
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #f5d07a;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (min-width: 768px) {
  .shop-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.shop-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.shop-card-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #ffffff;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border-subtle);
}

.shop-card-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.shop-card-cat {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(16, 32, 26, 0.06);
  color: #43564e;
  font-size: 10.5px;
  font-weight: 700;
}

.shop-card-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.shop-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 34px;
}

.shop-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: auto;
}

.shop-price-pill {
  font-size: 12.5px;
  font-weight: 800;
  color: #9a6b16;
  background: #fdf6e7;
  padding: 3px 8px;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}

body.dark-theme .shop-price-pill {
  background: rgba(212, 165, 116, 0.16);
  color: #fcd34d;
}

.shop-card-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.shop-card-stock {
  font-size: 11.5px;
  color: var(--text-secondary);
}
