/* 销量追踪系统 — shared stylesheet (login, main, admin, offline).
   Decoration colours (--pink, --lavender, --bg-*, --line*) are never used for text.
   Text/background pairs are checked by scripts/check-contrast.js (every --x-fg/--x-bg pair must be >= 4.5). */

:root {
  color-scheme: light only;

  /* decoration */
  --pink: #ff7eb3;
  --lavender: #b388ff;
  --bg-1: #fff5f9;
  --bg-2: #f6f0ff;
  --line: #f6d9e8;
  --line-2: #e6d6f5;
  --shadow: 0 6px 20px rgba(255, 126, 179, 0.16), 0 1px 3px rgba(142, 91, 217, 0.1);
  --shadow-lg: 0 14px 40px rgba(214, 51, 122, 0.18), 0 2px 6px rgba(142, 91, 217, 0.12);

  /* surfaces */
  --surface: #ffffff;
  --surface-2: #fff8fb;
  --seg-bg: #f7eefb;

  /* text */
  --text: #3b2f4a;
  --text-2: #6b5a7c;
  --accent-text: #c2185b;

  /* primary: white on #d6337a → #8e5bd9 */
  --on-primary: #ffffff;
  --primary-1: #d6337a;
  --primary-2: #8e5bd9;

  /* fg/bg pairs */
  --add-fg: #b0104f;       --add-bg: #ffe0ec;
  --refund-fg: #3f5fc0;    --refund-bg: #e8eeff;
  --init-fg: #7b4fc4;      --init-bg: #f1e8ff;
  --calib-fg: #5c5470;     --calib-bg: #efecf3;
  --tag-fg: #b0104f;       --tag-bg: #fff0f6;
  --chip-fg: #5d4a78;      --chip-bg: #f3ecff;
  --live-fg: #c2185b;      --live-bg: #ffe0ec;
  --warn-fg: #7a4a00;      --warn-bg: #fff3d6;
  --muted-fg: #5f5670;     --muted-bg: #efecf3;
  --danger-fg: #b3261e;    --danger-bg: #ffe8e6;
  --danger-btn-fg: #ffffff; --danger-btn-bg: #c0314f;
  --toast-fg: #ffffff;     --toast-bg: #3b2f4a;
  --toast-action-fg: #ffb8d5;

  --radius: 16px;
  --radius-sm: 12px;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei",
    "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;

  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0 auto;
  max-width: 1200px;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(16px + var(--sat)) calc(16px + var(--sar)) calc(24px + var(--sab)) calc(16px + var(--sal));
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-1);
  overflow-x: hidden;
  overflow-x: clip;
  -webkit-tap-highlight-color: transparent;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 126, 179, 0.14), transparent 40%),
    radial-gradient(circle at 92% 30%, rgba(179, 136, 255, 0.14), transparent 45%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2));
}
html.modal-open body { overflow: hidden; }

h1, h2, h3, p { margin: 0; }
a { color: var(--accent-text); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--primary-2); outline-offset: 2px; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.num, td, .stat-card p, .clock, .countdown { font-variant-numeric: tabular-nums; }
.hint { font-size: 13px; color: var(--text-2); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.12s ease, background 0.15s ease, filter 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }
@media (hover: hover) { .btn:hover { background: var(--tag-bg); } }
.btn-primary {
  border-color: transparent;
  color: var(--on-primary);
  background: linear-gradient(135deg, var(--primary-1), var(--primary-2));
  box-shadow: 0 4px 14px rgba(214, 51, 122, 0.25);
}
@media (hover: hover) { .btn-primary:hover { background: linear-gradient(135deg, var(--primary-1), var(--primary-2)); filter: brightness(0.95); } }
.btn-ghost { color: var(--accent-text); }
.btn-danger { border-color: transparent; color: var(--danger-btn-fg); background: var(--danger-btn-bg); }
@media (hover: hover) { .btn-danger:hover { background: var(--danger-btn-bg); filter: brightness(0.94); } }
.btn-danger-line { color: var(--danger-fg); border-color: #f5c6cf; }
@media (hover: hover) { .btn-danger-line:hover { background: var(--danger-bg); } }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }

