/* FF14 暗黑奇幻 / 极简黑金 UI */
:root{
  color-scheme: dark;
  --bg: #1a1a1a;
  --panel: #222222;
  --panel-raised: #292929;
  --control: #303030;
  --control-hover: #404040;
  --text: #dcdcdc;
  --muted: #888888;
  --gold: #c6aa75;
  --gold-bright: #ddc77e;
  --gold-dark: #81785b;
  --line: #4a4235;
  --shadow: 0 4px 12px rgba(0, 0, 0, .4);
}

@font-face {
  font-family: "FFXIV Local";
  src: url("../assets/fonts/ffxiv.woff2") format("woff2"),
       url("../assets/fonts/ffxiv.woff") format("woff"),
       url("../assets/fonts/ffxiv.ttf") format("truetype");
  font-display: swap;
}

*{ box-sizing: border-box; }
html{ min-width: 320px; background: var(--bg); }
body{
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "FFXIV Local", system-ui, -apple-system, "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.65;
}
button, input, textarea, select{ font: inherit; }
button{ border: 0; border-radius: 3px; cursor: pointer; transition: background-color .16s ease, color .16s ease, transform .16s ease; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible{
  outline: 2px solid var(--gold-dark);
  outline-offset: 2px;
}
button:disabled{ opacity: .38; cursor: not-allowed; }

.page{
  width: min(calc(100% - 40px), 1440px);
  max-width: 1440px;
  margin: 28px auto 24px;
  padding: 24px 28px 28px;
  border: 1px solid #80683f;
  border-radius: 4px;
  background: linear-gradient(145deg, rgba(205,167,96,.035), transparent 22%, transparent 78%, rgba(205,167,96,.025));
  box-shadow: 0 0 0 1px rgba(205,167,96,.10), inset 0 1px rgba(229,193,88,.16), 0 8px 24px rgba(0,0,0,.38);
}
h1{
  margin: 0;
  color: var(--gold);
  font-size: clamp(28px, 2.5vw, 32px);
  font-weight: 700;
  letter-spacing: .045em;
  line-height: 1.35;
}
.intro{ margin: 9px 0 24px; color: var(--muted); font-size: 16px; }
h2{ margin: 0; color: var(--gold); font-size: 22px; font-weight: 700; line-height: 1.4; }
p{ margin-top: 0; }
.hint, .intro, footer{ color: var(--muted); }
.hint{ font-size: 13px; }

/* 主要内容容器：暗金细框只用于区分区块 */
.panel{
  min-width: 0;
  margin: 18px 0;
  padding: 22px 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 2px;
  box-shadow: var(--shadow);
}
.entry-panel{ position: relative; padding: 26px 30px 88px; }
.data-management{ margin: 12px 0 22px; color: var(--muted); }
.data-management > summary{ padding: 8px 2px; color: var(--gold-dark); cursor: pointer; user-select: none; }
.data-management > summary:hover{ color: var(--gold); }
.management-panel{ margin-top: 8px; padding: 18px 20px; }
.management-panel p{ overflow-wrap: anywhere; }

.actions{ display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.actions button, .sort-button, .image-picker-label{
  min-height: 36px;
  padding: 7px 14px;
  background: var(--control);
  color: var(--text);
  border: 0;
  border-radius: 3px;
}
.actions button:hover, .sort-button:hover, .image-picker-label:hover{ background: var(--control-hover); color: var(--gold); }
.actions .secondary-button{ background: #292929; color: var(--muted); }
.actions .secondary-button:hover{ background: var(--control-hover); color: var(--gold); }
.management-panel .actions #restoreConnectionButton{ background: #343126; color: var(--gold); }
.management-panel .actions #restoreConnectionButton:hover:not(:disabled){ background: #403a2d; color: var(--gold-bright); }

.status{ color: var(--gold); font-weight: 600; }
.warning{ color: #d39b58; font-weight: 600; }
.success{ color: #a7b98a; }

/* 表单：用色阶而非描边表现交互控件 */
.section-heading, .history-heading{ display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-heading h2, .history-heading h2{ margin: 0; }
.count-display{
  display: inline-block;
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  color: var(--gold-bright);
  border: 0;
  border-radius: 0;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.compact-fields{ display: grid; grid-template-columns: minmax(150px, 190px) minmax(210px, 280px); gap: 18px; align-items: start; min-width: 0; }
.field{ min-width: 0; margin: 14px 0; }
.field > label{ display: block; margin-bottom: 6px; color: var(--gold-dark); font-weight: 700; }
input, textarea, select{
  max-width: 100%;
  padding: 10px 12px;
  background: #2d2d2d;
  color: var(--text);
  border: 0;
  border-radius: 3px;
  box-shadow: inset 0 -1px rgba(138, 115, 68, .25);
}
input::placeholder, textarea::placeholder{ color: #777; }
input:hover, textarea:hover, select:hover{ background: #333; }
input:focus, textarea:focus, select:focus{ background: #35332e; box-shadow: inset 0 -2px var(--gold-dark); outline: none; }
input{ width: 100%; }
textarea{ width: 100%; max-width: 100%; min-height: 112px; resize: vertical; line-height: 1.7; }
.date-row{ position: relative; display: flex; flex-wrap: nowrap; align-items: center; gap: 6px; }
.date-row input[type="text"]{ flex: 0 0 130px; width: 130px; min-width: 0; padding: 9px 10px; }
.date-row input[type="date"]{ display: none; }
.calendar-button{
  display: inline-flex !important;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: #302b21;
  color: var(--gold-dark);
}
.calendar-button:hover{ background: #3b3427; color: var(--gold-bright); }
.calendar-button svg{ display: block; width: 19px; height: 19px; }
.job-field, .duty-field{ position: relative; z-index: 2; }
.job-field:focus-within, .duty-field:focus-within{ z-index: 30; }
.job-field{ width: 220px; max-width: 100%; }
.job-field input, .duty-field input{ display: block; width: 100%; max-width: none; }
.duty-field{ width: min(760px, 100%); }
.job-field .match-result, .duty-field .match-result{
  position: absolute;
  top: calc(100% - 1px);
  left: 0;
  right: 0;
  z-index: 40;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  background: transparent;
}
.match-result[hidden], .duty-selected[hidden]{ display: none !important; }
.candidate-list{
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 300px;
  overflow-y: auto;
  background: #292929;
  border: 0;
  border-radius: 3px;
  box-shadow: 0 8px 18px rgba(0,0,0,.55);
}
.candidate-option{
  display: block;
  width: 100%;
  padding: 9px 12px;
  background: #292929;
  color: var(--text);
  border: 0;
  border-radius: 0;
  text-align: left;
}
.candidate-option + .candidate-option{ box-shadow: inset 0 1px rgba(255,255,255,.035); }
.candidate-option:hover, .candidate-option:focus{ background: #38342c; color: var(--gold-bright); outline: none; }
.candidate-empty{ padding: 10px 12px; color: var(--muted); background: #292929; }
.duty-candidate-option{ display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 10px; }
.candidate-duty-main{ display: block; min-width: 0; overflow: hidden; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.candidate-duty-type{ display: inline; margin-right: .35em; }
.candidate-duty-name{ display: inline; min-width: 0; }
.candidate-duty-level{ justify-self: end; color: var(--muted); text-align: right; white-space: nowrap; }
.duty-selected{
  display: grid;
  grid-template-columns: minmax(90px,auto) minmax(180px,1fr) minmax(48px,auto);
  align-items: baseline;
  gap: 12px;
  max-width: 760px;
  margin-top: 8px;
  padding: 8px 10px;
  background: #292929;
  border: 0;
  border-radius: 3px;
}
.duty-selected .duty-type{ grid-column: 1; grid-row: 1; color: var(--muted); }
.duty-selected .duty-name{ grid-column: 2; grid-row: 1; text-align: left; }
.duty-selected .duty-level{ grid-column: 3; grid-row: 1; color: var(--muted); text-align: right; white-space: nowrap; }
.image-field{ display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.image-field > label{ margin: 0; }
.image-field input[type="file"]{ display: none; }
.image-picker-label{ display: inline-flex !important; align-items: center; cursor: pointer; color: var(--gold); }
.image-list{ display: flex; flex-basis: 100%; flex-wrap: wrap; gap: 10px; margin-top: 2px; color: var(--muted); }
.image-item{ display: flex; align-items: center; gap: 8px; max-width: 100%; padding: 7px; background: #292929; border: 0; border-radius: 3px; }
.image-item img{ width: auto; height: auto; max-width: 110px; max-height: 84px; object-fit: contain; border-radius: 1px; }
.image-item span{ overflow-wrap: anywhere; color: var(--muted); font-size: 12px; }
.image-item button{ padding: 5px 8px; background: #37312a; color: var(--gold); }
.image-item button:hover{ background: #494033; color: var(--gold-bright); }
.form-actions{ margin-top: 20px; }

/* 历史记录导航 */
.history-section{ min-width: 0; margin: 30px 0 22px; }
.history-heading{ flex-wrap: wrap; margin-bottom: 14px; }
.history-heading .hint{ margin: 4px 0 0; }
.history-controls{ display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.sort-button{ white-space: nowrap; }
.view-switch{ display: flex; gap: 3px; padding: 3px; background: #151515; border-radius: 3px; }
.view-button{ padding: 7px 15px; background: transparent; color: var(--muted); border: 0; border-radius: 3px; }
.view-button:hover{ background: #303030; color: var(--gold); }
.view-button.active{ background: #2a2a2a; color: var(--gold); }
.record-history{ min-width: 0; }
.empty-history{ margin: 0; padding: 28px 16px; background: var(--panel); color: var(--muted); border: 1px solid var(--line); border-radius: 3px; text-align: center; }

/* Excel 式列表：比例优先，内容在窄列内换行 */
.record-history.list-view{
  display: block;
  width: 100%;
  min-width: 0;
  overflow: visible;
  background: var(--panel);
  border: 1px solid #333333;
  border-radius: 2px;
  box-shadow: none;
}
.history-table{
  width: 100%;
  min-width: 0;
  margin: 0;
  table-layout: fixed;
  border-collapse: collapse;
  border-spacing: 0;
  color: var(--text);
}
.history-table .col-count{ width: 4%; }
.history-table .col-date{ width: 8%; }
.history-table .col-job{ width: 7%; }
.history-table .col-role{ width: 5%; }
.history-table .col-type{ width: 7%; }
.history-table .col-duty{ width: 18%; }
.history-table .col-level{ width: 5%; }
.history-table .col-comment{ width: 32%; }
.history-table .col-image{ width: 14%; }
.history-table th, .history-table td{
  min-width: 0;
  padding: 10px 8px;
  border: 1px solid #333333;
  vertical-align: top;
  text-align: left;
  overflow-wrap: anywhere;
  word-break: normal;
}
.history-table thead th{ background: #101010; color: var(--text); font-size: 14px; font-weight: 600; line-height: 1.35; text-align: center; white-space: nowrap; padding: 9px 3px; }
.history-table tbody tr:nth-child(odd){ background: #242424; }
.history-table tbody tr:nth-child(even){ background: #202020; }
.history-table tbody tr:hover{ background: #2c2a25; }
.history-table th{ line-height: 1.4; }
.history-table .count-cell{ text-align: center; color: var(--gold-bright); font-variant-numeric: tabular-nums; }
.history-table .date-cell{ color: var(--muted); font-variant-numeric: tabular-nums; }
.history-table .job-cell, .history-table .type-cell, .history-table .duty-cell, .history-table .level-cell, .history-table .comment-cell{ white-space: normal; overflow-wrap: anywhere; }
.history-table .level-cell{ color: var(--muted); }
.history-table .comment-cell{ white-space: pre-wrap; line-height: 1.65; }
.history-table .image-cell{ overflow: hidden; }
.history-table .record-gallery{ margin-top: 0; gap: 5px; }
.history-table .record-gallery img{ max-width: 54px; max-height: 54px; width: auto; height: auto; object-fit: contain; }

/* 卡片：按可用宽度自动增加/减少列数，横向从左向右排列 */
.record-history.card-view{
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  grid-auto-flow: row;
  grid-auto-rows: 8px;
  align-items: start;
  gap: 12px;
}
.record-history.card-view > .record-item{
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 16px 18px;
  align-self: start;
  overflow-wrap: anywhere;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 2px;
  box-shadow: var(--shadow);
}
.record-topline{ display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.record-count{ color: var(--gold-bright); font-size: 15px; font-weight: 700; }
.record-date{ color: var(--muted); font-size: 13px; white-space: nowrap; }
.record-meta{ margin: 5px 0 8px; color: #b8b8b8; font-size: 13px; overflow-wrap: anywhere; }
.card-duty{ display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: baseline; gap: 9px; margin: 8px 0; }
.card-duty .duty-type{ color: var(--gold-dark); font-weight: 700; }
.card-duty .duty-name{ min-width: 0; color: var(--text); font-size: 16px; overflow-wrap: anywhere; }
.card-duty .duty-level{ color: var(--muted); text-align: right; white-space: nowrap; }
.record-comment{ margin: 10px 0 0; color: #c7c7c7; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; }
.record-gallery{ display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.record-gallery img{ display: block; width: auto; height: auto; max-width: 180px; max-height: 140px; object-fit: contain; border-radius: 1px; cursor: zoom-in; transition: filter .15s ease, transform .15s ease; }
.record-gallery img:hover{ filter: brightness(1.12); transform: translateY(-1px); }
.image-count{ color: var(--muted); font-size: 12px; }

/* 图片查看器：无外框图标，背景遮罩与纯色控制条 */
.image-viewer[hidden]{ display: none !important; }
.image-viewer{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 76px 76px;
  background: rgba(8,8,8,.94);
  cursor: default;
}
.image-viewer-stage{ display: flex; width: 100%; height: 100%; align-items: center; justify-content: center; overflow: hidden; }
.image-viewer img{
  display: block;
  max-width: min(92vw, 1500px);
  max-height: 82vh;
  object-fit: contain;
  border-radius: 1px;
  box-shadow: 0 8px 36px rgba(0,0,0,.55);
  cursor: zoom-in;
  user-select: none;
  touch-action: none;
  transform-origin: center center;
}
.image-viewer-close, .image-viewer-nav{
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  color: var(--gold-dark);
  border: 0;
  border-radius: 0;
  font-weight: 800;
  text-shadow: 0 1px rgba(255,255,255,.16), 0 -1px rgba(0,0,0,.8);
}
.image-viewer-close{ top: 14px; right: 20px; width: 44px; height: 44px; font-size: 38px; line-height: 1; }
.image-viewer-nav{ top: 50%; width: 54px; height: 72px; margin-top: -36px; font-size: 58px; line-height: 1; }
.image-viewer-prev{ left: 12px; }
.image-viewer-next{ right: 12px; }
.image-viewer-close:hover, .image-viewer-nav:hover{ color: var(--gold-bright); background: transparent; }
.image-viewer-tools{
  position: absolute;
  bottom: 18px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  transform: translateX(-50%);
  background: #242424;
  border: 1px solid var(--line);
  border-radius: 2px;
  box-shadow: var(--shadow);
}
.image-viewer-tools button{ min-width: 34px; height: 32px; padding: 4px 9px; background: transparent; color: var(--gold); font-weight: 700; }
.image-viewer-tools button:hover:not(:disabled){ background: #38332a; color: var(--gold-bright); }
.image-viewer-tools button:disabled{ opacity: .3; }
.image-viewer-index{ min-width: 42px; padding: 0 6px; color: var(--muted); font-size: 12px; text-align: center; }
body.image-viewer-open{ overflow: hidden; }

/* 辅助表格、状态信息 */
.table-wrap{ width: 100%; overflow-x: auto; }
table:not(.history-table){ width: 100%; margin: 12px 0; border-collapse: collapse; color: var(--text); }
table:not(.history-table) th, table:not(.history-table) td{ padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
table:not(.history-table) th{ color: var(--gold); background: #292929; }
footer{ padding: 16px 4px; color: #777; font-size: 12px; text-align: center; }

@media (max-width: 760px) {
  .page{ width: min(calc(100% - 28px), 1440px); margin-top: 22px; padding: 20px 18px 24px; }
  .panel{ padding: 18px; }
  .entry-panel{ padding: 18px 18px 88px; }
  .compact-fields{ grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; }
  .job-field{ width: 100%; }
  .duty-field{ width: 100%; }
  .history-table th, .history-table td{ padding: 8px 5px; font-size: 12px; }
  .record-history.card-view{ grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
}
@media (max-width: 520px) {
  .page{ width: calc(100% - 20px); margin-top: 16px; padding: 16px 12px 20px; }
  .panel{ padding: 14px; }
  .entry-panel{ padding: 14px 14px 88px; }
  .compact-fields{ grid-template-columns: 1fr; gap: 0; }
  .section-heading, .history-heading{ align-items: flex-start; }
  .history-controls{ justify-content: flex-start; width: 100%; }
  .view-button{ padding: 7px 12px; }
  .image-viewer{ padding: 56px 48px 72px; }
  .image-viewer-nav{ width: 38px; font-size: 46px; }
  .image-viewer-prev{ left: 2px; }
  .image-viewer-next{ right: 2px; }
  .history-table th, .history-table td{ padding: 7px 4px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after{ scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

/* 第十七阶段：更大的日记卡片、记录筛选与空记录编辑 */
.page{ width: min(calc(100% - 40px), 2600px); max-width: 2600px; }
.record-history.card-view{
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 620px), 1fr));
  gap: 16px;
}
.record-history.card-view > .record-item{
  padding: 20px 22px;
  min-height: 150px;
}
.record-count{ font-size: 17px; }
.record-date{ font-size: 14px; }
.record-meta{ font-size: 14px; margin: 7px 0 10px; }
.card-duty .duty-name{ font-size: 18px; }
.record-comment{ font-size: 15px; }

/* 筛选按钮与排序、视图切换并列，筛选面板从按钮下方展开 */
.history-tools{
  position: relative;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 2px;
}
.history-tools > summary{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  min-height: 36px;
  padding: 7px 14px;
  background: var(--control);
  color: var(--text);
  cursor: pointer;
  user-select: none;
  border-radius: 3px;
  list-style: none;
  white-space: nowrap;
}
.history-tools > summary::-webkit-details-marker{ display: none; }
.history-tools > summary::after{
  content: "";
  display: inline-block;
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  margin: -3px 0 0 9px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform .15s ease, margin .15s ease;
  color: var(--muted);
}
.history-tools > summary:hover, .history-tools[open] > summary{ background: var(--control-hover); color: var(--gold); }
.history-tools[open] > summary::after{ margin-top: 4px; transform: rotate(225deg); }
.history-tools[open] .filter-grid{
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  width: min(1050px, calc(100vw - 48px));
  box-shadow: 0 10px 24px rgba(0,0,0,.5);
}
.filter-grid{
  display: grid;
  grid-template-columns: minmax(82px, .55fr) minmax(100px, .68fr) minmax(145px, .95fr) minmax(280px, 2.1fr) minmax(118px, .78fr) minmax(118px, .78fr) auto;
  gap: 9px;
  align-items: end;
  padding: 12px;
  background: #202020;
  border: 1px solid #353535;
  border-radius: 2px;
}
.filter-grid label{
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
  color: var(--gold-dark);
  font-size: 12px;
  font-weight: 650;
}
.filter-grid select, .filter-grid input{ width: 100%; min-width: 0; height: 36px; padding: 6px 8px; font-size: 13px; }
.filter-grid .filter-search{ min-width: 0; }
.filter-grid .filter-empty-toggle{ display: flex; flex-direction: row; align-items: center; gap: 7px; white-space: nowrap; }
.filter-grid .filter-empty-toggle input{ width: auto; height: auto; accent-color: var(--gold); }
.filter-grid input[type="date"]{ color-scheme: dark; }
.filter-clear, .record-edit-button, .record-edit-actions button{
  min-height: 34px;
  padding: 6px 12px;
  background: #303030;
  color: var(--text);
  border: 0;
  border-radius: 3px;
  white-space: nowrap;
}
.filter-clear:hover, .record-edit-button:hover, .record-edit-actions button:hover{ background: #403a30; color: var(--gold-bright); }
.filter-clear{ color: var(--muted); }
.empty-record-entry{
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 16px;
  color: var(--gold-dark);
  font-size: 13px;
}
.empty-record-entry input{
  width: 72px;
  height: 36px;
  padding: 6px 8px;
  font-variant-numeric: tabular-nums;
}
.empty-record-entry button{
  min-height: 36px;
  padding: 7px 13px;
  background: #303030;
  color: var(--text);
  border-radius: 3px;
}
.empty-record-entry button:hover{ background: #403a30; color: var(--gold-bright); }
.empty-record-entry button:disabled{ opacity: .38; }
.candidate-divider{
  padding: 5px 12px 3px;
  color: var(--gold-dark);
  background: #242424;
  border-top: 1px solid #444;
  font-size: 11px;
  letter-spacing: .08em;
}
.candidate-role-option{ color: var(--gold); }
.history-table .col-count{ width: 4%; }
.history-table .col-date{ width: 8%; }
.history-table .col-job{ width: 7%; }
.history-table .col-role{ width: 5%; }
.history-table .col-type{ width: 7%; }
.history-table .col-duty{ width: 17%; }
.history-table .col-level{ width: 5%; }
.history-table .col-comment{ width: 27%; }
.history-table .col-image{ width: 15%; }
.history-table .col-action{ width: 5%; }
.history-table .record-action-cell{ text-align: center; vertical-align: middle; }
.history-table .record-edit-button{ min-height: 30px; padding: 4px 7px; font-size: 12px; }
.card-record-actions{ display: flex; justify-content: flex-end; margin-top: 12px; }
.record-edit-button:disabled{ opacity: .5; }
.record-editor{
  display: grid;
  grid-template-columns: minmax(130px, .8fr) minmax(150px, 1fr) minmax(190px, 1.2fr);
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  background: #1c1c1c;
  border: 1px solid #393939;
  border-radius: 2px;
}
.record-editor > label{
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
  color: var(--gold-dark);
  font-size: 12px;
}
.record-editor .record-edit-control{ width: 100%; min-width: 0; font-size: 13px; }
.edit-match-wrap{ position: relative; width: 100%; }
.edit-match-result{ position: absolute; z-index: 60; top: calc(100% - 1px); left: 0; right: 0; }
.edit-date-row{ display: flex; align-items: center; gap: 6px; }
.edit-date-row > input[type="text"]{ flex: 1 1 auto; min-width: 0; }
.edit-calendar-button{ flex: 0 0 42px; width: 42px; height: 36px; font-size: 11px; }
.edit-date-picker{ display: none; }
.edit-image-label{ grid-column: 1 / -1; }
.edit-image-label input{ display: block; margin-top: 5px; }
.edit-image-status{ display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.record-editor textarea.record-edit-control{ min-height: 78px; }
.record-editor .edit-comment-label{ grid-column: 1 / -1; }
.record-edit-actions{ grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
.record-edit-actions .secondary-button{ background: #292929; color: var(--muted); }
.table-record-editor{ margin: 0; }
.table-record-editor .record-editor{ margin: 0; }

@media (max-width: 1250px) {
  .filter-grid{ grid-template-columns: minmax(85px,.55fr) minmax(105px,.7fr) minmax(145px,1fr) minmax(220px,2fr); }
  .filter-grid .filter-search{ grid-column: span 1; }
}
@media (max-width: 760px) {
  .page{ width: min(calc(100% - 28px), 2600px); }
  .record-history.card-view{ grid-template-columns: minmax(0, 1fr); }
  .filter-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .record-editor{ grid-template-columns: 1fr 1fr; }
  .record-editor .edit-comment-label, .record-edit-actions{ grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .filter-grid{ grid-template-columns: 1fr; }
  .empty-record-entry{ align-items: center; }
  .record-editor{ grid-template-columns: 1fr; }
  .record-editor .edit-comment-label, .record-edit-actions{ grid-column: 1; }
}

/* 第二十阶段：日历按钮定位、紧凑瀑布流与右下角空记录入口 */
.date-row input[type="date"]{
  display: block;
  position: absolute;
  left: 136px;
  top: 0;
  z-index: 3;
  width: 38px;
  height: 38px;
  padding: 0;
  opacity: 0;
  cursor: pointer;
  color-scheme: dark;
}
.calendar-button svg{ display: block; width: 19px; height: 19px; }

/* 普通行优先 CSS Grid：保持从左到右顺序，不测量卡片高度，降低低配设备布局开销。 */
.record-history.card-view{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 620px), 1fr));
  grid-auto-flow: row;
  grid-auto-rows: auto;
  column-gap: 14px;
  row-gap: 14px;
  align-items: start;
}
.record-history.card-view > .record-item{
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  grid-row: auto;
  break-inside: auto;
}

/* 编辑区日历图标与原生日历弹层在同一位置 */
.edit-date-row{ position: relative; }
.edit-calendar-button{ flex: 0 0 42px; width: 42px; height: 36px; }
.edit-date-picker{
  display: block;
  position: absolute;
  z-index: 3;
  right: 0;
  top: 0;
  width: 42px;
  height: 36px;
  padding: 0;
  opacity: 0;
  cursor: pointer;
  color-scheme: dark;
}

/* 筛选日期：文本显示统一为数字格式，日历图标固定贴在输入框右侧 */
.filter-date-control{
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}
.filter-date-control > input[type="text"]{
  width: 100%;
  padding-right: 38px;
  font-variant-numeric: tabular-nums;
}
.filter-calendar-button{
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  background: transparent;
  color: var(--gold-dark);
}
.filter-calendar-button:hover{ background: #34302a; color: var(--gold-bright); }
.filter-date-picker{
  display: block;
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  width: 36px;
  height: 36px;
  padding: 0;
  opacity: 0;
  cursor: pointer;
  color-scheme: dark;
}

/* 空记录入口固定在新增导随记录面板的右下角 */
.empty-record-entry{
  position: absolute;
  right: 22px;
  bottom: 18px;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: var(--gold-dark);
  font-size: 13px;
}
.empty-record-entry label{ margin: 0; white-space: nowrap; }
.empty-record-entry input{ width: 58px; height: 32px; padding: 5px 7px; }
.empty-record-entry button{ min-height: 32px; padding: 5px 10px; }

/* 日历图标按钮位于透明 date input 上层，由按钮触发原生弹层，弹层锚点仍在图标位置 */
.date-row .calendar-button{ position: relative; z-index: 4; }
.date-row input[type="date"]{ z-index: 2; }
.edit-calendar-button{ position: relative; z-index: 4; }
.edit-date-picker{ z-index: 2; }
.filter-calendar-button{ z-index: 4; }
.filter-date-picker{ z-index: 2; }

/* 第二十一阶段：历史工具栏统一尺寸与状态 */
.history-controls > .sort-button, .history-controls > .history-tools > summary, .history-controls > .view-switch{
  min-height: 36px;
}
.history-controls > .sort-button{ display: inline-flex; align-items: center; justify-content: center; min-width: 82px; }
.history-controls > .view-switch{ align-items: center; padding: 3px; gap: 2px; }
.history-controls > .view-switch .view-button{ min-height: 30px; padding: 4px 13px; }
@media (max-width: 760px) {
  .history-controls{ justify-content: flex-start; }
  .history-tools[open] .filter-grid{ right: auto; left: 0; width: min(94vw, 520px); }
}


/* 卡片使用标准行流网格，避免瀑布流测量造成的持续重排。 */
.record-history.card-view{
  grid-auto-flow: row;
  grid-auto-rows: auto;
  align-items: start;
}

.history-controls{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}
.history-controls > .sort-button, .history-controls > .history-tools > summary, .history-controls > .view-switch{
  height: 38px;
  min-height: 38px;
  box-sizing: border-box;
  border: 0;
  border-radius: 3px;
  box-shadow: none;
}
.history-controls > .sort-button, .history-controls > .history-tools > summary{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
  background: var(--control);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}
.history-controls > .sort-button{ min-width: 72px; }
.history-controls > .history-tools > summary{ min-width: 78px; }
.history-controls > .sort-button:hover, .history-controls > .history-tools > summary:hover, .history-controls > .history-tools[open] > summary{
  background: var(--control-hover);
  color: var(--gold);
}
.history-controls > .view-switch{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 3px;
  background: var(--control);
}
.history-controls > .view-switch .view-button{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  min-height: 32px;
  padding: 0 14px;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}
.history-controls > .view-switch .view-button:hover{
  background: #3a3a3a;
  color: var(--gold);
}
.history-controls > .view-switch .view-button.active{
  background: #45413a;
  color: var(--gold-bright);
}
/* 筛选箭头使用 CSS 线条绘制，避免字符基线导致上下错位 */
.history-tools > summary::after{ margin-left: 9px; }

/* 空记录入口锚定在“新增导随记录”整个面板的右下角 */
.entry-panel{ position: relative; }
.entry-panel > .empty-record-entry{
  position: absolute;
  right: 22px;
  bottom: 18px;
}
@media (max-width: 760px) {
  .history-controls{ justify-content: flex-start; }
}

/* 数据连接状态：压缩为一行信息，避免说明文字占据面板 */
.connection-info{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #333333;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.connection-info .status{ color: var(--gold-dark); font-weight: 600; }
.management-panel .connection-info + #summary{ margin-top: 0; }

/* 双击切换视图后，短暂标出对应记录 */
.record-item.record-jump-highlight{ animation: record-jump-card 1.3s ease; }
tr.record-jump-highlight > td{ animation: record-jump-row 1.3s ease; }
@keyframes record-jump-card {
  0%, 100% { background: var(--panel); }
  35% { background: #343128; box-shadow: 0 0 0 1px var(--gold-dark), var(--shadow); }
}
@keyframes record-jump-row {
  0%, 100% { background: transparent; }
  35% { background: #343128; }
}


/* 图片清除、图片筛选与图片比例 */
.edit-existing-images{ grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 12px; }
.edit-clear-images{ padding: 6px 10px; background: #302b25; color: var(--gold); }
.edit-clear-images.pending-clear{ background: #573b32; color: #f0b6a1; }
.filter-grid label{ min-width: 0; }
.filter-grid #filterImagePresence{ min-width: 105px; }

/* 第二十九阶段：筛选面板重新排版，固定在视口内并避免控件挤压 */
.history-controls{ position: relative; }
.history-tools{ position: static; }
.history-tools[open] .filter-grid{
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  z-index: 100;
  display: grid;
  width: min(760px, calc(100vw - 40px));
  max-width: calc(100vw - 40px);
  max-height: min(72vh, 560px);
  overflow: auto;
  overscroll-behavior: contain;
  grid-template-columns: minmax(105px, .72fr) minmax(130px, .9fr) minmax(150px, 1fr) 100px;
  grid-template-areas:
    "role job type image"
    "search search from to"
    "empty empty empty clear";
  align-items: end;
  gap: 10px;
  padding: 14px;
  box-sizing: border-box;
}
.filter-grid > label:nth-of-type(1){ grid-area: role; }
.filter-grid > label:nth-of-type(2){ grid-area: job; }
.filter-grid > label:nth-of-type(3){ grid-area: type; }
.filter-grid > .filter-image{ grid-area: image; }
.filter-grid > .filter-search{ grid-area: search; }
.filter-grid > label:nth-of-type(6){ grid-area: from; }
.filter-grid > label:nth-of-type(7){ grid-area: to; }
.filter-grid > .filter-empty-toggle{
  grid-area: empty;
  justify-self: start;
  align-self: center;
  min-height: 36px;
  white-space: nowrap;
}
.filter-grid > .filter-clear{
  grid-area: clear;
  justify-self: end;
  align-self: center;
  min-width: 88px;
}
.filter-grid #filterImagePresence{ min-width: 0; width: 100%; }
.filter-grid select, .filter-grid input[type="search"], .filter-grid .filter-date-control > input[type="text"]{
  min-width: 0;
  width: 100%;
}
.filter-grid .filter-search{ min-width: 0; }
.filter-grid .filter-date-control{ min-width: 0; }
.filter-grid .filter-empty-toggle input{ flex: 0 0 auto; }
.filter-grid .filter-clear{ margin: 0; }

/* 删除操作保持低调，但与普通按钮明确区分 */
.record-edit-actions .delete-record-button{
  margin-right: auto;
  background: #352727;
  color: #c98f83;
}
.record-edit-actions .delete-record-button:hover{
  background: #4a2e2b;
  color: #e6a69a;
}
.edit-existing-images{
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 760px) {
  .history-tools[open] .filter-grid{
    right: 0;
    left: auto;
    width: min(540px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "role job"
      "type image"
      "search search"
      "from to"
      "empty empty"
      "clear clear";
  }
  .filter-grid > .filter-clear{ justify-self: end; }
}
@media (max-width: 480px) {
  .history-tools[open] .filter-grid{
    width: min(360px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "role" "job" "type" "image" "search" "from" "to" "empty" "clear";
    gap: 9px;
    padding: 11px;
  }
  .filter-grid > .filter-clear{ justify-self: end; }
}


/* 第三十阶段：开始/结束日期等宽，日期清空后控件保持同步 */
@media (min-width: 761px) {
  .history-tools[open] .filter-grid{
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 760px) {
  .history-tools[open] .filter-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.filter-grid > label:nth-of-type(6), .filter-grid > label:nth-of-type(7){
  width: 100%;
  min-width: 0;
}
.filter-grid > label:nth-of-type(6) .filter-date-control, .filter-grid > label:nth-of-type(7) .filter-date-control{
  width: 100%;
  min-width: 0;
}
.filter-grid > label:nth-of-type(6) .filter-date-control > input[type="text"], .filter-grid > label:nth-of-type(7) .filter-date-control > input[type="text"]{
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}
@media (max-width: 480px) {
  .history-tools[open] .filter-grid{
    grid-template-columns: minmax(0, 1fr);
  }
}

/* 第四十一阶段：统计页签、成就进度与导随数据可视化 */
.content-tabs{
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 30px 0 18px;
  padding: 4px;
  width: fit-content;
  max-width: 100%;
  background: #151515;
  border-radius: 3px;
}
.content-tab{
  min-height: 38px;
  padding: 7px 20px;
  background: transparent;
  color: var(--muted);
  border-radius: 2px;
  white-space: nowrap;
}
.content-tab:hover{ background: #292929; color: var(--gold); }
.content-tab.active{ background: #302b21; color: var(--gold-bright); }
.history-section{ margin-top: 0; }
.statistics-section{ min-width: 0; margin: 0 0 26px; }
.statistics-section[hidden], .history-section[hidden]{ display: none !important; }
.statistics-heading{ display: flex; align-items: center; justify-content: space-between; margin: 0 0 18px; }
.statistics-heading h2{ margin: 0; }
.statistics-heading .hint{ margin: 4px 0 0; }
.achievement-section, .statistics-group{ margin: 0 0 24px; }
.statistics-section-heading{ display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px 18px; margin: 0 0 12px; }
.statistics-section-heading h3{ margin: 0; color: var(--gold); font-size: 19px; }
.statistics-section-heading .hint{ margin: 0; }
.achievement-grid{ display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.achievement-card{
  position: relative;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) minmax(110px, auto);
  align-items: center;
  gap: 14px;
  min-width: 0;
  min-height: 116px;
  padding: 15px 18px 22px;
  overflow: hidden;
  background: linear-gradient(110deg, #292720, #242424 38%, #202020);
  border: 1px solid #514735;
  border-radius: 3px;
  box-shadow: inset 0 1px rgba(205,167,96,.07), 0 3px 10px rgba(0,0,0,.18);
}
.achievement-card.achieved{ border-color: #8b7449; background: linear-gradient(110deg, #332e22, #25241f 42%, #202020); }
.achievement-emblem{
  position: relative;
  display: flex;
  width: 62px;
  height: 62px;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 35%, #484236, #211f1b 72%);
  border: 1px solid #796746;
  border-radius: 8px;
  box-shadow: inset 0 0 0 3px rgba(0,0,0,.28), 0 2px 6px rgba(0,0,0,.35);
}
.achievement-emblem strong{ color: var(--gold-bright); font-size: 28px; text-shadow: 0 2px 3px #000; }
.achievement-stars{ position: absolute; top: -12px; left: 50%; transform: translateX(-50%); color: #d8bd70; font-size: 14px; letter-spacing: 1px; white-space: nowrap; text-shadow: 0 1px 3px #000; }
.achievement-info{ min-width: 0; }
.achievement-info h4{ margin: 0 0 3px; color: var(--gold); font-size: 17px; }
.achievement-info p{ margin: 2px 0; color: #b9b5aa; font-size: 12px; line-height: 1.5; }
.achievement-info .achievement-reward{ color: #d2c29d; }
.achievement-state{ display: flex; min-width: 110px; flex-direction: column; align-items: flex-end; gap: 5px; text-align: right; }
.achievement-state strong{ display: inline-flex; min-width: 82px; justify-content: center; padding: 4px 10px; background: #39352c; color: #b7a98a; border-radius: 2px; font-size: 13px; font-weight: 600; }
.achievement-card.achieved .achievement-state strong{ background: #3b3929; color: #d9c17c; }
.achievement-state span{ color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.achievement-progress{ position: absolute; right: 18px; bottom: 10px; left: 18px; height: 4px; overflow: hidden; background: #111; border-radius: 4px; }
.achievement-progress span{ display: block; height: 100%; background: linear-gradient(90deg, #8e7444, #ddc77e); border-radius: inherit; }
.distribution-grid{ display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.statistics-card{ min-width: 0; padding: 18px 18px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 3px; box-shadow: var(--shadow); }
.statistics-card h4{ margin: 0 0 13px; color: var(--gold); font-size: 16px; }
.chart-content{ min-width: 0; }
.pie-chart-layout{ display: grid; grid-template-columns: minmax(130px, 190px) minmax(0, 1fr); align-items: center; gap: 12px; }
.pie-chart{ display: block; width: 100%; max-width: 190px; height: auto; overflow: visible; }
.chart-legend{ display: flex; min-width: 0; max-height: 228px; flex-direction: column; gap: 7px; overflow: auto; padding-right: 3px; }
.chart-legend-row{ display: grid; grid-template-columns: 9px minmax(0,1fr) auto; align-items: center; gap: 7px; min-width: 0; font-size: 12px; }
.chart-swatch{ width: 8px; height: 8px; border-radius: 1px; }
.chart-legend-name{ min-width: 0; overflow: hidden; color: #c9c6bd; text-overflow: ellipsis; white-space: nowrap; }
.chart-legend-value{ color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.chart-total{ margin-top: 9px; padding-top: 0; color: var(--muted); border-top: 0; font-size: 13px; text-align: right; }
.statistics-empty{ margin: 0; padding: 22px 8px; color: var(--muted); text-align: center; }
.top-duties-card{ padding-bottom: 18px; }
.statistics-total{ color: var(--muted); font-size: 12px; }
.top-duties-list{ display: flex; flex-direction: column; gap: 10px; }
.top-duty-row{ display: grid; grid-template-columns: 34px minmax(140px, 1.2fr) minmax(80px, 2fr) minmax(115px, auto); align-items: center; gap: 12px; min-width: 0; }
.top-duty-rank{ color: var(--gold-dark); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.top-duty-name{ min-width: 0; overflow: hidden; color: var(--text); text-overflow: ellipsis; white-space: nowrap; }
.top-duty-track, .rate-track{ display: block; height: 7px; overflow: hidden; background: #141414; border-radius: 5px; }
.top-duty-track span, .rate-track span{ display: block; height: 100%; background: linear-gradient(90deg, #806b45, #d1b678); border-radius: inherit; }
.top-duty-value{ color: var(--muted); font-size: 12px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.roulette-rate-grid{ display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.roulette-rate-card{ min-width: 0; padding: 17px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 3px; box-shadow: var(--shadow); }
.roulette-rate-card h4{ margin: 0 0 7px; color: var(--gold); font-size: 15px; }
.roulette-rate-percent{ display: block; color: var(--gold-bright); font-size: 27px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.roulette-rate-card p{ margin: 5px 0 12px; color: var(--muted); font-size: 12px; }
.rate-track{ height: 6px; }
@media (max-width: 1050px) {
  .distribution-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .distribution-grid > .statistics-card:last-child{ grid-column: 1 / -1; }
  .roulette-rate-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .achievement-grid, .distribution-grid{ grid-template-columns: minmax(0, 1fr); }
  .distribution-grid > .statistics-card:last-child{ grid-column: auto; }
  .achievement-card{ grid-template-columns: 60px minmax(0,1fr); gap: 12px; padding: 14px 14px 22px; }
  .achievement-emblem{ width: 54px; height: 54px; }
  .achievement-state{ grid-column: 2; flex-direction: row; align-items: center; justify-content: space-between; min-width: 0; text-align: left; }
  .achievement-state strong{ min-width: 70px; }
  .pie-chart-layout{ grid-template-columns: minmax(120px, 170px) minmax(0,1fr); }
  .top-duty-row{ grid-template-columns: 26px minmax(0,1fr) minmax(70px,1fr); gap: 8px; }
  .top-duty-track{ display: none; }
  .top-duty-value{ font-size: 11px; }
}
@media (max-width: 460px) {
  .content-tab{ padding: 7px 13px; font-size: 13px; }
  .roulette-rate-grid{ grid-template-columns: minmax(0,1fr); }
  .pie-chart-layout{ grid-template-columns: minmax(0, 135px) minmax(0,1fr); gap: 8px; }
  .chart-legend-row{ grid-template-columns: 8px minmax(0,1fr); }
  .chart-legend-value{ grid-column: 2; font-size: 11px; }
  .top-duty-row{ grid-template-columns: 24px minmax(0,1fr) auto; }
}

/* 第四十二阶段：统计图表辨识度、悬停详情与简洁排版 */
.pie-chart-layout{ position: relative; }
.chart-tooltip{ position: absolute; z-index: 5; max-width: min(230px, calc(100% - 12px)); padding: 8px 11px; color: #e4dfd2; background: rgba(25,25,24,.97); border: 1px solid #756443; border-radius: 3px; box-shadow: 0 4px 14px rgba(0,0,0,.38); font-size: 12px; line-height: 1.4; white-space: nowrap; pointer-events: none; }
.chart-tooltip[hidden]{ display: none; }
.statistics-select{ min-width: 130px; max-width: 220px; padding: 6px 28px 6px 9px; color: #dcd6c8; background: #292824; border: 1px solid #514735; border-radius: 2px; font: inherit; font-size: 13px; }
.statistics-select:focus{ outline: 1px solid #8c754a; outline-offset: 1px; }
.top-duties-toolbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  margin: 0 0 14px;
}
.top-duties-title{
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  margin: 0;
  padding: 0;
  color: var(--gold);
  font-size: 16px;
  line-height: 1.4;
  text-align: left;
}
.top-duties-controls{
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
  align-items: center;
  margin: 0;
}
#statisticsSummary:empty{ display: none; }


/* ===== 网页主题切换 ===== */
.page-heading{ display:flex; align-items:flex-start; justify-content:space-between; gap:20px; }
.page-heading .intro{ margin-bottom:24px; }


:root[data-theme="light"]{
  color-scheme: light;
  --bg:#ebd9ba; --panel:#e0cba7; --panel-raised:#ead8b7; --control:#4a3d32; --control-hover:#65513d;
  --text:#3a2d22; --muted:#78664f; --gold:#8b6735; --gold-bright:#a77c3d; --gold-dark:#b88d4a; --line:#6b5337;
  --shadow:0 3px 9px rgba(74,61,50,.16);
}
:root[data-theme="light"] body{ background:var(--bg); color:var(--text); }
:root[data-theme="light"] .page{ background:rgba(224,203,167,.42); border-color:var(--line); box-shadow:0 0 0 1px rgba(107,83,55,.12), inset 0 1px rgba(255,255,255,.32), 0 6px 18px rgba(74,61,50,.16); }
:root[data-theme="light"] .panel, :root[data-theme="light"] .statistics-card, :root[data-theme="light"] .top-duties-card, :root[data-theme="light"] .roulette-rate-card, :root[data-theme="light"] .achievement-card{ background:var(--panel); border-color:var(--line); box-shadow:inset 0 1px 3px rgba(107,83,55,.10); }
:root[data-theme="light"] button, :root[data-theme="light"] .actions button, :root[data-theme="light"] .sort-button, :root[data-theme="light"] .image-picker-label{ background:#4a3d32; color:#ebd9ba; }
:root[data-theme="light"] button:hover, :root[data-theme="light"] .actions button:hover, :root[data-theme="light"] .sort-button:hover{ background:#65513d; color:#fff0d2; }
:root[data-theme="light"] input, :root[data-theme="light"] textarea, :root[data-theme="light"] select, :root[data-theme="light"] .match-result, :root[data-theme="light"] .candidate-empty, :root[data-theme="light"] .candidate-option{ background:#ead8b7; color:var(--text); border-color:var(--line); }
:root[data-theme="light"] input:hover, :root[data-theme="light"] textarea:hover, :root[data-theme="light"] select:hover{ background:#f0dfc1; }
:root[data-theme="light"] input:focus, :root[data-theme="light"] textarea:focus, :root[data-theme="light"] select:focus{ background:#f3e4c9; box-shadow:inset 0 -2px var(--gold-dark); }
:root[data-theme="light"] .content-tab{ background:transparent; color:var(--muted); }
:root[data-theme="light"] .content-tab.active{ background:#b88d4a; color:#fff8e9; }
:root[data-theme="light"] .view-switch{ background:#cbb58f; }
:root[data-theme="light"] .view-button.active, :root[data-theme="light"] .view-button:hover{ background:#4a3d32; color:#ebd9ba; }
:root[data-theme="light"] .history-table thead th{ background:#cbb58f; color:#3a2d22; }
:root[data-theme="light"] .history-table tbody tr:nth-child(odd){ background:#ead8b7; }
:root[data-theme="light"] .history-table tbody tr:nth-child(even){ background:#e3cda8; }
:root[data-theme="light"] .history-table tbody tr:hover{ background:#d9bd8d; }
:root[data-theme="light"] .history-table th, :root[data-theme="light"] .history-table td, :root[data-theme="light"] table:not(.history-table) th, :root[data-theme="light"] table:not(.history-table) td{ border-color:rgba(107,83,55,.35); }
:root[data-theme="light"] table:not(.history-table) th{ background:#d3bd97; }
:root[data-theme="light"] .record-item, :root[data-theme="light"] .empty-history, :root[data-theme="light"] .record-editor{ background:#e0cba7; border-color:var(--line); }
:root[data-theme="light"] .record-comment, :root[data-theme="light"] .achievement-info p, :root[data-theme="light"] .achievement-info .achievement-reward{ color:#65513d; }
:root[data-theme="light"] .achievement-emblem{ background:radial-gradient(circle at 32% 25%,#51483a,#211e19 72%); }
:root[data-theme="light"] .achievement-state strong{ background:#d0bb96; color:#65513d; }
:root[data-theme="light"] .achievement-card.achieved .achievement-state strong{ background:#b88d4a; color:#fff8e9; }
:root[data-theme="light"] .statistics-total{ color:#78664f; }
:root[data-theme="light"] .rate-track, :root[data-theme="light"] .top-duty-track, :root[data-theme="light"] .achievement-progress{ background:#c4ad85; }
:root[data-theme="light"] .image-item{ background:#d5bf99; border-color:var(--line); }
:root[data-theme="light"] .image-viewer{ background:rgba(40,32,23,.94); }

:root[data-theme="white"]{
  color-scheme: light;
  --bg:rgba(255,255,255,.30); --panel:rgba(245,245,245,.92); --panel-raised:rgba(245,245,245,.88);
  --control:#cccccc; --control-hover:#bcbcbc; --text:#333333; --muted:#707070; --gold:#a8872c; --gold-bright:#b99736; --gold-dark:#d4af37;
  --line:rgba(160,160,160,.6); --shadow:0 3px 12px rgba(0,0,0,.08);
}
:root[data-theme="white"] html{ background:#fff; }
:root[data-theme="white"] body{ background:linear-gradient(135deg,#fff 0%,#f3f3f3 48%,#fff 100%); color:#333; }
:root[data-theme="white"] .page{ background:rgba(255,255,255,.30); border-color:rgba(160,160,160,.6); box-shadow:0 0 0 1px rgba(160,160,160,.12),0 8px 28px rgba(0,0,0,.07); backdrop-filter:blur(10px); -webkit-backdrop-filter:blur(10px); }
:root[data-theme="white"] .panel, :root[data-theme="white"] .statistics-card, :root[data-theme="white"] .top-duties-card, :root[data-theme="white"] .roulette-rate-card, :root[data-theme="white"] .achievement-card{ background:rgba(245,245,245,.92); border-color:var(--line); box-shadow:0 2px 8px rgba(0,0,0,.045); backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px); }
:root[data-theme="white"] button, :root[data-theme="white"] .actions button, :root[data-theme="white"] .sort-button, :root[data-theme="white"] .image-picker-label{ background:#ccc; color:#333; }
:root[data-theme="white"] button:hover, :root[data-theme="white"] .actions button:hover, :root[data-theme="white"] .sort-button:hover{ background:#bcbcbc; color:#222; }
:root[data-theme="white"] input, :root[data-theme="white"] textarea, :root[data-theme="white"] select, :root[data-theme="white"] .match-result, :root[data-theme="white"] .candidate-empty, :root[data-theme="white"] .candidate-option{ background:rgba(255,255,255,.78); color:#333; border-color:var(--line); }
:root[data-theme="white"] .content-tab{ background:transparent; color:#666; }
:root[data-theme="white"] .content-tab.active{ background:#555; color:#fff; box-shadow:inset 3px 0 #d4af37; }
:root[data-theme="white"] .view-switch{ background:#ddd; }
:root[data-theme="white"] .view-button.active, :root[data-theme="white"] .view-button:hover{ background:#555; color:#fff; }
:root[data-theme="white"] .history-table thead th{ background:#dedede; color:#333; }
:root[data-theme="white"] .history-table tbody tr:nth-child(odd){ background:rgba(245,245,245,.92); }
:root[data-theme="white"] .history-table tbody tr:nth-child(even){ background:rgba(232,232,232,.92); }
:root[data-theme="white"] .history-table tbody tr:hover{ background:#ddd; }
:root[data-theme="white"] .history-table th, :root[data-theme="white"] .history-table td, :root[data-theme="white"] table:not(.history-table) th, :root[data-theme="white"] table:not(.history-table) td{ border-color:rgba(160,160,160,.45); }
:root[data-theme="white"] table:not(.history-table) th{ background:#e5e5e5; }
:root[data-theme="white"] .record-item, :root[data-theme="white"] .empty-history, :root[data-theme="white"] .record-editor{ background:rgba(240,240,240,.88); border-color:var(--line); }
:root[data-theme="white"] .record-comment, :root[data-theme="white"] .achievement-info p, :root[data-theme="white"] .achievement-info .achievement-reward{ color:#555; }
:root[data-theme="white"] .achievement-emblem{ background:radial-gradient(circle at 32% 25%,#51483a,#211e19 72%); }
:root[data-theme="white"] .achievement-state strong{ background:#ddd; color:#555; }
:root[data-theme="white"] .achievement-card.achieved .achievement-state strong{ background:#555; color:#fff; }
:root[data-theme="white"] .statistics-total{ color:#777; }
:root[data-theme="white"] .rate-track, :root[data-theme="white"] .top-duty-track, :root[data-theme="white"] .achievement-progress{ background:#ddd; }
:root[data-theme="white"] .image-item{ background:#eee; border-color:var(--line); }
:root[data-theme="white"] .image-viewer{ background:rgba(25,25,25,.94); }




/* 第四十九阶段：主题弹出菜单、滑动切换与三主题细节适配 */
.theme-menu-wrap{position:relative;z-index:120;flex:0 0 auto;margin-top:2px}
.theme-menu-button{width:38px;height:38px;display:grid;place-items:center;padding:8px;background:var(--control);color:var(--gold);border:1px solid var(--line);border-radius:2px}
.theme-menu-button svg{width:21px;height:21px}
.theme-menu-button:hover{background:var(--control-hover);color:var(--gold-bright)}
.theme-menu{position:absolute;top:calc(100% + 8px);right:0;display:grid;grid-template-columns:1fr;min-width:116px;padding:5px;background:var(--panel);border:1px solid var(--line);box-shadow:0 8px 22px rgba(0,0,0,.24)}
.theme-menu[hidden]{display:none}
.theme-menu button{padding:8px 13px;text-align:left;background:transparent;color:var(--text);white-space:nowrap;border-radius:1px}
.theme-menu button:hover, .theme-menu button.active{background:var(--control-hover);color:var(--gold-bright)}

/* 两组切换均使用滑动指示块，不再呈现双按钮套框 */
.content-tabs, .history-controls>.view-switch{position:relative;isolation:isolate;display:inline-flex;align-items:center;gap:0;padding:3px;overflow:hidden}
.content-tabs::before, .history-controls>.view-switch::before{content:"";position:absolute;z-index:-1;top:3px;bottom:3px;left:3px;width:calc((100% - 6px)/2);background:var(--tab-active-bg,#302b21);border-radius:2px;transform:translateX(var(--switch-offset,0%));transition:transform .24s cubic-bezier(.2,.75,.25,1),background-color .2s ease}
.content-tabs:has(#statisticsTabButton.active){--switch-offset:100%}
.content-tab{position:relative;z-index:1;min-width:132px;background:transparent!important;transition:color .2s ease}
.content-tab.active{background:transparent!important;color:var(--tab-active-text,var(--gold-bright))!important}
.history-controls>.view-switch{--tab-active-bg:#45413a;background:var(--control);border-radius:3px}
.history-controls>.view-switch:has(#cardViewButton.active)::before{transform:translateX(100%)}
.history-controls>.view-switch .view-button{position:relative;z-index:1;min-width:64px;background:transparent!important;transition:color .2s ease}
.history-controls>.view-switch .view-button.active{background:transparent!important;color:var(--tab-active-text,var(--gold-bright))!important}

/* 筛选浮层、记录跳转高亮、图例与计量条统一使用主题变量 */
.filter-grid{background:var(--panel-raised);border-color:var(--line);color:var(--text)}
.filter-grid label{color:var(--gold-dark)}
.chart-legend-name{color:var(--text)}
.record-meta{color:var(--gold-dark)}
@keyframes record-jump-card{0%,100%{background:var(--panel)}35%{background:var(--jump-highlight,#343128);box-shadow:0 0 0 1px var(--gold-dark),var(--shadow)}}
@keyframes record-jump-row{0%,100%{background:transparent}35%{background:var(--jump-highlight,#343128)}}

:root[data-theme="light"]{--tab-active-bg:#b88d4a;--tab-active-text:#fff8e9;--jump-highlight:#d4bd94;--panel-raised:#ead8b7}
:root[data-theme="light"] .management-panel .actions #restoreConnectionButton{background:#b88d4a;color:#fffaf0;box-shadow:inset 0 1px rgba(255,255,255,.24),0 1px 2px rgba(74,61,50,.16)}
:root[data-theme="light"] .management-panel .actions #restoreConnectionButton:hover:not(:disabled){background:#a77a3d;color:#fff}
:root[data-theme="light"] .content-tabs{background:#d1bc98}
:root[data-theme="light"] .history-controls>.view-switch{background:#cbb58f}
:root[data-theme="light"] .history-controls>.view-switch::before{--tab-active-bg:#4a3d32}
:root[data-theme="light"] .history-controls>.view-switch .view-button.active{color:#ebd9ba!important}
:root[data-theme="light"] .history-tools[open] .filter-grid{background:#e0cba7;border-color:#6b5337;box-shadow:0 10px 24px rgba(74,61,50,.24)}
:root[data-theme="light"] .filter-grid select, :root[data-theme="light"] .filter-grid input{background:#f0dfc1;color:#3a2d22;border-color:#8b704d}
:root[data-theme="light"] .record-meta{color:#59432d;font-weight:650}
:root[data-theme="light"] .chart-legend-name{color:#3a2d22;font-weight:600}
:root[data-theme="light"] .rate-track, :root[data-theme="light"] .top-duty-track, :root[data-theme="light"] .achievement-progress{background:#c4ad85}
:root[data-theme="light"] .rate-track span, :root[data-theme="light"] .top-duty-track span{background:linear-gradient(90deg,#8b6735,#b88d4a)}
:root[data-theme="light"] .achievement-progress span{background:linear-gradient(90deg,#8b6735,#c49a55)}
:root[data-theme="light"] .record-item.record-jump-highlight{--jump-highlight:#d4bd94}

:root[data-theme="white"]{--tab-active-bg:#555;--tab-active-text:#fff;--jump-highlight:rgba(212,175,55,.22);--gold:#967b36;--gold-bright:#a58a48;--gold-dark:#9b8247;--panel-raised:rgba(245,245,245,.92)}
:root[data-theme="white"] .theme-menu{background:rgba(238,238,238,.96);border-color:rgba(160,160,160,.7);backdrop-filter:blur(10px)}
:root[data-theme="white"] .theme-menu-button{background:#ddd;color:#92783e;border-color:rgba(160,160,160,.65)}
:root[data-theme="white"] .management-panel .actions #restoreConnectionButton{background:#b5a16d;color:#fff;box-shadow:inset 0 1px rgba(255,255,255,.45),0 1px 3px rgba(0,0,0,.12)}
:root[data-theme="white"] .management-panel .actions #restoreConnectionButton:hover:not(:disabled){background:#9e8958;color:#fff}
:root[data-theme="white"] .content-tabs{background:#e0e0e0}
:root[data-theme="white"] .history-controls>.view-switch{background:#ddd}
:root[data-theme="white"] .history-controls>.view-switch::before{--tab-active-bg:#555}
:root[data-theme="white"] .history-tools[open] .filter-grid{background:rgba(235,235,235,.97);border-color:rgba(160,160,160,.65);box-shadow:0 10px 24px rgba(0,0,0,.15);backdrop-filter:blur(10px)}
:root[data-theme="white"] .filter-grid select, :root[data-theme="white"] .filter-grid input{background:rgba(255,255,255,.92);color:#333;border-color:rgba(150,150,150,.7)}
:root[data-theme="white"] .record-meta{color:#514638;font-weight:650}
:root[data-theme="white"] .chart-legend-name{color:#333;font-weight:600}
:root[data-theme="white"] .rate-track, :root[data-theme="white"] .top-duty-track, :root[data-theme="white"] .achievement-progress{background:#d4d4d4}
:root[data-theme="white"] .rate-track span, :root[data-theme="white"] .top-duty-track span{background:linear-gradient(90deg,#77705e,#a99a70)}
:root[data-theme="white"] .achievement-progress span{background:linear-gradient(90deg,#85764e,#b4a16d)}
:root[data-theme="white"] .record-item.record-jump-highlight{--jump-highlight:rgba(180,150,75,.2)}
@media(max-width:600px){.content-tab{min-width:0;padding-inline:13px}.theme-menu-wrap{align-self:flex-end}}

/* 第五十阶段：主题细节与控件状态优化 */
.theme-menu-button{border-radius:50%}
:root[data-theme="white"] .record-editor select, :root[data-theme="white"] .record-editor input, :root[data-theme="white"] select, :root[data-theme="white"] .filter-grid input, :root[data-theme="white"] .filter-grid select{background:rgba(255,255,255,.96);border-color:rgba(155,155,155,.58)}
:root[data-theme="white"] select:focus, :root[data-theme="white"] input:focus, :root[data-theme="white"] textarea:focus{background:#fff;border-color:#b9a36c;outline:0;box-shadow:0 0 0 2px rgba(185,163,108,.18)}
:root[data-theme="white"] .achievement-card{background:rgba(250,250,250,.94);border:1px solid #d5d5d5;box-shadow:none;backdrop-filter:none;-webkit-backdrop-filter:none}
:root[data-theme="white"] .achievement-card.achieved{background:rgba(255,249,231,.96);border-color:#c9b477}
:root[data-theme="white"] .achievement-emblem{background:#f2f2f2;border:1px solid #d1d1d1;box-shadow:none}
:root[data-theme="white"] .achievement-card.achieved .achievement-emblem{background:#f0e4c4;border-color:#d5c18b}
:root[data-theme="white"] .achievement-emblem strong{color:#806a35;text-shadow:none}
:root[data-theme="white"] .achievement-stars{color:#a88a43;text-shadow:none}
:root[data-theme="white"] .achievement-info h4{color:#806a35}
:root[data-theme="white"] .achievement-info p, :root[data-theme="white"] .achievement-info .achievement-reward{color:#555}
:root[data-theme="white"] .achievement-state strong{background:#e8e8e8;color:#666}
:root[data-theme="white"] .achievement-card.achieved .achievement-state strong{background:#e9d9ad;color:#624e22}
:root[data-theme="white"] .achievement-progress{background:#e1e1e1}
:root[data-theme="white"] .achievement-progress span{background:#b49a5b}
:root[data-theme="white"] .pie-chart{filter:brightness(1.28) saturate(1.08)}
:root[data-theme="white"] .chart-swatch{filter:brightness(1.22) saturate(1.08)}
:root[data-theme="white"] .rate-track, :root[data-theme="white"] .top-duty-track, :root[data-theme="white"] .achievement-progress{background:#e4e4e4}
:root[data-theme="white"] .rate-track span, :root[data-theme="white"] .top-duty-track span{background:#b6a16b}
:root[data-theme="white"] .achievement-progress span{background:#b69a58}
:root[data-theme="white"] .content-tab.active{box-shadow:none}
:root[data-theme="light"] .history-tools>summary{color:#ebd9ba}
:root[data-theme="light"] .history-tools>summary:hover, :root[data-theme="light"] .history-tools[open]>summary{color:#fff0d2}
:root[data-theme="light"] .filter-grid select:focus, :root[data-theme="light"] .filter-grid input:focus{background:#f3e4c9;border-color:#a88752;box-shadow:inset 0 -2px #b88d4a,0 0 0 1px rgba(184,141,74,.12)}
:root[data-theme="light"] .achievement-card{background:#ead8b7}
:root[data-theme="light"] .achievement-card.achieved{background:#f0dfbd;border-color:#b88d4a}
:root[data-theme="light"] .achievement-state strong{background:#d8c8aa;color:#65513d}
:root[data-theme="light"] .achievement-card.achieved .achievement-state strong{background:#b88d4a;color:#fff8e9}
:root[data-theme="white"] .history-table tbody tr:nth-child(odd){background:rgba(255,255,255,.94)}
:root[data-theme="white"] .history-table tbody tr:nth-child(even){background:rgba(247,247,247,.96)}
:root[data-theme="white"] .history-table thead th{background:#e8e8e8;color:#333}
:root[data-theme="white"] .history-table tbody tr:hover{background:#ededed}
:root[data-theme="white"] .record-history.list-view{background:#fafafa;border-color:#d4d4d4}
:root[data-theme="white"] .record-item, :root[data-theme="white"] .empty-history, :root[data-theme="white"] .record-editor{background:rgba(250,250,250,.96)}
:root[data-theme="white"] table:not(.history-table) tbody tr{background:rgba(250,250,250,.94)}
:root[data-theme="white"] table:not(.history-table) th{background:#e9e9e9}
/* 页签滑块只负责装饰，不延迟实际切换 */
.content-tabs::before, .content-tab{transition:none}

/* 第五十一阶段：滑块即时响应、职能统计筛选与记录职能着色 */
/* 滑块动画保留；按钮状态和页面内容由点击事件立即更新，动画只负责装饰。 */
.content-tabs::before, .history-controls>.view-switch::before{transition:transform .24s cubic-bezier(.2,.75,.25,1),background-color .2s ease}
.content-tab{min-width:96px;transition:color .2s ease}
.content-tabs{width:max-content}
.history-controls>.view-switch .view-button{transition:color .2s ease}
/* 两段式视图切换保持原滑块，点击后不等待 transitionend。 */

/* 原生 select 的 focus/option 状态统一使用当前主题强调色，覆盖浏览器蓝色焦点环。 */
select:focus, select:focus-visible, .filter-grid select:focus, .filter-grid select:focus-visible{
  outline:2px solid var(--gold-dark)!important;outline-offset:1px;border-color:var(--gold-dark)!important;
  box-shadow:0 0 0 2px color-mix(in srgb,var(--gold-dark) 22%,transparent)!important;
}
select option{background:var(--panel-raised);color:var(--text)}
:root[data-theme="light"] select:focus, :root[data-theme="light"] .filter-grid select:focus{background:#f3e4c9;outline-color:#b88d4a!important;box-shadow:0 0 0 2px rgba(184,141,74,.2)!important}
:root[data-theme="white"] select:focus, :root[data-theme="white"] .filter-grid select:focus{background:#fff;outline-color:#b9a36c!important;box-shadow:0 0 0 2px rgba(185,163,108,.2)!important}

/* 职能切换：四色圆角分段按钮，默认/坦克/治疗/DPS。 */
.role-segment-switch{display:inline-flex;align-items:center;gap:5px;flex:0 0 auto}
.role-segment-switch button{width:15px;height:15px;min-width:15px;padding:0;border:2px solid rgba(255,255,255,.55);border-radius:50%;box-shadow:0 0 0 1px rgba(0,0,0,.16);background:#b49a62;cursor:pointer}
.role-segment-switch button[data-role="坦克"]{background:#315f9c}
.role-segment-switch button[data-role="治疗"]{background:#39845a}
.role-segment-switch button[data-role="DPS"]{background:#b94b4b}
.role-segment-switch button.active{outline:2px solid var(--gold-dark);outline-offset:2px;transform:scale(1.08)}
.statistics-section-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}
.duty-type-stat-card{transition:background-color .2s ease,border-color .2s ease}
.duty-type-stat-card[data-role-mode="坦克"]{background:color-mix(in srgb,#315f9c 13%,var(--panel));border-color:color-mix(in srgb,#315f9c 38%,var(--line))}
.duty-type-stat-card[data-role-mode="治疗"]{background:color-mix(in srgb,#39845a 13%,var(--panel));border-color:color-mix(in srgb,#39845a 38%,var(--line))}
.duty-type-stat-card[data-role-mode="DPS"]{background:color-mix(in srgb,#b94b4b 13%,var(--panel));border-color:color-mix(in srgb,#b94b4b 38%,var(--line))}

/* 记录着色开关：圆形三色按钮。 */
.record-role-color-button{width:25px;height:25px;min-width:25px;padding:3px;border-radius:50%;border:1px solid var(--line);background:var(--panel)!important;display:grid;place-items:center}
.record-role-color-button span{display:block;width:16px;height:16px;border-radius:50%;background:conic-gradient(#315f9c 0 33.333%,#39845a 33.333% 66.666%,#b94b4b 66.666% 100%)}
.record-role-color-button[aria-pressed="true"]{outline:2px solid var(--gold-dark);outline-offset:2px}
.record-history.card-view.role-color-enabled .record-item[data-role="坦克"]{background:color-mix(in srgb,#315f9c 24%,var(--panel));border-color:color-mix(in srgb,#315f9c 55%,var(--line))}
.record-history.card-view.role-color-enabled .record-item[data-role="治疗"]{background:color-mix(in srgb,#39845a 24%,var(--panel));border-color:color-mix(in srgb,#39845a 55%,var(--line))}
.record-history.card-view.role-color-enabled .record-item[data-role="DPS"]{background:color-mix(in srgb,#b94b4b 24%,var(--panel));border-color:color-mix(in srgb,#b94b4b 55%,var(--line))}
.record-history.role-color-enabled .history-table tr[data-role="坦克"]{background:color-mix(in srgb,#315f9c 9%,var(--panel))}
.record-history.role-color-enabled .history-table tr[data-role="治疗"]{background:color-mix(in srgb,#39845a 9%,var(--panel))}
.record-history.role-color-enabled .history-table tr[data-role="DPS"]{background:color-mix(in srgb,#b94b4b 9%,var(--panel))}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor{background:color-mix(in srgb,var(--panel) 84%,white);border-color:var(--line)}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) input, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) select, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) textarea{background:color-mix(in srgb,var(--panel-raised) 90%,white);color:var(--text);border-color:var(--line)}
:root[data-theme="light"] .record-history.card-view.role-color-enabled .record-item[data-role="坦克"]{background:rgba(91,139,194,.22)}
:root[data-theme="light"] .record-history.card-view.role-color-enabled .record-item[data-role="治疗"]{background:rgba(91,164,117,.22)}
:root[data-theme="light"] .record-history.card-view.role-color-enabled .record-item[data-role="DPS"]{background:rgba(194,105,105,.22)}
:root[data-theme="light"] .record-history.role-color-enabled .history-table tr[data-role="坦克"]{background:rgba(91,139,194,.09)}
:root[data-theme="light"] .record-history.role-color-enabled .history-table tr[data-role="治疗"]{background:rgba(91,164,117,.09)}
:root[data-theme="light"] .record-history.role-color-enabled .history-table tr[data-role="DPS"]{background:rgba(194,105,105,.09)}
:root[data-theme="white"] .record-history.card-view.role-color-enabled .record-item[data-role="坦克"]{background:rgba(75,126,187,.20)}
:root[data-theme="white"] .record-history.card-view.role-color-enabled .record-item[data-role="治疗"]{background:rgba(76,157,105,.20)}
:root[data-theme="white"] .record-history.card-view.role-color-enabled .record-item[data-role="DPS"]{background:rgba(190,87,87,.20)}
:root[data-theme="white"] .record-history.role-color-enabled .history-table tr[data-role="坦克"]{background:rgba(75,126,187,.08)}
:root[data-theme="white"] .record-history.role-color-enabled .history-table tr[data-role="治疗"]{background:rgba(76,157,105,.08)}
:root[data-theme="white"] .record-history.role-color-enabled .history-table tr[data-role="DPS"]{background:rgba(190,87,87,.08)}

/* 稳定的横向逐行卡片流：每行等高由内容自然撑开，间距固定，不做纵向瀑布填列。 */
.record-history.card-view{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,320px),1fr));grid-auto-flow:row;grid-auto-rows:auto;align-items:stretch;column-gap:12px;row-gap:12px}
.record-history.card-view>.record-item{height:100%;align-self:stretch;margin:0}
@media(max-width:600px){.statistics-section-heading{align-items:flex-start}.role-segment-switch{padding-top:3px}.record-role-color-button{width:24px;height:24px}}


/* 第五十二阶段修正：职能统计容器、记录着色、编辑器适配与响应式卡片布局。 */
/* 统计图容器必须随职能切换呈现清楚可辨的整块底色，而不是只有细边框变化。 */
.duty-type-stat-card{
  border-width: 1px;
  transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.duty-type-stat-card[data-role-mode="all"]{
  background: var(--panel);
  border-color: var(--line);
  box-shadow: var(--shadow);
}
.duty-type-stat-card[data-role-mode="坦克"]{
  background: color-mix(in srgb, #315f9c 42%, var(--panel));
  border-color: #527eaf;
  box-shadow: inset 0 0 0 1px rgba(76,130,190,.16), var(--shadow);
}
.duty-type-stat-card[data-role-mode="治疗"]{
  background: color-mix(in srgb, #39845a 42%, var(--panel));
  border-color: #579a70;
  box-shadow: inset 0 0 0 1px rgba(65,150,95,.16), var(--shadow);
}
.duty-type-stat-card[data-role-mode="DPS"]{
  background: color-mix(in srgb, #b94b4b 42%, var(--panel));
  border-color: #c16a6a;
  box-shadow: inset 0 0 0 1px rgba(190,70,70,.16), var(--shadow);
}

/* 下拉框焦点统一使用主题金色，避免 Chromium/系统默认蓝色焦点环。 */
:root select, :root select:focus, :root select:focus-visible, :root .filter-grid select:focus, :root .filter-grid select:focus-visible, :root .record-editor select:focus, :root .record-editor select:focus-visible{
  accent-color: var(--gold-dark) !important;
  outline: 2px solid var(--gold-dark) !important;
  outline-offset: 1px !important;
  border-color: var(--gold-dark) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold-dark) 24%, transparent) !important;
  -webkit-tap-highlight-color: color-mix(in srgb, var(--gold-dark) 22%, transparent);
}
:root[data-theme="light"] select:focus, :root[data-theme="light"] select:focus-visible{
  --gold-dark: #a77a35;
  background-color: #f3e4c9 !important;
}
:root[data-theme="white"] select:focus, :root[data-theme="white"] select:focus-visible{
  --gold-dark: #b49a58;
  background-color: #fff !important;
}

/* 按职能着色：卡片本身使用明确的深蓝、绿、红底色；三个主题均保证文字清晰。 */
.record-history.card-view.role-color-enabled .record-item[data-role="坦克"]{
  --role-card-bg: #234b78;
  --role-card-border: #527da9;
  background: var(--role-card-bg) !important;
  border-color: var(--role-card-border) !important;
  color: #f4f7fb !important;
}
.record-history.card-view.role-color-enabled .record-item[data-role="治疗"]{
  --role-card-bg: #245b43;
  --role-card-border: #579477;
  background: var(--role-card-bg) !important;
  border-color: var(--role-card-border) !important;
  color: #f2faf5 !important;
}
.record-history.card-view.role-color-enabled .record-item[data-role="DPS"]{
  --role-card-bg: #713b40;
  --role-card-border: #b36a70;
  background: var(--role-card-bg) !important;
  border-color: var(--role-card-border) !important;
  color: #fff5f5 !important;
}
.record-history.card-view.role-color-enabled .record-item[data-role="坦克"] .record-count, .record-history.card-view.role-color-enabled .record-item[data-role="治疗"] .record-count, .record-history.card-view.role-color-enabled .record-item[data-role="DPS"] .record-count, .record-history.card-view.role-color-enabled .record-item[data-role="坦克"] .record-date, .record-history.card-view.role-color-enabled .record-item[data-role="治疗"] .record-date, .record-history.card-view.role-color-enabled .record-item[data-role="DPS"] .record-date, .record-history.card-view.role-color-enabled .record-item[data-role="坦克"] .record-meta, .record-history.card-view.role-color-enabled .record-item[data-role="治疗"] .record-meta, .record-history.card-view.role-color-enabled .record-item[data-role="DPS"] .record-meta, .record-history.card-view.role-color-enabled .record-item[data-role="坦克"] .duty-name, .record-history.card-view.role-color-enabled .record-item[data-role="治疗"] .duty-name, .record-history.card-view.role-color-enabled .record-item[data-role="DPS"] .duty-name, .record-history.card-view.role-color-enabled .record-item[data-role="坦克"] .duty-level, .record-history.card-view.role-color-enabled .record-item[data-role="治疗"] .duty-level, .record-history.card-view.role-color-enabled .record-item[data-role="DPS"] .duty-level, .record-history.card-view.role-color-enabled .record-item[data-role="坦克"] .record-comment, .record-history.card-view.role-color-enabled .record-item[data-role="治疗"] .record-comment, .record-history.card-view.role-color-enabled .record-item[data-role="DPS"] .record-comment{
  color: #f4f6f8 !important;
}
.record-history.card-view.role-color-enabled .record-item[data-role="坦克"] .duty-type, .record-history.card-view.role-color-enabled .record-item[data-role="治疗"] .duty-type, .record-history.card-view.role-color-enabled .record-item[data-role="DPS"] .duty-type{
  color: #ffe2a0 !important;
}

/* 编辑器属于卡片的一部分：独立浅色工作区、深色文字、明确边界和完整宽度约束。 */
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor{
  display: grid;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  background: rgba(12, 19, 27, .38) !important;
  border: 1px solid rgba(255,255,255,.32) !important;
  border-radius: 4px;
  color: #fff;
  box-sizing: border-box;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor > label, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .edit-image-status, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .edit-existing-images{
  min-width: 0;
  color: #f5f6f8 !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor > label, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor > div, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .edit-match-wrap, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .edit-date-row{
  max-width: 100%;
  min-width: 0;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor input:not([type="file"]), .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor select, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor textarea, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor input[type="file"]{
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: #f8f9fb !important;
  color: #26313d !important;
  border: 1px solid #c3ccd6 !important;
  border-radius: 3px;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor input:focus, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor select:focus, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor textarea:focus{
  outline: 2px solid #d3b66d !important;
  outline-offset: 1px;
  box-shadow: 0 0 0 2px rgba(211,182,109,.22) !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .match-result, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .candidate-option{
  max-width: 100%;
  background: #f8f9fb !important;
  color: #26313d !important;
  border-color: #c3ccd6 !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .candidate-option:hover, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .candidate-option:focus{
  background: #e7edf4 !important;
  color: #172331 !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-edit-actions{
  display: flex;
  grid-column: 1 / -1;
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-edit-actions button{
  max-width: 100%;
  background: #e8edf2 !important;
  color: #26313d !important;
  border: 1px solid #b8c3ce !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-edit-actions .delete-record-button{
  background: #f4e3e3 !important;
  color: #8c2929 !important;
  border-color: #d9aaaa !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-edit-actions button:hover{
  filter: brightness(.95);
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .edit-calendar-button{
  flex: 0 0 38px;
  width: 38px;
  max-width: 38px;
  background: #e8edf2 !important;
  color: #26313d !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .edit-existing-images{
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .edit-image-label{
  grid-column: 1 / -1;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .edit-comment-label{
  grid-column: 1 / -1;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .edit-match-result{
  left: 0;
  right: 0;
  width: 100%;
  overflow-x: hidden;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .edit-date-row > input[type="text"]{
  flex: 1 1 0;
  width: 1%;
}

/* 100% 缩放约两列；缩小浏览器缩放后 CSS 视口变宽，可自然增加列数。 */
.page:has(.record-history.card-view){
  width: min(calc(100% - 40px), 2600px);
  max-width: 2600px;
}
.record-history.card-view{
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 600px), 1fr));
  grid-auto-flow: row;
  grid-auto-rows: auto;
  align-items: stretch;
  column-gap: 14px;
  row-gap: 14px;
}
.record-history.card-view > .record-item{
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  align-self: stretch;
  overflow: hidden;
  overflow-wrap: anywhere;
  box-sizing: border-box;
}
.record-history.card-view > .record-item > *{
  min-width: 0;
  max-width: 100%;
}
.record-history.card-view .record-editor{
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.record-history.card-view .record-editor > label, .record-history.card-view .record-editor .edit-match-wrap, .record-history.card-view .record-editor .edit-date-row, .record-history.card-view .record-editor input, .record-history.card-view .record-editor textarea, .record-history.card-view .record-editor select{
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
@media (max-width: 760px) {
  .page:has(.record-history.card-view){ width: min(calc(100% - 28px), 2600px); }
  .record-history.card-view{ grid-template-columns: minmax(0, 1fr); }
  .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor{ grid-template-columns: minmax(0, 1fr); }
  .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-edit-actions{ grid-column: 1; }
}

/* 第五十三阶段：真正的横向瀑布流。卡片保留各自自然高度，按 DOM 顺序逐行放置。 */
.record-history.card-view{
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 500px), 1fr)) !important;
  grid-auto-flow: row !important;
  grid-auto-rows: 4px !important;
  align-items: start !important;
  column-gap: 14px !important;
  row-gap: 12px !important;
}
.record-history.card-view > .record-item{
  height: auto !important;
  min-height: 0 !important;
  align-self: start !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  overflow: visible !important;
}
/* 100% 缩放下通常两列；浏览器缩放至 50% 后视口 CSS 宽度变大，自动增加列数。 */
.page:has(.record-history.card-view){
  width: min(calc(100% - 40px), 2600px) !important;
  max-width: 2600px !important;
}

/* 编辑器布局不依赖职能着色开关：开关只改变颜色，不改变字段排版。 */
.record-history.card-view .record-item .record-editor, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor{
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}
.record-history.card-view .record-item .record-editor > *, .record-history.card-view .record-item .record-editor label, .record-history.card-view .record-item .record-editor .edit-match-wrap, .record-history.card-view .record-item .record-editor .edit-date-row{
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}
.record-history.card-view .record-item .record-editor input, .record-history.card-view .record-item .record-editor select, .record-history.card-view .record-item .record-editor textarea, .record-history.card-view .record-item .record-editor button{
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}
.record-history.card-view .record-item .record-editor .edit-image-label, .record-history.card-view .record-item .record-editor .edit-comment-label, .record-history.card-view .record-item .record-editor .edit-existing-images, .record-history.card-view .record-item .record-editor .record-edit-actions{
  grid-column: 1 / -1 !important;
}
@media (max-width: 420px) {
  .record-history.card-view .record-item .record-editor, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor{
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .record-history.card-view .record-item .record-editor .edit-image-label, .record-history.card-view .record-item .record-editor .edit-comment-label, .record-history.card-view .record-item .record-editor .edit-existing-images, .record-history.card-view .record-item .record-editor .record-edit-actions{
    grid-column: 1 !important;
  }
}

/* 三种职能直接着色卡片；颜色开关不再改动编辑器结构。 */
.record-history.card-view.role-color-enabled .record-item[data-role="坦克"]{
  background: #234b78 !important;
  border-color: #527da9 !important;
  color: #f5f8fc !important;
  --role-control-bg: #f4f7fb;
  --role-control-text: #1d2b3b;
  --role-control-border: #aebed0;
}
.record-history.card-view.role-color-enabled .record-item[data-role="治疗"]{
  background: #245b43 !important;
  border-color: #579477 !important;
  color: #f3faf5 !important;
  --role-control-bg: #f3f8f4;
  --role-control-text: #20372a;
  --role-control-border: #b0c9b8;
}
.record-history.card-view.role-color-enabled .record-item[data-role="DPS"]{
  background: #713b40 !important;
  border-color: #b36a70 !important;
  color: #fff5f5 !important;
  --role-control-bg: #fff6f6;
  --role-control-text: #432629;
  --role-control-border: #d2b0b2;
}
.record-history.card-view.role-color-enabled .record-item[data-role="坦克"] .record-count, .record-history.card-view.role-color-enabled .record-item[data-role="治疗"] .record-count, .record-history.card-view.role-color-enabled .record-item[data-role="DPS"] .record-count, .record-history.card-view.role-color-enabled .record-item[data-role="坦克"] .record-date, .record-history.card-view.role-color-enabled .record-item[data-role="治疗"] .record-date, .record-history.card-view.role-color-enabled .record-item[data-role="DPS"] .record-date, .record-history.card-view.role-color-enabled .record-item[data-role="坦克"] .record-meta, .record-history.card-view.role-color-enabled .record-item[data-role="治疗"] .record-meta, .record-history.card-view.role-color-enabled .record-item[data-role="DPS"] .record-meta, .record-history.card-view.role-color-enabled .record-item[data-role="坦克"] .duty-name, .record-history.card-view.role-color-enabled .record-item[data-role="治疗"] .duty-name, .record-history.card-view.role-color-enabled .record-item[data-role="DPS"] .duty-name, .record-history.card-view.role-color-enabled .record-item[data-role="坦克"] .duty-level, .record-history.card-view.role-color-enabled .record-item[data-role="治疗"] .duty-level, .record-history.card-view.role-color-enabled .record-item[data-role="DPS"] .duty-level, .record-history.card-view.role-color-enabled .record-item[data-role="坦克"] .record-comment, .record-history.card-view.role-color-enabled .record-item[data-role="治疗"] .record-comment, .record-history.card-view.role-color-enabled .record-item[data-role="DPS"] .record-comment{
  color: #f5f7fa !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor{
  background: rgba(12, 19, 27, .30) !important;
  border: 1px solid rgba(255,255,255,.30) !important;
  color: #f8fafc !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor > label, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .edit-image-status, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .edit-existing-images{
  color: #f5f7fa !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor input:not([type="file"]), .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor select, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor textarea, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor input[type="file"]{
  background: var(--role-control-bg, #f7f8fa) !important;
  color: var(--role-control-text, #26313d) !important;
  border: 1px solid var(--role-control-border, #c3ccd6) !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor button, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-edit-actions button, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .edit-calendar-button{
  background: #e9eef3 !important;
  color: #263442 !important;
  border: 1px solid #b8c5d1 !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-edit-actions .delete-record-button{
  background: #f6e6e6 !important;
  color: #872d32 !important;
  border-color: #d8aeb0 !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .match-result, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .candidate-option{
  background: #f7f9fb !important;
  color: #263442 !important;
  border-color: #c3ccd6 !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .candidate-option:hover, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .candidate-option:focus{
  background: #e4ebf2 !important;
  color: #1e2b38 !important;
}

/* 撤销此前误加的全局金色焦点大边框；筛选弹出框恢复原本干净的主题样式。 */
:root .filter-grid select:focus, :root .filter-grid select:focus-visible{
  outline: none !important;
  outline-offset: 0 !important;
  box-shadow: none !important;
  -webkit-tap-highlight-color: transparent !important;
}
:root[data-theme="white"] .filter-grid select:focus, :root[data-theme="white"] .filter-grid select:focus-visible{
  background: rgba(255,255,255,.96) !important;
  border-color: rgba(155,155,155,.58) !important;
}

/* 第五十四阶段：三个主题统一的职能统计配色、完整记录控件适配与跳转高亮。 */
/* 副本类型占比：浅色与透明白也必须显示整块职能底色。 */
:root[data-theme="light"] .duty-type-stat-card[data-role-mode="坦克"]{
  background: linear-gradient(135deg, rgba(65,116,174,.34), rgba(65,116,174,.19)), var(--panel) !important;
  border-color: rgba(54,103,158,.62) !important;
}
:root[data-theme="light"] .duty-type-stat-card[data-role-mode="治疗"]{
  background: linear-gradient(135deg, rgba(61,139,91,.34), rgba(61,139,91,.19)), var(--panel) !important;
  border-color: rgba(48,119,76,.62) !important;
}
:root[data-theme="light"] .duty-type-stat-card[data-role-mode="DPS"]{
  background: linear-gradient(135deg, rgba(183,75,75,.34), rgba(183,75,75,.19)), var(--panel) !important;
  border-color: rgba(157,55,55,.62) !important;
}
:root[data-theme="white"] .duty-type-stat-card[data-role-mode="坦克"]{
  background: linear-gradient(135deg, rgba(65,116,174,.27), rgba(65,116,174,.13)), rgba(255,255,255,.82) !important;
  border-color: rgba(54,103,158,.52) !important;
}
:root[data-theme="white"] .duty-type-stat-card[data-role-mode="治疗"]{
  background: linear-gradient(135deg, rgba(61,139,91,.27), rgba(61,139,91,.13)), rgba(255,255,255,.82) !important;
  border-color: rgba(48,119,76,.52) !important;
}
:root[data-theme="white"] .duty-type-stat-card[data-role-mode="DPS"]{
  background: linear-gradient(135deg, rgba(183,75,75,.27), rgba(183,75,75,.13)), rgba(255,255,255,.82) !important;
  border-color: rgba(157,55,55,.52) !important;
}

/* 专项统计卡片与副本类型占比使用同一职能色阶。 */
.roulette-rate-card{ transition: background .2s ease, border-color .2s ease, box-shadow .2s ease; }
:root[data-theme="dark"] .roulette-rate-card[data-role-mode="坦克"]{ background:linear-gradient(135deg,rgba(49,95,156,.28),rgba(49,95,156,.12)),var(--panel); border-color:rgba(82,126,175,.58); }
:root[data-theme="dark"] .roulette-rate-card[data-role-mode="治疗"]{ background:linear-gradient(135deg,rgba(57,132,90,.28),rgba(57,132,90,.12)),var(--panel); border-color:rgba(87,154,112,.58); }
:root[data-theme="dark"] .roulette-rate-card[data-role-mode="DPS"]{ background:linear-gradient(135deg,rgba(185,75,75,.28),rgba(185,75,75,.12)),var(--panel); border-color:rgba(193,106,106,.58); }
:root[data-theme="light"] .roulette-rate-card[data-role-mode="坦克"]{ background:linear-gradient(135deg,rgba(65,116,174,.34),rgba(65,116,174,.18)),var(--panel); border-color:rgba(54,103,158,.62); }
:root[data-theme="light"] .roulette-rate-card[data-role-mode="治疗"]{ background:linear-gradient(135deg,rgba(61,139,91,.34),rgba(61,139,91,.18)),var(--panel); border-color:rgba(48,119,76,.62); }
:root[data-theme="light"] .roulette-rate-card[data-role-mode="DPS"]{ background:linear-gradient(135deg,rgba(183,75,75,.34),rgba(183,75,75,.18)),var(--panel); border-color:rgba(157,55,55,.62); }
:root[data-theme="white"] .roulette-rate-card[data-role-mode="坦克"]{ background:linear-gradient(135deg,rgba(65,116,174,.27),rgba(65,116,174,.13)),rgba(255,255,255,.82); border-color:rgba(54,103,158,.52); }
:root[data-theme="white"] .roulette-rate-card[data-role-mode="治疗"]{ background:linear-gradient(135deg,rgba(61,139,91,.27),rgba(61,139,91,.13)),rgba(255,255,255,.82); border-color:rgba(48,119,76,.52); }
:root[data-theme="white"] .roulette-rate-card[data-role-mode="DPS"]{ background:linear-gradient(135deg,rgba(183,75,75,.27),rgba(183,75,75,.13)),rgba(255,255,255,.82); border-color:rgba(157,55,55,.52); }

/* 着色模式下，编辑按钮、编辑器及其所有交互控件统一适配当前职能色。 */
.record-history.card-view.role-color-enabled .record-item[data-role="坦克"]{ --role-accent:#527eaf; --role-control-border:#9eb6d0; --role-control-focus:#527eaf; --role-action-bg:#dce8f4; --role-action-text:#203b58; }
.record-history.card-view.role-color-enabled .record-item[data-role="治疗"]{ --role-accent:#579a70; --role-control-border:#a5c7b0; --role-control-focus:#579a70; --role-action-bg:#dceee2; --role-action-text:#244a32; }
.record-history.card-view.role-color-enabled .record-item[data-role="DPS"]{ --role-accent:#c16a6a; --role-control-border:#d6aaaa; --role-control-focus:#b94b4b; --role-action-bg:#f4dfdf; --role-action-text:#642d32; }
.record-history.card-view.role-color-enabled .record-item .record-edit-button, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-edit-actions button, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .edit-calendar-button, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .edit-clear-images{
  background:var(--role-action-bg,#e8edf2) !important;
  color:var(--role-action-text,#26313d) !important;
  border:1px solid var(--role-accent,#9aa8b5) !important;
  box-shadow:inset 0 1px rgba(255,255,255,.42) !important;
}
.record-history.card-view.role-color-enabled .record-item .record-edit-button:hover, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-edit-actions button:hover, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .edit-calendar-button:hover, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .edit-clear-images:hover{ filter:brightness(.94); }
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor input:not([type="file"]), .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor select, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor textarea, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .match-result, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .candidate-option{
  background:#fbfcfd !important;
  color:#26313d !important;
  border:1px solid var(--role-control-border,#c3ccd6) !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor input:focus, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor select:focus, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor textarea:focus, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .candidate-option:focus{
  outline:2px solid var(--role-control-focus,#9aa8b5) !important;
  outline-offset:1px;
  box-shadow:0 0 0 2px color-mix(in srgb,var(--role-control-focus,#9aa8b5) 22%,transparent) !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .candidate-option:hover{ background:#eaf0f6 !important; }
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .edit-image-label, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .edit-comment-label{ color:#f6f8fb !important; }
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-edit-actions .delete-record-button{ background:#f6e5e5 !important; color:#842f35 !important; border-color:#d5a4a8 !important; }

/* 列表着色提高可见度，深色模式不再接近无色；表格文字仍继承主题前景色。 */
:root[data-theme="dark"] .record-history.role-color-enabled .history-table tr[data-role="坦克"]{ background:rgba(49,95,156,.23) !important; }
:root[data-theme="dark"] .record-history.role-color-enabled .history-table tr[data-role="治疗"]{ background:rgba(57,132,90,.23) !important; }
:root[data-theme="dark"] .record-history.role-color-enabled .history-table tr[data-role="DPS"]{ background:rgba(185,75,75,.23) !important; }
:root[data-theme="light"] .record-history.role-color-enabled .history-table tr[data-role="坦克"]{ background:rgba(65,116,174,.23) !important; }
:root[data-theme="light"] .record-history.role-color-enabled .history-table tr[data-role="治疗"]{ background:rgba(61,139,91,.23) !important; }
:root[data-theme="light"] .record-history.role-color-enabled .history-table tr[data-role="DPS"]{ background:rgba(183,75,75,.23) !important; }
:root[data-theme="white"] .record-history.role-color-enabled .history-table tr[data-role="坦克"]{ background:rgba(65,116,174,.19) !important; }
:root[data-theme="white"] .record-history.role-color-enabled .history-table tr[data-role="治疗"]{ background:rgba(61,139,91,.19) !important; }
:root[data-theme="white"] .record-history.role-color-enabled .history-table tr[data-role="DPS"]{ background:rgba(183,75,75,.19) !important; }

/* 双击跳转高亮跟随当前职能色；未开启职能着色时仍使用主题默认高亮。 */
.record-history.card-view.role-color-enabled .record-item[data-role="坦克"]{ --jump-highlight:rgba(111,166,225,.62); }
.record-history.card-view.role-color-enabled .record-item[data-role="治疗"]{ --jump-highlight:rgba(105,190,135,.62); }
.record-history.card-view.role-color-enabled .record-item[data-role="DPS"]{ --jump-highlight:rgba(224,120,120,.62); }
:root[data-theme="dark"] .record-history.role-color-enabled .history-table tr[data-role="坦克"] > td{ --jump-highlight:rgba(111,166,225,.55); }
:root[data-theme="dark"] .record-history.role-color-enabled .history-table tr[data-role="治疗"] > td{ --jump-highlight:rgba(105,190,135,.55); }
:root[data-theme="dark"] .record-history.role-color-enabled .history-table tr[data-role="DPS"] > td{ --jump-highlight:rgba(224,120,120,.55); }
:root[data-theme="light"] .record-history.card-view.role-color-enabled .record-item[data-role="坦克"]{ --jump-highlight:rgba(65,116,174,.35); }
:root[data-theme="light"] .record-history.card-view.role-color-enabled .record-item[data-role="治疗"]{ --jump-highlight:rgba(61,139,91,.35); }
:root[data-theme="light"] .record-history.card-view.role-color-enabled .record-item[data-role="DPS"]{ --jump-highlight:rgba(183,75,75,.35); }
:root[data-theme="white"] .record-history.card-view.role-color-enabled .record-item[data-role="坦克"]{ --jump-highlight:rgba(65,116,174,.29); }
:root[data-theme="white"] .record-history.card-view.role-color-enabled .record-item[data-role="治疗"]{ --jump-highlight:rgba(61,139,91,.29); }
:root[data-theme="white"] .record-history.card-view.role-color-enabled .record-item[data-role="DPS"]{ --jump-highlight:rgba(183,75,75,.29); }

/* 卡片职能底色加入克制的斜向渐变：保留明确蓝/绿/红色相，不改变内容布局。 */
:root[data-theme="dark"] .record-history.card-view.role-color-enabled .record-item[data-role="坦克"]{ background:linear-gradient(145deg,#315f91 0%,#234b78 58%,#1d4169 100%) !important; }
:root[data-theme="dark"] .record-history.card-view.role-color-enabled .record-item[data-role="治疗"]{ background:linear-gradient(145deg,#347a57 0%,#245b43 58%,#1d4c37 100%) !important; }
:root[data-theme="dark"] .record-history.card-view.role-color-enabled .record-item[data-role="DPS"]{ background:linear-gradient(145deg,#914b50 0%,#713b40 58%,#603238 100%) !important; }
:root[data-theme="light"] .record-history.card-view.role-color-enabled .record-item[data-role="坦克"]{ background:linear-gradient(145deg,rgba(91,139,194,.46),rgba(91,139,194,.27)) !important; }
:root[data-theme="light"] .record-history.card-view.role-color-enabled .record-item[data-role="治疗"]{ background:linear-gradient(145deg,rgba(91,164,117,.46),rgba(91,164,117,.27)) !important; }
:root[data-theme="light"] .record-history.card-view.role-color-enabled .record-item[data-role="DPS"]{ background:linear-gradient(145deg,rgba(194,105,105,.46),rgba(194,105,105,.27)) !important; }
:root[data-theme="white"] .record-history.card-view.role-color-enabled .record-item[data-role="坦克"]{ background:linear-gradient(145deg,rgba(75,126,187,.37),rgba(75,126,187,.21)) !important; }
:root[data-theme="white"] .record-history.card-view.role-color-enabled .record-item[data-role="治疗"]{ background:linear-gradient(145deg,rgba(76,157,105,.37),rgba(76,157,105,.21)) !important; }
:root[data-theme="white"] .record-history.card-view.role-color-enabled .record-item[data-role="DPS"]{ background:linear-gradient(145deg,rgba(190,87,87,.37),rgba(190,87,87,.21)) !important; }

/* 第五十五阶段：三主题职能配色精修。
   目标：职能色贯穿卡片、编辑操作区和表单控件；统计卡片三主题规则统一。 */

/* 卡片本体：三种主题都保留明确的蓝/绿/红渐变，浅色与透明白提高色相辨识度。 */
:root[data-theme="dark"] .record-history.card-view.role-color-enabled .record-item[data-role="坦克"]{
  background:linear-gradient(145deg,#315f91 0%,#234b78 58%,#1d4169 100%) !important;
  border-color:#527eaf !important;
}
:root[data-theme="dark"] .record-history.card-view.role-color-enabled .record-item[data-role="治疗"]{
  background:linear-gradient(145deg,#347a57 0%,#245b43 58%,#1d4c37 100%) !important;
  border-color:#579a70 !important;
}
:root[data-theme="dark"] .record-history.card-view.role-color-enabled .record-item[data-role="DPS"]{
  background:linear-gradient(145deg,#914b50 0%,#713b40 58%,#603238 100%) !important;
  border-color:#c16a6a !important;
}
:root[data-theme="light"] .record-history.card-view.role-color-enabled .record-item[data-role="坦克"]{
  background:linear-gradient(145deg,#dce9f7 0%,#c9dbef 58%,#bed3eb 100%) !important;
  border-color:#7b9fc8 !important;
}
:root[data-theme="light"] .record-history.card-view.role-color-enabled .record-item[data-role="治疗"]{
  background:linear-gradient(145deg,#dcefe2 0%,#c8e3d1 58%,#b9d9c5 100%) !important;
  border-color:#78aa89 !important;
}
:root[data-theme="light"] .record-history.card-view.role-color-enabled .record-item[data-role="DPS"]{
  background:linear-gradient(145deg,#f3dddd 0%,#eacaca 58%,#e2baba 100%) !important;
  border-color:#c88787 !important;
}
:root[data-theme="white"] .record-history.card-view.role-color-enabled .record-item[data-role="坦克"]{
  background:linear-gradient(145deg,rgba(103,151,204,.42) 0%,rgba(103,151,204,.30) 58%,rgba(103,151,204,.23) 100%) !important;
  border-color:rgba(65,112,169,.72) !important;
}
:root[data-theme="white"] .record-history.card-view.role-color-enabled .record-item[data-role="治疗"]{
  background:linear-gradient(145deg,rgba(101,169,123,.40) 0%,rgba(101,169,123,.28) 58%,rgba(101,169,123,.21) 100%) !important;
  border-color:rgba(58,126,81,.70) !important;
}
:root[data-theme="white"] .record-history.card-view.role-color-enabled .record-item[data-role="DPS"]{
  background:linear-gradient(145deg,rgba(198,112,112,.40) 0%,rgba(198,112,112,.28) 58%,rgba(198,112,112,.21) 100%) !important;
  border-color:rgba(158,70,70,.70) !important;
}

/* 编辑按钮与编辑操作按钮：不再使用白色填充，直接采用对应职能色的按钮色阶。 */
:root[data-theme="dark"] .record-history.card-view.role-color-enabled .record-item[data-role="坦克"]{ --role-btn-bg:#315f91; --role-btn-hover:#3c70a8; --role-btn-text:#f4f8ff; --role-input-bg:#183653; --role-input-text:#f2f6fc; --role-input-border:#668db8; --role-placeholder:#c1d1e2; }
:root[data-theme="dark"] .record-history.card-view.role-color-enabled .record-item[data-role="治疗"]{ --role-btn-bg:#347a57; --role-btn-hover:#408d65; --role-btn-text:#f3fff6; --role-input-bg:#183f2d; --role-input-text:#f1faf3; --role-input-border:#69a780; --role-placeholder:#c1ddca; }
:root[data-theme="dark"] .record-history.card-view.role-color-enabled .record-item[data-role="DPS"]{ --role-btn-bg:#914b50; --role-btn-hover:#a65a60; --role-btn-text:#fff5f5; --role-input-bg:#492a30; --role-input-text:#fff4f4; --role-input-border:#c17b80; --role-placeholder:#e4c5c7; }
:root[data-theme="light"] .record-history.card-view.role-color-enabled .record-item[data-role="坦克"]{ --role-btn-bg:#789bc3; --role-btn-hover:#668bb7; --role-btn-text:#102b49; --role-input-bg:#eaf2fb; --role-input-text:#1c344e; --role-input-border:#8eadd0; --role-placeholder:#647f9e; }
:root[data-theme="light"] .record-history.card-view.role-color-enabled .record-item[data-role="治疗"]{ --role-btn-bg:#80ad8d; --role-btn-hover:#6e9e7c; --role-btn-text:#173b25; --role-input-bg:#eaf5ed; --role-input-text:#21432c; --role-input-border:#91b99c; --role-placeholder:#64846d; }
:root[data-theme="light"] .record-history.card-view.role-color-enabled .record-item[data-role="DPS"]{ --role-btn-bg:#c88c8c; --role-btn-hover:#b97878; --role-btn-text:#4c2024; --role-input-bg:#faeeee; --role-input-text:#4c292c; --role-input-border:#d4a0a0; --role-placeholder:#94676a; }
:root[data-theme="white"] .record-history.card-view.role-color-enabled .record-item[data-role="坦克"]{ --role-btn-bg:#4779ad; --role-btn-hover:#386b9f; --role-btn-text:#fff; --role-input-bg:rgba(218,233,249,.92); --role-input-text:#183653; --role-input-border:#7199c2; --role-placeholder:#587797; }
:root[data-theme="white"] .record-history.card-view.role-color-enabled .record-item[data-role="治疗"]{ --role-btn-bg:#4e8a62; --role-btn-hover:#407b54; --role-btn-text:#fff; --role-input-bg:rgba(219,239,225,.94); --role-input-text:#1c432b; --role-input-border:#78a987; --role-placeholder:#557c60; }
:root[data-theme="white"] .record-history.card-view.role-color-enabled .record-item[data-role="DPS"]{ --role-btn-bg:#a9555b; --role-btn-hover:#98464c; --role-btn-text:#fff; --role-input-bg:rgba(246,222,222,.94); --role-input-text:#54272b; --role-input-border:#c78387; --role-placeholder:#956267; }

.record-history.card-view.role-color-enabled .record-item .record-edit-button, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-edit-actions button, .record-history.card-view.role-color-enabled .record-item .card-record-actions button, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .edit-calendar-button, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .edit-clear-images{
  background:var(--role-btn-bg) !important;
  color:var(--role-btn-text) !important;
  border:1px solid var(--role-input-border) !important;
  box-shadow:inset 0 1px rgba(255,255,255,.20),0 1px 2px rgba(0,0,0,.12) !important;
}
.record-history.card-view.role-color-enabled .record-item .record-edit-button:hover, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-edit-actions button:hover, .record-history.card-view.role-color-enabled .record-item .card-record-actions button:hover, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .edit-calendar-button:hover, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .edit-clear-images:hover{
  background:var(--role-btn-hover) !important;
  filter:none !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor input:not([type="file"]), .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor select, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor textarea, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .match-result, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .candidate-option{
  background:var(--role-input-bg) !important;
  color:var(--role-input-text) !important;
  border:1px solid var(--role-input-border) !important;
  color-scheme:normal;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor input::placeholder, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor textarea::placeholder{
  color:var(--role-placeholder) !important;
  opacity:1;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor input:focus, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor select:focus, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor textarea:focus, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .candidate-option:focus{
  outline:2px solid var(--role-input-border) !important;
  outline-offset:1px;
  box-shadow:0 0 0 2px color-mix(in srgb,var(--role-input-border) 24%,transparent) !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .candidate-option:hover, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .match-result:hover{
  background:var(--role-btn-bg) !important;
  color:var(--role-btn-text) !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor input[type="file"]{
  background:var(--role-input-bg) !important;
  color:var(--role-input-text) !important;
  border:1px solid var(--role-input-border) !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-edit-actions .delete-record-button{
  background:var(--role-btn-bg) !important;
  color:var(--role-btn-text) !important;
  border-color:var(--role-input-border) !important;
}

/* 统计卡片统一规则：深色保持原有职能卡片；浅色使用中性底色+职能外框；透明白使用无渐变的浅色职能底。 */
:root[data-theme="light"] .duty-type-stat-card[data-role-mode="坦克"], :root[data-theme="light"] .roulette-rate-card[data-role-mode="坦克"]{
  background:var(--panel) !important; border:2px solid #4779ad !important;
  box-shadow:inset 0 0 0 1px rgba(71,121,173,.12),var(--shadow) !important;
}
:root[data-theme="light"] .duty-type-stat-card[data-role-mode="治疗"], :root[data-theme="light"] .roulette-rate-card[data-role-mode="治疗"]{
  background:var(--panel) !important; border:2px solid #4e8a62 !important;
  box-shadow:inset 0 0 0 1px rgba(78,138,98,.12),var(--shadow) !important;
}
:root[data-theme="light"] .duty-type-stat-card[data-role-mode="DPS"], :root[data-theme="light"] .roulette-rate-card[data-role-mode="DPS"]{
  background:var(--panel) !important; border:2px solid #a9555b !important;
  box-shadow:inset 0 0 0 1px rgba(169,85,91,.12),var(--shadow) !important;
}
:root[data-theme="white"] .duty-type-stat-card[data-role-mode="坦克"], :root[data-theme="white"] .roulette-rate-card[data-role-mode="坦克"]{
  background:rgba(103,151,204,.24) !important; border:1px solid rgba(65,112,169,.58) !important;
  box-shadow:0 2px 8px rgba(0,0,0,.045) !important;
}
:root[data-theme="white"] .duty-type-stat-card[data-role-mode="治疗"], :root[data-theme="white"] .roulette-rate-card[data-role-mode="治疗"]{
  background:rgba(101,169,123,.23) !important; border:1px solid rgba(58,126,81,.56) !important;
  box-shadow:0 2px 8px rgba(0,0,0,.045) !important;
}
:root[data-theme="white"] .duty-type-stat-card[data-role-mode="DPS"], :root[data-theme="white"] .roulette-rate-card[data-role-mode="DPS"]{
  background:rgba(198,112,112,.23) !important; border:1px solid rgba(158,70,70,.56) !important;
  box-shadow:0 2px 8px rgba(0,0,0,.045) !important;
}

/* 编辑器标签、图片状态文字与原生下拉选项也继承当前职能色系。 */
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor > label, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .edit-image-status, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .edit-existing-images, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .edit-existing-images span{
  color:var(--role-input-text) !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor select option{
  background:var(--role-input-bg) !important;
  color:var(--role-input-text) !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor button:focus-visible, .record-history.card-view.role-color-enabled .record-item .record-edit-button:focus-visible{
  outline:2px solid var(--role-input-border) !important;
  outline-offset:2px;
}

/* 第五十六阶段：恢复三主题一致的深色职能卡片，并统一两类统计容器样式。
   记录卡片在浅色、透明白主题下也使用与深色主题相同的蓝/绿/红实色渐变；
   卡片文字和编辑区控件同步采用深色职能配色，避免浅底白字及白色表单控件。 */
:root[data-theme="light"] .record-history.card-view.role-color-enabled .record-item[data-role="坦克"], :root[data-theme="white"] .record-history.card-view.role-color-enabled .record-item[data-role="坦克"]{
  background:linear-gradient(145deg,#315f91 0%,#234b78 58%,#1d4169 100%) !important;
  border-color:#527eaf !important;
}
:root[data-theme="light"] .record-history.card-view.role-color-enabled .record-item[data-role="治疗"], :root[data-theme="white"] .record-history.card-view.role-color-enabled .record-item[data-role="治疗"]{
  background:linear-gradient(145deg,#347a57 0%,#245b43 58%,#1d4c37 100%) !important;
  border-color:#579a70 !important;
}
:root[data-theme="light"] .record-history.card-view.role-color-enabled .record-item[data-role="DPS"], :root[data-theme="white"] .record-history.card-view.role-color-enabled .record-item[data-role="DPS"]{
  background:linear-gradient(145deg,#914b50 0%,#713b40 58%,#603238 100%) !important;
  border-color:#c16a6a !important;
}

/* 所有主题下的卡片文字均使用适配深色职能底色的高对比浅色。 */
.record-history.card-view.role-color-enabled .record-item[data-role="坦克"], .record-history.card-view.role-color-enabled .record-item[data-role="治疗"], .record-history.card-view.role-color-enabled .record-item[data-role="DPS"]{
  color:#f5f7fa !important;
}
.record-history.card-view.role-color-enabled .record-item[data-role="坦克"] .record-date, .record-history.card-view.role-color-enabled .record-item[data-role="治疗"] .record-date, .record-history.card-view.role-color-enabled .record-item[data-role="DPS"] .record-date, .record-history.card-view.role-color-enabled .record-item[data-role="坦克"] .record-meta, .record-history.card-view.role-color-enabled .record-item[data-role="治疗"] .record-meta, .record-history.card-view.role-color-enabled .record-item[data-role="DPS"] .record-meta, .record-history.card-view.role-color-enabled .record-item[data-role="坦克"] .duty-name, .record-history.card-view.role-color-enabled .record-item[data-role="治疗"] .duty-name, .record-history.card-view.role-color-enabled .record-item[data-role="DPS"] .duty-name, .record-history.card-view.role-color-enabled .record-item[data-role="坦克"] .duty-level, .record-history.card-view.role-color-enabled .record-item[data-role="治疗"] .duty-level, .record-history.card-view.role-color-enabled .record-item[data-role="DPS"] .duty-level, .record-history.card-view.role-color-enabled .record-item[data-role="坦克"] .record-comment, .record-history.card-view.role-color-enabled .record-item[data-role="治疗"] .record-comment, .record-history.card-view.role-color-enabled .record-item[data-role="DPS"] .record-comment{
  color:#f5f7fa !important;
}

/* 编辑按钮、保存/取消/删除按钮和编辑表单：三个主题共用同一套深色职能色阶。 */
.record-history.card-view.role-color-enabled .record-item[data-role="坦克"]{ --role-btn-bg:#315f91; --role-btn-hover:#3c70a8; --role-btn-text:#f4f8ff; --role-input-bg:#183653; --role-input-text:#f2f6fc; --role-input-border:#668db8; --role-placeholder:#c1d1e2; }
.record-history.card-view.role-color-enabled .record-item[data-role="治疗"]{ --role-btn-bg:#347a57; --role-btn-hover:#408d65; --role-btn-text:#f3fff6; --role-input-bg:#183f2d; --role-input-text:#f1faf3; --role-input-border:#69a780; --role-placeholder:#c1ddca; }
.record-history.card-view.role-color-enabled .record-item[data-role="DPS"]{ --role-btn-bg:#914b50; --role-btn-hover:#a65a60; --role-btn-text:#fff5f5; --role-input-bg:#492a30; --role-input-text:#fff4f4; --role-input-border:#c17b80; --role-placeholder:#e4c5c7; }
.record-history.card-view.role-color-enabled .record-item .record-edit-button, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-edit-actions button, .record-history.card-view.role-color-enabled .record-item .card-record-actions button, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .edit-calendar-button, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .edit-clear-images{
  background:var(--role-btn-bg) !important;
  color:var(--role-btn-text) !important;
  border:1px solid var(--role-input-border) !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor{
  background:rgba(10,17,25,.42) !important;
  border-color:rgba(255,255,255,.24) !important;
  color:#f5f7fa !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor > label, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .edit-image-status, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .edit-existing-images, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .edit-existing-images span{
  color:#f5f7fa !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor input:not([type="file"]), .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor select, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor textarea, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor input[type="file"], .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .match-result, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .candidate-option, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor select option{
  background:var(--role-input-bg) !important;
  color:var(--role-input-text) !important;
  border-color:var(--role-input-border) !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor input::placeholder, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor textarea::placeholder{
  color:var(--role-placeholder) !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor input:focus, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor select:focus, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor textarea:focus, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .candidate-option:focus{
  outline:2px solid var(--role-input-border) !important;
  outline-offset:1px;
  box-shadow:0 0 0 2px color-mix(in srgb,var(--role-input-border) 28%,transparent) !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .candidate-option:hover, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .match-result:hover{
  background:var(--role-btn-hover) !important;
  color:var(--role-btn-text) !important;
}

/* 统计卡片：深色主题下专项统计与副本类型占比完全采用同一种“主题底色+职能色外框”样式。
   浅色主题继续使用职能色外框；透明白主题保留浅色职能底色，但不使用渐变。 */
:root[data-theme="dark"] .duty-type-stat-card[data-role-mode="坦克"], :root[data-theme="dark"] .roulette-rate-card[data-role-mode="坦克"]{
  background:var(--panel) !important;
  border:1px solid #527eaf !important;
  box-shadow:inset 0 0 0 1px rgba(82,126,175,.14),var(--shadow) !important;
}
:root[data-theme="dark"] .duty-type-stat-card[data-role-mode="治疗"], :root[data-theme="dark"] .roulette-rate-card[data-role-mode="治疗"]{
  background:var(--panel) !important;
  border:1px solid #579a70 !important;
  box-shadow:inset 0 0 0 1px rgba(87,154,112,.14),var(--shadow) !important;
}
:root[data-theme="dark"] .duty-type-stat-card[data-role-mode="DPS"], :root[data-theme="dark"] .roulette-rate-card[data-role-mode="DPS"]{
  background:var(--panel) !important;
  border:1px solid #c16a6a !important;
  box-shadow:inset 0 0 0 1px rgba(193,106,106,.14),var(--shadow) !important;
}
:root[data-theme="light"] .duty-type-stat-card[data-role-mode="坦克"], :root[data-theme="light"] .roulette-rate-card[data-role-mode="坦克"]{ background:var(--panel) !important; border:2px solid #4779ad !important; }
:root[data-theme="light"] .duty-type-stat-card[data-role-mode="治疗"], :root[data-theme="light"] .roulette-rate-card[data-role-mode="治疗"]{ background:var(--panel) !important; border:2px solid #4e8a62 !important; }
:root[data-theme="light"] .duty-type-stat-card[data-role-mode="DPS"], :root[data-theme="light"] .roulette-rate-card[data-role-mode="DPS"]{ background:var(--panel) !important; border:2px solid #a9555b !important; }
:root[data-theme="white"] .duty-type-stat-card[data-role-mode="坦克"], :root[data-theme="white"] .roulette-rate-card[data-role-mode="坦克"]{ background:rgba(103,151,204,.24) !important; border:1px solid rgba(65,112,169,.58) !important; }
:root[data-theme="white"] .duty-type-stat-card[data-role-mode="治疗"], :root[data-theme="white"] .roulette-rate-card[data-role-mode="治疗"]{ background:rgba(101,169,123,.23) !important; border:1px solid rgba(58,126,81,.56) !important; }
:root[data-theme="white"] .duty-type-stat-card[data-role-mode="DPS"], :root[data-theme="white"] .roulette-rate-card[data-role-mode="DPS"]{ background:rgba(198,112,112,.23) !important; border:1px solid rgba(158,70,70,.56) !important; }

/* 第五十七阶段（从第五十六阶段回退基线制作）：职能控件、编辑图标与列表双击适配。 */
.record-history.card-view.role-color-enabled .record-item[data-role="坦克"]{
  --role-btn-bg:#315f91; --role-btn-hover:#3c70a8; --role-btn-text:#f4f8ff;
  --role-input-bg:#183653; --role-input-text:#f2f6fc; --role-input-border:#668db8; --role-placeholder:#c1d1e2;
}
.record-history.card-view.role-color-enabled .record-item[data-role="治疗"]{
  --role-btn-bg:#347a57; --role-btn-hover:#408d65; --role-btn-text:#f3fff6;
  --role-input-bg:#183f2d; --role-input-text:#f1faf3; --role-input-border:#69a780; --role-placeholder:#c1ddca;
}
.record-history.card-view.role-color-enabled .record-item[data-role="DPS"]{
  --role-btn-bg:#914b50; --role-btn-hover:#a65a60; --role-btn-text:#fff5f5;
  --role-input-bg:#492a30; --role-input-text:#fff4f4; --role-input-border:#c17b80; --role-placeholder:#e4c5c7;
}

/* 日期按钮、编辑按钮、编辑操作按钮统一使用当前记录的职能色。 */
.record-history.card-view.role-color-enabled .record-item .record-edit-button, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-edit-actions button, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .edit-calendar-button, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .edit-clear-images{
  background:var(--role-btn-bg) !important;
  color:var(--role-btn-text) !important;
  border:1px solid var(--role-input-border) !important;
}
.record-history.card-view.role-color-enabled .record-item .record-edit-button:hover, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-edit-actions button:hover, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .edit-calendar-button:hover, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .edit-clear-images:hover{
  background:var(--role-btn-hover) !important;
  color:var(--role-btn-text) !important;
  filter:none !important;
}

/* 编辑器所有输入控件（含职业/副本搜索、原生下拉、日期与文件选择）统一深色职能控件配色。 */
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor input:not([type="hidden"]), .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor select, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor textarea, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .match-result, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .edit-match-result, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .candidate-option, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor select option{
  background:var(--role-input-bg) !important;
  color:var(--role-input-text) !important;
  border-color:var(--role-input-border) !important;
  color-scheme:dark;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor input::placeholder, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor textarea::placeholder{
  color:var(--role-placeholder) !important;
  opacity:1;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor input:focus, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor select:focus, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor textarea:focus{
  outline:2px solid var(--role-input-border) !important;
  outline-offset:1px;
  box-shadow:0 0 0 2px color-mix(in srgb,var(--role-input-border) 28%,transparent) !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .candidate-option:hover, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .candidate-option:focus, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .match-result:hover{
  background:var(--role-btn-hover) !important;
  color:var(--role-btn-text) !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor input[type="file"]::file-selector-button{
  background:var(--role-btn-bg) !important;
  color:var(--role-btn-text) !important;
  border:1px solid var(--role-input-border) !important;
  border-radius:5px;
  padding:5px 10px;
  margin-right:9px;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor input[type="file"]::file-selector-button:hover{
  background:var(--role-btn-hover) !important;
}
.record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor > label, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .edit-image-status, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .edit-existing-images, .record-history.card-view.role-color-enabled .record-item:not([data-role=""]) .record-editor .edit-existing-images span{
  color:#f5f7fa !important;
}

/* 圆形笔形编辑按钮：尺寸、SVG 尺寸和行高同步，避免图标错位或撑开操作栏。 */
.record-history .record-edit-button{
  display:inline-grid !important;
  place-items:center !important;
  box-sizing:border-box !important;
  width:30px !important;
  min-width:30px !important;
  max-width:30px !important;
  height:30px !important;
  min-height:30px !important;
  padding:0 !important;
  border-radius:50% !important;
  line-height:1 !important;
  font-size:0 !important;
}
.record-history .record-edit-button svg{
  display:block;
  width:15px;
  height:15px;
}
.history-table .record-edit-button{
  width:28px !important;
  min-width:28px !important;
  max-width:28px !important;
  height:28px !important;
  min-height:28px !important;
}
.history-table .record-edit-button svg{ width:14px; height:14px; }

/* 深色主题列表职能底色减淡：保留色相辨识度，降低与深色表格底色的冲突。 */
:root[data-theme="dark"] .record-history.role-color-enabled .history-table tr[data-role="坦克"]{ background:rgba(49,95,156,.14) !important; }
:root[data-theme="dark"] .record-history.role-color-enabled .history-table tr[data-role="治疗"]{ background:rgba(57,132,90,.14) !important; }
:root[data-theme="dark"] .record-history.role-color-enabled .history-table tr[data-role="DPS"]{ background:rgba(185,75,75,.14) !important; }


/* 第五十九阶段：职能着色严格隔离到卡片视图；列表编辑器恢复主题原样。
   开关只改变颜色属性，不改变控件尺寸、编辑器网格、间距或瀑布流行跨度。 */

/* 卡片职能基色：与卡片底色一致，三主题共用，避免浅色主题按钮发白。 */
:root[data-theme="dark"] .record-history.card-view.role-color-enabled > .record-item[data-role="坦克"], :root[data-theme="light"] .record-history.card-view.role-color-enabled > .record-item[data-role="坦克"], :root[data-theme="white"] .record-history.card-view.role-color-enabled > .record-item[data-role="坦克"]{
  --role-card-base:#234b78;
  --role-card-accent:#668db8;
  --role-control-bg:#193956;
  --role-control-hover:#28547f;
  --role-control-text:#f4f8ff;
  --role-placeholder:#c1d1e2;
}
:root[data-theme="dark"] .record-history.card-view.role-color-enabled > .record-item[data-role="治疗"], :root[data-theme="light"] .record-history.card-view.role-color-enabled > .record-item[data-role="治疗"], :root[data-theme="white"] .record-history.card-view.role-color-enabled > .record-item[data-role="治疗"]{
  --role-card-base:#245b43;
  --role-card-accent:#69a780;
  --role-control-bg:#1b4633;
  --role-control-hover:#2b694c;
  --role-control-text:#f1faf3;
  --role-placeholder:#c1ddca;
}
:root[data-theme="dark"] .record-history.card-view.role-color-enabled > .record-item[data-role="DPS"], :root[data-theme="light"] .record-history.card-view.role-color-enabled > .record-item[data-role="DPS"], :root[data-theme="white"] .record-history.card-view.role-color-enabled > .record-item[data-role="DPS"]{
  --role-card-base:#713b40;
  --role-card-accent:#c17b80;
  --role-control-bg:#4b2b31;
  --role-control-hover:#754047;
  --role-control-text:#fff4f4;
  --role-placeholder:#e4c5c7;
}

/* 编辑器的几何属性固定，不随职能着色开关改变。 */
.record-history.card-view > .record-item .record-editor, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor{
  display:grid !important;
  grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  gap:10px !important;
  margin-top:12px !important;
  padding:12px !important;
  width:100% !important;
  max-width:100% !important;
  min-width:0 !important;
  box-sizing:border-box !important;
}
.record-history.card-view > .record-item .record-editor .edit-calendar-button, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .edit-calendar-button{
  flex:0 0 42px !important;
  width:42px !important;
  min-width:42px !important;
  max-width:42px !important;
  height:36px !important;
  min-height:36px !important;
  box-sizing:border-box !important;
}
.record-history.card-view > .record-item .record-editor .edit-date-row > input[type="text"], .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .edit-date-row > input[type="text"]{
  flex:1 1 auto !important;
  width:auto !important;
  min-width:0 !important;
  box-sizing:border-box !important;
}
.record-history.card-view > .record-item .record-editor .record-edit-actions, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .record-edit-actions{
  display:flex !important;
  grid-column:1 / -1 !important;
  justify-content:flex-end !important;
  flex-wrap:nowrap !important;
  gap:8px !important;
  min-width:auto !important;
  max-width:none !important;
}
.record-history.card-view > .record-item .record-editor .edit-existing-images, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .edit-existing-images{
  grid-column:1 / -1 !important;
  display:block !important;
}
.record-history.card-view > .record-item .record-editor .edit-image-label, .record-history.card-view > .record-item .record-editor .edit-comment-label, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .edit-image-label, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .edit-comment-label{
  grid-column:1 / -1 !important;
}

/* 颜色层：不设置 border-width、padding、尺寸、display、gap 或行高。 */
.record-history.card-view.role-color-enabled > .record-item[data-role="坦克"], .record-history.card-view.role-color-enabled > .record-item[data-role="治疗"], .record-history.card-view.role-color-enabled > .record-item[data-role="DPS"]{
  color:#f5f7fa !important;
}
.record-history.card-view.role-color-enabled > .record-item .record-edit-button, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .edit-calendar-button, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-edit-actions button, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .edit-clear-images{
  background-color:var(--role-card-base) !important;
  background-image:none !important;
  color:var(--role-control-text) !important;
  border-width:0 !important;
  border-color:transparent !important;
  box-sizing:border-box !important;
  box-shadow:inset 0 0 0 1px var(--role-card-accent) !important;
}
.record-history.card-view.role-color-enabled > .record-item .record-edit-button:hover, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .edit-calendar-button:hover, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-edit-actions button:hover, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .edit-clear-images:hover{
  background-color:var(--role-control-hover) !important;
  color:var(--role-control-text) !important;
  filter:none !important;
}
.record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor{
  background-color:rgba(10,16,24,.34) !important;
  border-color:rgba(255,255,255,.22) !important;
  color:#f5f7fa !important;
}
.record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor > label, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .edit-image-status, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .edit-existing-images, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .edit-existing-images span{
  color:#f5f7fa !important;
}
.record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor input:not([type="hidden"]), .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor select, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor textarea, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor input[type="file"], .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .match-result, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .edit-match-result, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .candidate-option, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor select option{
  background-color:var(--role-control-bg) !important;
  color:var(--role-control-text) !important;
  border-width:0 !important;
  border-color:transparent !important;
  box-sizing:border-box !important;
  box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--role-card-accent) 72%,transparent) !important;
  box-sizing:border-box !important;
}
.record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor input::placeholder, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor textarea::placeholder{
  color:var(--role-placeholder) !important;
  opacity:1 !important;
}
.record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor input:focus, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor select:focus, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor textarea:focus, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .candidate-option:focus{
  outline:2px solid var(--role-card-accent) !important;
  outline-offset:1px !important;
}
.record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .edit-match-result{
  width:auto !important;
  overflow-x:visible !important;
}
.record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .candidate-option:hover, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .match-result:hover{
  background-color:var(--role-control-hover) !important;
  color:var(--role-control-text) !important;
}
.record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor input[type="file"]::file-selector-button{
  background-color:var(--role-card-base) !important;
  color:var(--role-control-text) !important;
  border:0 !important;
  box-shadow:inset 0 0 0 1px var(--role-card-accent) !important;
}

/* 列表编辑模块：职能控件配色规则仅作用于 .card-view，列表编辑器继续使用原主题样式。 */


/* 第六十阶段：恢复第五十六阶段验证过的编辑区职能配色标准。
   保留第五十九阶段的卡片视图作用域与布局隔离；只回滚编辑控件的颜色/边框表现，
   不改变编辑器尺寸、网格、日历按钮尺寸、卡片瀑布流或列表编辑模块。 */
.record-history.card-view.role-color-enabled > .record-item .record-edit-button, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-edit-actions button, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .edit-calendar-button, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .edit-clear-images{
  background:var(--role-btn-bg) !important;
  background-image:none !important;
  color:var(--role-btn-text) !important;
  border:1px solid var(--role-input-border) !important;
  box-shadow:none !important;
}
.record-history.card-view.role-color-enabled > .record-item .record-edit-button:hover, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-edit-actions button:hover, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .edit-calendar-button:hover, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .edit-clear-images:hover{
  background:var(--role-btn-hover) !important;
  color:var(--role-btn-text) !important;
  border-color:var(--role-input-border) !important;
  filter:none !important;
}
.record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor{
  background:rgba(10,17,25,.42) !important;
  border-color:rgba(255,255,255,.24) !important;
  color:#f5f7fa !important;
}
.record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor > label, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .edit-image-status, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .edit-existing-images, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .edit-existing-images span{
  color:#f5f7fa !important;
}
.record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor input:not([type="hidden"]), .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor select, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor textarea, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .match-result, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .edit-match-result, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .candidate-option, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor select option{
  background:var(--role-input-bg) !important;
  color:var(--role-input-text) !important;
  border:1px solid var(--role-input-border) !important;
  box-shadow:none !important;
  color-scheme:normal;
}
.record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor input[type="file"]{
  background:var(--role-input-bg) !important;
  color:var(--role-input-text) !important;
  border:1px solid var(--role-input-border) !important;
}
.record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor input[type="file"]::file-selector-button{
  background:var(--role-btn-bg) !important;
  color:var(--role-btn-text) !important;
  border:1px solid var(--role-input-border) !important;
}
.record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor input[type="file"]::file-selector-button:hover{
  background:var(--role-btn-hover) !important;
}
.record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor input::placeholder, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor textarea::placeholder{
  color:var(--role-placeholder) !important;
  opacity:1 !important;
}
.record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor input:focus, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor select:focus, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor textarea:focus, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .candidate-option:focus{
  outline:2px solid var(--role-input-border) !important;
  outline-offset:1px !important;
  box-shadow:0 0 0 2px color-mix(in srgb,var(--role-input-border) 28%,transparent) !important;
}
.record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .candidate-option:hover, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .match-result:hover{
  background:var(--role-btn-hover) !important;
  color:var(--role-btn-text) !important;
}


/* 第六十一阶段：浅色与透明白主题的卡片编辑控件，统一沿用深色主题职能色阶。
   只覆盖颜色变量；不触碰尺寸、边框宽度、布局、间距或瀑布流属性。 */
:root[data-theme="dark"] .record-history.card-view.role-color-enabled > .record-item[data-role="坦克"], :root[data-theme="light"] .record-history.card-view.role-color-enabled > .record-item[data-role="坦克"], :root[data-theme="white"] .record-history.card-view.role-color-enabled > .record-item[data-role="坦克"]{
  --role-btn-bg:#315f91;
  --role-btn-hover:#3c70a8;
  --role-btn-text:#f4f8ff;
  --role-input-bg:#183653;
  --role-input-text:#f2f6fc;
  --role-input-border:#668db8;
  --role-placeholder:#c1d1e2;
}
:root[data-theme="dark"] .record-history.card-view.role-color-enabled > .record-item[data-role="治疗"], :root[data-theme="light"] .record-history.card-view.role-color-enabled > .record-item[data-role="治疗"], :root[data-theme="white"] .record-history.card-view.role-color-enabled > .record-item[data-role="治疗"]{
  --role-btn-bg:#347a57;
  --role-btn-hover:#408d65;
  --role-btn-text:#f3fff6;
  --role-input-bg:#183f2d;
  --role-input-text:#f1faf3;
  --role-input-border:#69a780;
  --role-placeholder:#c1ddca;
}
:root[data-theme="dark"] .record-history.card-view.role-color-enabled > .record-item[data-role="DPS"], :root[data-theme="light"] .record-history.card-view.role-color-enabled > .record-item[data-role="DPS"], :root[data-theme="white"] .record-history.card-view.role-color-enabled > .record-item[data-role="DPS"]{
  --role-btn-bg:#914b50;
  --role-btn-hover:#a65a60;
  --role-btn-text:#fff5f5;
  --role-input-bg:#492a30;
  --role-input-text:#fff4f4;
  --role-input-border:#c17b80;
  --role-placeholder:#e4c5c7;
}


/* 第六十二阶段：修正编辑器原生日历输入框被通用 input{width:100%} 规则撑宽的问题。
   日期输入框必须与右侧日历按钮完全重合，原生弹层才能以按钮位置为锚点；
   透明输入框只负责接收点击，不改变按钮和编辑器的可见尺寸。 */
.record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .edit-date-row{
  position: relative !important;
}
.record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .edit-date-row > .edit-date-picker{
  display: block !important;
  position: absolute !important;
  top: 0 !important;
  right: 0 !important;
  bottom: auto !important;
  left: auto !important;
  width: 42px !important;
  min-width: 42px !important;
  max-width: 42px !important;
  height: 36px !important;
  min-height: 36px !important;
  max-height: 36px !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  z-index: 5 !important;
  cursor: pointer !important;
  pointer-events: auto !important;
  box-sizing: border-box !important;
  appearance: none !important;
  -webkit-appearance: none !important;
}
/* 日历按钮只改变底色和图标颜色，不改动任何几何属性。 */
.record-history.card-view.role-color-enabled > .record-item[data-role="坦克"] .record-editor .edit-calendar-button{
  background-color: #315f91 !important;
  background-image: none !important;
  color: #f4f8ff !important;
}
.record-history.card-view.role-color-enabled > .record-item[data-role="治疗"] .record-editor .edit-calendar-button{
  background-color: #347a57 !important;
  background-image: none !important;
  color: #f3fff6 !important;
}
.record-history.card-view.role-color-enabled > .record-item[data-role="DPS"] .record-editor .edit-calendar-button{
  background-color: #914b50 !important;
  background-image: none !important;
  color: #fff5f5 !important;
}
.record-history.card-view.role-color-enabled > .record-item[data-role="坦克"] .record-editor .edit-calendar-button:hover{ background-color:#3c70a8 !important; }
.record-history.card-view.role-color-enabled > .record-item[data-role="治疗"] .record-editor .edit-calendar-button:hover{ background-color:#408d65 !important; }
.record-history.card-view.role-color-enabled > .record-item[data-role="DPS"] .record-editor .edit-calendar-button:hover{ background-color:#a65a60 !important; }

/* 第六十三阶段：文件选择按钮在三种主题下始终使用主题本身的控件配色，
   不再因卡片是否启用职能着色而改变；只设置按钮外观，不改变文件输入框布局。 */
.record-history.card-view:not(.role-color-enabled) .record-item:not([data-role=""]) .record-editor input[type="file"]::file-selector-button{
  padding:5px 10px !important;
  margin-right:9px !important;
  border-radius:5px !important;
  background:var(--control) !important;
  color:var(--text) !important;
  border:1px solid var(--line) !important;
  box-shadow:none !important;
}
.record-history.card-view:not(.role-color-enabled) .record-item:not([data-role=""]) .record-editor input[type="file"]::file-selector-button:hover{
  background:var(--control-hover) !important;
  color:var(--text) !important;
}
:root[data-theme="dark"] .record-history.card-view:not(.role-color-enabled) .record-item:not([data-role=""]) .record-editor input[type="file"]::file-selector-button{
  background:#303030 !important;
  color:#dcdcdc !important;
  border-color:#4a4235 !important;
}
:root[data-theme="dark"] .record-history.card-view:not(.role-color-enabled) .record-item:not([data-role=""]) .record-editor input[type="file"]::file-selector-button:hover{
  background:#404040 !important;
}
:root[data-theme="light"] .record-history.card-view:not(.role-color-enabled) .record-item:not([data-role=""]) .record-editor input[type="file"]::file-selector-button{
  background:#4a3d32 !important;
  color:#ebd9ba !important;
  border-color:#6b5337 !important;
}
:root[data-theme="light"] .record-history.card-view:not(.role-color-enabled) .record-item:not([data-role=""]) .record-editor input[type="file"]::file-selector-button:hover{
  background:#65513d !important;
  color:#fff0d2 !important;
}
:root[data-theme="white"] .record-history.card-view:not(.role-color-enabled) .record-item:not([data-role=""]) .record-editor input[type="file"]::file-selector-button{
  background:#ccc !important;
  color:#333 !important;
  border-color:rgba(160,160,160,.6) !important;
}
:root[data-theme="white"] .record-history.card-view:not(.role-color-enabled) .record-item:not([data-role=""]) .record-editor input[type="file"]::file-selector-button:hover{
  background:#bcbcbc !important;
  color:#222 !important;
}

/* 日期输入框只作为 showPicker() 的调用目标，绝不覆盖可见按钮的点击区域。
   弹层仍由原生 date input 打开，按钮的尺寸、位置和编辑器布局不变。 */
.record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .edit-date-row > .edit-date-picker{
  pointer-events:none !important;
  z-index:-1 !important;
}


/* 第六十六阶段：修正第六十五阶段变量覆盖优先级错误。
   旧规则缺少主题选择器，优先级低于前面的 :root[data-theme] 变量定义，导致新色值没有生效。
   这里只调整已开启职能着色时的按钮底色；不改文字、边框、尺寸、阴影、布局或交互逻辑。 */
:root[data-theme="dark"] .record-history.card-view.role-color-enabled .record-item[data-role="坦克"]{
  --role-btn-bg:#274e78;
  --role-btn-hover:#2e5b87;
}
:root[data-theme="dark"] .record-history.card-view.role-color-enabled .record-item[data-role="治疗"]{
  --role-btn-bg:#286343;
  --role-btn-hover:#326f4e;
}
:root[data-theme="dark"] .record-history.card-view.role-color-enabled .record-item[data-role="DPS"]{
  --role-btn-bg:#743b40;
  --role-btn-hover:#84464b;
}
:root[data-theme="light"] .record-history.card-view.role-color-enabled .record-item[data-role="坦克"]{
  --role-btn-bg:#5e7fa5;
  --role-btn-hover:#527395;
}
:root[data-theme="light"] .record-history.card-view.role-color-enabled .record-item[data-role="治疗"]{
  --role-btn-bg:#658f72;
  --role-btn-hover:#567e63;
}
:root[data-theme="light"] .record-history.card-view.role-color-enabled .record-item[data-role="DPS"]{
  --role-btn-bg:#a96e6e;
  --role-btn-hover:#965e5e;
}
:root[data-theme="white"] .record-history.card-view.role-color-enabled .record-item[data-role="坦克"]{
  --role-btn-bg:#38628e;
  --role-btn-hover:#2f557d;
}
:root[data-theme="white"] .record-history.card-view.role-color-enabled .record-item[data-role="治疗"]{
  --role-btn-bg:#3d704e;
  --role-btn-hover:#326242;
}
:root[data-theme="white"] .record-history.card-view.role-color-enabled .record-item[data-role="DPS"]{
  --role-btn-bg:#894248;
  --role-btn-hover:#78383e;
}

/* 所有配套按钮只读取各自卡片继承的职能底色。保留原有文字、边框、阴影与几何属性。 */
:root[data-theme] .record-history.card-view.role-color-enabled .record-item[data-role] .record-edit-button, :root[data-theme] .record-history.card-view.role-color-enabled .record-item[data-role] .card-record-actions button, :root[data-theme] .record-history.card-view.role-color-enabled .record-item:not([data-role=""])[data-role] .record-edit-actions button, :root[data-theme] .record-history.card-view.role-color-enabled .record-item:not([data-role=""])[data-role] .edit-calendar-button, :root[data-theme] .record-history.card-view.role-color-enabled .record-item:not([data-role=""])[data-role] .edit-clear-images{
  background-color:var(--role-btn-bg) !important;
  background-image:none !important;
}
:root[data-theme] .record-history.card-view.role-color-enabled .record-item[data-role] .record-edit-button:hover, :root[data-theme] .record-history.card-view.role-color-enabled .record-item[data-role] .card-record-actions button:hover, :root[data-theme] .record-history.card-view.role-color-enabled .record-item:not([data-role=""])[data-role] .record-edit-actions button:hover, :root[data-theme] .record-history.card-view.role-color-enabled .record-item:not([data-role=""])[data-role] .edit-calendar-button:hover, :root[data-theme] .record-history.card-view.role-color-enabled .record-item:not([data-role=""])[data-role] .edit-clear-images:hover{
  background-color:var(--role-btn-hover) !important;
}
:root[data-theme] .record-history.card-view.role-color-enabled .record-item:not([data-role=""])[data-role] .record-editor input[type="file"]::file-selector-button{
  background-color:var(--role-btn-bg) !important;
  background-image:none !important;
}
:root[data-theme] .record-history.card-view.role-color-enabled .record-item:not([data-role=""])[data-role] .record-editor input[type="file"]::file-selector-button:hover{
  background-color:var(--role-btn-hover) !important;
}

/* 第六十七阶段：编辑器按钮统一为小方形；只改控件外观，不改编辑器网格与卡片布局。 */
.record-history.card-view > .record-item .record-editor .edit-calendar-button, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .edit-calendar-button{
  flex:0 0 34px !important;
  width:34px !important;
  min-width:34px !important;
  max-width:34px !important;
  height:34px !important;
  min-height:34px !important;
  max-height:34px !important;
  padding:0 !important;
  display:inline-grid !important;
  place-items:center !important;
  box-sizing:border-box !important;
  border-radius:4px !important;
}
.record-history.card-view > .record-item .record-editor input[type="file"]::file-selector-button, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor input[type="file"]::file-selector-button{
  width:34px !important;
  min-width:34px !important;
  max-width:34px !important;
  height:34px !important;
  min-height:34px !important;
  max-height:34px !important;
  padding:0 !important;
  margin:0 8px 0 0 !important;
  box-sizing:border-box !important;
  border-radius:4px !important;
  font-size:0 !important;
  color:transparent !important;
  vertical-align:middle !important;
  background-repeat:no-repeat !important;
  background-position:center !important;
  background-size:17px 17px !important;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 16V4m0 0L7.5 8.5M12 4l4.5 4.5M4 15.5v4h16v-4' fill='none' stroke='%23ffffff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}
.record-history.card-view > .record-item .record-editor .record-edit-actions button, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .record-edit-actions button{
  display:inline-grid !important;
  place-items:center !important;
  box-sizing:border-box !important;
  width:34px !important;
  min-width:34px !important;
  max-width:34px !important;
  height:34px !important;
  min-height:34px !important;
  max-height:34px !important;
  padding:0 !important;
  border-radius:4px !important;
  line-height:1 !important;
  font-size:0 !important;
}
.record-history.card-view > .record-item .record-editor .record-edit-actions button svg, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .record-edit-actions button svg{
  display:block !important;
  width:17px !important;
  height:17px !important;
}
.record-history.card-view > .record-item .record-editor .record-edit-actions .delete-record-button, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .record-edit-actions .delete-record-button{
  width:28px !important;
  min-width:28px !important;
  max-width:28px !important;
  height:28px !important;
  min-height:28px !important;
  max-height:28px !important;
  background:#ed1c2e !important;
  color:#ffffff !important;
  border:0 !important;
  box-shadow:none !important;
  border-radius:4px !important;
}
.record-history.card-view > .record-item .record-editor .record-edit-actions .delete-record-button svg, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .record-edit-actions .delete-record-button svg{
  width:15px !important;
  height:15px !important;
}
/* 去掉职能着色模式下编辑器及其内部布局容器的外框线；输入控件自身边框保留。 */
.record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor > label, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor > div, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .edit-date-row, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .edit-existing-images, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .record-edit-actions{
  border:0 !important;
  outline:0 !important;
  box-shadow:none !important;
}
.record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor{
  background:rgba(10,17,25,.22) !important;
}
/* 三个主题分别明确指定更深的坦克蓝、治疗绿、DPS红；不依赖主题继承或旧规则。 */
:root[data-theme="dark"] .record-history.card-view.role-color-enabled > .record-item[data-role="坦克"]{ --role-btn-bg:#23486f; --role-btn-hover:#2b5885; }
:root[data-theme="dark"] .record-history.card-view.role-color-enabled > .record-item[data-role="治疗"]{ --role-btn-bg:#205638; --role-btn-hover:#286a45; }
:root[data-theme="dark"] .record-history.card-view.role-color-enabled > .record-item[data-role="DPS"]{ --role-btn-bg:#71363c; --role-btn-hover:#854149; }
:root[data-theme="light"] .record-history.card-view.role-color-enabled > .record-item[data-role="坦克"]{ --role-btn-bg:#294f76; --role-btn-hover:#315f8d; }
:root[data-theme="light"] .record-history.card-view.role-color-enabled > .record-item[data-role="治疗"]{ --role-btn-bg:#245d3d; --role-btn-hover:#2e704b; }
:root[data-theme="light"] .record-history.card-view.role-color-enabled > .record-item[data-role="DPS"]{ --role-btn-bg:#783a40; --role-btn-hover:#8b474e; }
:root[data-theme="white"] .record-history.card-view.role-color-enabled > .record-item[data-role="坦克"]{ --role-btn-bg:#24496f; --role-btn-hover:#2e5a82; }
:root[data-theme="white"] .record-history.card-view.role-color-enabled > .record-item[data-role="治疗"]{ --role-btn-bg:#20563a; --role-btn-hover:#2b6845; }
:root[data-theme="white"] .record-history.card-view.role-color-enabled > .record-item[data-role="DPS"]{ --role-btn-bg:#71363d; --role-btn-hover:#824149; }
/* 无职能颜色时，方形按钮的颜色继续由当前主题自身决定；尺寸规则与着色模式完全相同。 */
.record-history.card-view:not(.role-color-enabled) > .record-item:not([data-role=""]) .record-editor .edit-calendar-button, .record-history.card-view:not(.role-color-enabled) > .record-item:not([data-role=""]) .record-editor .record-edit-actions button{
  border:1px solid var(--line) !important;
}

/* 文件选择图标在浅色底上使用深色线条，避免白色图标对比不足。 */
:root[data-theme="white"] .record-history.card-view > .record-item .record-editor input[type="file"]::file-selector-button{
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 16V4m0 0L7.5 8.5M12 4l4.5 4.5M4 15.5v4h16v-4' fill='none' stroke='%23333333' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
}

/* 清除已有图片/撤销清除同属编辑配套操作，使用统一的小方形图标按钮。 */
.record-history.card-view > .record-item .record-editor .edit-clear-images, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .edit-clear-images{
  display:inline-grid !important;
  place-items:center !important;
  width:34px !important; min-width:34px !important; max-width:34px !important;
  height:34px !important; min-height:34px !important; max-height:34px !important;
  padding:0 !important; border-radius:4px !important; font-size:0 !important;
}
.record-history.card-view > .record-item .record-editor .edit-clear-images svg, .record-history.card-view.role-color-enabled > .record-item:not([data-role=""]) .record-editor .edit-clear-images svg{
  display:block !important; width:17px !important; height:17px !important;
}

/* 第六十八阶段：恢复文件选择按钮文字，并让卡片/列表编辑器的操作图标一致。
   列表编辑器始终使用主题自身的中性色，不读取职能着色变量。 */

/* 文件选择按钮保留浏览器原生“选择文件”文字，不再使用正方形上传图标。 */
.record-history .record-editor input[type="file"]::file-selector-button{
  width:auto !important;
  min-width:0 !important;
  max-width:none !important;
  height:auto !important;
  min-height:0 !important;
  max-height:none !important;
  padding:5px 10px !important;
  margin:0 9px 0 0 !important;
  border-radius:5px !important;
  font-size:13px !important;
  line-height:normal !important;
  color:var(--text) !important;
  background:var(--control) !important;
  background-image:none !important;
  border:1px solid var(--line) !important;
  box-shadow:none !important;
  vertical-align:middle !important;
}
.record-history .record-editor input[type="file"]::file-selector-button:hover{
  color:var(--text) !important;
  background:var(--control-hover) !important;
  background-image:none !important;
}
/* 开启职能着色的卡片编辑器仍使用原有职能色，但文字保持可见。 */
:root[data-theme] .record-history.card-view.role-color-enabled > .record-item:not([data-role=""])[data-role] .record-editor input[type="file"]::file-selector-button{
  width:auto !important;
  min-width:0 !important;
  max-width:none !important;
  height:auto !important;
  min-height:0 !important;
  max-height:none !important;
  padding:5px 10px !important;
  margin:0 9px 0 0 !important;
  font-size:13px !important;
  line-height:normal !important;
  color:var(--role-btn-text) !important;
  background:var(--role-btn-bg) !important;
  background-image:none !important;
  border:1px solid var(--role-input-border) !important;
}
:root[data-theme] .record-history.card-view.role-color-enabled > .record-item:not([data-role=""])[data-role] .record-editor input[type="file"]::file-selector-button:hover{
  color:var(--role-btn-text) !important;
  background:var(--role-btn-hover) !important;
}

/* 列表编辑器与 .record-editor 是同一个元素，不能写成父子选择器。 */
:root[data-theme="light"] .record-history:not(.card-view) .table-record-editor input[type="file"]::file-selector-button{
  color:#ebd9ba !important;
  background:#4a3d32 !important;
  border:1px solid #6b5337 !important;
}
:root[data-theme="light"] .record-history:not(.card-view) .table-record-editor input[type="file"]::file-selector-button:hover{
  color:#fff0d2 !important;
  background:#65513d !important;
}

/* 卡片与列表编辑器的日历、保存、取消、清除图片图标统一尺寸。 */
.record-history .record-editor .edit-calendar-button{
  flex:0 0 34px !important;
  width:34px !important;
  min-width:34px !important;
  max-width:34px !important;
  height:34px !important;
  min-height:34px !important;
  max-height:34px !important;
  padding:0 !important;
  display:inline-grid !important;
  place-items:center !important;
  box-sizing:border-box !important;
  border-radius:4px !important;
}
.record-history .record-editor .record-edit-actions button{
  display:inline-grid !important;
  place-items:center !important;
  box-sizing:border-box !important;
  width:34px !important;
  min-width:34px !important;
  max-width:34px !important;
  height:34px !important;
  min-height:34px !important;
  max-height:34px !important;
  padding:0 !important;
  border-radius:4px !important;
  line-height:1 !important;
  font-size:0 !important;
}
.record-history .record-editor .record-edit-actions button svg, .record-history .record-editor .edit-calendar-button svg{
  display:block !important;
  width:17px !important;
  height:17px !important;
  flex:none !important;
}
.record-history .record-editor .edit-clear-images{
  display:inline-grid !important;
  place-items:center !important;
  width:34px !important;
  min-width:34px !important;
  max-width:34px !important;
  height:34px !important;
  min-height:34px !important;
  max-height:34px !important;
  margin-left:10px !important;
  padding:0 !important;
  border:0 !important;
  outline:0 !important;
  box-shadow:none !important;
  border-radius:4px !important;
  font-size:0 !important;
  color:#fff !important;
}
.record-history .record-editor .edit-clear-images svg{
  display:block !important;
  width:17px !important;
  height:17px !important;
  color:#fff !important;
  stroke:#fff !important;
}
.record-history .record-editor .edit-clear-images.pending-clear{
  color:#fff !important;
}
.record-history .record-editor .edit-clear-images.pending-clear svg{
  color:#fff !important;
  stroke:#fff !important;
}

/* 删除此条是例外：所有主题、所有职能颜色状态、卡片与列表模式均固定鲜红色。 */
:root[data-theme] .record-history.card-view .record-item .record-editor .record-edit-actions .delete-record-button, :root[data-theme] .record-history:not(.card-view) .table-record-editor .record-editor .record-edit-actions .delete-record-button{
  width:28px !important;
  min-width:28px !important;
  max-width:28px !important;
  height:28px !important;
  min-height:28px !important;
  max-height:28px !important;
  padding:0 !important;
  display:inline-grid !important;
  place-items:center !important;
  background:#ed1c2e !important;
  background-image:none !important;
  color:#fff !important;
  border:0 !important;
  outline:0 !important;
  box-shadow:none !important;
  border-radius:4px !important;
}
:root[data-theme] .record-history.card-view .record-item .record-editor .record-edit-actions .delete-record-button:hover, :root[data-theme] .record-history:not(.card-view) .table-record-editor .record-editor .record-edit-actions .delete-record-button:hover{
  background:#d91124 !important;
  color:#fff !important;
}
:root[data-theme] .record-history .record-editor .record-edit-actions .delete-record-button svg{
  display:block !important;
  width:15px !important;
  height:15px !important;
  color:#fff !important;
  stroke:#fff !important;
}

/* 列表编辑器不继承职能配色：日期、保存、取消继续按主题中性色显示。 */
:root[data-theme] .record-history:not(.card-view) .table-record-editor .record-editor .edit-calendar-button, :root[data-theme] .record-history:not(.card-view) .table-record-editor .record-editor .record-edit-actions button:not(.delete-record-button){
  background:var(--control) !important;
  color:var(--text) !important;
  border:1px solid var(--line) !important;
  box-shadow:none !important;
}
:root[data-theme] .record-history:not(.card-view) .table-record-editor .record-editor .edit-calendar-button:hover, :root[data-theme] .record-history:not(.card-view) .table-record-editor .record-editor .record-edit-actions button:not(.delete-record-button):hover{
  background:var(--control-hover) !important;
  color:var(--text) !important;
}
:root[data-theme] .record-history:not(.card-view) .table-record-editor .record-editor .edit-clear-images{
  background:var(--control) !important;
  color:#fff !important;
  border:0 !important;
  box-shadow:none !important;
}

/* 优先级补正：职能着色模式的通用按钮规则带有更高优先级，删除按钮与清图按钮在此明确排除其影响。 */
:root[data-theme] .record-history.card-view.role-color-enabled .record-item:not([data-role=""])[data-role] .record-editor .record-edit-actions .delete-record-button, :root[data-theme] .record-history.card-view.role-color-enabled .record-item:not([data-role=""])[data-role] .record-editor .edit-clear-images{
  border:0 !important;
  outline:0 !important;
  box-shadow:none !important;
}
:root[data-theme] .record-history.card-view.role-color-enabled .record-item:not([data-role=""])[data-role] .record-editor .record-edit-actions .delete-record-button{
  background:#ed1c2e !important;
  background-image:none !important;
  color:#fff !important;
}
:root[data-theme] .record-history.card-view.role-color-enabled .record-item:not([data-role=""])[data-role] .record-editor .record-edit-actions .delete-record-button:hover{
  background:#d91124 !important;
  color:#fff !important;
}

/* 日期选择器使用浏览器默认配色方案，跟随操作系统外观，不随网页主题或职能颜色切换。 */
.record-history .record-editor .edit-date-picker, #recordDatePicker{
  color-scheme: normal !important;
}

/* 列表编辑器本身带有 table-record-editor 与 record-editor 两个类，
   不是父子嵌套；直接命中其删除按钮，确保与职能颜色开关无关的鲜红样式生效。 */
:root[data-theme] .record-history:not(.card-view) .table-record-editor.record-editor .record-edit-actions .delete-record-button{
  width:28px !important;
  min-width:28px !important;
  max-width:28px !important;
  height:28px !important;
  min-height:28px !important;
  max-height:28px !important;
  padding:0 !important;
  display:inline-grid !important;
  place-items:center !important;
  background:#ed1c2e !important;
  background-image:none !important;
  color:#fff !important;
  border:0 !important;
  outline:0 !important;
  box-shadow:none !important;
}
:root[data-theme] .record-history:not(.card-view) .table-record-editor.record-editor .record-edit-actions .delete-record-button:hover{
  background:#d91124 !important;
  color:#fff !important;
}
:root[data-theme] .record-history:not(.card-view) .table-record-editor.record-editor .record-edit-actions .delete-record-button svg{
  display:block !important;
  width:15px !important;
  height:15px !important;
  color:#fff !important;
  stroke:#fff !important;
}


/* 新增导随记录：按钮文字改为“保存”后按内容自适应宽度。 */
#saveRecordButton{
  width:auto !important;
  min-width:0 !important;
  max-width:none !important;
  padding-left:14px !important;
  padding-right:14px !important;
}


/* 第七十一阶段：仅恢复未开启职能颜色的卡片编辑器文件按钮文字；不改变按钮底色、边框或其他控件。 */
.record-history.card-view:not(.role-color-enabled) > .record-item:not([data-role=""]) .record-editor input[type="file"]::file-selector-button{
  width:auto !important;
  min-width:0 !important;
  max-width:none !important;
  height:auto !important;
  min-height:0 !important;
  max-height:none !important;
  padding:5px 10px !important;
  font-size:13px !important;
  line-height:normal !important;
  color:var(--text) !important;
  background-image:none !important;
}

/* 透明白主题的职业/副本候选下拉栏：整体改为明亮白底，避免容器露出深色底。 */
:root[data-theme="white"] .candidate-list{
  background:rgba(255,255,255,.98) !important;
  box-shadow:0 8px 18px rgba(0,0,0,.10) !important;
}
:root[data-theme="white"] .candidate-list .candidate-option, :root[data-theme="white"] .candidate-list .candidate-empty{
  background:rgba(255,255,255,.98) !important;
  color:#333333 !important;
}
:root[data-theme="white"] .candidate-list .candidate-option:hover, :root[data-theme="white"] .candidate-list .candidate-option:focus{
  background:#f2f2f2 !important;
  color:#222222 !important;
}


/* 第七十二阶段：筛选容器、TOP 10 外框、浅色主框与卡片瀑布流间距修正。 */
/* 只移除四个筛选字段自身 label 容器的装饰描边，不改下拉控件本身。 */
.filter-grid > label:has(> #filterRole), .filter-grid > label:has(> #filterJob), .filter-grid > label:has(> #filterDutyType), .filter-grid > label:has(> #filterImagePresence){
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}
/* 总 TOP 10 卡片不显示额外的金色外框；其他统计卡片保持原样。 */
.statistics-card.top-duties-card{
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}
/* 仅浅色主题：外框沿用深色主题的金色，轻微加粗。 */
:root[data-theme="light"] .page{
  border: 1.5px solid #80683f !important;
}


/* 第七十三阶段：按实际 DOM 层级修正四个筛选下拉框、TOP 10 卡片与浅色主框。 */
:root .filter-grid > label > select#filterRole, :root .filter-grid > label > select#filterJob, :root .filter-grid > label > select#filterDutyType, :root .filter-grid > label.filter-image > select#filterImagePresence, :root .filter-grid > label > select#filterRole:focus, :root .filter-grid > label > select#filterJob:focus, :root .filter-grid > label > select#filterDutyType:focus, :root .filter-grid > label.filter-image > select#filterImagePresence:focus, :root .filter-grid > label > select#filterRole:focus-visible, :root .filter-grid > label > select#filterJob:focus-visible, :root .filter-grid > label > select#filterDutyType:focus-visible, :root .filter-grid > label.filter-image > select#filterImagePresence:focus-visible{
  border:0 !important;
  outline:0 !important;
  box-shadow:none !important;
}

/* TOP 10 外框只针对该排行卡片本身，不影响其他统计卡。 */
:root .statistics-section article.statistics-card.top-duties-card{
  border:0 !important;
  outline:0 !important;
  box-shadow:none !important;
}

/* 浅色主题最外层页面框：明确设置边框宽度与颜色，并去掉造成假边框观感的外圈描边阴影。 */
:root[data-theme="light"] body > .page, :root[data-theme="light"] .page{
  border:2px solid #80683f !important;
  outline:0 !important;
  box-shadow:inset 0 1px rgba(255,255,255,.32), 0 6px 18px rgba(74,61,50,.16) !important;
}

/* 所有原生日期选择器统一使用深色原生界面：新增记录、筛选日期、卡片/列表编辑日期。 */
:root input[type="date"], :root input[type="date"].edit-date-picker, :root input[type="date"].filter-date-picker, :root #recordDatePicker, :root #filterDateFromPicker, :root #filterDateToPicker{
  color-scheme:dark !important;
}

/* 第七十四阶段：统计区域边框、职能开关未选中描边与浅色主题质感。 */

/* 总 TOP 10：同时压掉排行卡片本体及其内部范围选择框的金色边线。 */
:root #statisticsSection .statistics-group:has(> article.top-duties-card) > article.top-duties-card, :root #statisticsSection article.statistics-card.top-duties-card, :root #statisticsSection .top-duties-card{
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}
:root #statisticsSection .top-duties-card #topDutiesMode, :root #statisticsSection .top-duties-card #topDutiesMode:focus, :root #statisticsSection .top-duties-card #topDutiesMode:focus-visible{
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}

/* 记录职能着色开关：未选中时不显示容器细边框；选中状态仍保留金色高亮圈。 */
:root .record-role-color-button[aria-pressed="false"]{
  border: 0 !important;
  box-shadow: none !important;
}

/* 副本类型占比、专项统计：四个红绿灯按钮未选中时不显示白色细框/外圈。 */
:root .role-segment-switch button:not(.active){
  border: 0 !important;
  box-shadow: none !important;
  outline: 0 !important;
}
:root .role-segment-switch button.active{
  border: 0 !important;
  box-shadow: none !important;
  outline: 2px solid var(--gold-dark) !important;
  outline-offset: 2px !important;
}

/* 浅色主题：背景增加与深色主题相呼应的多层暖金渐变和柔和高光。 */
:root[data-theme="light"] body{
  background:
    radial-gradient(ellipse at 12% 4%, rgba(255,248,225,.72) 0, rgba(255,248,225,0) 34%),
    radial-gradient(ellipse at 88% 18%, rgba(190,151,91,.16) 0, rgba(190,151,91,0) 38%),
    linear-gradient(145deg, #f0e1c5 0%, #e8d4b0 46%, #e3cba2 100%) !important;
  background-attachment: fixed !important;
}
:root[data-theme="light"] .page{
  background:
    linear-gradient(132deg, rgba(255,250,235,.74) 0%, rgba(239,222,190,.66) 24%, rgba(224,203,167,.76) 62%, rgba(246,231,201,.72) 100%),
    var(--panel) !important;
  border: 1px solid #80683f !important;
  outline: 1px solid rgba(255,239,195,.68) !important;
  outline-offset: 2px !important;
  box-shadow:
    0 0 0 1px rgba(107,83,55,.38),
    0 0 12px rgba(174,132,66,.22),
    inset 0 1px 0 rgba(255,255,255,.88),
    inset 0 0 24px rgba(255,247,224,.24),
    0 8px 24px rgba(74,61,50,.24) !important;
}
:root[data-theme="light"] .panel, :root[data-theme="light"] .statistics-card, :root[data-theme="light"] .top-duties-card, :root[data-theme="light"] .roulette-rate-card, :root[data-theme="light"] .achievement-card{
  background: linear-gradient(145deg, rgba(250,239,215,.96), rgba(222,201,165,.96) 58%, rgba(238,220,187,.96)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.72),
    inset 0 -1px 0 rgba(135,103,58,.10),
    0 3px 9px rgba(74,61,50,.13) !important;
}
:root[data-theme="light"] .statistics-section-heading h3, :root[data-theme="light"] .statistics-card h4{
  text-shadow: 0 1px 0 rgba(255,255,255,.48);
}

/* 第七十六阶段：彻底移除第七十四阶段遗留的浅色主题白金渐变卡片底色。 */
:root[data-theme="light"] .panel, :root[data-theme="light"] .statistics-card, :root[data-theme="light"] .top-duties-card, :root[data-theme="light"] .roulette-rate-card, :root[data-theme="light"] .achievement-card{
  background: var(--panel) !important;
  background-image: none !important;
}

/* 第七十五阶段：按深色主题原参数还原浅色外框，去除浅色背景渐变，并精简职能按钮。 */
:root[data-theme="light"] body{
  background: var(--bg) !important;
  background-image: none !important;
  background-attachment: initial !important;
}
:root[data-theme="light"] .page{
  /* 外框参数直接沿用基础深色主题 .page，不再使用棕色粗框。 */
  border: 1px solid #80683f !important;
  outline: 0 !important;
  background: rgba(224,203,167,.42) !important;
  background-image: none !important;
  box-shadow: 0 0 0 1px rgba(205,167,96,.10), inset 0 1px rgba(229,193,88,.16), 0 8px 24px rgba(0,0,0,.38) !important;
}

/* 副本类型占比的四色筛选按钮移至卡片右上角。 */
#dutyTypeStatCard{
  position: relative;
}
#dutyTypeStatCard > .role-segment-switch{
  position: absolute;
  top: 15px;
  right: 18px;
  z-index: 2;
  padding: 0;
  margin: 0;
}

/* 三色职能着色按钮：色环铺满按钮，不留黑色容器边，也不叠加内外双框。 */
:root .record-role-color-button{
  width: 25px !important;
  height: 25px !important;
  min-width: 25px !important;
  padding: 0 !important;
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  overflow: visible;
}
:root .record-role-color-button > span{
  display: block;
  width: 25px !important;
  height: 25px !important;
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  border-radius: 50%;
}
:root .record-role-color-button[aria-pressed="true"]{
  border: 0 !important;
  box-shadow: none !important;
  outline: 2px solid var(--gold-dark) !important;
  outline-offset: 2px !important;
}

/* 红绿灯按钮只保留选中态金色外圈；未选中态没有白边、黑圈或容器边框。 */
:root .role-segment-switch button{
  border: 0 !important;
  box-shadow: none !important;
  outline: 0 !important;
}
:root .role-segment-switch button.active{
  border: 0 !important;
  box-shadow: none !important;
  outline: 2px solid var(--gold-dark) !important;
  outline-offset: 2px !important;
}


/* 第七十七阶段：浅色主题大容器去除浮雕式内侧高光。
   保留外部投影层次，但不再使用内侧亮边、内阴影或标题高光。 */
:root[data-theme="light"] .page{
  box-shadow: 0 8px 24px rgba(0,0,0,.38) !important;
}
:root[data-theme="light"] .panel, :root[data-theme="light"] .statistics-card, :root[data-theme="light"] .top-duties-card, :root[data-theme="light"] .roulette-rate-card, :root[data-theme="light"] .achievement-card{
  box-shadow: 0 3px 9px rgba(74,61,50,.13) !important;
}
:root[data-theme="light"] .statistics-section-heading h3, :root[data-theme="light"] .statistics-card h4{
  text-shadow: none !important;
}


/* 第七十八阶段遗留的 grid-row:auto !important 已移除，避免覆盖瀑布流脚本的行跨度。 */

/* 第八十阶段：保留原有响应式列宽与卡片尺寸，仅恢复稳定的逐列瀑布流轨道。 */
#recordHistory.card-view{
  grid-auto-flow: row !important;
  grid-auto-rows: 4px !important;
  row-gap: 12px !important;
  align-items: start !important;
}
#recordHistory.card-view > .record-item{
  width: 100% !important;
  min-width: 0 !important;
  height: auto !important;
  margin: 0 !important;
  align-self: start !important;
}


/* 第八十二阶段：响应式缩放时强制等宽列，避免 auto-fit 与旧定位残留造成卡片宽度分裂。 */
#recordHistory.card-view{
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: row !important;
  grid-auto-rows: 4px !important;
  column-gap: 14px !important;
  row-gap: 12px !important;
  align-items: start !important;
  min-width: 0 !important;
  width: 100% !important;
}
#recordHistory.card-view > .record-item{
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  align-self: start !important;
}
#recordHistory.card-view > .record-item, #recordHistory.card-view > .record-item > *{
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box;
}
