/*
 * 埃及豆豆旅行 · 深海军蓝档案视觉系统
 *
 * This file is deliberately loaded after every feature stylesheet.  New views
 * should use the archive-* contracts below; the compatibility section keeps
 * older views visually aligned while they migrate to the shared components.
 */

:root {
  color-scheme: light;
  --archive-navy-950: #0b1b2c;
  --archive-navy-900: #10243a;
  --archive-navy-850: #152b43;
  --archive-navy-800: #1b354d;
  --archive-navy-700: #29465e;
  --archive-gold-700: #ad771d;
  --archive-gold-600: #c68b26;
  --archive-gold-500: #d39a31;
  --archive-gold-300: #e7c681;
  --archive-gold-100: #fbf1dc;
  --archive-canvas: #f7f4ee;
  --archive-canvas-subtle: #faf8f4;
  --archive-surface: #fffdf9;
  --archive-surface-raised: #ffffff;
  --archive-surface-muted: #faf7f1;
  --archive-text: #1d2935;
  --archive-text-soft: #465464;
  --archive-muted: #78828d;
  --archive-muted-light: #9ba3ab;
  --archive-line: #e5e0d7;
  --archive-line-strong: #d7d0c5;
  --archive-success: #267a55;
  --archive-success-bg: #e9f5ee;
  --archive-warning: #9a6719;
  --archive-warning-bg: #fbf1dd;
  --archive-danger: #b94f49;
  --archive-danger-bg: #faecea;
  --archive-info: #2c637f;
  --archive-info-bg: #eaf2f6;
  --archive-radius-xs: 7px;
  --archive-radius-sm: 9px;
  --archive-radius-md: 14px;
  --archive-radius-lg: 18px;
  --archive-radius-pill: 999px;
  --archive-shadow-xs: 0 1px 2px rgba(16, 36, 58, 0.035);
  --archive-shadow-sm: 0 4px 14px rgba(16, 36, 58, 0.055);
  --archive-shadow-drawer: -12px 0 34px rgba(16, 36, 58, 0.12);
  --archive-focus-ring: 0 0 0 3px rgba(211, 154, 49, 0.22);
  --archive-page-gap: 22px;
  --archive-control-height: 42px;
  --archive-sidebar-width: 244px;
  --archive-transition: 160ms ease;
}

/* -------------------------------------------------------------------------- */
/* Application foundation                                                     */
/* -------------------------------------------------------------------------- */

#appView {
  --navy: var(--archive-navy-900);
  --navy2: var(--archive-navy-950);
  --gold: var(--archive-gold-600);
  --gold2: var(--archive-gold-500);
  --paper: var(--archive-surface);
  --bg: var(--archive-canvas);
  --text: var(--archive-text);
  --muted: var(--archive-muted);
  --line: var(--archive-line);
  --shadow: var(--archive-shadow-sm);
  background: var(--archive-canvas);
  color: var(--archive-text);
}

#appView,
#appView button,
#appView input,
#appView select,
#appView textarea {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, -apple-system, sans-serif;
}

#appView .content-shell,
#appView .main-content {
  min-width: 0;
  background: var(--archive-canvas);
}

#appView .main-content {
  color: var(--archive-text);
  scrollbar-gutter: stable;
}

#appView .topbar {
  min-height: 70px;
  padding: 0 28px;
  border-bottom: 1px solid var(--archive-line);
  background: rgba(255, 253, 249, 0.98);
  box-shadow: none;
}

#appView .topbar-copy h1,
#appView #pageTitle {
  color: var(--archive-text);
  font-size: clamp(25px, 2vw, 31px);
  font-weight: 760;
  letter-spacing: -0.035em;
}

#appView .topbar-copy p,
#appView .eyebrow,
#appView .top-actions {
  color: var(--archive-muted);
}

#appView .sidebar {
  width: var(--archive-sidebar-width);
  color: #dce4eb;
  background: var(--archive-navy-900);
  border-right: 1px solid rgba(255, 255, 255, 0.055);
  box-shadow: none;
}

#appView .side-brand {
  border-bottom-color: rgba(255, 255, 255, 0.09);
}

#appView .side-brand-text strong {
  color: #fff;
}

#appView .side-brand-text small,
#appView .nav-group h2,
#appView .side-user small {
  color: rgba(224, 232, 239, 0.56);
}

#appView .sidebar nav .nav-group button,
#appView .sidebar nav button {
  color: #bfc9d3;
  border: 0;
  background: transparent;
  box-shadow: none;
}

#appView .sidebar .nav-text {
  font-size: 20px !important;
  font-weight: 900;
  line-height: 1.25;
}

#appView .sidebar .nav-group h2 {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

#appView .main-content small {
  font-size: 12px;
  line-height: 1.5;
}

#appView .sidebar nav .nav-group button:hover,
#appView .sidebar nav button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.055);
}

#appView .sidebar nav .nav-group button.active,
#appView .sidebar nav button.active {
  color: #fff;
  background: rgba(211, 154, 49, 0.12);
  box-shadow: inset 3px 0 0 var(--archive-gold-500);
}

#appView .sidebar nav .nav-group button.active .nav-svg,
#appView .sidebar nav button.active .nav-svg {
  color: var(--archive-gold-500);
}

#appView .side-user {
  border-top-color: rgba(255, 255, 255, 0.09);
  background: rgba(8, 23, 38, 0.2);
}

#appView .panel,
#appView .metric,
#appView .wizard,
#appView .setting-section,
#appView .account-panel,
#appView .report-trend-panel,
#appView .success-card,
#appView .table-wrap {
  color: var(--archive-text);
  border: 1px solid var(--archive-line);
  border-radius: var(--archive-radius-md);
  background: var(--archive-surface);
  box-shadow: var(--archive-shadow-xs);
}

#appView .panel::before,
#appView .metric::before,
#appView .setting-section::before,
#appView .account-panel::before {
  background: var(--archive-gold-500);
}

#appView :is(input, select, textarea) {
  color: var(--archive-text);
  border: 1px solid var(--archive-line-strong);
  border-radius: var(--archive-radius-sm);
  background: var(--archive-surface-raised);
  box-shadow: none;
  transition: border-color var(--archive-transition), box-shadow var(--archive-transition), background var(--archive-transition);
}

#appView :is(input, select, textarea):hover:not(:disabled) {
  border-color: #c9c0b2;
}

#appView :is(input, select, textarea):focus-visible {
  outline: 0;
  border-color: var(--archive-gold-500);
  box-shadow: var(--archive-focus-ring);
}

#appView :is(input, select, textarea):disabled {
  color: var(--archive-muted-light);
  border-color: var(--archive-line);
  background: #f1eee8;
  cursor: not-allowed;
}

#appView :is(button, a, [tabindex]):focus-visible {
  outline: 0;
  box-shadow: var(--archive-focus-ring);
}

#appView button:disabled,
#appView .disabled {
  opacity: 0.52;
  cursor: not-allowed;
  transform: none;
}

#appView .primary,
#appView .button-link.primary,
#appView .workbench-primary,
#appView .trip-primary,
#appView .knowledge-gold-button {
  color: #fff;
  border: 1px solid var(--archive-navy-900);
  border-radius: var(--archive-radius-sm);
  background: var(--archive-navy-900);
  box-shadow: none;
}

#appView .primary:hover:not(:disabled),
#appView .button-link.primary:hover:not(:disabled),
#appView .workbench-primary:hover:not(:disabled),
#appView .trip-primary:hover:not(:disabled),
#appView .knowledge-gold-button:hover:not(:disabled) {
  border-color: var(--archive-navy-800);
  background: var(--archive-navy-800);
  box-shadow: 0 4px 10px rgba(16, 36, 58, 0.14);
  transform: translateY(-1px);
}

