/* ==========================================================================
   手账店铺管理系统 · 全局样式
   韩系简约手账风格：奶油底色 / 低饱和主色 / 极细边框 / 6-8-12 三档圆角
   所有颜色通过 CSS Custom Properties 控制，支持深浅色与主色自定义
   ========================================================================== */

/* ---------- 1. 设计变量 ---------- */
:root {
  /* 中性色（浅色模式） */
  --bg-primary: #faf7f2;
  --bg-sidebar: #f5f0e8;
  --bg-card: #ffffff;
  --bg-subtle: #f7f3ec;
  --text-primary: #2d2a26;
  --text-secondary: #8c857d;
  --border-color: #e8e0d8;
  --dot-color: #e8e0d8;
  --shadow-1: 0 1px 2px rgba(45, 42, 38, 0.04);
  --shadow-2: 0 4px 14px rgba(45, 42, 38, 0.08);

  /* 主题色（可由用户自定义，JS 覆盖） */
  --primary: #7c9a92;
  --primary-hover: #68847d;
  --primary-soft: rgba(124, 154, 146, 0.1);
  --primary-border: rgba(124, 154, 146, 0.3);
  --primary-text: #ffffff;

  /* 语义色 */
  --success: #6b9e78;
  --warning: #c47f5a;
  --danger: #b56f5c;
  --accent-pink: #d4a5a5;
  --accent-apricot: #e8c4a0;
  --accent-blue: #9bb0c1;

  /* 圆角三档 */
  --r-s: 6px;
  --r-m: 8px;
  --r-l: 12px;

  /* 字体 */
  --font-sans: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", "Noto Sans KR", "Nanum Gothic", Arial,
    "PingFang SC", "Microsoft YaHei", sans-serif;

  --sidebar-w: 240px;
  --ease: 0.2s ease;
}

[data-theme="dark"] {
  --bg-primary: #1a1714;
  --bg-sidebar: #201c18;
  --bg-card: #24201c;
  --bg-subtle: #2a251f;
  --text-primary: #f0ece6;
  --text-secondary: #b0a89e;
  --border-color: #3a342e;
  --dot-color: #302a24;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-2: 0 4px 14px rgba(0, 0, 0, 0.45);
}

/* ---------- 2. 基础重置 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 20px;
  font-weight: 400;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  background-image: radial-gradient(circle, var(--dot-color) 1px, transparent 1px);
  background-size: 16px 16px;
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.h1 {
  font-size: 26px;
  line-height: 32px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.h2 {
  font-size: 18px;
  line-height: 24px;
  font-weight: 600;
}

.body {
  font-size: 14px;
  line-height: 20px;
}

.caption {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-secondary);
}

.sub-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin: 6px 0 2px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-color);
}

.muted {
  color: var(--text-secondary);
}

.mono {
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

svg.ico {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

svg.ico-sm {
  width: 14px;
  height: 14px;
}

svg.ico-lg {
  width: 22px;
  height: 22px;
}

/* ---------- 3. 顶部细进度条 ---------- */
#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--primary);
  z-index: 900;
  opacity: 0;
  transition: width 0.25s ease, opacity 0.3s ease;
}

#progress-bar.active {
  opacity: 1;
}

