:root {
  --bg: #0b0d17;
  --bg-2: #11131f;
  --panel: #161a2b;
  --panel-2: #1c2136;
  --line: #262c44;
  --text: #e9ecf8;
  --muted: #8e97b8;
  --accent: #ff5c8a;
  --accent-2: #7c5cff;
  --ok: #35d0a5;
  --warn: #ffb84d;
  --danger: #ff5d5d;
  --radius: 14px;
  --shadow: 0 18px 40px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 700px at 15% -10%, #23204a 0%, transparent 55%),
              radial-gradient(900px 600px at 100% 0%, #2a1734 0%, transparent 45%),
              var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100%;
}

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

button, input, select, textarea { font-family: inherit; font-size: 14px; }

button { cursor: pointer; }

/* ---------------- 通用控件 ---------------- */

.btn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 10px;
  transition: .16s ease;
  font-weight: 600;
  white-space: nowrap;
}
.btn:hover { border-color: #3a4267; transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #fff;
  box-shadow: 0 8px 22px rgba(255, 92, 138, .28);
}
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.danger { border-color: rgba(255, 93, 93, .5); color: #ffb3b3; }
.btn.danger:hover { background: rgba(255, 93, 93, .12); }
.btn.ok { border-color: rgba(53, 208, 165, .5); color: #9df0d6; }
.btn.ok:hover { background: rgba(53, 208, 165, .12); }

input, select, textarea {
  width: 100%;
  background: #0f1322;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 11px 13px;
  border-radius: 10px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, .16);
}
textarea { resize: vertical; min-height: 110px; line-height: 1.6; }
label.field { display: block; margin-bottom: 16px; }
label.field > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 13px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 6px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, .03);
}
.badge.open { color: #9df0d6; border-color: rgba(53, 208, 165, .35); background: rgba(53, 208, 165, .1); }
.badge.taken { color: #a5b4ff; border-color: rgba(124, 92, 255, .4); background: rgba(124, 92, 255, .12); }
.badge.submitted { color: #ffd699; border-color: rgba(255, 184, 77, .4); background: rgba(255, 184, 77, .12); }
.badge.done { color: #8fb4c9; border-color: rgba(143, 180, 201, .3); background: rgba(143, 180, 201, .1); }
.badge.cancelled { color: #8e97b8; }

/* ---------------- 登录页 ---------------- */

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, rgba(28, 33, 54, .95), rgba(18, 21, 35, .95));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.logo {
  width: 42px; height: 42px; border-radius: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; font-weight: 800; font-size: 19px; color: #fff;
  box-shadow: 0 10px 24px rgba(124, 92, 255, .35);
}
.brand h1 { font-size: 20px; margin: 0; letter-spacing: .5px; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

.auth-tabs { display: flex; gap: 8px; margin: 22px 0 20px; background: #0e1120; padding: 5px; border-radius: 12px; }
.auth-tabs button {
  flex: 1; border: none; background: transparent; color: var(--muted);
  padding: 9px; border-radius: 9px; font-weight: 600;
}
.auth-tabs button.active { background: var(--panel-2); color: var(--text); box-shadow: 0 2px 10px rgba(0,0,0,.3); }
.demo-tip {
  margin-top: 18px; padding: 12px 14px; border-radius: 12px;
  background: rgba(124, 92, 255, .08); border: 1px dashed rgba(124, 92, 255, .35);
  color: var(--muted); font-size: 12px; line-height: 1.7;
}
.demo-tip b { color: var(--text); }

/* ---------------- 布局 ---------------- */

.app { max-width: 1180px; margin: 0 auto; padding: 0 18px 70px; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0 12px;
  background: linear-gradient(180deg, rgba(11, 13, 23, .96) 60%, rgba(11, 13, 23, 0));
  backdrop-filter: blur(8px);
}
.topbar .brand h1 { font-size: 16px; }
.topbar .spacer { flex: 1; }

.nav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav button {
  border: 1px solid transparent; background: transparent; color: var(--muted);
  padding: 8px 14px; border-radius: 10px; font-weight: 600; white-space: nowrap;
}
.nav button:hover { color: var(--text); background: rgba(255,255,255,.04); }
.nav button.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(255, 92, 138, .22), rgba(124, 92, 255, .22));
  border-color: rgba(124, 92, 255, .4);
}

.userchip { display: flex; align-items: center; gap: 9px; padding: 5px 10px 5px 5px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff;
}
.userchip .name { font-size: 13px; font-weight: 600; }
.userchip .bal { font-size: 12px; color: var(--ok); font-variant-numeric: tabular-nums; }

.bell { position: relative; }
.bell .dot {
  position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--accent); color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 999px; display: grid; place-items: center;
}

.notice {
  margin: 8px 0 18px; padding: 11px 15px; border-radius: 12px;
  background: linear-gradient(90deg, rgba(255, 92, 138, .12), rgba(124, 92, 255, .1));
  border: 1px solid rgba(255, 92, 138, .22);
  color: #ffd9e4; font-size: 13px; line-height: 1.6;
  display: flex; gap: 9px; align-items: flex-start;
}

.panel {
  background: linear-gradient(180deg, rgba(28, 33, 54, .72), rgba(17, 20, 33, .72));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.section-title { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 14px; }
.section-title h2 { font-size: 16px; margin: 0; }
.section-title .sub { color: var(--muted); font-size: 12px; }

/* ---------------- 筛选 ---------------- */

.filters { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr auto; gap: 10px; margin-bottom: 16px; }
@media (max-width: 860px) { .filters { grid-template-columns: 1fr 1fr; } }

/* ---------------- 订单卡片 ---------------- */

.order-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }

.order-card {
  background: linear-gradient(180deg, rgba(28, 33, 54, .8), rgba(15, 18, 30, .9));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  transition: .18s ease;
  position: relative;
  overflow: hidden;
}
.order-card::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  opacity: .0; transition: .18s;
}
.order-card:hover { border-color: #39406a; transform: translateY(-2px); box-shadow: 0 16px 32px rgba(0,0,0,.4); }
.order-card:hover::before { opacity: 1; }
.order-card .oc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.order-card h3 { margin: 0; font-size: 15px; line-height: 1.4; }
.order-card .oc-desc {
  color: var(--muted); font-size: 13px; line-height: 1.65; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.oc-meta { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 12px; }
.oc-meta b { color: #c8cee8; font-weight: 600; }
.oc-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 4px; }
.reward { display: flex; flex-direction: column; }
.reward .amt { font-size: 22px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; line-height: 1.1; }
.reward .amt small { font-size: 13px; margin-right: 2px; }
.reward .fee { color: var(--muted); font-size: 11px; }

/* ---------------- 列表 / 表格 ---------------- */

.rows { display: flex; flex-direction: column; gap: 10px; }
.row {
  display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center;
  padding: 14px 16px; border-radius: 12px;
  background: rgba(22, 26, 43, .7); border: 1px solid var(--line);
}
.row .r-title { font-weight: 600; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row .r-sub { color: var(--muted); font-size: 12px; display: flex; gap: 12px; flex-wrap: wrap; }
.row .r-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid rgba(38, 44, 68, .7); }
th { color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; }
td { vertical-align: middle; }
.mono { font-variant-numeric: tabular-nums; }
.amount-pos { color: var(--ok); font-weight: 700; }
.amount-neg { color: var(--danger); font-weight: 700; }

/* ---------------- 统计卡 ---------------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  background: linear-gradient(180deg, rgba(28, 33, 54, .85), rgba(16, 19, 32, .9));
  border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
}
.stat .k { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.stat .v { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 3px; }

.trend { display: flex; align-items: flex-end; gap: 14px; height: 130px; padding: 10px 4px 0; }
.trend .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.trend .bars { display: flex; gap: 3px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.trend .bar { width: 12px; border-radius: 4px 4px 0 0; min-height: 3px; }
.trend .bar.a { background: linear-gradient(180deg, var(--accent), rgba(255, 92, 138, .3)); }
.trend .bar.b { background: linear-gradient(180deg, var(--ok), rgba(53, 208, 165, .25)); }
.trend .lbl { font-size: 11px; color: var(--muted); }

/* ---------------- 表单页 ---------------- */

.publish-wrap { display: grid; grid-template-columns: 1.7fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .publish-wrap { grid-template-columns: 1fr; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button {
  border: 1px solid var(--line); background: #0f1322; color: var(--muted);
  padding: 7px 13px; border-radius: 999px; font-size: 13px;
}
.chips button.active { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .split { grid-template-columns: 1fr; } }

.kv { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed rgba(38,44,68,.8); font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv span { color: var(--muted); }
.kv b { font-variant-numeric: tabular-nums; }

/* ---------------- 弹窗 ---------------- */

.modal-mask {
  position: fixed; inset: 0; background: rgba(5, 6, 12, .7); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px; z-index: 60;
}
.modal {
  width: 100%; max-width: 560px; max-height: 88vh; overflow: auto;
  background: linear-gradient(180deg, #1a1f33, #12152398); 
  background-color: #161a2b;
  border: 1px solid var(--line); border-radius: 18px; padding: 22px;
  box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 4px; font-size: 17px; }
.modal .m-meta { color: var(--muted); font-size: 12px; display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.modal .m-desc { font-size: 13.5px; line-height: 1.75; color: #cfd5ea; white-space: pre-wrap; margin: 0 0 14px; }
.modal .m-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 18px; }

/* ---------------- 提示条 ---------------- */

.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 20px);
  background: #1e2338; color: var(--text); border: 1px solid var(--line);
  padding: 11px 18px; border-radius: 12px; font-size: 13px; z-index: 90;
  opacity: 0; pointer-events: none; transition: .22s ease; box-shadow: var(--shadow);
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(255, 93, 93, .5); color: #ffc9c9; }

.empty {
  text-align: center; color: var(--muted); font-size: 13px; padding: 46px 10px;
  border: 1px dashed var(--line); border-radius: 12px;
}
.loading { text-align: center; color: var(--muted); padding: 30px; font-size: 13px; }

.pager { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 18px; color: var(--muted); font-size: 13px; }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; background: #0e1120; padding: 5px; border-radius: 12px; width: fit-content; }
.tabs button { border: none; background: transparent; color: var(--muted); padding: 8px 16px; border-radius: 9px; font-weight: 600; }
.tabs button.active { background: var(--panel-2); color: var(--text); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.footer { text-align: center; color: #4d5573; font-size: 12px; margin-top: 40px; }

/* ---------------- 记账录入表单 ---------------- */
.rec-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}
.rec-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.rec-form input { width: 100%; }
.rec-actions { display: flex; gap: 8px; align-items: center; }
.rec-actions .btn { height: 40px; }
@media (max-width: 1080px) { .rec-form { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) { .rec-form { grid-template-columns: 1fr 1fr; } }