#appView .secondary,
#appView .ghost,
#appView .button-link,
#appView .workbench-secondary,
#appView .trip-outline,
#appView .knowledge-outline-button {
  color: var(--archive-text-soft);
  border: 1px solid var(--archive-line-strong);
  border-radius: var(--archive-radius-sm);
  background: var(--archive-surface-raised);
  box-shadow: none;
}

#appView :is(.secondary, .ghost, .button-link, .workbench-secondary, .trip-outline, .knowledge-outline-button):hover:not(:disabled) {
  color: var(--archive-navy-900);
  border-color: #bfb5a6;
  background: var(--archive-surface-muted);
}

#appView .danger,
#appView .danger-button {
  color: var(--archive-danger);
  border-color: #e8c5c2;
  background: var(--archive-danger-bg);
}

#appView .danger:hover:not(:disabled),
#appView .danger-button:hover:not(:disabled) {
  color: #963e39;
  border-color: #dba9a5;
  background: #f8e3e1;
}

#appView table {
  color: var(--archive-text);
  border-collapse: separate;
  border-spacing: 0;
}

#appView th {
  color: var(--archive-text-soft);
  background: var(--archive-surface-muted);
  border-bottom: 1px solid var(--archive-line);
  font-weight: 690;
}

#appView td {
  border-bottom-color: var(--archive-line);
}

#appView tbody tr:hover td {
  background: rgba(251, 241, 220, 0.34);
}

/* -------------------------------------------------------------------------- */
/* Shared page frame                                                           */
/* -------------------------------------------------------------------------- */

.archive-page {
  width: min(100%, 1560px);
  margin: 0 auto;
  padding: 24px 26px 40px;
  display: grid;
  gap: var(--archive-page-gap);
  color: var(--archive-text);
}

.archive-page-summary,
.archive-summary-band,
.page-summary-band {
  position: relative;
  min-height: 146px;
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(430px, auto);
  align-items: stretch;
  gap: 36px;
  padding: 27px 34px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--archive-radius-md);
  background: var(--archive-navy-900);
  box-shadow: var(--archive-shadow-sm);
  overflow: hidden;
}

#archivePageSummary {
  width: auto;
  margin: 24px 26px 0;
}

#appView .content-shell.archive-summary-active .topbar-copy,
#appView .content-shell.archive-summary-active #dashboardTopSummary {
  display: none !important;
}

/* A feature may explicitly own its visible page heading. The shared top bar
   keeps navigation, date and account controls, but must not repeat that title. */
#appView .content-shell.feature-page-head .topbar-copy,
#appView .content-shell.feature-page-head #dashboardTopSummary {
  display: none !important;
}

#appView .content-shell.feature-page-head .topbar {
  justify-content: flex-end;
}

#appView .content-shell.feature-page-head .topbar #menuBtn {
  margin-right: auto;
}

#appView .content-shell.archive-summary-active .topbar {
  justify-content: flex-end;
}

#appView .content-shell.archive-summary-active .topbar #menuBtn {
  margin-right: auto;
}

/* The legacy workbench hides the account cluster. In the archive shell the
   page title moves into the summary band, so the top bar must keep the real
   date/avatar/account controls visible on every route. */
#appView.dashboard-mode .content-shell.archive-summary-active #topUser {
  display: flex !important;
}

#appView .main-content > .archive-page {
  width: 100%;
  padding: 0;
}

#appView:has(.main-content.ai-assistant-main) .content-shell.archive-summary-active {
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
}

#appView .content-shell.archive-summary-active .main-content.ai-assistant-main {
  height: auto;
  min-height: 0;
}

.archive-page-summary__copy,
.archive-summary-band__copy,
.page-summary-band__copy,
.archive-summary-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
}

.archive-page-summary__eyebrow,
.archive-summary-band__eyebrow,
.page-summary-band__eyebrow,
.archive-summary-eyebrow,
.archive-summary-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  color: var(--archive-gold-300);
  font-size: 12px;
  line-height: 1.25;
  font-weight: 720;
  letter-spacing: 0.12em;
}

.archive-page-summary__eyebrow::before,
.archive-summary-band__eyebrow::before,
.page-summary-band__eyebrow::before,
.archive-summary-eyebrow::before,
.archive-summary-kicker::before {
  width: 15px;
  height: 1px;
  content: "";
  background: currentColor;
}

.archive-summary-kicker svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.archive-page-summary h1,
.archive-page-summary h2,
.archive-summary-band h1,
.archive-summary-band h2,
.page-summary-band h1,
.page-summary-band h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(28px, 2.5vw, 37px);
  line-height: 1.18;
  font-weight: 760;
  letter-spacing: -0.04em;
}

.archive-page-summary__description,
.archive-summary-band__description,
.page-summary-band__description,
.archive-page-summary p,
.archive-summary-band p,
.page-summary-band p {
  max-width: 660px;
  margin: 11px 0 0;
  color: rgba(236, 242, 247, 0.7);
  font-size: 14px;
  line-height: 1.65;
}

.archive-page-summary__metrics,
.archive-summary-band__metrics,
.page-summary-band__metrics,
.archive-summary-metrics {
  min-width: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(112px, 1fr);
  align-items: stretch;
}

.archive-summary-side {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: stretch;
}

.archive-summary-side .archive-summary-metrics {
  min-height: 82px;
}

.archive-summary-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 13px;
  padding: 3px 22px 0;
}

.archive-summary-todos {
  padding: 5px 0;
  color: rgba(236, 242, 247, 0.72);
  background: transparent;
  font-size: 12px;
  font-weight: 680;
}

.archive-summary-todos:hover,
.archive-summary-todos:focus-visible {
  color: #fff;
}

.archive-summary-ai {
  position: relative;
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(231, 198, 129, 0.42);
  border-radius: 11px;
  color: var(--archive-gold-300);
  background: rgba(255, 255, 255, 0.055);
  transition: border-color var(--archive-transition), background var(--archive-transition), transform var(--archive-transition);
}

.archive-summary-ai:hover,
.archive-summary-ai:focus-visible {
  border-color: var(--archive-gold-300);
  background: rgba(255, 255, 255, 0.11);
  transform: translateY(-1px);
}

.archive-summary-ai > svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.archive-summary-ai > i {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border: 2px solid var(--archive-navy-900);
  border-radius: 50%;
  background: var(--archive-gold-300);
}

.archive-summary-ai > i.is-online {
  background: #6fc39a;
}

.archive-ai-tooltip {
  position: absolute;
  right: 0;
  bottom: calc(100% + 9px);
  z-index: 10;
  width: max-content;
  max-width: 210px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  color: #fff;
  background: var(--archive-navy-950);
  box-shadow: var(--archive-shadow-sm);
  font-size: 11px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translateY(3px);
  transition: opacity var(--archive-transition), transform var(--archive-transition);
}

.archive-summary-ai:hover .archive-ai-tooltip,
.archive-summary-ai:focus-visible .archive-ai-tooltip {
  opacity: 1;
  transform: none;
}

.archive-metric,
.archive-metric-stat,
.metric-stat {
  min-width: 0;
  padding: 13px 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  border-left: 1px solid rgba(255, 255, 255, 0.13);
}

.archive-metric:first-child,
.archive-metric-stat:first-child,
.metric-stat:first-child {
  border-left: 0;
}

.archive-metric__icon,
.archive-metric-stat__icon,
.metric-stat__icon {
  width: 28px;
  height: 28px;
  margin-bottom: 8px;
  display: grid;
  place-items: center;
  color: var(--archive-gold-300);
}

