:root {
  color-scheme: light;
  --ink: #182634;
  --muted: #687887;
  --line: #d9e2ea;
  --surface: #ffffff;
  --canvas: #eef3f7;
  --primary: #1769aa;
  --primary-dark: #10548a;
  --primary-soft: #e8f2fa;
  --success: #18835a;
  --success-soft: #e7f5ef;
  --warning: #986318;
  --danger: #b43b3b;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  letter-spacing: 0;
}

button,
select {
  font: inherit;
}

button,
.drop-zone {
  -webkit-tap-highlight-color: transparent;
}

.page-shell {
  width: min(100%, 1080px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 14px max(28px, env(safe-area-inset-bottom));
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px 20px;
}

.brand-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 48px;
  height: 48px;
  flex: none;
  object-fit: contain;
}

.system-name {
  margin: 0 0 5px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.25;
}

h2 {
  margin: 2px 0 0;
  font-size: 18px;
  line-height: 1.3;
}

.secure-mark {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 6px;
  color: var(--success);
  font-size: 12px;
}

.header-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 9px;
}

.el-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
  font-weight: 500;
}

.el-button--medium {
  min-height: 40px;
  padding: 0 18px;
  font-size: 14px;
}

.el-button--primary {
  border-color: #409eff;
  background: #409eff;
  color: #fff;
}

.logout-button:hover {
  border-color: #66b1ff;
  background: #66b1ff;
}

.el-icon-switch-button {
  position: relative;
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
}

.el-icon-switch-button::before {
  position: absolute;
  top: -4px;
  left: 5px;
  width: 2px;
  height: 8px;
  border-radius: 1px;
  background: currentColor;
  content: "";
}

.secure-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.upload-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(31, 55, 74, 0.07);
}

.panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.selected-count {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.upload-controls {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: #f9fbfc;
}

.material-fields {
  display: contents;
}

.material-fields[hidden] {
  display: none;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span {
  font-size: 13px;
  font-weight: 700;
}

select {
  width: 100%;
  height: 44px;
  padding: 0 38px 0 12px;
  border: 1px solid #c8d4de;
  border-radius: 6px;
  outline: none;
  background: var(--surface);
  color: var(--ink);
}

select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 105, 170, 0.12);
}

select:disabled {
  background: #eef2f5;
  color: #87939e;
}

.select-trigger {
  display: flex;
  width: 100%;
  height: 44px;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid #c8d4de;
  border-radius: 6px;
  outline: none;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.select-trigger:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 105, 170, 0.12);
}

.select-trigger:disabled {
  cursor: not-allowed;
  background: #eef2f5;
  color: #87939e;
}

.select-trigger > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-placeholder {
  color: #778693;
}

.select-chevron {
  width: 8px;
  height: 8px;
  flex: none;
  border-right: 2px solid #738391;
  border-bottom: 2px solid #738391;
  transform: translateY(-2px) rotate(45deg);
}

.primary-button,
.choose-button,
.remove-button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  padding: 0 18px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

.primary-button:hover:not(:disabled) {
  background: var(--primary-dark);
}

.primary-button:disabled {
  cursor: not-allowed;
  background: #afbec9;
}

.upload-arrow {
  position: relative;
  width: 16px;
  height: 16px;
  border-bottom: 2px solid currentColor;
}

.upload-arrow::before {
  position: absolute;
  top: 1px;
  left: 7px;
  width: 2px;
  height: 10px;
  background: currentColor;
  content: "";
}

.upload-arrow::after {
  position: absolute;
  top: 1px;
  left: 4px;
  width: 6px;
  height: 6px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  content: "";
  transform: rotate(45deg);
}

.drop-zone {
  margin: 0 18px;
  overflow: hidden;
  border: 1px dashed #9bb5c9;
  border-radius: 8px;
  outline: none;
  background: #fbfdff;
  transition: border-color 160ms ease, background 160ms ease;
}

.drop-zone:focus-visible,
.drop-zone.is-dragging {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px rgba(23, 105, 170, 0.1);
}

.drop-zone.is-disabled {
  cursor: wait;
}

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.toolbar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
}

.file-symbol,
.empty-file {
  display: inline-block;
  position: relative;
  width: 17px;
  height: 21px;
  border: 2px solid var(--primary);
  border-radius: 2px;
}

.file-symbol::after,
.empty-file::after {
  position: absolute;
  right: -2px;
  top: -2px;
  width: 6px;
  height: 6px;
  border-bottom: 2px solid var(--primary);
  border-left: 2px solid var(--primary);
  background: #fbfdff;
  content: "";
}

.choose-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  background: transparent;
  color: var(--primary);
  font-weight: 700;
}

.choose-button:hover:not(:disabled) {
  background: var(--primary-soft);
}

.choose-button:disabled,
.remove-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.plus {
  position: relative;
  width: 14px;
  height: 14px;
}

.plus::before,
.plus::after {
  position: absolute;
  background: currentColor;
  content: "";
}

.plus::before {
  top: 6px;
  left: 1px;
  width: 12px;
  height: 2px;
}

.plus::after {
  top: 1px;
  left: 6px;
  width: 2px;
  height: 12px;
}

.list-head {
  display: none;
}

.file-list {
  min-height: 180px;
  max-height: 320px;
  overflow-y: auto;
}