.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.is-loading .spinner { display: inline-block; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent-text);
  font-size: 18px;
  line-height: 1;
}

/* ---------- form controls ---------- */

input[type="text"], input[type="password"], input[type="number"], select, textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font-size: 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary-2);
  box-shadow: 0 0 0 3px rgba(142, 91, 217, 0.18);
}
::placeholder { color: var(--text-2); opacity: 1; }
textarea { resize: vertical; line-height: 1.5; min-height: 96px; }
select {
  appearance: none;
  -webkit-appearance: none;
  width: auto;
  padding-right: 34px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23c2185b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
input[type="checkbox"] { accent-color: var(--primary-1); width: 18px; height: 18px; margin: 0; flex: none; }

.form { display: grid; gap: 12px; }
.field, .form-group { display: grid; gap: 4px; min-width: 0; }
.form-group { margin-bottom: 12px; }
.field > label, .form-group > label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.form-error {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--danger-fg);
  background: var(--danger-bg);
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.checkbox-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 8px;
}
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 14px;
  cursor: pointer;
  min-width: 0;
}
.checkbox-item span { min-width: 0; overflow-wrap: anywhere; }
.checkbox-item.is-archived span { color: var(--text-2); }

/* ---------- badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
  vertical-align: 1px;
}
.badge-pending, .badge-warn { color: var(--warn-fg); background: var(--warn-bg); }
.badge-ended, .badge-gone, .badge-archived { color: var(--muted-fg); background: var(--muted-bg); }
.badge-invalid { color: var(--danger-fg); background: var(--danger-bg); }
.badge-active { color: var(--live-fg); background: var(--live-bg); }
.badge-admin { color: var(--init-fg); background: var(--init-bg); }
.tz {
  display: inline-block;
  padding: 0 4px;
  margin-right: 3px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--chip-fg);
  background: var(--chip-bg);
}

/* ---------- page header ---------- */

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.header h1 { font-size: 20px; font-weight: 800; }
.header-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}
.clock {
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
}
.clock-sep { margin: 0 6px; }
.user-badge { font-size: 14px; color: var(--text-2); overflow-wrap: anywhere; }

/* ---------- tabs ---------- */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  padding: 6px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.tab {
  min-height: 40px;
  max-width: 100%;
  padding: 8px 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s ease, color 0.15s ease;
}
@media (min-width: 600px) { .tab { max-width: 280px; } }
@media (hover: hover) { .tab:hover { background: var(--tag-bg); } }
.tab.active, .tab.active:hover {
  color: var(--on-primary);
  background: linear-gradient(135deg, var(--primary-1), var(--primary-2));
  font-weight: 600;
}
.tab.muted { color: var(--muted-fg); text-decoration: line-through; text-decoration-color: rgba(95, 86, 112, 0.5); }
.tab.active.muted { color: var(--on-primary); text-decoration: none; }
.tabs:empty { display: none; }
.tabs-empty { padding: 8px 10px; color: var(--text-2); font-size: 14px; }

/* ---------- cards ---------- */

.card, .product-info, .stat-card, .table-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
}
.card { padding: 18px; margin-bottom: 16px; }
.card h2 { font-size: 16px; font-weight: 700; margin-bottom: 14px; }

