/* ══════════════ MineMacro Dark Navy Theme ══════════════
   Loaded LAST — overrides the ice-blue/DeepSeek Light tokens and every
   hardcoded light surface shipped in styles.css / ui-refresh.css /
   ui-consistency.css / styles/*.css. Palette base: #0d1220 (dark navy). */

:root {
  color-scheme: dark;

  --bg-page: #0b111e;
  --bg-elev-1: rgba(16, 24, 40, 0.92);
  --bg-elev-2: #101828;
  --bg-0: #0b111e;
  --bg-1: #141d31;
  --bg-2: #101828;
  --bg-3: #16213a;
  --bg-hover: rgba(77, 107, 254, 0.16);

  --surface-0: rgba(20, 29, 49, 0.97);
  --surface-1: #141d31;
  --surface-2: #101828;

  --line: rgba(43, 58, 86, 0.85);
  --line-strong: rgba(96, 122, 220, 0.55);

  --text-0: #f2f6fd;
  --text-1: #cdd7e6;
  --text-2: #97a5bd;
  --text-muted: #6b7890;

  --accent: #4D6BFE;
  --accent-2: #6c85ff;
  --accent-glow: rgba(77, 107, 254, 0.35);
  --ds-ice: #9cc1e7;
  --ds-ice-pill: rgba(77, 107, 254, 0.14);

  --shadow-xl: 0 20px 40px -8px rgba(0, 0, 0, 0.55), 0 8px 16px -4px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.45), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 4px 20px rgba(77, 107, 254, 0.3);

  /* ── mm-* token family (authoritative dark tokens) ── */
  --mm-blue: #4D6BFE;
  --mm-blue-deep: #6c85ff;
  --mm-blue-soft: rgba(77, 107, 254, 0.14);
  --mm-navy: #141d31;
  --mm-text: #f2f6fd;
  --mm-text-soft: #cdd7e6;
  --mm-text-faint: #97a5bd;
  --mm-muted: #97a5bd;
  --mm-border: #2b3a56;
  --mm-border-strong: #3a4d73;
  --mm-surface: rgba(20, 29, 49, 0.97);
  --mm-surface-solid: #141d31;
  --mm-canvas: #0b111e;
  --mm-danger: #ef4444;
  --mm-danger-soft: rgba(239, 68, 68, 0.16);
  --mm-success: #10b981;
  --mm-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 22px rgba(0, 0, 0, 0.35);
  --mm-shadow-hover: 0 14px 34px rgba(0, 0, 0, 0.5);
  --bg-base: #0d1524;
  --bg-elevated: #141d31;
  --border: #2b3a56;
  --border-light: #2b3a56;
  --border-faint: #1d2942;
  --text-primary: #f2f6fd;
  --text-secondary: #cdd7e6;

  /* public shell (login/admin/status) */
  --public-bg: #0b111e;
  --public-surface: rgba(20, 29, 49, 0.9);
}

/* ── base surfaces ── */
body,
.shell {
  background: var(--bg-page) !important;
  color: var(--text-0);
}

.topbar {
  background: var(--bg-elev-1) !important;
  border-bottom: 1px solid var(--line) !important;
}

/* ── inputs ── */
input, select, textarea, .form-input {
  background: #0d1524 !important;
  border: 1px solid #2b3a56 !important;
  color: var(--text-0) !important;
  box-shadow: none !important;
}
input:focus, select:focus, textarea:focus, .form-input:focus {
  background: #101a30 !important;
  border-color: var(--line-strong) !important;
}
input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}

/* ── buttons ── */
.btn, .profile-bulk-btn, .profile-action-btn, .profile-create-btn {
  background: #16213a !important;
  border: 1px solid #2b3a56 !important;
  color: var(--text-0) !important;
}
.btn:hover:not(:disabled), .profile-bulk-btn:hover, .profile-action-btn:hover {
  background: #1b2846 !important;
}
.btn-light, .btn-outline {
  background: #16213a !important;
  border-color: #2b3a56 !important;
  color: var(--text-0) !important;
}
.btn-light:hover, .btn-outline:hover {
  background: #1b2846 !important;
}
.btn-primary, .btn-success {
  color: #ffffff !important;
}
.btn-warning {
  background: #2a2413 !important;
  border-color: #8a6d2f !important;
  color: #f5d8a7 !important;
}
.btn-warning:hover {
  background: #332b16 !important;
}
.actions-bar, .kc-actions-bar {
  background: rgba(11, 17, 30, 0.85) !important;
}
.actions-divider, .kc-actions-divider {
  background: #2b3a56 !important;
}

