:root {
  color-scheme: light;
  --ink: #101828;
  --muted: #667085;
  --soft: #8a97a8;
  --line: #e7edf3;
  --line-strong: #d7e3ed;
  --page: #eef5f8;
  --panel: rgba(245, 251, 254, 0.78);
  --panel-soft: rgba(238, 248, 252, 0.66);
  --glass: rgba(244, 251, 254, 0.74);
  --glass-strong: rgba(255, 255, 255, 0.58);
  --glass-line: rgba(182, 215, 229, 0.58);
  --blue: #0b80de;
  --blue-strong: #075fc8;
  --cyan: #12c6df;
  --teal: #13b98f;
  --green: #20c36b;
  --dark: #111827;
  --danger: #e23d4f;
  --warning: #f6a21a;
  --shadow: 0 18px 50px rgba(17, 24, 39, 0.08);
  --shadow-soft: 0 12px 30px rgba(6, 38, 67, 0.07);
  --radius: 8px;
  --sidebar: 270px;
  --topbar: 86px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.92), rgba(237, 249, 252, 0.82) 45%, rgba(232, 245, 251, 0.95)),
    var(--page);
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(18, 198, 223, 0.28);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.mobile-only {
  display: none !important;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.soft-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  color: #06745c;
  background: #e8fbf5;
  border: 1px solid rgba(19, 185, 143, 0.18);
  font-size: 0.78rem;
  font-weight: 800;
}

.login-screen {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  overflow: hidden;
  padding: 32px;
  background:
    radial-gradient(circle at 20% 18%, rgba(11, 128, 222, 0.13), transparent 32%),
    linear-gradient(135deg, #f9fcff 0%, #eef9fb 48%, #eaf4fb 100%);
}

.login-orbit {
  position: absolute;
  inset: auto -18% -28% 42%;
  height: 62vh;
  background:
    linear-gradient(110deg, transparent 0 34%, rgba(18, 198, 223, 0.16) 34% 42%, transparent 42% 58%, rgba(19, 185, 143, 0.14) 58% 66%, transparent 66%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.32), transparent);
  transform: rotate(-8deg);
  pointer-events: none;
}

.login-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 430px;
  gap: 34px;
  width: min(1100px, 100%);
  align-items: center;
}

.login-brand {
  display: grid;
  gap: 24px;
  padding: 38px;
}

.login-logo {
  width: min(490px, 100%);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 22px 34px rgba(7, 95, 200, 0.14));
}

.login-brand h1 {
  max-width: 620px;
  margin: 0;
  color: #0c2038;
  font-size: clamp(2.35rem, 4.5vw, 4.65rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.login-copy {
  max-width: 520px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.7;
}

.login-hero-copy {
  display: grid;
  gap: 4px;
}

.login-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 14px;
}

.login-highlights span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(11, 128, 222, 0.14);
  border-radius: 999px;
  color: #075fc8;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 20px rgba(11, 128, 222, 0.07);
  font-size: 0.8rem;
  font-weight: 850;
}