.archive-metric strong,
.archive-metric-stat strong,
.metric-stat strong {
  color: #fff;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 740;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.archive-metric span,
.archive-metric-stat span,
.metric-stat span {
  order: 2;
  margin-top: 7px;
  color: rgba(235, 241, 246, 0.68);
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
}

.archive-metric strong,
.archive-metric-stat strong,
.metric-stat strong {
  order: 1;
}

.archive-metric small,
.archive-metric-stat small,
.metric-stat small {
  order: 3;
  margin-top: 4px;
  color: rgba(235, 241, 246, 0.48);
  font-size: 10px;
  line-height: 1.35;
  white-space: nowrap;
}

.archive-metric.is-positive strong,
.archive-metric.is-positive .archive-metric-icon {
  color: #9ed4b7;
}

.archive-metric.is-attention strong,
.archive-metric.is-attention .archive-metric-icon {
  color: var(--archive-gold-300);
}

.archive-metric.is-danger strong,
.archive-metric.is-danger .archive-metric-icon {
  color: #efaaa5;
}

.archive-metric-icon,
.archive-metric .archive-metric-icon {
  order: 1;
  margin: 0 0 7px;
  color: var(--archive-gold-300);
  font-size: 23px;
}

.archive-metric-retention > span:last-child {
  order: 2;
  margin-top: 0;
  color: rgba(235, 241, 246, 0.68);
}

.archive-summary-rule {
  position: absolute;
  left: 34px;
  bottom: 0;
  width: 48px;
  height: 2px;
  background: var(--archive-gold-500);
}

.recycle-record-details {
  grid-column: 1 / -1;
  padding: 15px 0 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  border-top: 1px solid var(--archive-line);
}

.recycle-record-details.hidden {
  display: none;
}

.recycle-record-details > span {
  min-width: 0;
  color: var(--archive-text-soft);
  font-size: 12px;
  line-height: 1.55;
}

.recycle-record-details b {
  display: block;
  margin-bottom: 4px;
  color: var(--archive-muted);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.recycle-results-meta {
  display: flex;
  justify-content: flex-end;
  color: var(--archive-muted);
  font-size: 12px;
}

.recycle-retention-footer {
  padding: 8px 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--archive-muted);
  font-size: 11px;
}

.recycle-restore-drawer {
  width: min(372px, calc(100vw - 28px));
}

body.archive-drawer-open {
  overflow: hidden;
}

.archive-metric--promise strong,
.archive-metric-stat--promise strong,
.metric-stat--promise strong {
  font-size: 22px;
}

/* -------------------------------------------------------------------------- */
/* Toolbar, tabs and controls                                                  */
/* -------------------------------------------------------------------------- */

.archive-page-toolbar,
.archive-toolbar,
.page-toolbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border: 0;
  background: transparent;
}

.archive-page-toolbar__search,
.archive-toolbar__search,
.page-toolbar__search {
  position: relative;
  min-width: 260px;
  flex: 1 1 420px;
}

.archive-page-toolbar__search input,
.archive-toolbar__search input,
.page-toolbar__search input {
  width: 100%;
  min-height: var(--archive-control-height);
  padding-left: 40px;
}

.archive-page-toolbar__search > svg,
.archive-page-toolbar__search > span,
.archive-toolbar__search > svg,
.archive-toolbar__search > span,
.page-toolbar__search > svg,
.page-toolbar__search > span {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 17px;
  height: 17px;
  color: var(--archive-muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.archive-page-toolbar__actions,
.archive-toolbar__actions,
.page-toolbar__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.archive-search-field,
.archive-select-field {
  position: relative;
  min-width: 0;
  display: flex;
  align-items: center;
}

.archive-search-field {
  flex: 1 1 420px;
}

.archive-search-field > span,
.archive-select-field > span {
  position: absolute;
  left: 14px;
  z-index: 1;
  color: var(--archive-muted);
  pointer-events: none;
}

.archive-search-field input,
.archive-select-field select {
  width: 100%;
  min-height: var(--archive-control-height);
}

.archive-search-field input {
  padding-left: 39px;
}

.archive-select-field select {
  min-width: 150px;
  padding-left: 38px;
}

.archive-page-toolbar :is(select, input, button),
.archive-toolbar :is(select, input, button),
.page-toolbar :is(select, input, button) {
  min-height: var(--archive-control-height);
}

.archive-segmented-tabs,
.archive-segmented,
.segmented-tabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--archive-line);
  border-radius: var(--archive-radius-sm);
  background: #eeeae3;
}

.archive-segmented-tabs button,
.archive-segmented button,
.segmented-tabs button {
  min-height: 34px;
  padding: 7px 15px;
  color: var(--archive-muted);
  border: 0;
  border-radius: var(--archive-radius-xs);
  background: transparent;
  box-shadow: none;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.archive-segmented-tabs button:hover,
.archive-segmented button:hover,
.segmented-tabs button:hover {
  color: var(--archive-text);
}

.archive-segmented-tabs button.active,
.archive-segmented-tabs button[aria-selected="true"],
.archive-segmented-tabs button.is-active,
.archive-segmented button.active,
.archive-segmented button[aria-selected="true"],
.archive-segmented button.is-active,
.segmented-tabs button.active,
.segmented-tabs button[aria-selected="true"],
.segmented-tabs button.is-active {
  color: var(--archive-navy-900);
  background: var(--archive-surface-raised);
  box-shadow: var(--archive-shadow-xs);
}

.archive-segmented-tabs button span,
.archive-segmented button span,
.segmented-tabs button span {
  min-width: 18px;
  height: 18px;
  margin-left: 4px;
  padding: 0 5px;
  display: inline-grid;
  place-items: center;
  border-radius: var(--archive-radius-pill);
  background: rgba(16, 36, 58, 0.07);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.archive-button,
.archive-btn,
.primary-button,
.secondary-button,
.danger-button {
  min-height: var(--archive-control-height);
  padding: 9px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--archive-radius-sm);
  font-size: 14px;
  line-height: 1;
  font-weight: 680;
  text-decoration: none;
  cursor: pointer;
  transition: color var(--archive-transition), border-color var(--archive-transition), background var(--archive-transition), box-shadow var(--archive-transition), transform var(--archive-transition);
}

.archive-button--primary,
.archive-btn-primary,
.primary-button {
  color: #fff;
  border: 1px solid var(--archive-navy-900);
  background: var(--archive-navy-900);
  box-shadow: none;
}

.archive-button--primary:hover:not(:disabled),
.archive-btn-primary:hover:not(:disabled),
.primary-button:hover:not(:disabled) {
  border-color: var(--archive-navy-800);
  background: var(--archive-navy-800);
  box-shadow: 0 4px 10px rgba(16, 36, 58, 0.14);
  transform: translateY(-1px);
}

.archive-button--accent {
  color: #fff;
  border: 1px solid var(--archive-gold-600);
  background: var(--archive-gold-600);
}

.archive-button--accent:hover:not(:disabled) {
  border-color: var(--archive-gold-700);
  background: var(--archive-gold-700);
}

.archive-button--secondary,
.archive-btn-secondary,
.secondary-button {
  color: var(--archive-text-soft);
  border: 1px solid var(--archive-line-strong);
  background: var(--archive-surface-raised);
}

.archive-button--secondary:hover:not(:disabled),
.archive-btn-secondary:hover:not(:disabled),
.secondary-button:hover:not(:disabled) {
  color: var(--archive-navy-900);
  border-color: #bfb5a6;
  background: var(--archive-surface-muted);
}

.archive-button--danger,
.archive-btn-danger,
.danger-button {
  color: var(--archive-danger);
  border: 1px solid #e8c5c2;
  background: var(--archive-danger-bg);
}

.archive-button--ghost {
  color: var(--archive-text-soft);
  border: 1px solid transparent;
  background: transparent;
}

.archive-button--compact {
  min-height: 34px;
  padding: 7px 13px;
  font-size: 13px;
}

.archive-button--icon {
  width: var(--archive-control-height);
  padding: 0;
}

.archive-btn-confirm {
  color: #fff;
  border: 1px solid var(--archive-gold-600);
  background: var(--archive-gold-600);
}

.archive-btn-confirm:hover:not(:disabled) {
  border-color: var(--archive-gold-700);
  background: var(--archive-gold-700);
}

/* -------------------------------------------------------------------------- */
/* Record cards and data tables                                                */
/* -------------------------------------------------------------------------- */

.archive-record-list,
.record-card-list {
  display: grid;
  gap: 13px;
}

.archive-record-card,
.record-card {
  position: relative;
  min-width: 0;
  padding: 19px 22px 19px 26px;
  display: grid;
  grid-template-columns: minmax(300px, 1.45fr) minmax(250px, 1fr) auto;
  align-items: center;
  gap: 26px;
  color: var(--archive-text);
  border: 1px solid var(--archive-line);
  border-radius: var(--archive-radius-md);
  background: var(--archive-surface);
  box-shadow: var(--archive-shadow-xs);
  overflow: hidden;
}

.archive-record-card::before,
.record-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  content: "";
  background: var(--archive-gold-500);
}

