/* Aether Campus — Shared Components */

.text-muted { color: var(--text2); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.w-full { width: 100%; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }

.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r3);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.card-body { padding: 1.25rem; }
.card-title {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 1.15rem;
  border-radius: var(--r2);
  border: 1px solid transparent;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, box-shadow 0.2s, border-color 0.2s;
  white-space: nowrap;
  background: transparent;
  color: var(--text);
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent2);
  box-shadow: 0 8px 24px rgba(43, 110, 232, 0.28);
  color: #fff;
}
.btn-secondary {
  background: var(--surface2);
  border-color: var(--border2);
  color: var(--text2);
}
.btn-secondary:hover { color: var(--text); background: var(--surface3); }
.btn-outline {
  border-color: var(--border2);
  color: var(--text2);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ai {
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: #fff;
  box-shadow: 0 6px 18px rgba(123, 94, 248, 0.28);
}
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-icon:hover {
  color: var(--text);
  background: var(--surface2);
  border-color: var(--border2);
}
.btn[disabled], .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ==========================================================================
   State 1: Button Loading State
   Usage: Add class 'is-loading' (or 'btn-loading' / [data-loading="true"]) to any .btn / .btn-icon.
          Disabled state is automatically enforced via CSS and JS API.
   ========================================================================== */
.btn.is-loading,
.btn.btn-loading,
.btn[data-loading="true"],
.btn-icon.is-loading,
.btn-icon.btn-loading,
.btn-icon[data-loading="true"] {
  position: relative !important;
  pointer-events: none !important;
  cursor: not-allowed !important;
  user-select: none !important;
}

/* Ensure button stays solid and visible while disabled in loading state */
.btn.is-loading:disabled,
.btn.is-loading[disabled],
.btn.btn-loading:disabled,
.btn.btn-loading[disabled],
.btn[data-loading="true"]:disabled,
.btn[data-loading="true"][disabled],
.btn-icon.is-loading:disabled,
.btn-icon.is-loading[disabled] {
  opacity: 0.88 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

/* Centered spinner for standard buttons (preserves exact dimensions, zero layout shift) */
.btn.is-loading:not(.has-loading-text)::after,
.btn.btn-loading:not(.has-loading-text)::after,
.btn[data-loading="true"]:not(.has-loading-text)::after,
.btn-icon.is-loading::after,
.btn-icon.btn-loading::after,
.btn-icon[data-loading="true"]::after {
  content: '';
  position: absolute;
  width: 1.15em;
  height: 1.15em;
  top: 50%;
  left: 50%;
  margin-top: -0.575em;
  margin-left: -0.575em;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: currentColor;
  animation: acBtnSpin 0.65s linear infinite;
  box-sizing: border-box;
  z-index: 2;
}

/* Hide children text/icons while loading (maintains width/height so button doesn't jump) */
.btn.is-loading:not(.has-loading-text) > *,
.btn.btn-loading:not(.has-loading-text) > *,
.btn[data-loading="true"]:not(.has-loading-text) > *,
.btn-icon.is-loading > *,
.btn-icon.btn-loading > *,
.btn-icon[data-loading="true"] > * {
  visibility: hidden !important;
  opacity: 0 !important;
}
.btn.is-loading:not(.has-loading-text),
.btn.btn-loading:not(.has-loading-text),
.btn[data-loading="true"]:not(.has-loading-text) {
  color: transparent !important;
}

/* Spinner alongside visible text (when .has-loading-text or [data-loading-text] is present) */
.btn.is-loading.has-loading-text::before,
.btn.btn-loading.has-loading-text::before {
  content: '';
  display: inline-block;
  width: 0.95em;
  height: 0.95em;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: currentColor;
  animation: acBtnSpin 0.65s linear infinite;
  box-sizing: border-box;
  margin-right: 0.5rem;
  vertical-align: -0.1em;
}

/* Variants spinner color adjustments */
.btn-primary.is-loading::after,
.btn-primary.is-loading.has-loading-text::before,
.btn-danger.is-loading::after,
.btn-danger.is-loading.has-loading-text::before,
.btn-ai.is-loading::after,
.btn-ai.is-loading.has-loading-text::before {
  border-color: rgba(255, 255, 255, 0.32);
  border-top-color: #ffffff;
}

.btn-secondary.is-loading::after,
.btn-secondary.is-loading.has-loading-text::before,
.btn-outline.is-loading::after,
.btn-outline.is-loading.has-loading-text::before {
  border-color: rgba(43, 110, 232, 0.22);
  border-top-color: var(--accent);
}

.btn-sm.is-loading:not(.has-loading-text)::after {
  width: 0.95em;
  height: 0.95em;
  margin-top: -0.475em;
  margin-left: -0.475em;
  border-width: 1.75px;
}
.btn-sm.is-loading.has-loading-text::before {
  width: 0.85em;
  height: 0.85em;
  border-width: 1.75px;
}

.btn-icon.is-loading::after {
  width: 18px;
  height: 18px;
  margin-top: -9px;
  margin-left: -9px;
  border-color: rgba(43, 110, 232, 0.25);
  border-top-color: var(--accent);
}

@keyframes acBtnSpin {
  to { transform: rotate(360deg); }
}


.badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.25rem 0.7rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600;
}
.badge-primary { background: var(--ag); color: var(--accent); }
.badge-success { background: rgba(52,196,124,.15); color: var(--success); }
.badge-warning { background: rgba(245,166,35,.15); color: var(--warning); }
.badge-danger { background: rgba(224,82,82,.15); color: var(--danger); }
.badge-ai { background: var(--pg); color: var(--purple); }
.badge-neutral { background: var(--surface3); color: var(--text2); }

.form-group { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }
.form-label { font-size: 0.8rem; font-weight: 600; color: var(--text2); }
.form-control {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: var(--r2);
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
/*body.light .form-control { background: var(--surface); }*/
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ag);
}
.form-control::placeholder { color: var(--text3); }
.form-hint { font-size: 0.75rem; color: var(--text3); }

.table-wrap {
  width: 100%; overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.card > .table-wrap {
  border: 0;
  border-radius: 0;
}
.card > .pagination {
  border-top: 1px solid var(--border);
}
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; padding: 0.85rem 1rem;
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text2); background: var(--surface2); border-bottom: 1px solid var(--border);
  font-family: var(--font-sans); font-weight: 600;
}
.table td {
  padding: 0.9rem 1rem; border-bottom: 1px solid var(--border);
  font-size: 0.875rem; color: var(--text2); background: var(--surface);
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface2); }
.table td.strong { color: var(--text); font-weight: 600; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ag); color: var(--accent); font-weight: 700; font-size: 0.8rem;
  flex-shrink: 0;
}
.avatar-lg { width: 56px; height: 56px; font-size: 1.1rem; }

/* ==========================================================================
   Executive KPI & Stat Cards (Top-of-Page Cards)
   ========================================================================== */

