:root {
  color-scheme: light;
  --ink: #16243a;
  --muted: #65748b;
  --line: #d8e2ef;
  --soft: #f4f7fb;
  --paper: #ffffff;
  --green: #2563eb;
  --green-dark: #1d4ed8;
  --blue-soft: #eef5ff;
  --coral: #d85f4a;
  --yellow: #d9a62e;
  --shadow: 0 12px 30px rgba(40, 73, 125, 0.1);
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

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

body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

button,
input,
select {
  color: inherit;
  font: inherit;
}

button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.2);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  padding: 12px max(22px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.customer-contact-bar {
  position: sticky;
  z-index: 19;
  top: 72px;
  border-bottom: 1px solid #c7d8f0;
  background: #eaf3ff;
}

.customer-contact-inner {
  display: flex;
  width: min(1180px, calc(100% - 44px));
  min-height: 56px;
  align-items: center;
  gap: 10px;
  margin: 0 auto;
}

.customer-contact-heading {
  display: flex;
  min-width: 150px;
  align-items: center;
  gap: 8px;
  color: var(--green-dark);
}

.customer-contact-heading svg {
  flex: 0 0 auto;
}

.customer-contact-chip {
  display: grid;
  min-width: 0;
  min-height: 38px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid #c3d5ed;
  border-radius: 5px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}

.customer-contact-chip:hover {
  border-color: var(--green);
  background: #f8fbff;
}

.customer-contact-chip strong {
  overflow: hidden;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-contact-channel {
  font-size: 12px;
  font-weight: 800;
}

.qq-channel {
  color: var(--green);
}

.wechat-channel {
  color: #148a57;
}

.customer-contact-copy {
  color: var(--muted);
  font-size: 11px;
}

.brand-block,
.top-actions,
.privacy-line,
.section-heading,
.task-actions,
.export-section,
.export-actions,
.record-toolbar,
.photo-toolbar,
.record-filters,
.task-status-row,
.task-status-row dl,
.task-status-row dl div {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 11px;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 6px;
  background: var(--ink);
  color: white;
  font-size: 20px;
  font-weight: 800;
}

.brand-block h1,
.brand-block p,
.login-copy h2,
.account-band h2,
.section-heading h3,
.export-section h3,
.record-toolbar h2 {
  margin: 0;
}

.brand-block h1 {
  font-size: 16px;
  line-height: 1.2;
}

.brand-block p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.top-actions {
  gap: 12px;
}

.status-dot {
  display: inline-flex;
  min-width: 92px;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.status-dot i,
#task-indicator {
  display: block;
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--yellow);
}

.status-dot.online i,
#task-indicator.success {
  background: var(--green);
}

.status-dot.error i,
#task-indicator.error {
  background: var(--coral);
}

main {
  width: min(1180px, calc(100% - 44px));
  margin: 0 auto;
}

.access-view {
  display: grid;
  min-height: calc(100vh - 129px);
  place-items: center;
}

.access-panel {
  width: min(480px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.access-panel h2 {
  margin: 6px 0 26px;
  font-size: 27px;
}

.access-panel label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.inline-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

input,
select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper);
}

input {
  min-width: 0;
  padding: 0 12px;
}

select {
  padding: 0 34px 0 11px;
}

.login-view {
  display: grid;
  min-height: calc(100vh - 129px);
  grid-template-columns: minmax(0, 1fr) minmax(300px, 430px);
  align-items: center;
  gap: clamp(40px, 9vw, 130px);
  padding: 42px 4vw 70px;
}

.section-index {
  color: var(--green);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
}

.login-copy h2 {
  max-width: 620px;
  margin-top: 12px;
  font-size: 48px;
  line-height: 1.12;
}

.login-copy > p {
  margin: 18px 0 25px;
  color: var(--muted);
  font-size: 16px;
}

.privacy-line {
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.privacy-line i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--coral);
}