.archive-record-card:hover,
.record-card:hover {
  border-color: #d7cdbd;
  box-shadow: var(--archive-shadow-sm);
}

.archive-record-card__main,
.record-card__main,
.archive-record-primary,
.archive-record-card__detail,
.record-card__detail,
.archive-record-audit {
  min-width: 0;
}

.archive-record-card__header,
.record-card__header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.archive-record-card__title,
.record-card__title {
  margin: 0;
  color: var(--archive-text);
  font-size: 17px;
  line-height: 1.35;
  font-weight: 740;
}

.archive-record-card__meta,
.record-card__meta {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 15px;
  color: var(--archive-muted);
  font-size: 12px;
  line-height: 1.5;
}

.archive-record-card__detail,
.record-card__detail,
.archive-record-audit {
  padding-left: 24px;
  border-left: 1px solid var(--archive-line);
}

.archive-record-card__label,
.record-card__label {
  margin-bottom: 5px;
  color: var(--archive-muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.archive-record-card__value,
.record-card__value {
  color: var(--archive-text-soft);
  font-size: 13px;
  line-height: 1.55;
}

.archive-record-card__actions,
.record-card__actions,
.archive-record-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.archive-record-primary h3 {
  margin: 10px 0 0;
  color: var(--archive-text);
  font-size: 17px;
  line-height: 1.35;
  font-weight: 740;
}

.archive-record-audit > strong {
  display: block;
  margin-bottom: 8px;
  color: var(--archive-text);
  font-size: 12px;
  font-weight: 710;
}

.archive-record-audit dl {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 16px;
}

.archive-record-audit dl > div {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 6px;
}

.archive-record-audit :is(dt, dd) {
  margin: 0;
  color: var(--archive-muted);
  font-size: 11px;
  line-height: 1.45;
}

.archive-record-audit dd {
  color: var(--archive-text-soft);
  overflow-wrap: anywhere;
}

.archive-chip-row {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.archive-data-table-wrap,
.data-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--archive-line);
  border-radius: var(--archive-radius-md);
  background: var(--archive-surface);
  box-shadow: var(--archive-shadow-xs);
}

.archive-data-table,
.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--archive-text);
  background: var(--archive-surface);
}

.archive-data-table th,
.data-table th {
  padding: 13px 16px;
  color: var(--archive-text-soft);
  border-bottom: 1px solid var(--archive-line);
  background: var(--archive-surface-muted);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 690;
  text-align: left;
  white-space: nowrap;
}

.archive-data-table td,
.data-table td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--archive-line);
  background: var(--archive-surface);
  font-size: 13px;
  line-height: 1.55;
  vertical-align: middle;
}

.archive-data-table tbody tr:last-child td,
.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.archive-data-table tbody tr:hover td,
.data-table tbody tr:hover td {
  background: rgba(251, 241, 220, 0.32);
}

/* -------------------------------------------------------------------------- */
/* Pills, chips and metadata                                                   */
/* -------------------------------------------------------------------------- */

.archive-status-pill,
.status-pill {
  min-height: 24px;
  padding: 4px 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--archive-muted);
  border: 1px solid var(--archive-line);
  border-radius: var(--archive-radius-pill);
  background: #f1eee8;
  font-size: 11px;
  line-height: 1;
  font-weight: 680;
  white-space: nowrap;
}

.archive-status-pill--success,
.status-pill--success {
  color: var(--archive-success);
  border-color: #cfe7d8;
  background: var(--archive-success-bg);
}

.archive-status-pill--warning,
.status-pill--warning {
  color: var(--archive-warning);
  border-color: #edd8aa;
  background: var(--archive-warning-bg);
}

.archive-status-pill--danger,
.status-pill--danger,
.archive-status-pill--deleted,
.status-pill--deleted,
.archive-status-pill.deleted,
.archive-status-pill.is-deleted {
  color: var(--archive-danger);
  border-color: #eacac7;
  background: var(--archive-danger-bg);
}

.archive-status-pill--info,
.status-pill--info {
  color: var(--archive-info);
  border-color: #d2e1e9;
  background: var(--archive-info-bg);
}

.archive-status-pill--neutral,
.status-pill--neutral,
.archive-status-pill--cancelled,
.status-pill--cancelled,
.archive-status-pill.canceled,
.archive-status-pill.cancelled,
.archive-status-pill.is-cancelled {
  color: #5f6872;
  border-color: #ddd8d0;
  background: #f0ede7;
}

.archive-content-chip,
.content-chip {
  min-height: 25px;
  padding: 4px 9px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--archive-text-soft);
  border: 1px solid var(--archive-line);
  border-radius: var(--archive-radius-xs);
  background: var(--archive-surface-muted);
  font-size: 11px;
  line-height: 1;
  font-weight: 620;
  white-space: nowrap;
}

.archive-content-chip--gold,
.content-chip--gold {
  color: var(--archive-warning);
  border-color: #ead39e;
  background: var(--archive-gold-100);
}

.archive-chip-list,
.content-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* -------------------------------------------------------------------------- */
/* Side drawer                                                                 */
/* -------------------------------------------------------------------------- */

.archive-drawer-backdrop,
.side-drawer-backdrop,
.archive-side-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 880;
  display: flex;
  justify-content: flex-end;
  background: rgba(11, 27, 44, 0.38);
  opacity: 1;
  transition: opacity var(--archive-transition);
}

.archive-drawer-backdrop.hidden,
.side-drawer-backdrop.hidden,
.archive-side-drawer-overlay.hidden {
  display: none;
  opacity: 0;
}

.archive-side-drawer,
.side-drawer {
  width: min(410px, calc(100vw - 28px));
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  color: var(--archive-text);
  border-left: 1px solid var(--archive-line);
  background: var(--archive-surface-raised);
  box-shadow: var(--archive-shadow-drawer);
  overflow: hidden;
  animation: archive-drawer-enter 180ms ease-out both;
}

/* The restore flow is intentionally a compact archive drawer, matching the
   approved ledger reference rather than the wider operational drawers. */
.archive-side-drawer.recycle-restore-drawer {
  width: min(330px, calc(100vw - 28px));
}

@keyframes archive-drawer-enter {
  from { transform: translateX(18px); opacity: 0.72; }
  to { transform: translateX(0); opacity: 1; }
}

