:root {
  color-scheme: dark;
  --bg: #071019;
  --panel: #101e2b;
  --panel-strong: #16293a;
  --panel-soft: #0b1824;
  --line: #29465d;
  --line-strong: #3b6682;
  --text: #eaf3f8;
  --muted: #9db2c2;
  --blue: #52bdf5;
  --blue-deep: #237eaf;
  --green: #55d6a4;
  --red: #ff8585;
  --gold: #e9bf61;
  --shadow: 0 18px 55px rgba(0, 0, 0, .24);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% -10%, rgba(38, 101, 148, .45), transparent 38rem),
    radial-gradient(circle at 90% 14%, rgba(25, 89, 103, .2), transparent 34rem),
    linear-gradient(155deg, #071019, #0b1621 54%, #071019);
  color: var(--text);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
}

button, input, select { font: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(82, 189, 245, .28);
  outline-offset: 2px;
}

.shell {
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 72px;
}
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: clamp(30px, 4vw, 48px); letter-spacing: .035em; }
h2 { margin-bottom: 8px; font-size: 21px; }
.header-subtitle { color: var(--muted); margin-bottom: 0; }
.eyebrow, .section-kicker {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .18em;
  margin-bottom: 7px;
  text-transform: uppercase;
}
.section-kicker { letter-spacing: .12em; }
.status {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 15px;
  color: var(--muted);
  background: rgba(9, 22, 34, .76);
  white-space: nowrap;
}
.status.ready { color: var(--green); border-color: #267a61; }

.card {
  background: rgba(16, 30, 43, .95);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.card p { color: var(--muted); }
.hidden { display: none !important; }
.error { color: var(--red) !important; min-height: 1.3em; }
.muted-label { color: var(--muted); margin-right: 9px; }

.login-card {
  display: grid;
  grid-template-columns: minmax(220px, .85fr) minmax(280px, 1.15fr);
  gap: 32px;
  max-width: 820px;
  align-items: center;
}
.login-copy p:last-child { margin-bottom: 0; line-height: 1.75; }
form { display: grid; gap: 14px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 14px; }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px 13px;
  background: #081622;
  color: var(--text);
  outline: none;
}
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(82, 189, 245, .11); }
select { min-width: 150px; cursor: pointer; }

