/* =========================
   Root / Theme
========================= */
:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --surface-4: #e8edf5;

  --text: #111827;
  --text-soft: #4b5563;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;

  --border: #e5e7eb;
  --border-strong: #d1d5db;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #dbeafe;

  --success: #16a34a;
  --success-soft: #dcfce7;

  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: #fee2e2;

  --warning: #d97706;
  --warning-hover: #b45309;
  --warning-soft: #fef3c7;

  --info: #0f766e;
  --info-soft: #ccfbf1;

  --sidebar-bg: #0f172a;
  --sidebar-text: rgba(255, 255, 255, 0.92);
  --sidebar-muted: rgba(255, 255, 255, 0.62);
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --sidebar-active: rgba(37, 99, 235, 0.28);

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 10px 24px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 18px 42px rgba(15, 23, 42, 0.1);
  --shadow-lg: 0 28px 64px rgba(15, 23, 42, 0.18);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-2xl: 28px;
  --radius-pill: 999px;

  --sidebar-width: 285px;
  --topbar-height: 88px;

  --transition-fast: 0.18s ease;
  --transition-base: 0.24s ease;

  --font-main: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body.dark-theme {
  --bg: #0b1220;
  --surface: #111827;
  --surface-2: #0f172a;
  --surface-3: #162033;
  --surface-4: #1a263b;

  --text: #f3f4f6;
  --text-soft: #d1d5db;
  --text-muted: #9ca3af;
  --text-faint: #6b7280;

  --border: #1f2937;
  --border-strong: #334155;

  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-soft: rgba(59, 130, 246, 0.16);

  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.16);

  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-soft: rgba(239, 68, 68, 0.16);

  --warning: #f59e0b;
  --warning-hover: #d97706;
  --warning-soft: rgba(245, 158, 11, 0.16);

  --info: #14b8a6;
  --info-soft: rgba(20, 184, 166, 0.16);

  --sidebar-bg: #08101d;
  --sidebar-text: rgba(255, 255, 255, 0.95);
  --sidebar-muted: rgba(255, 255, 255, 0.62);
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active: rgba(59, 130, 246, 0.22);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-sm: 0 10px 24px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 18px 42px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 28px 64px rgba(0, 0, 0, 0.42);
}

/* =========================
   Reset
========================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  transition: background var(--transition-base), color var(--transition-base);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

table {
  width: 100%;
  border-collapse: collapse;
}

img,
canvas {
  display: block;
  max-width: 100%;
}

textarea {
  resize: vertical;
}

.hidden {
  display: none !important;
}

/* =========================
   App Shell
========================= */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* =========================
   Sidebar
========================= */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  padding: 22px 18px;
  gap: 22px;
  z-index: 30;
  transition: transform var(--transition-base);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 4px 8px;
}

.sidebar__logo {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), #60a5fa);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 800;
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.28);
}

.sidebar__brand h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.sidebar__brand p {
  margin: 4px 0 0;
  color: var(--sidebar-muted);
  font-size: 0.92rem;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar__link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--sidebar-text);
  text-align: left;
  transition: background var(--transition-fast), transform var(--transition-fast),
    color var(--transition-fast);
}

.sidebar__link:hover {
  background: var(--sidebar-hover);
  transform: translateX(2px);
}

.sidebar__link--active {
  background: var(--sidebar-active);
  font-weight: 700;
}

.sidebar__icon {
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar__card {
  margin-top: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 18px;
  padding: 16px;
}

.sidebar__card h4 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-weight: 800;
}

.sidebar__mini-stats {
  display: grid;
  gap: 10px;
}

.sidebar__mini-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--sidebar-muted);
}

.sidebar__mini-stat strong {
  color: #fff;
  font-size: 0.94rem;
}

.sidebar__footer {
  margin-top: auto;
  padding: 10px 8px 0;
  color: var(--sidebar-muted);
  font-size: 0.9rem;
}

