:root {
  color-scheme: light;
  --ink: #172b3f;
  --muted: #66788a;
  --line: #d7e0e7;
  --line-strong: #bac8d3;
  --surface: #ffffff;
  --surface-soft: #f6f8fa;
  --canvas: #edf1f4;
  --blue: #225ea8;
  --blue-dark: #17497f;
  --blue-soft: #e9f1fa;
  --teal: #0b7a75;
  --teal-dark: #08645f;
  --teal-soft: #e6f4f2;
  --amber: #9a6400;
  --amber-soft: #fff4d6;
  --danger: #b42318;
  --danger-soft: #fff0ee;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.hidden {
  display: none !important;
}

.site-header {
  height: 64px;
  border-bottom: 1px solid #112b43;
  background: #17324d;
  color: #ffffff;
}

.site-header-inner {
  width: min(1180px, calc(100% - 40px));
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

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

.brand img {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
}

.brand div {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.brand strong {
  font-size: 15px;
  line-height: 1.35;
}

.brand span {
  color: #b9c8d6;
  font-size: 11px;
  line-height: 1.3;
}

.system-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #d7e3ec;
  font-size: 12px;
  white-space: nowrap;
}

.system-state i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #55c6a9;
  box-shadow: 0 0 0 3px rgba(85, 198, 169, 0.16);
}

.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 30px 0 48px;
}

.login-panel {
  width: min(440px, 100%);
  margin: 6vh auto 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(23, 43, 63, 0.1);
}

.login-header {
  padding: 26px 28px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.section-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.4;
}

.login-header h1,
.workspace-header h1 {
  font-size: 24px;
  line-height: 1.3;
  letter-spacing: 0;
}

.login-header p,
.workspace-header p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.login-form {
  display: grid;
  gap: 16px;
  padding: 24px 28px 26px;
}

label {
  min-width: 0;
  display: grid;
  gap: 7px;
  color: #465c70;
  font-size: 12px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  height: 42px;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: none;
  background: var(--surface);
  color: var(--ink);
}

input::placeholder {
  color: #9aa8b5;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(34, 94, 168, 0.12);
}

input.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.1);
}

