:root {
  --bg: #eef2f7;
  --bg-2: #f8fafc;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --surface-soft: #f8fafc;
  --surface-dark: #0f172a;
  --surface-dark-2: #111c32;
  --border: rgba(148, 163, 184, 0.24);
  --border-strong: rgba(100, 116, 139, 0.34);
  --text: #0f172a;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --primary: #2563eb;
  --primary-2: #4f46e5;
  --primary-hover: #1d4ed8;
  --accent: #06b6d4;
  --danger: #dc2626;
  --info: #2563eb;
  --success: #059669;
  --warning: #b45309;
  --shadow: 0 24px 80px rgba(15, 23, 42, 0.10);
  --shadow-soft: 0 18px 50px rgba(15, 23, 42, 0.07);
  --ring: 0 0 0 4px rgba(37, 99, 235, 0.13);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --sidebar-width: 300px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 8%, rgba(37, 99, 235, 0.18), transparent 32%),
    radial-gradient(circle at 86% 14%, rgba(6, 182, 212, 0.16), transparent 30%),
    linear-gradient(135deg, var(--bg), var(--bg-2));
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.55), rgba(0,0,0,0.05));
}

button,
input,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-loader {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(238, 242, 247, 0.82);
  backdrop-filter: blur(18px);
}

.app-loader.active {
  display: flex;
}

.loader-card {
  width: min(410px, 100%);
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.20);
  text-align: center;
  animation: popIn 460ms cubic-bezier(.2,.8,.2,1);
}

.loader-card strong {
  display: block;
  margin: 16px 0 6px;
  font-size: 20px;
  letter-spacing: -0.035em;
}

.loader-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.loader-mark {
  width: 64px;
  height: 64px;
  margin: 0 auto;
  border-radius: 22px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: 6px;
  padding: 12px;
  background: linear-gradient(135deg, var(--surface-dark), #1e3a8a);
  box-shadow: 0 18px 38px rgba(37, 99, 235, 0.30);
}

.loader-mark span {
  display: block;
  border-radius: 999px;
  background: linear-gradient(180deg, #67e8f9, #60a5fa);
  animation: equalizer 760ms ease-in-out infinite;
}

.loader-mark span:nth-child(1) { height: 42%; animation-delay: 0ms; }
.loader-mark span:nth-child(2) { height: 78%; animation-delay: 120ms; }
.loader-mark span:nth-child(3) { height: 55%; animation-delay: 240ms; }

.loader-progress {
  width: 100%;
  height: 8px;
  margin-top: 22px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.24);
}

.loader-progress span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  animation: progressSlide 1.15s ease-in-out infinite;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
}

.sidebar {
  height: calc(100vh - 24px);
  margin: 12px;
  padding: 24px;
  position: sticky;
  top: 12px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 30px;
  color: #e2e8f0;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(17, 24, 39, 0.98)),
    radial-gradient(circle at 50% -20%, rgba(37, 99, 235, 0.35), transparent 45%);
  box-shadow: 0 26px 70px rgba(15, 23, 42, 0.30);
}

.sidebar::after {
  content: "";
  position: absolute;
  inset: auto -72px -90px auto;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.18);
  filter: blur(28px);
  pointer-events: none;
}

.brand {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.brand-logo-row,
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: inline-grid;
  place-items: center;
  border-radius: 16px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 950;
  letter-spacing: -0.06em;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.34);
}

.brand-kicker,
.eyebrow,
.card-kicker {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #dbeafe;
  background: rgba(37, 99, 235, 0.18);
  border: 1px solid rgba(147, 197, 253, 0.16);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow,
.card-kicker {
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.10);
  border-color: rgba(37, 99, 235, 0.12);
}

.brand-title {
  margin: 8px 0 0;
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.07em;
}

.brand-subtitle {
  margin: 0;
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.55;
}

.nav-menu {
  position: relative;
  display: grid;
  gap: 10px;
}