.archive-side-drawer__header,
.side-drawer__header,
.archive-side-drawer > header {
  min-height: 78px;
  padding: 21px 22px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--archive-line);
}

.archive-side-drawer__header h2,
.side-drawer__header h2,
.archive-side-drawer > header h2 {
  margin: 0;
  color: var(--archive-text);
  font-size: 20px;
  line-height: 1.3;
  font-weight: 740;
}

.archive-side-drawer__header p,
.side-drawer__header p,
.archive-side-drawer > header p {
  margin: 5px 0 0;
  color: var(--archive-muted);
  font-size: 12px;
  line-height: 1.55;
}

.archive-side-drawer__close,
.side-drawer__close,
.archive-drawer-close {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--archive-muted);
  border: 1px solid transparent;
  border-radius: var(--archive-radius-xs);
  background: transparent;
}

.archive-side-drawer__close:hover,
.side-drawer__close:hover,
.archive-drawer-close:hover {
  color: var(--archive-text);
  border-color: var(--archive-line);
  background: var(--archive-surface-muted);
}

.archive-side-drawer__body,
.side-drawer__body {
  min-height: 0;
  padding: 22px;
  overflow-y: auto;
}

.archive-side-drawer__footer,
.side-drawer__footer,
.archive-side-drawer form > footer {
  padding: 15px 22px 18px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  border-top: 1px solid var(--archive-line);
  background: var(--archive-surface-muted);
}

.archive-side-drawer > form {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.archive-side-drawer > form > :not(footer) {
  margin-inline: 22px;
}

.archive-side-drawer > form > :first-child {
  margin-top: 22px;
}

.archive-side-drawer form > footer {
  margin-top: auto;
}

.recycle-restore-targets {
  display: grid;
  gap: 8px;
}

.recycle-restore-targets label {
  padding: 12px 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--archive-text-soft);
  border: 1px solid var(--archive-line);
  border-radius: var(--archive-radius-sm);
  background: var(--archive-surface);
  font-size: 13px;
  font-weight: 650;
}

.recycle-restore-targets input[type="checkbox"] {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  margin: 0;
  accent-color: var(--archive-navy-800);
}

.recycle-restore-targets label > span {
  min-width: 0;
  flex: 1;
}

.recycle-restore-note {
  padding: 12px 13px;
  color: var(--archive-info);
  border: 1px solid #d2e1e9;
  border-radius: var(--archive-radius-sm);
  background: var(--archive-info-bg);
  font-size: 12px;
  line-height: 1.55;
}

.archive-inline-error {
  padding: 10px 12px;
  color: var(--archive-danger);
  border: 1px solid #eacac7;
  border-radius: var(--archive-radius-sm);
  background: var(--archive-danger-bg);
  font-size: 12px;
}

.archive-drawer-option,
.side-drawer-option {
  padding: 13px 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--archive-line);
  border-radius: var(--archive-radius-sm);
  background: var(--archive-surface);
}

.archive-drawer-option + .archive-drawer-option,
.side-drawer-option + .side-drawer-option {
  margin-top: 8px;
}

/* -------------------------------------------------------------------------- */
/* Confirm dialog                                                              */
/* -------------------------------------------------------------------------- */

.archive-confirm-backdrop,
.confirm-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 920;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(11, 27, 44, 0.42);
}

.archive-confirm-backdrop.hidden,
.confirm-dialog-backdrop.hidden {
  display: none;
}

.archive-confirm-dialog,
.confirm-dialog {
  width: min(430px, 100%);
  color: var(--archive-text);
  border: 1px solid var(--archive-line);
  border-radius: var(--archive-radius-lg);
  background: var(--archive-surface-raised);
  box-shadow: 0 20px 50px rgba(11, 27, 44, 0.18);
  overflow: hidden;
}

.archive-confirm-dialog__body,
.confirm-dialog__body {
  padding: 25px 26px 22px;
}

.archive-confirm-dialog h2,
.confirm-dialog h2 {
  margin: 0;
  color: var(--archive-text);
  font-size: 19px;
  line-height: 1.4;
  font-weight: 740;
}

.archive-confirm-dialog p,
.confirm-dialog p {
  margin: 9px 0 0;
  color: var(--archive-muted);
  font-size: 13px;
  line-height: 1.65;
}

.archive-confirm-dialog__footer,
.confirm-dialog__footer {
  padding: 14px 18px;
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  border-top: 1px solid var(--archive-line);
  background: var(--archive-surface-muted);
}

/* -------------------------------------------------------------------------- */
/* Empty, loading and error states                                             */
/* -------------------------------------------------------------------------- */

.archive-state,
.archive-empty-state,
.archive-loading-state,
.archive-error-state,
.empty-state,
.loading-state,
.error-state {
  min-height: 220px;
  padding: 36px 24px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 9px;
  color: var(--archive-muted);
  border: 1px dashed var(--archive-line-strong);
  border-radius: var(--archive-radius-md);
  background: rgba(255, 253, 249, 0.56);
  text-align: center;
}

.archive-state__icon,
.empty-state__icon,
.loading-state__icon,
.error-state__icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--archive-gold-600);
}

.archive-state h3,
.archive-empty-state h3,
.archive-loading-state h3,
.archive-error-state h3,
.empty-state h3,
.loading-state h3,
.error-state h3 {
  margin: 0;
  color: var(--archive-text);
  font-size: 16px;
  font-weight: 710;
}

.archive-state p,
.archive-empty-state p,
.archive-loading-state p,
.archive-error-state p,
.empty-state p,
.loading-state p,
.error-state p {
  max-width: 520px;
  margin: 0;
  color: var(--archive-muted);
  font-size: 13px;
  line-height: 1.6;
}

.archive-error-state,
.error-state {
  color: var(--archive-danger);
  border-color: #e4c3c0;
  background: rgba(250, 236, 234, 0.52);
}

.archive-skeleton,
.loading-skeleton {
  min-height: 14px;
  border-radius: 5px;
  background: #e9e4dc;
  animation: archive-pulse 1.35s ease-in-out infinite alternate;
}

@keyframes archive-pulse {
  from { opacity: 0.48; }
  to { opacity: 0.9; }
}

.archive-spinner,
.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--archive-line-strong);
  border-top-color: var(--archive-gold-600);
  border-radius: 50%;
  animation: archive-spin 750ms linear infinite;
}

@keyframes archive-spin {
  to { transform: rotate(360deg); }
}

/* -------------------------------------------------------------------------- */
/* Pagination                                                                  */
/* -------------------------------------------------------------------------- */

.archive-pagination,
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.archive-pagination button,
.archive-pagination a,
.pagination button,
.pagination a {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  display: inline-grid;
  place-items: center;
  color: var(--archive-text-soft);
  border: 1px solid var(--archive-line);
  border-radius: var(--archive-radius-xs);
  background: var(--archive-surface);
  text-decoration: none;
}

.archive-pagination :is(button, a):hover,
.pagination :is(button, a):hover {
  color: var(--archive-navy-900);
  border-color: #bfb5a6;
}

.archive-pagination .active,
.archive-pagination [aria-current="page"],
.pagination .active,
.pagination [aria-current="page"] {
  color: #fff;
  border-color: var(--archive-navy-900);
  background: var(--archive-navy-900);
}

/* -------------------------------------------------------------------------- */
/* Compatibility layer for established pages                                  */
/* -------------------------------------------------------------------------- */

#appView .workbench-page {
  --wb-bg: var(--archive-canvas);
  --wb-card: var(--archive-surface);
  --wb-soft: var(--archive-surface-muted);
  --wb-line: var(--archive-line);
  --wb-text: var(--archive-text);
  --wb-muted: var(--archive-muted);
  --wb-navy: var(--archive-navy-900);
  --wb-gold: var(--archive-gold-600);
  --wb-shadow: var(--archive-shadow-xs);
  background: var(--archive-canvas);
}

