/*
 * SHENYU MAP · Codex-inspired interface theme
 *
 * This file intentionally sits after styles.css. It changes the visual system
 * while keeping every existing id, data attribute and interaction hook intact.
 */

.codex-ui {
  --bg: #181818;
  --bg2: #1b1b1b;
  --panel: #1d1d1d;
  --panel2: #232323;
  --sidebar: #1b222d;
  --sidebar-active: #2b3240;
  --surface: #222222;
  --surface-raised: #282828;
  --surface-hover: #2d2d2d;
  --line: #303030;
  --line2: #3a3a3a;
  --line-sidebar: #333b48;
  --text: #f1f1ef;
  --muted: #8f918d;
  --muted2: #b1b2ae;
  --accent: #8fb7ff;
  --accent-strong: #a9c8ff;
  --accent-soft: rgba(143, 183, 255, 0.12);
  --success: #73c8a9;
  --danger: #ff7b86;
  --shadow: rgba(0, 0, 0, 0.34);
  background: #181818;
  color: var(--text);
  color-scheme: dark;
  font-family: Inter, "SF Pro Text", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.codex-ui * {
  scrollbar-width: thin;
  scrollbar-color: #454545 transparent;
}

.codex-ui *::-webkit-scrollbar { width: 8px; height: 8px; }
.codex-ui *::-webkit-scrollbar-track { background: transparent; }
.codex-ui *::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: #484848;
  background-clip: padding-box;
}
.codex-ui *::-webkit-scrollbar-thumb:hover { background: #5a5a5a; background-clip: padding-box; }

.codex-ui button,
.codex-ui input,
.codex-ui select,
.codex-ui textarea { font-family: inherit; }

.codex-ui button { transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease, opacity 150ms ease, transform 150ms ease; }
.codex-ui button:active:not(:disabled) { transform: translateY(1px); }

.codex-ui :is(button, input, select, textarea):focus-visible {
  outline: 2px solid rgba(143, 183, 255, 0.72);
  outline-offset: 2px;
}

.codex-ui ::selection { background: rgba(143, 183, 255, 0.25); color: #fff; }

/* Authentication */
.codex-ui .auth-shell {
  grid-template-columns: minmax(0, 1.22fr) minmax(410px, 0.78fr);
  background: #181818;
}

.codex-ui .auth-visual {
  border-right: 1px solid #2c3037;
  background:
    radial-gradient(circle at 18% 100%, rgba(76, 105, 157, 0.14), transparent 34%),
    radial-gradient(circle at 88% 16%, rgba(91, 115, 163, 0.08), transparent 28%),
    linear-gradient(145deg, #1a212c 0%, #1b222e 52%, #191f29 100%);
}

.codex-ui .auth-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.32;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, transparent, #000 34%, #000 74%, transparent);
}

.codex-ui .auth-visual::after {
  width: 46vw;
  height: 46vw;
  right: -16vw;
  top: 13vh;
  border-color: rgba(181, 199, 229, 0.08);
  box-shadow: 0 0 0 72px rgba(181, 199, 229, 0.018), 0 0 0 144px rgba(181, 199, 229, 0.012);
}

.codex-ui .brand-lockup { gap: 11px; }
.codex-ui .brand-mark {
  width: 42px;
  height: 42px;
  border: 1px solid #4b5360;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: none;
  color: #f4f4f2;
  font-size: 14px;
  font-weight: 650;
}
.codex-ui .brand-title {
  color: #f2f2ef;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.09em;
}
.codex-ui .brand-sub { color: #888e96; font-size: 10px; }
.codex-ui .compact .brand-mark { width: 34px; height: 34px; border-radius: 9px; }
.codex-ui .compact .brand-title { font-size: 13px; }

.codex-ui .eyebrow {
  color: #8e98a8;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.16em;
}
.codex-ui .auth-copy h1 {
  max-width: 720px;
  margin: 16px 0 14px;
  color: #f4f4f1;
  font-size: clamp(34px, 3.1vw, 58px);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.2;
}
.codex-ui .auth-copy p { max-width: 640px; color: #a5a9ae; font-size: 14px; line-height: 1.8; }
.codex-ui .auth-grid { gap: 10px; }
.codex-ui .auth-feature {
  padding: 17px 18px;
  border-color: #353d49;
  border-radius: 13px;
  background: rgba(17, 21, 28, 0.34);
  backdrop-filter: blur(8px);
}
.codex-ui .auth-feature.cyan,
.codex-ui .auth-feature.violet,
.codex-ui .auth-feature.gold { border-top-color: #4a5361; }
.codex-ui .auth-feature strong { color: #e8e9e7; font-size: 13px; font-weight: 600; }
.codex-ui .auth-feature span { color: #868d96; font-size: 10px; }

.codex-ui .auth-card {
  position: relative;
  padding: clamp(48px, 8vw, 132px) clamp(44px, 5.5vw, 92px);
  background: #171717;
}
.codex-ui .auth-card::before {
  content: "账户空间";
  position: absolute;
  top: clamp(26px, 5vh, 58px);
  left: clamp(44px, 5.5vw, 92px);
  color: #666864;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.15em;
}
.codex-ui .auth-tabs {
  gap: 4px;
  margin-bottom: 26px;
  padding: 4px;
  border: 1px solid #303030;
  border-radius: 11px;
  background: #202020;
}
.codex-ui .tab {
  border: 0;
  border-radius: 8px;
  color: #8c8e8a;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
}
.codex-ui .tab:hover { color: #d5d5d1; background: #252525; }
.codex-ui .tab.active { border: 0; background: #343434; color: #f4f4f2; box-shadow: inset 0 0 0 1px #404040; }
.codex-ui .auth-form { gap: 10px; }
.codex-ui .auth-form label,
.codex-ui .contact-form label,
.codex-ui .todo-form label,
.codex-ui .level-config-row label,
.codex-ui .relationship-field label,
.codex-ui .feedback-field label { color: #a2a39f; font-size: 11px; font-weight: 500; }

.codex-ui :is(
  .auth-form input,
  .contact-form input,
  .contact-form select,
  .contact-form textarea,
  .todo-form input,
  .todo-form select,
  .todo-form textarea,
  .searchbox input,
  .level-config-row input,
  .relationship-field input,
  .feedback-field input,
  .feedback-field textarea,
  .friend-search-bar input,
  .chat-composer textarea
) {
  border: 1px solid #383838;
  border-radius: 10px;
  background: #202020;
  color: #f0f0ed;
  box-shadow: none;
}
.codex-ui :is(
  .auth-form input,
  .contact-form input,
  .contact-form select,
  .contact-form textarea,
  .todo-form input,
  .todo-form select,
  .todo-form textarea,
  .searchbox input,
  .level-config-row input,
  .relationship-field input,
  .feedback-field input,
  .feedback-field textarea,
  .friend-search-bar input,
  .chat-composer textarea
)::placeholder { color: #666864; }
.codex-ui :is(
  .auth-form input,
  .contact-form input,
  .contact-form select,
  .contact-form textarea,
  .todo-form input,
  .todo-form select,
  .todo-form textarea,
  .searchbox input,
  .level-config-row input,
  .relationship-field input,
  .feedback-field input,
  .feedback-field textarea,
  .friend-search-bar input,
  .chat-composer textarea
):focus {
  border-color: #6684b8;
  box-shadow: 0 0 0 3px rgba(143, 183, 255, 0.10);
  outline: none;
}

.codex-ui .primary,
.codex-ui .ghost,
.codex-ui .danger {
  min-height: 38px;
  border-radius: 9px;
  padding: 10px 14px;
  font-weight: 550;
  box-shadow: none;
}
.codex-ui .primary {
  border: 1px solid #e5e5e1;
  background: #e9e9e5;
  color: #1b1b1b;
}
.codex-ui .primary:hover { border-color: #fff; background: #f5f5f1; filter: none; }
.codex-ui .primary:disabled { opacity: 0.42; cursor: not-allowed; }
.codex-ui .ghost {
  border: 1px solid #393939;
  background: #222222;
  color: #b7b8b3;
}
.codex-ui .ghost:hover { border-color: #4d4d4d; background: #2b2b2b; color: #f0f0ed; }
.codex-ui .danger { border: 1px solid #63373b; background: #2c1d1f; color: #ff9ba3; }
.codex-ui .danger:hover { border-color: #845057; background: #3a2326; color: #ffc0c5; }
.codex-ui .small { min-height: 34px; padding: 8px 11px; font-size: 11px; }
.codex-ui .tiny { min-height: 30px; padding: 6px 9px; font-size: 10px; }
.codex-ui .form-note,
.codex-ui .modal-sub { color: #787a76; }
.codex-ui .security-note {
  border-color: #343434;
  border-radius: 10px;
  background: #1d1d1d;
  color: #8d8f8b;
}
.codex-ui .otp-heading {
  border-color: #3a3a3a;
  background: #202020;
}
.codex-ui .otp-heading small { color: #898b87; }
.codex-ui .otp-shield { border-color: #526b92; background: #252b35; color: #b8d0fb; }

/* Main application shell */
.codex-ui .app { min-height: 100vh; background: #181818; }
.codex-ui .topbar {
  height: 64px;
  padding: 0 16px;
  border-bottom: 1px solid #303030;
  background: rgba(25, 25, 25, 0.96);
  backdrop-filter: blur(18px);
}
.codex-ui .top-actions { gap: 7px; }
.codex-ui .user-chip,
.codex-ui .sync-badge {
  border-color: #393939;
  border-radius: 999px;
  background: #212121;
  color: #989a96;
  padding: 7px 10px;
  font-size: 10px;
}
.codex-ui .sync-badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: #8b8d89;
  vertical-align: 1px;
}
.codex-ui .sync-badge.online { border-color: #355147; background: #1e2925; color: #92c7b4; }
.codex-ui .sync-badge.online::before { background: #73c8a9; box-shadow: 0 0 0 3px rgba(115, 200, 169, 0.10); }

.codex-ui .dashboard {
  grid-template-rows: minmax(540px, calc(100vh - 132px)) auto;
  gap: 10px;
  padding: 10px;
  background: #181818;
}
.codex-ui .sidebar,
.codex-ui .map-panel,
.codex-ui .detail-panel {
  border: 1px solid #303030;
  border-radius: 14px;
  background: #1d1d1d;
  box-shadow: none;
}
.codex-ui .sidebar { padding: 14px; }
.codex-ui .left-panel { border-color: #303846; background: #1b222d; }
.codex-ui .map-panel { background: #191919; }
.codex-ui .right-panel { background: #1d1d1d; }
.codex-ui .section-title {
  color: #858983;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
}
.codex-ui .with-gap { margin-top: 20px; }
.codex-ui .text-btn { color: #9cb8e7; font-size: 10px; }
.codex-ui .text-btn:hover { color: #c7d9f7; }

/* Stats and navigation */
.codex-ui .stats { gap: 7px; margin-top: 10px; }
.codex-ui .stat-card {
  padding: 11px;
  border-color: #343c48;
  border-radius: 10px;
  background: rgba(15, 19, 25, 0.28);
}
.codex-ui .stat-card::before { display: none; }
.codex-ui .stat-card span { color: #858b93; font-size: 9px; }
.codex-ui .stat-card strong,
.codex-ui :is(.stat-cyan, .stat-violet, .stat-teal, .stat-gold) strong {
  margin-top: 4px;
  color: #ececea;
  font-size: 22px;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
}
.codex-ui .function-nav { gap: 5px; }
.codex-ui .function-nav-btn {
  min-height: 52px;
  border-color: transparent;
  border-radius: 10px;
  background: transparent;
  color: #a5a9b0;
  padding: 9px;
}
.codex-ui .function-nav-btn:hover { border-color: #333c49; background: rgba(255, 255, 255, 0.035); color: #ececea; }
.codex-ui .function-nav-btn.active {
  border-color: #3a4350;
  background: #2b3240;
  color: #f2f2f0;
  box-shadow: none;
}
.codex-ui .function-nav-icon {
  width: 29px;
  height: 29px;
  border-color: #3e4652;
  border-radius: 8px;
  background: rgba(10, 13, 18, 0.22);
  color: #aeb5bf;
  font-size: 13px;
}
.codex-ui .function-nav-btn.active .function-nav-icon { border-color: #596372; background: #343c49; color: #f5f5f2; }
.codex-ui .function-nav-btn strong { font-size: 11px; font-weight: 600; }
.codex-ui .function-nav-btn small,
.codex-ui .function-nav-btn.active small { color: #7c838e; }
.codex-ui .function-nav-count {
  border-color: #5d5340;
  background: #332e25;
  color: #ddc28e;
}
.codex-ui .filter-summary { color: #c6c8c5; }

/* Main content and map */
.codex-ui .panel-head { border-bottom: 1px solid #2d2d2d; }
.codex-ui .panel-head h2 { color: #f1f1ef; font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
.codex-ui .map-tip { color: #72746f; }
.codex-ui .map-canvas,
.codex-ui .map-fallback { background: #191919; }
.codex-ui .map-fallback { color: #777a76; }
.codex-ui .fallback-shape { border-color: #3b3b3b; background: radial-gradient(circle, #242424, #191919); }
.codex-ui .city-html-label {
  border-color: #444;
  border-radius: 6px;
  background: rgba(30, 30, 30, 0.88);
  color: #bbbcb8;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(8px);
}
.codex-ui .city-html-label:hover { border-color: #667b9e; background: #292d33; color: #fff; }
.codex-ui .city-html-label.covered { border-color: #4a7062; background: rgba(30, 48, 42, 0.92); color: #cceadd; }
.codex-ui .city-html-label b { color: #83c7ad; }

/* Contacts and filters */
.codex-ui .contacts-head .section-title { color: #a8aaa6; }
.codex-ui .muted { color: #757772; }
.codex-ui .searchbox { margin: 11px 0 9px; }
.codex-ui .searchbox input { padding: 10px 11px; }
.codex-ui .advanced-filter-wrap { margin-bottom: 9px; }
.codex-ui .advanced-filter-toggle {
  border-color: #363636;
  border-radius: 9px;
  background: #222;
  color: #999b97;
}
.codex-ui .advanced-filter-toggle:hover,
.codex-ui .advanced-filter-toggle.active { border-color: #4a4a4a; background: #292929; color: #e3e3df; }
.codex-ui .filter-count { background: #4b607f; color: #f0f4fa; }
.codex-ui .advanced-filter-panel {
  border-color: #383838;
  background: #202020;
  box-shadow: none;
}
.codex-ui .filter-panel-head strong { color: #dadbd7; }
.codex-ui .filter-group { border-top-color: #343434; }
.codex-ui .filter-group > span,
.codex-ui .filter-group-head > span { color: #898b87; }
.codex-ui .filter-chip {
  border-color: #3b3b3b;
  background: #252525;
  color: #979995;
}
.codex-ui .filter-chip:hover { border-color: #555; color: #e4e4e1; }
.codex-ui .filter-chip.active {
  border-color: #607da9;
  background: #293446;
  color: #dce8fb;
  box-shadow: none;
}
.codex-ui .contact-item {
  margin-bottom: 6px;
  padding: 11px;
  border-color: transparent;
  border-radius: 10px;
  background: #222;
}
.codex-ui .contact-item:hover { border-color: #404040; background: #282828; transform: none; }
.codex-ui .contact-item.active {
  border-color: #4a5669;
  background: #2b3039;
  box-shadow: none;
}
.codex-ui .contact-name { color: #eeeeeb; font-size: 12px; font-weight: 600; }
.codex-ui .contact-unit { color: #8c8e89; }
.codex-ui .contact-meta { color: #6f716d; }
.codex-ui .response-pill { border-color: #494949; background: #292929; }

/* Detail panel */
.codex-ui .detail-panel { background: #1d1d1d; }
.codex-ui .detail-bar { border-bottom-color: #303030; }
.codex-ui .detail-kicker { color: #7f93b5; }
.codex-ui .detail-bar strong { font-weight: 600; }
.codex-ui .detail-empty { color: #757772; }
.codex-ui .empty-icon { color: #697486; }
.codex-ui .person-identity h3 { font-weight: 600; }
.codex-ui .person-identity .loc { color: #858783; }
.codex-ui .detail-field,
.codex-ui .detail-field.unit-field { border-left-color: #363636; }
.codex-ui .detail-field span { color: #747671; }
.codex-ui .detail-field strong { color: #d9dad6; font-weight: 550; }

/* Modals and floating UI */
.codex-ui .modal,
.codex-ui .support-author-modal {
  background: rgba(5, 5, 5, 0.72);
  backdrop-filter: blur(10px);
}
.codex-ui .modal-card {
  border-color: #3c3c3c;
  border-radius: 18px;
  background: #202020;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.58);
}
.codex-ui .modal-head { padding-bottom: 14px; border-bottom: 1px solid #343434; }
.codex-ui .modal-head h3 { color: #f1f1ee; font-size: 18px; font-weight: 600; }
.codex-ui .icon-btn {
  border-color: #3c3c3c;
  border-radius: 9px;
  background: #272727;
  color: #a6a7a3;
}
.codex-ui .icon-btn:hover { border-color: #505050; background: #303030; color: #fff; }
.codex-ui .modal-actions { padding-top: 14px; border-top: 1px solid #343434; }
.codex-ui .level-config-row {
  border-color: #383838;
  background: #252525;
}
.codex-ui .icon-mini { border-color: #444; background: #2a2a2a; color: #aaa; }
.codex-ui .level-code { border-color: #4a4a4a; color: #d1d2ce; }
.codex-ui .relationship-pair {
  border-color: #3b3b3b;
  background: #252525;
}
.codex-ui .relationship-pair strong { color: #ededeb; font-weight: 600; }
.codex-ui .relationship-pair span { color: #c7ab79; text-shadow: none; }
.codex-ui .feedback-thumb { border-color: #3b3b3b; background: #252525; }
.codex-ui .feedback-thumb span { color: #858783; }
.codex-ui .feedback-status { border-color: #5a4b32; background: #2b271f; color: #d5bf98; }
.codex-ui .feedback-count { background: #252525; color: #737570; }
.codex-ui .feedback-support-row { border-top-color: #343434; }
.codex-ui .support-author-link { color: #777a75; }
.codex-ui .support-author-link:hover { background: #2a2a2a; color: #c9cac6; }
.codex-ui .support-qr-wrap { border-color: #444; box-shadow: 0 18px 45px rgba(0, 0, 0, 0.4); }
.codex-ui .support-author-copy strong { color: #e5e5e1; }
.codex-ui .support-author-copy span { color: #9a9c98; }
.codex-ui .support-author-copy small { color: #737570; }

.codex-ui #toast { top: 76px; right: 14px; }
.codex-ui .toast-item {
  border-color: #484848;
  border-radius: 11px;
  background: #2a2a2a;
  color: #e7e7e3;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
}

/* Todo workspace */
.codex-ui .todo-center { background: #191919; }
.codex-ui .todo-summary-card,
.codex-ui .todo-add-card {
  border-color: #353535;
  border-radius: 12px;
  background: #222;
}
.codex-ui .todo-summary-card span { color: #898b87; }
.codex-ui .todo-summary-card strong { color: #eeeeeb; font-weight: 550; }
.codex-ui .todo-summary-card small,
.codex-ui .todo-add-card small { color: #777974; }
.codex-ui .todo-add-card { border-color: #4a4a4a; }
.codex-ui .todo-add-card:hover { border-color: #67758a; background: #292c31; transform: none; }
.codex-ui .todo-add-card > span { background: #303641; color: #b9c9e2; }
.codex-ui .todo-add-card strong { color: #dadbd7; }
.codex-ui .todo-toolbar { border-bottom-color: #303030; }
.codex-ui .todo-tabs { border-color: #393939; background: #202020; }
.codex-ui .todo-tab { color: #858783; }
.codex-ui .todo-tab.active { background: #343434; color: #f0f0ed; }
.codex-ui .todo-view-hint { color: #72746f; }
.codex-ui .todo-card {
  border-color: #353535;
  background: #222;
}
.codex-ui .todo-card.is-overdue:not(.is-complete) { border-color: #633d42; box-shadow: inset 3px 0 0 #9c555e; }
.codex-ui .todo-card-head { border-bottom-color: #343434; }
.codex-ui .todo-title-row strong { color: #e8e8e5; font-weight: 600; }
.codex-ui .todo-type-pill,
.codex-ui .todo-date-pill,
.codex-ui .todo-repeat-pill { border-color: #474747; background: #292929; color: #aaa; }
.codex-ui .todo-card-note { color: #7d7f7a; }
.codex-ui .todo-progress small { color: #777974; }
.codex-ui .todo-contact-item {
  border-color: #383838;
  background: #272727;
  color: #bdbeba;
}
.codex-ui .todo-contact-item:hover { border-color: #505050; }
.codex-ui .todo-contact-check { border-color: #4e4e4e; background: #303030; }
.codex-ui .todo-contact-item.done .todo-contact-check { border-color: #4e7768; background: #263a33; color: #92d0b8; }
.codex-ui .todo-contact-info small,
.codex-ui .todo-card-status { color: #777974; }
.codex-ui .todo-edit-btn { border-color: #464646; background: #292929; color: #aeb0ab; }
.codex-ui .todo-edit-btn:hover { border-color: #5c5c5c; color: #efefec; }
.codex-ui .todo-empty { border-color: #3b3b3b; color: #787a76; }
.codex-ui .todo-empty strong { color: #b7b8b4; }
.codex-ui .todo-contact-picker { border-color: #383838; background: #242424; }
.codex-ui .todo-picker-head > div small { color: #787a76; }
.codex-ui .todo-contact-option { border-color: #383838; background: #292929; }
.codex-ui .todo-contact-option:hover { border-color: #4c4c4c; }
.codex-ui .todo-contact-option.selected { border-color: #617b9f; background: #2b3441; }
.codex-ui .todo-contact-option small { color: #777974; }
.codex-ui .todo-date-picker-btn { border-color: #444; background: #292929; color: #b3b4af !important; }
.codex-ui .todo-date-picker-btn:hover { border-color: #5a5a5a; background: #303030; color: #fff !important; }
.codex-ui .todo-date-help,
.codex-ui .todo-repeat-row small { color: #777974; }

/* Friends and chat */
.codex-ui .social-center { background: #191919; }
.codex-ui .social-id-card,
.codex-ui .social-email-setting,
.codex-ui .friend-search-bar {
  border-color: #353535;
  background: #222;
}
.codex-ui .social-id-card span,
.codex-ui .social-email-setting small,
.codex-ui .friend-search-bar small,
.codex-ui .social-id-card small { color: #7e807b; }
.codex-ui .social-id-card strong { color: #dce7f7; font-weight: 550; }
.codex-ui .social-email-setting strong,
.codex-ui .friend-search-bar > div strong { color: #d9dad6; }
.codex-ui .social-email-setting i { border-color: #464646; background: #303030; }
.codex-ui .social-email-setting i::after { background: #858783; }
.codex-ui .social-email-setting input:checked + i { border-color: #5a7398; background: #35445d; }
.codex-ui .social-email-setting input:checked + i::after { background: #c9dafa; box-shadow: none; }
.codex-ui .friend-search-result { border-color: #414141; background: #242424; }
.codex-ui .friend-avatar { border-color: #4e5e75; background: #303744; color: #c5d5ee; }
.codex-ui .friend-search-user > div small,
.codex-ui .friend-search-user > div em { color: #82847f; }
.codex-ui .social-workspace {
  border-color: #353535;
  background: #1d1d1d;
}
.codex-ui .social-list-pane { border-right-color: #343434; background: #202020; }
.codex-ui .social-list-head,
.codex-ui .friend-request-section,
.codex-ui .outgoing-requests { border-color: #343434; }
.codex-ui .social-list-head small,
.codex-ui .friend-request-title,
.codex-ui .outgoing-requests { color: #7d7f7a; }
.codex-ui .friend-request-title b { background: #3b4658; color: #d0def2; }
.codex-ui .friend-request-card { border-color: #3b3b3b; background: #272727; }
.codex-ui .friend-request-card small,
.codex-ui .outgoing-request-row small { color: #777974; }
.codex-ui .outgoing-request-row span { color: #a9aaa6; }
.codex-ui .friend-list-item:hover { border-color: #3c3c3c; background: #292929; }
.codex-ui .friend-list-item.active { border-color: #4c596b; background: #303641; }
.codex-ui .friend-list-copy strong { color: #dededb; }
.codex-ui .friend-list-copy small,
.codex-ui .friend-list-meta small { color: #787a76; }
.codex-ui .friend-list-meta b { background: #536985; }
.codex-ui .friend-list-empty { color: #7a7c77; }
.codex-ui .chat-pane { background: #1b1b1b; }
.codex-ui .chat-empty { color: #7d7f7a; }
.codex-ui .chat-empty-icon { border-color: #464646; background: #272727; color: #a9b9d0; }
.codex-ui .chat-empty strong { color: #bfc0bc; }
.codex-ui .chat-head,
.codex-ui .chat-composer { border-color: #343434; background: #202020; }
.codex-ui .chat-peer small { color: #7d7f7a; }
.codex-ui .chat-message-bubble {
  border-color: #3b3b3b;
  background: #292929;
  color: #e1e1de;
  box-shadow: none;
}
.codex-ui .chat-message-row.mine .chat-message-bubble { border-color: #52637c; background: #343d4a; }
.codex-ui .chat-message-meta { color: #858782; }
.codex-ui .chat-media-placeholder { background: #202020; color: #858782; }
.codex-ui .chat-attach-btn { border-color: #444; background: #292929; color: #afb1ac; }
.codex-ui .chat-attach-btn:hover { border-color: #5a5a5a; color: #fff; }
.codex-ui .chat-load-older { border-color: #454545; background: #252525; color: #a8aaa6; }
.codex-ui .chat-load-older:hover { border-color: #5a5a5a; color: #ecece9; }

/* Administration */
.codex-ui .metric-chip { border-color: #383838; background: #252525; }
.codex-ui .metric-chip span { color: #858783; }
.codex-ui .metric-chip.platform-metric:hover { border-color: #4d4d4d; background: #2a2a2a; transform: none; }
.codex-ui .metric-chip.platform-metric small { color: #777974; }
.codex-ui .metric-chip.platform-metric i { background: #343434; }
.codex-ui .metric-chip.platform-metric i b { background: #6b7f9e; box-shadow: none; }
.codex-ui .admin-section-head strong { color: #d9dad6; }
.codex-ui .admin-section-head span { color: #777974; }
.codex-ui .admin-table-wrap { border-color: #383838; }
.codex-ui .admin-table th,
.codex-ui .admin-table td { border-bottom-color: #343434; }
.codex-ui .admin-table th { background: #252525; color: #939590; }
.codex-ui .admin-table td { background: #202020; }
.codex-ui .table-sub { color: #777974; }
.codex-ui .session-pill { border-color: #464646; background: #292929; color: #959792; }
.codex-ui .session-pill.online { border-color: #4d7567; background: #263a33; color: #a2d4c1; }
.codex-ui .admin-switch-btn { border-color: #4c5e76; background: #2e3744; color: #c2d1e7; }
.codex-ui .admin-switch-btn:hover { background: #394454; color: #fff; }
.codex-ui .admin-switch-btn.current { border-color: #414141; background: #292929; color: #777974; }
.codex-ui .admin-ops-detail { border-color: #3c3c3c; background: #252525; box-shadow: none; }
.codex-ui .admin-ops-detail-head strong { color: #dadbd7; }
.codex-ui .ops-detail-close { color: #858783; }
.codex-ui .ops-detail-grid > div { border-color: #393939; background: #292929; }
.codex-ui .ops-detail-grid span,
.codex-ui .ops-detail-grid small,
.codex-ui .ops-detail-note { color: #787a76; }
.codex-ui .ops-detail-grid strong { color: #e4e4e1; }
.codex-ui .impersonation-banner {
  border-color: #66583b;
  background: #332d22;
  color: #d8c291;
  box-shadow: none;
}
.codex-ui .impersonation-exit { border-color: #685a3d; background: #2a261f; color: #ddc58e; }

/* Responsive refinements */
@media (max-width: 1050px) {
  .codex-ui .auth-shell { grid-template-columns: minmax(0, 1fr); }
  .codex-ui .auth-card {
    min-height: 100vh;
    align-items: stretch;
    padding: 18vh min(14vw, 120px) 10vh;
    background:
      radial-gradient(circle at 12% 0%, rgba(71, 91, 124, 0.12), transparent 32%),
      #181818;
  }
  .codex-ui .auth-card::before { top: 10vh; left: min(14vw, 120px); }
  .codex-ui .dashboard { grid-template-rows: auto auto auto; }
}

@media (max-width: 720px) {
  .codex-ui { font-size: 13px; }
  .codex-ui .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    padding: 9px 10px;
    gap: 8px;
  }
  .codex-ui .topbar .brand-lockup { min-width: 0; }
  .codex-ui .topbar .brand-title { white-space: nowrap; font-size: 11px; letter-spacing: 0.06em; }
  .codex-ui .topbar .brand-sub { display: none; }
  .codex-ui .topbar .compact .brand-mark { width: 32px; height: 32px; }
  .codex-ui .top-actions { flex-wrap: nowrap; gap: 4px; }
  .codex-ui #syncBadge,
  .codex-ui #currentUser { display: none; }
  .codex-ui .top-actions .small { min-height: 32px; padding: 7px 9px; }
  .codex-ui #addBtn { font-size: 0; }
  .codex-ui #addBtn::after { content: "＋ 联系人"; font-size: 10px; }
  .codex-ui #feedbackBtn,
  .codex-ui #logoutBtn { font-size: 10px; }
  .codex-ui .dashboard { padding: 7px; gap: 7px; }
  .codex-ui .sidebar,
  .codex-ui .map-panel,
  .codex-ui .detail-panel { border-radius: 12px; margin-bottom: 7px; }
  .codex-ui .left-panel { padding: 8px; }
  .codex-ui .function-nav { gap: 5px; }
  .codex-ui .function-nav-btn { min-height: 56px; border-color: #333b48; }
  .codex-ui .panel-head { padding-left: 14px; padding-right: 14px; }
  .codex-ui .modal { padding: 10px; }
  .codex-ui .modal-card { width: 100%; max-height: 94vh; border-radius: 16px; padding: 16px; }
  .codex-ui .modal-actions { position: sticky; bottom: -16px; margin-left: -16px; margin-right: -16px; padding: 12px 16px 16px; background: #202020; }
  .codex-ui .auth-card { padding: 18vh 8vw 8vh; }
  .codex-ui .auth-card::before { left: 8vw; }
  .codex-ui .social-list-pane { border-right: 0; border-bottom: 1px solid #343434; }
}

@media (prefers-reduced-motion: reduce) {
  .codex-ui *,
  .codex-ui *::before,
  .codex-ui *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Theme switcher: shared shell (the existing dark interface remains the default). */
.codex-ui .theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 34px;
  padding: 3px;
  border: 1px solid #3b3b3b;
  border-radius: 999px;
  background: #212121;
  color: #92948f;
  white-space: nowrap;
}

.codex-ui .theme-toggle:hover {
  border-color: #505050;
  background: #272727;
}

.codex-ui .theme-toggle .theme-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1;
}

.codex-ui .theme-toggle:not([aria-pressed="true"]) .theme-option:first-child {
  border-color: #494949;
  background: #343434;
  color: #f1f1ed;
}

.codex-ui .theme-toggle[aria-pressed="true"] .theme-option:last-child {
  border-color: #c9ac68;
  background: #f8efda;
  color: #8c611b;
}

/* Warm ivory / wine red / champagne gold light theme. */
html[data-theme="light"] .codex-ui {
  --bg: #f7f4ed;
  --bg2: #fbf9f5;
  --panel: #fffdfa;
  --panel2: #faf6ef;
  --sidebar: #fffaf1;
  --sidebar-active: #f8ecdf;
  --surface: #fffaf4;
  --surface-raised: #ffffff;
  --surface-hover: #f8f0e4;
  --line: #e7dece;
  --line2: #d8c7a9;
  --line-sidebar: #e3d5bd;
  --text: #2d2823;
  --muted: #82796d;
  --muted2: #655e55;
  --accent: #98283a;
  --accent-strong: #7e1727;
  --accent-soft: rgba(152, 40, 58, 0.09);
  --success: #477f69;
  --danger: #b43643;
  --shadow: rgba(86, 61, 31, 0.11);
  --tier-special: #a92135;
  --tier-level1: #bd8124;
  --tier-level2: #a86431;
  --tier-level3: #8a7151;
  background: #f7f4ed;
  color: var(--text);
  color-scheme: light;
}

html[data-theme="light"] { background: #f7f4ed; color-scheme: light; }

html[data-theme="light"] .codex-ui :is(input[type="checkbox"], input[type="radio"]) {
  accent-color: #98283a;
}

html[data-theme="light"] .codex-ui * {
  scrollbar-color: #cdbd9f transparent;
}

html[data-theme="light"] .codex-ui *::-webkit-scrollbar-thumb {
  background: #d3c3a6;
  background-clip: padding-box;
}

html[data-theme="light"] .codex-ui *::-webkit-scrollbar-thumb:hover {
  background: #bfa985;
  background-clip: padding-box;
}

html[data-theme="light"] .codex-ui :is(button, input, select, textarea):focus-visible {
  outline-color: rgba(152, 40, 58, 0.55);
}

html[data-theme="light"] .codex-ui ::selection {
  background: rgba(183, 147, 74, 0.26);
  color: #4e321c;
}

/* Authentication */
html[data-theme="light"] .codex-ui .auth-shell {
  background: #f7f4ed;
}

html[data-theme="light"] .codex-ui .auth-visual {
  border-right-color: #dfcfb2;
  background:
    radial-gradient(circle at 16% 98%, rgba(160, 38, 55, 0.10), transparent 34%),
    radial-gradient(circle at 86% 14%, rgba(183, 147, 74, 0.15), transparent 30%),
    linear-gradient(145deg, #fffaf1 0%, #f5ebda 56%, #f8f3e9 100%);
}

html[data-theme="light"] .codex-ui .auth-visual::before {
  opacity: 0.42;
  background-image:
    linear-gradient(rgba(150, 112, 48, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(150, 112, 48, 0.055) 1px, transparent 1px);
}

html[data-theme="light"] .codex-ui .auth-visual::after {
  border-color: rgba(154, 103, 30, 0.17);
  box-shadow: 0 0 0 72px rgba(183, 147, 74, 0.045), 0 0 0 144px rgba(183, 147, 74, 0.025);
}

html[data-theme="light"] .codex-ui .brand-mark {
  border-color: #c8a653;
  background: linear-gradient(145deg, #fffdf8, #f8edd5);
  color: #8e6219;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.75), 0 5px 14px rgba(139, 94, 25, 0.08);
}

html[data-theme="light"] .codex-ui .brand-title { color: #3b3026; }
html[data-theme="light"] .codex-ui .brand-sub { color: #8a7d6c; }
html[data-theme="light"] .codex-ui .eyebrow { color: #9a2336; }
html[data-theme="light"] .codex-ui .auth-copy h1 { color: #3a2c24; }
html[data-theme="light"] .codex-ui .auth-copy p { color: #786f64; }

html[data-theme="light"] .codex-ui .auth-feature {
  border-color: #dfcfb5;
  background: rgba(255, 253, 248, 0.72);
  box-shadow: 0 8px 24px rgba(105, 73, 34, 0.045);
}

html[data-theme="light"] .codex-ui .auth-feature.cyan,
html[data-theme="light"] .codex-ui .auth-feature.violet,
html[data-theme="light"] .codex-ui .auth-feature.gold { border-top-color: #bd9747; }
html[data-theme="light"] .codex-ui .auth-feature strong { color: #44382e; }
html[data-theme="light"] .codex-ui .auth-feature span { color: #857b6e; }

html[data-theme="light"] .codex-ui .auth-card {
  background: #fffdfa;
}

html[data-theme="light"] .codex-ui .auth-card::before { color: #a38f70; }

html[data-theme="light"] .codex-ui .auth-tabs {
  border-color: #e5dbc9;
  background: #f8f3eb;
}

html[data-theme="light"] .codex-ui .tab { color: #8a8176; }
html[data-theme="light"] .codex-ui .tab:hover { color: #762333; background: #f5e9e8; }
html[data-theme="light"] .codex-ui .tab.active {
  background: #fffdfa;
  color: #8c1d30;
  box-shadow: inset 0 0 0 1px #d7bd86, 0 2px 8px rgba(116, 74, 24, 0.06);
}

html[data-theme="light"] .codex-ui :is(
  .auth-form label, .contact-form label, .todo-form label, .level-config-row label,
  .relationship-field label, .feedback-field label
) { color: #766d62; }

html[data-theme="light"] .codex-ui :is(
  .auth-form input, .contact-form input, .contact-form select, .contact-form textarea,
  .todo-form input, .todo-form select, .todo-form textarea, .searchbox input,
  .level-config-row input, .relationship-field input, .feedback-field input,
  .feedback-field textarea, .friend-search-bar input, .chat-composer textarea
) {
  border-color: #ddd1bf;
  background: #fffdfa;
  color: #342d27;
}

html[data-theme="light"] .codex-ui :is(
  .auth-form input, .contact-form input, .contact-form select, .contact-form textarea,
  .todo-form input, .todo-form select, .todo-form textarea, .searchbox input,
  .level-config-row input, .relationship-field input, .feedback-field input,
  .feedback-field textarea, .friend-search-bar input, .chat-composer textarea
)::placeholder { color: #aaa094; }

html[data-theme="light"] .codex-ui :is(
  .auth-form input, .contact-form input, .contact-form select, .contact-form textarea,
  .todo-form input, .todo-form select, .todo-form textarea, .searchbox input,
  .level-config-row input, .relationship-field input, .feedback-field input,
  .feedback-field textarea, .friend-search-bar input, .chat-composer textarea
):focus {
  border-color: #ae3547;
  box-shadow: 0 0 0 3px rgba(152, 40, 58, 0.09);
}

html[data-theme="light"] .codex-ui .primary {
  border-color: #7e1727;
  background: #94263a;
  color: #fffaf3;
  box-shadow: 0 7px 18px rgba(142, 31, 50, 0.14);
}

html[data-theme="light"] .codex-ui .primary:hover {
  border-color: #67101f;
  background: #7f1b2d;
}

html[data-theme="light"] .codex-ui .ghost {
  border-color: #d8c49d;
  background: #fffdfa;
  color: #655a4c;
}

html[data-theme="light"] .codex-ui .ghost:hover {
  border-color: #bd984d;
  background: #fbf2df;
  color: #702232;
}

html[data-theme="light"] .codex-ui .danger {
  border-color: #dfb2b6;
  background: #fff0f0;
  color: #a52838;
}

html[data-theme="light"] .codex-ui .danger:hover {
  border-color: #c97880;
  background: #fbe3e4;
  color: #821827;
}

html[data-theme="light"] .codex-ui :is(.form-note, .modal-sub) { color: #887e72; }
html[data-theme="light"] .codex-ui .security-note {
  border-color: #e0d0b2;
  background: #faf4e7;
  color: #77664d;
}
html[data-theme="light"] .codex-ui .otp-heading { border-color: #dfc99e; background: #fbf4e7; }
html[data-theme="light"] .codex-ui .otp-heading small { color: #877b6d; }
html[data-theme="light"] .codex-ui .otp-shield { border-color: #b9903f; background: #fff8e9; color: #865d18; }

/* Application shell and gold-accented top bar */
html[data-theme="light"] .codex-ui .app,
html[data-theme="light"] .codex-ui .dashboard { background: #f7f4ed; }

html[data-theme="light"] .codex-ui .topbar {
  border-bottom: 2px solid #c6a45f;
  background: rgba(255, 253, 249, 0.97);
  box-shadow: 0 4px 18px rgba(103, 75, 37, 0.06);
}

html[data-theme="light"] .codex-ui .user-chip,
html[data-theme="light"] .codex-ui .sync-badge {
  border-color: #d8bf89;
  background: #fffaf1;
  color: #716452;
}

html[data-theme="light"] .codex-ui .user-chip::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: #b88b36;
  box-shadow: 0 0 0 3px rgba(184, 139, 54, 0.12);
  vertical-align: 1px;
}

html[data-theme="light"] .codex-ui .sync-badge::before { background: #a99982; }
html[data-theme="light"] .codex-ui .sync-badge.online {
  border-color: #a8cbbb;
  background: #f2faf6;
  color: #477b67;
}
html[data-theme="light"] .codex-ui .sync-badge.online::before { background: #4f9a7b; }

html[data-theme="light"] .codex-ui .top-actions .ghost {
  border-color: #d6bd88;
  background: #fffdf8;
  color: #665743;
}

html[data-theme="light"] .codex-ui .top-actions .ghost:hover {
  border-color: #b68b38;
  background: #fbf1dc;
  color: #7d2031;
}

html[data-theme="light"] .codex-ui #addBtn {
  border: 1px solid #c6a45f;
  background: #902237;
  color: #fffaf1;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.16), 0 4px 12px rgba(122, 26, 43, .13);
}

html[data-theme="light"] .codex-ui #addBtn:hover {
  border-color: #a98131;
  background: #781729;
}

html[data-theme="light"] .codex-ui .theme-toggle {
  border-color: #d7bd84;
  background: #fffaf1;
  color: #837766;
}

html[data-theme="light"] .codex-ui .theme-toggle:hover {
  border-color: #c19a4f;
  background: #fff7e7;
}

html[data-theme="light"] .codex-ui .theme-toggle .theme-option:first-child { color: #9b9082; }
html[data-theme="light"] .codex-ui .theme-toggle[aria-pressed="true"] .theme-option:last-child {
  border-color: #c4a057;
  background: #f6e7c7;
  color: #7c5415;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55);
}

html[data-theme="light"] .codex-ui .sidebar,
html[data-theme="light"] .codex-ui .map-panel,
html[data-theme="light"] .codex-ui .detail-panel {
  border-color: #e4dac8;
  background: #fffdfa;
  box-shadow: 0 10px 28px rgba(91, 63, 29, 0.055);
}

html[data-theme="light"] .codex-ui .left-panel {
  border-color: #dfd0b6;
  background: #fffaf1;
}

html[data-theme="light"] .codex-ui .map-panel { background: #fffdfa; }
html[data-theme="light"] .codex-ui .right-panel,
html[data-theme="light"] .codex-ui .detail-panel { background: #fffdfa; }
html[data-theme="light"] .codex-ui .section-title { color: #907c5d; }
html[data-theme="light"] .codex-ui .text-btn { color: #94263a; }
html[data-theme="light"] .codex-ui .text-btn:hover { color: #6e1424; }

/* Stats, navigation and level legend */
html[data-theme="light"] .codex-ui .stat-card {
  border-color: #e4d4b9;
  background: rgba(255, 253, 248, 0.9);
}
html[data-theme="light"] .codex-ui .stat-card span { color: #887d6d; }
html[data-theme="light"] .codex-ui .stat-card strong,
html[data-theme="light"] .codex-ui :is(.stat-cyan, .stat-violet, .stat-teal, .stat-gold) strong { color: #3d332a; }

html[data-theme="light"] .codex-ui .function-nav-btn { color: #756b5e; }
html[data-theme="light"] .codex-ui .function-nav-btn:hover {
  border-color: #dec99f;
  background: #fbf2e2;
  color: #6f1d2c;
}
html[data-theme="light"] .codex-ui .function-nav-btn.active {
  border-color: #c9a85f;
  background: linear-gradient(135deg, #f8e8df, #fbf2df);
  color: #7e1d2f;
}
html[data-theme="light"] .codex-ui .function-nav-icon {
  border-color: #d9c49b;
  background: #fffdf8;
  color: #98702d;
}
html[data-theme="light"] .codex-ui .function-nav-btn.active .function-nav-icon {
  border-color: #bb913d;
  background: #fff5df;
  color: #841e30;
}
html[data-theme="light"] .codex-ui .function-nav-btn small,
html[data-theme="light"] .codex-ui .function-nav-btn.active small { color: #928777; }
html[data-theme="light"] .codex-ui .function-nav-count {
  border-color: #d4b66f;
  background: #fbefd5;
  color: #855a17;
}
html[data-theme="light"] .codex-ui .filter-summary { color: #62594f; }

html[data-theme="light"] .codex-ui .legend-item { color: #7c7163; }
html[data-theme="light"] .codex-ui .legend-item:hover,
html[data-theme="light"] .codex-ui .legend-item.active {
  border-color: #d2b36e;
  background: #fbf1df;
  color: #792033;
}
html[data-theme="light"] .codex-ui .tier-mark.all {
  border-color: #b89040;
  color: #8a631f;
  background: #fff8e9;
}
html[data-theme="light"] .codex-ui .tier-mark.special,
html[data-theme="light"] .codex-ui .response-pill.special { background: rgba(169, 33, 53, .08); }
html[data-theme="light"] .codex-ui .tier-mark.level1,
html[data-theme="light"] .codex-ui .response-pill.level1 { background: rgba(189, 129, 36, .10); }
html[data-theme="light"] .codex-ui .tier-mark.level2,
html[data-theme="light"] .codex-ui .response-pill.level2 { background: rgba(168, 100, 49, .09); }
html[data-theme="light"] .codex-ui .tier-mark.level3,
html[data-theme="light"] .codex-ui .response-pill.level3 { background: rgba(138, 113, 81, .09); }

/* Map workspace and HTML labels */
html[data-theme="light"] .codex-ui .panel-head { border-bottom-color: #e7dece; }
html[data-theme="light"] .codex-ui .panel-head h2 { color: #332c26; }
html[data-theme="light"] .codex-ui .map-tip { color: #8c8173; }
html[data-theme="light"] .codex-ui .view-switch {
  border-color: #decda9;
  background: #faf4e9;
}
html[data-theme="light"] .codex-ui .switch-btn { color: #887c6d; }
html[data-theme="light"] .codex-ui .switch-btn:hover { color: #7a2231; background: #f8ebe8; }
html[data-theme="light"] .codex-ui .switch-btn.active {
  background: #92263a;
  color: #fffaf3;
}
html[data-theme="light"] .codex-ui .map-canvas,
html[data-theme="light"] .codex-ui .map-fallback { background: #fffdfa; }
html[data-theme="light"] .codex-ui .map-fallback { color: #8b8174; }
html[data-theme="light"] .codex-ui .fallback-shape {
  border-color: #d8c5a2;
  background: radial-gradient(circle, #fff9ec, #f7f2e9);
}
html[data-theme="light"] .codex-ui .city-html-label {
  border-color: rgba(184, 148, 78, .62);
  background: rgba(255, 253, 248, .92);
  color: #695c4a;
  box-shadow: 0 4px 12px rgba(92, 64, 31, .10);
}
html[data-theme="light"] .codex-ui .city-html-label:hover {
  border-color: #9b283a;
  background: #fff8ed;
  color: #7c1e30;
}
html[data-theme="light"] .codex-ui .city-html-label.covered {
  border-color: #b78f3f;
  background: rgba(251, 239, 211, .95);
  color: #6f4b15;
}
html[data-theme="light"] .codex-ui .city-html-label b { color: #98283a; }

/* Contacts and filters */
html[data-theme="light"] .codex-ui .contacts-head .section-title { color: #716658; }
html[data-theme="light"] .codex-ui .muted { color: #8b8174; }
html[data-theme="light"] .codex-ui .advanced-filter-toggle {
  border-color: #ded1bc;
  background: #faf6ef;
  color: #786e61;
}
html[data-theme="light"] .codex-ui .advanced-filter-toggle:hover,
html[data-theme="light"] .codex-ui .advanced-filter-toggle.active {
  border-color: #c8a55e;
  background: #fbf1df;
  color: #7f2132;
}
html[data-theme="light"] .codex-ui .filter-count { background: #98283a; color: #fffaf3; }
html[data-theme="light"] .codex-ui .advanced-filter-panel {
  border-color: #dfd1b9;
  background: #fffaf3;
}
html[data-theme="light"] .codex-ui .filter-panel-head strong { color: #4d4238; }
html[data-theme="light"] .codex-ui .filter-group { border-top-color: #eadfce; }
html[data-theme="light"] .codex-ui .filter-group > span,
html[data-theme="light"] .codex-ui .filter-group-head > span { color: #887d70; }
html[data-theme="light"] .codex-ui .filter-chip {
  border-color: #ded2c0;
  background: #fffdfa;
  color: #7c7266;
}
html[data-theme="light"] .codex-ui .filter-chip:hover { border-color: #c4a45e; color: #7b2031; }
html[data-theme="light"] .codex-ui .filter-chip.active {
  border-color: #a8394b;
  background: #f9e9e9;
  color: #841c2e;
}
html[data-theme="light"] .codex-ui .contact-item {
  border-color: #e8dfd1;
  background: #fffdfa;
}
html[data-theme="light"] .codex-ui .contact-item:hover {
  border-color: #d4b875;
  background: #fff9ef;
}
html[data-theme="light"] .codex-ui .contact-item.active {
  border-color: #a83a4c;
  background: linear-gradient(135deg, #faebea, #fff6e7);
}
html[data-theme="light"] .codex-ui .contact-name { color: #392f29; }
html[data-theme="light"] .codex-ui .contact-unit { color: #756c61; }
html[data-theme="light"] .codex-ui .contact-meta { color: #968b7c; }
html[data-theme="light"] .codex-ui .response-pill { border-color: currentColor; background: #fff9ee; }

/* Detail panel */
html[data-theme="light"] .codex-ui .detail-bar { border-bottom-color: #e5dac8; }
html[data-theme="light"] .codex-ui .detail-kicker { color: #9c293b; }
html[data-theme="light"] .codex-ui .detail-empty { color: #8e8477; }
html[data-theme="light"] .codex-ui .empty-icon { color: #b8944b; }
html[data-theme="light"] .codex-ui .person-identity h3 { color: #362e28; }
html[data-theme="light"] .codex-ui .person-identity .loc { color: #81776a; }
html[data-theme="light"] .codex-ui .detail-field,
html[data-theme="light"] .codex-ui .detail-field.unit-field { border-left-color: #e1d3bd; }
html[data-theme="light"] .codex-ui .detail-field span { color: #8d8274; }
html[data-theme="light"] .codex-ui .detail-field strong { color: #473d34; }

/* Modals, forms and floating UI */
html[data-theme="light"] .codex-ui .modal,
html[data-theme="light"] .codex-ui .support-author-modal {
  background: rgba(61, 44, 29, 0.35);
}
html[data-theme="light"] .codex-ui .modal-card {
  border-color: #dbc8a8;
  background: #fffdfa;
  box-shadow: 0 28px 90px rgba(71, 46, 20, 0.20);
}
html[data-theme="light"] .codex-ui .modal-head { border-bottom-color: #e8dece; }
html[data-theme="light"] .codex-ui .modal-head h3 { color: #382f28; }
html[data-theme="light"] .codex-ui .icon-btn {
  border-color: #dfd2bf;
  background: #faf6ef;
  color: #7c7164;
}
html[data-theme="light"] .codex-ui .icon-btn:hover {
  border-color: #bd984d;
  background: #fbf0dc;
  color: #7e1e30;
}
html[data-theme="light"] .codex-ui .modal-actions { border-top-color: #e7dcca; }
html[data-theme="light"] .codex-ui .level-config-row {
  border-color: #e2d5c2;
  background: #faf6ef;
}
html[data-theme="light"] .codex-ui .icon-mini { border-color: #d8c8ad; background: #fffdfa; color: #75695a; }
html[data-theme="light"] .codex-ui .level-code { border-color: #cfb77f; color: #6e604d; }
html[data-theme="light"] .codex-ui .level-code small { color: #958877; }
html[data-theme="light"] .codex-ui .relationship-pair {
  border-color: #dbc49a;
  background: linear-gradient(135deg, #fff6e8, #faeeee);
}
html[data-theme="light"] .codex-ui .relationship-pair strong { color: #44372e; }
html[data-theme="light"] .codex-ui .relationship-pair span { color: #a77b27; }
html[data-theme="light"] .codex-ui .relationship-field small { color: #8c8174; }
html[data-theme="light"] .codex-ui .feedback-thumb { border-color: #ded1bd; background: #faf6ef; }
html[data-theme="light"] .codex-ui .feedback-thumb span { color: #82776a; }
html[data-theme="light"] .codex-ui .feedback-status { border-color: #d5b873; background: #fbf1dc; color: #77551c; }
html[data-theme="light"] .codex-ui .feedback-count { background: #f2eadf; color: #887c6e; }
html[data-theme="light"] .codex-ui .feedback-support-row { border-top-color: #e5dac8; }
html[data-theme="light"] .codex-ui .feedback-entry { border-color: #d5bd8c; color: #735f42; }
html[data-theme="light"] .codex-ui .feedback-entry:hover { border-color: #a72d40; color: #7d1c2e; background: #f9e9e8; }
html[data-theme="light"] .codex-ui .support-author-link { color: #8c8173; }
html[data-theme="light"] .codex-ui .support-author-link:hover { background: #f7eee0; color: #8e2537; }
html[data-theme="light"] .codex-ui .support-qr-wrap { border-color: #c9aa68; box-shadow: 0 18px 45px rgba(90, 59, 23, 0.16); }
html[data-theme="light"] .codex-ui .support-author-copy strong { color: #453a31; }
html[data-theme="light"] .codex-ui .support-author-copy span { color: #7c7266; }
html[data-theme="light"] .codex-ui .support-author-copy small { color: #918678; }
html[data-theme="light"] .codex-ui .field-error { border-color: #b82d41 !important; box-shadow: 0 0 0 3px rgba(184, 45, 65, .09) !important; }
html[data-theme="light"] .codex-ui .loading-line { color: #8d8274; }

html[data-theme="light"] .codex-ui .toast-item {
  border-color: #d3b875;
  background: #fffaf0;
  color: #493d32;
  box-shadow: 0 14px 34px rgba(86, 58, 25, 0.14);
}

/* Todo workspace */
html[data-theme="light"] .codex-ui .todo-center { background: #fffdfa; }
html[data-theme="light"] .codex-ui .todo-summary-card,
html[data-theme="light"] .codex-ui .todo-add-card {
  border-color: #e2d5c2;
  background: #faf6ef;
}
html[data-theme="light"] .codex-ui .todo-summary-card span { color: #84796c; }
html[data-theme="light"] .codex-ui .todo-summary-card strong { color: #3d332c; }
html[data-theme="light"] .codex-ui .todo-summary-card small,
html[data-theme="light"] .codex-ui .todo-add-card small { color: #918678; }
html[data-theme="light"] .codex-ui .todo-add-card { border-color: #cdb078; }
html[data-theme="light"] .codex-ui .todo-add-card:hover { border-color: #a98336; background: #fff5e1; }
html[data-theme="light"] .codex-ui .todo-add-card > span { background: #f5e3bd; color: #8b5e17; }
html[data-theme="light"] .codex-ui .todo-add-card strong { color: #6f2030; }
html[data-theme="light"] .codex-ui .todo-toolbar { border-bottom-color: #e6dccd; }
html[data-theme="light"] .codex-ui .todo-tabs { border-color: #ded0b7; background: #faf5ec; }
html[data-theme="light"] .codex-ui .todo-tab { color: #8a8073; }
html[data-theme="light"] .codex-ui .todo-tab.active { background: #93263a; color: #fffaf3; }
html[data-theme="light"] .codex-ui .todo-view-hint { color: #928778; }
html[data-theme="light"] .codex-ui .todo-card { border-color: #e1d5c3; background: #fffdfa; }
html[data-theme="light"] .codex-ui .todo-card.is-overdue:not(.is-complete) { border-color: #d8959d; box-shadow: inset 3px 0 0 #b84351; }
html[data-theme="light"] .codex-ui .todo-card-head { border-bottom-color: #e8dece; }
html[data-theme="light"] .codex-ui .todo-title-row strong { color: #3f352e; }
html[data-theme="light"] .codex-ui .todo-type-pill,
html[data-theme="light"] .codex-ui .todo-date-pill,
html[data-theme="light"] .codex-ui .todo-repeat-pill {
  border-color: #d5c19a;
  background: #faf2e3;
  color: #7c6541;
}
html[data-theme="light"] .codex-ui .todo-date-pill.overdue { border-color: #d99ba2; color: #a52d3c; background: #fbe9ea; }
html[data-theme="light"] .codex-ui .todo-repeat-pill { border-color: #d1b36c; color: #7f5a1c; background: #fbf1d9; }
html[data-theme="light"] .codex-ui .todo-card-note,
html[data-theme="light"] .codex-ui .todo-progress small { color: #8d8274; }
html[data-theme="light"] .codex-ui .todo-contact-item { border-color: #e1d5c4; background: #faf7f1; color: #645a50; }
html[data-theme="light"] .codex-ui .todo-contact-item:hover { border-color: #c8aa68; }
html[data-theme="light"] .codex-ui .todo-contact-check { border-color: #ccb98f; background: #fffdfa; }
html[data-theme="light"] .codex-ui .todo-contact-item.done .todo-contact-check { border-color: #7aab96; background: #edf8f3; color: #3f8066; }
html[data-theme="light"] .codex-ui .todo-contact-info small,
html[data-theme="light"] .codex-ui .todo-card-status { color: #918678; }
html[data-theme="light"] .codex-ui .todo-edit-btn { border-color: #d0b77d; background: #fff8e9; color: #795820; }
html[data-theme="light"] .codex-ui .todo-edit-btn:hover { border-color: #a77d2e; color: #7c2030; }
html[data-theme="light"] .codex-ui .todo-empty { border-color: #d9c7a6; color: #8f8477; }
html[data-theme="light"] .codex-ui .todo-empty strong { color: #65594e; }
html[data-theme="light"] .codex-ui .todo-contact-picker { border-color: #dfd1ba; background: #faf6ef; }
html[data-theme="light"] .codex-ui .todo-picker-head > div small { color: #8e8375; }
html[data-theme="light"] .codex-ui .todo-contact-option { border-color: #e0d3c0; background: #fffdfa; }
html[data-theme="light"] .codex-ui .todo-contact-option:hover { border-color: #c5a55d; }
html[data-theme="light"] .codex-ui .todo-contact-option.selected { border-color: #a83649; background: #fae9e9; }
html[data-theme="light"] .codex-ui .todo-contact-option small { color: #8f8476; }
html[data-theme="light"] .codex-ui .todo-date-picker-btn { border-color: #d0b675; background: #fff7e6; color: #7e5b20 !important; }
html[data-theme="light"] .codex-ui .todo-date-picker-btn:hover { border-color: #a88133; background: #faedcf; color: #7c1e2f !important; }
html[data-theme="light"] .codex-ui .todo-date-help,
html[data-theme="light"] .codex-ui .todo-repeat-row small { color: #8d8274; }

/* Friends and chat */
html[data-theme="light"] .codex-ui .social-center { background: #fffdfa; }
html[data-theme="light"] .codex-ui .social-id-card,
html[data-theme="light"] .codex-ui .social-email-setting,
html[data-theme="light"] .codex-ui .friend-search-bar {
  border-color: #e1d4bf;
  background: #faf6ef;
}
html[data-theme="light"] .codex-ui .social-id-card span,
html[data-theme="light"] .codex-ui .social-email-setting small,
html[data-theme="light"] .codex-ui .friend-search-bar small,
html[data-theme="light"] .codex-ui .social-id-card small { color: #8c8174; }
html[data-theme="light"] .codex-ui .social-id-card strong { color: #91263a; }
html[data-theme="light"] .codex-ui .social-email-setting strong,
html[data-theme="light"] .codex-ui .friend-search-bar > div strong { color: #453a32; }
html[data-theme="light"] .codex-ui .social-email-setting i { border-color: #d2c2a5; background: #ebe2d5; }
html[data-theme="light"] .codex-ui .social-email-setting i::after { background: #a69b8e; }
html[data-theme="light"] .codex-ui .social-email-setting input:checked + i { border-color: #aa3547; background: #f0d5d8; }
html[data-theme="light"] .codex-ui .social-email-setting input:checked + i::after { background: #92263a; }
html[data-theme="light"] .codex-ui .friend-search-result { border-color: #dccbab; background: #fff9ee; }
html[data-theme="light"] .codex-ui .friend-avatar { border-color: #c5a153; background: #fff4dc; color: #8a5f1a; }
html[data-theme="light"] .codex-ui .friend-search-user > div small,
html[data-theme="light"] .codex-ui .friend-search-user > div em { color: #897e70; }
html[data-theme="light"] .codex-ui .social-workspace { border-color: #e0d3be; background: #fffdfa; }
html[data-theme="light"] .codex-ui .social-list-pane { border-right-color: #e5dac8; background: #faf6ef; }
html[data-theme="light"] .codex-ui .social-list-head,
html[data-theme="light"] .codex-ui .friend-request-section,
html[data-theme="light"] .codex-ui .outgoing-requests { border-color: #e5dac8; }
html[data-theme="light"] .codex-ui .social-list-head small,
html[data-theme="light"] .codex-ui .friend-request-title,
html[data-theme="light"] .codex-ui .outgoing-requests { color: #8b8072; }
html[data-theme="light"] .codex-ui .friend-request-title b { background: #eedfe0; color: #8f2336; }
html[data-theme="light"] .codex-ui .friend-request-card { border-color: #e0d2be; background: #fffdfa; }
html[data-theme="light"] .codex-ui .friend-request-card small,
html[data-theme="light"] .codex-ui .outgoing-request-row small { color: #8d8275; }
html[data-theme="light"] .codex-ui .outgoing-request-row span { color: #665c51; }
html[data-theme="light"] .codex-ui .friend-list-item:hover { border-color: #dfcfb3; background: #fff7e9; }
html[data-theme="light"] .codex-ui .friend-list-item.active { border-color: #a83a4c; background: #fae9e9; }
html[data-theme="light"] .codex-ui .friend-list-copy strong { color: #433930; }
html[data-theme="light"] .codex-ui .friend-list-copy small,
html[data-theme="light"] .codex-ui .friend-list-meta small { color: #8d8275; }
html[data-theme="light"] .codex-ui .friend-list-meta b { background: #92263a; }
html[data-theme="light"] .codex-ui .friend-list-empty { color: #8d8275; }
html[data-theme="light"] .codex-ui .chat-pane { background: #fffdfa; }
html[data-theme="light"] .codex-ui .chat-empty { color: #8b8073; }
html[data-theme="light"] .codex-ui .chat-empty-icon { border-color: #d1b570; background: #fff5df; color: #8c631d; }
html[data-theme="light"] .codex-ui .chat-empty strong { color: #655a4e; }
html[data-theme="light"] .codex-ui .chat-no-messages { color: #918678; }
html[data-theme="light"] .codex-ui .chat-head,
html[data-theme="light"] .codex-ui .chat-composer { border-color: #e4d9c8; background: #faf6ef; }
html[data-theme="light"] .codex-ui .chat-peer small { color: #8c8174; }
html[data-theme="light"] .codex-ui .chat-message-bubble { border-color: #e0d4c2; background: #faf6ef; color: #453b32; }
html[data-theme="light"] .codex-ui .chat-message-row.mine .chat-message-bubble { border-color: #b45b68; background: #f6e2e4; color: #641a29; }
html[data-theme="light"] .codex-ui .chat-message-meta { color: #918678; }
html[data-theme="light"] .codex-ui .chat-media-placeholder { background: #f3ede4; color: #8b8174; }
html[data-theme="light"] .codex-ui .chat-attach-btn { border-color: #d1b77e; background: #fff7e6; color: #765820; }
html[data-theme="light"] .codex-ui .chat-attach-btn:hover { border-color: #aa8031; color: #7e1f30; }
html[data-theme="light"] .codex-ui .chat-load-older { border-color: #d6c39e; background: #faf5ec; color: #786d60; }
html[data-theme="light"] .codex-ui .chat-load-older:hover { border-color: #b78d3c; color: #7e2132; }

/* Administration */
html[data-theme="light"] .codex-ui .metric-chip { border-color: #e0d2bc; background: #faf6ef; }
html[data-theme="light"] .codex-ui .metric-chip span { color: #877c6f; }
html[data-theme="light"] .codex-ui .metric-chip.platform-metric:hover { border-color: #c8aa68; background: #fff6e3; }
html[data-theme="light"] .codex-ui .metric-chip.platform-metric small { color: #8f8476; }
html[data-theme="light"] .codex-ui .metric-chip.platform-metric i { background: #eadfce; }
html[data-theme="light"] .codex-ui .metric-chip.platform-metric i b { background: #9b283b; }
html[data-theme="light"] .codex-ui .metric-chip.platform-metric.warn strong { color: #94651e; }
html[data-theme="light"] .codex-ui .metric-chip.platform-metric.danger strong,
html[data-theme="light"] .codex-ui .metric-chip.platform-metric.capacity strong { color: #98283a; }
html[data-theme="light"] .codex-ui .metric-chip.platform-metric.warn i b { background: #c29238; }
html[data-theme="light"] .codex-ui .metric-chip.platform-metric.danger i b,
html[data-theme="light"] .codex-ui .metric-chip.platform-metric.capacity i b { background: #a92c40; }
html[data-theme="light"] .codex-ui .admin-section-head strong { color: #4a3f36; }
html[data-theme="light"] .codex-ui .admin-section-head span { color: #8d8274; }
html[data-theme="light"] .codex-ui .admin-table-wrap { border-color: #ded0ba; }
html[data-theme="light"] .codex-ui .admin-table th,
html[data-theme="light"] .codex-ui .admin-table td { border-bottom-color: #e7dccb; }
html[data-theme="light"] .codex-ui .admin-table th { background: #f6efe5; color: #74685b; }
html[data-theme="light"] .codex-ui .admin-table td { background: #fffdfa; color: #493f36; }
html[data-theme="light"] .codex-ui .table-sub { color: #8e8375; }
html[data-theme="light"] .codex-ui .ip-code { color: #8c2638; }
html[data-theme="light"] .codex-ui .session-pill { border-color: #d8cab4; background: #faf6ef; color: #817669; }
html[data-theme="light"] .codex-ui .session-pill.online { border-color: #9fc5b4; background: #eff8f4; color: #477a65; }
html[data-theme="light"] .codex-ui .admin-switch-btn { border-color: #cfb77e; background: #fff6e2; color: #735520; }
html[data-theme="light"] .codex-ui .admin-switch-btn:hover { background: #f7e8c7; color: #762031; }
html[data-theme="light"] .codex-ui .admin-switch-btn.current { border-color: #dfd3c1; background: #f4efe8; color: #9b9185; }
html[data-theme="light"] .codex-ui .admin-ops-detail { border-color: #dac6a3; background: #fff9ee; }
html[data-theme="light"] .codex-ui .admin-ops-detail-head strong { color: #4b4036; }
html[data-theme="light"] .codex-ui .ops-detail-close { color: #8d8174; }
html[data-theme="light"] .codex-ui .ops-detail-close:hover { color: #821f31; }
html[data-theme="light"] .codex-ui .ops-detail-grid > div { border-color: #e2d5c1; background: #fffdfa; }
html[data-theme="light"] .codex-ui .ops-detail-grid span,
html[data-theme="light"] .codex-ui .ops-detail-grid small,
html[data-theme="light"] .codex-ui .ops-detail-note { color: #8e8375; }
html[data-theme="light"] .codex-ui .ops-detail-grid strong { color: #443a31; }
html[data-theme="light"] .codex-ui .audit-enter { color: #8e2739; }
html[data-theme="light"] .codex-ui .audit-exit { color: #9a6e23; }
html[data-theme="light"] .codex-ui .impersonation-banner { border-color: #d1b266; background: #fbf0d4; color: #765318; }
html[data-theme="light"] .codex-ui .impersonation-banner strong { color: #5e3e10; }
html[data-theme="light"] .codex-ui .impersonation-exit { border-color: #c5a050; background: #fff8e8; color: #745319; }

/* Responsive light-theme finishing. */
@media (max-width: 1050px) {
  html[data-theme="light"] .codex-ui .auth-card {
    background:
      radial-gradient(circle at 12% 0%, rgba(183, 147, 74, 0.13), transparent 32%),
      #fffdfa;
  }
}

@media (max-width: 720px) {
  .codex-ui .top-actions {
    min-width: 0;
    max-width: calc(100vw - 126px);
    overflow-x: auto;
    scrollbar-width: none;
  }

  .codex-ui .top-actions::-webkit-scrollbar { display: none; }

  .codex-ui .theme-toggle {
    width: 34px;
    min-width: 34px;
    min-height: 32px;
    padding: 3px;
  }

  .codex-ui .theme-toggle .theme-option { display: none; }

  .codex-ui .theme-toggle:not([aria-pressed="true"]) .theme-option:first-child,
  .codex-ui .theme-toggle[aria-pressed="true"] .theme-option:last-child {
    display: grid;
    width: 26px;
    min-width: 26px;
    min-height: 24px;
    padding: 0;
    overflow: hidden;
    font-size: 0;
  }

  .codex-ui .theme-toggle:not([aria-pressed="true"]) .theme-option:first-child::before {
    content: "☾";
    font-size: 14px;
  }

  .codex-ui .theme-toggle[aria-pressed="true"] .theme-option:last-child::before {
    content: "☀";
    font-size: 13px;
  }

  html[data-theme="light"] .codex-ui .function-nav-btn { border-color: #e0d0b4; }
  html[data-theme="light"] .codex-ui .social-list-pane { border-bottom-color: #e5dac8; }
  html[data-theme="light"] .codex-ui .modal-actions { background: #fffdfa; }
}