.admin-picker,
.export-mode {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.admin-picker legend,
.export-mode legend {
  margin-bottom: 7px;
  padding: 0;
  color: #465c70;
  font-size: 12px;
  font-weight: 700;
}

.admin-picker-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.admin-picker button {
  height: 36px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: #3d5368;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-picker button:hover,
.admin-picker button.selected {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.primary-btn,
.secondary-btn,
.text-btn,
.icon-btn,
.download-btn {
  border-radius: 6px;
  cursor: pointer;
  font-weight: 750;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.primary-btn {
  height: 42px;
  padding: 0 18px;
  border: 1px solid var(--blue-dark);
  background: var(--blue);
  color: #ffffff;
}

.primary-btn:hover {
  background: var(--blue-dark);
}

.login-submit {
  width: 100%;
  margin-top: 2px;
}

.login-status {
  min-height: 18px;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.5;
}

.dashboard {
  min-width: 0;
}

.workspace-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 2px 0 22px;
}

.workspace-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-summary {
  min-width: 150px;
  display: grid;
  justify-items: end;
  gap: 2px;
  margin-right: 5px;
}

.user-summary strong {
  max-width: 180px;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-summary span {
  max-width: 180px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn,
.text-btn {
  height: 36px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: #3c5267;
}

.icon-btn {
  width: 36px;
  padding: 0;
  font-size: 19px;
  line-height: 1;
}

.text-btn {
  padding: 0 13px;
}

.icon-btn:hover,
.text-btn:hover,
.secondary-btn:hover {
  border-color: #8fa2b3;
  background: #f1f5f8;
}

.text-btn.danger {
  color: var(--danger);
}

.text-btn.danger:hover {
  border-color: #e5aaa4;
  background: var(--danger-soft);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(180px, 0.8fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.summary-item,
.sync-summary {
  min-width: 0;
  min-height: 102px;
  display: grid;
  align-content: center;
  gap: 7px;
  padding: 18px 22px;
  border-right: 1px solid var(--line);
}

.sync-summary {
  border-right: 0;
  background: var(--surface-soft);
}

.summary-item span,
.sync-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.summary-item strong {
  color: var(--blue);
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0;
}

.improvement-summary strong {
  color: var(--teal);
}

.total-summary strong {
  color: var(--ink);
}

.sync-summary strong {
  color: #3e5367;
  font-size: 16px;
  line-height: 1.2;
  letter-spacing: 0;
}

.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-top: 18px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.filter-fields {
  min-width: 0;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(138px, 1fr)) auto;
  align-items: end;
  gap: 12px;
}

.secondary-btn {
  height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  background: var(--surface-soft);
  color: #344d64;
  white-space: nowrap;
}

.export-mode {
  flex: 0 0 230px;
}

.segmented-control {
  height: 42px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-soft);
}

.segmented-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.segmented-control label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.segmented-control input:checked + label {
  border-color: var(--line);
  background: var(--surface);
  color: var(--blue-dark);
  box-shadow: 0 1px 2px rgba(23, 43, 63, 0.08);
}

.segmented-control input:focus-visible + label {
  outline: 2px solid rgba(34, 94, 168, 0.45);
  outline-offset: 1px;
}

.export-mode > span {
  display: block;
  margin-top: 7px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.export-section {
  margin-top: 26px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 13px;
}

.section-heading h2 {
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: 0;
}

.selection-state {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.export-list {
  display: grid;
  gap: 10px;
}

.export-item {
  min-width: 0;
  min-height: 104px;
  display: grid;
  grid-template-columns: 5px minmax(0, 1fr) 130px 112px;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.export-item:hover {
  border-color: #aebdca;
  box-shadow: 0 5px 16px rgba(23, 43, 63, 0.06);
}

.export-accent {
  align-self: stretch;
  background: var(--blue);
}

.improvement-item .export-accent {
  background: var(--teal);
}

.all-item .export-accent {
  background: var(--amber);
}

.export-copy {
  min-width: 0;
  padding: 18px 24px;
}

.export-type {
  display: block;
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
}

.improvement-item .export-type {
  color: var(--teal);
}

.all-item .export-type {
  color: var(--amber);
}

.export-copy h3 {
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: 0;
}

.export-copy p {
  margin-top: 5px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.export-count {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 0 22px;
  border-left: 1px solid var(--line);
}

.export-count strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.export-count span {
  color: var(--muted);
  font-size: 11px;
}

.download-btn {
  width: 86px;
  height: 38px;
  justify-self: center;
  border: 1px solid var(--blue-dark);
  background: var(--blue);
  color: #ffffff;
}

.download-btn span {
  display: inline-block;
  margin-right: 6px;
  font-size: 16px;
}

.download-btn:hover {
  background: var(--blue-dark);
}

.improvement-download {
  border-color: var(--teal-dark);
  background: var(--teal);
}

.improvement-download:hover {
  background: var(--teal-dark);
}

.all-download {
  border-color: #183044;
  background: #203c54;
}

.all-download:hover {
  background: #152d42;
}

.primary-btn:disabled,
.secondary-btn:disabled,
.text-btn:disabled,
.icon-btn:disabled,
.download-btn:disabled,
.admin-picker button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.status-panel {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 16px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.status-panel i {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #8fa0af;
}

.status-panel.loading i {
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(34, 94, 168, 0.12);
}

.status-panel.success {
  border-color: #b9ddd5;
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.status-panel.success i {
  background: var(--teal);
}

.status-panel.error {
  border-color: #efc0bb;
  background: var(--danger-soft);
  color: var(--danger);
}

.status-panel.error i {
  background: var(--danger);
}

@media (max-width: 920px) {
  .toolbar {
    display: grid;
    align-items: stretch;
  }

  .export-mode {
    width: 100%;
    flex-basis: auto;
  }

  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-item:nth-child(2) {
    border-right: 0;
  }

  .summary-item:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .export-item {
    grid-template-columns: 5px minmax(0, 1fr) 105px 100px;
  }

  .export-copy {
    padding: 16px 18px;
  }

  .export-count {
    padding: 0 16px;
  }
}

@media (max-width: 700px) {
  .site-header-inner,
  .shell {
    width: min(100% - 24px, 1180px);
  }

  .shell {
    padding-top: 20px;
  }

  .system-state {
    font-size: 0;
  }

  .workspace-header {
    display: grid;
    gap: 15px;
  }

  .workspace-actions {
    width: 100%;
  }

  .user-summary {
    min-width: 0;
    flex: 1;
    align-items: start;
    justify-items: start;
  }

  .filter-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .scope-filter,
  .apply-filter {
    grid-column: 1 / -1;
  }

  .section-heading {
    align-items: flex-start;
  }

  .export-item {
    min-height: 136px;
    grid-template-columns: 5px minmax(0, 1fr) 92px;
    grid-template-rows: 1fr auto;
    padding-bottom: 14px;
  }

  .export-accent {
    grid-row: 1 / 3;
  }

  .export-copy {
    grid-column: 2 / 4;
    padding: 15px 16px 10px;
  }

  .export-count {
    grid-column: 2;
    grid-row: 2;
    padding: 0 16px;
    border-left: 0;
  }

  .download-btn {
    grid-column: 3;
    grid-row: 2;
    width: 76px;
  }
}

@media (max-width: 430px) {
  .login-header,
  .login-form {
    padding-left: 20px;
    padding-right: 20px;
  }

  .admin-picker-buttons {
    grid-template-columns: 1fr;
  }

  .summary-strip {
    grid-template-columns: 1fr 1fr;
  }

  .summary-item,
  .sync-summary {
    min-height: 88px;
    padding: 14px;
  }

  .filter-fields {
    grid-template-columns: 1fr;
  }

  .filter-fields > * {
    grid-column: 1;
  }

  .selection-state {
    max-width: 130px;
    overflow-wrap: anywhere;
    text-align: right;
    white-space: normal;
  }
}