.nav-button {
  width: 100%;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
  color: #cbd5e1;
  padding: 13px 14px;
  font-size: 14px;
  font-weight: 850;
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.nav-button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.nav-button.active {
  color: #0f172a;
  background: linear-gradient(135deg, #ffffff, #dbeafe);
  border-color: rgba(255, 255, 255, 0.95);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.22);
}

.nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.68;
}

.sidebar-insight {
  position: relative;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.055);
}

.sidebar-insight span,
.sidebar-insight small {
  display: block;
  color: #94a3b8;
  font-size: 12px;
}

.sidebar-insight strong {
  display: block;
  margin: 5px 0 8px;
  color: #e0f2fe;
  font-size: 16px;
  letter-spacing: -0.025em;
}

.sidebar-insight code {
  color: #bfdbfe;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.sidebar-footer {
  position: relative;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.55;
}

.main {
  padding: 38px 36px 42px;
  overflow: hidden;
}

.topbar {
  display: none;
  color: #fff;
  background: rgba(15, 23, 42, 0.94);
  padding: 16px;
  backdrop-filter: blur(16px);
}

.topbar h1 {
  margin: 0 0 2px;
  font-size: 17px;
  letter-spacing: -0.04em;
}

.topbar p {
  margin: 0;
  color: #94a3b8;
  font-size: 12px;
}

.topbar-nav {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.page {
  display: none;
  max-width: 1320px;
  margin: 0 auto;
}

.page.active {
  display: block;
  animation: pageEnter 360ms ease both;
}

.product-hero {
  position: relative;
  margin-bottom: 20px;
  padding: 28px;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 24px;
  border: 1px solid rgba(255, 255, 255, 0.70);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.96), rgba(248,250,252,0.78)),
    radial-gradient(circle at 92% 18%, rgba(37, 99, 235, 0.14), transparent 34%);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.product-hero::after {
  content: "";
  position: absolute;
  inset: auto 24px -55px auto;
  width: 160px;
  height: 160px;
  border-radius: 999px;
  background: rgba(6, 182, 212, 0.16);
  filter: blur(20px);
}

.product-hero.compact {
  align-items: center;
}

.hero-copy,
.hero-status-card {
  position: relative;
  z-index: 1;
}

.hero-copy {
  max-width: 760px;
}

.page-title {
  margin: 12px 0 12px;
  font-size: clamp(30px, 4.5vw, 54px);
  line-height: 0.98;
  letter-spacing: -0.075em;
}

.page-description {
  margin: 0;
  max-width: 820px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.hero-status-card {
  width: min(285px, 100%);
  flex: 0 0 285px;
  padding: 18px;
  border: 1px solid rgba(148, 163, 184, 0.20);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px);
}

.hero-status-card strong {
  display: block;
  margin-top: 14px;
  font-size: 18px;
  letter-spacing: -0.035em;
}

.hero-status-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.10);
  border: 1px solid rgba(37, 99, 235, 0.12);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.10);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.metric-card,
.card {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.68);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.metric-card {
  padding: 18px;
  border-radius: 22px;
  overflow: hidden;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.metric-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), transparent 42%);
  opacity: 0;
  transition: opacity 180ms ease;
}

.metric-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.metric-card:hover::after {
  opacity: 1;
}

