*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #eef6fc;
  --surface: #ffffff;
  --primary: #4a9fd4;
  --primary-dark: #2d7eb5;
  --primary-light: #d4eaf7;
  --text: #1a3a52;
  --text-muted: #5a7a92;
  --border: #c5dff0;
  --danger: #d64545;
  --success: #2a9d6a;
  --shadow: 0 2px 12px rgba(74, 159, 212, 0.12);
  --radius: 10px;
}

html {
  font-size: 150%;
}

body {
  margin: 0;
  font-family: "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  background-color: var(--bg);
  background-image: url("/images/beijing.jpeg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: var(--primary-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 100px;
}

header {
  padding: 16px 20px 0;
  background: transparent;
  box-shadow: none;
}

header .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px;
  text-align: center;
  color: var(--text);
  border-radius: var(--radius);
  overflow: hidden;
  background: transparent;
  box-shadow: none;
}

header h1 {
  margin: 0 0 6px;
  font-size: calc(1.5rem * 1.2);
  font-weight: 700;
  color: #fff;
  -webkit-text-stroke: 3px #042a4a;
  paint-order: stroke fill;
  text-shadow:
    2px 0 0 #042a4a,
    -2px 0 0 #042a4a,
    0 2px 0 #042a4a,
    0 -2px 0 #042a4a,
    1.5px 1.5px 0 #042a4a,
    -1.5px 1.5px 0 #042a4a,
    1.5px -1.5px 0 #042a4a,
    -1.5px -1.5px 0 #042a4a,
    0 0 8px rgba(255, 255, 255, 0.95),
    0 0 18px rgba(255, 255, 255, 0.75),
    0 0 32px rgba(255, 255, 255, 0.45);
}

header p {
  margin: 0;
  opacity: 0.9;
  font-size: 0.9rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 20px 0 16px;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
}

.meta {
  color: #111;
  /* 原 2 倍基础再缩小 20% */
  font-size: calc(0.875rem * 4 / 3 * 0.8);
  flex-shrink: 0;
  white-space: nowrap;
  -webkit-text-stroke: 3px #fff;
  paint-order: stroke fill;
}

.meta .meta-num {
  color: #2db86a;
  font-size: 1.15em;
  font-weight: 700;
  -webkit-text-stroke: 3px #111;
  paint-order: stroke fill;
  text-shadow:
    0 0 4px rgba(77, 217, 136, 0.95),
    0 0 12px rgba(77, 217, 136, 0.75),
    0 0 20px rgba(120, 230, 170, 0.5);
}

.meta.meta-fresh,
.meta.meta-stale {
  font-weight: 600;
}

.notice-hint {
  background: var(--primary-light);
  padding: 8px 16px;
  border-radius: var(--radius);
  color: var(--text-muted);
  margin-bottom: 16px;
}

.notice-hint-line {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.35;
  white-space: nowrap;
  overflow-x: auto;
  text-align: center;
}

.notice-highlight {
  color: var(--danger);
  font-weight: 700;
}

.notice-hint-line + .notice-hint-line {
  margin-top: 6px;
}

.notice-hint-best {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.best-pick {
  color: #2db86a;
  font-size: 1.15rem;
  font-weight: 700;
  -webkit-text-stroke: 0.45px #111;
  paint-order: stroke fill;
  text-shadow:
    1px 0 0 #111,
    -1px 0 0 #111,
    0 1px 0 #111,
    0 -1px 0 #111,
    0 0 4px rgba(77, 217, 136, 0.95),
    0 0 12px rgba(77, 217, 136, 0.75),
    0 0 20px rgba(120, 230, 170, 0.5);
}

.notice-hint-footer {
  margin-top: 1.35em;
  text-align: center;
}

.notice-hint-disclaimer {
  margin: 0;
  color: var(--text-muted);
}

.disclaimer-title {
  margin: 0 0 6px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #111;
}

.disclaimer-text {
  margin: 0 0 5px;
  font-size: 0.6rem;
  line-height: 1.45;
  text-align: center;
}

.disclaimer-text strong {
  color: #333;
  font-weight: 600;
}

.disclaimer-bless {
  margin-top: 8px;
  color: var(--primary-dark);
  font-weight: 600;
}

.disclaimer-author {
  color: #111;
}

.tabs-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.tabs-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.tab {
  padding: 10px 20px;
  border: 1px solid var(--border);
  background: var(--primary-light);
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.15s;
}

.tab:hover {
  border-color: var(--primary);
  background: #c5e3f5;
}

.tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--primary-light);
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.15s;
}