/* ---------- 4. 布局骨架 ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border: 1px solid var(--primary-border);
  border-radius: 12px 6px 12px 6px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
}

.brand-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.brand-sub {
  font-size: 11px;
  line-height: 14px;
  color: var(--text-secondary);
}

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

.nav-label {
  font-size: 11px;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  padding: 0 8px 4px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-m);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
  width: 100%;
}

.nav-item:hover {
  background: var(--bg-card);
  border-color: var(--border-color);
}

.nav-item:active {
  transform: scale(0.99);
}

.nav-item.active {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary);
  font-weight: 600;
}

.nav-item .badge {
  margin-left: auto;
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px dashed var(--border-color);
  padding-top: 16px;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--r-m);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex: none;
  letter-spacing: 0.5px;
}

.avatar-sm {
  width: 24px;
  height: 24px;
  font-size: 11px;
  border-radius: var(--r-s);
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.link-btn {
  background: none;
  border: none;
  padding: 2px 0;
  font: inherit;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 1px dashed transparent;
  transition: color var(--ease), border-color var(--ease);
}

.link-btn:hover {
  color: var(--primary);
  border-bottom-color: var(--primary-border);
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border-color);
  background: color-mix(in srgb, var(--bg-primary) 88%, transparent);
  position: sticky;
  top: 0;
  z-index: 60;
  backdrop-filter: saturate(1.05);
}

.topbar-title {
  min-width: 0;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.page {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex: 1;
}

.mobile-nav {
  display: none;
}

/* ---------- 5. 卡片与网格 ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--r-l);
  padding: 20px;
  box-shadow: var(--shadow-1);
}

.card-dashed {
  border-style: dashed;
  background: transparent;
  box-shadow: none;
}

.callout {
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
  border-radius: var(--r-s);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
}

.card-note {
  border-radius: 12px 6px 12px 6px;
}

.card-hover {
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
}

.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.card-head .h2 {
  min-width: 0;
}

.card-head-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.grid {
  display: grid;
  gap: 20px;
}

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

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

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

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

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

.row-tight {
  gap: 8px;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.spacer {
  flex: 1;
}

.stat-value {
  font-size: 26px;
  line-height: 32px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-secondary);
}

/* 空状态 */
.empty {
  border: 1px dashed var(--border-color);
  border-radius: var(--r-l);
  padding: 36px 20px;
  text-align: center;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* ---------- 6. 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 8px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--r-m);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease), color var(--ease),
    transform var(--ease), box-shadow var(--ease);
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--primary-border);
  color: var(--primary);
}

.btn:active {
  transform: scale(0.98);
}

.btn:focus-visible {
  outline: 2px solid var(--primary-border);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-text);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: var(--primary-text);
}

.btn-soft {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary);
}

.btn-ghost {
  background: transparent;
}

.btn-danger:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}

.btn-sm {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 13px;
  border-radius: var(--r-s);
}

.btn-icon {
  width: 36px;
  min-height: 36px;
  padding: 0;
}

.btn-icon.btn-sm {
  width: 30px;
  min-height: 30px;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--bg-subtle);
  border-color: var(--border-color);
  color: var(--text-secondary);
  transform: none;
}

.btn-block {
  width: 100%;
}

/* 分段控件（视图切换） */
.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  border-radius: var(--r-m);
}

.segmented button {
  border: none;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: var(--r-s);
  cursor: pointer;
  transition: background var(--ease), color var(--ease);
  min-height: 28px;
}

.segmented button:hover {
  color: var(--primary);
}

.segmented button.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-1);
  font-weight: 600;
}

/* ---------- 7. 表单 ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > label,
.field-label {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-secondary);
  font-weight: 500;
}

.input,
.select,
.textarea {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--r-m);
  padding: 9px 11px;
  min-height: 38px;
  transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
}

.textarea {
  min-height: 84px;
  resize: vertical;
  line-height: 20px;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--primary-border);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%),
    linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%);
  background-position: calc(100% - 16px) 17px, calc(100% - 11px) 17px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

.hint {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-secondary);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  user-select: none;
}

.check input {
  appearance: none;
  width: 17px;
  height: 17px;
  border: 1px solid var(--border-color);
  border-radius: var(--r-s);
  background: var(--bg-card);
  cursor: pointer;
  position: relative;
  transition: background var(--ease), border-color var(--ease);
  flex: none;
}

.check input:hover {
  border-color: var(--primary);
}

.check input:checked {
  background: var(--primary);
  border-color: var(--primary);
}

.check input:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 6px;
  height: 10px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(42deg);
}

.color-input {
  width: 44px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--border-color);
  border-radius: var(--r-s);
  background: var(--bg-card);
  cursor: pointer;
}

/* ---------- 8. 徽章 / 标签 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  line-height: 16px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  white-space: nowrap;
}

.badge-primary {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary);
}

.badge-success {
  background: color-mix(in srgb, var(--success) 12%, transparent);
  border-color: color-mix(in srgb, var(--success) 35%, transparent);
  color: var(--success);
}

.badge-warn {
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  border-color: color-mix(in srgb, var(--warning) 35%, transparent);
  color: var(--warning);
}

.badge-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ---------- 9. 表格 ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--r-l);
  background: var(--bg-card);
}

table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 720px;
}

table.tbl th,
table.tbl td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

table.tbl th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  white-space: nowrap;
}

table.tbl tbody tr:last-child td {
  border-bottom: none;
}

table.tbl tbody tr {
  transition: background var(--ease);
}

table.tbl tbody tr:hover {
  background: var(--bg-subtle);
}

.cell-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* ---------- 10. 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(45, 42, 38, 0.32);
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  animation: fade-in 0.18s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-2);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  animation: rise 0.2s ease;
}

.modal-lg {
  max-width: 760px;
}

.modal-xl {
  max-width: 980px;
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 0;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-foot {
  padding: 0 20px 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ---------- 11. Toast ---------- */