.login-card {
  display: grid;
  gap: 14px;
  padding: 30px;
  border: 1px solid rgba(215, 227, 237, 0.82);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-card-header {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

.login-card h2 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0;
}

.login-card p {
  margin: 0;
  color: var(--muted);
}

.login-card label,
.filter-panel label {
  display: grid;
  gap: 5px;
  color: #344054;
  font-size: 0.74rem;
  font-weight: 800;
}

.login-card input,
.filter-panel input,
.filter-panel select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0 11px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.login-card input:hover,
.filter-panel input:hover,
.filter-panel select:hover {
  border-color: rgba(11, 128, 222, 0.42);
}

.login-card input:focus,
.filter-panel input:focus,
.filter-panel select:focus {
  border-color: rgba(11, 128, 222, 0.72);
  box-shadow: 0 0 0 4px rgba(11, 128, 222, 0.08);
}

.form-error {
  min-height: 21px;
  color: var(--danger) !important;
  font-size: 0.86rem;
  font-weight: 800;
}

.primary-action,
.ghost-action,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  border: 0;
  border-radius: var(--radius);
  font-weight: 850;
  letter-spacing: 0;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.primary-action {
  color: #fff;
  background: linear-gradient(135deg, var(--blue) 0%, var(--cyan) 52%, var(--teal) 100%);
  box-shadow: 0 14px 28px rgba(11, 128, 222, 0.22);
}

.primary-action:hover,
.ghost-action:hover,
.icon-button:hover,
.nav-item:hover {
  transform: translateY(-1px);
}

.primary-action.compact,
.ghost-action.compact {
  min-height: 38px;
  padding: 0 12px;
  font-size: 0.8rem;
}

.ghost-action {
  min-width: 82px;
  padding: 0 15px;
  color: #1f344d;
  border: 1px solid var(--glass-line);
  background: rgba(247, 252, 254, 0.66);
  backdrop-filter: blur(12px);
}

.ghost-action.danger {
  color: var(--danger);
}

.icon-button {
  width: 44px;
  min-width: 44px;
  padding: 0;
  color: #1f344d;
  border: 1px solid var(--glass-line);
  background: rgba(247, 252, 254, 0.66);
  backdrop-filter: blur(12px);
}

.icon-button svg,
.nav-icon svg,
.metric-icon svg,
.mini-icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: var(--sidebar);
  flex-direction: column;
  padding: 22px;
  border-right: 1px solid rgba(215, 227, 237, 0.76);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(232, 247, 252, 0.68)),
    rgba(244, 251, 254, 0.72);
  box-shadow: 24px 0 54px rgba(17, 24, 39, 0.05);
  backdrop-filter: blur(20px) saturate(1.22);
  transition: width 0.2s ease, padding 0.2s ease, transform 0.22s ease;
}

.brand-box {
  display: grid;
  min-height: 100px;
  place-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.sidebar-logo {
  width: 190px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 12px 18px rgba(11, 128, 222, 0.12));
}

.nav-stack {
  display: grid;
  gap: 9px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 47px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0 14px;
  color: #344054;
  background: transparent;
  font-weight: 850;
  text-align: left;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.nav-item.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--blue-strong), var(--blue) 48%, var(--cyan));
  box-shadow: 0 14px 26px rgba(11, 128, 222, 0.24);
}

.nav-icon {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: var(--radius);
  background: rgba(16, 24, 40, 0.06);
}

.nav-item.is-active .nav-icon {
  background: rgba(255, 255, 255, 0.18);
}

.sidebar-footer {
  display: grid;
  gap: 5px;
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(18, 198, 223, 0.16);
  border-radius: var(--radius);
  background: rgba(242, 250, 253, 0.72);
  backdrop-filter: blur(14px);
  color: var(--muted);
  font-size: 0.82rem;
}

.sidebar-footer p,
.sidebar-footer strong,
.sidebar-footer span {
  margin: 0;
}

.sidebar-footer strong {
  color: var(--ink);
}

.sidebar-privacy {
  justify-self: start;
  margin-top: 4px;
  padding: 5px 8px;
  border-radius: 10px;
  color: #344054;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(179, 210, 226, 0.48);
  font-size: 0.72rem;
}

.sidebar-privacy span {
  font-size: 0.72rem;
  font-weight: 760;
}

.workspace {
  min-height: 100vh;
  margin-left: var(--sidebar);
  padding: 22px 26px 34px;
  overflow-x: hidden;
  transition: margin-left 0.2s ease;
}

.app-shell.sidebar-collapsed .sidebar {
  width: 84px;
  padding: 18px 12px;
}

.app-shell.sidebar-collapsed .sidebar:hover,
.app-shell.sidebar-collapsed .sidebar:focus-within {
  width: var(--sidebar);
  padding: 22px;
}

.app-shell.sidebar-collapsed .workspace {
  margin-left: 84px;
}

.app-shell.sidebar-collapsed .brand-box {
  min-height: 72px;
  margin-bottom: 16px;
}