/* Thematic Color Themes & CSS Variables */
.kpi {
  --kpi-accent: var(--accent, #4F8EF7);
  --kpi-glow: rgba(79, 142, 247, 0.16);
  --kpi-bg-icon: rgba(79, 142, 247, 0.12);
  --kpi-border: rgba(79, 142, 247, 0.3);
}

/* Sequential color variations across grids: Blue -> Green -> Purple -> Amber -> Teal -> Rose */
.grid > .kpi:nth-child(1),
.grid > .card.kpi:nth-child(1),
.kpi.kpi-primary {
  --kpi-accent: #4F8EF7;
  --kpi-glow: rgba(79, 142, 247, 0.18);
  --kpi-bg-icon: rgba(79, 142, 247, 0.12);
  --kpi-border: rgba(79, 142, 247, 0.3);
}

.grid > .kpi:nth-child(2),
.grid > .card.kpi:nth-child(2),
.kpi.kpi-success {
  --kpi-accent: #34C47C;
  --kpi-glow: rgba(52, 196, 124, 0.18);
  --kpi-bg-icon: rgba(52, 196, 124, 0.12);
  --kpi-border: rgba(52, 196, 124, 0.3);
}

.grid > .kpi:nth-child(3),
.grid > .card.kpi:nth-child(3),
.kpi.kpi-purple {
  --kpi-accent: #7B5EF8;
  --kpi-glow: rgba(123, 94, 248, 0.18);
  --kpi-bg-icon: rgba(123, 94, 248, 0.12);
  --kpi-border: rgba(123, 94, 248, 0.3);
}

.grid > .kpi:nth-child(4),
.grid > .card.kpi:nth-child(4),
.kpi.kpi-warning {
  --kpi-accent: #F5A623;
  --kpi-glow: rgba(245, 166, 35, 0.18);
  --kpi-bg-icon: rgba(245, 166, 35, 0.12);
  --kpi-border: rgba(245, 166, 35, 0.3);
}

.grid > .kpi:nth-child(5),
.grid > .card.kpi:nth-child(5),
.kpi.kpi-teal {
  --kpi-accent: #2DD4BF;
  --kpi-glow: rgba(45, 212, 191, 0.18);
  --kpi-bg-icon: rgba(45, 212, 191, 0.12);
  --kpi-border: rgba(45, 212, 191, 0.3);
}

.grid > .kpi:nth-child(6),
.grid > .card.kpi:nth-child(6),
.kpi.kpi-danger {
  --kpi-accent: #E05252;
  --kpi-glow: rgba(224, 82, 82, 0.18);
  --kpi-bg-icon: rgba(224, 82, 82, 0.12);
  --kpi-border: rgba(224, 82, 82, 0.3);
}

/* Light Mode calibrated theme tokens */
body.light .grid > .kpi:nth-child(1),
body.light .grid > .card.kpi:nth-child(1),
body.light .kpi.kpi-primary {
  --kpi-accent: #2B6EE8;
  --kpi-glow: rgba(43, 110, 232, 0.12);
  --kpi-bg-icon: rgba(43, 110, 232, 0.08);
  --kpi-border: rgba(43, 110, 232, 0.25);
}
body.light .grid > .kpi:nth-child(2),
body.light .grid > .card.kpi:nth-child(2),
body.light .kpi.kpi-success {
  --kpi-accent: #16A34A;
  --kpi-glow: rgba(22, 163, 74, 0.12);
  --kpi-bg-icon: rgba(22, 163, 74, 0.08);
  --kpi-border: rgba(22, 163, 74, 0.25);
}
body.light .grid > .kpi:nth-child(3),
body.light .grid > .card.kpi:nth-child(3),
body.light .kpi.kpi-purple {
  --kpi-accent: #6248E8;
  --kpi-glow: rgba(98, 72, 232, 0.12);
  --kpi-bg-icon: rgba(98, 72, 232, 0.08);
  --kpi-border: rgba(98, 72, 232, 0.25);
}
body.light .grid > .kpi:nth-child(4),
body.light .grid > .card.kpi:nth-child(4),
body.light .kpi.kpi-warning {
  --kpi-accent: #D97706;
  --kpi-glow: rgba(217, 119, 6, 0.12);
  --kpi-bg-icon: rgba(217, 119, 6, 0.08);
  --kpi-border: rgba(217, 119, 6, 0.25);
}
body.light .grid > .kpi:nth-child(5),
body.light .grid > .card.kpi:nth-child(5),
body.light .kpi.kpi-teal {
  --kpi-accent: #0D9488;
  --kpi-glow: rgba(13, 148, 136, 0.12);
  --kpi-bg-icon: rgba(13, 148, 136, 0.08);
  --kpi-border: rgba(13, 148, 136, 0.25);
}
body.light .grid > .kpi:nth-child(6),
body.light .grid > .card.kpi:nth-child(6),
body.light .kpi.kpi-danger {
  --kpi-accent: #DC2626;
  --kpi-glow: rgba(220, 38, 38, 0.12);
  --kpi-bg-icon: rgba(220, 38, 38, 0.08);
  --kpi-border: rgba(220, 38, 38, 0.25);
}

/* KPI Card Base Styles */
.kpi {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: 1.35rem 1.45rem;
  border-radius: var(--r3, 16px);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.7rem;
  min-height: 114px;
  background:
    radial-gradient(150px 150px at calc(100% - 10px) 10px, var(--kpi-glow), transparent 75%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 97%, rgba(255, 255, 255, 0.04)) 0%, var(--surface) 100%);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.25),
    0 4px 14px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.25s ease;
  cursor: default;
}

body.light .kpi {
  background:
    radial-gradient(150px 150px at calc(100% - 10px) 10px, var(--kpi-glow), transparent 75%),
    linear-gradient(180deg, #FFFFFF 0%, #F9FAFD 100%);
  border-color: var(--border);
  box-shadow:
    0 1px 3px rgba(12, 14, 24, 0.03),
    0 6px 18px rgba(12, 14, 24, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

/* Top Luminous Accent Line */
.kpi::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--kpi-accent) 25%,
    color-mix(in srgb, var(--kpi-accent) 45%, #ffffff) 50%,
    var(--kpi-accent) 75%,
    transparent 100%
  );
  opacity: 0.85;
  transition: opacity 0.3s ease, height 0.3s ease, box-shadow 0.3s ease;
  pointer-events: none;
  z-index: 2;
}

/* Soft Ambient Radial Corner Halo */
.kpi::after {
  content: "";
  position: absolute;
  top: -30px;
  right: -30px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--kpi-glow) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

/* Hover Elevation & Illumination */
.kpi:hover {
  transform: translateY(-4px);
  border-color: var(--kpi-border);
  box-shadow:
    0 16px 36px -8px color-mix(in srgb, var(--kpi-accent) 24%, transparent),
    0 4px 14px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.kpi:hover::before {
  opacity: 1;
  height: 3px;
  box-shadow: 0 1px 8px var(--kpi-accent);
}

.kpi:hover::after {
  transform: scale(1.3);
  opacity: 1;
}

body.light .kpi:hover {
  border-color: var(--kpi-border);
  box-shadow:
    0 16px 32px -8px color-mix(in srgb, var(--kpi-accent) 18%, transparent),
    0 6px 16px rgba(12, 14, 24, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 1);
}

/* Content Stacking & Alignment */
.kpi > * {
  position: relative;
  z-index: 1;
}

.kpi > .flex {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* Label with glowing status dot */
.kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.065em;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.2rem;
  transition: color 0.2s ease;
}

.kpi:hover .kpi-label {
  color: var(--text2);
}

.kpi-label::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--kpi-accent);
  box-shadow: 0 0 6px var(--kpi-accent);
  flex-shrink: 0;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.kpi:hover .kpi-label::before {
  transform: scale(1.3);
  box-shadow: 0 0 10px var(--kpi-accent);
}

/* Authoritative Metric Value */
.kpi-value {
  font-family: var(--font-sans);
  font-size: clamp(1.7rem, 2.3vw, 2.25rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-top: 0.15rem;
  transition: color 0.2s ease;
}

/* Trend & Meta Pill Badge */
.kpi-meta {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text2);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface2) 80%, transparent);
  border: 1px solid var(--border);
  margin-top: 0.4rem;
  width: fit-content;
  line-height: 1.35;
}

.kpi-meta i {
  font-size: 0.72rem;
}

.kpi-meta.up {
  color: var(--success);
  background: color-mix(in srgb, var(--success) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--success) 28%, transparent);
}

.kpi-meta.down {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--danger) 28%, transparent);
}

body.light .kpi-meta {
  background: var(--surface2);
  border-color: var(--border);
}

body.light .kpi-meta.up {
  color: #16A34A;
  background: rgba(22, 163, 74, 0.09);
  border-color: rgba(22, 163, 74, 0.22);
}

body.light .kpi-meta.down {
  color: #DC2626;
  background: rgba(220, 38, 38, 0.09);
  border-color: rgba(220, 38, 38, 0.22);
}

