:root {
  --blue: #0b5cad;
  --blue-soft: #eaf3ff;
  --orange: #d86f10;
  --ink: #172033;
  --muted: #667085;
  --line: #e4e7ec;
  --surface: #ffffff;
  --background: #f5f7fa;
  font-family: Inter, "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--background);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 1080px; background: var(--background); }
button, input, select, textarea { font: inherit; }
.hidden { display: none !important; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px;
  background: linear-gradient(150deg, #eef5fd, #ffffff 56%, #fff7ed);
}

.login-panel {
  width: 460px;
  padding: 36px;
  background: #fff;
  border-top: 5px solid var(--blue);
  box-shadow: 0 24px 70px rgba(15, 35, 64, .14);
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--blue);
  font-weight: 800;
}

h1 { margin: 22px 0 8px; font-size: 26px; }
.login-panel p { margin: 0 0 24px; color: var(--muted); line-height: 1.6; }
label { display: grid; gap: 8px; color: #344054; font-size: 14px; margin-top: 16px; }
input, select, textarea { width: 100%; border: 1px solid #cfd5df; background: #fff; padding: 11px 12px; color: var(--ink); }
textarea { min-height: 130px; resize: vertical; }

.trial-accounts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.trial-account { border: 1px solid #d7e4f2; background: #f8fbff; color: var(--blue); padding: 10px; cursor: pointer; }
.divider { display: flex; align-items: center; gap: 12px; margin: 24px 0 4px; color: #98a2b3; font-size: 12px; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }

.button { min-height: 38px; border: 0; padding: 0 16px; cursor: pointer; white-space: nowrap; }
.button.primary { background: var(--blue); color: #fff; }
.button.quiet { background: #eef2f6; color: #344054; }
.login-panel > .button { width: 100%; margin-top: 18px; }
.message { min-height: 22px; color: #b42318; font-size: 13px; margin-top: 12px; }

.app-shell { height: 100vh; display: grid; grid-template: 64px minmax(0, 1fr) / 248px minmax(0, 1fr); overflow: hidden; }
.app-shell.nav-collapsed { grid-template-columns: 72px minmax(0, 1fr); }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; background: #fff; border-bottom: 1px solid var(--line); }
.topbar strong { color: var(--blue); font-size: 18px; }
.version { margin-left: 10px; color: #98a2b3; font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 14px; color: #475467; font-size: 13px; }
.environment-badge { padding: 6px 10px; color: #8a5a13; background: #fff5dc; border: 1px solid #efd59b; }
.environment-badge.production { color: #b42318; background: #fef3f2; border-color: #fecdca; }

.sidebar { min-height: 0; overflow-y: auto; background: #0f3158; padding: 14px 12px 22px; }
.sidebar-tools { position: relative; padding-bottom: 14px; border-bottom: 1px solid rgba(255,255,255,.12); }
.sidebar-collapse { width: 100%; min-height: 34px; border: 1px solid rgba(255,255,255,.2); color: #d9e5f2; background: transparent; cursor: pointer; white-space: nowrap; }
.menu-search-label { gap: 6px; margin: 12px 0 0; color: #aebfd2; font-size: 12px; }
.menu-search-label input { padding: 9px 10px; border: 1px solid rgba(255,255,255,.18); color: #fff; background: rgba(255,255,255,.08); }
.menu-search-label input::placeholder { color: #9fb0c4; }
.menu-search-results { position: absolute; z-index: 5; top: 86px; left: 0; right: 0; max-height: 300px; overflow: auto; padding: 6px; background: #fff; box-shadow: 0 12px 30px rgba(0,0,0,.24); }
.menu-search-results button { width: 100%; display: grid; gap: 3px; padding: 9px 10px; border: 0; text-align: left; background: #fff; cursor: pointer; }
.menu-search-results button:hover { background: #f1f6fc; }
.menu-search-results strong { color: var(--ink); font-size: 13px; }
.menu-search-results span, .menu-search-results > div { color: var(--muted); font-size: 11px; }
.favorite-title { margin-top: 14px; color: #8fa8c2; font-size: 11px; }
.favorite-links { display: grid; gap: 3px; margin-top: 7px; }
.favorite-link { overflow: hidden; width: 100%; padding: 7px 9px; border: 0; color: #dce7f2; background: rgba(255,255,255,.07); text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.sidebar-empty { color: #8098b1; font-size: 11px; }
.nav-group { margin-top: 10px; }
.nav-group-button { width: 100%; display: grid; grid-template-columns: 28px minmax(0, 1fr) 18px; align-items: center; min-height: 42px; padding: 0 8px; border: 0; color: #edf4fb; background: transparent; text-align: left; cursor: pointer; }
.nav-group-button:hover { background: rgba(255,255,255,.08); }
.nav-icon { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.24); color: #dce8f4; font-size: 11px; }
.nav-group-title { font-weight: 700; }
.nav-chevron { text-align: center; transform: rotate(-90deg); transition: transform .15s ease; }
.nav-group.open .nav-chevron { transform: rotate(0); }
.nav-submenu { display: none; padding-left: 28px; }
.nav-group.open .nav-submenu { display: block; }
.nav-button { width: 100%; border: 0; color: #c9d7e8; background: transparent; text-align: left; padding: 10px 10px; cursor: pointer; margin-bottom: 2px; }
.nav-button:hover, .nav-button.active { color: #fff; background: rgba(255,255,255,.12); }
.app-shell.nav-collapsed .menu-search-label,
.app-shell.nav-collapsed .favorite-title,
.app-shell.nav-collapsed .favorite-links,
.app-shell.nav-collapsed .nav-group-title,
.app-shell.nav-collapsed .nav-chevron,
.app-shell.nav-collapsed .nav-submenu { display: none; }
.app-shell.nav-collapsed .nav-group-button { display: flex; justify-content: center; padding: 0; }
.app-shell.nav-collapsed .sidebar-collapse { overflow: hidden; padding: 0 3px; font-size: 11px; }

.content { padding: 28px; overflow: auto; }
.content-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.content-actions { display: flex; align-items: center; gap: 10px; }
.content-actions .button.selected { color: var(--blue); background: var(--blue-soft); }
.content-head h2 { margin: 6px 0; font-size: 24px; }
.content-head p { margin: 0; color: var(--muted); font-size: 13px; }
.breadcrumb { color: #98a2b3; font-size: 12px; }
.notice { padding: 12px 14px; margin-bottom: 18px; color: #8a5a13; background: #fff8e8; border-left: 4px solid #d9a441; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }
.metric-card { background: #fff; border-top: 4px solid var(--blue); padding: 18px; box-shadow: 0 6px 20px rgba(15,35,64,.06); }
.section-heading { margin: 28px 0 12px; color: #16345f; font-size: 18px; font-weight: 700; }
.metric-label { color: var(--muted); font-size: 13px; }
.metric-value { margin-top: 10px; color: var(--blue); font-size: 28px; font-weight: 800; }

.table-shell { background: #fff; border: 1px solid var(--line); overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { position: sticky; top: 0; padding: 12px; color: #475467; background: #f8fafc; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid #eef1f5; vertical-align: top; }
tr:hover td { background: #fbfdff; }
.status { display: inline-flex; padding: 4px 8px; color: var(--blue); background: var(--blue-soft); white-space: nowrap; }
.status.warning { color: #9a4f08; background: #fff3e7; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; min-width: 190px; }
.row-action { border: 0; color: var(--blue); background: var(--blue-soft); padding: 6px 9px; cursor: pointer; white-space: nowrap; }
.row-action.warning { color: #9a4f08; background: #fff3e7; }
.link-action { display: inline-flex; text-decoration: none; }
.muted { color: var(--muted); }
.subpage-toolbar { display: flex; align-items: center; justify-content: flex-start; gap: 12px; margin-bottom: 14px; }
.pagination-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; color: var(--muted); font-size: 13px; }
.pagination-actions { display: flex; gap: 8px; }
.pagination-actions button:disabled { cursor: not-allowed; opacity: .45; }
.empty { padding: 48px; text-align: center; color: #98a2b3; background: #fff; }

.management-filter-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
}
.management-filter-bar input,
.management-filter-bar select { min-width: 0; margin: 0; }
.management-filter-bar .button { align-self: stretch; }
.management-filter-bar.compact-filter { grid-template-columns: 2fr 1.2fr 1fr 1fr auto; margin-bottom: 0; padding: 0; border: 0; }
.file-upload-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; }
.file-upload-grid label { margin: 0; }
.management-export-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.management-export-bar .button { border: 1px solid #d7e4f2; color: var(--blue); background: #f8fbff; }

.finance-filter-bar {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
}
.finance-filter-bar input,
.finance-filter-bar select { min-width: 0; margin: 0; }
.finance-config-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.finance-config-tabs .button { border: 1px solid #d7e4f2; }

.filter-panel { margin-bottom: 16px; padding: 16px; background: #fff; border: 1px solid var(--line); }
.filter-grid { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(180px, 1fr); gap: 12px; }
.filter-grid label { margin: 0; color: #344054; font-size: 13px; }
.filter-grid input,
.filter-grid select { width: 100%; min-width: 0; margin: 6px 0 0; box-sizing: border-box; }
.filter-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

dialog { width: 720px; max-height: 86vh; padding: 0; border: 0; box-shadow: 0 28px 90px rgba(15,35,64,.26); }
dialog::backdrop { background: rgba(15, 23, 42, .45); }
.detail-dialog { width: 860px; }
.detail-dialog-body { max-height: calc(86vh - 76px); padding: 22px 24px 28px; overflow: auto; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.detail-item { min-width: 0; padding: 12px 14px; background: #f8fafc; border: 1px solid var(--line); }
.detail-item.wide { grid-column: 1 / -1; }
.detail-item span { display: block; color: var(--muted); font-size: 12px; }
.detail-item strong { display: block; margin-top: 5px; color: var(--ink); overflow-wrap: anywhere; }
.detail-section-title { margin: 24px 0 10px; color: var(--ink); font-size: 16px; }
.exception-filter-bar { display: grid; grid-template-columns: 180px minmax(220px, 1fr); gap: 10px; margin-bottom: 16px; }
.exception-review-box { margin-top: 22px; padding: 18px; background: #fff8e8; border-left: 4px solid #d9a441; }
.exception-review-box textarea { width: 100%; min-height: 100px; box-sizing: border-box; margin-top: 10px; }
.exception-review-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.exception-attachment-list { display: grid; gap: 8px; }
.exception-attachment-preview { margin-top: 14px; min-height: 40px; }
.exception-attachment-preview img { display: block; max-width: 100%; max-height: 480px; margin: 0 auto; object-fit: contain; }
.exception-history { display: grid; gap: 8px; }
.exception-history article { padding: 12px 14px; background: #f8fafc; border-left: 3px solid #ff8a1f; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.dialog-head h3 { margin: 0; }
.icon-button { border: 0; background: transparent; font-size: 28px; cursor: pointer; color: #667085; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 20px; padding: 8px 24px 24px; max-height: 62vh; overflow: auto; }
.form-grid .wide { grid-column: 1 / -1; }
.content-editor { min-height: 320px; line-height: 1.65; font-family: "Microsoft YaHei", sans-serif; }
.checkbox-field { margin: 16px 0 0; padding: 12px 14px 14px; border: 1px solid var(--line); }
.checkbox-field legend { padding: 0 6px; color: #344054; font-size: 14px; }
.checkbox-grid { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.checkbox-grid label { display: inline-flex; align-items: center; gap: 7px; margin: 0; }
.checkbox-grid input { width: 16px; height: 16px; margin: 0; accent-color: var(--blue); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); }

.material-preview { max-width: 920px; margin: 0 auto; background: #fff; border: 1px solid var(--line); box-shadow: 0 12px 36px rgba(15,35,64,.08); }
.material-preview > header { padding: 30px 34px 24px; border-top: 5px solid var(--blue); border-bottom: 1px solid var(--line); }
.material-preview h2 { margin: 14px 0 10px; color: var(--ink); font-size: 28px; }
.material-preview-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.material-preview-meta span { padding: 5px 9px; color: var(--blue); background: var(--blue-soft); font-size: 12px; }
.material-preview-summary { margin: 0; color: #475467; font-size: 15px; line-height: 1.8; }
.material-preview-scope { margin-top: 16px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.material-preview-content { padding: 28px 34px; line-height: 1.85; }
.material-preview-content h2 { margin: 0 0 18px; color: var(--blue); font-size: 23px; }
.material-preview-content h3 { margin: 28px 0 12px; padding-left: 12px; color: var(--ink); font-size: 19px; border-left: 4px solid var(--orange); }
.material-preview-content h4 { margin: 22px 0 8px; font-size: 16px; }
.material-preview-content p { margin: 7px 0; color: #344054; }
.preview-list-item { display: grid; grid-template-columns: 24px 1fr; gap: 4px; align-items: start; }
.preview-list-item > span { color: var(--orange); font-weight: 700; }
.preview-list-item p { margin: 0 0 7px; }
.preview-spacer { height: 7px; }
.material-preview > footer { padding: 20px 34px 28px; background: #f8fafc; border-top: 1px solid var(--line); }
.preview-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

@media (max-width: 1200px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .management-filter-bar { grid-template-columns: repeat(3, minmax(160px, 1fr)); }
  .finance-filter-bar { grid-template-columns: repeat(3, minmax(160px, 1fr)); }
  .file-upload-grid { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
}

@media (max-width: 720px) {
  .filter-grid,
  .detail-grid { grid-template-columns: 1fr; }
}