.app-shell.sidebar-collapsed .sidebar:hover .brand-box,
.app-shell.sidebar-collapsed .sidebar:focus-within .brand-box {
  min-height: 100px;
  margin-bottom: 20px;
}

.app-shell.sidebar-collapsed .sidebar-logo {
  width: 58px;
}

.app-shell.sidebar-collapsed .sidebar:hover .sidebar-logo,
.app-shell.sidebar-collapsed .sidebar:focus-within .sidebar-logo {
  width: 190px;
}

.app-shell.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 0;
}

.app-shell.sidebar-collapsed .sidebar:hover .nav-item,
.app-shell.sidebar-collapsed .sidebar:focus-within .nav-item {
  justify-content: flex-start;
  padding: 0 14px;
}

.app-shell.sidebar-collapsed .nav-item > span:last-child,
.app-shell.sidebar-collapsed .sidebar-footer {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar:hover .nav-item > span:last-child,
.app-shell.sidebar-collapsed .sidebar:focus-within .nav-item > span:last-child {
  display: inline;
}

.app-shell.sidebar-collapsed .sidebar:hover .sidebar-footer,
.app-shell.sidebar-collapsed .sidebar:focus-within .sidebar-footer {
  display: grid;
}

.nav-toggle {
  flex: 0 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: -22px -26px 12px;
  padding: 14px 22px 10px;
  border-bottom: 1px solid rgba(215, 227, 237, 0.74);
  background: rgba(238, 248, 252, 0.78);
  backdrop-filter: blur(18px) saturate(1.16);
}

.topbar-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.topbar-heading h2 {
  margin: 0;
  color: #101828;
  font-size: clamp(1.35rem, 2.4vw, 1.86rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.topbar-heading p:last-child {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sheet-status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(247, 252, 254, 0.7);
  backdrop-filter: blur(12px);
  font-size: 0.83rem;
  font-weight: 750;
  white-space: nowrap;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 5px rgba(246, 162, 26, 0.12);
}

.sheet-status.is-ok .status-dot {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(32, 195, 107, 0.13);
}

.sheet-status.is-error .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 5px rgba(226, 61, 79, 0.12);
}

.privacy-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  color: #0f172a;
  background: rgba(247, 252, 254, 0.68);
  backdrop-filter: blur(12px);
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}

.privacy-chip input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: #0b80de;
}

.filter-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, var(--glass-strong), rgba(231, 247, 252, 0.54)),
    var(--glass);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px) saturate(1.12);
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
  gap: 8px;
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.page-content {
  display: grid;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

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

.metric-card,
.panel-card,
.chart-card,
.table-card,
.insight-card,
.empty-state,
.error-state {
  border: 1px solid var(--glass-line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.62), rgba(231, 247, 252, 0.5)),
    var(--glass);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px) saturate(1.14);
  min-width: 0;
  max-width: 100%;
}

.metric-card {
  display: grid;
  min-height: 94px;
  min-width: 0;
  gap: 6px;
  padding: 11px;
}

.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.metric-icon,
.mini-icon {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: var(--radius);
  color: #fff;
  background: #151a24;
}

.metric-menu {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.metric-label {
  margin: 0;
  color: #344054;
  font-size: 0.72rem;
  font-weight: 850;
}

.metric-value {
  display: block;
  margin-top: 3px;
  color: #0f172a;
  font-size: clamp(0.82rem, 0.74vw, 0.98rem);
  line-height: 1.08;
  font-weight: 900;
  word-break: keep-all;
  overflow-wrap: normal;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-value.is-long {
  font-size: clamp(0.74rem, 0.7vw, 0.88rem);
}

.metric-note {
  margin: 0;
  color: var(--soft);
  font-size: 0.64rem;
}

.metric-note strong {
  color: var(--green);
}

.overview-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.34fr) minmax(340px, 0.9fr);
  gap: 12px;
  align-items: start;
}

.overview-right {
  display: grid;
  gap: 12px;
  align-content: start;
}

.overview-insights {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 12px;
  align-items: stretch;
}

.overview-support-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 12px;
  align-items: start;
}