.qr-stage {
  display: grid;
  min-height: 440px;
  place-items: center;
  align-content: center;
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.qr-placeholder,
.qr-image {
  width: 250px;
  height: 250px;
}

.qr-placeholder {
  display: grid;
  place-content: center;
  text-align: center;
  border: 1px dashed #b9c7da;
  color: var(--muted);
}

.qr-placeholder span {
  color: var(--green);
  font-size: 46px;
}

.qr-placeholder p {
  margin: 4px 0 0;
}

.qr-image {
  display: block;
  object-fit: contain;
  image-rendering: pixelated;
}

.primary-button,
.secondary-button,
.icon-command,
.tab-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  text-decoration: none;
}

.primary-button {
  padding: 0 18px;
  background: var(--green);
  color: white;
  font-weight: 700;
}

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

.primary-button:disabled,
.secondary-button:disabled,
.icon-command:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.secondary-button {
  padding: 0 14px;
  border-color: var(--line);
  background: var(--paper);
  color: var(--ink);
  font-weight: 650;
}

.secondary-button:hover,
.icon-command:hover {
  border-color: #aab9cc;
  background: #f8fbff;
}

.icon-command {
  width: 40px;
  padding: 0;
  border-color: var(--line);
  background: var(--paper);
  font-size: 19px;
}

.qr-button {
  width: 250px;
}

.workspace {
  padding: 28px 0 70px;
}

.workspace-tabs {
  display: flex;
  height: 45px;
  gap: 4px;
  border-bottom: 1px solid var(--line);
}

.tab-button {
  position: relative;
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
}

.tab-button.active {
  color: var(--ink);
}

.tab-button.active::after {
  position: absolute;
  right: 12px;
  bottom: -1px;
  left: 12px;
  height: 3px;
  background: var(--green);
  content: "";
}

.tab-button span {
  color: var(--green);
  font-variant-numeric: tabular-nums;
}

.account-band {
  display: flex;
  align-items: end;
  justify-content: space-between;
  padding: 38px 0 25px;
}

.account-band h2,
.record-toolbar h2 {
  margin-top: 7px;
  font-size: 30px;
}

.photo-toolbar h2 {
  margin: 7px 0 0;
  font-size: 30px;
}

.account-band > p {
  color: var(--muted);
  font-size: 12px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border: solid var(--line);
  border-width: 1px 0;
  background: var(--paper);
}

.metric-grid > div {
  min-width: 0;
  padding: 20px;
  border-right: 1px solid var(--line);
}

.metric-grid > div:last-child {
  border-right: 0;
}

.metric-grid strong,
.metric-grid span {
  display: block;
}

.metric-grid strong {
  overflow: hidden;
  font-size: 27px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
}

.metric-grid span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.task-section {
  margin-top: 34px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
}

.section-heading,
.export-section,
.record-toolbar {
  justify-content: space-between;
  gap: 22px;
}

.section-heading h3,
.export-section h3 {
  margin-top: 6px;
  font-size: 20px;
}

.task-actions,
.export-actions {
  gap: 8px;
}

.task-options {
  display: flex;
  gap: 12px;
  margin-top: 25px;
}

.task-options label {
  display: grid;
  grid-template-columns: auto minmax(100px, 140px);
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
}

.progress-track {
  height: 5px;
  margin-top: 28px;
  overflow: hidden;
  background: #e6edf7;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--green);
  transition: width 350ms ease;
}

.progress-track span.running {
  width: 42%;
  animation: running-progress 2.4s ease-in-out infinite;
}

@keyframes running-progress {
  0% { transform: translateX(-105%); }
  100% { transform: translateX(240%); }
}

.task-status-row {
  justify-content: space-between;
  gap: 24px;
  padding-top: 18px;
}

.task-status-row > div {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}

.task-status-row strong {
  overflow-wrap: anywhere;
}

.task-status-row dl {
  flex: 0 0 auto;
  gap: 22px;
  margin: 0;
}