/* Thematic Icon Container */
.kpi-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--kpi-bg-icon);
  color: var(--kpi-accent);
  border: 1px solid color-mix(in srgb, var(--kpi-accent) 25%, transparent);
  font-size: 1.15rem;
  margin-left: auto;
  flex-shrink: 0;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.25s ease;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--kpi-accent) 20%, transparent);
}

.kpi:hover .kpi-icon {
  transform: scale(1.08) rotate(3deg);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--kpi-accent) 32%, transparent);
  background: color-mix(in srgb, var(--kpi-accent) 18%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  .kpi, .kpi::before, .kpi::after, .kpi-icon { transition: none !important; animation: none !important; }
}

.empty-state {
  text-align: center; padding: 3rem 1.5rem; color: var(--text2);
}
.empty-state i { font-size: 2rem; margin-bottom: 0.75rem; opacity: 0.5; }

.logo-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #5B8DEF);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-family: var(--font-display); font-style: italic; font-size: 1.15rem;
}
.logo-word {
  font-family: var(--font-display); font-size: 1.25rem; color: var(--text);
}
.logo-word span { color: var(--accent); }

/* Official Brand Logo Images */
.brand-logo-img {
  height: 38px;
  width: auto;
  max-width: 195px;
  object-fit: contain;
  display: block;
}
body.light .brand-logo-img.dark-only,
[data-theme="light"] .brand-logo-img.dark-only,
body:not(.light):not([data-theme="light"]) .brand-logo-img.light-only,
[data-theme="dark"] .brand-logo-img.light-only {
  display: none !important;
}
body.light .brand-logo-img.light-only,
[data-theme="light"] .brand-logo-img.light-only,
body:not(.light):not([data-theme="light"]) .brand-logo-img.dark-only,
[data-theme="dark"] .brand-logo-img.dark-only {
  display: block !important;
}

.demo-fab {
  position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 9999;
  display: flex; gap: 0.4rem; padding: 0.4rem;
  background: var(--bg-glass); backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass); border-radius: 999px;
  box-shadow: var(--shadow-md);
}
.demo-fab button {
  width: 38px; height: 38px; border-radius: 50%; border: none;
  background: var(--surface); color: var(--text); cursor: pointer;
}
.demo-fab button:hover, .demo-fab button.active { background: var(--accent); color: #fff; }

.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-start;
  justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem;
}
.page-head h1 {
  font-size: 1.65rem; margin-bottom: 0.25rem;
}
.page-head p { color: var(--text2); font-size: 0.9rem; }

.filter-bar {
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center;
  padding: 0.9rem 1rem; margin-bottom: 1rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r3);
  transition: border-color .2s, box-shadow .2s;
}
.filter-bar.is-filtered {
  border-color: rgba(79, 142, 247, 0.45);
  box-shadow: 0 0 0 3px rgba(79, 142, 247, 0.1);
}
.filter-bar .form-control {
  width: auto;
  min-width: 140px;
  margin: 0;
  min-height: 42px;
  box-sizing: border-box;
}
.filter-bar .search { flex: 1; min-width: 180px; }
.filter-bar .filter-actions {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-left: auto;
}
.filter-bar > .filter-chips {
  flex: 1 1 100%;
  margin: 0.15rem 0 0;
}
.filter-bar .btn,
.filter-bar .btn.btn-sm {
  min-height: 42px;
  height: 42px;
  padding-top: 0;
  padding-bottom: 0;
  padding-left: 1rem;
  padding-right: 1rem;
  font-size: 0.875rem;
  box-sizing: border-box;
}
.filter-chips {
  display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center;
  margin: -0.35rem 0 1rem;
  min-height: 0;
}
.filter-chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.55rem 0.3rem 0.65rem;
  border-radius: 999px;
  background: var(--ag);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid rgba(79, 142, 247, 0.25);
}
.filter-chip button {
  border: 0; background: transparent; color: inherit; cursor: pointer;
  padding: 0; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; font-size: 0.7rem;
}
.filter-chip button:hover { background: rgba(79, 142, 247, 0.2); }
.pagination {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.75rem;
}
.pagination-pages {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem;
}
.page-btn {
  min-width: 34px; height: 34px; padding: 0 0.45rem;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text2);
  font: inherit; font-size: 0.82rem; font-weight: 600;
  cursor: pointer; display: inline-grid; place-items: center;
  transition: background .15s, color .15s, border-color .15s;
}
.page-btn:hover:not(:disabled):not(.active) {
  color: var(--text); border-color: var(--border2); background: var(--surface3);
}
.page-btn.active {
  background: var(--ag); color: var(--accent); border-color: rgba(79,142,247,.4);
}
.page-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.page-ellipsis {
  width: 28px; text-align: center; color: var(--text3); font-size: 0.85rem;
}
.page-jump {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.8rem; color: var(--text2);
}
.page-jump input {
  width: 56px; height: 34px; text-align: center;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit; font-size: 0.82rem;
}

.tabs {
  display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; flex-wrap: wrap;
}
.tab {
  padding: 0.7rem 1rem; color: var(--text2); cursor: pointer;
  background: transparent; border: none;
  border-bottom: 2px solid transparent; font-weight: 500; font-size: 0.9rem;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.tab i { font-size: 0.82rem; opacity: 0.85; }
.tabs .tab:hover, .tabs a.tab:hover { color: var(--accent); }
.tabs .tab.active, .tabs a.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs .tab.active i, .tabs a.tab.active i { opacity: 1; }
.tab-link {
  text-decoration: none;
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 0.5rem;
}
.settings-card {
  display: block;
  padding: 1.15rem 1.2rem;
  border-radius: var(--r3);
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.settings-card:hover {
  border-color: rgba(79, 142, 247, 0.4);
  box-shadow: 0 8px 24px rgba(12, 27, 58, 0.08);
  transform: translateY(-2px);
  color: inherit;
}
.settings-card .ico {
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--ag); color: var(--accent);
  margin-bottom: 0.75rem;
}
.settings-card strong { display: block; margin-bottom: 0.25rem; }
.settings-card p { margin: 0; font-size: 0.82rem; color: var(--text2); line-height: 1.4; }

.settings-form {
  width: min(720px, 100%);
  margin-inline: auto;
}
.settings-form-wide {
  width: min(860px, 100%);
  margin-inline: auto;
}

.perm-matrix { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.perm-matrix th, .perm-matrix td {
  padding: 0.55rem 0.45rem; border-bottom: 1px solid var(--border); text-align: center;
}
.perm-matrix th:first-child, .perm-matrix td:first-child { text-align: left; }
.perm-matrix th { color: var(--text2); font-size: 0.72rem; text-transform: uppercase; letter-spacing: .04em; }

/* —— Student Attendance —— */
.att-role-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.att-role-copy {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: min(100%, 280px);
  flex: 1;
}
.att-role-switch {
  display: inline-flex;
  padding: 0.25rem;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  gap: 0.2rem;
}
.att-role-btn {
  border: 0;
  background: transparent;
  color: var(--text2);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  cursor: pointer;
}
.att-role-btn.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.att-controls-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 0.85rem;
}
.att-controls-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.att-controls-grid-view {
  grid-template-columns: minmax(180px, 240px) 1fr;
  align-items: end;
}
.att-controls-grid-view-lecture {
  grid-template-columns: minmax(180px, 220px) minmax(180px, 220px) 1fr;
}
.att-controls-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.att-day-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}
.att-day-summary > div {
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.att-day-summary .kpi-label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text3);
  margin-bottom: 0.2rem;
}
.att-day-summary strong { font-size: 1.15rem; }
.att-day-summary .c-present { color: var(--success); }
.att-day-summary .c-absent { color: var(--danger); }
.att-day-summary .c-leave { color: var(--warning); }