.btn:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: #c5e3f5;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  color: #fff;
}

.btn-danger {
  color: var(--danger);
  border-color: #f0c0c0;
  background: #fff0f0;
}

.btn-danger:hover {
  background: #fff5f5;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.freight-panel {
  padding: 16px 20px 20px;
}

.freight-title {
  margin: 0 0 6px;
  font-size: 1rem;
  color: var(--primary-dark);
}

.freight-hint {
  margin: 0 0 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.freight-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.freight-row:last-of-type {
  border-bottom: none;
}

.freight-index {
  flex: 0 0 24px;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: right;
}

.freight-product {
  flex: 1 1 200px;
  min-width: 160px;
  max-width: 320px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--text);
  background: #fff;
}

.freight-qty {
  width: 100px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--text);
}

.freight-formula {
  flex: 1 1 180px;
  color: var(--text);
  font-size: 0.875rem;
  white-space: nowrap;
}

.freight-formula strong {
  color: var(--primary-dark);
  font-weight: 700;
}

.freight-total-row {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 2px solid var(--border);
}

.freight-total-label {
  font-size: 0.95rem;
  color: var(--text);
  font-weight: 600;
}

.freight-total-num {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.freight-total-unit {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th,
td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  background: var(--primary-light);
  color: var(--text);
  font-weight: 600;
  position: sticky;
  top: 0;
  cursor: pointer;
  user-select: none;
}

th:hover {
  background: #c0e0f4;
}

th .sort-icon {
  opacity: 0.4;
  margin-left: 4px;
}

th.sorted .sort-icon {
  opacity: 1;
}

tr:hover td {
  background: #f8fcff;
}

tr.locked td.col-notes {
  color: var(--text-muted);
}

td.col-num {
  color: var(--text);
}

td.col-product {
  color: var(--text);
}

td.col-num input {
  color: var(--text);
}

td.col-profit .profit-value {
  color: var(--text);
  font-weight: 400;
}

.profit-warning {
  color: #b8860b !important;
  font-weight: 700;
  text-shadow:
    0 0 4px rgba(255, 193, 7, 0.85),
    0 0 10px rgba(255, 193, 7, 0.55);
}

tr.type-header td {
  background: #e3f2fa;
  color: var(--primary-dark);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 36px;
  z-index: 1;
}

tr.type-header:hover td {
  background: #e3f2fa;
}

.profit-top-tag {
  margin-left: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: 0.02em;
}

.profit-highest {
  color: #16884a !important;
  font-weight: 700;
  text-shadow:
    0 0 4px rgba(42, 157, 106, 0.9),
    0 0 10px rgba(42, 157, 106, 0.65),
    0 0 18px rgba(42, 157, 106, 0.35);
}

.profit-lowest {
  color: #c62828 !important;
  font-weight: 700;
  text-shadow:
    0 0 4px rgba(214, 69, 69, 0.9),
    0 0 10px rgba(214, 69, 69, 0.65),
    0 0 18px rgba(214, 69, 69, 0.35);
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: #fff3cd;
  color: #856404;
}

.badge-locked {
  background: #e9ecef;
  color: #6c757d;
}

.badge-double {
  background: #fff3cd;
  color: #856404;
}

.badge-unknown-double {
  background: #e9ecef;
  color: #6c757d;
}

input[type="number"],
input[type="password"],
input[type="text"] {
  width: 90px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.875rem;
}

input[type="password"].wide,
input[type="text"].wide {
  width: 200px;
}

.tabs-tools input.search-input {
  width: 280px;
  min-width: 200px;
  max-width: 360px;
  flex: 0 1 auto;
  box-sizing: border-box;
}

input.input-double {
  width: 90px;
}

input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(74, 159, 212, 0.2);
}

.fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  padding: 14px 28px;
  font-size: 1rem;
  box-shadow: 0 4px 20px rgba(74, 159, 212, 0.35);
  z-index: 100;
  display: none;
}

.fab.visible {
  display: block;
}

.admin-section {
  margin-bottom: 24px;
}

.admin-section .table-wrap {
  max-height: none;
  overflow-y: visible;
}

.admin-section .card {
  overflow: visible;
}

.admin-section h2 {
  font-size: 1.1rem;
  margin: 0 0 12px;
  color: var(--primary-dark);
}

.login-box {
  max-width: 360px;
  margin: 60px auto;
  padding: 32px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-box h2 {
  margin: 0 0 20px;
  text-align: center;
}

.login-box label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.875rem;
}

.login-box input {
  width: 100%;
  margin-bottom: 16px;
}

.login-box .btn-primary {
  width: 100%;
  padding: 10px;
}

.error-msg {
  color: var(--danger);
  font-size: 0.875rem;
  margin-top: 8px;
}

.hidden {
  display: none !important;
}

.font-notice {
  margin: 24px 0 0;
  padding-bottom: 16px;
  text-align: center;
  font-size: 0.65rem;
  color: var(--text-muted);
  opacity: 0.55;
}

@media (max-width: 768px) {
  html {
    font-size: 100%;
  }

  body {
    background-image: url("/images/beijing-mobile.jpeg");
    background-position: center top;
    background-size: cover;
    background-attachment: scroll;
  }

  .container {
    padding: 10px 10px 88px;
  }

  header {
    padding: 10px 10px 0;
  }

  header .container {
    padding: 16px 8px;
  }

  header h1 {
    font-size: 1.05rem;
    line-height: 1.4;
    -webkit-text-stroke: 2px #042a4a;
    text-shadow:
      1.5px 0 0 #042a4a,
      -1.5px 0 0 #042a4a,
      0 1.5px 0 #042a4a,
      0 -1.5px 0 #042a4a,
      0 0 6px rgba(255, 255, 255, 0.9),
      0 0 14px rgba(255, 255, 255, 0.65);
  }

  .notice-hint {
    padding: 8px 10px;
    background: rgba(212, 234, 247, 0.92);
  }

  .notice-hint-line {
    white-space: normal;
    word-break: break-word;
    font-size: 0.68rem;
  }

  .notice-hint-best {
    font-size: 0.78rem;
    white-space: normal;
    word-break: break-word;
    line-height: 1.45;
  }

  .best-pick {
    font-size: 0.95rem;
  }

  .disclaimer-text {
    font-size: 0.58rem;
  }

  .disclaimer-bless {
    white-space: normal;
    word-break: break-word;
    line-height: 1.5;
  }

  .tabs-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }

  .tab {
    padding: 10px 8px;
    font-size: 0.78rem;
    line-height: 1.25;
    text-align: center;
  }

  .tabs-tools {
    margin-left: 0;
    justify-content: stretch;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .tabs-tools .btn {
    width: 100%;
    text-align: center;
  }

  .tabs-tools .meta {
    text-align: center;
    width: 100%;
    white-space: normal;
    font-size: 0.82rem;
    -webkit-text-stroke: 2px #fff;
  }

  .meta .meta-num {
    -webkit-text-stroke: 2px #111;
  }

  .tabs-tools input.search-input {
    flex: 1 1 auto;
    max-width: none;
    width: 100%;
    min-width: 0;
  }

  .card {
    background: rgba(255, 255, 255, 0.96);
  }

  .freight-panel {
    padding: 12px 12px 16px;
  }

  .freight-row {
    gap: 8px;
  }

  .freight-product {
    flex: 1 1 100%;
    max-width: none;
  }

  .freight-qty {
    width: 100%;
  }

  .freight-formula {
    flex: 1 1 100%;
    white-space: normal;
    word-break: break-all;
  }

  .freight-total-row {
    flex-wrap: wrap;
    justify-content: center;
  }

  th,
  td {
    padding: 6px 8px;
    font-size: 0.75rem;
  }

  tr.type-header td {
    top: 28px;
    font-size: 0.72rem;
  }

  .fab {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    padding: 12px 22px;
    font-size: 0.9rem;
  }
}
