* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f4f6f9;
  color: #17212b;
}
.shell {
  max-width: 1260px;
  margin: 0 auto;
  padding: clamp(16px, 3vw, 28px);
}
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 20px;
}
h1 {
  margin: 0 0 6px;
  font-size: 30px;
}
.topbar p {
  margin: 0;
  color: #5f6b7a;
}
.status-block {
  min-width: 220px;
  text-align: right;
  display: grid;
  gap: 4px;
}
.status-label, .metric-label, label, .note {
  color: #5f6b7a;
  font-size: 13px;
}
.status-value {
  font-size: 22px;
  font-weight: 700;
  margin-top: 4px;
}
.status-hint {
  margin-top: 4px;
  color: #667085;
  font-size: 12px;
}
.switch-row {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  color: #344054;
  cursor: pointer;
}
.switch-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.switch-track {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #d0d5dd;
  position: relative;
  flex: 0 0 auto;
  transition: background 0.18s ease;
}
.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.24);
  transition: transform 0.18s ease;
}
.switch-row input:checked + .switch-track {
  background: #1463ff;
}
.switch-row input:checked + .switch-track::after {
  transform: translateX(20px);
}

.status-banner {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  min-width: min(560px, calc(100vw - 32px));
  max-width: min(560px, calc(100vw - 32px));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid #cfd7e3;
  background: #ffffff;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.16);
}
.status-banner.hidden { display: none; }
.status-banner.error {
  border-color: #f1aeb5;
  background: #fff5f5;
}
.status-banner-text {
  color: #18212f;
  font-size: 14px;
  line-height: 1.5;
  flex: 1;
}
.status-banner-close {
  border: 0;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  padding: 0 4px;
  color: #667085;
  cursor: pointer;
}
.mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.mode-panel, .panel {
  background: white;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  padding: 16px;
}
.mode-panel.active {
  border-color: #1463ff;
  box-shadow: 0 0 0 1px rgba(20, 99, 255, 0.14);
}
.mode-head, .section-head, .store-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.mode-head h2, .section-head h2, .store-top h3 { margin: 0; }
.mode-head h2, .section-head h2 { font-size: 18px; }
.store-top h3 {
  font-size: 16px;
  line-height: 1.35;
}
.tag {
  background: #eef4ff;
  color: #175cd3;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
}
.metric-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.metric-edit {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}
.metric-value {
  margin-top: 6px;
  font-size: clamp(22px, 4vw, 28px);
  font-weight: 700;
}
.override-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
  align-items: end;
}
.choice-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
button {
  border: 1px solid #c9d1d9;
  background: white;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font: inherit;
}
button.primary {
  background: #1463ff;
  color: white;
  border-color: #1463ff;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}
button.choice.selected, .channel-btn.active {
  border-color: #1463ff;
  background: #eef4ff;
  color: #175cd3;
}
.mini-btn {
  padding: 8px 10px;
  white-space: nowrap;
}
.field label {
  display: block;
  margin-bottom: 6px;
}
input {
  width: 100%;
  border: 1px solid #cfd7e3;
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  background: white;
}
.inline-note {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.batch-row {
  align-items: stretch;
}
.store-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.store-card {
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  display: grid;
  gap: 12px;
  min-height: 150px;
  position: relative;
  overflow: hidden;
}
.store-card.disabled {
  opacity: 0.88;
}
.store-card.flashing {
  border-color: #1463ff;
  box-shadow: 0 0 0 1px rgba(20, 99, 255, 0.16), 0 10px 24px rgba(20, 99, 255, 0.08);
}
.store-card.flashing::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(20, 99, 255, 0.02) 38%, rgba(20, 99, 255, 0.28) 50%, rgba(20, 99, 255, 0.02) 62%, transparent 100%);
  transform: translateX(-120%);
  animation: sweepFlash 1.2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes sweepFlash {
  0% {
    transform: translateX(-120%);
    opacity: 0.15;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translateX(120%);
    opacity: 0.15;
  }
}
.store-no {
  margin-top: 4px;
  color: #667085;
  font-size: 12px;
  word-break: break-all;
}
.store-state {
  min-width: 88px;
  text-align: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}
.store-state.haomaqi {
  background: #ecfdf3;
  color: #027a48;
}
.store-state.lakala {
  background: #eef4ff;
  color: #175cd3;
}
.channel-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.channel-btn {
  padding: 10px 12px;
  font-weight: 600;
}
.store-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #667085;
  font-size: 12px;
  flex-wrap: wrap;
}
.log-panel {
  margin-top: 14px;
}
.log-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.log-item {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 10px 12px;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  background: #fafbfc;
}
.log-time {
  min-width: 82px;
  color: #667085;
  font-size: 12px;
  flex: 0 0 auto;
}
.log-text {
  color: #18212f;
  font-size: 13px;
  line-height: 1.45;
}
.log-empty {
  color: #667085;
  font-size: 13px;
  padding: 8px 0;
}
@media (max-width: 980px) {
  .store-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 840px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
  .status-block {
    min-width: 0;
    text-align: left;
  }
  .override-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .status-block {
    text-align: left;
  }
  .mode-grid, .override-row {
    grid-template-columns: 1fr;
  }
  .metric-row {
    grid-template-columns: 1fr;
  }
  .metric-edit {
    flex-wrap: wrap;
  }
  .store-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 560px) {
  .shell {
    padding: 14px;
  }
  h1 {
    font-size: 24px;
  }
  .topbar p {
    line-height: 1.5;
  }
  .mode-panel, .panel, .status-banner {
    border-radius: 8px;
  }
  .status-banner {
    left: 16px;
    right: 16px;
    top: auto;
    bottom: 16px;
    transform: none;
    min-width: 0;
    max-width: none;
  }
  .status-banner-text {
    font-size: 13px;
  }
  .mode-head, .section-head, .store-top {
    align-items: flex-start;
    flex-direction: column;
  }
  .tag {
    white-space: normal;
  }
  .choice-group {
    flex-direction: column;
  }
  .choice-group button, .mini-btn, button.primary, .channel-btn {
    width: 100%;
  }
  .confirm-actions button {
    width: 100%;
  }
  .metric-value {
    font-size: 24px;
  }
}
.hidden {
  display: none !important;
}
.confirm-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}