/* ── sidebar / nav ── */
.sidebar {
  background: rgba(11, 17, 30, 0.97) !important;
  border-right: 1px solid var(--line) !important;
}
.nav-item {
  color: var(--text-1);
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
}
.nav-item.active {
  background: rgba(77, 107, 254, 0.16) !important;
  color: var(--text-0) !important;
  box-shadow: inset 0 0 0 1px rgba(96, 122, 220, 0.45) !important;
}
.sidebar-toggle-btn {
  background: #16213a !important;
  color: var(--text-1);
}
.sidebar-close-btn {
  background: rgba(22, 33, 58, 0.9) !important;
  color: var(--text-1);
}
.sidebar-close-btn:hover {
  background: #1b2846 !important;
}

/* ── profile picker + dropdown ── */
.profile-picker-trigger,
.profile-dropdown,
.profile-dropdown .profile-bulk-actions,
.profile-create-btn {
  background: #101828 !important;
}
.profile-picker-trigger {
  border: 1px solid #2b3a56 !important;
  color: var(--text-0) !important;
}
.profile-dropdown,
.menu, .modal-card {
  background: rgba(13, 18, 32, 0.98) !important;
  border: 1px solid #2b3a56 !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55) !important;
}
.profile-dropdown-row {
  border-bottom: 1px solid #1d2942 !important;
}
.profile-dropdown-row.active {
  background: rgba(77, 107, 254, 0.14) !important;
}
.profile-dropdown-name {
  color: var(--text-0) !important;
}
.profile-action-btn.select {
  background: #10b981 !important;
  color: #04110b !important;
}
.profile-action-btn.delete {
  background: rgba(239, 68, 68, 0.16) !important;
  color: #ff9d9d !important;
}
.profile-bulk-actions {
  background: #0d1524 !important;
  border-bottom: 1px solid #1d2942 !important;
}
.profile-bulk-btn {
  background: #16213a !important;
  border: 1px solid #2b3a56 !important;
  color: var(--text-1) !important;
}
.profile-bulk-btn:hover {
  background: #1b2846 !important;
  border-color: #3a4d73 !important;
}
.profile-bulk-btn.danger {
  border-color: rgba(239, 68, 68, 0.4) !important;
  background: rgba(239, 68, 68, 0.1) !important;
  color: #ff9d9d !important;
}
.profile-create-btn {
  border: 1px solid var(--accent) !important;
  background: linear-gradient(135deg, rgba(77, 107, 254, 0.25) 0%, rgba(53, 87, 236, 0.35) 100%) !important;
  color: var(--text-0) !important;
}

/* ── dashboard cards & panes ── */
.dashboard-tab {
  background: #0d1524 !important;
  color: var(--text-2) !important;
}
.dashboard-tab.active {
  background: #16213a !important;
  color: var(--text-0) !important;
}
.dashboard-pill,
.status-pill,
.status-chip,
.logs-chip,
.builder-pill {
  background: #16213a !important;
  color: var(--text-0) !important;
  border: 1px solid #2b3a56 !important;
}
.dash-slot,
.dash-slot.empty,
.dash-mini-cmd-wrap {
  background: #0d1524 !important;
  border: 1px solid #2b3a56 !important;
}
.map-screenshot-btn {
  background: #16213a !important;
  border: 1px solid #2b3a56 !important;
  color: var(--text-1) !important;
}
.grid-account .tooltip,
.dashboard-account-tooltip {
  background: #16213a !important;
  color: var(--text-0) !important;
  border: 1px solid #2b3a56 !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5) !important;
}

/* ── dark shadows ── */
.node-card,
.grid-account,
.kc-stats-bar .card:hover,
.viewer-modal-container,
.builder-left, .builder-right {
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.45) !important;
}
.grid-account:hover {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55), 0 0 12px rgba(77, 107, 254, 0.18) !important;
}

/* ── lists / panels / tables ── */
.account-table,
.account-table-head,
.account-row {
  background: #101828 !important;
  color: var(--text-0) !important;
  border-color: var(--line) !important;
}
.account-table-head {
  background: #131d33 !important;
  color: var(--text-1) !important;
}
.account-row:hover {
  background: #16213a !important;
}
.account-row.active,
.account-row.selected {
  background: rgba(77, 107, 254, 0.18) !important;
}
.account-row .name {
  color: var(--text-0) !important;
}
.account-row .sub,
.account-row .muted-line {
  color: var(--text-2) !important;
}

