:root {
  --bg: #0f1117;
  --panel: #171a23;
  --panel-2: #1e2230;
  --line: #2a2f3f;
  --text: #e8ebf2;
  --muted: #98a1b8;
  --accent: #6d8bff;
  --accent-2: #8b5cf6;
  --ok: #34d399;
  --err: #f87171;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 20% -10%, #1b2033 0%, var(--bg) 55%) no-repeat, var(--bg);
  color: var(--text);
  font: 15px/1.6 "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }

header.top {
  border-bottom: 1px solid var(--line);
  background: rgba(15, 17, 23, .85);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
header.top .inner { display: flex; align-items: center; gap: 18px; height: 60px; }
.brand { font-weight: 700; font-size: 17px; letter-spacing: .3px; color: var(--text); }
.brand span { color: var(--accent); }
header.top nav { display: flex; gap: 16px; align-items: center; margin-left: auto; flex-wrap: wrap; }
header.top nav a { color: var(--muted); font-size: 14px; }
header.top nav a:hover, header.top nav a.active { color: var(--text); text-decoration: none; }
.badge-dot { background: var(--err); color: #fff; border-radius: 10px; padding: 0 6px; font-size: 11px; margin-left: 4px; }

main { padding: 28px 0 60px; }

h1 { font-size: 24px; margin: 0 0 6px; }
h2 { font-size: 18px; margin: 26px 0 12px; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.item-card { display: flex; flex-direction: column; gap: 8px; }
.item-card .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.item-card h3 { margin: 0; font-size: 16px; }
.item-card h3 a { color: var(--text); }
.item-card p { margin: 0; color: var(--muted); font-size: 13.5px; }

.tag {
  font-size: 12px; padding: 2px 9px; border-radius: 20px;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
}
.tag.have { color: #7dd3fc; border-color: #24506b; background: #10222e; }
.tag.want { color: #fcd34d; border-color: #6b5a1f; background: #2a2413; }
.tag.closed { color: var(--muted); }
.tag.removed { color: var(--err); border-color: #5b2222; background: #2a1414; }
.tag.admin { color: var(--accent-2); border-color: #43307a; background: #1e1633; }
.tag.owner { color: #f0b429; border-color: #6b5a1f; background: #2a2413; }

/* 营业中 状态标识 */
.tag.open-now {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 13px; font-size: 13px;
  color: var(--ok); border-color: #1c5a3f; background: #10291f;
}
.tag.open-now .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, .16);
  animation: breath 2s ease-in-out infinite;
}

/* 休息中 */
.tag.closed-now {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 13px; font-size: 13px;
  color: var(--muted); border-color: var(--line); background: var(--panel-2);
}
.tag.closed-now .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--muted);
}

.shop-form { display: flex; gap: 10px; }

/* 页面标题行（右边放按钮） */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.page-head .btn { flex: 0 0 auto; margin-top: 6px; }

/* ---------------- 交互手感（悬停 / 点击反馈） ---------------- */

input, select, textarea { transition: border-color .15s, box-shadow .15s, background .15s; }
input:hover, select:hover, textarea:hover { border-color: #3a4160; }
input:active, select:active, textarea:active { border-color: #4a5478; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(109, 139, 255, .14); }

button, .btn { transition: transform .12s ease, opacity .15s, box-shadow .15s, border-color .15s, background .15s; }
button:hover, .btn:hover { opacity: .95; }
button:active, .btn:active { transform: scale(.96); }
.btn.ghost:hover { background: rgba(255, 255, 255, .06); }

/* 商品卡片：悬停浮起、按下回弹 */
.item-card { transition: transform .16s ease, border-color .16s, box-shadow .16s, background .16s; }
.item-card:hover { transform: translateY(-3px); border-color: #3a4160; box-shadow: 0 12px 28px rgba(0, 0, 0, .38); }
.item-card:active { transform: translateY(-1px) scale(.985); box-shadow: 0 6px 16px rgba(0, 0, 0, .3); }

/* ---------------- 自定义下拉框（带展开动画） ---------------- */

.fsel { position: relative; }
.fsel-native { display: none !important; }

.fsel-btn {
  width: 100%; padding: 10px 30px 10px 12px; text-align: left;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel-2); color: var(--text); font: inherit; font-size: 15px;
  cursor: pointer; position: relative;
}
.fsel-btn:hover { border-color: #3a4160; background: #232839; }
.fsel-btn::after {
  content: '▾'; position: absolute; right: 11px; top: 50%; margin-top: -10px;
  color: var(--muted); transition: transform .18s ease;
}
.fsel.open .fsel-btn { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(109, 139, 255, .14); }
.fsel.open .fsel-btn::after { transform: rotate(180deg); }

.fsel-panel {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 60;
  max-height: 264px; overflow: auto; padding: 5px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .5);
  opacity: 0; transform: translateY(-8px) scale(.97); transform-origin: top center;
  pointer-events: none;
  transition: opacity .17s ease, transform .17s ease;
}
.fsel.open .fsel-panel { opacity: 1; transform: none; pointer-events: auto; }

.fsel-item {
  padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 14px;
  transition: background .12s, color .12s;
}
.fsel-item:hover { background: #2b3145; }
.fsel-item.active { color: var(--accent); background: #1e2440; }

/* 列表行 / 表格行 反馈 */
.conv { transition: background .15s ease, transform .12s ease; }
.conv:active { transform: scale(.995); }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: rgba(255, 255, 255, .03); }

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

/* 输入框下面的字段级错误提示 */
.field-error { margin-top: 6px; font-size: 12.5px; color: var(--err); }

/* ---------------- 商品详情弹窗 ---------------- */

.modal.modal-product { max-width: 440px; }
.pm-rows { display: flex; flex-direction: column; margin: 4px 0 16px; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.pm-row { display: flex; gap: 12px; padding: 9px 12px; background: var(--panel-2); }
.pm-row + .pm-row { border-top: 1px solid var(--line); }
.pm-k { flex: 0 0 54px; color: var(--muted); font-size: 13px; }
.pm-v { flex: 1; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.pm-price { color: #f0b429; font-weight: 700; }
@keyframes breath { 50% { opacity: .4; } }

.toolbar .status-badge { align-self: flex-end; display: flex; align-items: center; padding-bottom: 2px; }

form.stack { display: flex; flex-direction: column; gap: 12px; max-width: 520px; }
label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 5px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  font: inherit; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 90px; }

button, .btn {
  display: inline-block; padding: 9px 16px; border-radius: 9px; cursor: pointer;
  border: 1px solid transparent; font: inherit; font-size: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
}
button:hover, .btn:hover { opacity: .92; text-decoration: none; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn.danger { background: transparent; border-color: #5b2222; color: var(--err); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 20px; }
.toolbar .field { flex: 1 1 150px; }
.toolbar .field.grow { flex: 2 1 240px; }
.toolbar .actions { display: flex; gap: 8px; }

.flash { padding: 10px 14px; border-radius: 9px; margin-bottom: 16px; font-size: 14px; }
.flash.ok { background: #10291f; border: 1px solid #1c5a3f; color: var(--ok); }
.flash.err { background: #2a1414; border: 1px solid #5b2222; color: var(--err); }

.empty { color: var(--muted); text-align: center; padding: 40px 0; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 13px; }

.msg-list { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 72%; padding: 9px 13px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.msg .meta { font-size: 11.5px; color: var(--muted); margin: 5px 0 0; text-align: right; }
.msg.mine { align-self: flex-end; background: #1d2440; border-color: #2f3a63; }

.conv { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.conv:hover { background: var(--panel-2); text-decoration: none; }
.conv .who { font-size: 14px; }
.conv .preview { color: var(--muted); font-size: 13px; }
.conv .time { color: var(--muted); font-size: 12px; white-space: nowrap; }

footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 17px; line-height: 1.8; padding: 20px 0 32px; }

/* ---------------- 登录 / 注册弹窗 ---------------- */

html.modal-open, html.modal-open body { overflow: hidden; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 999;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(4, 6, 12, .8);
  backdrop-filter: blur(6px);
  animation: modal-fade .16s ease-out;
}
@keyframes modal-fade { from { opacity: 0; } }
.modal-backdrop[hidden] { display: none; }

.modal {
  position: relative;
  width: 100%; max-width: 420px; max-height: 90vh; overflow: auto;
  background: linear-gradient(180deg, #1c2130, var(--panel));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 26px 24px;
  box-shadow: 0 40px 90px rgba(0, 0, 0, .68), 0 0 0 1px rgba(255, 255, 255, .05), 0 10px 28px rgba(0, 0, 0, .45);
  animation: modal-pop .22s cubic-bezier(.2, .9, .3, 1.25);
}
@keyframes modal-pop {
  from { transform: translateY(18px) scale(.94); opacity: 0; }
}

.modal-close {
  position: absolute; top: 8px; right: 10px;
  background: transparent; border: 0; padding: 4px 9px;
  color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer;
}
.modal-close:hover { color: var(--text); }

.modal-title { margin: 0 0 6px; font-size: 20px; text-align: center; }
.modal-sub { margin: 0 0 18px; color: var(--muted); font-size: 13px; text-align: center; }

.tabs { display: flex; gap: 5px; padding: 4px; margin-bottom: 16px; border-radius: 10px; background: var(--panel-2); }
.tab {
  flex: 1; padding: 7px 0; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer;
}
.tab.active { background: var(--accent); color: #fff; }

.modal-form { display: flex; flex-direction: column; gap: 12px; }
.modal-form[hidden] { display: none; }
.modal-form .field label { display: block; margin-bottom: 5px; }

.check { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: 13.5px; cursor: pointer; }
.check input { width: auto; margin: 0; }

.btn.block { width: 100%; }

.modal-error {
  padding: 8px 11px; border-radius: 8px; font-size: 13px;
  background: #2a1414; border: 1px solid #5b2222; color: var(--err);
}
.modal-error[hidden] { display: none; }

.modal-actions { display: flex; gap: 10px; margin-top: 4px; }
.modal-actions .btn { flex: 1; text-align: center; }

/* 付款 */
.send-row { display: flex; gap: 10px; }
.pay-img { display: block; width: 100%; margin-top: 4px; border-radius: 12px; border: 1px solid var(--line); }

/* 收款码上传行：只读路径框 + 上传按钮 */
.upload-row { display: flex; gap: 10px; align-items: center; }
.upload-row input[type="text"] { flex: 1 1 auto; min-width: 0; color: var(--muted); }
.upload-row .btn { flex: 0 0 auto; }
.btn.pay { background: linear-gradient(135deg, #10b981, #059669); }

/* 付款码窗口：占页面宽度的 30% 左右 */
.modal.modal-pay { width: 30vw; min-width: 280px; max-width: 700px; padding: 20px; }
@media (max-width: 820px) { .modal.modal-pay { width: 86vw; min-width: 0; } }

.link-mini { display: block; margin-top: 2px; text-align: center; font-size: 13px; color: var(--muted); }
.link-mini:hover { color: var(--text); text-decoration: none; }
.modal-hint { margin: 0; font-size: 13px; color: var(--muted); }

/* 价格 */
.price { margin-left: auto; color: #f0b429; font-weight: 600; font-size: 14px; white-space: nowrap; }
.price-big { margin: 8px 0 2px; color: #f0b429; font-weight: 700; font-size: 22px; }

/* ---------------- 右下角消息通知 ---------------- */

.toast-wrap {
  position: fixed; right: 20px; bottom: 20px; z-index: 1000;
  display: flex; flex-direction: column; gap: 10px;
  max-width: min(320px, calc(100vw - 40px));
}

.toast {
  cursor: pointer;
  padding: 12px 14px;
  background: linear-gradient(180deg, #1c2130, var(--panel));
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .55);
  animation: toast-in .25s ease-out;
}
.toast:hover { border-left-color: var(--accent-2); }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }

.toast .t-who { font-size: 13px; font-weight: 600; color: var(--accent); }
.toast .t-body {
  margin-top: 4px; font-size: 13.5px; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.toast .t-hint { margin-top: 6px; font-size: 12px; color: var(--muted); }

/* ================= 手机端适配 ================= */

html { -webkit-tap-highlight-color: rgba(255, 255, 255, .06); }
button, .btn, a, .fsel-btn, .conv, .item-card, .toast { touch-action: manipulation; }

@media (max-width: 720px) {
  .wrap { padding: 0 14px; }
  main { padding: 18px 0 48px; }

  /* 顶栏：品牌一行，菜单换行到第二行 */
  header.top .inner { height: auto; padding: 10px 0; flex-wrap: wrap; gap: 6px 14px; }
  header.top nav { margin-left: 0; width: 100%; flex-wrap: wrap; gap: 9px 16px; }
  header.top nav a { font-size: 14.5px; }
  .brand { font-size: 16px; }

  h1 { font-size: 21px; }
  h2 { font-size: 17px; }

  /* 筛选工具条：控件占满整行 */
  .toolbar { gap: 10px; }
  .toolbar .field { flex: 1 1 100%; }
  .toolbar .actions { width: 100%; }
  .toolbar .actions button, .toolbar .actions .btn { flex: 1; text-align: center; }
  .toolbar .status-badge { align-self: flex-start; }

  /* 商品列表单列 */
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }

  /* 表格横向滚动（后台那种多列的表） */
  .card { overflow-x: auto; }
  .card table { min-width: 560px; }

  /* iOS：输入框字号 ≥16px 才不会自动放大页面 */
  input, select, textarea { font-size: 16px; }

  /* 弹窗贴边 */
  .modal-backdrop { padding: 12px; }
  .modal { padding: 20px 16px 16px; border-radius: 14px; }
  .modal.modal-pay { width: 92vw; max-width: 92vw; min-width: 0; }
  .modal.modal-product { max-width: 100%; }

  /* 消息气泡 / 会话行 */
  .msg { max-width: 86%; }
  .conv { flex-direction: column; gap: 4px; }
  .conv .time { text-align: left; }

  /* 发送行 / 上传行 */
  .send-row { flex-wrap: wrap; }
  .send-row button { flex: 1; }
  .upload-row { flex-wrap: wrap; }
  .upload-row .btn { flex: 1 1 100%; }

  .page-head { flex-direction: column; gap: 8px; }
  .page-head .btn { margin-top: 0; }

  .rowbtns { gap: 6px; }
  .btn.small { padding: 6px 10px; font-size: 13px; }

  .toast-wrap { right: 12px; bottom: 12px; }
}
