:root {
  --bg: #f3efe6;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: #ffffff;
  --ink: #1b2431;
  --muted: #607087;
  --line: rgba(27, 36, 49, 0.1);
  --accent: #1f4e78;
  --success: #1f7a4d;
  --danger: #b54a3f;
  --shadow: 0 20px 50px rgba(31, 54, 82, 0.12);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI Variable Display", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(31, 78, 120, 0.12), transparent 35%),
    radial-gradient(circle at bottom right, rgba(243, 184, 74, 0.15), transparent 26%),
    linear-gradient(180deg, #fcfbf8 0%, var(--bg) 100%);
}

.page-shell {
  width: min(1580px, calc(100vw - 32px));
  margin: 14px auto 30px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-card {
  width: min(420px, calc(100vw - 32px));
  padding: 28px 24px;
  border-radius: var(--radius-lg);
}

.login-card h1 {
  margin: 0;
  font-size: 28px;
}

.login-copy {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

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

.login-field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(31, 78, 120, 0.12);
  background: var(--panel-strong);
  color: var(--ink);
  font: inherit;
}

.login-button {
  margin-top: 18px;
  width: 100%;
}

.login-status {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.hero,
.control-panel,
.summary-strip,
.sku-card {
  backdrop-filter: blur(18px);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(31, 78, 120, 0.97), rgba(25, 38, 74, 0.96));
  color: #f7fbff;
  box-shadow: var(--shadow);
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.hero-user {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hero-user-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(247, 251, 255, 0.72);
}

.hero-user strong,
.hero-user small {
  display: block;
}

.hero-user small {
  color: rgba(247, 251, 255, 0.78);
}

.hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 6px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 14px;
  opacity: 0.72;
}

.hero h1,
.sku-card-header h2,
.note-head h3 {
  margin: 0;
}

.hero h1 {
  font-size: clamp(22px, 2.6vw, 28px);
}

.hero-copy {
  margin: 8px 0 0;
  line-height: 1.55;
  font-size: 13px;
  color: rgba(247, 251, 255, 0.84);
}

.hero-heading {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hero-meta,
.control-panel,
.summary-card,
.sku-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.hero-meta {
  align-self: end;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px;
  border-radius: var(--radius-md);
  color: var(--ink);
}

.meta-label,
.summary-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.control-panel,
.sku-card {
  margin-top: 16px;
  padding: 18px;
  border-radius: var(--radius-lg);
}

.control-panel {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(180px, 0.9fr) minmax(0, 1.8fr) auto;
  gap: 16px;
  align-items: end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.field select,
.field input,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(31, 78, 120, 0.12);
  background: var(--panel-strong);
  color: var(--ink);
  font: inherit;
}

.field-wide {
  min-width: 300px;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-size: 13px;
  transition: transform 160ms ease;
}

button:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: linear-gradient(135deg, #1f4e78, #295f90);
  color: #fff;
}

.ghost-button {
  background: rgba(31, 78, 120, 0.08);
  color: var(--accent);
}

.hero .ghost-button {
  background: rgba(255, 255, 255, 0.12);
  color: #f7fbff;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.trend-button {
  padding: 8px 14px;
  font-size: 12px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.summary-card {
  padding: 16px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.summary-accent {
  background: linear-gradient(135deg, rgba(31, 78, 120, 0.98), rgba(71, 107, 52, 0.95));
  color: #f7fafc;
}

.summary-accent .summary-label,
.summary-accent small {
  color: rgba(247, 250, 252, 0.78);
}

.summary-card strong {
  font-size: 20px;
}

.status-row {
  margin-top: 18px;
}

.status-text {
  margin: 0;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.sku-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 14px;
}

.sku-card-header,
.note-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.sku-card-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sku-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sku-country {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.85em;
}

.sku-asin-sub {
  margin: 2px 0 0;
  font-size: 0.78em;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.trend-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sku-meta,
.note-tip {
  margin: 6px 0 0;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  background: var(--panel-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.listing-wrap {
  margin-top: 16px;
}

.listing-table {
  min-width: 1080px;
}

thead th {
  background: linear-gradient(135deg, rgba(31, 78, 120, 0.96), rgba(31, 78, 120, 0.82));
  color: #fff;
  font-size: 13px;
}

th,
td {
  border: 1px solid var(--line);
  padding: 10px 12px;
  text-align: right;
  white-space: nowrap;
  vertical-align: top;
  font-size: 13px;
}

th:first-child,
td:first-child {
  text-align: left;
}

tbody tr:nth-child(odd) td {
  background: rgba(31, 78, 120, 0.02);
}

tbody td.value-cell {
  background: rgba(226, 239, 218, 0.72);
}

.delta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12px;
}

.delta.positive {
  color: var(--success);
  background: rgba(31, 122, 77, 0.12);
}

.delta.negative {
  color: var(--danger);
  background: rgba(181, 74, 63, 0.12);
}

.delta.neutral {
  color: var(--muted);
  background: rgba(96, 112, 135, 0.1);
}

.cell-delta {
  margin-top: 8px;
}

.note-panel {
  margin-top: 14px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(31, 78, 120, 0.04);
}

.note-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

textarea {
  resize: none;
  min-height: 160px;
  height: 160px;
  line-height: 1.6;
}

textarea::placeholder {
  color: rgba(96, 112, 135, 0.72);
}

.note-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.note-tip-inline {
  margin: 0;
}

.filter-group-wrap {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.field-label {
  font-size: 13px;
  color: rgba(247, 251, 255, 0.9);
  white-space: nowrap;
}

.form-select {
  min-width: 148px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.import-section {
  margin-top: 14px;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: stretch;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.upload-zone {
  flex: 1;
  min-height: 92px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px dashed rgba(31, 78, 120, 0.32);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(31, 78, 120, 0.04), rgba(243, 184, 74, 0.08));
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.upload-zone:hover,
.upload-zone.is-dragover {
  border-color: rgba(31, 78, 120, 0.7);
  background: linear-gradient(135deg, rgba(31, 78, 120, 0.08), rgba(243, 184, 74, 0.12));
  transform: translateY(-1px);
}

.upload-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.upload-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.upload-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.upload-file-name {
  max-width: 240px;
  color: var(--accent);
  font-size: 12px;
  text-align: right;
  word-break: break-word;
}

.import-meta {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(16, 24, 40, 0.38);
  backdrop-filter: blur(6px);
}

.modal-card {
  width: min(1450px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.modal-head h3 {
  margin: 0;
}

.password-form {
  display: grid;
  gap: 14px;
}

.password-form .field {
  gap: 6px;
}

.password-form .field span {
  color: var(--ink);
  font-size: 13px;
}

.password-status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.modal-table-wrap {
  max-height: calc(100vh - 180px);
  overflow: auto;
}

.seven-day-table {
  min-width: 860px;
}

@media (max-width: 980px) {
  .page-shell {
    width: calc(100vw - 20px);
    margin: 10px auto 28px;
  }

  .hero,
  .control-panel,
  .summary-strip,
  .note-grid {
    grid-template-columns: 1fr;
  }

  .import-section {
    flex-direction: column;
  }

  .upload-zone {
    align-items: flex-start;
    flex-direction: column;
  }

  .filter-group {
    width: 100%;
    justify-content: space-between;
  }

  .form-select {
    flex: 1;
    min-width: 0;
  }

  .sku-title-row,
  .modal-head,
  .hero-top {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* ---- export modal ---- */
.export-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.export-hint {
  color: var(--muted);
  font-size: 0.9em;
  margin: 0;
}

.export-date-row {
  display: flex;
  gap: 12px;
}

.export-date-row .field {
  flex: 1;
}

.delete-owner-section {
  border: 1px solid rgba(181, 74, 63, 0.25);
  background: rgba(181, 74, 63, 0.04);
}

.delete-owner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  flex-wrap: wrap;
}

.delete-owner-button {
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  padding: 6px 14px;
}

.delete-owner-button:hover {
  background: #a04038;
}

.exclude-sku-button {
  background: rgba(181, 74, 63, 0.1);
  color: var(--danger);
  font-size: 11px;
  padding: 4px 10px;
  margin-left: 8px;
}

.exclude-sku-button.is-excluded {
  background: rgba(31, 122, 77, 0.12);
  color: var(--success);
}

.sku-excluded-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(181, 74, 63, 0.15);
  color: var(--danger);
}