.att-quick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
}
.att-quick-label {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.att-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.btn-success {
  background: rgba(46, 168, 110, 0.14);
  color: var(--success);
  border-color: rgba(46, 168, 110, 0.3);
}
.btn-success:hover { background: rgba(46, 168, 110, 0.22); }
.btn-danger-soft {
  background: rgba(224, 82, 82, 0.12);
  color: var(--danger);
  border-color: rgba(224, 82, 82, 0.28);
}
.btn-danger-soft:hover { background: rgba(224, 82, 82, 0.2); }

.att-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r3);
  padding: 0.65rem;
}
.att-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.75rem 0.85rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg);
  transition: border-color .15s, background .15s;
}
.att-row.is-p { border-color: rgba(46, 168, 110, 0.35); background: rgba(46, 168, 110, 0.06); }
.att-row.is-a { border-color: rgba(224, 82, 82, 0.35); background: rgba(224, 82, 82, 0.06); }
.att-row.is-l { border-color: rgba(245, 166, 35, 0.4); background: rgba(245, 166, 35, 0.08); }
.att-student {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  flex: 1;
}
.att-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
  flex-shrink: 0;
  min-width: min(100%, 280px);
}
.att-status-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-height: 52px;
  padding: 0.45rem 0.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform .12s, background .15s, border-color .15s, color .15s;
}
.att-status-btn i { font-size: 0.95rem; }
.att-status-btn:active { transform: scale(0.97); }
.att-status-btn.is-p.active {
  background: rgba(46, 168, 110, 0.18);
  border-color: rgba(46, 168, 110, 0.45);
  color: var(--success);
}
.att-status-btn.is-a.active {
  background: rgba(224, 82, 82, 0.16);
  border-color: rgba(224, 82, 82, 0.45);
  color: var(--danger);
}
.att-status-btn.is-l.active {
  background: rgba(245, 166, 35, 0.18);
  border-color: rgba(245, 166, 35, 0.5);
  color: var(--warning);
}

.att-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
}
.att-pill.is-p { background: rgba(46, 168, 110, 0.16); color: var(--success); border-color: rgba(46, 168, 110, 0.3); }
.att-pill.is-a { background: rgba(224, 82, 82, 0.14); color: var(--danger); border-color: rgba(224, 82, 82, 0.3); }
.att-pill.is-l { background: rgba(245, 166, 35, 0.16); color: var(--warning); border-color: rgba(245, 166, 35, 0.35); }
.att-pill.is-u { opacity: 0.85; }

.att-save-bar {
  position: sticky;
  bottom: 0.75rem;
  z-index: 20;
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-lg);
}

.att-empty {
  text-align: center;
  padding: 2.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}
.att-empty i {
  font-size: 1.6rem;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.att-empty-inline {
  text-align: center;
  padding: 1.5rem;
  color: var(--text2);
  font-size: 0.9rem;
}

.att-class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.85rem;
}
.att-class-card {
  text-align: left;
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.att-class-card:hover {
  border-color: rgba(79, 142, 247, 0.4);
}
.att-class-card.is-selected {
  border-color: rgba(79, 142, 247, 0.55);
  box-shadow: 0 0 0 3px rgba(79, 142, 247, 0.12);
}
.att-class-card.has-record { background: var(--bg); }
.att-class-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}
.att-class-stats {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
  font-size: 0.85rem;
  font-weight: 700;
}
.att-class-stats .is-p { color: var(--success); }
.att-class-stats .is-a { color: var(--danger); }
.att-class-stats .is-l { color: var(--warning); }

@media (max-width: 900px) {
  .att-controls-grid,
  .att-controls-grid-4,
  .att-controls-grid-view,
  .att-controls-grid-view-lecture,
  .att-day-summary {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 720px) {
  .att-row {
    flex-direction: column;
    align-items: stretch;
  }
  .att-status { min-width: 0; width: 100%; }
  .att-status-btn { min-height: 56px; font-size: 0.78rem; }
  .att-save-bar { bottom: 0.5rem; }
  .att-quick-actions { width: 100%; }
  .att-quick-actions .btn { flex: 1 1 calc(50% - 0.45rem); }
}

.color-row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: end; }
.color-row .swatch-field { display: flex; flex-direction: column; gap: 0.35rem; }
.color-row input[type="color"] {
  width: 48px; height: 42px; padding: 0; border: 1px solid var(--border);
  border-radius: 8px; background: transparent; cursor: pointer;
}

.carousel-editor { display: grid; gap: 0.75rem; }
.carousel-row {
  display: grid; grid-template-columns: 72px 1fr auto; gap: 0.75rem; align-items: center;
  padding: 0.75rem; border: 1px solid var(--border); border-radius: 12px; background: var(--bg);
}
.carousel-row .thumb {
  width: 72px; height: 48px; border-radius: 8px; background-size: cover; background-position: center;
  background-color: var(--surface2);
}
/* Full slide editor: thumb | fields | actions */
.carousel-row-full { grid-template-columns: 120px 1fr auto; align-items: start; }
.carousel-row-full .thumb { width: 120px; height: 80px; }
.carousel-row-full .carousel-fields .form-group { margin-bottom: 0.6rem; }
.carousel-row-full .carousel-fields .grid { gap: 0 0.75rem; }
.carousel-actions { display: flex; flex-direction: column; gap: 0.4rem; }
@media (max-width: 768px) {
  .carousel-row-full { grid-template-columns: 1fr; }
  .carousel-row-full .thumb { width: 100%; height: 140px; }
  .carousel-actions { flex-direction: row; justify-content: flex-end; }
}
/* Custom pages listing + live HTML preview */
.cp-list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.cp-list-head p { margin: 0.25rem 0 0; font-size: 0.86rem; color: var(--text3); max-width: 36rem; }
.cp-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
  padding: 0.28rem 0.5rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--ag);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  text-decoration: none;
}
.cp-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cp-link:hover { color: var(--accent2); }
.cp-link-actions { display: inline-flex; gap: 0.3rem; margin-left: 0.25rem; }
.cp-editor-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.95fr);
  gap: 1rem;
  align-items: start;
}
.cp-editor-form { min-width: 0; }
.cp-preview-pane {
  position: sticky;
  top: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface2);
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}
.cp-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.cp-preview-head strong { font-size: 0.82rem; }
.cp-preview-head .meta { font-size: 0.72rem; color: var(--text3); }
.cp-preview-chrome {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, var(--accent));
  font-size: 0.72rem;
  color: var(--text3);
}
.cp-preview-chrome .dot {
  width: 0.5rem; height: 0.5rem; border-radius: 50%;
  background: var(--border);
}
.cp-preview-chrome .url {
  flex: 1;
  min-width: 0;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.cp-preview-body {
  padding: 1.15rem 1.1rem 1.35rem;
  min-height: 280px;
  max-height: min(62vh, 560px);
  overflow: auto;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 5%, var(--surface)), var(--surface) 40%);
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.55;
}
.cp-preview-body h1,
.cp-preview-body h2,
.cp-preview-body h3 {
  font-family: "DM Serif Display", Georgia, serif;
  font-weight: 400;
  line-height: 1.2;
  margin: 0 0 0.65rem;
  color: var(--text);
}
.cp-preview-body h1 { font-size: 1.55rem; }
.cp-preview-body h2 { font-size: 1.3rem; }
.cp-preview-body h3 { font-size: 1.1rem; }
.cp-preview-body p { margin: 0 0 0.75rem; color: var(--text2); }
.cp-preview-body ul, .cp-preview-body ol { margin: 0 0 0.85rem 1.15rem; color: var(--text2); }
.cp-preview-body a { color: var(--accent); }
.cp-preview-body img { max-width: 100%; border-radius: 10px; }
.cp-preview-empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  text-align: center;
  color: var(--text3);
  font-size: 0.88rem;
  padding: 1.5rem;
}
.cp-modal .modal { width: min(1100px, calc(100vw - 1.5rem)); max-width: none; }
.cp-modal .modal-body { padding: 1rem 1.15rem 1.25rem; }
@media (max-width: 960px) {
  .cp-editor-shell { grid-template-columns: 1fr; }
  .cp-preview-pane { position: relative; top: 0; }
}