#appView :is(.workbench-panel, .workbench-metric, .workbench-task-panel, .workbench-business-panel) {
  color: var(--archive-text);
  border-color: var(--archive-line);
  border-radius: var(--archive-radius-md);
  background: var(--archive-surface);
  box-shadow: var(--archive-shadow-xs);
}

#appView :is(.operations-page, .trip-center-main, .trip-center-page, .report-page, .settings-page, .recycle-page, .ai-assistant-main) {
  color: var(--archive-text);
  background: var(--archive-canvas);
}

#appView :is(.ops-panel, .ops-metrics article, .payment-list-panel, .payment-summary > article, .payment-detail-card, .payment-detail-section, .arrangement-panel, .arrangement-card, .hotel-arrangement-card, .trip-center-workspace, .trip-mode-panel, .recycle-card, .recycle-toolbar) {
  border-color: var(--archive-line);
  border-radius: var(--archive-radius-md);
  background: var(--archive-surface);
  box-shadow: var(--archive-shadow-xs);
}

#appView :is(.ops-filterbar, .payment-filters, .search-row) {
  border-color: var(--archive-line);
  background: transparent;
  box-shadow: none;
}

#appView :is(.ops-segmented, .workbench-segmented) {
  border-color: var(--archive-line);
  background: #eeeae3;
}

#appView :is(.ops-segmented, .workbench-segmented) button.active {
  color: var(--archive-navy-900);
  background: var(--archive-surface);
  box-shadow: var(--archive-shadow-xs);
}

#appView :is(.status, .payment-status, .route-state) {
  border-radius: var(--archive-radius-pill);
  box-shadow: none;
}

#appView :is(.ops-team-table, .payment-table) th {
  color: var(--archive-text-soft);
  background: var(--archive-surface-muted);
}

#appView :is(.ops-team-table, .payment-table) td {
  background: var(--archive-surface);
}

/* Keep the primary row action visible while the dense, multi-currency payment
   ledger scrolls inside its own table wrapper. */
#appView .payment-table th:last-child,
#appView .payment-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  min-width: 104px;
  background: var(--archive-surface);
  box-shadow: -10px 0 14px -14px rgba(16, 36, 58, 0.42);
}

#appView .payment-table th:last-child {
  z-index: 3;
  background: var(--archive-surface-muted);
}

#appView :is(.ops-drawer, .payment-detail-drawer, .workbench-drawer) {
  border-left-color: var(--archive-line);
  background: var(--archive-surface-raised);
  box-shadow: var(--archive-shadow-drawer);
}

#appView :is(.ops-overlay, .payment-overlay, .workbench-overlay) {
  background: rgba(11, 27, 44, 0.38);
}

#appView :is(.ops-modal, .payment-modal, .workbench-modal, .avatar-modal, .business-delete-confirm, .quote-share-dialog) {
  border-color: var(--archive-line);
  border-radius: var(--archive-radius-lg);
  background: var(--archive-surface-raised);
  box-shadow: 0 20px 50px rgba(11, 27, 44, 0.18);
}

#appView :is(.ops-empty, .recycle-empty, .trip-empty, .knowledge-empty, .ai-empty-state) {
  color: var(--archive-muted);
  border-color: var(--archive-line-strong);
  background: rgba(255, 253, 249, 0.56);
}

#appView :is(.ops-error, .workbench-error, .ai-error, .trip-error) {
  color: var(--archive-danger);
  border-color: #e4c3c0;
  background: var(--archive-danger-bg);
}

/* Recycle cards retain their feature markup while inheriting archive records. */
#appView .recycle-list {
  display: grid;
  gap: 13px;
}

#appView .recycle-card {
  position: relative;
  padding: 19px 22px 19px 26px;
  overflow: hidden;
}

#appView .recycle-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  content: "";
  background: var(--archive-gold-500);
}

#appView .recycle-card-actions .primary,
#appView .recycle-card-actions button[data-action="restore"] {
  color: #fff;
  border-color: var(--archive-navy-900);
  background: var(--archive-navy-900);
}

/* Trip center */
#appView .trip-center-page {
  --trip-gold: var(--archive-gold-600);
  --trip-card: var(--archive-surface);
  --trip-line: var(--archive-line);
  --trip-text: var(--archive-text);
  --trip-muted: var(--archive-muted);
}

#appView .trip-center-tabs,
#appView .itinerary-hub-tabs {
  border-color: var(--archive-line);
  background: var(--archive-surface);
  box-shadow: var(--archive-shadow-xs);
}

#appView :is(.trip-center-tabs, .itinerary-hub-tabs) button.active {
  color: var(--archive-navy-900);
  border-color: var(--archive-gold-500);
  background: var(--archive-gold-100);
}

#appView .trip-history-card,
#appView .itinerary-entry {
  border-color: var(--archive-line);
  background: var(--archive-surface);
  box-shadow: none;
}

/* Knowledge base had a separate cold canvas; align it without changing layout. */
#appView .knowledge-shell {
  --kb-bg: var(--archive-canvas);
  --kb-surface: var(--archive-surface);
  --kb-surface-2: var(--archive-surface-muted);
  --kb-border: var(--archive-line);
  --kb-text: var(--archive-text);
  --kb-muted: var(--archive-muted);
  --kb-gold: var(--archive-gold-600);
  --knowledge-bg: var(--archive-canvas);
  --knowledge-surface: var(--archive-surface);
  --knowledge-card: var(--archive-surface);
  --knowledge-text: var(--archive-text);
  --knowledge-muted: var(--archive-muted);
  --knowledge-line: var(--archive-line);
  --knowledge-gold: var(--archive-gold-600);
  color: var(--archive-text);
  background: var(--archive-canvas);
}

/* knowledge.css hid the desktop top bar in its legacy standalone layout. The
   unified archive shell keeps the shared date/avatar/account header visible. */
#appView .content-shell.knowledge-shell.archive-summary-active .topbar {
  display: flex !important;
}

#appView :is(.knowledge-page-header, .knowledge-table, .knowledge-grid-card, .knowledge-dialog, .knowledge-preview-panel) {
  border-color: var(--archive-line);
  background: var(--archive-surface);
  box-shadow: var(--archive-shadow-xs);
}

/* The archive summary already carries the page title. Keep the upload action,
   but remove the second, visually competing "资料库" heading below it. */
.content-shell.archive-summary-active #knowledgePage > .knowledge-page-header {
  justify-content: flex-end;
  min-height: 58px;
  padding-block: 12px;
}

.content-shell.archive-summary-active #knowledgePage > .knowledge-page-header > div {
  display: none;
}

#appView .knowledge-category-tabs button.active,
#appView .knowledge-view-toggle button.active {
  color: var(--archive-navy-900);
  border-color: var(--archive-gold-500);
  background: var(--archive-gold-100);
}

/* AI retains the conversation-first layout but uses the same surfaces. */
#appView .ai-assistant-main {
  --ai-navy: var(--archive-navy-900);
  --ai-gold: var(--archive-gold-600);
  --ai-bg: var(--archive-canvas);
  --ai-card: var(--archive-surface);
  --ai-line: var(--archive-line);
  --ai-text: var(--archive-text);
  --ai-muted: var(--archive-muted);
}

#appView :is(.ai-chat-workspace, .ai-chat-sidebar, .ai-chat-main, .ai-conversation-card, .ai-message-card, .ai-chat-composer, .ai-source-card, .ai-result-card) {
  border-color: var(--archive-line);
  background: var(--archive-surface);
  box-shadow: none;
}