.product-info { padding: 14px 16px; margin-bottom: 16px; display: grid; gap: 4px; }
.product-info .name { font-size: 16px; font-weight: 700; overflow-wrap: anywhere; word-break: keep-all; }
.product-info .name a { color: var(--text); text-decoration: none; }
.product-info .name a:hover, .product-info .name a:focus-visible { text-decoration: underline; }
.product-info .sub { font-size: 13px; color: var(--text-2); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.countdown { font-size: 14px; color: var(--text); overflow-wrap: anywhere; }
.countdown b { color: var(--accent-text); }
.countdown .left { white-space: nowrap; }
.countdown.is-past { color: var(--text-2); }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.stat-card { padding: 14px 16px; }
.stat-card h3 { font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.stat-card p { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1.25; overflow-wrap: anywhere; }
.stat-card p.cut { color: var(--accent-text); }
.stat-card p.negative { color: var(--refund-fg); }
.stat-card p.small { font-size: 16px; }

.last-update { font-size: 13px; color: var(--text-2); margin-bottom: 14px; overflow-wrap: anywhere; }
.live { color: var(--live-fg); font-weight: 600; white-space: nowrap; }
.stale { color: var(--warn-fg); white-space: nowrap; }

/* ---------- toolbar & table ---------- */

.toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.toolbar-left { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.toolbar label { font-size: 13px; color: var(--text-2); }
.toolbar select { min-height: 40px; font-size: 16px; padding-top: 6px; padding-bottom: 6px; }
.order-btn {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}
@media (hover: hover) { .order-btn:hover { background: var(--tag-bg); } }
.order-btn.active, .order-btn.active:hover {
  border-color: transparent;
  color: var(--on-primary);
  background: linear-gradient(135deg, var(--primary-1), var(--primary-2));
}

.table-card { overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: left; font-size: 14px; }
th {
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
th[data-sort] { cursor: pointer; user-select: none; -webkit-user-select: none; }
@media (hover: hover) { th[data-sort]:hover { background: var(--tag-bg); } }
th[aria-sort="ascending"]::after { content: " ↑"; color: var(--accent-text); }
th[aria-sort="descending"]::after { content: " ↓"; color: var(--accent-text); }
td { border-top: 1px solid var(--line); }
td .t2 { color: var(--text-2); font-size: 12px; margin-top: 2px; }
td .t1, td .t2 { white-space: nowrap; }
tr.fresh td { animation: rec-in 3s ease; }
.positive { color: var(--add-fg); font-weight: 700; }
.negative { color: var(--refund-fg); font-weight: 700; }
.initial { color: var(--init-fg); font-weight: 700; }
.neutral { color: var(--calib-fg); font-weight: 700; }
.seq { color: var(--text-2); font-size: 12px; width: 44px; }
.empty { text-align: center; color: var(--text-2); padding: 36px 16px; font-size: 14px; }

/* ---------- toasts ---------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(16px + var(--sab));
  z-index: 80;
  display: grid;
  gap: 8px;
  width: min(440px, calc(100vw - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 8px 8px 16px;
  border-radius: 14px;
  color: var(--toast-fg);
  background: var(--toast-bg);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  pointer-events: auto;
  animation: toast-in 0.2s ease;
}
.toast-msg { flex: 1; min-width: 0; overflow-wrap: anywhere; padding: 4px 0; }
.toast-error { border-left: 5px solid var(--pink); }
.toast-action {
  flex: none;
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--toast-action-fg);
  font-weight: 700;
}

/* ---------- dialogs (sheets) ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + var(--sat)) calc(12px + var(--sar)) calc(16px + var(--sab)) calc(12px + var(--sal));
  background: rgba(59, 47, 74, 0.4);
  animation: fade-in 0.15s ease;
}
.sheet-backdrop.sheet-form { align-items: flex-start; }
.sheet {
  width: 100%;
  max-width: 500px;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 20px 20px;
  background: var(--surface);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.15s ease;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; }
.sheet-title { font-size: 17px; font-weight: 800; min-width: 0; overflow-wrap: anywhere; }
.sheet-body { display: grid; gap: 12px; }
.sheet-text { color: var(--text); overflow-wrap: anywhere; }
.sheet-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.sheet-actions .btn { flex: 1 1 120px; min-height: 44px; font-size: 15px; }
.policy { font-size: 13px; }
.copy-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--seg-bg);
  font-size: 17px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.copy-box code { flex: 1; min-width: 0; font: inherit; user-select: all; -webkit-user-select: all; }
@media (min-width: 600px) {
  .sheet-backdrop.sheet-form { align-items: center; }
}

/* ---------- add-to-home-screen guide ---------- */

.guide { display: grid; gap: 10px; }
.guide-block { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.guide-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.guide-steps { margin: 0; padding-left: 1.4em; display: grid; gap: 4px; }
.guide-note { color: var(--text-2); font-size: 14px; }

/* ---------- login ---------- */

body.page-login { max-width: none; padding: 0; }
.login-wrap {
  display: grid;
  gap: 14px;
  align-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 400px;
  margin: 0 auto;
  padding: calc(24px + var(--sat)) calc(16px + var(--sar)) calc(24px + var(--sab)) calc(16px + var(--sal));
}
.login-card { padding: 28px 22px; margin: 0; display: grid; gap: 14px; }
.login-logo { width: 64px; height: 64px; border-radius: 16px; justify-self: center; box-shadow: var(--shadow); }
.login-title { text-align: center; font-size: 22px; font-weight: 800; }
.login-card .btn { min-height: 46px; font-size: 16px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 68px; }
.pw-toggle {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 60px;
  height: 100%;
  border: 0;
  background: none;
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 700;
}
.a2hs-btn { justify-self: center; }

/* ---------- admin ---------- */

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px 0 4px;
  color: var(--accent-text);
  font-weight: 600;
  text-decoration: none;
}
.header-left { display: flex; align-items: center; gap: 4px; min-width: 0; flex-wrap: wrap; }
.admin-tabs .tab { flex: 1 1 0; max-width: none; }
.section { display: none; }
.section.active { display: block; }
.form-row { display: grid; gap: 12px; }
@media (min-width: 700px) { .form-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.results { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.results:empty { display: none; }
.result {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 14px;
  min-width: 0;
}
.result > span:last-child { min-width: 0; overflow-wrap: anywhere; }

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.list-item:last-child { border-bottom: 0; }
.list-item .info { flex: 1; min-width: 0; display: grid; gap: 2px; }
.list-item .name { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; word-break: keep-all; }
.list-item .sub { font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.list-item .sales { color: var(--text); font-weight: 700; }
.list-item a.name { color: var(--text); text-decoration: none; }
.list-item a.name:hover, .list-item a.name:focus-visible { text-decoration: underline; }
.list-item.is-archived .name { color: var(--text-2); }
.list-item .actions { display: flex; flex-wrap: wrap; gap: 6px; flex-shrink: 0; justify-content: flex-end; }
@media (max-width: 699.98px) {
  .list-item { flex-direction: column; align-items: stretch; }
  .list-item .actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(62px, 1fr)); }
  .list-item .actions .btn { padding: 0 6px; }
}

/* ---------- phones ---------- */

@media (max-width: 600px) {
  body { padding: calc(12px + var(--sat)) calc(12px + var(--sar)) calc(20px + var(--sab)) calc(12px + var(--sal)); }
  body.page-login { padding: 0; }
  .header h1 { font-size: 18px; }
  .page-main .header-right { width: 100%; }
  .page-main .clock { flex-basis: 100%; }
  .header-right .btn { padding: 0 12px; }
  .btn, .order-btn, .tab, .back-link, .check, .icon-btn { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  .btn-sm { min-height: 44px; padding: 0 14px; font-size: 14px; }
  .toolbar select { min-height: 44px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { padding: 12px; }
  .stat-card p { font-size: 20px; }
  .card { padding: 16px 14px; }
  th, td { padding: 10px 6px; font-size: 13px; }
  th { padding-top: 13px; padding-bottom: 13px; }
  th:first-child, td:first-child { padding-left: 10px; }
  th:last-child, td:last-child { padding-right: 10px; }
  .seq { width: 30px; }
}
@media (max-width: 359.98px) {
  th, td { padding-left: 4px; padding-right: 4px; font-size: 12px; }
  td .t2 { font-size: 11px; }
  .list-item .actions .btn { font-size: 13px; }
  .tz { font-size: 11px; padding: 0 3px; }
  .clock { font-size: 12px; }
  /* main header: clock and user on one line, the three buttons on the next */
  .page-main .header-right { gap: 6px; }
  .page-main .clock { flex-basis: auto; }
  .page-main .header-right::after { content: ''; flex-basis: 100%; order: 1; }
  .page-main .header-right .btn { order: 2; padding: 0 10px; }
  .toolbar label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .order-btn { padding: 0 10px; }
}

/* ---------- offline ---------- */

body.page-offline { display: grid; place-items: center; text-align: center; }
.offline-box { max-width: 360px; padding: 28px 22px; display: grid; gap: 12px; justify-items: center; }
.offline-box h1 { font-size: 20px; }
.offline-box p { color: var(--text-2); }

/* ---------- motion ---------- */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rec-in { from { background: var(--add-bg); } to { background: transparent; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { transform: scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }

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


/* SALES_TRACKER_PASTEL_UI_START */
/* Reference palette: sage, blush, warm peach and lavender. Load after style.css. */
:root {
  --pink: #f9d9e9;
  --lavender: #c2c0e6;
  --bg-1: #f0f0f0;
  --bg-2: #f0f0f0;
  --line: #e3e6df;
  --line-2: #d4dace;
  --shadow: 0 2px 16px rgba(24, 30, 45, .045);
  --shadow-lg: 0 14px 40px rgba(36, 50, 33, .12);
  --surface: #ffffff;
  --surface-2: #f4f7f9;
  --seg-bg: #eae9f5;
  --text: #141414;
  --text-2: #51564e;
  --accent-text: #3e642d;
  --on-primary: #63364f;
  --primary-1: #f9d9e9;
  --primary-2: #fce6f1;
  --add-fg: #365b38; --add-bg: #e9f0d5;
  --refund-fg: #535187; --refund-bg: #eae9f5;
  --init-fg: #535187; --init-bg: #eae9f5;
  --calib-fg: #51564e; --calib-bg: #edf0eb;
  --tag-fg: #63364f; --tag-bg: #fce6f1;
  --chip-fg: #535187; --chip-bg: #eae9f5;
  --live-fg: #365b38; --live-bg: #e9f0d5;
  --warn-fg: #7a4a00; --warn-bg: #fdf2e5;
  --muted-fg: #51564e; --muted-bg: #edf0eb;
  --danger-fg: #a32d43; --danger-bg: #fce6ed;
  --danger-btn-fg: #ffffff; --danger-btn-bg: #a32d43;
  --toast-fg: #ffffff; --toast-bg: #243222;
  --toast-action-fg: #e9f0c4;
}
body::before { background: #f0f0f0; }
.btn-primary { box-shadow: 0 4px 14px rgba(180, 100, 140, .12); }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px rgba(180, 100, 140, .16); }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%233e642d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.product-info { background: linear-gradient(180deg, #fcfdfd, #e2ebef); }
.stat-card { border: 1px solid rgba(255,255,255,.92); }
.stat-card:nth-child(1) { background: linear-gradient(135deg, #fff4cf, #ffedb3); }
.stat-card:nth-child(2) { background: linear-gradient(135deg, #f9d9e9, #fce6f1); }
.stat-card:nth-child(3) { background: linear-gradient(180deg, #fdf2e5, #f7efe6); }
.stat-card:nth-child(4) { background: linear-gradient(103deg, #eae9f5, #cfcdea); }
.stat-card p.cut { color: #63364f; }
.sheet-backdrop { background: rgba(36, 50, 33, .4); }

/* Blush controls; status and sales colours keep their original meanings. */
.btn, .order-btn, .tab { color: #63364f; }
.btn, .order-btn { background: #fff0f6; border-color: #f3d4e3; }
.btn-primary, .order-btn.active, .tab.active { background: linear-gradient(135deg, var(--primary-1), var(--primary-2)); color: var(--on-primary); border-color: transparent; }

/* Companion pages share the dashboard palette. */
.page-login .login-card { background: #ffffff; }
.page-login .pw-toggle, .page-admin .back-link { color: #63364f; }
.page-admin #section-products > .card:first-child { background: #fff4cf; }
.page-admin #section-products > .card:nth-child(2) { background: #fff3f8; }
.page-admin #section-users > .card:first-child { background: #f2effb; }
.page-login { background: #fff0f6; }
body.page-login::before { background: #fff0f6; }

.page-login .a2hs-btn { background: #fff4cf; border-color: #f2e3b5; color: #63502d; }
@media (hover: hover) { .page-login .a2hs-btn:hover { background: #ffedb3; } }
/* SALES_TRACKER_PASTEL_UI_END */