.html-editor {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem; min-height: 140px; line-height: 1.45;
}
.notif-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.notif-table th, .notif-table td {
  padding: 0.7rem 0.5rem; border-bottom: 1px solid var(--border); text-align: left;
}
.notif-table th { color: var(--text2); font-size: 0.72rem; text-transform: uppercase; letter-spacing: .04em; }
.notif-table td.center { text-align: center; }

.drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 80;
}

/* Global API / fetch loader */
.ac-loader {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(12, 18, 28, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.ac-loader[hidden] { display: none !important; }
html.ac-loading,
html.ac-loading body {
  cursor: progress;
}
.ac-loader-card {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  min-width: min(320px, 92vw);
  padding: 1rem 1.2rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  color: var(--text);
}
.ac-loader-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(79, 142, 247, 0.2);
  border-top-color: var(--accent);
  animation: ac-spin 0.7s linear infinite;
  flex-shrink: 0;
}
.ac-loader-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.ac-loader-title {
  font-size: 0.95rem;
  font-weight: 700;
}
.ac-loader-label {
  font-size: 0.82rem;
  color: var(--text2);
}
@keyframes ac-spin {
  to { transform: rotate(360deg); }
}
body.light .ac-loader {
  background: rgba(15, 23, 42, 0.28);
}

/* App shell: cover the content column only. Sidebar and topbar stay usable. */
.ac-loader.ac-loader-content {
  z-index: 250;
}
@media (max-width: 960px) {
  body:has(.sidebar.open) .ac-loader.ac-loader-content {
    z-index: 34;
  }
}

/* ==========================================================================
   State 2: Page Content Loading State (Shimmer Skeleton)
   Usage: Add class 'is-loading' to <main class="content"> or 'is-page-loading' to <body>.
          The menu (sidebar) and header bar (topbar) remain fully interactive and visible.
   ========================================================================== */

/* Shimmer Keyframes */
@keyframes acShimmerWave {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@keyframes acTopBarPulse {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* Ensure menu (sidebar) and header bar (topbar) remain completely unaffected */
body.is-page-loading .sidebar,
body.is-page-loading .topbar,
.sidebar,
.topbar {
  pointer-events: auto !important;
  filter: none !important;
  opacity: 1 !important;
}

/* The content container entering loading state */
.content.is-loading,
body.is-page-loading .content,
.content[data-loading="true"] {
  position: relative !important;
  pointer-events: none !important;
  user-select: none !important;
}

/* Glowing top progress accent wave along the top of page content */
.content.is-loading::before,
body.is-page-loading .content::before,
.content[data-loading="true"]::before {
  content: '';
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  display: block;
  margin: -1.35rem -1.5rem 1.25rem -1.5rem;
  background: linear-gradient(90deg, var(--accent), var(--purple), var(--teal), var(--accent));
  background-size: 250% 100%;
  animation: acTopBarPulse 1.6s linear infinite;
  z-index: 60;
  border-radius: 0 0 3px 3px;
  box-shadow: 0 1px 12px rgba(79, 142, 247, 0.45);
}

/* Ambient shimmer wave sweep across existing content blocks */
.content.is-loading .card,
.content.is-loading .kpi,
.content.is-loading .table-wrap,
.content.is-loading .stat-card,
body.is-page-loading .content .card,
body.is-page-loading .content .kpi,
body.is-page-loading .content .table-wrap,
body.is-page-loading .content .stat-card {
  position: relative !important;
  overflow: hidden !important;
}

.content.is-loading .card::after,
.content.is-loading .kpi::after,
.content.is-loading .table-wrap::after,
body.is-page-loading .content .card::after,
body.is-page-loading .content .kpi::after,
body.is-page-loading .content .table-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 15;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
  animation: acShimmerWave 1.8s infinite linear;
  pointer-events: none;
}

body.light .content.is-loading .card::after,
body.light .content.is-loading .kpi::after,
body.light .content.is-loading .table-wrap::after,
body.light.is-page-loading .content .card::after,
body.light.is-page-loading .content .kpi::after,
body.light.is-page-loading .content .table-wrap::after {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.65) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
}

/* ==========================================================================
   Reusable Shimmer Skeleton Primitives
   Can be dropped anywhere inside .content for custom skeleton loading screens
   ========================================================================== */
.shimmer,
.skeleton {
  background: var(--surface2);
  background: linear-gradient(
    90deg,
    var(--surface2) 0%,
    color-mix(in srgb, var(--surface2) 78%, rgba(255,255,255,0.12)) 50%,
    var(--surface2) 100%
  );
  background-size: 200% 100%;
  animation: acShimmerWave 1.8s infinite linear;
  border-radius: var(--r2);
  color: transparent !important;
  user-select: none;
  pointer-events: none;
  display: block;
}

body.light .shimmer,
body.light .skeleton {
  background: #E8ECF5;
  background: linear-gradient(
    90deg,
    #E8ECF5 0%,
    #F7F9FD 50%,
    #E8ECF5 100%
  );
  background-size: 200% 100%;
}

/* Skeleton shapes */
.skeleton-title {
  height: 28px;
  width: 40%;
  max-width: 320px;
  border-radius: 8px;
  margin-bottom: 0.85rem;
}

.skeleton-text {
  height: 14px;
  width: 100%;
  border-radius: 6px;
  margin-bottom: 0.55rem;
}
.skeleton-text.sm { height: 11px; }
.skeleton-text.lg { height: 18px; }
.skeleton-text.w-75 { width: 75%; }
.skeleton-text.w-50 { width: 50%; }
.skeleton-text.w-25 { width: 25%; }

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  flex-shrink: 0;
}
.skeleton-avatar.circle { border-radius: 50%; }

.skeleton-badge {
  display: inline-block;
  width: 65px;
  height: 22px;
  border-radius: 999px;
}

.skeleton-btn {
  display: inline-block;
  width: 110px;
  height: 38px;
  border-radius: var(--r2);
}

.skeleton-box {
  width: 100%;
  height: 140px;
  border-radius: var(--r);
}

/* Skeleton Card */
.skeleton-card {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* Skeleton KPI Card */
.skeleton-kpi {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Skeleton Table */
.skeleton-table {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  overflow: hidden;
}
.skeleton-table-header {
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  display: flex;
  gap: 1.5rem;
}
.skeleton-table-row {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.skeleton-table-row:last-child {
  border-bottom: none;
}


.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 92vw);
  background: var(--surface); border-left: 1px solid var(--border);
  z-index: 90; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: fadeUp 0.3s ease;
}
.drawer-header {
  padding: 1.15rem 1.25rem; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.drawer-body { padding: 1.25rem; overflow: auto; flex: 1; }

.progress {
  height: 8px; border-radius: 999px; background: var(--bg3); overflow: hidden;
}
.progress > span {
  display: block; height: 100%; background: var(--accent); border-radius: 999px;
}

.proposed-tag,
.page-tag {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--warning); background: rgba(245,166,35,.12); padding: 0.2rem 0.5rem; border-radius: 6px;
}

/* Modal / popup forms */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(8, 10, 20, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(2px);
}
.modal {
  width: min(520px, 100%);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  max-height: min(90vh, 720px);
  display: flex;
  flex-direction: column;
  animation: fadeUp 0.28s ease;
  opacity: 1;
}
.modal.modal-lg { width: min(640px, 100%); }
.modal.modal-xl { width: min(760px, 100%); }

/* Shared period filter (income, expenses, reports, etc.) */
.date-range {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 0.85rem;
  align-items: center;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r3);
}
.date-range-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text2);
  white-space: nowrap;
}
.date-range-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}
.date-chip {
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  border-radius: 8px;
  padding: 0.38rem 0.72rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.2;
}
.date-chip:hover { border-color: rgba(79, 142, 247, 0.4); color: var(--accent); }
.date-chip.active {
  border-color: rgba(79, 142, 247, 0.45);
  background: var(--ag);
  color: var(--accent);
}
.date-range-custom {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  width: 100%;
  padding-top: 0.15rem;
}
.date-range-custom .form-control {
  width: auto;
  min-width: 140px;
  margin: 0;
  min-height: 38px;
}
.date-range-meta {
  font-size: 0.78rem;
  color: var(--text3);
  margin-left: auto;
}

