/* ═══════════════════════════════════════════════════════════════
   Policy & Premium Page Styles
   ═══════════════════════════════════════════════════════════════ */

/* ── Page Header ── */
.pp-page-header {
  margin-bottom: 32px;
}

.pp-page-title {
  font-family: var(--font-serif);
  font-size: 36px;
  line-height: 1.2;
  color: var(--color-ink);
  font-weight: 400;
  margin: 0;
}

/* ── Latest Report Card ── */
.pp-latest-card {
  background: var(--surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 32px;
  margin-bottom: 40px;
  position: relative; /* Anchor point for the floating toggle */
}

.pp-latest-card__header {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
  padding-right: 280px; /* Prevents overlapping the toggle on wider screens */
}

.pp-latest-card__header .badge {
  margin-bottom: 8px;
}

.pp-latest-card__title {
  font-family: var(--font-serif);
  font-size: 24px;
  color: var(--color-ink);
  margin: 0 0 4px;
  font-weight: 400;
}

.pp-latest-card__meta {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--color-muted);
  margin: 0;
}

/* Icon-only variant (for tight spaces) */
.db-btn--sm {
  width: 32px;
  height: 32px;
  padding: 0;
  line-height: 32px; 
  border-radius: 50%;
}

.db-btn--sm .material-symbols-outlined {
  font-size: 18px;
}

/* ── Floating Toggle Wrap ── */
.latest-report-toggle-wrap {
  position: absolute;
  top: 32px;
  right: 32px;
}

.latest-tab-panel[hidden] {
  display: none !important;
}

/* ── Segmented Toggle (Report Type) ── */
.report-type-toggle {
  display: flex;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}

.report-type-toggle label {
  position: relative;
  padding: 8px 14px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-subtle);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.report-type-toggle label:not(:last-child) {
  border-right: 1px solid var(--color-border);
}

.report-type-toggle input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.report-type-toggle input[type="radio"]:checked + label,
.report-type-toggle label:has(input[type="radio"]:checked) {
  background: var(--swatch-gold-bg);
  color: var(--swatch-gold-text);
}

/* ── KPI Modifiers ── */
.kpi-item__value--secondary {
  color: var(--swatch-green-accent);
}

.kpi-item__value--compact {
  font-size: 22px;
}

/* ── Ratio Cards ── */
.ratio-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.ratio-card {
  border-radius: var(--radius-md);
  padding: 18px;
  position: relative; 
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}

.ratio-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.ratio-card__watermark {
  position: absolute;
  right: -15px;
  bottom: -15px;
  font-size: 110px !important;
  opacity: 0.1;
  pointer-events: none;
  z-index: 0;
  transition: transform 0.5s ease, opacity 0.3s ease;
}

.ratio-card:hover .ratio-card__watermark {
  transform: scale(1.1);
  opacity: 0.15;
}

.ratio-card__content {
  position: relative;
  z-index: 1;
}

.ratio-card__label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 6px;
}

.ratio-card__value {
  font-family: var(--font-serif);
  font-size: 28px;
  margin: 0;
  font-weight: 700;
}

/* Color Variants */
.ratio-card--renewal { background: var(--swatch-green-bg); }
.ratio-card--renewal .ratio-card__label,
.ratio-card--renewal .ratio-card__value { color: var(--swatch-green-text); }
.ratio-card--renewal .ratio-card__watermark { color: var(--swatch-green-strong); }

.ratio-card--lapse { background: var(--swatch-amber-bg); }
.ratio-card--lapse .ratio-card__label,
.ratio-card--lapse .ratio-card__value { color: var(--swatch-amber-text); }
.ratio-card--lapse .ratio-card__watermark { color: var(--swatch-amber-strong); }

.ratio-card--loss { background: var(--swatch-red-bg); }
.ratio-card--loss .ratio-card__label,
.ratio-card--loss .ratio-card__value { color: var(--swatch-red-text); }
.ratio-card--loss .ratio-card__watermark { color: var(--swatch-red-text); }

/* ── Policy Breakdown Grid ── */
.pp-breakdown-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}

.pp-breakdown-label {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-subtle);
  margin: 0 0 12px;
}

.db-table tr.total-row {
  font-weight: 600;
  background: var(--surface-alt);
}

.trend-card__body {
  flex: 1;
  min-height: 280px;
}

/* ── Skeleton Modifiers ── */
.skeleton--fill { width: 100%; height: 100%; }
.skeleton-text--wide { width: 80%; }
.skeleton-text--medium { width: 60%; }
.skeleton-chart--spaced { margin-top: 12px; }

/* ── Empty State ── */
.pp-empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--color-muted);
}

.pp-empty-state__icon {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
  color: var(--color-border-strong);
}

.pp-empty-state__text {
  font-family: var(--font-serif-alt);
  font-size: 18px;
  margin: 0;
}

/* ── Trend Filter Bar (Premium Look) ── */
.claims-trend-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 20px;
  padding: 20px;
  margin-bottom: 24px;
  background: var(--surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-group__label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* ── Checkbox dropdown filters ── */
.filter-dropdown { position: relative; }

.filter-dropdown-btn {
  height: 40px;
  padding: 0 16px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-ink);
  background: var(--surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.filter-dropdown-btn:hover,
.filter-dropdown:focus-within .filter-dropdown-btn {
  border-color: var(--color-muted);
}

.filter-dropdown-count {
  font-weight: 400;
  color: var(--color-muted);
  font-size: 12px;
}

.filter-dropdown-btn .material-symbols-outlined {
  font-size: 20px;
  transition: transform 0.2s ease;
}

.filter-dropdown:focus-within .filter-dropdown-btn .material-symbols-outlined {
  transform: rotate(180deg);
}

.filter-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 100;
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.filter-dropdown:focus-within .filter-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.filter-checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--color-ink);
  border-radius: 6px;
  cursor: pointer;
}

.filter-checkbox-item:hover { background: var(--color-bg-subtle); }
.filter-checkbox-item input[type="checkbox"] { accent-color: var(--swatch-green-strong); width: 16px; height: 16px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .pp-breakdown-grid { grid-template-columns: 1fr; }
  .ratio-row { grid-template-columns: 1fr; }
  .pp-page-title { font-size: 28px; }
  .trend-card__body { min-height: 200px; }

  .latest-report-toggle-wrap {
    position: static;
    margin-bottom: 24px;
  }
  .pp-latest-card__header { padding-right: 0; }

  .claims-trend-filters { flex-direction: column; align-items: stretch; }
  .filter-dropdown-menu { left: auto; right: 0; width: 100%; }
}