/* Infinimous CRM: refinement of the existing glass material and new workflows.
   No scroll interception: depth belongs to the background, never to working data. */
:root {
  --lime: #d8ff5f;
  --upgrade-surface: color-mix(in srgb, var(--panel2) 94%, var(--bg));
  --upgrade-highlight: rgba(245, 242, 233, .12);
  --upgrade-warning: #f0cc85;
  --upgrade-danger: #ffb1af;
  --upgrade-success: #c5eeb4;
}
html { scroll-padding-top: 88px; }
body, input, select, textarea, button { font-family: "Avenir Next", Inter, system-ui, sans-serif; }
::selection { color: #171916; background: #d8ff5f; }
input, textarea { caret-color: var(--lime); }
:where(.content, .modal, .mobile-drawer, .table-wrap, .upgrade-table) {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent;
}
:where(button, a, input, select, textarea):focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 3px;
  scroll-margin-block: 88px 32px;
}
:where(.heading h1, .sample-page-head h1, .panel h2, .upgrade-section h2) {
  letter-spacing: -.035em;
  text-wrap: balance;
}
:where(.metric strong, .upgrade-table, .upgrade-metrics, .invoice-total-row) {
  font-variant-numeric: tabular-nums;
}
/* A single brief title reveal retains the reference's soft materialization. */
.content.page-enter > * { animation: none; }
.soft-blur-in .sbi-character {
  animation: upgrade-title-focus 260ms var(--ease-out, cubic-bezier(.16, 1, .3, 1)) both;
  animation-delay: min(var(--soft-blur-delay, 0ms), 80ms);
  will-change: auto;
}
@keyframes upgrade-title-focus {
  from { opacity: .35; filter: blur(4px); transform: translate3d(0, 5px, 0); }
  to { opacity: 1; filter: blur(0); transform: none; }
}
/* Keep the existing ambient material still until native scroll timelines exist. */
body:not(.auth-screen)::before { animation: none; transform: scale(1.04); will-change: auto; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  @supports (animation-timeline: scroll()) {
    body:not(.auth-screen)::before {
      animation: upgrade-material-depth linear both;
      animation-timeline: scroll(root block);
    }
  }
}
@keyframes upgrade-material-depth {
  from { transform: scale(1.04) translate3d(0, 0, 0); }
  to { transform: scale(1.075) translate3d(0, -1%, 0); }
}
:where(.topbar, .portal-command-bar, .control-popover) {
  -webkit-backdrop-filter: blur(22px) saturate(130%);
  backdrop-filter: blur(22px) saturate(130%);
}
:where(.primary, .outline) {
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
:where(.primary, .outline):active { filter: brightness(.94); }

/* Shared page primitives for finance, partner publications, and the academy. */
.content > .upgrade-section {
  width: calc(100% - 84px);
  max-width: 1460px;
  margin: 24px auto;
}
.upgrade-section { min-width: 0; color: var(--text); }
.upgrade-section > :first-child { margin-top: 0; }
.upgrade-section > :last-child { margin-bottom: 0; }
.upgrade-section + .upgrade-section { margin-top: 28px; }
.upgrade-section :where(h2, h3) { margin: 0 0 12px; letter-spacing: -.025em; }
.upgrade-section h2 { font-size: 22px; line-height: 1.25; }
.upgrade-section h3 { font-size: 16px; line-height: 1.35; }
.upgrade-section :where(p, .hint, .form-note) { font-size: 13px; line-height: 1.6; }
.upgrade-section p { max-width: 70ch; }
.upgrade-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.upgrade-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.upgrade-section :where(.panel, .metric),
.upgrade-surface {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--upgrade-surface);
  box-shadow: inset 0 1px var(--upgrade-highlight);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.upgrade-section .metric { padding: 22px; min-height: 140px; }
.upgrade-section .metric span { color: var(--muted); font-size: 13px; line-height: 1.4; }
.upgrade-section .metric strong { margin: 12px 0 6px; font-size: clamp(26px, 3vw, 40px); letter-spacing: -.035em; overflow-wrap: anywhere; }
.upgrade-section .metric small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.upgrade-section .metric.featured { background: var(--lime); color: #171916; }
.upgrade-section .metric.featured :where(span, small) { color: #394126; }
.upgrade-toolbar {
  display: flex; align-items: flex-end; flex-wrap: wrap;
  gap: 12px; margin-bottom: 20px;
}
.upgrade-toolbar label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
.upgrade-toolbar :where(input, select) { max-width: 100%; }
.upgrade-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.upgrade-section :where(input, select, textarea) {
  min-width: 0; width: 100%; min-height: 44px; font-size: 14px;
  border-radius: 10px; border-color: var(--line);
  color: var(--text); background: var(--panel2);
}
.upgrade-section input::placeholder, .upgrade-section textarea::placeholder { color: var(--muted); opacity: 1; }
.upgrade-section select option { color: var(--text); background: var(--bg); }
.upgrade-section .form-grid label { color: var(--text); font-size: 13px; }
.upgrade-section .form-grid { gap: 20px 16px; }
.upgrade-section :where(.primary, .outline) { min-height: 44px; font-size: 13px; }
.upgrade-table { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--upgrade-surface); }
.upgrade-table table { width: 100%; min-width: 640px; }
.upgrade-table :where(th, td) { padding: 16px 18px; border-bottom-color: var(--line); line-height: 1.5; }
.upgrade-table th { font-size: 11px; font-weight: 600; letter-spacing: .045em; color: var(--muted); background: var(--panel2); }
.upgrade-table td { font-size: 13px; color: var(--text); vertical-align: middle; }
.upgrade-table td strong { font-size: 13px; }
.upgrade-table td small { font-size: 12px; color: var(--muted); }
.upgrade-table tbody tr:last-child td { border-bottom: 0; }
.upgrade-table tbody tr:hover { background: color-mix(in srgb, var(--text) 3%, transparent); }
.upgrade-empty { padding: 32px 24px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.upgrade-empty :where(h2, h3, strong) { color: var(--text); }
.upgrade-empty p { margin: 8px 0 18px; }
.upgrade-note { padding: 14px 16px; border-radius: 12px; background: color-mix(in srgb, var(--lime) 7%, var(--panel2)); color: var(--text); font-size: 13px; line-height: 1.6; }
.upgrade-note p { margin: 0; }
.upgrade-status { display: inline-flex; align-items: center; max-width: 100%; min-height: 28px; padding: 4px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--panel2); font-size: 12px; line-height: 1.4; }
.upgrade-status[data-tone="warning"] { color: var(--upgrade-warning); }
.upgrade-status[data-tone="success"] { color: var(--upgrade-success); }
.upgrade-status[data-tone="danger"] { color: var(--upgrade-danger); }
.upgrade-progress { overflow: hidden; height: 6px; border: 0; border-radius: 6px; background: color-mix(in srgb, var(--text) 12%, transparent); }
.upgrade-progress :where(i, span), progress.upgrade-progress::-webkit-progress-value { display: block; height: 100%; background: var(--lime); border-radius: inherit; }
progress.upgrade-progress::-webkit-progress-bar { background: color-mix(in srgb, var(--text) 12%, transparent); }
progress.upgrade-progress::-moz-progress-bar { background: var(--lime); border-radius: inherit; }
.request-thread { display: grid; gap: 0; }
.request-entry { min-width: 0; padding: 22px 0; border-bottom: 1px solid var(--line); }
.request-entry:first-child { padding-top: 0; }
.request-entry:last-child { border-bottom: 0; }
.request-entry > header { display: flex; align-items: start; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.request-entry p { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.request-entry :where(time, small) { color: var(--muted); font-size: 12px; }
.request-attachments { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.request-attachment { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; overflow-wrap: anywhere; font-size: 12px; }
.request-attachment img { display: block; width: 64px; height: 64px; border-radius: 6px; object-fit: cover; }
.academy-mode { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 9px; border-radius: 8px; background: color-mix(in srgb, var(--lime) 9%, var(--panel2)); color: var(--text); font-size: 12px; }
html[data-theme="light"] { --upgrade-warning: #755015; --upgrade-danger: #a62f32; --upgrade-success: #33642b; --upgrade-highlight: rgba(255, 255, 255, .7); }
@media (max-width: 1100px) { .upgrade-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 740px) {
  .content > .upgrade-section { width: calc(100% - 24px); margin-block: 20px; }
  .upgrade-grid { grid-template-columns: 1fr; gap: 16px; }
  .upgrade-section .metric { min-height: 124px; padding: 16px; }
  .upgrade-section .metric strong { font-size: 28px; }
  .upgrade-section .metric span, .upgrade-section .metric small { font-size: 12px; }
  .upgrade-toolbar { align-items: stretch; }
  .upgrade-toolbar label { flex: 1 1 150px; }
  .upgrade-toolbar > :where(.primary, .outline) { flex: 1 1 150px; }
  .upgrade-section .form-grid { grid-template-columns: 1fr; }
  .request-entry > header { display: grid; }
}
@media (max-width: 380px) { .upgrade-metrics { grid-template-columns: 1fr; } }
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  :root { --upgrade-surface: var(--bg); }
  :where(.layout, .sidebar, .topbar, .panel, .modal, .portal-command-bar, .control-popover, .mobile-drawer) {
    -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--bg);
  }
  body:not(.auth-screen)::before, body:not(.auth-screen)::after { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .soft-blur-in .sbi-character { animation: none; opacity: 1; filter: none; transform: none; }
  body:not(.auth-screen)::before { animation: none; transform: none; }
  :where(.primary, .outline) { transition: none; }
}
@media print { .upgrade-section { color: #171916; --text: #171916; --muted: #52584e; --line: #d7dacf; --upgrade-surface: #fff; } }

/* Academy: rows keep enrollment details together without nested glass cards. */
.academy-toolbar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin: 20px 0; }
.academy-toolbar label { display: grid; gap: 7px; min-width: 220px; color: var(--muted); font-size: 13px; }
.academy-summary { display: flex; align-items: baseline; flex-wrap: wrap; gap: 20px 40px; margin: 24px 0; padding-block: 16px; border-block: 1px solid var(--line); }
.academy-summary > div { display: grid; gap: 8px; }
.academy-summary span { color: var(--muted); font-size: 13px; }
.academy-summary strong { font-variant-numeric: tabular-nums; font-size: 26px; font-weight: 600; letter-spacing: -.025em; }
.academy-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 20px; }
.academy-editor { margin-bottom: 24px; }
.academy-list { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.academy-list li { padding: 18px 0; border-bottom: 1px solid var(--line); }
.academy-list li:last-child { border-bottom: 0; }
.academy-list li > strong { display: block; font-size: 14px; }
.academy-list :where(small, .academy-note) { display: block; margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.academy-list .actions { margin-top: 10px; }
.academy-list .text-button { min-height: 36px; font-size: 13px; }
.academy-section { margin-top: 28px; }
.academy-section :where(th, td) { padding: 16px; font-size: 13px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.academy-section th { font-size: 11px; color: var(--muted); }
.academy-section td :where(small, strong) { font-size: 13px; white-space: normal; }
.academy-section td small { color: var(--muted); }
.academy-section .text-button { font-size: 13px; }
.academy-fee-status { white-space: normal; min-width: 140px; }
.academy-attendance { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 12px 0; }
.academy-attendance select { max-width: 200px; }
.academy-note { color: var(--muted); font-size: 13px; line-height: 1.6; }
@media (max-width: 850px) {
  .academy-layout { grid-template-columns: 1fr; }
  .academy-toolbar label { min-width: 0; flex: 1 1 100%; }
  .academy-summary { gap: 20px 28px; }
}
@media (max-width: 740px) {
  .academy-section .panel-head { align-items: flex-start; flex-wrap: wrap; }
  .academy-attendance select { width: 100%; max-width: none; }
  .academy-section .actions { width: auto; }
  .academy-section .actions button { flex: initial; }
}
.request-content { white-space: pre-wrap; overflow-wrap: anywhere; }
.request-filename { overflow-wrap: anywhere; }
.upgrade-section > .panel + .panel { margin-top: 20px; }
.upgrade-section .heading { width: 100%; margin: 0 0 24px; }
.upgrade-section .heading p { margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.upgrade-section .inline-form :where(input, select) { min-width: 0; max-width: 100%; }
.upgrade-section .row { border-color: var(--line); }
.upgrade-section .row > div { min-width: 0; }
.upgrade-section .row small { font-size: 12px; color: var(--muted); line-height: 1.6; }
.upgrade-section .row .text-button { max-width: 100%; overflow-wrap: anywhere; text-align: left; font-size: 14px; }
.upgrade-section .request-content { font-size: 14px; line-height: 1.65; }
@media (max-width: 740px) {
  .upgrade-section .row { flex-wrap: wrap; }
  .upgrade-section .inline-form label { min-width: 0; }
}