/* =========================
   Topbar
========================= */
.topbar {
  min-height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  display: grid;
  grid-template-columns: auto minmax(280px, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar__left,
.topbar__center,
.topbar__right {
  min-width: 0;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar__center {
  display: flex;
  justify-content: center;
}

.topbar__right {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.page-title {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.1;
}

.page-subtitle {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  transition: background var(--transition-fast), transform var(--transition-fast),
    border-color var(--transition-fast);
}

.icon-btn:hover {
  background: var(--surface-3);
}

.icon-btn:active {
  transform: scale(0.97);
}

.topbar-search {
  width: min(520px, 100%);
  height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 0 14px;
  box-shadow: var(--shadow-xs);
}

.topbar-search__icon {
  color: var(--text-faint);
  flex-shrink: 0;
}

.topbar-search__input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--text);
  outline: none;
}

.topbar-search__input::placeholder {
  color: var(--text-faint);
}

/* =========================
   Content / Sections
========================= */
.content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.app-section {
  display: none;
  flex-direction: column;
  gap: 24px;
}

.app-section--active {
  display: flex;
}

/* =========================
   Buttons
========================= */
.btn {
  height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast),
    border-color var(--transition-fast), transform var(--transition-fast),
    box-shadow var(--transition-fast), opacity var(--transition-fast);
}

.btn:active {
  transform: scale(0.98);
}

.btn--sm {
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 0.88rem;
}

.btn--primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.18);
}

.btn--primary:hover {
  background: var(--primary-hover);
}

.btn--secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn--secondary:hover {
  background: var(--surface-3);
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn--ghost:hover {
  background: var(--surface-2);
}

.btn--danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 10px 18px rgba(220, 38, 38, 0.18);
}

.btn--danger:hover {
  background: var(--danger-hover);
}

.btn--file {
  overflow: hidden;
}

/* =========================
   Panels
========================= */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel--chart {
  min-height: 100%;
}

.panel__header {
  padding: 22px 22px 0;
}

.panel__header--split {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel__header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.panel__title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
}

.panel__subtitle {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* =========================
   Stats
========================= */
.stats-grid {
  display: grid;
  gap: 18px;
}

.stats-grid--xl {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.stats-grid--payments {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast),
    border-color var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card--accent {
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.1), var(--surface));
  border-color: rgba(37, 99, 235, 0.18);
}

body.dark-theme .stat-card--accent {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.18), var(--surface));
}

.stat-card__label {
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.stat-card__value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
}

.stat-card__hint {
  margin-top: 10px;
  color: var(--text-faint);
  font-size: 0.85rem;
}

/* =========================
   Dashboard Layout
========================= */
.dashboard-layout {
  display: grid;
  grid-template-columns: 1.35fr 0.95fr 1fr;
  gap: 18px;
  align-items: stretch;
}

.dashboard-layout--secondary {
  grid-template-columns: 1.25fr 0.95fr 0.85fr;
}

/* =========================
   Chart / Chips / Legend
========================= */
.chart-box {
  padding: 18px 22px 22px;
  min-height: 280px;
}

.chart-box--compact {
  min-height: 220px;
}

.chart-box canvas {
  width: 100%;
  height: auto;
}

.chip-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 0.85rem;
  font-weight: 700;
  transition: background var(--transition-fast), color var(--transition-fast),
    border-color var(--transition-fast);
}

.chip:hover {
  background: var(--surface-3);
}

.chip--active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: transparent;
}

.legend-list {
  padding: 0 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.legend-item__left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.legend-item__dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  flex-shrink: 0;
}

.legend-item__label {
  font-weight: 600;
  color: var(--text-soft);
}

.legend-item__value {
  font-weight: 800;
  color: var(--text);
}

/* =========================
   Lists / Cards
========================= */
.renewal-list,
.activity-list,
.ranking-list {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 220px;
}

.renewal-item,
.activity-item,
.ranking-item {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-2);
}

.renewal-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.renewal-item__main,
.ranking-item__main {
  min-width: 0;
}

.renewal-item__name,
.activity-item__title,
.ranking-item__name {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--text);
}

.renewal-item__meta,
.activity-item__meta,
.ranking-item__meta {
  margin: 6px 0 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.activity-list--timeline .activity-item {
  position: relative;
  padding-left: 18px;
}

.activity-list--timeline .activity-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  width: 6px;
  height: calc(100% - 36px);
  border-radius: 999px;
  background: var(--primary-soft);
}

.activity-empty {
  margin: auto 0;
  border: 1px dashed var(--border-strong);
  border-radius: 16px;
  background: var(--surface-2);
  color: var(--text-muted);
  padding: 18px;
  text-align: center;
}