.metric-label {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-card strong {
  position: relative;
  z-index: 1;
  display: block;
  color: var(--text);
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: -0.035em;
}

.metric-card small {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.calculator-layout {
  display: grid;
  grid-template-columns: minmax(420px, 0.92fr) minmax(420px, 1.08fr);
  gap: 20px;
  align-items: start;
}

.card {
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.calculator-card,
.result-card,
.about-card {
  padding: 26px;
}

.card-header {
  margin-bottom: 20px;
}

.card-header.horizontal {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.card-header h3,
.about-card h3 {
  margin: 8px 0 6px;
  font-size: 22px;
  letter-spacing: -0.05em;
}

.card-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.card-index {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 44px;
  border-radius: 16px;
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.10);
  border: 1px solid rgba(37, 99, 235, 0.12);
  font-weight: 950;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-field.full {
  grid-column: 1 / -1;
}

label {
  display: block;
  margin-bottom: 8px;
  color: #334155;
  font-size: 13px;
  font-weight: 900;
}

input,
select {
  width: 100%;
  min-height: 48px;
  padding: 13px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 15px;
  outline: none;
  background: rgba(255, 255, 255, 0.80);
  color: var(--text);
  font-size: 14px;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease, background 150ms ease;
}

input:focus,
select:focus {
  border-color: rgba(37, 99, 235, 0.70);
  box-shadow: var(--ring);
  background: #ffffff;
}

input[readonly] {
  background: rgba(241, 245, 249, 0.90);
  color: #475569;
  cursor: not-allowed;
}

.input-shell {
  display: flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.80);
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.input-shell:focus-within {
  border-color: rgba(37, 99, 235, 0.70);
  box-shadow: var(--ring);
  background: #ffffff;
}

.input-shell span {
  padding-left: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.input-shell input {
  min-height: 46px;
  border: 0;
  box-shadow: none;
  background: transparent;
}

.input-shell input:focus {
  box-shadow: none;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px dashed rgba(37, 99, 235, 0.24);
  border-radius: 16px;
  background: rgba(37, 99, 235, 0.055);
}

.inline-check input {
  width: 18px;
  height: 18px;
  min-height: auto;
  accent-color: var(--primary);
}

.inline-check label {
  margin: 0;
  color: #1e3a8a;
  font-size: 13px;
}

.primary-button {
  position: relative;
  width: 100%;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 16px;
  overflow: hidden;
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 18px 36px rgba(37, 99, 235, 0.26);
  font-size: 15px;
  font-weight: 950;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.primary-button::before {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.24), transparent);
  transition: transform 500ms ease;
}

.primary-button:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: saturate(1.12);
  box-shadow: 0 22px 42px rgba(37, 99, 235, 0.34);
}

.primary-button:hover:not(:disabled)::before {
  transform: translateX(100%);
}

.primary-button:disabled {
  background: #94a3b8;
  box-shadow: none;
  cursor: not-allowed;
}

.primary-button.is-loading {
  cursor: wait;
}

.primary-button.is-loading::after {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.44);
  border-top-color: #fff;
  animation: spin 720ms linear infinite;
}

.helper-text {
  display: none;
  margin: 8px 0 0;
  color: var(--info);
  font-size: 12px;
  line-height: 1.45;
}

.message {
  display: none;
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.45;
}

.message.error {
  color: var(--danger);
  background: #fef2f2;
  border: 1px solid #fecaca;
  font-weight: 850;
}

.processing-panel {
  display: none;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 18px;
  background: rgba(37, 99, 235, 0.07);
  animation: fadeInUp 240ms ease both;
}

.processing-panel.active {
  display: flex;
}

.processing-panel strong {
  display: block;
  margin-bottom: 3px;
  font-size: 14px;
}

.processing-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.mini-spinner {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  border: 3px solid rgba(37, 99, 235, 0.16);
  border-top-color: var(--primary);
  animation: spin 760ms linear infinite;
}

.result-placeholder {
  display: grid;
  gap: 12px;
  padding: 20px;
  border: 1px dashed rgba(37, 99, 235, 0.25);
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.075), rgba(6, 182, 212, 0.06));
  color: #334155;
}

.result-placeholder strong {
  font-size: 14px;
}

.result-placeholder code {
  display: block;
  padding: 14px;
  border-radius: 14px;
  color: #e0f2fe;
  background: #0f172a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  white-space: normal;
}

.result-placeholder p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.result-box {
  display: none;
  gap: 16px;
}

.result-box.active {
  display: grid;
  animation: fadeInUp 280ms ease both;
}

.result-section {
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.86);
}

.result-section span,
.result-summary-grid span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-section p {
  margin: 0;
  color: #334155;
  line-height: 1.6;
  font-size: 14px;
}

.result-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.result-summary-grid > div {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255,255,255,0.88), rgba(248,250,252,0.90));
}

.result-summary-grid strong {
  display: block;
  font-size: clamp(18px, 2vw, 26px);
  line-height: 1.12;
  letter-spacing: -0.055em;
  font-variant-numeric: tabular-nums;
}