.chart-card,
.panel-card,
.table-card {
  padding: 12px;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.panel-header h3,
.drawer-panel h3,
.section-title {
  margin: 0;
  color: #101828;
  font-size: 0.88rem;
  line-height: 1.25;
  letter-spacing: 0;
}

.panel-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.panel-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 9px;
  color: #344054;
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
  font-weight: 800;
}

.chart-wrap {
  position: relative;
  height: 188px;
  min-height: 188px;
  max-height: 188px;
}

.chart-wrap.tall {
  height: 278px;
  min-height: 278px;
  max-height: 278px;
}

.chart-wrap.compact {
  height: 180px;
  min-height: 180px;
  max-height: 180px;
}

.chart-wrap.gauge {
  height: 212px;
  min-height: 212px;
  max-height: 212px;
}

.chart-wrap.short {
  height: 172px;
  min-height: 172px;
  max-height: 172px;
}

.aging-half {
  width: 100%;
  max-width: calc((100% - 12px) * 0.525);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.canvas-tooltip {
  position: fixed;
  z-index: 80;
  display: none;
  min-width: 132px;
  padding: 9px 10px;
  border: 1px solid rgba(215, 227, 237, 0.88);
  border-radius: var(--radius);
  color: #101828;
  background: rgba(246, 252, 254, 0.96);
  box-shadow: var(--shadow-soft);
  font-size: 0.78rem;
  pointer-events: none;
}

.insight-card {
  display: grid;
  gap: 10px;
  min-height: 142px;
  padding: 16px;
  color: #fff;
  border: 0;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(7, 95, 200, 0.96), rgba(11, 128, 222, 0.96) 48%, rgba(18, 198, 223, 0.96));
  box-shadow: 0 18px 42px rgba(11, 128, 222, 0.22);
}

.insight-card .panel-header {
  margin: 0;
}

.insight-card h3,
.insight-card p {
  color: #fff;
}

.insight-card p {
  margin: 0;
  line-height: 1.45;
  font-size: 0.82rem;
}

.insight-card .ghost-pill {
  width: fit-content;
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  color: var(--blue-strong);
  background: #fff;
  font-size: 0.8rem;
  font-weight: 900;
}

.donut-legend,
.legend-row {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.legend-item span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.legend-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.overview-bottom {
  display: grid;
  grid-template-columns: minmax(300px, 0.78fr) minmax(0, 1.22fr);
  gap: 12px;
}

.summary-analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 8px;
}

.summary-tile {
  display: grid;
  gap: 5px;
  padding: 11px;
  border: 1px solid rgba(182, 215, 229, 0.48);
  border-radius: var(--radius);
  background: rgba(247, 252, 254, 0.62);
}

.summary-tile span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
}

.summary-tile strong {
  color: #101828;
  font-size: 0.96rem;
  overflow-wrap: anywhere;
}

.summary-tile button {
  width: fit-content;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--blue-strong);
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.76rem;
  font-weight: 900;
}

.interpretation-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.interpretation-list li {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 10px;
  align-items: start;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.interpretation-list li::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--cyan);
}

.recovery-block {
  display: grid;
  gap: 10px;
}

.recovery-value {
  display: flex;
  align-items: end;
  gap: 12px;
}

.recovery-value strong {
  font-size: clamp(1.2rem, 2vw, 1.65rem);
  line-height: 1;
  letter-spacing: 0;
}

.recovery-value span {
  color: var(--green);
  font-weight: 900;
}

