/* =========================================================
   校园超市进销存管理系统 — 前端样式
   设计：深色侧栏 + 浅色内容区，主色青绿，数据卡片化
   ========================================================= */
:root {
  --brand: #0e7c66;
  --brand-light: #14b8a6;
  --brand-soft: #e6f6f2;
  --accent: #f59e0b;
  --danger: #e5484d;
  --info: #2563eb;
  --text: #1f2937;
  --text-2: #64748b;
  --text-3: #94a3b8;
  --line: #e8edf3;
  --bg: #f4f6f9;
  --white: #ffffff;
  --sidebar: #0f172a;
  --sidebar-2: #16213a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  color: var(--text);
  background: var(--bg);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 登录页 ---------------- */
.login-wrap {
  position: fixed; inset: 0; z-index: 50;
  display: grid; grid-template-columns: 1.1fr .9fr;
  background: var(--white);
}
.login-brand {
  background: radial-gradient(1200px 600px at 15% 10%, #14b8a6 0%, #0e7c66 42%, #0b5b4c 100%);
  color: #fff; padding: 64px 60px; position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
}
.login-brand::after {
  content: ""; position: absolute; width: 520px; height: 520px; right: -140px; bottom: -220px;
  background: radial-gradient(circle, rgba(255, 255, 255, .18), transparent 62%);
}
.login-brand .mark { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 15px; letter-spacing: .5px; }
.login-brand .mark-badge {
  width: 38px; height: 38px; border-radius: 11px; background: rgba(255, 255, 255, .16);
  display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, .28);
}
.login-brand h1 { font-size: 40px; line-height: 1.25; margin: 0 0 14px; letter-spacing: 1px; font-weight: 700; }
.login-brand p.sub { margin: 0; opacity: .82; font-size: 15px; letter-spacing: .6px; }
.login-features { display: grid; gap: 14px; margin-top: 26px; position: relative; z-index: 2; }
.login-features div { display: flex; align-items: center; gap: 10px; font-size: 14px; opacity: .92; }
.login-features svg { flex: none; opacity: .9; }
.login-foot { font-size: 12px; opacity: .62; position: relative; z-index: 2; }

.login-panel { display: grid; place-items: center; padding: 40px; background: #fbfcfd; }
.login-card { width: 100%; max-width: 360px; }
.login-card h2 { font-size: 26px; margin: 0 0 6px; }
.login-card .tip { color: var(--text-2); margin: 0 0 28px; font-size: 13px; }
.login-field { margin-bottom: 18px; }
.login-field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 7px; letter-spacing: .4px; }
.login-field input {
  width: 100%; height: 46px; border: 1px solid #dde4ec; border-radius: 10px; padding: 0 14px;
  font-size: 14px; outline: none; transition: border-color .2s, box-shadow .2s; background: #fff;
}
.login-field input:focus { border-color: var(--brand-light); box-shadow: 0 0 0 4px rgba(20, 184, 166, .12); }
.login-btn {
  width: 100%; height: 46px; border: 0; border-radius: 10px; color: #fff; cursor: pointer;
  background: linear-gradient(135deg, #14b8a6, #0e7c66); font-size: 15px; font-weight: 600; letter-spacing: 2px;
  box-shadow: 0 10px 22px -12px rgba(14, 124, 102, .9); transition: transform .15s, box-shadow .2s;
}
.login-btn:hover { transform: translateY(-1px); }
.login-btn:disabled { opacity: .7; cursor: default; transform: none; }
.login-accounts { margin-top: 26px; border-top: 1px dashed var(--line); padding-top: 16px; font-size: 12px; color: var(--text-3); line-height: 1.9; }
.login-accounts b { color: var(--text-2); font-weight: 600; }
.login-error { color: var(--danger); font-size: 13px; min-height: 20px; margin-bottom: 6px; }

/* ---------------- 应用框架 ---------------- */
.app { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 224px; flex: none; background: linear-gradient(180deg, var(--sidebar), #111c33 100%);
  color: #cbd5e1; display: flex; flex-direction: column; position: relative; z-index: 20;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.logo-badge {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #14b8a6, #0e7c66); color: #fff; box-shadow: 0 6px 14px -8px #14b8a6;
}
.logo-text { font-size: 14px; font-weight: 700; color: #f1f5f9; line-height: 1.3; }
.logo-text span { display: block; font-size: 10.5px; font-weight: 400; color: #7c8ba1; letter-spacing: .8px; margin-top: 2px; }
.nav { flex: 1; overflow-y: auto; padding: 6px 10px 20px; }
.nav::-webkit-scrollbar-thumb { background: #2b3a52; }
.nav-group-title { font-size: 10.5px; color: #5f7189; letter-spacing: 1.4px; padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 9px; height: 38px; padding: 0 10px; border-radius: 9px;
  color: #b6c2d2; font-size: 13px; cursor: pointer; margin-bottom: 2px; position: relative;
  transition: background .15s, color .15s;
}
.nav-item svg { opacity: .78; flex: none; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: rgba(20, 184, 166, .14); color: #5eead4; }
.nav-item.active::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px;
  background: var(--brand-light);
}
.nav-badge {
  margin-left: auto; background: rgba(245, 158, 11, .18); color: #fbbf24;
  font-size: 10px; padding: 1px 6px; border-radius: 20px; font-weight: 600;
}
.sidebar-foot { padding: 12px 16px 16px; border-top: 1px solid rgba(255, 255, 255, .07); font-size: 11px; color: #5f7189; display: flex; justify-content: space-between; align-items: center; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 60px; flex: none; background: rgba(255, 255, 255, .86); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 22px;
  position: relative; z-index: 10;
}
.menu-toggle { display: none; border: 0; background: none; cursor: pointer; color: var(--text-2); }
.crumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-3); }
.crumb b { color: var(--text); font-weight: 600; font-size: 15px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.todo-chip {
  display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px; border-radius: 20px;
  background: #fff7ed; color: #b45309; font-size: 12px; border: 1px solid #fde3c0; cursor: pointer;
}
.user-chip { display: flex; align-items: center; gap: 9px; padding: 4px 10px 4px 4px; border-radius: 22px; background: #f1f5f9; cursor: pointer; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, #14b8a6, #0e7c66); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.user-meta { line-height: 1.25; }
.user-meta b { display: block; font-size: 12.5px; font-weight: 600; }
.user-meta span { font-size: 10.5px; color: var(--text-3); }
.user-menu {
  position: absolute; top: 56px; right: 22px; min-width: 168px; background: #fff; border-radius: 12px;
  box-shadow: 0 18px 40px -12px rgba(15, 23, 42, .3); border: 1px solid var(--line); padding: 6px; display: none; z-index: 40;
}
.user-menu.show { display: block; }
.user-menu button { display: flex; width: 100%; align-items: center; gap: 8px; border: 0; background: none; padding: 9px 10px; border-radius: 8px; font-size: 13px; color: var(--text); cursor: pointer; text-align: left; }
.user-menu button:hover { background: #f4f6f9; }
.user-menu .sep { height: 1px; background: var(--line); margin: 4px 2px; }

.view { flex: 1; overflow-y: auto; padding: 20px 22px 40px; }
.page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 19px; letter-spacing: .3px; }
.page-head p { margin: 4px 0 0; color: var(--text-2); font-size: 12.5px; }
.page-head .spacer { margin-left: auto; }

/* ---------------- 通用组件 ---------------- */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid rgba(232, 237, 243, .9); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; }
.card-head .sub { color: var(--text-3); font-size: 12px; }
.card-head .spacer { margin-left: auto; }
.card-body { padding: 16px 18px; }
.card-body.tight { padding: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat {
  background: #fff; border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
  border: 1px solid rgba(232, 237, 243, .9); position: relative; overflow: hidden;
}
.stat::after { content: ""; position: absolute; right: -30px; top: -30px; width: 92px; height: 92px; border-radius: 50%; background: var(--brand-soft); opacity: .55; }
.stat .label { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 26px; font-weight: 700; margin: 8px 0 2px; letter-spacing: .5px; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--text-2); margin-left: 4px; }
.stat .foot { font-size: 11.5px; color: var(--text-3); display: flex; gap: 10px; flex-wrap: wrap; }
.stat .foot em { font-style: normal; color: var(--brand); font-weight: 600; }
.stat.warn::after { background: #fff1f0; }
.stat.warn .value { color: var(--danger); }

.toolbar { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin-bottom: 14px; }
.toolbar .spacer { margin-left: auto; }

.btn {
  height: 34px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line); background: #fff;
  color: var(--text); font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: #cfd8e3; background: #fafbfc; }
.btn-primary { background: linear-gradient(135deg, #14b8a6, #0e7c66); border-color: transparent; color: #fff; box-shadow: 0 8px 18px -10px rgba(14, 124, 102, .8); }
.btn-primary:hover { background: linear-gradient(135deg, #0fb3a0, #0b6e5a); border-color: transparent; }
.btn-danger { color: var(--danger); border-color: #f5cfd0; background: #fff6f6; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.field { display: inline-flex; align-items: center; gap: 7px; }
.field label { font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="month"], select, textarea {
  height: 34px; border: 1px solid #dfe6ee; border-radius: 8px; padding: 0 10px; font-size: 13px;
  background: #fff; color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-light); box-shadow: 0 0 0 3px rgba(20, 184, 166, .1); }
input[disabled], select[disabled] { background: #f6f8fa; color: var(--text-2); }
select { padding-right: 22px; }

.table-wrap { width: 100%; overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.table th {
  text-align: left; font-weight: 500; color: var(--text-2); font-size: 12px; padding: 11px 14px;
  background: #fafbfc; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0;
}
table.table td { padding: 11px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
table.table tbody tr:hover { background: #fbfdfd; }
table.table tbody tr:last-child td { border-bottom: 0; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.muted { color: var(--text-3); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }

.badge { display: inline-flex; align-items: center; gap: 4px; height: 21px; padding: 0 8px; border-radius: 20px; font-size: 11.5px; font-weight: 500; }
.badge.green { background: #e8f7f0; color: #0f7b52; }
.badge.gray { background: #f1f5f9; color: #64748b; }
.badge.red { background: #fef1f1; color: #cf2f34; }
.badge.amber { background: #fff7e8; color: #b45309; }
.badge.blue { background: #eff5ff; color: #2563eb; }

.tabs { display: flex; gap: 4px; background: #f1f5f9; padding: 3px; border-radius: 10px; }
.tabs button { border: 0; background: none; padding: 6px 14px; border-radius: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.tabs button.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(15, 23, 42, .1); font-weight: 600; }

.pager { display: flex; align-items: center; gap: 8px; padding: 12px 16px; color: var(--text-2); font-size: 12.5px; }
.pager .spacer { margin-left: auto; }
.pager button { min-width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 12.5px; }
.pager button.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager button[disabled] { opacity: .5; cursor: default; }

.empty { padding: 44px 20px; text-align: center; color: var(--text-3); font-size: 13px; }
.empty .big { font-size: 15px; color: var(--text-2); margin-bottom: 6px; }
.skeleton { padding: 24px; color: var(--text-3); font-size: 13px; }

.chart { width: 100%; height: 300px; }
.chart.sm { height: 240px; }
.chart.lg { height: 340px; }
.grid-2 { display: grid; grid-template-columns: 1.45fr 1fr; gap: 16px; }
.grid-2.equal { grid-template-columns: 1fr 1fr; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px);
  display: grid; place-items: center; z-index: 100; padding: 24px; animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: #fff; border-radius: 16px; width: 520px; max-width: 100%; max-height: calc(100vh - 60px);
  display: flex; flex-direction: column; box-shadow: 0 30px 70px -20px rgba(15, 23, 42, .5);
  animation: pop .18s ease;
}
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: .6 } to { transform: none; opacity: 1 } }
.modal.wide { width: 860px; }
.modal.xwide { width: 1040px; }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-head .close { margin-left: auto; border: 0; background: none; cursor: pointer; color: var(--text-3); font-size: 20px; line-height: 1; padding: 4px; }
.modal-head .close:hover { color: var(--text); }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { padding: 13px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.modal-foot .spacer { margin-left: auto; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-item label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.form-item input, .form-item select, .form-item textarea { width: 100%; }
.req::after { content: " *"; color: var(--danger); }
.hint { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }

/* 单据表格 */
.items-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.items-table th { background: #fafbfc; font-weight: 500; font-size: 12px; color: var(--text-2); padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.items-table td { padding: 7px 8px; border-bottom: 1px solid #f1f5f9; }
.items-table select, .items-table input { height: 32px; }
.items-table .del { border: 0; background: none; color: #cbd5e1; cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 6px; }
.items-table .del:hover { color: var(--danger); }
.order-total { display: flex; justify-content: flex-end; gap: 26px; padding: 14px 6px 2px; font-size: 13px; }
.order-total b { font-size: 18px; color: var(--brand); font-variant-numeric: tabular-nums; }

/* 详情单 */
.doc { font-size: 13px; }
.doc-head { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 12px; border-bottom: 2px solid #0f172a; margin-bottom: 12px; align-items: flex-end; }
.doc-head h2 { margin: 0 0 4px; font-size: 18px; letter-spacing: 2px; }
.doc-head .no { font-size: 12px; color: var(--text-2); }
.doc-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 18px; margin-bottom: 14px; font-size: 12.5px; }
.doc-meta div span { color: var(--text-3); margin-right: 6px; }
.doc-sign { display: flex; gap: 40px; margin-top: 20px; font-size: 12.5px; color: var(--text-2); }
.doc-sign div { flex: 1; border-bottom: 1px solid var(--line); padding-bottom: 18px; }

/* Toast */
.toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; }
.toast {
  min-width: 200px; max-width: 460px; background: #0f172a; color: #fff; padding: 10px 16px;
  border-radius: 10px; font-size: 13px; box-shadow: 0 18px 40px -14px rgba(0, 0, 0, .5);
  animation: toastIn .2s ease; display: flex; align-items: center; gap: 8px;
}
.toast.ok { background: #0e7c66; }
.toast.err { background: #c2333a; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px) } to { opacity: 1; transform: none } }

/* 项目符号 / 提示条 */
.notice { display: flex; gap: 10px; align-items: flex-start; background: #fffdf5; border: 1px solid #fbe6b7; color: #8a5a09; border-radius: 10px; padding: 10px 14px; font-size: 12.5px; line-height: 1.7; margin-bottom: 14px; }
.notice.info { background: #f3f8ff; border-color: #d8e5fb; color: #21518f; }

/* 响应式 */
@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .menu-toggle { display: inline-flex; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .view { padding: 14px; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ===== ICP beian footer (required by MIIT, always visible) ===== */
.site-footer { margin-top: 18px; padding: 10px 16px 4px; text-align: center; font-size: 12px; color: #8a93a5; line-height: 1.8; }
.site-footer a { color: #8a93a5; text-decoration: none; }
.site-footer a:hover { color: #0e7c66; text-decoration: underline; }
.site-footer .police { margin-left: 12px; }
.login-foot .beian { margin-top: 8px; opacity: .9; }
.login-foot .beian a { color: #d7eee9; text-decoration: none; }
.login-foot .beian a:hover { text-decoration: underline; }