.dict-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.65rem;
}
.dict-tab {
  border: 0;
  background: transparent;
  color: var(--text2);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.dict-tab:hover { color: var(--accent); background: var(--ag); }
.dict-tab.active {
  color: var(--accent);
  background: var(--ag);
}
.category-help {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--text3);
  line-height: 1.45;
}
.category-help a { color: var(--accent); font-weight: 600; text-decoration: none; }
.category-help a:hover { text-decoration: underline; }
.mini-chart { height: 220px; position: relative; }

/* Profit / Loss statement */
.pl-hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
  padding: 1.35rem 1.5rem;
  border-radius: var(--r3);
  border: 1px solid var(--border);
  background: var(--surface);
  align-items: center;
}
.pl-hero.is-profit {
  border-color: rgba(52, 196, 124, 0.4);
  background: linear-gradient(135deg, rgba(52, 196, 124, 0.1), var(--surface) 55%);
}
.pl-hero.is-loss {
  border-color: rgba(224, 82, 82, 0.4);
  background: linear-gradient(135deg, rgba(224, 82, 82, 0.1), var(--surface) 55%);
}
.pl-hero-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}
.pl-hero-amount {
  font-size: clamp(1.75rem, 3.5vw, 2.4rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.pl-hero.is-profit .pl-hero-amount { color: var(--success); }
.pl-hero.is-loss .pl-hero-amount { color: var(--danger, #E05252); }
.pl-hero-meta { margin-top: 0.5rem; font-size: 0.86rem; color: var(--text2); line-height: 1.45; }
.pl-hero-side {
  display: grid;
  gap: 0.65rem;
}
.pl-hero-stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.86rem;
}
.pl-hero-stat strong { font-variant-numeric: tabular-nums; }
.pl-statement { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.pl-statement th, .pl-statement td { padding: 0.65rem 0.5rem; border-bottom: 1px solid var(--border); text-align: left; }
.pl-statement th { color: var(--text2); font-size: 0.72rem; text-transform: uppercase; letter-spacing: .04em; }
.pl-statement .num { text-align: right; font-variant-numeric: tabular-nums; }
.pl-statement .section-row td { padding-top: 1rem; color: var(--text2); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; border-bottom: 0; }
.pl-statement .total-row td { font-weight: 700; border-bottom-width: 2px; }
.pl-statement .net-row td { font-size: 1.05rem; border-bottom: 0; padding-top: 0.85rem; }
.pl-statement .net-row.is-profit td { color: var(--success); }
.pl-statement .net-row.is-loss td { color: var(--danger, #E05252); }
.pl-statement tr.is-major-expense td {
  background: color-mix(in srgb, var(--danger, #E05252) 10%, transparent);
  font-weight: 600;
}
.pl-statement tr.is-major-expense td:first-child {
  box-shadow: inset 3px 0 0 var(--danger, #E05252);
}
.pl-major-callout {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  margin-bottom: 1.25rem;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--danger, #E05252) 40%, var(--border));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--danger, #E05252) 12%, var(--bg)) 0%, var(--surface, var(--bg)) 55%);
}
.pl-major-callout .pl-major-kicker {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--danger, #E05252);
  margin-bottom: 0.25rem;
}
.pl-major-callout strong.pl-major-amount {
  display: block;
  font-size: 1.45rem;
  font-variant-numeric: tabular-nums;
  color: var(--danger, #E05252);
  line-height: 1.2;
}
.pl-major-callout p { margin: 0.35rem 0 0; font-size: 0.86rem; color: var(--text2); max-width: 36rem; line-height: 1.45; }
.expense-salary-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.25rem;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--danger, #E05252) 35%, var(--border));
  background: color-mix(in srgb, var(--danger, #E05252) 8%, var(--bg));
}
.expense-salary-banner .label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--danger, #E05252);
}
.expense-salary-banner .amount {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--danger, #E05252);
  font-variant-numeric: tabular-nums;
}
.expense-salary-banner .meta { font-size: 0.84rem; color: var(--text2); }
tr.is-salary-expense td {
  background: color-mix(in srgb, var(--danger, #E05252) 7%, transparent);
}
tr.is-salary-expense td:first-child {
  box-shadow: inset 3px 0 0 var(--danger, #E05252);
}
.pl-list-head {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
@media (max-width: 800px) {
  .pl-hero { grid-template-columns: 1fr; }
}
body.light .modal-overlay {
  background: rgba(15, 20, 35, 0.55);
}
body.light .modal {
  background: #ffffff;
  border-color: var(--border);
}
.line-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.line-table th, .line-table td { padding: 0.55rem 0.4rem; border-bottom: 1px solid var(--border); text-align: left; }
.line-table th { color: var(--text2); font-size: 0.72rem; text-transform: uppercase; letter-spacing: .04em; }
.line-table .num, .line-table td:last-child { text-align: right; }
.fee-type-pill {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.2rem 0.5rem; border-radius: 6px; font-size: 0.75rem; font-weight: 600;
  background: var(--ag); color: var(--accent); margin: 0.15rem 0.15rem 0.15rem 0;
}
.fee-type-pill-meta { opacity: 0.75; font-weight: 500; }
/* Fee structure editor + info card (replaces kit inline styles) */
.fee-info-card { border-left: 3px solid var(--teal); }
.fee-info-card p { margin: 0.35rem 0 0; line-height: 1.5; }
.fee-line-card {
  padding: 0.85rem; margin-bottom: 0.75rem; border: 1px solid var(--border);
  border-radius: 12px; background: var(--bg);
}
.fee-line-card .grid { gap: 0 0.75rem; }
.fee-line-card .form-group { margin-bottom: 0.6rem; }
.form-static { min-height: 42px; display: flex; align-items: center; }
.kpi-value.kpi-value-sm { font-size: 1.45rem; }
/* Fee vouchers (moved from html/app/fee-vouchers.html <style> + generator) */
.row-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: flex-end; }
.voucher-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem 1rem; font-size: 0.86rem; margin-bottom: 1rem; }
.voucher-meta dt { color: var(--text2); }
.voucher-meta dd { margin: 0; font-weight: 600; }
.pay-mode { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.5rem; margin-bottom: 1rem; }
.pay-mode label {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.7rem 0.85rem;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg); cursor: pointer; font-size: 0.86rem;
}
.pay-mode label:has(input:checked) { border-color: rgba(79,142,247,.45); background: var(--ag); color: var(--accent); }
.gen-mode { display: grid; gap: 0.5rem; }
.gen-mode label {
  display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.75rem 0.85rem; cursor: pointer;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg);
}
.gen-mode label.active { border-color: rgba(79,142,247,.45); background: var(--ag); }
.gen-mode input { margin-top: 0.2rem; }
.gen-mode small, .switch-row small { display: block; color: var(--text3); font-size: 0.8rem; margin-top: 0.15rem; line-height: 1.4; }
.gen-notes { margin: 0 0 1rem; padding-left: 1.1rem; font-size: 0.86rem; color: var(--text2); }
.gen-preview-table { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: 12px; }
.card.kpi.kpi-compact { padding: 0.9rem; }
.switch-row { display: flex; align-items: flex-start; gap: 0.6rem; margin-bottom: 1rem; cursor: pointer; }
.switch-row input { margin-top: 0.25rem; }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
/* Fee collection: receipts in voucher view + collect modal */
.receipts-block { margin-top: 1.25rem; display: grid; gap: 0.5rem; }
.receipt-row {
  display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  padding: 0.7rem 0.85rem; border: 1px solid var(--border); border-radius: 10px; background: var(--bg);
}
.receipt-row.is-cancelled { opacity: 0.7; }
.receipt-row.is-cancelled .receipt-row-end strong { text-decoration: line-through; }
.receipt-row-end { display: flex; align-items: center; gap: 0.6rem; }
.collect-net {
  display: flex; justify-content: space-between; gap: 0.75rem; font-size: 0.86rem;
  padding: 0.75rem; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); margin-bottom: 0.5rem;
}
tr.is-cancelled td { opacity: 0.6; }
.filter-check { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--text2); white-space: nowrap; }
@media (max-width: 640px) {
  .voucher-meta { grid-template-columns: 1fr; }
}
.modal-header {
  padding: 1.15rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
}
.modal-header h3 {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.2rem;
}
.modal-header p { margin: 0; color: var(--text2); font-size: 0.82rem; }
.modal-body {
  padding: 1.25rem;
  overflow: auto;
}
.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 0.6rem;
  background: var(--surface2);
  border-radius: 0 0 18px 18px;
}

/* ── Reusable single-image uploader ── */
.ac-upload {
  --ac-up-radius: 16px;
  --ac-up-size: 7.5rem;
  display: grid;
  gap: 0.55rem;
}
.ac-upload-drop {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 6.5rem;
  padding: 0.85rem 1rem;
  border-radius: var(--ac-up-radius);
  border: 1.5px dashed color-mix(in srgb, var(--accent) 35%, var(--border));
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 55%),
    var(--surface2);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.ac-upload-drop:hover,
.ac-upload-drop.is-dragging {
  border-color: var(--accent);
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 55%),
    color-mix(in srgb, var(--accent) 6%, var(--surface));
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 12%, transparent);
}
.ac-upload-drop.has-file {
  border-style: solid;
  cursor: default;
}
.ac-upload-preview {
  flex: 0 0 auto;
  width: var(--ac-up-size);
  height: var(--ac-up-size);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  display: grid;
  place-items: center;
  position: relative;
}
.ac-upload-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ac-upload-preview .ac-upload-ph {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.ac-upload-preview .ac-upload-empty-ico {
  color: var(--text3);
  font-size: 1.35rem;
}
.ac-upload--avatar {
  --ac-up-size: 5.5rem;
  --ac-up-radius: 18px;
}
.ac-upload--avatar .ac-upload-preview,
.ac-upload--avatar .ac-upload-preview img { border-radius: 50%; }
.ac-upload--logo {
  --ac-up-size: 5.25rem;
}
.ac-upload--logo .ac-upload-preview,
.ac-upload--logo .ac-upload-preview img { border-radius: 14px; object-fit: contain; padding: 0.35rem; }
.ac-upload--attachment {
  --ac-up-size: 4.75rem;
}
.ac-upload--attachment .ac-upload-preview,
.ac-upload--attachment .ac-upload-preview img {
  border-radius: 12px;
  object-fit: cover;
}
.ac-upload-meta { flex: 1; min-width: 0; }
.ac-upload-meta strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0.2rem;
}
.ac-upload-meta p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text3);
  line-height: 1.35;
}
.ac-upload-meta .ac-upload-name {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ac-upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}
.ac-upload-error {
  margin: 0;
  font-size: 0.8rem;
  color: var(--danger);
}
.ac-upload input[type="file"] { display: none; }

/* Listing thumbnail */
.ac-attach-thumb {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
  background: var(--surface2);
  cursor: zoom-in;
  display: inline-grid;
  place-items: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.ac-attach-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ac-attach-thumb:hover {
  transform: scale(1.06);
  border-color: var(--accent);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 18%, transparent);
}
.ac-attach-none {
  color: var(--text3);
  font-size: 0.8rem;
}

/* Full-image lightbox */
body.ac-lightbox-open { overflow: hidden; }
.ac-lightbox[hidden] { display: none !important; }
.ac-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}
.ac-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 28, 0.72);
  backdrop-filter: blur(6px);
}
.ac-lightbox-dialog {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: min(88vh, 920px);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.75rem;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  animation: acLightboxIn 0.22s ease;
}
.ac-lightbox-img {
  width: 100%;
  max-height: min(76vh, 820px);
  object-fit: contain;
  border-radius: 12px;
  background: var(--surface2);
}
.ac-lightbox-caption {
  font-size: 0.85rem;
  color: var(--text2);
  text-align: center;
  min-height: 1.1em;
}
.ac-lightbox-close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 2;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #fff;
  background: rgba(15, 20, 35, 0.72);
}
.ac-lightbox-close:hover { background: var(--accent); }
@keyframes acLightboxIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@media (max-width: 640px) {
  .ac-upload-drop {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .ac-upload-preview { margin: 0 auto; }
  .ac-upload-actions { justify-content: center; }
}

/* ==========================================================================
   Inquiries Inbox & Status Filter Pills Component Styles
   ========================================================================== */
.status-filter-pills {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  text-decoration: none;
}
.status-pill:hover {
  border-color: var(--border3);
  color: var(--text);
  background: var(--surface2);
}
.status-pill.is-active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  font-weight: 600;
}
.status-pill .pill-badge {
  font-size: 0.72rem;
  padding: 0.1rem 0.42rem;
  border-radius: 999px;
  background: var(--surface2);
  color: var(--text2);
}
.status-pill.is-active .pill-badge {
  background: rgba(255, 255, 255, 0.22);
  color: var(--bg);
}
body.light .status-pill.is-active .pill-badge {
  background: rgba(0, 0, 0, 0.15);
  color: #fff;
}