button {
  border: 0;
  border-radius: 9px;
  padding: 11px 16px;
  color: white;
  background: linear-gradient(135deg, var(--blue-deep), #319ed7);
  font-weight: 750;
  cursor: pointer;
  transition: transform .14s ease, filter .14s ease, opacity .14s ease;
}
button:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
button:disabled { opacity: .46; cursor: not-allowed; }
button.secondary { background: #203649; border: 1px solid #36566e; }
.danger-button { background: #7f3939; border: 1px solid #a24b4b; }
.mini-button { padding: 7px 11px; border-radius: 7px; font-size: 13px; }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; justify-content: flex-end; }

.toolbar, .section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 17px;
}
.toolbar { padding: 14px 18px; }
.compact-head { align-items: flex-start; }
.section-head > div > p:last-child { margin-bottom: 0; }
.welcome-cera-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  border-color: #78632f;
  background:
    radial-gradient(circle at 5% 50%, rgba(233, 191, 97, .18), transparent 220px),
    linear-gradient(115deg, rgba(26, 37, 47, .98), rgba(16, 30, 43, .98));
}
.welcome-cera-mark {
  width: 92px;
  height: 82px;
  display: grid;
  place-content: center;
  text-align: center;
  border: 1px solid #9b7d38;
  border-radius: 15px;
  color: #f7d77e;
  background: linear-gradient(145deg, rgba(110, 76, 16, .68), rgba(49, 38, 20, .82));
  box-shadow: inset 0 0 22px rgba(255, 210, 97, .08);
}
.welcome-cera-mark strong { display: block; font-size: 25px; line-height: 1.1; }
.welcome-cera-mark span { display: block; margin-top: 6px; font-size: 12px; letter-spacing: .12em; }
.welcome-cera-copy h2 { margin-bottom: 6px; }
.welcome-cera-copy > p:last-of-type { margin-bottom: 10px; line-height: 1.65; }
.welcome-cera-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: 12px; }
.welcome-cera-action { min-width: 184px; display: grid; justify-items: stretch; gap: 9px; }
.benefit-state {
  display: block;
  text-align: center;
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(7, 19, 29, .62);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
}
.benefit-state.available { color: #f7d77e; border-color: #8d7134; }
.benefit-state.completed { color: var(--green); border-color: #2f8266; }
.benefit-state.locked { color: #f2d995; border-color: #745e29; }
.benefit-state.ineligible { color: var(--muted); }
.warning {
  border: 1px solid #80672a;
  background: rgba(94, 71, 20, .46);
  color: #f6dfa7;
  border-radius: 12px;
  padding: 15px 18px;
  margin-bottom: 18px;
  line-height: 1.7;
}

.workspace-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.character-panel {
  position: sticky;
  top: 14px;
  padding: 17px;
}
.character-list { display: grid; gap: 9px; }
.character {
  text-align: left;
  padding: 13px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}
.character.active { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(82, 189, 245, .12); }
.character small { display: block; color: var(--muted); margin-top: 6px; font-weight: 500; }
.compact-empty { padding: 18px 2px !important; }
.workspace-main { min-width: 0; }
.empty-state { text-align: center; padding: 62px 24px; }
.empty-state p { margin-bottom: 0; }
.empty-icon {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  border: 1px solid var(--line-strong);
  border-radius: 17px;
  color: var(--blue);
  background: linear-gradient(145deg, #1c354a, #0b1d2c);
  font-size: 14px;
  font-weight: 800;
}
.character-summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.character-summary h2 { font-size: 26px; margin-bottom: 4px; }
.character-summary p:last-child { margin-bottom: 0; }
.safety-badge {
  color: var(--green);
  background: rgba(35, 126, 94, .17);
  border: 1px solid #2f8266;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  white-space: nowrap;
}

.feature-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 7px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(8, 21, 32, .8);
}
.feature-tab { background: transparent; color: var(--muted); border: 1px solid transparent; }
.feature-tab.active {
  color: white;
  background: linear-gradient(135deg, #1d638c, #247fab);
  border-color: #3e94bd;
}
.feature-panel { min-height: 270px; }
.feature-note {
  margin: 17px 0;
  padding: 12px 14px;
  border-radius: 9px;
  border: 1px solid #745e29;
  color: #efd899;
  background: rgba(89, 66, 15, .23);
  line-height: 1.65;
  font-size: 13px;
}
.safe-note { border-color: #2d6d59; color: #b6ead6; background: rgba(21, 91, 68, .18); }

.task { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; margin-top: 12px; }
.task-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; background: var(--panel-strong); }
.task-head small { color: var(--muted); }
.task-title { font-size: 17px; font-weight: 750; }
.tag { color: var(--blue); font-size: 12px; margin-left: 8px; }
.materials { width: 100%; border-collapse: collapse; }
.materials th, .materials td { padding: 11px 16px; border-top: 1px solid var(--line); text-align: left; }
.materials th { color: var(--muted); font-size: 12px; font-weight: 500; }
.ready-note { padding: 16px; border-top: 1px solid var(--line); color: #f2d995; line-height: 1.7; background: rgba(91, 66, 15, .18); }
.ready-note.done { color: var(--green); background: rgba(18, 93, 69, .16); }
.missing { color: var(--gold); }
.done { color: var(--green); }

.filter-bar {
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(230px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 15px;
}
.search-field { min-width: 0; }
.data-summary {
  color: var(--muted);
  border: 1px solid var(--line);
  background: var(--panel-soft);
  border-radius: 9px;
  padding: 11px 13px;
  min-height: 42px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  font-size: 13px;
}
.standalone-summary { display: inline-flex; margin: 0 0 12px; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; }
.data-table { width: 100%; border-collapse: collapse; min-width: 780px; }
.data-table th, .data-table td { padding: 12px 13px; border-bottom: 1px solid rgba(41, 70, 93, .72); text-align: left; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table th { color: var(--muted); background: #0c1a26; font-size: 12px; font-weight: 650; white-space: nowrap; }
.data-table tbody tr:hover { background: rgba(39, 84, 111, .1); }
.data-table td small { display: block; margin-top: 5px; color: var(--muted); line-height: 1.45; }
.empty-cell { color: var(--muted); text-align: center !important; padding: 30px !important; }
.container-label, .sender-name { font-weight: 700; }
.item-name { font-weight: 700; }
.action-cell, .mail-action { white-space: nowrap; }
.readonly-badge, .protected-badge, .status-chip {
  display: inline-block;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
  color: var(--muted);
  background: #1a2c3b;
  border: 1px solid #355169;
  white-space: nowrap;
}
.protected-badge { color: #f0c675; border-color: #765f2b; background: rgba(91, 67, 16, .25); }
.protected-value { color: var(--gold); font-weight: 700; }
.status-chip { color: var(--blue); border-color: #2f6f95; margin-bottom: 3px; }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 11px; margin-top: 13px; color: var(--muted); font-size: 13px; }

.mail-table { min-width: 980px; }
.mail-detail summary { cursor: pointer; color: #dbeaf2; margin-top: 6px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-detail p { max-width: 320px; margin: 9px 0 4px; color: var(--muted); white-space: pre-wrap; line-height: 1.6; }
.mail-attachments { min-width: 180px; }
.attachment-line { display: block; margin-bottom: 5px; line-height: 1.4; }
.attachment-line:last-child { margin-bottom: 0; }

.rarity-0 { color: #e1edf3; }
.rarity-1 { color: #6fd17f; }
.rarity-2 { color: #61b8ff; }
.rarity-3 { color: #bb79ff; }
.rarity-4 { color: #ffbd56; }
.rarity-5 { color: #ff7581; }
.rarity-6 { color: #70ece1; }
.rarity-7 { color: #f6e580; }

.catalog-card { margin-top: 22px; }
.catalog-heading { align-items: end; }
.catalog-heading p { margin-bottom: 0; }
.catalog-search { width: min(360px, 100%); }
.catalog-list { display: grid; gap: 12px; margin-top: 18px; }
.catalog-group { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: rgba(9, 22, 34, .55); }
.catalog-group summary { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 15px 17px; cursor: pointer; background: var(--panel-strong); }
.catalog-group summary span { color: var(--blue); font-size: 13px; }
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(285px, 1fr)); gap: 10px; padding: 12px; }
.catalog-task { border: 1px solid var(--line); border-radius: 9px; padding: 13px; background: rgba(16, 30, 43, .84); }
.catalog-task-title { font-weight: 700; line-height: 1.45; }
.catalog-task small { display: block; color: var(--muted); margin-top: 5px; }
.catalog-materials { color: #c7d8e4; font-size: 13px; line-height: 1.65; margin-top: 9px; }

.empty { color: var(--muted); padding: 28px 2px; text-align: center; }
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(430px, calc(100% - 44px));
  padding: 14px 17px;
  border-radius: 10px;
  background: #17384a;
  border: 1px solid var(--blue);
  box-shadow: 0 15px 50px rgba(0, 0, 0, .4);
  line-height: 1.5;
}
.toast.bad { border-color: var(--red); background: #462329; }

@media (max-width: 980px) {
  .workspace-layout { grid-template-columns: 1fr; }
  .character-panel { position: static; }
  .character-list { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .filter-bar { grid-template-columns: 180px 1fr; }
  .data-summary { grid-column: 1 / -1; justify-content: center; }
}

@media (max-width: 680px) {
  .shell { width: min(100% - 20px, 1320px); padding-top: 22px; }
  .site-header, .section-head, .task-head, .character-summary { align-items: stretch; flex-direction: column; }
  .status { align-self: flex-start; }
  .login-card { grid-template-columns: 1fr; gap: 20px; }
  .card { padding: 17px; border-radius: 12px; }
  .feature-tabs { gap: 5px; padding: 5px; }
  .feature-tab { padding: 10px 7px; font-size: 13px; }
  .filter-bar { grid-template-columns: 1fr; }
  .data-summary { grid-column: auto; white-space: normal; }
  .button-row { justify-content: flex-start; }
  .welcome-cera-card { grid-template-columns: 72px minmax(0, 1fr); gap: 15px; }
  .welcome-cera-mark { width: 72px; height: 72px; }
  .welcome-cera-mark strong { font-size: 20px; }
  .welcome-cera-action { grid-column: 1 / -1; min-width: 0; }
  .catalog-heading { align-items: stretch; }
  .catalog-grid { grid-template-columns: 1fr; }
  .materials th:nth-child(1), .materials td:nth-child(1) { display: none; }
  .materials th, .materials td { padding: 10px 8px; }
  .toast { right: 12px; bottom: 12px; max-width: calc(100% - 24px); }
}
