/* ==========================================================================
   商家后台 · 设计系统「墨与朱」
   --------------------------------------------------------------------------
   方向：这套系统卖的是「经得起查」，所以后台不做互联网 SaaS 那种蓝色仪表盘，
        做成一本干净的账本——纸底、墨字、朱砂印。
   结构：釉青（中式陶瓷的青绿）承担导航与框架
   强调：朱砂只给两样东西——钱，和需要人立刻处理的事
   标题：宋体。系统自带、零加载成本，且管理后台几乎没人这么用，
        它一出现就把这套系统和其他模板区分开了。
   数字：等宽 + tabular-nums，金额右对齐。老板看的是账，不是卡片。
   签名：朱砂方印。合规的本质是留痕，留痕的符号是印章。
   ========================================================================== */

:root {
  --paper:        #F2F3EF;  /* 纸底：微绿灰，刻意避开暖奶油 */
  --paper-raised: #FAFAF8;  /* 卡片面 */
  --paper-sunk:   #EDEEE9;  /* 表头、输入框底 */

  --ink:    #1B211E;        /* 墨：带绿调的近黑，比纯黑柔和 */
  --ink-2:  #4A544E;
  --ink-3:  #8A948D;

  --celadon:   #2F4F44;     /* 釉青：侧栏与框架 */
  --celadon-2: #3D6355;
  --celadon-3: #57806F;

  --cinnabar:   #B93B26;    /* 朱砂：钱 + 主操作 + 印章 */
  --cinnabar-2: #9E2F1D;
  --cinnabar-w: #FBEDE9;    /* 朱砂浅底 */

  --amber:   #C08A2E;       /* 琥珀：待处理、需注意 */
  --amber-w: #FBF3E2;
  --jade:    #2F7D5B;       /* 玉绿：通过、成功 */
  --jade-w:  #E8F4EE;

  --line:      #DEE0D9;
  --line-soft: #EAEBE5;

  --r-sm: 6px;
  --r:    10px;
  --r-lg: 16px;

  --shadow:    0 1px 2px rgba(27,33,30,.04), 0 4px 16px rgba(27,33,30,.05);
  --shadow-up: 0 2px 4px rgba(27,33,30,.06), 0 12px 28px rgba(27,33,30,.09);

  --font-display: "Songti SC", "STSong", "SimSun", "Noto Serif SC", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
               "Liberation Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--celadon-2); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--cinnabar); text-decoration: none; }

::selection { background: var(--cinnabar); color: #fff; }

:focus-visible {
  outline: 2px solid var(--cinnabar);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ============================ 签名元素：朱砂方印 ============================ */
/* 出现在侧栏、登录页、合规体检的通过标记上。
   微旋转是刻意的——盖章不会盖得笔直，这一点点歪才像真的盖上去的。 */
.seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--cinnabar);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  border-radius: 5px;
  transform: rotate(-4deg);
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.28);
  flex-shrink: 0;
  letter-spacing: .02em;
}
.seal-lg { width: 44px; height: 44px; font-size: 22px; border-radius: 7px; }
.seal-md { width: 32px; height: 32px; font-size: 16px; }
.seal-sm { width: 20px; height: 20px; font-size: 11px; border-radius: 4px; }