/* Inquiries Inbox Specific Styles */
.inquiry-row {
  transition: background-color 0.18s ease;
  cursor: pointer;
}
.inquiry-row.is-unread {
  background: color-mix(in srgb, var(--accent) 5%, var(--surface)) !important;
  font-weight: 500;
}
.inquiry-row.is-unread:hover {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface2)) !important;
}
.inquiry-row.is-selected {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface)) !important;
}

/* Unread Pulse Indicator */
.unread-pulse {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(79, 142, 247, 0.7);
  animation: inquiryPulse 2s infinite;
  margin-right: 0.35rem;
  vertical-align: middle;
}
@keyframes inquiryPulse {
  0% { box-shadow: 0 0 0 0 rgba(79, 142, 247, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(79, 142, 247, 0); }
  100% { box-shadow: 0 0 0 0 rgba(79, 142, 247, 0); }
}

/* Sender Card */
.sender-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 220px;
}
.sender-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.sender-info {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}
.sender-name {
  font-weight: 600;
  color: var(--text);
  font-size: 0.9rem;
}
.sender-meta {
  font-size: 0.78rem;
  color: var(--text3);
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.sender-meta a {
  color: inherit;
  text-decoration: none;
}
.sender-meta a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Message snippet */
.inquiry-snippet {
  max-width: 380px;
  line-height: 1.4;
}
.inquiry-subject {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inquiry-text-preview {
  font-size: 0.8rem;
  color: var(--text2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Quick Action Buttons */
.action-btn-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}
.action-btn-group .btn-icon {
  width: 32px;
  height: 32px;
  font-size: 0.85rem;
}

/* Sticky Bulk Toolbar */
.bulk-toolbar {
  position: sticky;
  top: 70px;
  z-index: 50;
  background: var(--surface2);
  border: 1px solid var(--accent);
  box-shadow: 0 8px 24px -6px color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--r2);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  animation: slideDown 0.2s ease;
}

/* Reply Drawer / Modal Enhancements */
.template-card {
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0.75rem;
  background: var(--bg);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.84rem;
}
.template-card:hover {
  border-color: var(--accent);
  background: var(--surface);
}
.template-card.active {
  border-color: var(--accent);
  background: var(--ag2);
  font-weight: 600;
}

/* Floating Toast — always viewport-fixed (append to body; avoid transform parents) */
.inquiry-toast {
  position: fixed !important;
  top: auto !important;
  left: auto !important;
  bottom: 24px !important;
  right: 24px !important;
  z-index: 99999 !important;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.35rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  animation: toastIn 0.25s ease;
  max-width: min(420px, calc(100vw - 2rem));
  pointer-events: auto;
}
.inquiry-toast.is-success { border-left: 4px solid var(--success); }
.inquiry-toast.is-info { border-left: 4px solid var(--accent); }
.inquiry-toast.is-warning { border-left: 4px solid var(--warning); }
.inquiry-toast.is-error { border-left: 4px solid var(--danger); }
@keyframes toastIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Finance pages (replace kit inline styles) */
.mini-chart.mini-chart-lg { height: 260px; }
.pl-statement-body { padding-top: 0.5rem; }
.pl-inline-badge { margin-left: 0.35rem; }
.activity-dot.activity-dot-success { background: var(--success); }
.activity-dot.activity-dot-danger { background: var(--danger); }

/* Dashboard (replaces kit inline styles) */
.grid.grid-dash { grid-template-columns: 1.4fr 1fr; }
@media (max-width: 900px) { .grid.grid-dash { grid-template-columns: 1fr; } }
.text-ai { color: var(--purple); }

/* HTML page editors (Privacy, Terms, About, Contact, custom pages) — moved from kit page <style> */
.html-code-area {
  font-family: 'JetBrains Mono', Consolas, Monaco, monospace; font-size: 0.88rem; line-height: 1.6;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--r);
  padding: 1.15rem; width: 100%; resize: vertical; white-space: pre-wrap; tab-size: 2;
}
.html-code-area:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.html-toolbar {
  display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; background: var(--surface2);
  padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-bottom: none; border-radius: var(--r) var(--r) 0 0;
}
.html-tool-btn {
  background: var(--surface); border: 1px solid var(--border); color: var(--text2); border-radius: 6px;
  padding: 0.25rem 0.55rem; font-size: 0.75rem; font-family: 'JetBrains Mono', monospace; cursor: pointer; transition: all 0.15s ease;
}
.html-tool-btn:hover { background: var(--ag2); border-color: var(--accent); color: var(--accent); }
.preview-box {
  border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); overflow: hidden;
  display: flex; flex-direction: column; height: 100%; border-top: 4px solid var(--accent);
}
.preview-head {
  background: var(--surface2); padding: 0.65rem 1rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; font-size: 0.82rem;
}
/* Sandboxed preview of owner HTML (no scripts run; styles can't leak into the app). */
.preview-frame { display: block; width: 100%; min-height: 560px; border: 0; background: #fff; }
.preview-frame.preview-frame-sm { min-height: 280px; }
.legal-editor-grid { grid-template-columns: 1.15fr 0.85fr; align-items: stretch; gap: 1.25rem; }
.legal-editor-grid > div { display: flex; flex-direction: column; }
@media (max-width: 900px) { .legal-editor-grid { grid-template-columns: 1fr; } }

/* Website editor: homepage section cards (landing-page Sections panel) */
.section-card { border: 1px solid var(--border); border-radius: var(--radius, 12px); margin-bottom: 0.75rem; background: var(--surface); }
.section-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; padding: 0.75rem 1rem; cursor: pointer; }
.section-card-chevron { width: 1rem; color: var(--text3); }
.section-card-toggle { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.86rem; color: var(--text2); cursor: pointer; }
.section-card-body { padding: 0 1rem 1rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.section-span { grid-column: 1 / -1; }
.section-item { margin-bottom: 0.6rem; align-items: center; }
.section-date { max-width: 11rem; }
.section-gallery-row { display: grid; grid-template-columns: 64px 1.3fr 1fr auto auto; gap: 0.5rem; align-items: center; }
.section-gallery-row .thumb { width: 64px; height: 44px; border-radius: 8px; background: var(--surface2) center / cover no-repeat; border: 1px solid var(--border); }
.btn.is-busy { opacity: 0.6; pointer-events: none; }
@media (max-width: 768px) {
  .section-gallery-row { grid-template-columns: 1fr; }
  .section-gallery-row .thumb { width: 100%; height: 120px; }
  .section-date { max-width: none; }
}

/* Website CMS lists: FAQs (accordion rows) and testimonials (quote cards) */
.cms-item { border-bottom: 1px solid var(--border); padding: 1rem 1.25rem; }
.cms-item:last-of-type { border-bottom: 0; }
.cms-item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; cursor: pointer; }
.cms-item-main { flex: 1; min-width: 0; }
.cms-item-main strong { display: block; color: var(--text); }
.cms-item-answer { margin: 0.75rem 0 0; padding: 0.85rem 1rem; border-radius: 10px; background: var(--bg); border-left: 3px solid var(--accent); color: var(--text2); line-height: 1.6; white-space: pre-line; }
.cms-quote { display: flex; flex-direction: column; gap: 0.25rem; padding: 1rem; border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: 12px; background: var(--surface); }
.cms-quote.is-featured { border-left-color: var(--accent); }
.cms-quote strong { display: block; }
.cms-quote img.avatar { object-fit: cover; }
.cms-quote-text { flex: 1; font-style: italic; line-height: 1.6; color: var(--text); margin: 0 0 0.75rem; }
.cms-stars { display: flex; align-items: center; gap: 0.2rem; font-size: 0.85rem; color: var(--border); }
.cms-stars .on { color: var(--warning); }
.cms-stars .badge { margin-left: 0.5rem; text-transform: capitalize; }
@media (max-width: 768px) {
  .cms-item-head { flex-direction: column; }
}

