:root {
  color-scheme: light;
  --bg: #e8eeef;
  --surface: #ffffff;
  --surface2: #f2f6f6;
  --line: rgba(10, 43, 61, .16);
  --blue: #155f86;
  --cyan: #2b7898;
  --violet: #6f8190;
  --text: #092334;
  --muted: #61747e;
  --danger: #c63f48;
  --success: #167455;
  --radius: 14px;
}

body,
.panel-body,
.auth-body {
  background:
    linear-gradient(135deg, rgba(255,255,255,.68), transparent 34rem),
    linear-gradient(180deg, #edf2f2 0%, #e4ebec 100%);
  color: var(--text);
}

.sidebar {
  border-right: 0;
  background: #082333;
  box-shadow: 18px 0 50px rgba(6, 31, 45, .12);
}

.panel-brand {
  gap: .85rem;
  min-height: 62px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  border-radius: 0;
}

.panel-brand img,
.auth-brand img,
.mandatory-brand img {
  width: 50px;
  height: 50px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  background: #f4f7f6;
  object-fit: contain;
}

.panel-brand b { color: #fff; }
.panel-brand small { color: #89bdd2; }
.sidebar nav { gap: .18rem; }
.sidebar nav a {
  border-radius: 7px;
  color: #a9bdc7;
  font-weight: 650;
}
.sidebar nav a:hover,
.sidebar nav a.active {
  border-color: rgba(255,255,255,.11);
  background: rgba(255,255,255,.085);
  color: #fff;
}
.sidebar nav a.active { box-shadow: inset 3px 0 #62a8c4; }
.user-chip {
  border-color: rgba(255,255,255,.13);
  background: rgba(255,255,255,.045);
}
.user-chip > span { background: #dfecef; color: #123d53; }
.user-chip b { color: #fff; }
.sidebar-bottom form button { border-color: rgba(255,255,255,.16); color: #b7c9d0; }

.topbar {
  min-height: 66px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 250, 249, .88);
  box-shadow: 0 8px 30px rgba(13, 43, 58, .045);
}
.lang-links a { color: #506b78; }
.topbar-actions,
.theme-toggle {
  display: flex;
  align-items: center;
}
.topbar-actions { gap: 1rem; }
.theme-toggle {
  min-height: 34px;
  gap: .45rem;
  padding: .42rem .68rem;
  border: 1px solid rgba(18, 62, 83, .18);
  border-radius: 999px;
  background: #e5edef;
  color: #163f53;
  font-size: .68rem;
  font-weight: 800;
  cursor: pointer;
}
.theme-toggle:hover { border-color: rgba(21, 95, 134, .42); background: #dce8eb; }
.theme-toggle > span:first-child { color: #276f90; font-size: 1rem; line-height: 1; }
.panel-content { width: min(100% - 48px, 1260px); padding-top: 2.4rem; }
.page-heading h1 { color: #092334; }
.kicker { color: #39758f; }
.muted,
.page-heading p { color: var(--muted); }

.panel-card,
.stats-grid > div,
.auth-card,
.mandatory-card,
.customer-card,
.customer-info-grid section {
  border-color: var(--line);
  background: rgba(255,255,255,.92);
  color: var(--text);
  box-shadow: 0 16px 42px rgba(15, 46, 60, .07);
}
.stats-grid > div { border-radius: 12px; }
.stats-grid span { color: #0a3147; }
.panel-card h1,
.panel-card h2,
.panel-card h3 { color: #0a2b3d; }

input,
select,
textarea,
.search-form input,
.search-form select {
  border-color: rgba(18, 62, 83, .2);
  background: #f9fbfb;
  color: #092334;
}
input:focus,
select:focus,
textarea:focus {
  border-color: #4387a4;
  outline-color: rgba(35, 115, 151, .13);
}
label > span,
legend { color: #465f6c; }

.table-card,
table,
thead,
tbody,
tr,
td { background: transparent; color: #173446; }
th { color: #607783; }
th,
td { border-color: rgba(15, 57, 77, .12); }
td > a { color: #17698e; }
.activity-list > div { border-color: rgba(15, 57, 77, .12); }

.primary-button {
  background: #0d4f70;
  box-shadow: 0 10px 24px rgba(13, 79, 112, .18);
}
.secondary-button {
  border-color: rgba(18, 62, 83, .2);
  background: #eef4f5;
  color: #153d52;
}
.danger-button { border-color: rgba(178, 49, 60, .25); background: #fff1f2; color: #a62f3a; }
.status-pill { background: #e2f2eb; color: #17694f; }
.status-pill.disabled,
.status-pill.locked { background: #fae7e9; color: #a6323c; }

.panel-section-tabs,
.mailing-layout,
.contact-layout,
.withdrawal-layout,
.security-gate-layout,
.knowledge-layout {
  border-color: var(--line) !important;
  background: rgba(255,255,255,.74) !important;
  color: var(--text);
}
.panel-section-tabs a { color: #315b70; }
.panel-section-tabs a.active { background: #dbe9ed; color: #0b3f5a; }
.alert.error { background: #fff0f2; color: #a42f3a; }
.alert.success { background: #e9f6f1; color: #17694f; }

.auth-shell { padding: 34px 20px; }
.auth-card {
  border-radius: 18px;
  background: rgba(255,255,255,.95);
  box-shadow: 0 30px 90px rgba(14, 44, 59, .16);
}
.auth-brand { color: #0b2b3d; }
.auth-brand img { border-color: var(--line); }
.auth-card input { background: #f6f9f9; color: #092334; }
.auth-footer { color: #60747e; }

/* Legacy module surfaces translated from the former Services dark theme. */
.panel-modal {
  border-color: rgba(10, 43, 61, .2);
  background: #f8fbfb;
  color: var(--text);
  box-shadow: 0 34px 90px rgba(5, 28, 41, .26);
}
.panel-modal h1,
.panel-modal h2,
.panel-modal h3,
.panel-modal strong,
.panel-modal p { color: var(--text); }
.panel-modal small,
.panel-modal .muted { color: var(--muted); }
.modal-close { border-color: var(--line); background: #edf3f4; color: #365765; }
.contact-request-meta > div,
.reset-customer-grid > div,
.career-applicant-grid > div {
  border-color: var(--line);
  background: #fff;
}
.contact-message,
.temporary-password-box,
.emergency-box {
  border-color: var(--line);
  background: #edf3f4;
  color: var(--text);
}
.contact-request-modal textarea {
  border-color: rgba(18, 62, 83, .2);
  background: #fff;
  color: var(--text);
}
.contact-summary > div,
.diagnostic-card,
.download-card,
.tebex-sync-card,
.tebex-search,
.tebex-buyer-head {
  border-color: var(--line);
  background: rgba(255,255,255,.92);
  color: var(--text);
  box-shadow: 0 12px 30px rgba(15, 46, 60, .055);
}
.contact-entry { color: var(--text); }
.contact-entry:hover { background: #edf4f5; }
.contact-category,
.download-access span { color: #466474; }
.dashboard-security-download {
  border-color: rgba(21, 95, 134, .22);
  background: linear-gradient(105deg, #e6f0f3, #f5f8f8 62%, #e8e9f3);
  box-shadow: 0 14px 34px rgba(15, 46, 60, .08);
}
.dashboard-security-download:hover { border-color: rgba(21, 95, 134, .48); }
.dashboard-download-icon {
  border-color: rgba(21, 95, 134, .24);
  background: #0b2b3e;
  color: #8ad2ee;
}
.dashboard-download-copy strong { color: #0a2b3d; }
.dashboard-download-copy small { color: #287594; }
.dashboard-download-copy em { color: #5d7480; }
.dashboard-download-action { background: #dbe8ec; color: #174b64; }
.diagnostic-entry {
  border-color: rgba(21, 95, 134, .2);
  background: linear-gradient(105deg, #dcecf1, #ebedf6);
  color: var(--text);
  box-shadow: 0 12px 30px rgba(15, 46, 60, .06);
}
.diagnostic-entry small,
.diagnostic-card small,
.diagnostic-card p { color: var(--muted); }
.diagnostic-entry > strong { color: #17698e; }
.download-dropzone,
.download-role-grid label { background: #f4f8f8; }
.download-dropzone-icon { background: #e6eff1; color: #17698e; }
.download-info h2,
.download-dropzone b { color: var(--text); }
.gate-reveal {
  border-color: rgba(21, 95, 134, .28);
  background: #e7f0f3;
  box-shadow: 0 14px 34px rgba(15, 46, 60, .08);
}
.gate-reveal h2 { color: var(--text); }
.gate-reveal small { color: var(--muted); }
.gate-reveal > code,
.gate-reveal div code { background: #0a2839; color: #a5e4f7; }
.tebex-sync-card h2,
.tebex-buyer-head h2,
.tebex-search label { color: var(--text); }

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #252a2f;
  --surface: #343a40;
  --surface2: #3b4248;
  --line: rgba(221, 234, 239, .13);
  --text: #edf2f4;
  --muted: #aab6bc;
  --danger: #ff8189;
  --success: #70d5ac;
}
html[data-theme="dark"] body,
html[data-theme="dark"] .panel-body,
html[data-theme="dark"] .auth-body {
  background:
    linear-gradient(135deg, rgba(82, 102, 111, .14), transparent 35rem),
    linear-gradient(180deg, #2b3035 0%, #24292e 100%);
  color: var(--text);
}
html[data-theme="dark"] .topbar {
  border-color: var(--line);
  background: rgba(47, 53, 58, .92);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .12);
}
html[data-theme="dark"] .lang-links a { color: #b6c2c8; }
html[data-theme="dark"] .theme-toggle {
  border-color: rgba(224, 235, 240, .14);
  background: #41484e;
  color: #edf2f4;
}
html[data-theme="dark"] .theme-toggle:hover { background: #4a5258; }
html[data-theme="dark"] .theme-toggle > span:first-child { color: #77b8d2; }
html[data-theme="dark"] .page-heading h1,
html[data-theme="dark"] .panel-card h1,
html[data-theme="dark"] .panel-card h2,
html[data-theme="dark"] .panel-card h3,
html[data-theme="dark"] .auth-brand,
html[data-theme="dark"] .dashboard-download-copy strong,
html[data-theme="dark"] .download-info h2,
html[data-theme="dark"] .download-dropzone b,
html[data-theme="dark"] .gate-reveal h2,
html[data-theme="dark"] .tebex-sync-card h2,
html[data-theme="dark"] .tebex-buyer-head h2,
html[data-theme="dark"] .tebex-search label { color: #f0f4f5; }
html[data-theme="dark"] .kicker { color: #78b5ce; }
html[data-theme="dark"] .panel-content { color: #edf2f4; }
html[data-theme="dark"] .stats-grid span,
html[data-theme="dark"] .stats-grid b,
html[data-theme="dark"] .panel-card > h1,
html[data-theme="dark"] .panel-card > h2,
html[data-theme="dark"] .panel-card > h3,
html[data-theme="dark"] .panel-card article h1,
html[data-theme="dark"] .panel-card article h2,
html[data-theme="dark"] .panel-card article h3,
html[data-theme="dark"] .panel-card article b,
html[data-theme="dark"] .panel-card article strong,
html[data-theme="dark"] .activity-list p,
html[data-theme="dark"] .contact-request-meta strong,
html[data-theme="dark"] .reset-customer-grid strong,
html[data-theme="dark"] .career-applicant-grid strong,
html[data-theme="dark"] .contact-message p,
html[data-theme="dark"] .contact-message h3,
html[data-theme="dark"] .download-info h2,
html[data-theme="dark"] .download-dropzone b,
html[data-theme="dark"] .withdrawal-summary strong,
html[data-theme="dark"] .withdrawal-summary b { color: #f2f6f7; }
html[data-theme="dark"] .stats-grid small,
html[data-theme="dark"] .panel-card p,
html[data-theme="dark"] .panel-card small,
html[data-theme="dark"] .activity-list small,
html[data-theme="dark"] .contact-request-meta small,
html[data-theme="dark"] .reset-customer-grid small,
html[data-theme="dark"] .career-applicant-grid small,
html[data-theme="dark"] .download-info p { color: #b6c2c8; }
html[data-theme="dark"] .panel-card,
html[data-theme="dark"] .stats-grid > div,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .mandatory-card,
html[data-theme="dark"] .customer-card,
html[data-theme="dark"] .customer-info-grid section,
html[data-theme="dark"] .contact-summary > div,
html[data-theme="dark"] .diagnostic-card,
html[data-theme="dark"] .download-card,
html[data-theme="dark"] .tebex-sync-card,
html[data-theme="dark"] .tebex-search,
html[data-theme="dark"] .tebex-buyer-head {
  border-color: var(--line);
  background: rgba(53, 59, 65, .96);
  color: var(--text);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .13);
}
html[data-theme="dark"] .panel-section-tabs,
html[data-theme="dark"] .mailing-layout,
html[data-theme="dark"] .contact-layout,
html[data-theme="dark"] .withdrawal-layout,
html[data-theme="dark"] .security-gate-layout,
html[data-theme="dark"] .knowledge-layout {
  border-color: var(--line) !important;
  background: rgba(53, 59, 65, .9) !important;
  color: var(--text);
}
html[data-theme="dark"] .panel-section-tabs a { color: #bac8ce; }
html[data-theme="dark"] .panel-section-tabs a.active { background: #465159; color: #fff; }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .search-form input,
html[data-theme="dark"] .search-form select,
html[data-theme="dark"] .contact-request-modal textarea {
  border-color: rgba(224, 235, 240, .14);
  background: #2b3035;
  color: #edf2f4;
}
html[data-theme="dark"] label > span,
html[data-theme="dark"] legend,
html[data-theme="dark"] th { color: #b0bec5; }
html[data-theme="dark"] table,
html[data-theme="dark"] thead,
html[data-theme="dark"] tbody,
html[data-theme="dark"] tr,
html[data-theme="dark"] td { background: transparent; color: #e3eaed; }
html[data-theme="dark"] td > a { color: #83c5df; }
html[data-theme="dark"] .secondary-button { border-color: var(--line); background: #424a50; color: #eef3f5; }
html[data-theme="dark"] .panel-modal {
  border-color: rgba(224, 235, 240, .15);
  background: #353b41;
  color: var(--text);
  box-shadow: 0 34px 90px rgba(0, 0, 0, .38);
}
html[data-theme="dark"] .panel-modal h1,
html[data-theme="dark"] .panel-modal h2,
html[data-theme="dark"] .panel-modal h3,
html[data-theme="dark"] .panel-modal strong,
html[data-theme="dark"] .panel-modal p { color: #edf2f4; }
html[data-theme="dark"] .modal-close { border-color: var(--line); background: #42494f; color: #dbe5e9; }
html[data-theme="dark"] .contact-request-meta > div,
html[data-theme="dark"] .reset-customer-grid > div,
html[data-theme="dark"] .career-applicant-grid > div,
html[data-theme="dark"] .contact-message,
html[data-theme="dark"] .temporary-password-box,
html[data-theme="dark"] .emergency-box {
  border-color: var(--line);
  background: #2d3338;
  color: var(--text);
}
html[data-theme="dark"] .contact-entry:hover { background: #3e464c; }
html[data-theme="dark"] .contact-category,
html[data-theme="dark"] .download-access span { color: #c0ccd1; }
html[data-theme="dark"] .dashboard-security-download,
html[data-theme="dark"] .diagnostic-entry {
  border-color: rgba(112, 171, 196, .25);
  background: linear-gradient(105deg, #35434a, #3c4148 62%, #41404e);
  color: var(--text);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .14);
}
html[data-theme="dark"] .dashboard-download-copy em,
html[data-theme="dark"] .diagnostic-entry small,
html[data-theme="dark"] .diagnostic-card small,
html[data-theme="dark"] .diagnostic-card p { color: #aab7bd; }
html[data-theme="dark"] .dashboard-download-action { background: #48575f; color: #dcecf2; }
html[data-theme="dark"] .download-dropzone,
html[data-theme="dark"] .download-role-grid label,
html[data-theme="dark"] .gate-reveal { border-color: var(--line); background: #3d444a; }
html[data-theme="dark"] .download-dropzone-icon { background: #2b3439; color: #84c4dc; }
html[data-theme="dark"] .status-pill { background: rgba(74, 180, 139, .17); color: #92e1c1; }
html[data-theme="dark"] .status-pill.disabled,
html[data-theme="dark"] .status-pill.locked { background: rgba(224, 86, 96, .16); color: #ffadb3; }
html[data-theme="dark"] .alert.success { background: #30473f; color: #9be0c5; }
html[data-theme="dark"] .alert.error { background: #51353a; color: #ffb6bc; }

@media (max-width: 900px) {
  .sidebar { box-shadow: 0 12px 32px rgba(6,31,45,.15); }
  .panel-content { width: min(100% - 26px, 1260px); }
}