.result-total {
  color: var(--success) !important;
}

.indices-card {
  overflow: hidden;
}

.table-toolbar {
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 140px 150px 190px auto auto;
  gap: 12px;
  align-items: end;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.56);
}

.toolbar-action {
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: 15px;
  color: #334155;
  background: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.toolbar-action:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.toolbar-action.primary-lite {
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.10);
  border-color: rgba(37, 99, 235, 0.18);
}

.toolbar-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.table-summary,
.pagination-bar {
  padding: 15px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(248, 250, 252, 0.78);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}

.pagination-bar {
  border-top: 1px solid var(--border);
  border-bottom: 0;
}

.pagination-actions {
  display: flex;
  gap: 10px;
}

.table-wrapper {
  position: relative;
  width: 100%;
  overflow: auto;
  max-height: calc(100vh - 410px);
  background: #ffffff;
}

.table-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(7px);
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 900;
}

.table-wrapper.loading .table-loading {
  display: flex;
}

table {
  width: 100%;
  min-width: 960px;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.86);
  text-align: left;
  color: #334155;
  font-size: 14px;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #475569;
  background: #f8fafc;
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

tbody tr {
  transition: background 130ms ease, transform 130ms ease;
}

tbody tr:hover {
  background: #f8fafc;
}

tbody tr.current-reference {
  background: #eff6ff;
}

.number-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 950;
}

.badge.available {
  color: var(--success);
  background: #ecfdf5;
}

.badge.empty {
  color: var(--warning);
  background: #fff7ed;
}

.copy-button {
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.86);
  color: #334155;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.copy-button:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

.copy-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.copy-button.delete-button {
  color: #b91c1c;
  background: #fff7f7;
  border-color: #fecaca;
}

.copy-button.delete-button:hover:not(:disabled) {
  color: #991b1b;
  border-color: #ef4444;
}

.history-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.empty-state {
  display: none;
  padding: 38px 20px;
  text-align: center;
  color: var(--muted);
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.about-card.full-card {
  grid-column: 1 / -1;
}

.about-card dl {
  margin: 18px 0 0;
  display: grid;
  gap: 12px;
}

.about-card dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.about-card dd {
  margin: 4px 0 0;
  color: #334155;
  font-size: 14px;
  line-height: 1.6;
}

.about-card ul {
  margin: 18px 0 0;
  padding-left: 18px;
  color: #334155;
  line-height: 1.7;
}

.xp-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.40);
  backdrop-filter: blur(3px);
}

.xp-modal-backdrop.active {
  display: flex;
}

.xp-window {
  width: min(430px, 100%);
  border: 2px solid #0055ea;
  border-radius: 7px 7px 3px 3px;
  background: #ece9d8;
  box-shadow: 7px 9px 0 rgba(0, 0, 0, 0.22);
  font-family: Tahoma, Verdana, Arial, sans-serif;
  overflow: hidden;
  animation: popIn 180ms ease both;
}

.xp-titlebar {
  min-height: 31px;
  padding: 5px 7px 5px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #ffffff;
  background: linear-gradient(180deg, #2f86ff 0%, #0055ea 48%, #003dc0 100%);
  font-family: Tahoma, Verdana, Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.35);
}

.xp-close {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 3px;
  background: linear-gradient(180deg, #ffb19b, #e74b2d 60%, #b7190e);
  color: #ffffff;
  cursor: pointer;
  font-family: Tahoma, Verdana, Arial, sans-serif;
  font-size: 16px;
  font-weight: 900;
  line-height: 18px;
}

.xp-content {
  padding: 20px 20px 18px;
  color: #111111;
  font-family: Tahoma, Verdana, Arial, sans-serif;
}

.xp-message-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.xp-error-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffb4b4, #d61f1f 62%);
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px #8b0000;
  color: white;
  font-size: 26px;
  line-height: 1;
  font-weight: 900;
}

.xp-message {
  margin: 2px 0 0;
  color: #111111;
  font-size: 12px;
  line-height: 1.45;
}