/* ================================= 布局 ================================= */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 212px;
  flex-shrink: 0;
  background: var(--celadon);
  color: rgba(255,255,255,.72);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .brand {
  padding: 22px 20px 20px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid rgba(255,255,255,.09);
}
.sidebar .brand-text { line-height: 1.25; }
.sidebar .brand-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .04em;
}
.sidebar .brand-sub {
  font-size: 11px;
  color: rgba(255,255,255,.42);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.sidebar nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.sidebar .nav-group {
  font-size: 11px;
  color: rgba(255,255,255,.34);
  letter-spacing: .14em;
  padding: 16px 12px 7px;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin-bottom: 2px;
  color: rgba(255,255,255,.72);
  border-radius: var(--r-sm);
  position: relative;
  transition: background .16s ease, color .16s ease;
}
.sidebar nav a svg { width: 16px; height: 16px; opacity: .72; flex-shrink: 0; }
.sidebar nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar nav a.active { background: rgba(255,255,255,.11); color: #fff; font-weight: 600; }
.sidebar nav a.active svg { opacity: 1; }
/* 选中项的朱砂竖标：像账本里被红笔勾过的那一行 */
.sidebar nav a.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  background: var(--cinnabar);
  border-radius: 0 3px 3px 0;
}
.sidebar nav a .dot {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--cinnabar);
  color: #fff;
  font-size: 11px;
  font-family: var(--font-mono);
  line-height: 18px;
  text-align: center;
}

.sidebar .side-foot {
  padding: 14px 20px 18px;
  border-top: 1px solid rgba(255,255,255,.09);
  font-size: 12px;
  color: rgba(255,255,255,.40);
}
.sidebar .side-foot a { color: rgba(255,255,255,.62); }
.sidebar .side-foot a:hover { color: #fff; }

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

.topbar {
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
}
.topbar .who { color: var(--ink-2); font-size: 13px; }
.topbar .who b { color: var(--ink); font-weight: 600; }

.content { padding: 26px 32px 56px; flex: 1; }

/* 页头：宋体大标题 + 一句话说明。说明写「这页能帮你干什么」，不写功能名复述 */
.page-head { margin-bottom: 22px; }
.page-title {
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--ink);
}
.page-desc { color: var(--ink-3); font-size: 13px; margin-top: 4px; }

/* ================================= 卡片 ================================= */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 17px 19px 19px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  animation: rise .42s cubic-bezier(.2,.7,.3,1) backwards;
}
.card:nth-child(1) { animation-delay: .02s; }
.card:nth-child(2) { animation-delay: .06s; }
.card:nth-child(3) { animation-delay: .10s; }
.card:nth-child(4) { animation-delay: .14s; }
.card:nth-child(5) { animation-delay: .18s; }

.card .label {
  color: var(--ink-3);
  font-size: 12.5px;
  letter-spacing: .04em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.card .value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 27px;
  font-weight: 600;
  margin-top: 9px;
  color: var(--ink);
  letter-spacing: -.02em;
}
.card .value.money { color: var(--cinnabar); }
.card .value .unit { font-size: 14px; color: var(--ink-3); margin-left: 3px; font-weight: 400; }
.card .foot { margin-top: 7px; font-size: 12px; color: var(--ink-3); }

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

/* ================================= 面板 ================================= */
.panel {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 19px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-head h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .02em;
}
.panel-head .sub { font-size: 12px; color: var(--ink-3); font-weight: 400; margin-left: 8px; }
.panel-body { padding: 19px; }
.panel-body.flush { padding: 0; }

/* ================================= 表格 ================================= */
/* 账本感：数字等宽右对齐，行线极细，hover 时左缘出现朱砂标记 */
table.tbl {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper-raised);
  font-size: 13.5px;
}
table.tbl th,
table.tbl td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
table.tbl th {
  background: var(--paper-sunk);
  color: var(--ink-2);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .06em;
  white-space: nowrap;
}
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr { position: relative; transition: background .14s ease; }
table.tbl tbody tr:hover { background: #F5F6F1; }
table.tbl tbody tr:hover td:first-child { box-shadow: inset 2px 0 0 var(--cinnabar); }

table.tbl td.num,
table.tbl th.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
table.tbl td.money {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--cinnabar);
  font-weight: 600;
  white-space: nowrap;
}
table.tbl td.dim { color: var(--ink-3); }
table.tbl td.mono { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-2); }

.table-wrap { overflow-x: auto; }