.empty-state {
  display: flex;
  min-height: 180px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  padding: 24px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.empty-state strong {
  margin-top: 5px;
  color: var(--ink);
  font-size: 14px;
}

.empty-file {
  width: 28px;
  height: 34px;
  border-color: #8aa4b8;
}

.empty-file::after {
  width: 9px;
  height: 9px;
  border-color: #8aa4b8;
}

.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 36px;
  gap: 9px 12px;
  padding: 14px 12px;
  border-bottom: 1px solid #e7edf2;
}

.file-row:last-child {
  border-bottom: 0;
}

.file-name {
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  color: var(--muted);
  font-size: 12px;
}

.file-status {
  grid-column: 1 / -1;
  grid-row: 2;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 4px;
  background: #e3eaf0;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 160ms ease;
}

.progress-fill.is-complete {
  background: var(--success);
}

.status-text {
  min-width: 66px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.status-text.is-complete {
  color: var(--success);
  font-weight: 700;
}

.remove-button {
  display: inline-flex;
  width: 36px;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  background: #f3f6f8;
  color: var(--danger);
  font-size: 20px;
  line-height: 1;
  grid-column: 3;
  grid-row: 1;
}

.remove-button:hover:not(:disabled) {
  background: #fbecec;
}

.drop-hint {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.format-tip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 14px 18px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.format-tip-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex: none;
  align-items: center;
  justify-content: center;
  border: 1px solid #8aa4b8;
  border-radius: 50%;
  color: var(--primary);
  font-weight: 700;
  line-height: 1;
}

.format-tip-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.page-message {
  min-height: 22px;
  margin: 8px 18px 13px;
  color: var(--warning);
  font-size: 12px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  z-index: 10;
  right: 16px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  left: 16px;
  max-width: 360px;
  margin: auto;
  padding: 13px 16px;
  border-radius: 6px;
  background: #17384a;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

body.picker-open {
  overflow: hidden;
}

.case-picker {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  align-items: end;
}

.case-picker[hidden] {
  display: none;
}

.picker-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(16, 34, 48, 0.48);
  cursor: default;
}

.picker-sheet {
  position: relative;
  z-index: 1;
  display: flex;
  width: 100%;
  max-height: min(78vh, 640px);
  flex-direction: column;
  overflow: hidden;
  border-radius: 8px 8px 0 0;
  background: var(--surface);
  box-shadow: 0 -12px 36px rgba(18, 43, 60, 0.2);
}

.picker-header {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.picker-close {
  display: inline-flex;
  width: 44px;
  height: 44px;
  flex: none;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  background: #f1f5f7;
  color: #526473;
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
}

.case-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin: 12px 14px;
}

.case-search-wrap input {
  width: 100%;
  height: 44px;
  padding: 0 12px 0 40px;
  border: 1px solid #c8d4de;
  border-radius: 6px;
  outline: none;
  font: inherit;
}

.case-search-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 105, 170, 0.12);
}

.search-symbol {
  position: absolute;
  z-index: 1;
  left: 14px;
  width: 14px;
  height: 14px;
  border: 2px solid #6d7f8e;
  border-radius: 50%;
  pointer-events: none;
}

.search-symbol::after {
  position: absolute;
  right: -6px;
  bottom: -4px;
  width: 7px;
  height: 2px;
  background: #6d7f8e;
  content: "";
  transform: rotate(45deg);
}

.case-option-list {
  min-height: 160px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 14px max(14px, env(safe-area-inset-bottom));
}

.case-option {
  display: grid;
  width: 100%;
  min-height: 52px;
  align-content: center;
  gap: 3px;
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid #e4ebf0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.case-option:hover,
.case-option:focus-visible,
.case-option[aria-selected="true"] {
  outline: none;
  background: var(--primary-soft);
}

.case-option-name {
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 700;
}

.case-option-id,
.case-empty {
  color: var(--muted);
  font-size: 12px;
}

.case-empty {
  padding: 38px 12px;
  text-align: center;
}

@media (min-width: 760px) {
  .page-shell {
    padding: 42px 24px;
  }

  h1 {
    font-size: 30px;
  }

  .brand-logo {
    width: 56px;
    height: 56px;
  }

  .panel-heading,
  .upload-controls {
    padding-right: 24px;
    padding-left: 24px;
  }

  .upload-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
  }

  .primary-button {
    width: 100%;
  }

  .drop-zone {
    margin-right: 24px;
    margin-left: 24px;
  }

  .list-head,
  .file-row {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 100px 210px 62px;
    align-items: center;
    gap: 14px;
  }

  .list-head {
    min-height: 40px;
    padding: 0 14px;
    border-bottom: 1px solid var(--line);
    background: #f4f7f9;
    color: #506171;
    font-size: 12px;
    font-weight: 700;
  }

  .list-head span:last-child {
    text-align: center;
  }

  .file-row {
    padding: 12px 14px;
  }

  .file-size {
    font-size: 13px;
  }

  .file-status {
    grid-column: 3;
    grid-row: 1;
  }

  .remove-button {
    grid-column: 4;
    grid-row: 1;
    justify-self: center;
  }

  .format-tip,
  .page-message {
    margin-right: 24px;
    margin-left: 24px;
  }

  .case-picker {
    align-items: center;
    justify-items: center;
    padding: 24px;
  }

  .picker-sheet {
    max-width: 520px;
    border-radius: 8px;
    box-shadow: 0 18px 48px rgba(18, 43, 60, 0.24);
  }
}

@media (max-width: 520px) {
  .header-actions .secure-mark {
    display: none;
  }
}

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