.plugin-item,
.macro-item,
.proxy-row,
.schedule-item,
.team-item {
  background: #101828 !important;
  color: var(--text-0) !important;
  border: 1px solid var(--line) !important;
}
.plugin-item:hover,
.macro-item:hover,
.proxy-row:hover,
.schedule-item:hover,
.team-item:hover {
  background: #16213a !important;
}

.actions-bar,
.accounts-bulk-actions {
  background: #101828 !important;
  border-color: var(--line) !important;
  color: var(--text-0) !important;
}

.section-empty {
  background: #101828 !important;
  border-color: var(--line) !important;
  color: var(--text-2) !important;
}

.incident-item,
.notice-item,
.builder-preflight-summary,
.settings-guidance,
.settings-option {
  background: #101828 !important;
  color: var(--text-0) !important;
  border-color: var(--line) !important;
}

.public-status-page .glass-panel {
  background: rgba(16, 24, 40, 0.9) !important;
}

/* builder canvas dots — keep grid visible but dark */
.builder-canvas {
  background-color: #0b111e !important;
  background-image: radial-gradient(circle, rgba(122, 150, 220, 0.16) 1px, transparent 1px) !important;
}

/* ── viewer modal ── */
.viewer-modal-overlay {
  background: rgba(11, 17, 30, 0.85) !important;
}
.viewer-modal-container {
  background: #101828 !important;
  border: 1px solid #2b3a56 !important;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7) !important;
}
.viewer-modal-close-btn {
  background: #16213a !important;
  color: var(--text-0) !important;
  border: 1px solid #2b3a56 !important;
}
.viewer-modal-close-btn:hover {
  background: #233252 !important;
}

/* ── settings ── */
.settings-tab,
.settings-preset-btn,
.settings-chip {
  background: #101828 !important;
  color: var(--text-1) !important;
  border: 1px solid #2b3a56 !important;
}
.settings-tab.active,
.settings-preset-btn.active {
  background: #16213a !important;
  color: var(--text-0) !important;
  border-color: var(--accent) !important;
}
.settings-slot-cell {
  background: #0d1524 !important;
  border: 1px solid #2b3a56 !important;
  color: var(--text-2) !important;
}
.settings-risk-badge.info {
  color: #9bb5ff !important;
  background: rgba(77, 107, 254, 0.16) !important;
}
.settings-risk-badge.warn {
  color: #f5d8a7 !important;
  background: rgba(245, 158, 11, 0.16) !important;
}
.settings-risk-badge.danger {
  color: #ff9d9d !important;
  background: rgba(239, 68, 68, 0.16) !important;
}

/* misc light leftovers */
.add-account-footer {
  background: #141d31 !important;
  border-color: #2b3a56 !important;
}
.account-grid .bot-card {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03) !important;
}
input, select, textarea, .form-input {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03) !important;
}
.terminal-log, .logs-console, .chat-box {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
}
.brand-mark, .public-auth-mark, .btn-primary, .btn-success, .public-auth-submit {
  color: #ffffff;
}

/* simplified settings page — 2-column card grid */
.settings-simple {
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  align-items: start;
}
@media (max-width: 780px) {
  .settings-simple {
    grid-template-columns: 1fr;
  }
}

/* window tabs container */
.window-tabs {
  background: #0d1524 !important;
  border-color: #2b3a56 !important;
}

/* selected command type pill */
.command-type-item.active {
  background: #1b2846 !important;
  color: var(--text-0) !important;
}

/* section header subnav pills */
.workspace-subnav-button {
  background: transparent !important;
  color: var(--mm-text-soft) !important;
  border: 1px solid transparent !important;
}
.workspace-subnav-button:hover {
  background: rgba(77, 107, 254, 0.14) !important;
  color: var(--text-0) !important;
}
.workspace-subnav-button.active {
  background: var(--accent) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 10px rgba(77, 107, 254, 0.35) !important;
}

/* ── Universal fallback: eradicate any leftover hardcoded white backgrounds ── */
[style*="background: white" i],
[style*="background: #fff" i],
[style*="background:#fff" i],
[style*="background-color: white" i],
[style*="background-color: #fff" i],
[style*="background-color:#fff" i] {
  background: #101828 !important;
  color: #f2f6fd !important;
}