/* ================================= 按钮 ================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 15px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--paper-raised);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.5;
  transition: transform .12s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
  white-space: nowrap;
}
.btn:hover {
  background: #fff;
  border-color: #CBCEC5;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(27,33,30,.07);
  color: var(--ink);
}
.btn:active { transform: translateY(0); box-shadow: none; }

.btn-primary {
  background: var(--cinnabar);
  border-color: var(--cinnabar);
  color: #fff;
  font-weight: 500;
}
.btn-primary:hover { background: var(--cinnabar-2); border-color: var(--cinnabar-2); color: #fff; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--celadon-2); }
.btn-ghost:hover { background: rgba(47,79,68,.07); border-color: transparent; box-shadow: none; }

.btn-danger { color: var(--cinnabar); border-color: #E9C6BE; background: var(--cinnabar-w); }
.btn-danger:hover { background: #F7DED7; border-color: #DFAFA4; color: var(--cinnabar-2); }

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn[disabled], .btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

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

/* ================================= 徽章 ================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 19px;
  font-weight: 500;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.badge-on  { background: var(--jade-w);  color: var(--jade); }
.badge-off { background: #EEEFEA;        color: var(--ink-3); }
.badge-s0  { background: var(--amber-w); color: var(--amber); }       /* 待支付 */
.badge-s1  { background: #E7EFF6;        color: #2C5C86; }            /* 待制作 */
.badge-s2  { background: #EDE9F6;        color: #5B4A96; }            /* 制作中 */
.badge-s3  { background: var(--jade-w);  color: var(--jade); }        /* 已完成 */
.badge-s4  { background: #EEEFEA;        color: var(--ink-3); }       /* 已取消 */
.badge-s5  { background: var(--cinnabar-w); color: var(--cinnabar); } /* 已退款 */

/* ================================= 表单 ================================= */
.form-row { margin-bottom: 15px; }
.form-row label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: .03em;
}
.form-row .hint { color: var(--ink-3); font-size: 12px; margin-top: 5px; line-height: 1.5; }

input[type=text], input[type=password], input[type=number],
input[type=date], input[type=datetime-local], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--paper-raised);
  color: var(--ink);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--celadon-3);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(47,79,68,.10);
}
textarea { resize: vertical; min-height: 84px; line-height: 1.6; }
input[type=number] { font-family: var(--font-mono); }

.form-inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-inline .form-row { margin-bottom: 0; }
.form-inline input, .form-inline select { width: auto; min-width: 150px; }

/* ================================= 弹层 ================================= */
.modal-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(27,33,30,.42);
  backdrop-filter: blur(2px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-mask.show { display: flex; animation: fade .18s ease; }
.modal {
  background: var(--paper-raised);
  border-radius: var(--r-lg);
  width: 480px;
  max-width: 100%;
  max-height: 88vh;
  overflow: auto;
  box-shadow: var(--shadow-up);
  animation: pop .22s cubic-bezier(.2,.8,.3,1);
}
.modal-head {
  padding: 17px 21px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
}
.modal-body { padding: 21px; }
.modal-foot {
  padding: 14px 21px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop  { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: none; } }

/* ================================= 杂项 ================================= */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.muted { color: var(--ink-3); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.qr-img { width: 118px; height: auto; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }

.empty-state { padding: 56px 20px; text-align: center; color: var(--ink-3); }
.empty-state .es-title { font-family: var(--font-display); font-size: 16px; color: var(--ink-2); margin-bottom: 6px; }
.empty-state .es-tip { font-size: 13px; }

/* 合规体检：本后台唯一允许「抢眼」的地方，因为它是 demo 时最能打动商户的一屏 */
.audit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(258px, 1fr));
  gap: 14px;
}
.audit-group {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--paper-raised);
  overflow: hidden;
}
.audit-group-head {
  padding: 12px 16px;
  background: var(--paper-sunk);
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.audit-group-head .t { font-family: var(--font-display); font-size: 14.5px; font-weight: 700; }
.audit-group-head .c { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }
.audit-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.audit-item:last-child { border-bottom: none; }
.audit-item .txt { flex: 1; line-height: 1.5; }
.audit-item .why { color: var(--ink-3); font-size: 12px; margin-top: 3px; }
.audit-mark {
  width: 19px; height: 19px;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0; margin-top: 1px;
  transform: rotate(-4deg);
  font-family: var(--font-display);
}
.audit-pass { background: var(--cinnabar); color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.28); }
.audit-warn { background: var(--amber-w); color: var(--amber); box-shadow: inset 0 0 0 1.5px var(--amber); }
.audit-fail { background: #EEEFEA; color: var(--ink-3); box-shadow: inset 0 0 0 1.5px #C9CCC3; }

.audit-score { display: flex; align-items: baseline; gap: 10px; font-family: var(--font-mono); }
.audit-score .n { font-size: 34px; font-weight: 600; color: var(--jade); letter-spacing: -.03em; }
.audit-score .d { font-size: 15px; color: var(--ink-3); }
.audit-score.warn .n { color: var(--amber); }
.audit-score.bad  .n { color: var(--cinnabar); }

/* 呼叫服务员：待处理的行需要一眼看见 */
tr.call-pending td:first-child { box-shadow: inset 3px 0 0 var(--cinnabar) !important; }
.pulse {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--cinnabar);
  margin-right: 6px;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .35; transform: scale(.8); }
}

