/* ============================================================
   票务收集原型 · 管理后台样式
   ============================================================ */
:root {
  --brand: #07C160;
  --brand-d: #04984A;
  --brand-l: #E9F9F0;
  --text: #111827;
  --text-2: #6B7280;
  --text-3: #9CA3AF;
  --line: #EDF0F3;
  --bg: #F6F8FA;
  --danger: #E5484D;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; font-size: 13px;
}
button, input, select { font-family: inherit; font-size: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #D8DEE6; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #C4CCD6; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  height: 60px; background: #fff; border-bottom: 1px solid #E7EBF0;
  display: flex; align-items: center; gap: 28px; padding: 0 20px;
  position: relative; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.logo {
  width: 34px; height: 34px; border-radius: 9px; color: #fff;
  background: linear-gradient(135deg, #0AC163, #04A34E);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px -4px rgba(7,193,96,.8);
}
.brand-t { font-size: 14.5px; font-weight: 700; letter-spacing: .2px; }
.brand-s { font-size: 10.5px; color: #9CA3AF; margin-top: 2px; letter-spacing: .4px; }

.topnav { display: flex; gap: 4px; height: 100%; min-width: 0; }
.topnav button {
  position: relative; border: none; background: transparent; cursor: pointer;
  padding: 0 16px; height: 100%; color: #4B5563; font-size: 13.5px;
  transition: .16s; white-space: nowrap; flex: 0 0 auto;
}
.topnav button:hover { color: var(--brand-d); }
.topnav button.on { color: var(--brand-d); font-weight: 600; }
.topnav button.on::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 0;
  height: 2.5px; border-radius: 3px 3px 0 0; background: var(--brand);
}

.topright { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.demo-tag {
  font-size: 10.5px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #07C160, #0FAF5E);
  padding: 3px 8px; border-radius: 5px; letter-spacing: .3px;
}
.ghost-link { font-size: 12.5px; color: #6B7280; text-decoration: none; }
.ghost-link:hover { color: var(--brand-d); }
.user-chip {
  display: flex; align-items: center; gap: 7px; cursor: pointer;
  padding: 4px 10px 4px 4px; border-radius: 20px; transition: .16s;
}
.user-chip:hover { background: #F3F6F9; }
.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand-l); color: var(--brand-d);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.uname { font-size: 12.5px; color: #374151; }

/* ---------------- 布局 ---------------- */
.layout { display: flex; height: calc(100vh - 60px); }

.sidebar {
  width: 272px; flex: 0 0 auto; background: #fff;
  border-right: 1px solid #E7EBF0; display: flex; flex-direction: column;
}
.side-head {
  padding: 14px 16px 10px; display: flex; flex-direction: column; gap: 3px;
  font-size: 12px; font-weight: 700; color: #111827;
}
.side-tip { font-weight: 400; font-size: 10.5px; color: #A5ACB8; }
.tree { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.side-foot { padding: 10px 14px; border-top: 1px solid var(--line); }

.node-all, .tree-group-head, .tree-person {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 8px; border-radius: 7px; cursor: pointer;
  font-size: 12.5px; color: #374151; transition: .14s; user-select: none;
}
.node-all { font-weight: 600; margin-bottom: 2px; }
.node-all:hover, .tree-group-head:hover, .tree-person:hover { background: #F5F8FA; }
.node-all.on, .tree-group-head.on, .tree-person.on { background: var(--brand-l); color: var(--brand-d); font-weight: 600; }
.tree-group-head { font-weight: 600; }
.tree-person { padding-left: 26px; font-weight: 400; position: relative; }
.tree-person::before {
  content: ""; position: absolute; left: 14px; top: 50%; width: 5px; height: 5px;
  margin-top: -2.5px; border-radius: 50%; background: #D3D9E1;
}
.tree-person.on::before { background: var(--brand); }
.caret {
  width: 12px; color: #A5ACB8; font-size: 9px; transition: .18s;
  display: inline-flex; justify-content: center; flex: 0 0 auto;
}
.caret.open { transform: rotate(90deg); }
.nlabel { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ncount {
  font-size: 10.5px; color: #8A919C; background: #F0F3F7;
  padding: 1px 6px; border-radius: 9px; flex: 0 0 auto;
}
.on .ncount { background: rgba(7,193,96,.14); color: var(--brand-d); }
.tree-people { overflow: hidden; }

/* ---------------- 主区 ---------------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page-head {
  height: 66px; flex: 0 0 auto; background: #fff; border-bottom: 1px solid #E7EBF0;
  padding: 0 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.ph-title { font-size: 16.5px; font-weight: 700; }
.ph-crumb { font-size: 11.5px; color: #9CA3AF; margin-top: 3px; }
.ph-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.main-body { flex: 1; overflow-y: auto; padding: 18px 22px 40px; }

/* 统计 */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-card {
  background: #fff; border: 1px solid #EDF0F4; border-radius: 11px;
  padding: 14px 16px; position: relative; overflow: hidden;
}
.stat-k { font-size: 11.5px; color: #8A919C; }
.stat-v { font-size: 23px; font-weight: 700; margin-top: 6px; letter-spacing: -.3px; }
.stat-v small { font-size: 12px; font-weight: 600; color: #9CA3AF; margin-left: 3px; }
.stat-ico {
  position: absolute; right: 12px; top: 12px; width: 28px; height: 28px; border-radius: 8px;
  background: var(--brand-l); color: var(--brand-d);
  display: flex; align-items: center; justify-content: center;
}

/* 面板 / 表格 */
.panel { background: #fff; border: 1px solid #EDF0F4; border-radius: 11px; overflow: hidden; }
.panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.panel-title { font-size: 13px; font-weight: 700; }
.panel-note { font-size: 11.5px; color: #9CA3AF; }
.panel-head .spacer { margin-left: auto; }

.table-scroll { overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tb thead th {
  background: #FAFBFC; color: #6B7280; font-weight: 600; font-size: 11.5px;
  padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tb tbody td {
  padding: 11px 14px; border-bottom: 1px solid #F4F6F8; color: #1F2937;
  white-space: nowrap;
}
.tb tbody tr:last-child td { border-bottom: none; }
.tb tbody tr.click { cursor: pointer; }
.tb tbody tr.click:hover { background: #F9FCFA; }
.tb .num { text-align: right; font-variant-numeric: tabular-nums; }
.tb .money { font-weight: 700; color: #E37318; font-variant-numeric: tabular-nums; }
.tb .muted { color: #9CA3AF; }
.tb .mono { font-variant-numeric: tabular-nums; letter-spacing: .2px; }

.pill {
  display: inline-block; font-size: 10.5px; padding: 2px 7px; border-radius: 5px;
  background: #F1F4F8; color: #6B7280;
}
.pill-green { background: var(--brand-l); color: var(--brand-d); }
.pill-gray { background: #F4F5F7; color: #9CA3AF; }

.empty-state { padding: 60px 0; text-align: center; color: #A5ACB8; font-size: 13px; }
.empty-state svg { margin-bottom: 10px; }

/* 按钮 */
.btn-primary, .btn-sec, .btn-danger {
  height: 34px; padding: 0 14px; border-radius: 8px; cursor: pointer;
  font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid transparent; transition: .16s; white-space: nowrap;
}
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 10px -5px rgba(7,193,96,.9); }
.btn-primary:hover { background: #06AE56; }
.btn-sec { background: #fff; border-color: #DFE4EA; color: #374151; }
.btn-sec:hover { border-color: #C7CFD9; background: #FBFCFD; }
.btn-danger { background: #fff; border-color: #F3C9CB; color: var(--danger); }
.btn-danger:hover { background: #FFF5F5; }
.btn-mini {
  height: 28px; padding: 0 10px; font-size: 11.5px; border-radius: 7px;
  background: #fff; border: 1px solid #E3E8EE; color: #6B7280; cursor: pointer;
  width: 100%;
}
.btn-mini:hover { border-color: #C7CFD9; color: #374151; }
.link-btn {
  border: none; background: transparent; color: var(--brand-d); cursor: pointer;
  font-size: 12.5px; padding: 0 6px;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }

/* 搜索 */
.search-box { position: relative; }
.search-box input {
  width: 230px; height: 34px; border-radius: 8px; border: 1px solid #DFE4EA;
  background: #fff; padding: 0 12px 0 32px; outline: none; font-size: 12.5px;
  transition: .16s; color: var(--text);
}
.search-box input::placeholder { color: #AEB4BE; }
.search-box input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(7,193,96,.1); }
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #A5ACB8; }

/* ---------------- 抽屉 ---------------- */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(17,24,39,.32); z-index: 300;
  display: flex; justify-content: flex-end; animation: fadeIn .16s ease;
}
.drawer {
  width: 480px; max-width: 94vw; height: 100%; background: #fff;
  display: flex; flex-direction: column;
  box-shadow: -20px 0 50px -20px rgba(17,24,39,.3);
  animation: slideIn .22s cubic-bezier(.22,1,.36,1);
}
@keyframes slideIn { from { transform: translateX(30px); opacity: .5; } to { transform: none; opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.drawer-head {
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
}
.drawer-title { font-size: 16px; font-weight: 700; }
.drawer-sub { font-size: 11.5px; color: #9CA3AF; margin-top: 4px; }
.icon-btn {
  width: 28px; height: 28px; border-radius: 7px; border: 1px solid #E7EBF0;
  background: #fff; color: #6B7280; cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: #F5F8FA; }
.drawer-body { flex: 1; overflow-y: auto; padding: 4px 20px 28px; }

.kv { display: flex; padding: 11px 0; border-bottom: 1px dashed #F1F3F6; font-size: 13px; }
.kv .k { width: 88px; flex: 0 0 auto; color: #9CA3AF; font-size: 12px; }
.kv .v { flex: 1; color: #111827; word-break: break-all; }
.section-label {
  font-size: 11.5px; font-weight: 700; color: #6B7280; margin: 18px 0 8px;
  display: flex; align-items: center; gap: 6px;
}
.section-label::before { content: ""; width: 3px; height: 11px; background: var(--brand); border-radius: 2px; }
.ticket-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.ticket-grid .tk {
  position: relative; height: 92px; border-radius: 8px; overflow: hidden;
  border: 1px solid #EDF0F4; background: #F7F8FA; cursor: zoom-in;
}
.ticket-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(17,24,39,.36); z-index: 350;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .16s ease;
}
.modal {
  width: 430px; max-width: 92vw; background: #fff; border-radius: 13px;
  box-shadow: 0 30px 60px -20px rgba(17,24,39,.4); overflow: hidden;
  animation: popIn .18s cubic-bezier(.22,1,.36,1);
}
@keyframes popIn { from { transform: scale(.96); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head {
  padding: 15px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; font-weight: 700;
}
.modal-body { padding: 18px; }
.modal-foot {
  padding: 12px 18px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 8px; background: #FBFCFD;
}
.mf { margin-bottom: 14px; }
.mf:last-child { margin-bottom: 0; }
.mf label { display: block; font-size: 12px; color: #6B7280; margin-bottom: 6px; }
.mf input, .mf select {
  width: 100%; height: 38px; border: 1px solid #DFE4EA; border-radius: 8px;
  padding: 0 11px; outline: none; font-size: 13px; color: var(--text); background: #fff;
  transition: .16s;
}
.mf input:focus, .mf select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(7,193,96,.1); }
.mf .tip { font-size: 11px; color: #A5ACB8; margin-top: 6px; line-height: 1.5; }

/* ---------------- 登录 ---------------- */
.login-mask {
  position: fixed; inset: 0; z-index: 500;
  background: radial-gradient(1000px 500px at 50% -10%, #E8F9EF 0%, #F4F7FA 45%, #EEF2F6 100%);
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  width: 372px; max-width: 92vw; background: #fff; border-radius: 16px;
  padding: 34px 30px 26px; box-shadow: 0 30px 70px -28px rgba(17,24,39,.35);
  text-align: center; border: 1px solid #EEF1F5;
}
.login-logo {
  width: 50px; height: 50px; margin: 0 auto 14px; border-radius: 14px; color: #fff;
  background: linear-gradient(135deg, #0AC163, #04A34E);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 22px -10px rgba(7,193,96,.9);
}
.login-card h2 { margin: 0; font-size: 18px; }
.login-sub { font-size: 12px; color: #9CA3AF; margin: 6px 0 22px; }
.lf { text-align: left; margin-bottom: 14px; }
.lf label { display: block; font-size: 12px; color: #6B7280; margin-bottom: 6px; }
.lf input {
  width: 100%; height: 42px; border: 1px solid #DFE4EA; border-radius: 9px;
  padding: 0 12px; font-size: 14px; outline: none; transition: .16s;
}
.lf input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(7,193,96,.12); }
.login-err { color: var(--danger); font-size: 12px; height: 16px; text-align: left; margin-bottom: 6px; }
.login-card .btn-primary { width: 100%; height: 42px; justify-content: center; font-size: 14px; }
.login-hint { font-size: 11.5px; color: #A5ACB8; margin-top: 16px; }
.login-hint b { color: #6B7280; }

/* ---------------- toast / 灯箱 ---------------- */
.toast {
  position: fixed; left: 50%; top: 78px; transform: translate(-50%,-8px);
  background: rgba(17,24,39,.88); color: #fff; font-size: 12.5px;
  padding: 9px 16px; border-radius: 8px; z-index: 600;
  opacity: 0; pointer-events: none; transition: .2s; max-width: 80vw;
}
.toast.show { opacity: 1; transform: translate(-50%,0); }
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 700;
  display: flex; align-items: center; justify-content: center; cursor: zoom-out;
}
.lightbox img { max-width: 90%; max-height: 88%; border-radius: 6px; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1180px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}
.only-narrow { display: none !important; }
@media (max-width: 960px) {
  .brand-s, .demo-tag { display: none; }
  .topnav button { padding: 0 11px; }
  .sidebar {
    position: fixed; left: 0; top: 54px; bottom: 0; width: 282px; z-index: 220;
    transform: translateX(-100%); transition: transform .22s cubic-bezier(.22,1,.36,1);
    box-shadow: 12px 0 30px -18px rgba(17,24,39,.45);
  }
  .sidebar.open { transform: none; }
  .side-mask { position: fixed; inset: 54px 0 0 0; background: rgba(17,24,39,.3); z-index: 210; }
  .only-narrow { display: inline-flex !important; }
}
@media (max-width: 760px) {
  .topbar { height: 54px; padding: 0 12px; gap: 10px; }
  .brand-txt { display: none; }
  .ghost-link { display: none; }
  .uname { display: none; }
  .user-chip { padding: 3px 6px 3px 3px; }
  .topnav { overflow-x: auto; scrollbar-width: none; }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav button { padding: 0 9px; font-size: 13px; }
  .topnav button.on::after { left: 8px; right: 8px; }
  .layout { height: calc(100vh - 54px); }
  .page-head { height: auto; padding: 12px 14px; flex-wrap: wrap; gap: 10px; }
  .ph-title { font-size: 15.5px; }
  .ph-crumb { font-size: 11px; }
  .ph-right { width: 100%; }
  .search-box { flex: 1; }
  .search-box input { width: 100%; }
  .main-body { padding: 12px 14px 32px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-v { font-size: 20px; }
  .panel-head { flex-wrap: wrap; }
  .panel-head .spacer { display: none; }
  .drawer { width: 100%; }
}
