/* 便利店优惠券活动管理软件 V1.0 —— PC 端原生样式（无任何前端类库） */

:root {
  --primary: #2f6fed;
  --primary-dark: #1d55c4;
  --primary-soft: #eaf1ff;
  --bg: #f4f6fb;
  --card: #ffffff;
  --line: #e5eaf3;
  --line-strong: #d5dceb;
  --text: #1b2436;
  --text-2: #4b5872;
  --muted: #8490a6;
  --danger: #d93a40;
  --danger-soft: #fdecec;
  --success: #12945a;
  --success-soft: #e6f7ee;
  --warning: #b97208;
  --warning-soft: #fff4df;
  --info-soft: #eaf1ff;
  --sidebar: #131a2b;
  --sidebar-2: #1b2438;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(17, 28, 54, .08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}

body { min-width: 1180px; }

h1, h2, h3, h4, p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 12px; }
.mono { font-family: Consolas, "Courier New", monospace; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }

/* ---------------------------------------------------------------- 登录 */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  background: #f4f6fb;
}

.login-brand {
  flex: 1.15;
  padding: 84px 72px;
  color: #fff;
  background:
    radial-gradient(circle at 82% 18%, rgba(98, 154, 255, .45), transparent 42%),
    radial-gradient(circle at 12% 88%, rgba(47, 111, 237, .35), transparent 40%),
    linear-gradient(140deg, #101a30 0%, #16264a 58%, #1d3b74 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: linear-gradient(135deg, #4c8dff, #2f6fed);
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 22px rgba(47, 111, 237, .45);
}

.brand-mark.small {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 18px;
  box-shadow: none;
}

.login-brand h1 {
  margin: 10px 0 12px;
  max-width: 6.6em;
  font-size: 40px;
  line-height: 1.28;
  letter-spacing: 1px;
}

.brand-company {
  margin-top: 30px;
  color: rgba(255, 255, 255, .82);
  font-size: 15px;
  letter-spacing: 2px;
}

.brand-sub { color: rgba(255, 255, 255, .55); letter-spacing: .5px; }

.brand-points { margin-top: 52px; display: grid; gap: 14px; }

.brand-points li {
  position: relative;
  padding-left: 22px;
  color: rgba(255, 255, 255, .8);
  font-size: 14px;
}

.brand-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6ea3ff;
  box-shadow: 0 0 0 4px rgba(110, 163, 255, .16);
}

.login-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  position: relative;
}

.login-copyright {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 1px;
}

.login-form {
  width: 380px;
  background: var(--card);
  padding: 42px 40px 34px;
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.login-form h2 { font-size: 24px; margin-bottom: 8px; }
.login-form > .muted { margin-bottom: 28px; display: block; }

.field { display: block; margin-bottom: 18px; }
.field > span { display: block; margin-bottom: 7px; font-size: 13px; color: var(--text-2); }
.field > span em { color: var(--danger); font-style: normal; margin-left: 3px; }

.input, .select, .textarea {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.textarea { height: auto; min-height: 80px; padding: 9px 12px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, .12);
}
.input:disabled, .select:disabled, .textarea:disabled {
  background: #f4f6fa;
  color: var(--muted);
  cursor: not-allowed;
}
.input::placeholder, .textarea::placeholder { color: #aab3c5; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text-2);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}

.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:disabled:hover { border-color: var(--line-strong); color: var(--text-2); }

.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }

.btn-danger { background: #fff; border-color: #f2c2c4; color: var(--danger); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-soft); border-color: transparent; }

.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.btn-lg { height: 44px; font-size: 15px; }
.btn-block { width: 100%; }

.form-error {
  margin: -4px 0 14px;
  padding: 9px 12px;
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: 8px;
  font-size: 13px;
}

/* ---------------------------------------------------------------- 框架 */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 272px;
  flex: 0 0 272px;
  background: var(--sidebar);
  color: #c7d1e4;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.sidebar-brand strong {
  display: block;
  font-size: 13px;
  color: #fff;
  white-space: nowrap;
}

.brand-version {
  margin-left: 4px;
  color: #7f90ad;
  font-size: 11px;
  font-weight: 400;
}

.nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.nav-group-label {
  padding: 16px 12px 8px;
  font-size: 11px;
  letter-spacing: 1px;
  color: #5d6b86;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 2px;
  border-radius: 8px;
  color: #aebbd2;
  font-size: 13.5px;
  cursor: pointer;
  transition: all .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(47, 111, 237, .9), rgba(47, 111, 237, .55));
  color: #fff;
  box-shadow: 0 6px 16px rgba(47, 111, 237, .25);
}
.nav-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  border-radius: 5px;
  background: rgba(255, 255, 255, .08);
}
.nav-item.active .nav-icon { background: rgba(255, 255, 255, .2); }