#appView .ai-user-message,
#appView .ai-message--user .ai-message-card {
  border-color: #e8ca8d;
  background: var(--archive-gold-100);
}

#appView .ai-chat-composer button[type="submit"] {
  color: #fff;
  border-color: var(--archive-navy-900);
  background: var(--archive-navy-900);
}

/* Settings and reports */
#appView :is(.settings-tabs, .report-filters, .report-metrics article) {
  border-color: var(--archive-line);
  background: var(--archive-surface);
  box-shadow: var(--archive-shadow-xs);
}

#appView .settings-tabs button.active {
  color: var(--archive-navy-900);
  border-color: var(--archive-gold-500);
  background: var(--archive-gold-100);
}

#appView .report-chart :is(.bar, .chart-primary) {
  background: var(--archive-navy-900);
}

#appView .report-chart :is(.bar-accent, .chart-accent) {
  background: var(--archive-gold-500);
}

/* Common notices are compact and non-blocking. */
#appView :is(.notice, .inline-notice) {
  color: var(--archive-info);
  border: 1px solid #d2e1e9;
  border-radius: var(--archive-radius-sm);
  background: var(--archive-info-bg);
  box-shadow: none;
}

#appView :is(.notice.warning, .inline-notice.warning) {
  color: var(--archive-warning);
  border-color: #edd8aa;
  background: var(--archive-warning-bg);
}

#appView :is(.notice.danger, .inline-notice.danger) {
  color: var(--archive-danger);
  border-color: #eacac7;
  background: var(--archive-danger-bg);
}

/* -------------------------------------------------------------------------- */
/* Responsive                                                                  */
/* -------------------------------------------------------------------------- */

@media (max-width: 1280px) {
  .archive-page-summary,
  .archive-summary-band,
  .page-summary-band {
    grid-template-columns: minmax(280px, 1fr) minmax(380px, auto);
    gap: 24px;
    padding-inline: 28px;
  }

  .archive-metric,
  .archive-metric-stat,
  .metric-stat {
    padding-inline: 17px;
  }

  .archive-record-card,
  .record-card {
    grid-template-columns: minmax(260px, 1.3fr) minmax(220px, 1fr) auto;
    gap: 18px;
  }
}

@media (max-width: 1024px) {
  :root {
    --archive-page-gap: 18px;
  }

  .archive-page {
    padding: 20px 20px 34px;
  }

  .archive-page-summary,
  .archive-summary-band,
  .page-summary-band {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 25px 26px;
  }

  .archive-page-summary__metrics,
  .archive-summary-band__metrics,
  .page-summary-band__metrics,
  .archive-summary-metrics {
    grid-auto-flow: row;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .archive-metric,
  .archive-metric-stat,
  .metric-stat {
    min-height: 70px;
    padding-block: 8px;
  }

  .archive-record-card,
  .record-card {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .archive-record-card__detail,
  .record-card__detail,
  .archive-record-audit {
    grid-column: 1 / -1;
    padding: 13px 0 0;
    border-top: 1px solid var(--archive-line);
    border-left: 0;
  }

  .archive-page-toolbar,
  .archive-toolbar,
  .page-toolbar {
    flex-wrap: wrap;
  }

  .archive-page-toolbar__search,
  .archive-toolbar__search,
  .page-toolbar__search {
    flex-basis: 100%;
  }
}

@media (max-width: 768px) {
  #appView .topbar {
    min-height: 62px;
    padding-inline: 16px;
  }

  #appView .topbar-copy h1,
  #appView #pageTitle {
    font-size: 24px;
  }

  .archive-page {
    padding: 16px 14px 30px;
  }

  .archive-page-summary,
  .archive-summary-band,
  .page-summary-band {
    min-height: 0;
    padding: 22px 20px;
    border-radius: var(--archive-radius-sm);
  }

  .archive-page-summary h1,
  .archive-page-summary h2,
  .archive-summary-band h1,
  .archive-summary-band h2,
  .page-summary-band h1,
  .page-summary-band h2 {
    font-size: 27px;
  }

  .archive-page-summary__metrics,
  .archive-summary-band__metrics,
  .page-summary-band__metrics,
  .archive-summary-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 1px;
  }

  .archive-metric,
  .archive-metric-stat,
  .metric-stat {
    border-left: 1px solid rgba(255, 255, 255, 0.13);
  }

  .archive-metric:nth-child(odd),
  .archive-metric-stat:nth-child(odd),
  .metric-stat:nth-child(odd) {
    border-left: 0;
  }

  .archive-record-card,
  .record-card {
    padding: 18px 17px 18px 20px;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .archive-record-card__actions,
  .record-card__actions,
  .archive-record-actions {
    justify-content: flex-start;
  }

  .archive-page-toolbar__actions,
  .archive-toolbar__actions,
  .page-toolbar__actions {
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
  }

  .archive-segmented-tabs,
  .archive-segmented,
  .segmented-tabs {
    max-width: 100%;
    overflow-x: auto;
  }

  .archive-side-drawer,
  .side-drawer {
    width: min(100%, 440px);
  }
}

@media (max-width: 480px) {
  .archive-page {
    padding-inline: 11px;
  }

  .archive-page-summary,
  .archive-summary-band,
  .page-summary-band {
    padding: 20px 17px;
  }

  .archive-page-summary__description,
  .archive-summary-band__description,
  .page-summary-band__description,
  .archive-page-summary p,
  .archive-summary-band p,
  .page-summary-band p {
    font-size: 13px;
  }

  .archive-metric,
  .archive-metric-stat,
  .metric-stat {
    padding-inline: 12px;
  }

  .archive-metric strong,
  .archive-metric-stat strong,
  .metric-stat strong {
    font-size: 25px;
  }

  .archive-page-toolbar__search,
  .archive-toolbar__search,
  .page-toolbar__search {
    min-width: 100%;
  }

  .archive-record-card__actions,
  .record-card__actions,
  .archive-record-actions,
  .archive-side-drawer__footer,
  .side-drawer__footer {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .archive-record-card__actions > *,
  .record-card__actions > *,
  .archive-record-actions > *,
  .archive-side-drawer__footer > *,
  .side-drawer__footer > * {
    width: 100%;
  }

  .archive-side-drawer,
  .side-drawer {
    width: 100%;
  }

  .archive-side-drawer.recycle-restore-drawer {
    width: 100%;
  }

  .recycle-record-details {
    grid-template-columns: 1fr;
  }

  .archive-confirm-dialog,
  .confirm-dialog {
    border-radius: var(--archive-radius-md);
  }
}

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

@media print {
  #appView .sidebar,
  #appView .topbar,
  .archive-page-toolbar,
  .archive-toolbar,
  .page-toolbar,
  .archive-record-card__actions,
  .record-card__actions {
    display: none !important;
  }

  #appView,
  #appView .content-shell,
  #appView .main-content,
  .archive-page {
    background: #fff !important;
  }

  .archive-page {
    max-width: none;
    padding: 0;
  }

  .archive-record-card,
  .record-card,
  .archive-data-table-wrap,
  .data-table-wrap {
    box-shadow: none;
    break-inside: avoid;
  }
}

/* -------------------------------------------------------------------------- */
/* White right workspace                                                      */
/* -------------------------------------------------------------------------- */

/* The navigation rail remains navy.  Everything to its right uses one white
   canvas, including the shared page summary and the two feature-owned page
   headings.  Keep the summary markup alive because it carries real metrics,
   AI access and permission-trimmed actions. */
#appView {
  --archive-canvas: #fff;
  --archive-canvas-subtle: #fff;
  --archive-surface: #fff;
  --archive-surface-raised: #fff;
  --archive-surface-muted: #fff;
  --paper: #fff;
  --bg: #fff;
  background: #fff;
}