.quick-actions {
  padding: 20px 22px 22px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.quick-action-card {
  min-height: 96px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
  color: var(--text);
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast),
    border-color var(--transition-fast);
}

.quick-action-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: rgba(37, 99, 235, 0.18);
}

.quick-action-card__icon {
  font-size: 1.3rem;
}

/* =========================
   Toolbar / Filters
========================= */
.toolbar {
  padding: 20px 22px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.toolbar__search {
  width: 100%;
}

.toolbar__filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.toolbar__filters--wide {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.summary-bar {
  margin: 20px 22px 0;
  padding: 14px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--text-soft);
  flex-wrap: wrap;
}

.summary-bar__item strong {
  color: var(--text);
}

.bulk-bar {
  margin: 18px 22px 0;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  background: rgba(37, 99, 235, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

body.dark-theme .bulk-bar {
  background: rgba(59, 130, 246, 0.12);
}

.bulk-bar__left {
  font-weight: 700;
  color: var(--text);
}

.bulk-bar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* =========================
   Forms
========================= */
.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group--action {
  justify-content: flex-end;
}

.form-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
}

.form-label--hidden {
  visibility: hidden;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  padding: 0 14px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast),
    background var(--transition-fast), color var(--transition-fast);
}

.form-input,
.form-select {
  height: 46px;
}

.form-textarea {
  min-height: 110px;
  padding: 12px 14px;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-faint);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

/* =========================
   Tables
========================= */
.table-wrapper {
  margin: 22px;
  margin-top: 18px;
  overflow-x: auto;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.data-table {
  min-width: 1120px;
}

.data-table thead {
  background: var(--surface-2);
}

.data-table th,
.data-table td {
  padding: 15px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table th {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.1px;
}

.data-table td {
  color: var(--text);
  font-size: 0.95rem;
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: var(--surface-2);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.cell-checkbox {
  width: 52px;
}

.cell-checkbox input,
.data-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.member-name {
  font-weight: 800;
}

.member-note {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--text-faint);
}

.contact-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.contact-stack__primary {
  color: var(--text);
  font-weight: 600;
}

.contact-stack__secondary {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* =========================
   Badges / Pills
========================= */
.status-badge,
.fee-badge,
.plan-badge,
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 800;
}

.status-badge--active,
.status-badge--paid {
  background: var(--success-soft);
  color: var(--success);
}

.status-badge--expired,
.status-badge--inactive,
.status-badge--overdue {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-badge--pending {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-badge--refunded {
  background: var(--surface-3);
  color: var(--text-soft);
}

.fee-badge,
.plan-badge--premium {
  background: var(--primary-soft);
  color: var(--primary);
}

.plan-badge--basic {
  background: var(--surface-3);
  color: var(--text-soft);
}

.plan-badge--standard {
  background: var(--info-soft);
  color: var(--info);
}

.count-badge {
  background: var(--surface-3);
  color: var(--text-soft);
}

/* =========================
   Table Actions
========================= */
.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.table-action {
  min-width: 68px;
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.83rem;
  font-weight: 800;
  transition: background var(--transition-fast), color var(--transition-fast),
    transform var(--transition-fast);
}

.table-action:active {
  transform: scale(0.97);
}

.table-action--edit,
.table-action--renew,
.table-action--assign {
  background: var(--primary-soft);
  color: var(--primary);
}

.table-action--edit:hover,
.table-action--renew:hover,
.table-action--assign:hover {
  background: rgba(37, 99, 235, 0.2);
}

.table-action--delete {
  background: var(--danger-soft);
  color: var(--danger);
}

.table-action--delete:hover {
  background: rgba(220, 38, 38, 0.22);
}

/* =========================
   Empty State
========================= */
.empty-state {
  display: none;
  margin: 0 22px 22px;
  padding: 34px 18px;
  border: 1px dashed var(--border-strong);
  border-radius: 18px;
  background: var(--surface-2);
  text-align: center;
}

.empty-state.is-visible {
  display: block;
}

.empty-state__icon {
  font-size: 2rem;
  color: var(--text-faint);
  margin-bottom: 10px;
}

.empty-state h4 {
  margin: 0;
  font-size: 1.1rem;
}

.empty-state p {
  margin: 8px 0 0;
  color: var(--text-muted);
}

/* =========================
   Pagination
========================= */
.pagination {
  padding: 0 22px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.pagination__info {
  color: var(--text-muted);
  font-weight: 700;
}

/* =========================
   Settings / Meta
========================= */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.setting-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.setting-card h4 {
  margin: 0;
  font-size: 1.04rem;
  font-weight: 800;
}

.setting-card p {
  margin: 8px 0 16px;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.setting-card__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.meta-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.meta-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.meta-list span {
  color: var(--text-muted);
}

.meta-list strong {
  color: var(--text);
  font-weight: 800;
}

/* =========================
   Modal
========================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 22px;
}

.modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.58);
  backdrop-filter: blur(3px);
}

.modal__content {
  position: relative;
  width: 100%;
  max-width: 800px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 1;
  animation: modalIn 0.18s ease-out;
}

.modal__content--sm {
  max-width: 500px;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal__header {
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.modal__header h3 {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 800;
}

.modal__subtitle {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.modal__close {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  color: var(--text-muted);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.modal__close:hover {
  background: var(--surface-2);
  color: var(--text);
}

.modal__form {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 4px;
}

.confirm-box {
  padding: 22px;
}

.confirm-box p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.98rem;
}

.assign-helper {
  margin-bottom: 16px !important;
  color: var(--text);
}

/* =========================
   Toasts
========================= */
.toast-container {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: toastIn 0.2s ease-out;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast__icon {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  flex-shrink: 0;
  font-weight: 800;
}

.toast__content {
  min-width: 0;
  flex: 1;
}

.toast__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
}

.toast__message {
  margin: 4px 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.toast--success .toast__icon {
  background: var(--success-soft);
  color: var(--success);
}

.toast--error .toast__icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.toast--info .toast__icon {
  background: var(--primary-soft);
  color: var(--primary);
}

/* =========================
   Utilities
========================= */
.text-muted {
  color: var(--text-muted);
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

/* =========================
   Responsive
========================= */
@media (max-width: 1500px) {
  .stats-grid--xl {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-layout,
  .dashboard-layout--secondary {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-layout > :last-child,
  .dashboard-layout--secondary > :last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1280px) {
  .topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .topbar__center {
    justify-content: stretch;
  }

  .topbar-search {
    width: 100%;
  }

  .topbar__right {
    justify-content: flex-start;
  }

  .toolbar__filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .toolbar__filters--wide {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(84vw, 310px);
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-open::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.4);
    z-index: 25;
  }

  .stats-grid--xl,
  .stats-grid--payments {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-layout,
  .dashboard-layout--secondary {
    grid-template-columns: 1fr;
  }

  .quick-actions {
    grid-template-columns: 1fr 1fr;
  }

  .toolbar__filters,
  .toolbar__filters--wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .content {
    padding: 18px;
    gap: 18px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .bulk-bar,
  .summary-bar,
  .panel__header--split {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel__header-actions,
  .bulk-bar__actions {
    width: 100%;
  }

  .panel__header-actions .btn,
  .bulk-bar__actions .btn {
    flex: 1 1 auto;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

  .renewal-item {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .content {
    padding: 16px;
    gap: 16px;
  }

  .topbar {
    padding: 16px;
  }

  .panel__header,
  .toolbar,
  .modal__form,
  .modal__header,
  .confirm-box,
  .renewal-list,
  .activity-list,
  .ranking-list,
  .chart-box,
  .legend-list {
    padding-left: 16px;
    padding-right: 16px;
  }

  .summary-bar,
  .bulk-bar {
    margin-left: 16px;
    margin-right: 16px;
  }

  .table-wrapper {
    margin: 16px;
    margin-top: 14px;
  }

  .empty-state {
    margin: 0 16px 16px;
  }

  .pagination {
    padding: 0 16px 16px;
  }

  .stats-grid--xl,
  .stats-grid--payments {
    grid-template-columns: 1fr;
  }

  .toolbar__filters,
  .toolbar__filters--wide {
    grid-template-columns: 1fr;
  }

  .modal {
    padding: 14px;
  }

  .modal__actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .modal__actions .btn {
    width: 100%;
  }

  .toast-container {
    left: 16px;
    right: 16px;
    bottom: 16px;
    width: auto;
  }
}