.sidebar-foot { padding: 14px 18px 18px; border-top: 1px solid rgba(255, 255, 255, .07); }
.storage-note { font-size: 11px; color: #5d6b86; line-height: 1.7; }
.storage-note span { color: #46536b; }

.main {
  flex: 1;
  margin-left: 272px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 66px;
  padding: 0 26px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.crumb h2 { font-size: 17px; font-weight: 600; }
.crumb .muted { display: block; margin-top: 2px; }

.topbar-right { display: flex; align-items: center; gap: 18px; }
.server-time { color: var(--muted); font-size: 12px; }

.user-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 9px;
  border-radius: 9px;
  cursor: pointer;
}
.user-chip:hover { background: #f3f6fd; }

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.user-meta strong { display: block; font-size: 13px; }
.user-meta small { color: var(--muted); font-size: 11px; }

.user-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 48px;
  width: 140px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.user-menu.open { display: block; }
.user-menu button {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.user-menu button:hover { background: var(--primary-soft); color: var(--primary); }

.view { padding: 22px 26px 40px; }

.app-footer {
  margin-top: auto;
  padding: 14px 26px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 1px;
  text-align: center;
}

.app-footer .icp-link,
.login-copyright .icp-link {
  display: inline-block;
  color: var(--muted);
  text-decoration: none;
  transition: color .15s;
}

.app-footer .icp-link { margin-left: 12px; }
.login-copyright .icp-link { margin-top: 6px; }

.app-footer .icp-link:hover,
.login-copyright .icp-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* ---------------------------------------------------------------- 卡片/工具栏 */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(17, 28, 54, .03);
}

.card + .card { margin-top: 16px; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: 15px; font-weight: 600; }
.card-head .muted { margin-left: 8px; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { margin: 0; min-width: 138px; }
.filters .field.wide { min-width: 210px; }
.filters .field > span { font-size: 12px; margin-bottom: 5px; }

/* ---------------------------------------------------------------- 表格 */
.table-wrap { overflow: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  vertical-align: middle;
}
.table th {
  background: #f8fafd;
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  white-space: nowrap;
}
.table tbody tr:hover { background: #fafcff; }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.actions { white-space: nowrap; }
.table td.actions .btn + .btn { margin-left: 6px; }
.table .cell-main { font-weight: 500; color: var(--text); }
.table .cell-sub { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }

.checkbox { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

.thumb {
  width: 62px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #f2f5fa;
}
.thumb-empty {
  width: 62px;
  height: 40px;
  border-radius: 6px;
  border: 1px dashed var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b3bccd;
  font-size: 11px;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 11.5px;
  white-space: nowrap;
}
.badge-green { background: var(--success-soft); color: var(--success); }
.badge-blue { background: var(--info-soft); color: var(--primary); }
.badge-gray { background: #f0f2f7; color: #6b7690; }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-orange { background: var(--warning-soft); color: var(--warning); }

.empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--muted);
}
.empty strong { display: block; font-size: 14px; color: var(--text-2); margin-bottom: 6px; }

/* ---------------------------------------------------------------- 分页 */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
}
.pager-btns { display: flex; align-items: center; gap: 6px; }
.pager-btns .btn { min-width: 32px; padding: 0 8px; }
.pager-btns .btn.current { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager select { width: 92px; height: 28px; font-size: 12px; }

/* ---------------------------------------------------------------- 统计 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.stat-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px 18px;
  overflow: hidden;
}
.stat-card::after {
  content: "";
  position: absolute;
  right: -20px;
  top: -20px;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: var(--primary-soft);
  opacity: .65;
}
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { margin-top: 8px; font-size: 27px; font-weight: 600; letter-spacing: .5px; }
.stat-value small { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.stat-foot { margin-top: 7px; font-size: 11.5px; color: var(--muted); }

.grid-2 { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; }
.grid-2 > .card { margin-top: 0; }

.rank-list { display: grid; gap: 13px; }
.rank-item { display: flex; align-items: center; gap: 12px; }
.rank-no {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 6px;
  background: #f1f4fa;
  color: var(--muted);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rank-item:nth-child(1) .rank-no { background: var(--primary); color: #fff; }
.rank-info { flex: 1; min-width: 0; }
.rank-info strong { display: block; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-info span { color: var(--muted); font-size: 11.5px; }
.rank-value { font-size: 13px; color: var(--primary); }

/* ---------------------------------------------------------------- 弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(14, 21, 38, .48);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 70px 20px 40px;
  z-index: 100;
  overflow: auto;
}
.modal {
  width: 560px;
  max-width: 100%;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(10, 18, 36, .28);
  animation: modal-in .16s ease-out;
}
@keyframes modal-in { from { transform: translateY(-8px); opacity: .6; } to { transform: none; opacity: 1; } }

.modal.wide { width: 820px; }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 16px; }
.modal-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
}
.modal-close:hover { background: #f2f4f9; color: var(--text); }
.modal-body { padding: 20px; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .span-2 { grid-column: span 2; }
.hint { color: var(--muted); font-size: 11.5px; margin-top: 5px; line-height: 1.6; }

.image-upload { display: flex; align-items: center; gap: 14px; }
.image-preview {
  width: 132px;
  height: 82px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #f8fafd center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b3bccd;
  font-size: 12px;
  overflow: hidden;
}
.image-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ---------------------------------------------------------------- 核销 */
.verify-box {
  max-width: 760px;
  margin: 0 auto;
  padding: 26px;
}
.verify-input-row { display: flex; gap: 10px; }
.verify-input-row .input {
  height: 46px;
  font-size: 17px;
  letter-spacing: 1.5px;
  font-family: Consolas, "Courier New", monospace;
}
.verify-input-row .btn { height: 46px; padding: 0 26px; font-size: 15px; }

.verify-result { margin-top: 20px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.verify-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #f8fafd;
  border-bottom: 1px solid var(--line);
}
.verify-head strong { font-size: 15px; }
.kv-list { display: grid; grid-template-columns: 1fr 1fr; }
.kv { padding: 13px 18px; border-bottom: 1px solid var(--line); }
.kv:nth-child(odd) { border-right: 1px solid var(--line); }
.kv span { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 4px; }
.kv strong { font-weight: 500; font-size: 13.5px; }
.verify-actions { padding: 16px 18px; display: flex; gap: 10px; align-items: center; }
.verify-tip { padding: 13px 18px; background: var(--danger-soft); color: var(--danger); font-size: 13px; }
.verify-tip.ok { background: var(--success-soft); color: var(--success); }

/* ---------------------------------------------------------------- 其他 */
.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 5px;
  background: #f2f5fa;
  color: var(--text-2);
  font-size: 11.5px;
}
.tag + .tag { margin-left: 6px; }

.alert {
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.7;
}
.alert-info { background: var(--info-soft); color: var(--primary-dark); }
.alert-warn { background: var(--warning-soft); color: var(--warning); }

.toast-root {
  position: fixed;
  top: 18px;
  right: 22px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.toast {
  min-width: 220px;
  max-width: 380px;
  padding: 11px 15px;
  border-radius: 9px;
  background: #1f2a3f;
  color: #fff;
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: toast-in .18s ease-out;
}
.toast.success { background: #0f7a4c; }
.toast.error { background: #b52f35; }
@keyframes toast-in { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }

.loading { padding: 40px; text-align: center; color: var(--muted); }

.section-title { font-size: 14px; font-weight: 600; margin: 6px 0 12px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

.selected-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 12.5px;
  border-bottom: 1px solid #d8e4ff;
}

.code-cell { font-family: Consolas, "Courier New", monospace; font-size: 13px; letter-spacing: .5px; }