/* Settings → Modules */
.module-plan-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 2rem; }
.module-plan-bar p { margin: 0; }
.module-group-title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text3); margin: 0 0 0.6rem; }
.module-card { cursor: pointer; }
.module-card.is-off { opacity: 0.7; }
.module-card.is-locked { cursor: default; }
.module-card.is-locked:hover { transform: none; box-shadow: none; }
.module-switch { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }

/* Settings → Configuration (was inline in the kit page) */
.cfg-toolbar { display:flex; flex-wrap:wrap; gap:0.75rem; align-items:center; justify-content:space-between; margin-bottom:1rem; }
.cfg-group { margin-bottom:1.5rem; }
.cfg-group-title {
  font-size:0.72rem; font-weight:700; letter-spacing:.05em; text-transform:uppercase;
  color:var(--text3); margin:0 0 0.65rem;
}
.cfg-row {
  display:flex; gap:1rem; align-items:flex-start; justify-content:space-between;
  padding:1rem 1.1rem; border:1px solid var(--border); border-radius:14px;
  background:var(--surface); margin-bottom:0.65rem;
}
.cfg-row-main { min-width:0; flex:1; }
.cfg-row-main strong { display:block; margin-bottom:0.2rem; }
.cfg-key {
  display:inline-block; margin-top:0.35rem; font-size:0.72rem; font-family:ui-monospace,monospace;
  color:var(--text3); background:var(--bg); border:1px solid var(--border);
  padding:0.15rem 0.45rem; border-radius:6px;
}
.cfg-actions { display:flex; flex-wrap:wrap; gap:0.45rem; align-items:center; justify-content:flex-end; }
.cfg-switch {
  position:relative; width:46px; height:28px; border-radius:999px; border:1px solid var(--border);
  background:var(--bg); cursor:pointer; flex-shrink:0;
}
.cfg-switch::after {
  content:''; position:absolute; top:3px; left:3px; width:20px; height:20px; border-radius:50%;
  background:var(--surface); box-shadow:var(--shadow-sm); transition:transform .18s;
}
.cfg-switch.is-on { background:rgba(79,142,247,.25); border-color:rgba(79,142,247,.45); }
.cfg-switch.is-on::after { transform:translateX(18px); background:var(--accent); }
.cfg-input { width:min(180px, 42vw); }
.cfg-switch:disabled { opacity: .55; cursor: default; }
@media (max-width: 640px) { .cfg-row { flex-direction: column; } .cfg-actions { justify-content: flex-start; } }