.task-status-row dl div {
  gap: 6px;
}

.task-status-row dt {
  color: var(--muted);
  font-size: 11px;
}

.task-status-row dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.recent-section {
  margin-top: 28px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
}

.recent-section .record-list {
  margin-top: 18px;
}

.recent-record-list .record-item {
  grid-template-columns: 150px minmax(0, 1fr) 74px;
  padding: 18px 0;
}

.recent-record-list .record-item:last-child {
  border-bottom: 0;
}

.recent-record-list .record-comments p:nth-child(n+4) {
  display: none;
}

.compact-empty {
  min-height: 130px;
  padding-top: 50px;
  border-bottom: 0;
}

.export-section {
  margin-top: 28px;
  padding: 25px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.record-toolbar {
  align-items: end;
  padding: 38px 0 22px;
}

.photo-toolbar {
  justify-content: space-between;
  gap: 18px;
  padding: 38px 0 22px;
}

.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  padding-bottom: 32px;
}

.photo-tile {
  display: grid;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  grid-template-rows: auto 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  cursor: zoom-in;
}

.photo-tile:hover {
  border-color: #aab9cc;
  box-shadow: var(--shadow);
}

.photo-tile > img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  background: #e8eef7;
  object-fit: cover;
}

.photo-tile figcaption {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
}

.photo-tile figcaption strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-tile figcaption time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
}

.photo-viewer {
  width: min(1100px, calc(100% - 24px));
  max-width: none;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  background: #0b1220;
  color: white;
}

.photo-viewer::backdrop {
  background: rgba(10, 18, 32, 0.82);
}

.photo-viewer-bar,
.photo-viewer-actions {
  display: flex;
  align-items: center;
}

.photo-viewer-bar {
  min-height: 60px;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px 10px 18px;
}

.photo-viewer-bar strong,
.photo-viewer-bar span {
  display: block;
}

.photo-viewer-bar span {
  margin-top: 2px;
  color: #bac7dc;
  font-size: 11px;
}

.photo-viewer-actions {
  gap: 6px;
}

.photo-viewer .icon-command {
  border-color: #31415e;
  background: #17243a;
  color: white;
}

.photo-viewer > img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 100px);
  object-fit: contain;
}

.record-filters {
  gap: 8px;
}

.search-field {
  display: flex;
  width: min(310px, 38vw);
  height: 40px;
  align-items: center;
  gap: 7px;
  padding-left: 11px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper);
}

.search-field span {
  color: var(--muted);
  font-size: 20px;
}

.search-field input {
  width: 100%;
  min-height: 38px;
  padding-left: 0;
  border: 0;
  outline: 0;
}

.record-list {
  border-top: 1px solid var(--line);
}

.record-item {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 80px;
  gap: 24px;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.record-meta strong,
.record-meta time {
  display: block;
}

.record-meta strong {
  overflow-wrap: anywhere;
}

.record-meta time,
.record-meta span,
.record-counts {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.record-category {
  display: inline-block;
  margin-top: 10px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--green);
  font-size: 11px;
}

.record-content {
  min-width: 0;
}

.record-content > p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.record-pictures {
  display: grid;
  max-width: 620px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin-top: 14px;
}

.record-pictures img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4px;
  background: #e8eef7;
  object-fit: cover;
}

.record-comments {
  margin-top: 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--green);
  background: var(--blue-soft);
  font-size: 12px;
}

.record-comments p {
  margin: 5px 0;
  overflow-wrap: anywhere;
}

.record-comments b {
  color: var(--green-dark);
}

.record-counts {
  text-align: right;
}

.record-counts span {
  display: block;
  margin-bottom: 7px;
}

.empty-state {
  min-height: 240px;
  padding-top: 90px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
}

.pagination {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.pagination span {
  min-width: 70px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.toast {
  position: fixed;
  z-index: 50;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100vw - 44px));
  padding: 12px 15px;
  border-left: 4px solid var(--coral);
  border-radius: 4px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
}

