/**
 * 喝酒处罚系统 - 公共样式 common.css
 * 设计系统：Oxblood & Ink · 家庭酒账本
 *   主色 酒红 #722030（替代默认蓝），背景 暖纸 #f5f0e8（账本纸），
 *   金额 古金 #a8843a，墨色 #1a1410，签章 印章风格状态戳。
 *   字体：思源黑/PingFang 重磅显示 + 等宽数字（账本感）。
 *   规避 AI 默认：非 terracotta（用 oxblood）、非 cream+serif（用纸色+重磅黑体）、
 *   非 broadsheet（保留圆角卡片）。
 */

/* ============================ CSS Reset ============================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: "PingFang SC", "Noto Sans SC", "Hiragino Sans GB",
    "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(114, 32, 48, 0.045), transparent 70%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(168, 132, 58, 0.04), transparent 70%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

ul, ol { list-style: none; }

/* ============================ 主题变量 ============================ */
:root {
  /* 墨色阶（文字） */
  --ink: #1a1410;              /* 主文字：暖墨黑 */
  --ink-soft: #5c5248;         /* 次文字：暖灰 */
  --ink-faint: #9a8f80;        /* 弱文字：浅灰棕 */

  /* 纸色阶（背景） */
  --paper: #f5f0e8;            /* 主背景：账本纸 */
  --paper-soft: #fbf7ef;       /* 卡片底：浅纸 */
  --paper-warm: #f0e9dc;       /* 表头/分区：暖纸 */
  --rule: #d4c5a9;             /* 纸纹分隔线 */
  --rule-soft: #e6dcc8;        /* 浅分隔线 */

  /* 酒红品牌色阶（主色，替代蓝） */
  --wine: #722030;             /* 主色：深酒红 oxblood */
  --wine-deep: #4a1320;        /* 悬停加深 */
  --wine-soft: #f0dde2;        /* 浅酒红底 */
  --wine-ink: #5a1828;         /* 酒红文字 */

  /* 古金色阶（金额/重点） */
  --gold: #a8843a;             /* 古金：罚款金额 */
  --gold-deep: #8a6a28;        /* 加深金 */
  --gold-soft: #f5ecd7;        /* 浅金底 */

  /* 语义色（保留红/绿/琥珀，但与酒红调和） */
  --danger: #b8312a;           /* 危险：朱砂红（与酒红区分） */
  --danger-deep: #8f211c;
  --danger-soft: #f9e3e1;
  --success: #4a6b3a;          /* 成功：墨绿（账本绿） */
  --success-deep: #385029;
  --success-soft: #e6eedf;
  --warn: #9a6b1f;             /* 警告：琥珀棕 */
  --warn-soft: #f3e8d0;
  --info: #6b7280;             /* 中性灰 */

  /* 圆角 */
  --radius-sm: 4px;            /* 偏小，账本感 */
  --radius-md: 8px;
  --radius-lg: 14px;

  /* 阴影：克制，偏暖 */
  --shadow-sm: 0 1px 2px rgba(26, 20, 16, 0.06), 0 1px 1px rgba(26, 20, 16, 0.04);
  --shadow-md: 0 4px 14px rgba(74, 19, 32, 0.08), 0 1px 3px rgba(26, 20, 16, 0.05);
  --shadow-lg: 0 18px 40px rgba(74, 19, 32, 0.16), 0 4px 8px rgba(26, 20, 16, 0.06);

  /* 间距 */
  --space: 16px;

  /* 字体角色 */
  --font-mono: "SF Mono", "Roboto Mono", "JetBrains Mono", ui-monospace,
    "Cascadia Mono", Menlo, Consolas, monospace;

  /* 向后兼容别名（旧页面内联样式可能引用 --color-* 变量） */
  --color-primary: var(--wine);
  --color-primary-dark: var(--wine-deep);
  --color-primary-light: var(--wine-soft);
  --color-danger: var(--danger);
  --color-danger-dark: var(--danger-deep);
  --color-success: var(--success);
  --color-success-dark: var(--success-deep);
  --color-ghost: var(--ink-soft);
  --color-bg: var(--paper);
  --color-card: var(--paper-soft);
  --color-border: var(--rule);
  --color-text: var(--ink);
  --color-text-light: var(--ink-soft);
  --color-text-lighter: var(--ink-faint);
}

/* ============================ 响应式容器 ============================ */
.container {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 24px 18px 48px;
}

@media (max-width: 480px) {
  body { font-size: 14px; }
  .container { padding: 16px 12px 40px; }
}

/* ============================ 卡片 ============================ */
.card {
  background: var(--paper-soft);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 22px 20px;
  margin-bottom: 16px;
  position: relative;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--ink);
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 标题左侧的酒红色短线（账本栏目感） */
.card-title::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 14px;
  background: var(--wine);
  border-radius: 1px;
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 18px;
  color: var(--ink);
  letter-spacing: 0.5px;
  line-height: 1.3;
}

