/* ===== 深色/浅色模式切换 - 全站共享 ===== */
/* 原理：<html class="dark"> 时以下覆盖生效；选择存 localStorage('dx_theme') */

/* ---------- 切换按钮（右下角悬浮） ---------- */
#theme-toggle {
  position: fixed;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 500;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.1);
  background: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,.18);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform .15s, background .2s;
  -webkit-tap-highlight-color: transparent;
}
#theme-toggle:hover { transform: scale(1.1); }
#theme-toggle:active { transform: scale(.95); }
html.dark #theme-toggle {
  background: #2a2f38;
  border-color: #3d434e;
  box-shadow: 0 2px 12px rgba(0,0,0,.5);
}

/* ---------- 平滑过渡 ---------- */
body, .card, .modal, header, .wrap, .add-box, .ml-card, .week-row, .day,
input, select, textarea, .nav-btn, .btn-plain {
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}

/* ---------- 深色模式覆盖 ---------- */
html.dark body { background: #16181d; color: #e5e7eb; }

/* 卡片 / 面板 / 头部 */
html.dark header, html.dark .card, html.dark .add-box, html.dark .modal,
html.dark .wrap, html.dark .ml-card, html.dark .week-row, html.dark .cal-head {
  background: #1f232b;
}
html.dark header { box-shadow: 0 1px 4px rgba(0,0,0,.45); }
html.dark .card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.45); }
html.dark .ml-card { box-shadow: 0 1px 3px rgba(0,0,0,.4); }

/* 日历 */
html.dark .cal-head { border-bottom-color: #2c313a; }
html.dark .cal-head div { color: #9aa0a8; }
html.dark .day { border-color: #2c313a; }
html.dark .day.other-month { background: #1a1d23; }
html.dark .day.other-month .dnum { color: #5c626b; }
html.dark .day.selecting { background: #26436f; }
html.dark .dnum { color: #d7dae0; }
html.dark .day.today .dnum { color: #fff; }
html.dark .more { color: #7ba9ff; }

/* 表单控件 */
html.dark input:not([type=color]):not([type=file]),
html.dark select, html.dark textarea {
  background: #262b33;
  border-color: #3a404a;
  color: #e5e7eb;
}
html.dark ::placeholder { color: #6b727c; }
html.dark input:focus, html.dark select:focus, html.dark textarea:focus { border-color: #4f8ef7; }
html.dark input[type=color] { background: #262b33; border-color: #3a404a; }
html.dark fieldset { border-color: #353b44; }
html.dark legend { color: #9aa0a8; }
html.dark fieldset.fs-off { background: #1a1d23; }
html.dark .fs-toggle { background: #262b33; border-color: #3a404a; color: #c9cdd3; }
html.dark fieldset.fs-off .fs-toggle { background: #4f8ef7; color: #fff; border-color: #4f8ef7; }
html.dark label.f { color: #b9bec6; }

/* 按钮 */
html.dark .nav-btn { background: #262b33; border-color: #3a404a; color: #e5e7eb; }
html.dark .nav-btn:hover { background: #30363f; }
html.dark .btn-plain { background: #30363f; color: #e5e7eb; }
html.dark .btn-danger { background: #3a2626; color: #ff8a7a; border-color: #8c4a42; }
html.dark .mat-btn { background: #262b33; border-color: #3a404a; color: #c9cdd3; }
html.dark .mat-btn.del { color: #ff8a7a; border-color: #8c4a42; }
html.dark .card .del, html.dark .card .ren, html.dark .card .price-edit { color: #5c626b; }

/* 详情 / 表格 */
html.dark .detail-sec td { border-color: #2c313a; }
html.dark .detail-sec td.k { background: #23262d; color: #9aa0a8; }
html.dark .train-leg { border-color: #2c313a; }
html.dark .mat-row { background: #23262d; border-color: #353b44; }
html.dark th, html.dark td { border-bottom-color: #2c313a; }
html.dark th { color: #9aa0a8; }

/* 文字 / 链接 */
html.dark .head p, html.dark .sub { color: #9aa0a8; }
html.dark .card .count { color: #8b919a; }
html.dark .card .price { color: #9aa0a8; }
html.dark .empty { color: #6b727c; }
html.dark a.admin-link, html.dark .back { color: #7ba9ff; }
html.dark .opt-sec h2 { color: #b9bec6; }
html.dark .chip { background: #262b33; border-color: #3a404a; color: #d6d9de; }
html.dark .chip button { color: #8b919a; }

/* 手机端本月行程列表 */
html.dark .ml-date { color: #8b919a; }
html.dark .ml-cat { color: #a58cff; background: #2c2544; }
html.dark .ml-lines div { color: #c9cdd3; }
.ml-sectitle { font-size: 13px; font-weight: 600; margin: 4px 2px 8px; color: #333; }
html.dark .ml-sectitle { color: #d7dae0; }