#toast-wrap {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 950;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 2px solid var(--primary);
  border-radius: var(--r-m);
  box-shadow: var(--shadow-2);
  padding: 10px 14px;
  font-size: 13px;
  max-width: 320px;
  animation: toast-in 0.22s ease;
}

.toast.out {
  animation: toast-out 0.3s ease forwards;
}

.toast.success {
  border-left-color: var(--success);
  color: var(--text-primary);
}

.toast.warn {
  border-left-color: var(--warning);
}

.toast.error {
  border-left-color: var(--danger);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(12px);
  }
}

/* ---------- 12. 提醒横幅 ---------- */
#banner-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 28px;
}

#banner-wrap:not(:empty) {
  padding-top: 16px;
}

.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px dashed color-mix(in srgb, var(--warning) 45%, transparent);
  background: color-mix(in srgb, var(--warning) 9%, transparent);
  color: var(--text-primary);
  border-radius: var(--r-m);
  padding: 12px 14px;
  font-size: 14px;
}

.banner .btn {
  margin-left: auto;
}

/* ---------- 13. 登录 / 配置页 ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-2);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
}

.auth-deco {
  position: absolute;
  right: -18px;
  top: -18px;
  width: 88px;
  height: 88px;
  border: 1px solid var(--primary-border);
  border-radius: 50%;
  opacity: 0.35;
  pointer-events: none;
}

.auth-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ---------- 14. 日历 ---------- */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--border-color);
  border-radius: var(--r-l);
  overflow: hidden;
  background: var(--bg-card);
}

.cal-dow {
  padding: 10px 8px;
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-color);
}

.cal-cell {
  min-height: 100px;
  border-right: 1px dashed var(--border-color);
  border-bottom: 1px dashed var(--border-color);
  background: var(--bg-card);
  padding: 7px 8px 8px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 0;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: background var(--ease);
  overflow: hidden;
}

.cal-cell:hover {
  background: var(--bg-subtle);
}

.cal-cell:nth-child(7n) {
  border-right: none;
}

.cal-cell.dim {
  color: var(--text-secondary);
  background: color-mix(in srgb, var(--bg-subtle) 60%, transparent);
}

.cal-cell.today .cal-daynum {
  color: var(--primary);
  font-weight: 700;
  background: transparent;
}

.cal-daynum {
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  display: inline-block;
  line-height: 1;
}

/* 日期行：数字 + 今天小圆点（苹果风） */
.cal-date-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
  position: relative;
  z-index: 3;
  background: var(--bg-card);
  padding-bottom: 3px;
}
.cal-today-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--primary);
  display: block;
  margin: 3px 0 0 2px;
}