/* ============================ 按钮 ============================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.05s ease,
    border-color 0.18s ease;
  white-space: nowrap;
  user-select: none;
  min-height: 40px;
  line-height: 1.2;
  letter-spacing: 0.3px;
  border: 1px solid transparent;
}

.btn:active { transform: translateY(1px); }

.btn.primary {
  background: var(--wine);
  color: #fbf7ef;
  box-shadow: 0 1px 2px rgba(74, 19, 32, 0.2);
}
.btn.primary:hover {
  background: var(--wine-deep);
  box-shadow: 0 3px 8px rgba(74, 19, 32, 0.28);
}

.btn.danger {
  background: var(--danger);
  color: #fbf7ef;
  box-shadow: 0 1px 2px rgba(143, 33, 28, 0.2);
}
.btn.danger:hover {
  background: var(--danger-deep);
  box-shadow: 0 3px 8px rgba(143, 33, 28, 0.28);
}

.btn.success {
  background: var(--success);
  color: #fbf7ef;
}
.btn.success:hover { background: var(--success-deep); }

.btn.ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--rule);
}
.btn.ghost:hover {
  background: var(--paper-warm);
  color: var(--ink);
  border-color: var(--ink-faint);
}

.btn.block { width: 100%; }
.btn.sm { padding: 6px 12px; min-height: 32px; font-size: 13px; }
.btn.lg { padding: 14px 26px; min-height: 50px; font-size: 15px; letter-spacing: 1px; }

.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}

/* ============================ 表单 ============================ */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
  letter-spacing: 0.3px;
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: #fff;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  min-height: 42px;
  color: var(--ink);
}

.form-textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.6;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--wine);
  box-shadow: 0 0 0 3px rgba(114, 32, 48, 0.12);
}

.form-input:disabled,
.form-textarea:disabled,
.form-select:disabled {
  background: var(--paper-warm);
  color: var(--ink-faint);
  cursor: not-allowed;
}

.form-hint {
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 6px;
}

.form-error {
  font-size: 13px;
  color: var(--danger);
  margin-top: 6px;
}

.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.form-row > .form-group { flex: 1; min-width: 140px; }

/* ============================ 表格（账本横线样式） ============================ */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper-soft);
  font-size: 14px;
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
}

table.table th,
table.table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--rule-soft);
  white-space: nowrap;
}

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

table.table th {
  background: var(--paper-warm);
  font-weight: 700;
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.8px;
  text-transform: none;
  position: sticky;
  top: 0;
}

table.table tbody tr:hover { background: var(--wine-soft); }
table.table td.wrap { white-space: normal; word-break: break-word; }
table.table td.num,
table.table th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ============================ 状态标签（印章风格 · 签名元素） ============================ */
/* 设计意图：把状态做成"盖在账本上的小印章"——方形红边、略带旋转、
   双层边框模拟印泥渗透感。这是本系统区别于通用 SaaS 的视觉记忆点。 */
.status-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 1.5px;
  transform: rotate(-2deg);
  background: rgba(255, 253, 250, 0.7);
  box-shadow: inset 0 0 0 1px currentColor, 0 1px 1px rgba(26, 20, 16, 0.04);
  white-space: nowrap;
}

.status-pending {
  color: var(--warn);
}
.status-appealing {
  color: var(--wine);
}
.status-paid {
  color: var(--success);
}
.status-rejected {
  color: var(--danger);
}
.status-appeal-approved {
  color: var(--gold-deep);
}

/* ============================ Tab 切换 ============================ */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--rule);
  margin-bottom: 18px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-item {
  padding: 10px 16px;
  font-size: 14px;
  color: var(--ink-soft);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.18s ease, border-color 0.18s ease;
  background: none;
  margin-bottom: -2px;
  font-weight: 500;
}

.tab-item:hover { color: var(--wine); }
.tab-item.active {
  color: var(--wine);
  border-bottom-color: var(--wine);
  font-weight: 700;
}

/* ============================ 模态框 ============================ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(26, 20, 16, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.22s ease;
  padding: 16px;
}

.modal-mask.modal-show { opacity: 1; }

.modal-box {
  background: var(--paper-soft);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  padding: 26px 24px;
  transform: translateY(14px) scale(0.98);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-mask.modal-show .modal-box { transform: translateY(0) scale(1); }

.modal-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 14px;
  color: var(--ink);
  letter-spacing: 0.5px;
}

.modal-body {
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 22px;
  word-break: break-word;
  line-height: 1.7;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ============================ Toast ============================ */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: 100%;
  max-width: 90vw;
}

.toast {
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: #fbf7ef;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.28s ease, transform 0.28s ease;
  max-width: 100%;
  word-break: break-word;
  letter-spacing: 0.3px;
}

.toast.toast-show { opacity: 1; transform: translateY(0); }
.toast.toast-hide { opacity: 0; transform: translateY(-12px); }

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--ink); }

/* ============================ 空状态 ============================ */
.empty-state {
  text-align: center;
  padding: 56px 20px;
  color: var(--ink-faint);
}

.empty-state .empty-icon {
  font-size: 44px;
  margin-bottom: 14px;
  display: block;
  opacity: 0.7;
}

.empty-state .empty-text {
  font-size: 14px;
  letter-spacing: 0.3px;
}

/* ============================ 导航栏 ============================ */
#navbar { position: relative; z-index: 50; }