.xp-actions {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.xp-button,
.xp-link-action {
  min-width: 84px;
  min-height: 26px;
  padding: 3px 14px;
  border: 1px solid #7f9db9;
  border-radius: 3px;
  background: linear-gradient(180deg, #ffffff, #ece9d8);
  color: #111111;
  cursor: pointer;
  font-family: Tahoma, Verdana, Arial, sans-serif;
  font-size: 12px;
}

.xp-link-action {
  min-width: auto;
  border: 0;
  background: transparent;
  color: #0046d5;
  text-decoration: underline;
}

.xp-problem-panel {
  display: none;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #aca899;
  background: #fffef2;
}

.xp-problem-panel.active {
  display: block;
}

.xp-problem-message {
  margin: 0 0 10px;
  color: #111111;
  font-family: Tahoma, Verdana, Arial, sans-serif;
  font-size: 12px;
  line-height: 1.45;
}

.xp-whatsapp-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid #2b7a32;
  border-radius: 3px;
  background: linear-gradient(180deg, #e8ffe9, #bdf0c2);
  color: #14532d;
  font-family: Tahoma, Verdana, Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10000;
  max-width: 360px;
  padding: 14px 16px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 16px;
  color: #ffffff;
  background: rgba(15, 23, 42, 0.92);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
  font-size: 13px;
  font-weight: 850;
}

.toast.active {
  transform: translateY(0);
  opacity: 1;
}

@keyframes pageEnter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

@keyframes equalizer {
  0%, 100% { transform: scaleY(0.62); opacity: 0.75; }
  50% { transform: scaleY(1); opacity: 1; }
}

@keyframes progressSlide {
  0% { transform: translateX(-110%); }
  55%, 100% { transform: translateX(250%); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

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

  .sidebar {
    display: none;
  }

  .topbar {
    display: block;
    position: sticky;
    top: 0;
    z-index: 50;
  }

  .main {
    padding: 24px;
  }

  .calculator-layout,
  .about-grid {
    grid-template-columns: 1fr;
  }

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

  .table-toolbar {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  body {
    background: #f8fafc;
  }

  .main {
    padding: 16px;
  }

  .product-hero {
    display: grid;
    padding: 22px;
  }

  .hero-status-card {
    width: 100%;
    flex-basis: auto;
  }

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

  .metrics-grid,
  .form-grid,
  .result-summary-grid,
  .table-toolbar {
    grid-template-columns: 1fr;
  }

  .calculator-card,
  .result-card,
  .about-card {
    padding: 20px;
  }

  .topbar-nav {
    grid-template-columns: 1fr;
  }

  .topbar .nav-button {
    justify-content: center;
    text-align: center;
  }

  .table-summary,
  .pagination-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .pagination-actions {
    width: 100%;
  }

  .pagination-actions .toolbar-action {
    flex: 1;
  }

  .toast {
    right: 16px;
    left: 16px;
    bottom: 16px;
    max-width: none;
  }
}

.history-card {
  margin-top: 22px;
  padding: 0;
  animation: fadeInUp 320ms ease both;
}

.history-header {
  padding: 22px 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.58);
}

.history-header h3 {
  margin: 8px 0 6px;
  font-size: 22px;
  letter-spacing: -0.05em;
}

.history-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.history-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-action.danger-lite {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fecaca;
}

.toolbar-action.danger-lite:hover:not(:disabled) {
  border-color: #f87171;
  color: #991b1b;
  box-shadow: 0 10px 22px rgba(220, 38, 38, 0.10);
}

.history-table-wrapper {
  max-height: 360px;
}

.history-table {
  min-width: 1040px;
}

.history-result {
  color: var(--success);
  font-weight: 950;
}

.history-empty {
  border-top: 1px solid var(--border);
  background: rgba(248, 250, 252, 0.78);
}

@media (max-width: 860px) {
  .history-header {
    flex-direction: column;
    align-items: stretch;
  }

  .history-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .history-header .toolbar-action {
    width: 100%;
  }
}