/* 跨天事件轨道（固定高度，多天连贯） */
.cal-track {
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
  margin: 0 -8px;
  z-index: 2;
  overflow: hidden;
}
.cal-seg {
  position: absolute;
  left: 0;
  right: 0;
  top: 2px;
  height: 17px;
  line-height: 17px;
  font-size: 11px;
  padding: 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 0;
}
.cal-seg.first {
  border-top-left-radius: 9px;
  border-bottom-left-radius: 9px;
  left: 0;
  padding-left: 8px;
}
.cal-seg.last {
  border-top-right-radius: 9px;
  border-bottom-right-radius: 9px;
  right: 0;
  padding-right: 8px;
  text-align: right;
}
.cal-seg.first.last {
  border-radius: 9px;
  text-align: left;
  padding: 0 8px;
}
.cal-seg.market {
  background: color-mix(in srgb, var(--accent-apricot) 60%, #fff);
  color: #8a5a30;
}
.cal-seg.launch {
  background: var(--primary-soft);
  color: var(--primary);
}
.cal-seg.todo {
  background: color-mix(in srgb, var(--accent-blue) 30%, #fff);
  color: #5a7184;
}

/* 其它事件 */
.cal-evs {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 2px;
  position: relative;
  z-index: 1;
}

.cal-chip {
  font-size: 11px;
  line-height: 14px;
  padding: 3px 6px;
  border-radius: var(--r-s);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-chip.market {
  background: color-mix(in srgb, var(--accent-apricot) 22%, transparent);
  border-color: color-mix(in srgb, var(--accent-apricot) 55%, transparent);
}

.cal-chip.launch {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary);
}

.cal-chip.todo {
  background: color-mix(in srgb, var(--accent-blue) 20%, transparent);
  border-color: color-mix(in srgb, var(--accent-blue) 55%, transparent);
}

/* ---------- 15. 看板（博主） ---------- */
.kanban {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.blogger-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.status-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px dashed var(--border-color);
  border-bottom: 1px dashed var(--border-color);
  padding: 12px 0;
}

.addr-box {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--r-m);
  padding: 10px;
  font-size: 13px;
  line-height: 18px;
}

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

.thumb {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: var(--r-m);
  border: 1px solid var(--border-color);
  overflow: hidden;
  background: var(--bg-subtle);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb .tag {
  position: absolute;
  left: 0;
  bottom: 0;
  right: 0;
  font-size: 10px;
  line-height: 14px;
  text-align: center;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
}

.meta-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: auto;
}

/* ---------- 16. AI 助手悬浮窗 ---------- */
.fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 48px;
  height: 48px;
  border-radius: 14px 8px 14px 8px;
  background: var(--primary);
  color: var(--primary-text);
  border: 1px solid var(--primary);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow-2);
  z-index: 700;
  transition: transform var(--ease), background var(--ease);
}

.fab:hover {
  background: var(--primary-hover);
}

.fab:active {
  transform: scale(0.96);
}

.chat-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 40px);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-2);
  z-index: 750;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: var(--r-m);
  font-size: 13px;
  line-height: 19px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  word-break: break-word;
}

.msg.user {
  align-self: flex-end;
  background: var(--primary-soft);
  border-color: var(--primary-border);
}

.msg p {
  margin: 0 0 8px;
}

.msg p:last-child {
  margin-bottom: 0;
}

.msg pre {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--r-s);
  padding: 8px;
  overflow-x: auto;
  font-size: 12px;
}

.msg ul,
.msg ol {
  margin: 0 0 8px;
  padding-left: 18px;
}

.chat-foot {
  border-top: 1px solid var(--border-color);
  padding: 10px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-foot .textarea {
  min-height: 38px;
  max-height: 96px;
  padding: 9px 11px;
}

.typing {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}

.typing i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-secondary);
  animation: blink 1.2s infinite ease-in-out;
}

.typing i:nth-child(2) {
  animation-delay: 0.2s;
}

.typing i:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0%,
  100% {
    opacity: 0.25;
  }
  50% {
    opacity: 1;
  }
}

/* ---------- 17. 语音草稿箱 ---------- */
.draft-panel {
  position: fixed;
  right: 20px;
  bottom: 84px;
  width: 340px;
  max-width: calc(100vw - 32px);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-2);
  padding: 16px;
  z-index: 720;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse 1.4s infinite ease-in-out;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

/* ---------- 18. 骨架屏 ---------- */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-subtle) 25%,
    color-mix(in srgb, var(--bg-subtle) 60%, var(--border-color)) 50%,
    var(--bg-subtle) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--r-s);
  height: 14px;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ---------- 19. 杂项 ---------- */
.divider {
  height: 1px;
  background: var(--border-color);
  border: none;
  margin: 0;
}

