body {
  line-height: 1.6;
  transition: background 0.3s ease, color 0.3s ease;
  background: var(--body-background);
  color:var(--text-color);
}

body[data-theme='dark'] {
  --body-background: linear-gradient(180deg, #080a0f 0%, #0f111c 100%);
  --text-color: #f5f6fa;
  --link-color: var(--fadeColor);
  --link-hover-color: #d1e1ff;
  --btn-bg: var(--mainColor);
  --btn-primary-bg: var(--mainColor);
  --btn-text-color: #ffffff;
  --btn-ghost-border: rgba(255, 255, 255, 0.25);
  --btn-text-variant: var(--fadeColor);
  --sidebar-bg: #0d1019;
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --sidebar-link-color: #aab2c8;
  --sidebar-link-active-bg: rgba(138, 180, 255, 0.16);
  --sidebar-link-active-color: #f5f6ff;
  --topbar-border: rgba(255, 255, 255, 0.06);
  --eyebrow-color: #8a92a6;
  --user-chip-bg: rgba(255, 255, 255, 0.08);
  --user-chip-subtext: #9fa6c0;
  --logout-color: #ff9f9f;
  --panel-bg: #121624;
  --panel-border: rgba(255, 255, 255, 0.06);
  --card-bg: #121525;
  --card-border: rgba(255, 255, 255, 0.06);
  --table-wrap-bg: #0f121c;
  --table-wrap-border: rgba(255, 255, 255, 0.06);
  --placeholder-border: rgba(255, 255, 255, 0.2);
  --placeholder-bg: rgba(255, 255, 255, 0.03);
  --placeholder-text: #9ea4bb;
  --section-bg: #101321;
  --section-border: rgba(255, 255, 255, 0.04);
  --field-label-color: #c0c5da;
  --input-bg: #0b0e18;
  --input-border: rgba(255, 255, 255, 0.12);
  --input-text: #ffffff;
  --table-border: rgba(255, 255, 255, 0.05);
  --table-header-color: #aeb7ce;
  --status-active-text: #7dffb2;
  --status-active-bg: rgba(125, 255, 178, 0.15);
  --status-inactive-text: #ff9f9f;
  --status-inactive-bg: rgba(255, 159, 159, 0.15);
  --muted-color: #8a92a6;
  --auth-card-bg: #151821;
  --auth-card-border: rgba(255, 255, 255, 0.08);
  --auth-input-bg: #0f1117;
  --auth-input-border: rgba(255, 255, 255, 0.15);
  --error-color: #ff8a8a;
  --toggle-border: rgba(255, 255, 255, 0.2);
  --toggle-bg: rgba(255, 255, 255, 0.08);
  --success-bg: rgba(125, 255, 178, 0.12);
  --success-text: #7dffb2;
  --error-bg: rgba(255, 138, 138, 0.12);
  --sidebar-active-bg:#032739;
}

body[data-theme='light'] {
  --body-background: linear-gradient(180deg, #f5f7fb 0%, #e2e8f0 100%);
  --text-color: #0f172a;
  --link-color: var(--mainColor);
  --link-hover-color: var(--darkenColor);
  --btn-bg: var(--mainColor);
  --btn-primary-bg: var(--mainColor);
  --btn-text-color: #ffffff;
  --btn-ghost-border: rgba(15, 23, 42, 0.2);
  --btn-text-variant: var(--darkenColor);
  --sidebar-bg: #ffffff;
  --sidebar-border: rgba(15, 23, 42, 0.08);
  --sidebar-link-color: #475569;
  --sidebar-link-active-bg: rgba(59, 130, 246, 0.12);
  --sidebar-link-active-color: #fff;
  --topbar-border: rgba(15, 23, 42, 0.08);
  --eyebrow-color: #64748b;
  --user-chip-bg: rgba(15, 23, 42, 0.06);
  --user-chip-subtext: #475569;
  --logout-color: #dc2626;
  --panel-bg: #f8fafc;
  --panel-border: rgba(15, 23, 42, 0.08);
  --card-bg: #ffffff;
  --card-border: rgba(15, 23, 42, 0.08);
  --table-wrap-bg: #ffffff;
  --table-wrap-border: rgba(15, 23, 42, 0.08);
  --placeholder-border: rgba(148, 163, 184, 0.4);
  --placeholder-bg: rgba(148, 163, 184, 0.08);
  --placeholder-text: #475569;
  --section-bg: #ffffff;
  --section-border: rgba(15, 23, 42, 0.08);
  --field-label-color: #475569;
  --input-bg: #ffffff;
  --input-border: rgba(148, 163, 184, 0.6);
  --input-text: #0f172a;
  --table-border: rgba(15, 23, 42, 0.08);
  --table-header-color: #1e293b;
  --status-active-text: #15803d;
  --status-active-bg: rgba(34, 197, 94, 0.15);
  --status-inactive-text: #dc2626;
  --status-inactive-bg: rgba(248, 113, 113, 0.2);
  --muted-color: #64748b;
  --auth-card-bg: #ffffff;
  --auth-card-border: rgba(15, 23, 42, 0.08);
  --auth-input-bg: #f8fafc;
  --auth-input-border: rgba(148, 163, 184, 0.6);
  --error-color: #dc2626;
  --toggle-border: rgba(148, 163, 184, 0.6);
  --toggle-bg: rgba(148, 163, 184, 0.2);
  --success-bg: rgba(34, 197, 94, 0.15);
  --success-text: #166534;
  --error-bg: rgba(248, 113, 113, 0.15);
  --sidebar-active-bg:#e2f3fc;
}

a {
  color: var(--link-color);
}

a:hover {
  color: var(--link-hover-color);
}

button,
.btn {
  background: var(--btn-bg);
  color: var(--btn-text-color);
  font-size: 0.95rem;
  align-content:center;
}

button:hover,
.btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn.text {
  background: transparent;
  padding: 0;
  color: var(--btn-text-variant);
}

.admin-shell {
  min-height: 100vh;
  display: flex;
}

.admin-sidebar {
  width: 220px;
  min-width: 220px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  padding:0px;
  display: flex;
  flex-direction: column;
  gap:0px;
  border-right: 1px solid var(--sidebar-border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;

}

.admin-sidebar .brand {
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.85rem;
  padding:10px 12px;
  border-bottom:1px solid var(--darkenColor);
}

.admin-sidebar .brand img.brand-logo {
  max-height:30px;
  vertical-align:middle;
  margin-right:10px;
}

.admin-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0px;
}

.admin-sidebar nav > * {border-bottom:1px solid var(--panel-border)}

.admin-sidebar nav .nav-group {
  padding:0;
  display: flex;
  flex-direction: column;
  gap: 0px;
}

.admin-sidebar nav .nav-group.active .nav-subitem.active {
  background: var(--darkenColor);
  color: var(--sidebar-link-active-color);
}

.admin-sidebar nav .nav-group .nav-group-links {display:none;}
.admin-sidebar nav .nav-group.active .nav-group-links {display:flex;}

.admin-sidebar nav .nav-group.active {background-color:var(--sidebar-active-bg);}

.admin-sidebar nav .nav-group.active .nav-group-label {
  color:var(--mainColor);
}

.nav-group-label {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-color);
  padding: 0 12px;
  position:relative;
}

nav > a img,.nav-group-label img {max-height:20px;vertical-align: middle;margin-right:7px;}

.nav-group-label:after {
  content:'\25BE';
  position:absolute;
  right:10px;
  top:calc(50% - 12px);
  transform:scaleX(1.6);
  opacity:.6;
}

.admin-sidebar nav .nav-group.active .nav-group-label:after {
  content:'\25B4'
}

.nav-group-links {
  display: flex;
  flex-direction: column;
  gap:0;
  padding-left: 8px;
  padding-bottom:8px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-sidebar .nav-group-links a {padding:0 12px;}

body[data-theme='light'] .nav-group-links {
  border-left: 1px solid rgba(15, 23, 42, 0.08);
}

.admin-sidebar nav a {
  padding:8px 12px;
  color: var(--sidebar-link-color);
  transition: background 0.2s ease, color 0.2s ease;
  display: block;
}

.admin-sidebar nav .nav-subitem {
  font-size: 0.85rem;
  border-radius: 8px 0 0 8px;
  padding-left: 20px;
}

.admin-sidebar nav a.active {
  background: var(--sidebar-active-bg);
  color: var(--darkenColor);
}

.admin-main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 32px;
  height:51px;
  border-bottom: 1px solid var(--darkenColor);
  background-color:var(--sidebar-bg)
}

.admin-topbar .eyebrow {
  display:none;
}

.admin-topbar h1 {
  margin: 0;
  font-size:24px;
}

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

.user-chip {
  background: var(--user-chip-bg);
  padding: 8px 12px;
  border-radius: 999px;
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
}

.user-chip small {
  color: var(--user-chip-subtext);
}

.logout-link {
  color: var(--logout-color);
}

.theme-toggle {
  border-radius: 999px;
  border: 1px solid var(--toggle-border);
  padding: 6px 14px;
  background: transparent;
  color: var(--text-color);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.theme-toggle:hover {
  background: var(--toggle-bg);
}

.admin-main {
  flex: 1;
  padding: 32px;
}

.board-toolbar {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 24px;
  border-radius: 18px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
}

.board-toolbar h2 {margin-top:0;}

.toolbar-actions {
  display: flex;
  gap: 12px;
}

.flash-message {
  margin: 16px 0;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 0.95rem;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.flash-message.success {
  background: var(--success-bg);
  color: var(--success-text);
}

.flash-message.error {
  background: var(--error-bg);
  color: var(--error-color);
}

.flash-message.fade-out {
  opacity: 0;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.card-grid article {
  padding: 20px;
  border-radius: 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
}

.card-grid article > h3 {margin-top:0;}

.card-grid strong {
  font-size: 2rem;
  display: block;
  margin: 8px 0 4px;
}

.board-table-wrap {
  margin-top: 20px;
  background: var(--table-wrap-bg);
  border-radius: 18px;
  border: 1px solid var(--table-wrap-border);
  overflow: hidden;
}

.placeholder-card {
  margin-top: 20px;
  padding: 24px;
  border-radius: 16px;
  border: 1px dashed var(--placeholder-border);
  background: var(--placeholder-bg);
  color: var(--placeholder-text);
}

.settings-form {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.settings-form section {
  padding: 24px;
  border-radius: 16px;
  background: var(--section-bg);
  border: 1px solid var(--section-border);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-heading .switch {
  margin-left: auto;
}

.meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--toggle-bg);
  border: 1px solid var(--toggle-border);
  color: var(--text-color);
  font-size: 0.85rem;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--text-color);
}

.switch input {
  display: none;
}

.switch .slider {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: var(--toggle-bg);
  border: 1px solid var(--toggle-border);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.switch .slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.switch input:checked + .slider {
  background: var(--btn-primary-bg);
  border-color: var(--btn-primary-bg);
}

.switch input:checked + .slider::after {
  transform: translateX(20px);
}

.settings-form details {
  padding: 24px;
  border-radius: 16px;
  background: var(--section-bg);
  border: 1px solid var(--section-border);
}

.settings-form details > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.settings-form details > summary::-webkit-details-marker {
  display: none;
}

.settings-form details > summary::after {
  content: "▾";
  color: var(--table-header-color);
  font-size: 1rem;
  line-height: 1.4;
  margin-top: 2px;
}

.settings-form details:not([open]) > summary::after {
  content: "▸";
}

.settings-form details[open] > summary {
  margin-bottom: 16px;
}

.settings-form details .section-heading {
  margin-bottom: 0;
}

.settings-form h3 {
  margin-top: 0;
}

.field-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

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

.token-row input[readonly] {
  flex: 1;
}

.field-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--field-label-color);
}

.field-grid label span {
  font-size: 0.9rem;
}

.field-grid input,
.field-grid select {
  border-radius: 10px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--input-text);
  padding: 10px 12px;
}

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

.field-grid label.toggle {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.field-grid label.toggle input[type='checkbox'] {
  width: 18px;
  height: 18px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.board-table {
  width: 100%;
  border-collapse: collapse;
}

.board-table th,
.board-table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--table-border);
  vertical-align: top;
}

.board-table th {
  text-align: left;
  font-weight: 600;
  color: var(--table-header-color);
}

.board-table tr:last-child th,
.board-table tr:last-child td {
  border-bottom: none;
}

.board-table input[type='checkbox'] {
  width: 16px;
  height: 16px;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.status {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status.active {
  color: var(--status-active-text);
  background: var(--status-active-bg);
}

.status.inactive {
  color: var(--status-inactive-text);
  background: var(--status-inactive-bg);
}

.muted {
  color: var(--muted-color);
  margin: 4px 0 0;
}

.auth-view {
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-main {
  width: 100%;
  padding: 60px 16px;
}

.auth-theme-toggle {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.auth-card {
  max-width: 420px;
  margin: 0 auto;
  padding: 32px;
  border-radius: 16px;
  background: var(--auth-card-bg);
  border: 1px solid var(--auth-card-border);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-card form {
  display: grid;
  gap: 12px;
}

.auth-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-card input {
  border-radius: 10px;
  border: 1px solid var(--auth-input-border);
  background: var(--auth-input-bg);
  color: var(--text-color);
  padding: 10px 12px;
}

.error {
  color: var(--error-color);
  margin: 0;
}

.text-success {
  color: var(--success-text);
}

.text-error {
  color: var(--error-color);
}

/* PG vendor tab styling */
.vendor-tabstrip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
  padding: 8px 10px;
  background: #eef2ff;
  border: 1px solid #d7deea;
  border-radius: 14px;
}
.vendor-tab {
  border: 1px solid #cbd5e0;
  background: #f8fafc;
  color: #0f172a;
  padding: 9px 16px;
  border-radius: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  position: relative;
  transition: all 0.12s ease;
}
.vendor-tab.active {
  background: var(--darkenColor);
  color: #fff;
  border-color: var(--darkenColor);
  box-shadow: 0 10px 20px rgba(29, 78, 216, 0.25);
}
.vendor-tab.default {
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25), 0 6px 14px rgba(34, 197, 94, 0.18);
  border-color: #22c55e;
}
.vendor-tab .badge-default {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #22c55e;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}
.pg-form {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}