.navbar {
  background: var(--paper-soft);
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 1px 0 rgba(114, 32, 48, 0.04);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.navbar-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 54px;
}

.navbar-logo {
  font-size: 16px;
  font-weight: 800;
  color: var(--wine);
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* logo 前的酒红色小方块（印章感） */
.navbar-logo::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--wine);
  border-radius: 1px;
  box-shadow: inset 0 0 0 1px var(--wine-deep);
}

.navbar-links {
  display: flex;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.navbar-links::-webkit-scrollbar { display: none; }

.navbar-item {
  padding: 8px 14px;
  font-size: 14px;
  color: var(--ink-soft);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: color 0.18s ease, background 0.18s ease;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  font-weight: 500;
}

.navbar-item:hover { color: var(--wine); background: var(--wine-soft); }
.navbar-item.active {
  color: var(--wine);
  font-weight: 700;
  background: var(--wine-soft);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.navbar-user {
  font-size: 13px;
  color: var(--ink-soft);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.navbar-logout {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  background: transparent;
  transition: background 0.18s ease, color 0.18s ease;
  min-height: 32px;
}
.navbar-logout:hover { background: var(--danger); color: #fbf7ef; }

@media (max-width: 480px) {
  .navbar-user { display: none; }
  .navbar-inner { padding: 0 10px; gap: 8px; }
  .navbar-item { padding: 8px 10px; }
}

/* ============================ 通用辅助 ============================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--ink-soft); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-primary { color: var(--wine); }
.text-gold { color: var(--gold); }
.font-bold { font-weight: 700; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.hidden { display: none !important; }

/* 大额金额展示：古金色 + 等宽 + 重磅（账本金额感） */
.amount-large {
  font-size: 38px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: -0.5px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

/* 统计卡片网格 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.stat-card {
  background: var(--paper-soft);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 20px 16px;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 8px;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.stat-card .stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
  line-height: 1.15;
}

/* 统计卡金额/警告色（向后兼容旧页面 .amount/.warn 类） */
.stat-card .stat-value.amount,
.stat-card .stat-value.amber { color: var(--gold); }
.stat-card .stat-value.warn { color: var(--wine); }

/* 底部固定操作栏（收银台等多选场景） */
.action-bar {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--paper-soft);
  border-top: 1px solid var(--rule);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 -3px 12px rgba(74, 19, 32, 0.08);
  z-index: 40;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ============================ 登录页（hero） ============================ */
/* 设计意图：深酒红满屏作为"酒"的隐喻，纸色卡片浮于其上，
   巨大的半透明"酒"字水印作为印章式视觉锚点。 */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(ellipse 70% 50% at 50% 30%, rgba(168, 132, 58, 0.12), transparent 70%),
    linear-gradient(135deg, #722030 0%, #4a1320 100%);
  position: relative;
  overflow: hidden;
}

/* 背景巨大"酒"字水印（印章锚点） */
.auth-wrap::before {
  content: "酒";
  position: absolute;
  font-size: 60vmin;
  font-weight: 900;
  color: rgba(251, 247, 239, 0.06);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-8deg);
  font-family: "PingFang SC", "Noto Sans SC", "STSong", serif;
  pointer-events: none;
  user-select: none;
  line-height: 1;
}

.auth-card {
  background: var(--paper-soft);
  border: 1px solid rgba(212, 197, 154, 0.4);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 60px rgba(26, 20, 16, 0.35), 0 8px 20px rgba(26, 20, 16, 0.2);
  padding: 36px 30px 30px;
  width: 100%;
  max-width: 380px;
  position: relative;
  z-index: 1;
}

.auth-logo {
  text-align: center;
  font-size: 38px;
  margin-bottom: 10px;
}

.auth-title {
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 6px;
  letter-spacing: 2px;
}

.auth-subtitle {
  text-align: center;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 26px;
  letter-spacing: 1.5px;
}

/* 标题下的酒红短线分隔 */
.auth-subtitle::after {
  content: "";
  display: block;
  width: 32px;
  height: 2px;
  background: var(--wine);
  margin: 14px auto 0;
  border-radius: 1px;
}

.auth-hint {
  margin-top: 20px;
  padding: 11px 14px;
  background: var(--gold-soft);
  border: 1px solid rgba(168, 132, 58, 0.25);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--gold-deep);
  text-align: center;
  line-height: 1.7;
  letter-spacing: 0.3px;
}

.auth-error {
  margin-bottom: 16px;
  padding: 11px 14px;
  background: var(--danger-soft);
  border: 1px solid rgba(184, 49, 42, 0.25);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--danger-deep);
  text-align: center;
  letter-spacing: 0.3px;
}

/* ============================ 可访问性 ============================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .status-tag { transform: rotate(-2deg); }
}

/* 键盘聚焦可见 */
.btn:focus-visible,
.form-input:focus-visible,
.form-textarea:focus-visible,
.form-select:focus-visible,
.tab-item:focus-visible,
.navbar-item:focus-visible,
.navbar-logout:focus-visible {
  outline: 2px solid var(--wine);
  outline-offset: 2px;
}