.divider-dashed {
  border-top: 1px dashed var(--border-color);
  height: 0;
  background: none;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-input-row {
  display: grid;
  grid-template-columns: 1fr 110px 36px;
  gap: 8px;
  align-items: center;
}

.price-box {
  border: 1px dashed var(--primary-border);
  background: var(--primary-soft);
  border-radius: var(--r-m);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kv {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
}

.kv .k {
  color: var(--text-secondary);
  font-size: 12px;
  min-width: 84px;
}

.kv .v {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.scroll-x {
  overflow-x: auto;
}

.text-clip {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-box {
  border: 1px solid var(--border-color);
  border-radius: var(--r-m);
  background: var(--bg-subtle);
  padding: 12px;
  max-height: 320px;
  overflow: auto;
  font-size: 13px;
  line-height: 19px;
  white-space: pre-wrap;
}

/* ---------- 20. 响应式 ---------- */
@media (max-width: 1023px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    display: none;
  }

  .mobile-nav {
    display: block;
    position: sticky;
    top: 0;
    z-index: 70;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
  }

  .mnav-top {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
  }

  .mnav-scroll {
    display: flex;
    gap: 6px;
    padding: 0 16px 10px;
    overflow-x: auto;
  }

  .mnav-scroll .nav-item {
    width: auto;
    white-space: nowrap;
    padding: 8px 12px;
    min-height: 40px;
  }

  .topbar {
    padding: 16px 20px;
  }

  .page {
    padding: 20px;
  }

  #banner-wrap {
    padding: 0 20px;
  }

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

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

@media (max-width: 767px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: minmax(0, 1fr);
  }

  .page {
    padding: 16px;
    gap: 20px;
  }

  #banner-wrap {
    padding: 0 16px;
  }

  .card {
    padding: 16px;
  }

  .h1 {
    font-size: 22px;
    line-height: 28px;
  }

  .btn {
    min-height: 44px;
    padding: 10px 16px;
  }

  .btn-sm {
    min-height: 40px;
  }

  .btn-icon {
    width: 44px;
  }

  .btn-icon.btn-sm {
    width: 40px;
    min-height: 40px;
  }

  .nav-item {
    min-height: 44px;
  }

  .segmented button {
    min-height: 38px;
    padding: 8px 14px;
  }

  .input,
  .select,
  .textarea {
    min-height: 44px;
    font-size: 15px;
  }

  .cal-cell {
    min-height: 62px;
    padding: 5px;
  }

  .cal-chip {
    display: none;
  }

  .cal-cell .dot-row {
    display: flex;
    gap: 3px;
  }

  .modal-foot .btn {
    flex: 1;
  }

  .chat-panel {
    right: 8px;
    left: 8px;
    bottom: 8px;
    width: auto;
    height: calc(100vh - 80px);
  }

  .draft-panel {
    right: 8px;
    left: 8px;
    width: auto;
    bottom: 78px;
  }

  .tag-input-row {
    grid-template-columns: 1fr 90px 44px;
  }
}

@media (min-width: 768px) {
  .cal-cell .dot-row {
    display: none;
  }
}

@media print {
  .sidebar,
  .topbar,
  .mobile-nav,
  .fab,
  .chat-panel,
  .draft-panel,
  #toast-wrap,
  #banner-wrap {
    display: none !important;
  }

  body {
    background: #fff;
  }
}

/* ---------- 21. 日历：周视图 / 年视图 / 集市统计 ---------- */
.cal-week-grid .cal-week-cell {
  min-height: 150px;
}
.cal-income {
  font-size: 11px;
  line-height: 14px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.mini-month {
  border: 1px solid var(--border-color);
  border-radius: var(--r-l);
  background: var(--bg-card);
  padding: 10px;
}
.mini-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}
.mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.mini-dow {
  margin-bottom: 4px;
}
.mini-dow span {
  font-size: 10px;
  text-align: center;
  color: var(--text-secondary);
}
.mini-cell {
  aspect-ratio: 1 / 1;
  border: none;
  background: transparent;
  border-radius: var(--r-s);
  font: inherit;
  font-size: 11px;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  padding: 0;
}
.mini-cell:hover {
  background: var(--bg-subtle);
}
.mini-cell.empty {
  cursor: default;
}
.mini-cell.today {
  background: transparent;
  color: var(--primary);
  font-weight: 700;
}
.mini-cell.today .mini-num {
  color: var(--primary);
}
.mini-today-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--primary);
  display: block;
  margin-top: 1px;
}
.mini-num {
  font-variant-numeric: tabular-nums;
}
.mini-cell.has {
  background: var(--bg-subtle);
  font-weight: 600;
}
.mini-dots {
  display: flex;
  gap: 2px;
}
.mini-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  display: inline-block;
}
.stat-cards .stat-card {
  padding: 16px;
}
.stat-value.pos {
  color: var(--accent-apricot);
}
.stat-value.neg {
  color: var(--accent-pink);
}