@media (max-width: 820px) {
  main {
    width: min(100% - 28px, 680px);
  }

  .login-view {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 56px 0;
  }

  .login-copy h2 {
    font-size: 36px;
  }

  .qr-stage {
    min-height: 390px;
  }

  .metric-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .metric-grid > div:nth-child(3) {
    border-right: 0;
  }

  .metric-grid > div:nth-child(-n+3) {
    border-bottom: 1px solid var(--line);
  }

  .record-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .photo-gallery {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .record-filters {
    width: 100%;
  }

  .search-field {
    width: 100%;
  }

  .record-item {
    grid-template-columns: 130px minmax(0, 1fr);
  }

  .recent-record-list .record-item {
    grid-template-columns: 130px minmax(0, 1fr);
  }

  .record-counts {
    display: flex;
    grid-column: 2;
    gap: 14px;
    text-align: left;
  }
}

@media (max-width: 560px) {
  .topbar {
    min-height: 64px;
    padding: 10px 14px;
  }

  .customer-contact-bar {
    top: 64px;
  }

  .customer-contact-inner {
    display: grid;
    width: calc(100% - 28px);
    min-height: 58px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    padding: 8px 0;
  }

  .customer-contact-heading {
    display: none;
  }

  .customer-contact-chip {
    min-height: 42px;
    padding: 0 9px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand-block p,
  .status-dot span {
    display: none;
  }

  .status-dot {
    min-width: 8px;
  }

  .login-view {
    padding-top: 40px;
  }

  .login-copy h2 {
    font-size: 30px;
  }

  .privacy-line {
    gap: 7px;
  }

  .qr-stage {
    min-height: 350px;
  }

  .qr-placeholder,
  .qr-image,
  .qr-button {
    width: 220px;
  }

  .qr-placeholder,
  .qr-image {
    height: 220px;
  }

  .workspace {
    padding-top: 18px;
  }

  .workspace-tabs {
    overflow-x: auto;
  }

  .tab-button {
    flex: 1;
    white-space: nowrap;
  }

  .account-band,
  .section-heading,
  .export-section {
    align-items: stretch;
    flex-direction: column;
  }

  .account-band {
    gap: 8px;
    padding-top: 28px;
  }

  .account-band > p {
    margin: 0;
  }

  .metric-grid strong {
    font-size: 22px;
  }

  .metric-grid > div {
    padding: 15px;
  }

  .task-section {
    padding: 18px;
  }

  .recent-section {
    padding: 18px;
  }

  .task-actions,
  .task-actions button,
  .export-actions,
  .export-actions a {
    width: 100%;
  }

  .task-options {
    align-items: stretch;
    flex-direction: column;
  }

  .task-options label {
    grid-template-columns: 75px 1fr;
  }

  .task-status-row {
    align-items: stretch;
    flex-direction: column;
  }

  .task-status-row dl {
    justify-content: space-between;
    gap: 8px;
  }

  .record-filters {
    align-items: stretch;
    flex-direction: column;
  }

  .photo-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .photo-toolbar select {
    width: 100%;
  }

  .photo-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .photo-tile {
    grid-template-rows: auto 44px;
  }

  .photo-tile figcaption {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 0;
  }

  .record-item {
    grid-template-columns: 1fr;
    gap: 13px;
  }

  .recent-record-list .record-item {
    grid-template-columns: 1fr;
  }

  .record-meta {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 12px;
  }

  .record-meta time {
    grid-column: 1;
  }

  .record-category {
    grid-row: 1 / 3;
    grid-column: 2;
    align-self: start;
    margin-top: 0;
  }

  .record-counts {
    grid-column: 1;
  }

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

  .toast {
    right: 14px;
    bottom: 14px;
    max-width: calc(100vw - 28px);
  }
}

@media (max-width: 360px) {
  .customer-contact-copy {
    display: none;
  }
}

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