/* 云票达 · 应用页共享壳（客户/历史/设置）— 对照 preview 定稿，无 preview-strip */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #3b6df0;
  --primary-light: #e8edfe;
  --primary-dark: #2b54c8;
  --surface: #ffffff;
  --bg: #f5f6fa;
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 12px rgba(0,0,0,0.08);
  --sidebar-w: 248px;
  --content-max: 920px;
  --content-max-narrow: 760px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
}
.sidebar-logo {
  padding: 18px 22px 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.sidebar-logo .brand { font-size: 21px; font-weight: 700; }
.sidebar-logo .sub { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 8px 14px; list-style: none; display: flex; flex-direction: column; }
.sidebar-nav a,
.sidebar-nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  margin-bottom: 2px;
  transition: all 0.15s;
  cursor: pointer;
}
.sidebar-nav a:hover,
.sidebar-nav button:hover { background: var(--primary-light); color: var(--primary); }
.sidebar-nav a.active,
.sidebar-nav button.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--primary);
}
.sidebar-nav .dot-badge {
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  display: none;
}
.sidebar-nav .dot-badge.show { display: block; }
.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.sidebar-footer button {
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 13px;
}
.sidebar-footer button:hover { color: var(--danger); }
.sidebar-foot-link {
  display: flex; align-items: center; gap: 8px;
  padding: 0 0 10px; margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 500; color: var(--text-secondary); text-decoration: none;
}
.sidebar-foot-link:hover { color: var(--primary); }
.sidebar-foot-link.active { color: var(--primary); font-weight: 600; }

.app-shell {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
}
.main {
  flex: 0 1 var(--content-max);
  width: 100%;
  max-width: var(--content-max);
  min-width: 0;
  padding: 20px 28px 32px;
}
.main.main-narrow { max-width: var(--content-max-narrow); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.topbar h1 { font-size: 22px; font-weight: 700; }

.yunpia-back {
  display: inline-block;
  font-size: 13px;
  color: var(--primary);
  margin-top: 6px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
}
.yunpia-back:hover { text-decoration: underline; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  font-weight: 500;
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-ghost.active { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); font-weight: 500; }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 4px 12px; font-size: 12px; font-weight: 500; }
.btn-outline { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); font-weight: 500; }
.btn-outline:hover { background: var(--bg); color: var(--text); }

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.stat-card .label { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.stat-card .value { font-size: 24px; font-weight: 700; }
.stat-card .value.success { color: var(--success); }
.stat-card .sub { font-size: 11px; color: var(--success); margin-top: 4px; }

.yunpia-banner-slot { margin-bottom: 16px; }
.yunpia-banner-slot:empty { display: none; }
.hint-text { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 16px; }

.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 8px; line-height: 1.5; }
.alert-danger { background: #fce8e6; color: #c5221f; border: 1px solid #f5c6c2; }
.alert-warn { background: #fef7e0; color: #b06000; border: 1px solid #f9e6b8; }
.alert-info { background: #e8f0fe; color: #1a56db; border: 1px solid #c2d7f7; }

.search-bar { display: flex; gap: 12px; margin-bottom: 20px; }
.search-input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,109,240,0.1); }
.search-input::placeholder { color: #9ca3af; }

.empty-state { display: none; text-align: center; padding: 80px 20px; color: var(--text-secondary); }
.empty-state.show { display: block; }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; color: var(--text); margin-bottom: 8px; }
.empty { text-align: center; padding: 48px 20px; color: var(--text-secondary); font-size: 14px; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
  padding: 20px;
  overflow: auto;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 48px rgba(0,0,0,0.15);
  margin: 40px auto;
  animation: yunpiaModalIn 0.25s ease;
}
@keyframes yunpiaModalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 { font-size: 17px; font-weight: 600; }
.modal-header .close {
  cursor: pointer;
  font-size: 22px;
  color: var(--text-secondary);
  padding: 4px;
  border: none;
  background: none;
  line-height: 1;
}
.modal-body { padding: 24px; max-height: 70vh; overflow-y: auto; }
.modal-footer {
  padding: 12px 24px 24px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,109,240,0.1);
}

.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.tag-demo { background: #fef7e0; color: #b06000; }

/* 全站轻提示（客户/历史/设置等共用壳页面） */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.45;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  max-width: min(440px, calc(100vw - 32px));
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.success {
  border-color: #a7f3d0;
  background: #ecfdf5;
  color: #065f46;
}
.toast.err {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

@media (min-width: 1400px) {
  :root { --content-max: 960px; }
}

@media (max-width: 768px) {
  body { display: block; }
  .sidebar { display: none; }
  .app-shell { margin-left: 0; width: 100%; }
  .main { padding: 16px; max-width: 100%; flex: 1 1 auto; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