.recovery-explain {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.progress-track {
  position: relative;
  height: 30px;
  overflow: hidden;
  border-radius: var(--radius);
  background: #dcecf7;
}

.progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 65%;
  border-radius: inherit;
  background: repeating-linear-gradient(-45deg, var(--blue), var(--blue) 10px, #0da7e8 10px, #0da7e8 20px);
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.mini-stat {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid rgba(182, 215, 229, 0.48);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.mini-stat span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.mini-stat strong {
  font-size: 0.94rem;
}

.recovery-bank-list {
  display: grid;
  gap: 8px;
}

.recovery-bank-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 9px;
  border: 1px solid rgba(182, 215, 229, 0.48);
  border-radius: var(--radius);
  background: rgba(247, 252, 254, 0.52);
}

.recovery-rank {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: #075fc8;
  background: rgba(11, 128, 222, 0.12);
  font-size: 0.72rem;
  font-weight: 900;
}

.recovery-bank-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 850;
}

.recovery-bank-value {
  color: #101828;
  font-size: 0.82rem;
  white-space: nowrap;
}

.recovery-bank-share {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  white-space: nowrap;
}

.recovery-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.data-table-wrap {
  width: 100%;
  max-width: 100%;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.data-table th,
.data-table td {
  max-width: 150px;
  padding: 4px 6px;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.66rem;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #526173;
  background: rgba(240, 248, 252, 0.92);
  font-size: 0.64rem;
  font-weight: 900;
  text-transform: uppercase;
}

.data-table tbody tr {
  transition: background 0.14s ease;
}

.data-table tbody tr:hover {
  background: rgba(232, 248, 253, 0.78);
}

.data-table tbody tr.is-clickable {
  cursor: pointer;
}

.data-table .numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  font-size: inherit;
  font-weight: inherit;
  text-transform: inherit;
}

.sort-mark {
  color: var(--blue);
  font-size: 0.78rem;
}

.status-chip {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
}

.chip-green {
  color: #057a55;
  background: #e7fbf1;
}

.chip-blue {
  color: #075fc8;
  background: #e7f2ff;
}

.chip-red {
  color: #b42335;
  background: #fff0f2;
}

.chip-amber {
  color: #975a16;
  background: #fff6df;
}

.chip-neutral {
  color: #475467;
  background: #eef2f6;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination button {
  min-width: 36px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #344054;
  background: rgba(255, 255, 255, 0.7);
  font-weight: 900;
}

.pagination button[disabled] {
  cursor: not-allowed;
  opacity: 0.45;
}

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

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

.compact-chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.7fr);
  gap: 12px;
}

.page-stack {
  display: grid;
  gap: 12px;
}

.drawer-datalist {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.drawer-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.drawer-kpis .mini-stat {
  background: #fff;
}

.detail-drawer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
}

.detail-drawer.is-open {
  display: block;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.32);
}

.drawer-panel {
  position: absolute;
  inset: 0 0 0 auto;
  display: grid;
  width: min(760px, calc(100vw - 28px));
  grid-template-rows: auto 1fr;
  overflow: auto;
  padding: 28px;
  border-left: 1px solid rgba(215, 227, 237, 0.86);
  background: #f8fbfd;
  box-shadow: -26px 0 60px rgba(15, 23, 42, 0.16);
}

.drawer-close {
  position: sticky;
  top: 0;
  z-index: 2;
  justify-self: end;
}

.drawer-title-block {
  display: grid;
  gap: 8px;
  margin: 0 0 18px;
}

.drawer-title-block h2 {
  margin: 0;
  font-size: 1.7rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.drawer-title-block p {
  margin: 0;
  color: var(--muted);
}

.empty-state,
.error-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: 26px;
  text-align: center;
}

.empty-state h3,
.error-state h3 {
  margin: 0 0 8px;
}

.empty-state p,
.error-state p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.error-state {
  border-color: rgba(226, 61, 79, 0.26);
  background: #fff8f8;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 32%, rgba(18, 198, 223, 0.2), transparent 24%),
    radial-gradient(circle at 56% 28%, rgba(32, 195, 107, 0.16), transparent 20%),
    rgba(238, 245, 248, 0.84);
  backdrop-filter: blur(14px) saturate(1.18);
}

.loader-card {
  display: grid;
  width: min(520px, calc(100vw - 42px));
  justify-items: center;
  gap: 13px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
}

.loader-symbol-wrap {
  position: relative;
  display: grid;
  width: 148px;
  height: 148px;
  place-items: center;
}