#appView.dashboard-mode {
  --wb-bg: #fff;
  background: #fff;
}

#appView > .content-shell,
#appView .main-content,
#appView .topbar,
#appView :is(
  .workbench-page,
  .operations-page,
  .orders-page,
  .settings-control-page,
  .trip-center-main,
  .trip-center-page,
  .knowledge-shell,
  .report-page,
  .recycle-page,
  .ai-assistant-main
) {
  background: #fff;
}

/* Remove every page-level navy ribbon without removing its information. */
#appView :is(
  #archivePageSummary,
  .archive-page-summary,
  .archive-summary-band,
  .page-summary-band,
  .orders-heading,
  .settings-control-heading,
  .order-detail-head
) {
  color: var(--archive-text);
  border: 0;
  border-bottom: 1px solid var(--archive-line);
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

#appView #archivePageSummary {
  margin-top: 0;
}

#appView :is(
  #archivePageSummary,
  .archive-page-summary,
  .archive-summary-band,
  .page-summary-band,
  .orders-heading,
  .settings-control-heading,
  .order-detail-head
) :is(h1, h2, strong) {
  color: var(--archive-text);
}

#appView :is(
  #archivePageSummary,
  .archive-page-summary,
  .archive-summary-band,
  .page-summary-band,
  .orders-heading,
  .settings-control-heading
) p,
#appView :is(
  .archive-page-summary,
  .archive-summary-band,
  .page-summary-band
) :is(.archive-metric, .archive-metric-stat, .metric-stat) :is(span, small),
#appView .archive-metric-retention > span:last-child,
#appView .settings-control-heading-meta span {
  color: var(--archive-muted);
}

#appView :is(
  .archive-page-summary,
  .archive-summary-band,
  .page-summary-band
) :is(.archive-metric, .archive-metric-stat, .metric-stat) {
  border-left-color: var(--archive-line);
}

#appView :is(
  .archive-summary-kicker,
  .archive-summary-eyebrow,
  .archive-page-summary__eyebrow,
  .archive-summary-band__eyebrow,
  .page-summary-band__eyebrow,
  .orders-heading > div > span,
  .settings-control-heading > div > span,
  .order-detail-head span
) {
  color: var(--archive-gold-700);
}

#appView .archive-metric.is-positive strong {
  color: var(--archive-success);
}

#appView .archive-metric.is-attention strong {
  color: var(--archive-warning);
}

#appView .archive-metric.is-danger strong {
  color: var(--archive-danger);
}

#appView .archive-summary-todos {
  color: var(--archive-muted);
}

#appView .archive-summary-todos:hover,
#appView .archive-summary-todos:focus-visible {
  color: var(--archive-text);
}

#appView .archive-summary-ai {
  color: var(--archive-gold-700);
  border-color: var(--archive-line-strong);
  background: #fff;
}

#appView .archive-summary-ai:hover,
#appView .archive-summary-ai:focus-visible {
  border-color: var(--archive-gold-500);
  background: var(--archive-gold-100);
}

#appView .archive-summary-ai > i {
  border-color: #fff;
}

#appView .settings-control-heading-meta {
  border-color: var(--archive-line);
}

#appView .order-detail-drawer {
  background: #fff;
}

#appView .order-detail-head .icon-btn {
  color: var(--archive-text-soft);
  border-color: var(--archive-line-strong);
  background: #fff;
}

#appView .order-detail-head .icon-btn:hover {
  color: var(--archive-text);
  border-color: var(--archive-gold-500);
  background: var(--archive-gold-100);
}

#appView .orders-create-button:focus-visible {
  outline-color: rgba(211, 154, 49, 0.38);
}

/* -------------------------------------------------------------------------- */
/* V3 · 精简白金礼宾台账：全系统共享表面、层级与可读密度                     */
/* -------------------------------------------------------------------------- */

#appView{
  --archive-control-height:44px;
  --archive-page-gap:18px;
  background:#fff;
}

#appView :is(
  .workbench-page,.operations-page,.orders-page,.new-order-page,.settings-control-page,
  .personal-settings,.trip-center-page,.knowledge-shell,.report-page,.recycle-page,
  .guide-operations-page,.arrangement-page,.payments-page,.ai-assistant-main
){color:var(--archive-text);background:#fff}

#appView :is(
  .panel,.archive-panel,.archive-data-table,.archive-record-card,.record-card,
  .order-detail-section,.setting-section,.account-panel,.report-trend-panel,
  .business-create-wizard,.business-create-form-shell,.new-business-create-shell
){border-color:var(--archive-line);border-radius:var(--archive-radius-md);background:#fff;box-shadow:var(--archive-shadow-xs)}

#appView :is(
  .order-detail-tabs,.orders-tabs,.archive-text-tabs,.archive-page-tabs,.guide-operations-tabs,
  .trip-center-tabs,.knowledge-tabs,.settings-control-tabs
){background:#fff;border-bottom:1px solid var(--archive-line);box-shadow:none}

#appView :is(
  .order-detail-tabs,.orders-tabs,.archive-text-tabs,.archive-page-tabs,.guide-operations-tabs,
  .trip-center-tabs,.knowledge-tabs,.settings-control-tabs
) :is(button,a){color:var(--archive-muted);font-size:14px;font-weight:760;background:transparent;border-radius:0;box-shadow:none}

#appView :is(
  .order-detail-tabs,.orders-tabs,.archive-text-tabs,.archive-page-tabs,.guide-operations-tabs,
  .trip-center-tabs,.knowledge-tabs,.settings-control-tabs
) :is(button,a).is-active,
#appView :is(.orders-tabs,.guide-operations-tabs,.trip-center-tabs,.knowledge-tabs) :is(button,a).active{
  color:var(--archive-text);box-shadow:inset 0 -2px var(--archive-gold-500)
}

#appView :is(label,.field-label,.form-label){font-size:13px;line-height:1.45}
#appView :is(input,select,textarea){min-width:0;font-size:14px}
#appView :is(button,.button-link,.archive-button){font-size:13px}
#appView :is(.muted,small,.field-help,.form-help){font-size:max(11px,.72rem);line-height:1.5}
#appView :is(th,td){font-size:13px;line-height:1.45}
#appView th{padding-block:12px;background:#fffdf9}
#appView td{padding-block:13px}

#appView :is(.empty,.archive-empty-state,.route-state,.order-detail-empty){border-color:var(--archive-line);border-radius:var(--archive-radius-md);background:#fff;color:var(--archive-muted)}
#appView :is(.status-pill,.archive-status,.badge,.pill){box-shadow:none}

@media(max-width:1024px){
  #appView :is(.archive-page,.orders-page,.workbench-page,.operations-page,.guide-operations-page,.settings-control-page){max-width:100%;min-width:0}
}

@media(max-width:760px){
  #appView :is(.archive-page,.orders-page,.workbench-page,.operations-page,.guide-operations-page,.settings-control-page){padding-inline:13px}
  #appView :is(.archive-page-toolbar,.archive-toolbar,.orders-filterbar,.filterbar){gap:9px}
  #appView :is(input,select,textarea,button){max-width:100%}
}

/* V3.1 · 右侧工作区可读字号下限：只提升辅助文字，不拉平标题层级。 */
#appView .main-content :is(
  small,dt,.muted,.field-help,.form-help,.order-status,.status-pill,.archive-status,.badge,.pill,
  .order-pending-work summary,.order-pending-work li,.settings-logout-action small,
  .recycle-purge-drawer>header span
){font-size:12px!important;line-height:1.5}

#appView .main-content :is(label,.field-label,.form-label,th,td){font-size:13px!important;line-height:1.45}

#appView .main-content :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea){
  font-size:14px!important;
}
