/**
 * GradualPlus — global light / dark theme tokens
 * Applied via html.gp-theme-dark | html.gp-theme-light on layout/index.php
 */

html.gp-theme-dark,
html.dark {
  --gp-body-bg: radial-gradient(circle at top left, #0f172a 0, #020617 40%, #020617 100%);
  --gp-topbar-bg: linear-gradient(to right, rgba(15, 23, 42, 0.92), rgba(15, 23, 42, 0.88));
  --gp-topbar-border: rgba(15, 23, 42, 0.85);
  --gp-surface-input: rgba(2, 6, 23, 0.65);
  --gp-surface-muted: rgba(2, 6, 23, 0.35);
  --gp-surface-elevated: rgba(2, 6, 23, 0.55);
  --gp-surface-chip: rgba(2, 6, 23, 0.5);
  --gp-surface-hover: rgba(34, 211, 238, 0.05);
  --gp-surface-hover-strong: rgba(34, 211, 238, 0.08);
  --gp-card-bg: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(2, 6, 23, 0.99));
  --gp-card-ghost-bg: linear-gradient(135deg, rgba(15, 23, 42, 0.94), rgba(2, 6, 23, 0.98));
  --gp-card-solid: rgba(15, 23, 42, 0.95);
  --gp-card-border: rgba(148, 163, 184, 0.14);
  --gp-border-subtle: rgba(148, 163, 184, 0.12);
  --gp-border-medium: rgba(148, 163, 184, 0.25);
  --gp-dropdown-bg: #0f172a;
  --gp-icon-btn-bg: rgba(15, 23, 42, 0.92);
  --gp-kpi-value: #f9fafb;
  --gp-text-main: #e5e7eb;
  --gp-text-muted: #9ca3af;
  --gp-text-soft: #6b7280;
  --gp-shadow-subtle: 0 8px 22px rgba(15, 23, 42, 0.5);
  --gp-shadow-soft: 0 10px 40px rgba(15, 23, 42, 0.7);
  --gp-sidebar-bg: linear-gradient(180deg, #0c1222 0%, #070b14 100%);
  --gp-sidebar-border: rgba(148, 163, 184, 0.08);
  --gp-sidebar-text: #94a3b8;
  --gp-sidebar-text-active: #e2e8f0;
  --gp-sidebar-hover-bg: rgba(148, 163, 184, 0.08);
  --gp-sidebar-active-bg: rgba(34, 211, 238, 0.1);
  --gp-table-stripe: rgba(2, 6, 23, 0.25);
  --gp-surface-inset: rgba(2, 6, 23, 0.35);
  --gp-surface-tile: rgba(15, 23, 42, 0.4);
  --gp-control-bg: rgba(2, 6, 23, 0.5);
  --gp-control-border: rgba(148, 163, 184, 0.2);
  --gp-table-row-bg: transparent;
  --gp-table-hover-bg: #1a2d42;
  --gp-table-wrap-bg: rgba(2, 6, 23, 0.2);
  --gp-kpi-value-gradient: linear-gradient(135deg, #f1f5f9, #22d3ee);
}

html.gp-theme-light {
  --gp-body-bg: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  --gp-topbar-bg: rgba(255, 255, 255, 0.94);
  --gp-topbar-border: rgba(148, 163, 184, 0.22);
  --gp-surface-input: #ffffff;
  --gp-surface-muted: #f1f5f9;
  --gp-surface-elevated: #f8fafc;
  --gp-surface-chip: #f1f5f9;
  --gp-surface-hover: rgba(34, 211, 238, 0.06);
  --gp-surface-hover-strong: rgba(34, 211, 238, 0.1);
  --gp-card-bg: #ffffff;
  --gp-card-ghost-bg: #ffffff;
  --gp-card-solid: #ffffff;
  --gp-card-border: rgba(148, 163, 184, 0.22);
  --gp-border-subtle: rgba(148, 163, 184, 0.14);
  --gp-border-medium: rgba(148, 163, 184, 0.28);
  --gp-dropdown-bg: #ffffff;
  --gp-icon-btn-bg: #ffffff;
  --gp-kpi-value: #0f172a;
  --gp-text-main: #0f172a;
  --gp-text-muted: #475569;
  --gp-text-soft: #64748b;
  --gp-shadow-subtle: 0 4px 18px rgba(15, 23, 42, 0.08);
  --gp-shadow-soft: 0 10px 36px rgba(15, 23, 42, 0.1);
  --gp-sidebar-bg: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  --gp-sidebar-border: rgba(148, 163, 184, 0.22);
  --gp-sidebar-text: #64748b;
  --gp-sidebar-text-active: #0f172a;
  --gp-sidebar-hover-bg: rgba(148, 163, 184, 0.12);
  --gp-sidebar-active-bg: rgba(34, 211, 238, 0.12);
  --gp-table-stripe: #f8fafc;
  --gp-surface-inset: #f8fafc;
  --gp-surface-tile: #ffffff;
  --gp-control-bg: #ffffff;
  --gp-control-border: rgba(148, 163, 184, 0.28);
  --gp-table-row-bg: #ffffff;
  --gp-table-hover-bg: #ecfeff;
  --gp-table-wrap-bg: #ffffff;
  --gp-kpi-value-gradient: linear-gradient(135deg, #0f172a 0%, #0891b2 100%);
}

/* Light theme — settings theme picker cards */
html.gp-theme-light body.gp-app .thememenu-sy .theme-box .theme-img {
  border-color: rgba(148, 163, 184, 0.25);
  background: #fff;
}

html.gp-theme-light body.gp-app .tabs-custom .nav-tabs {
  border-bottom-color: var(--gp-border-subtle) !important;
}

html.gp-theme-light body.gp-app .tabs-custom .nav-tabs > li > a {
  color: var(--gp-text-soft) !important;
}

html.gp-theme-light body.gp-app .tabs-custom .nav-tabs > li.active > a {
  color: var(--gp-text-main) !important;
  background: var(--gp-surface-muted) !important;
}

html.gp-theme-light body.gp-app .tabs-custom .tab-content {
  background: var(--gp-card-solid) !important;
  color: var(--gp-text-main) !important;
}

/* Light theme — modals & legacy white-popup */
html.gp-theme-light body.gp-app .modal-content,
html.gp-theme-light body.gp-app .white-popup-block {
  background: #ffffff !important;
  color: var(--gp-text-main) !important;
  border-color: var(--gp-border-medium) !important;
}

html.gp-theme-light body.gp-app .modal-header,
html.gp-theme-light body.gp-app .modal-footer {
  border-color: var(--gp-border-subtle) !important;
  background: var(--gp-surface-muted) !important;
}

/* Dark theme — ensure html.dark legacy hooks stay aligned */
html.gp-theme-dark body.gp-app,
html.dark body.gp-app {
  color: var(--gp-text-main);
}

html.gp-theme-light body.gp-app {
  color: var(--gp-text-main);
}

html.gp-theme-light body.gp-app .gp-topbar__breadcrumb,
html.gp-theme-light body.gp-app .gp-topbar__title,
html.gp-theme-light body.gp-app .gp-page-header__title {
  color: var(--gp-text-main);
}

html.gp-theme-light body.gp-app .dataTables_wrapper .dataTables_info,
html.gp-theme-light body.gp-app .dataTables_wrapper .dataTables_length,
html.gp-theme-light body.gp-app .dataTables_wrapper .dataTables_filter {
  color: var(--gp-text-muted) !important;
}

html.gp-theme-light body.gp-app .pagination > li > a,
html.gp-theme-light body.gp-app .pagination > li > span {
  background: var(--gp-surface-input) !important;
  border-color: var(--gp-border-medium) !important;
  color: var(--gp-text-muted) !important;
}

html.gp-theme-light body.gp-app .pagination > .active > a,
html.gp-theme-light body.gp-app .pagination > .active > span {
  background: var(--gp-accent) !important;
  border-color: var(--gp-accent) !important;
  color: #0f172a !important;
}

/* ── Light theme — fix grey-on-white conflicts ── */
html.gp-theme-light body.gp-app .dt-buttons .btn,
html.gp-theme-light body.gp-app .dt-buttons .dt-button {
  background: var(--gp-control-bg) !important;
  border-color: var(--gp-control-border) !important;
  color: var(--gp-text-muted) !important;
}

html.gp-theme-light body.gp-app .dt-buttons .btn:hover,
html.gp-theme-light body.gp-app .dt-buttons .dt-button:hover {
  background: var(--gp-surface-hover-strong) !important;
  border-color: var(--gp-accent) !important;
  color: var(--gp-accent) !important;
}

html.gp-theme-light body.gp-app .dataTables_filter input,
html.gp-theme-light body.gp-app .dataTables_length select {
  background: var(--gp-control-bg) !important;
  border-color: var(--gp-control-border) !important;
  color: var(--gp-text-main) !important;
}

html.gp-theme-light body.gp-app .dataTables_wrapper .pagination > li > a,
html.gp-theme-light body.gp-app .dataTables_wrapper .pagination > li > span {
  background: var(--gp-control-bg) !important;
  border-color: var(--gp-control-border) !important;
  color: var(--gp-text-muted) !important;
}

html.gp-theme-light body.gp-app .dataTables_wrapper .pagination > .active > a {
  background: rgba(34, 211, 238, 0.15) !important;
  border-color: var(--gp-accent) !important;
  color: var(--gp-accent) !important;
}

html.gp-theme-light body.gp-app .table > tbody > tr > td,
html.gp-theme-light body.gp-app .table > tbody > tr > th,
html.gp-theme-light body.gp-app table.dataTable tbody td,
html.gp-theme-light body.gp-app table.dataTable tbody th {
  background: var(--gp-table-row-bg) !important;
}

html.gp-theme-light body.gp-app .table-striped > tbody > tr:nth-of-type(odd) > td,
html.gp-theme-light body.gp-app .table-striped > tbody > tr:nth-of-type(odd) > th {
  background: var(--gp-table-stripe) !important;
}

html.gp-theme-light body.gp-app .table-striped > tbody > tr:nth-of-type(even) > td,
html.gp-theme-light body.gp-app .table-striped > tbody > tr:nth-of-type(even) > th {
  background: var(--gp-table-row-bg) !important;
}

html.gp-theme-light body.gp-app table.dataTable.display tbody tr.odd > td,
html.gp-theme-light body.gp-app table.dataTable.stripe tbody tr.odd > td,
html.gp-theme-light body.gp-app table.dataTable.order-column tbody tr > .sorting_1,
html.gp-theme-light body.gp-app table.dataTable.display tbody tr > .sorting_1 {
  background: var(--gp-table-stripe) !important;
}

html.gp-theme-light body.gp-app table.dataTable.display tbody tr.even > td,
html.gp-theme-light body.gp-app table.dataTable.stripe tbody tr.even > td {
  background: var(--gp-table-row-bg) !important;
}

html.gp-theme-light body.gp-app table.dataTable.display tbody tr:hover > td,
html.gp-theme-light body.gp-app table.dataTable.hover tbody tr:hover > td {
  background: var(--gp-table-hover-bg) !important;
}

html.gp-theme-light body.gp-app .table-responsive {
  background: var(--gp-table-wrap-bg) !important;
  border-color: var(--gp-border-subtle) !important;
}

html.gp-theme-light body.gp-app .table .action a,
html.gp-theme-light body.gp-app .table td.action a,
html.gp-theme-light body.gp-app .table .actions a {
  background: var(--gp-control-bg) !important;
  border-color: var(--gp-control-border) !important;
  color: var(--gp-text-muted) !important;
}

html.gp-theme-light body.gp-app .btn-circle {
  background: var(--gp-control-bg) !important;
  border-color: var(--gp-control-border) !important;
  color: var(--gp-text-muted) !important;
}

html.gp-theme-light body.gp-app .gp-cashflow-stat {
  background: var(--gp-surface-tile) !important;
  border-color: var(--gp-border-subtle) !important;
}

html.gp-theme-light body.gp-app .gp-cashflow__chart-wrap {
  background: var(--gp-surface-inset) !important;
  border-color: var(--gp-border-subtle) !important;
}

html.gp-theme-light body.gp-app .gp-cashflow-empty__ring {
  border-color: rgba(148, 163, 184, 0.22) !important;
  box-shadow: inset 0 0 12px rgba(148, 163, 184, 0.08) !important;
}

html.gp-theme-light body.gp-app .gp-kpi__value {
  background: var(--gp-kpi-value-gradient) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}

html.gp-theme-light body.gp-app .gp-card--kpi {
  background: var(--gp-surface-inset) !important;
}

html.gp-theme-light body.gp-app .gp-birthday-item,
html.gp-theme-light body.gp-app .gp-birthday-empty {
  background: #ffffff !important;
  border-color: var(--gp-border-subtle) !important;
}

html.gp-theme-light body.gp-app .gp-birthday-empty {
  border-style: dashed !important;
  color: var(--gp-text-muted) !important;
}

html.gp-theme-light body.gp-app .gp-birthday-group__sub {
  color: var(--gp-text-muted) !important;
}

html.gp-theme-light body.gp-app .gp-birthday-widget__footer {
  background: var(--gp-surface-inset) !important;
  border-color: var(--gp-border-subtle) !important;
}

html.gp-theme-light body.gp-app .gp-calendar .fc-button,
html.gp-theme-light body.gp-app #event_calendar.gp-calendar .fc-toolbar .fc-button {
  background: var(--gp-control-bg) !important;
  border-color: var(--gp-control-border) !important;
  color: var(--gp-text-muted) !important;
}

html.gp-theme-light body.gp-app .gp-calendar .fc-button.fc-state-active,
html.gp-theme-light body.gp-app #event_calendar.gp-calendar .fc-toolbar .fc-button.fc-state-active {
  background: rgba(34, 211, 238, 0.12) !important;
  border-color: rgba(34, 211, 238, 0.35) !important;
  color: #0891b2 !important;
}

html.gp-theme-light body.gp-app .gp-calendar .fc-day-header {
  background: var(--gp-surface-inset) !important;
}

html.gp-theme-light body.gp-app .gp-calendar .fc-day {
  background: var(--gp-table-row-bg) !important;
}

html.gp-theme-light body.gp-app .gp-calendar .fc-day-number {
  color: var(--gp-text-main) !important;
}

html.gp-theme-light body.gp-app .gp-calendar .fc-other-month .fc-day-number {
  color: var(--gp-text-soft) !important;
  opacity: 0.55;
}

html.gp-theme-light body.gp-app .modal-content,
html.gp-theme-light body.gp-app .modal-block .panel {
  background: var(--gp-card-solid) !important;
  border-color: var(--gp-border-medium) !important;
  color: var(--gp-text-main) !important;
}

html.gp-theme-light body.gp-app .modal-header,
html.gp-theme-light body.gp-app .modal-footer {
  background: var(--gp-surface-muted) !important;
  border-color: var(--gp-border-subtle) !important;
}

html.gp-theme-light body.gp-app .progress {
  background: var(--gp-surface-muted) !important;
}

html.gp-theme-light body.gp-app .panel-custom,
html.gp-theme-light body.gp-app .panel-sp-custom {
  background: var(--gp-card-solid) !important;
  border-color: var(--gp-border-medium) !important;
}

html.gp-theme-light body.gp-app .swal2-popup {
  background: #ffffff !important;
  color: var(--gp-text-main) !important;
  border-color: var(--gp-border-medium) !important;
}

html.gp-theme-light body.gp-app .swal2-title {
  color: var(--gp-text-main) !important;
}

html.gp-theme-light body.gp-app .swal2-content,
html.gp-theme-light body.gp-app .swal2-html-container {
  color: var(--gp-text-muted) !important;
}

html.gp-theme-light body.gp-app .datepicker {
  background: #ffffff !important;
  border-color: var(--gp-control-border) !important;
  color: var(--gp-text-main) !important;
}

html.gp-theme-light body.gp-app .alert-success {
  color: #15803d !important;
}

html.gp-theme-light body.gp-app .alert-danger,
html.gp-theme-light body.gp-app .alert-error {
  color: #b91c1c !important;
}

html.gp-theme-light body.gp-app .alert-warning {
  color: #a16207 !important;
}

html.gp-theme-light body.gp-app .alert-info {
  color: #0e7490 !important;
}