/* 政策正文预览 */
.doc {
  font-size: 14px;
  line-height: 1.85;
  color: var(--ink-2);
  max-width: 760px;
}
.doc h2 {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--ink);
  margin: 24px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
}
.doc h2:first-child { margin-top: 0; }
.doc p { margin-bottom: 10px; }
.doc ul { margin: 0 0 12px 20px; }
.doc li { margin-bottom: 5px; }
.doc strong { color: var(--ink); font-weight: 600; }
.doc table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13px; }
.doc table th, .doc table td { border: 1px solid var(--line); padding: 8px 11px; text-align: left; }
.doc table th { background: var(--paper-sunk); font-weight: 600; }

/* ================================= 登录页 ================================= */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--celadon);
  position: relative;
  overflow: hidden;
}
/* 底纹：极淡的斜向纸纹，避免大色块显得廉价 */
.login-wrap::before {
  content: '';
  position: absolute;
  inset: -20%;
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(255,255,255,.028) 0 1px,
    transparent 1px 9px
  );
  pointer-events: none;
}
.login-box {
  position: relative;
  background: var(--paper-raised);
  padding: 38px 36px 32px;
  border-radius: var(--r-lg);
  width: 386px;
  max-width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,.28);
  animation: pop .32s cubic-bezier(.2,.8,.3,1);
}
.login-box .login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-box h1 {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: .03em;
  line-height: 1.3;
}
.login-box .sub {
  color: var(--ink-3);
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-top: 1px;
}
.login-box .err { color: var(--cinnabar); font-size: 13px; min-height: 20px; margin-bottom: 6px; }
.login-box .btn-primary { width: 100%; padding: 11px; font-size: 15px; letter-spacing: .16em; }
.login-foot {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.7;
}

/* ================================= 响应式 ================================= */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }
  .sidebar .brand { border-bottom: none; border-right: 1px solid rgba(255,255,255,.09); padding: 14px 16px; }
  .sidebar .brand-sub { display: none; }
  .sidebar nav { display: flex; gap: 4px; padding: 8px 10px; flex: 1; }
  .sidebar .nav-group { display: none; }
  .sidebar nav a { white-space: nowrap; margin-bottom: 0; }
  .sidebar nav a.active::before { display: none; }
  .sidebar nav a.active { box-shadow: inset 0 -2px 0 var(--cinnabar); }
  .sidebar .side-foot { display: none; }
  .topbar { height: 54px; padding: 0 18px; }
  .content { padding: 18px 18px 40px; }
  .page-title { font-size: 21px; }
}

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