.loader-symbol {
  width: 96px;
  height: 96px;
  object-fit: contain;
  filter:
    drop-shadow(0 16px 24px rgba(11, 128, 222, 0.22))
    drop-shadow(0 0 18px rgba(18, 198, 223, 0.24));
  animation: symbolThink 1.9s ease-in-out infinite, symbolGlow 2.4s ease-in-out infinite;
}

.loader-symbol-wrap::before,
.loader-symbol-wrap::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.loader-symbol-wrap::before {
  inset: 3px;
  background: conic-gradient(from 80deg, transparent 0 22%, rgba(18, 198, 223, 0.12) 28%, var(--blue) 38%, transparent 47%, rgba(32, 195, 107, 0.16) 62%, var(--green) 72%, transparent 84%);
  -webkit-mask: radial-gradient(circle, transparent 61%, #000 62% 68%, transparent 70%);
  mask: radial-gradient(circle, transparent 61%, #000 62% 68%, transparent 70%);
  filter: drop-shadow(0 0 12px rgba(18, 198, 223, 0.5));
  animation: spin 1.35s linear infinite;
}

.loader-symbol-wrap::after {
  inset: 18px;
  background: conic-gradient(from -40deg, transparent 0 18%, rgba(32, 195, 107, 0.95) 24%, rgba(18, 198, 223, 0.18) 34%, transparent 47%, rgba(7, 95, 200, 0.88) 66%, transparent 78%);
  -webkit-mask: radial-gradient(circle, transparent 58%, #000 60% 66%, transparent 68%);
  mask: radial-gradient(circle, transparent 58%, #000 60% 66%, transparent 68%);
  filter: drop-shadow(0 0 16px rgba(32, 195, 107, 0.46));
  animation: spin 2.1s linear infinite reverse;
}

.loader-orbit,
.loader-pulse {
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  pointer-events: none;
}

.loader-orbit {
  inset: 14px;
  border: 1px solid rgba(18, 198, 223, 0.2);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.64),
    0 0 24px rgba(18, 198, 223, 0.22),
    inset 0 0 18px rgba(11, 128, 222, 0.12);
  animation: ringGlow 1.8s ease-in-out infinite;
}

.loader-pulse {
  inset: 32px;
  border: 1px solid rgba(32, 195, 107, 0.54);
  box-shadow: 0 0 18px rgba(32, 195, 107, 0.24);
  animation: pulseRing 1.45s ease-in-out infinite;
}

.loader-card strong {
  color: #101828;
  font-size: clamp(1rem, 2.3vw, 1.18rem);
  line-height: 1.3;
  background: linear-gradient(90deg, #101828, #075fc8, #13b98f, #101828);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.64);
  animation: textShimmer 2.6s linear infinite, loaderTextFloat 1.8s ease-in-out infinite;
}

.loader-card > span {
  color: var(--muted);
  font-size: clamp(0.82rem, 1.6vw, 0.96rem);
  line-height: 1.45;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.64);
  animation: loaderMessage 2.4s ease-in-out infinite;
}

#loadingMessage::after {
  content: "";
  display: inline-block;
  width: 1.8em;
  text-align: left;
  animation: loadingDots 1.25s steps(4, end) infinite;
}

.toast-host {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 140;
  display: grid;
  gap: 10px;
  width: min(380px, calc(100vw - 40px));
}

.toast {
  padding: 13px 15px;
  border: 1px solid rgba(215, 227, 237, 0.92);
  border-left: 5px solid var(--blue);
  border-radius: var(--radius);
  color: #1f344d;
  background: #fff;
  box-shadow: var(--shadow-soft);
  font-size: 0.9rem;
  font-weight: 760;
}

.toast.is-error {
  border-left-color: var(--danger);
}

.toast.is-success {
  border-left-color: var(--green);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes symbolThink {
  0%,
  100% {
    transform: translateY(0) rotate(-2deg) scale(1);
  }

  45% {
    transform: translateY(-7px) rotate(3deg) scale(1.04);
  }
}

@keyframes symbolGlow {
  0%,
  100% {
    filter:
      drop-shadow(0 16px 24px rgba(11, 128, 222, 0.2))
      drop-shadow(0 0 14px rgba(18, 198, 223, 0.18));
  }

  50% {
    filter:
      drop-shadow(0 18px 28px rgba(11, 128, 222, 0.26))
      drop-shadow(0 0 28px rgba(32, 195, 107, 0.32));
  }
}

@keyframes ringGlow {
  0%,
  100% {
    opacity: 0.78;
    transform: scale(0.96);
  }

  50% {
    opacity: 1;
    transform: scale(1.04);
  }
}

@keyframes pulseRing {
  0% {
    opacity: 0.72;
    transform: scale(0.86);
  }

  100% {
    opacity: 0;
    transform: scale(1.38);
  }
}

@keyframes textShimmer {
  to {
    background-position: 220% center;
  }
}

@keyframes loaderTextFloat {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-3px);
  }
}

@keyframes loaderMessage {
  0%,
  100% {
    opacity: 0.72;
    transform: translateY(0);
  }

  50% {
    opacity: 1;
    transform: translateY(2px);
  }
}

@keyframes loadingDots {
  0% {
    content: "";
  }

  25% {
    content: ".";
  }

  50% {
    content: "..";
  }

  75%,
  100% {
    content: "...";
  }
}

@media (max-width: 1480px) {
  .filter-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  :root {
    --sidebar: 232px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overview-layout,
  .overview-support-grid,
  .overview-insights,
  .overview-bottom,
  .page-grid-2,
  .page-grid-balanced,
  .compact-chart-grid,
  .summary-analytics-grid {
    grid-template-columns: 1fr;
  }

  .aging-half {
    max-width: none;
  }

  .filter-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }
}

@media (max-width: 920px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-brand {
    padding: 12px;
  }

  .sidebar {
    transform: translateX(-105%);
    transition: transform 0.22s ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .app-shell.sidebar-collapsed .sidebar {
    width: var(--sidebar);
    padding: 22px;
  }

  .app-shell.sidebar-collapsed .workspace,
  .workspace {
    margin-left: 0;
  }

  .app-shell.sidebar-collapsed .brand-box {
    min-height: 100px;
    margin-bottom: 20px;
  }

  .app-shell.sidebar-collapsed .sidebar-logo {
    width: 190px;
  }

  .app-shell.sidebar-collapsed .nav-item {
    justify-content: flex-start;
    padding: 0 14px;
  }

  .app-shell.sidebar-collapsed .nav-item > span:last-child {
    display: inline;
  }

  .app-shell.sidebar-collapsed .sidebar-footer {
    display: grid;
  }

  .mobile-only {
    display: inline-flex !important;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
  }

  .sheet-status {
    order: 1;
    flex: 1 1 100%;
    min-width: 0;
    white-space: normal;
  }

  .privacy-chip {
    order: 2;
    margin-right: auto;
  }

  .filter-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

@media (max-width: 640px) {
  body {
    background: #f1f7fa;
  }

  .login-screen {
    padding: 18px;
  }

  .login-brand h1 {
    font-size: 2.2rem;
  }

  .login-card {
    padding: 22px;
  }

  .workspace {
    padding: 16px;
  }

  .topbar {
    margin: -16px -16px 16px;
    padding: 14px 16px;
  }

  .filter-grid,
  .metric-grid,
  .mini-grid,
  .drawer-kpis {
    grid-template-columns: 1fr;
  }

  .filter-actions {
    justify-content: stretch;
  }

  .filter-actions button {
    flex: 1 1 140px;
  }

  .chart-card,
  .panel-card,
  .table-card,
  .filter-panel {
    padding: 14px;
  }

  .chart-wrap,
  .chart-wrap.tall {
    height: 205px;
    min-height: 205px;
    max-height: 205px;
  }

  .chart-wrap.compact,
  .chart-wrap.short {
    height: 190px;
    min-height: 190px;
    max-height: 190px;
  }

  .drawer-panel {
    width: 100vw;
    padding: 18px;
  }
}