.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.24);
  display: grid;
  place-items: center;
  z-index: 30;
  padding: 16px;
}
.login-overlay.hidden {
  display: none;
}
.login-card {
  width: min(360px, 100%);
  background: #fff;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  padding: 18px;
  display: grid;
  gap: 12px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
}
.login-title {
  font-size: 20px;
  font-weight: 700;
}
.login-field {
  display: grid;
  gap: 6px;
}
.login-submit {
  width: 100%;
}
.login-hint {
  min-height: 20px;
  color: #b42318;
  font-size: 13px;
}
.login-state {
  font-size: 12px;
  color: #667085;
}
.login-link {
  border: 0;
  background: transparent;
  color: #175cd3;
  padding: 0;
  text-align: left;
}
.logout-inline {
  justify-self: end;
}


body.app-locked .shell {
  visibility: hidden;
}
body.app-locked {
  overflow: hidden;
}
.session-strip {
  background: white;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.session-summary {
  cursor: pointer;
  list-style: none;
}
.session-summary::-webkit-details-marker {
  display: none;
}
.session-summary::before {
  content: '>';
  color: #667085;
  font-size: 18px;
  transform: rotate(0deg);
  transition: transform 0.18s ease;
}
.session-strip[open] .session-summary::before {
  transform: rotate(90deg);
}
.session-content {
  display: grid;
  gap: 12px;
  padding-top: 14px;
}
.session-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 12px;
}
.session-grid .field {
  min-width: 0;
}
.session-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.session-state {
  color: #667085;
  font-size: 12px;
}
  .session-grid {
    grid-template-columns: 1fr 1fr;
  }
  .session-actions {
    align-items: stretch;
  }
  .session-grid {
    grid-template-columns: 1fr;
  }
