/* ===========================================================
   Max Station · 全局设计系统 —— 多彩卡片风
   模块自己的样式由各模块 JS 注入,这里只放公共部分
   =========================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #232a36;
  --muted: #8a93a6;
  --line: #e6e9f2;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 10px rgba(35, 42, 54, .06);
  --shadow-lift: 0 10px 28px rgba(35, 42, 54, .14);

  /* 八色卡片调色板:模块/标签/事件统一从这里取色 */
  --blue:   #4f7cf7; --blue-soft:   #e8eeff;
  --orange: #ff9f43; --orange-soft: #fff3e4;
  --green:  #2ecc8f; --green-soft:  #e3f9f0;
  --red:    #ff6b6b; --red-soft:    #ffe9e9;
  --purple: #9b6bf2; --purple-soft: #f1e9ff;
  --teal:   #19b8c4; --teal-soft:   #e2f8fa;
  --pink:   #f368a0; --pink-soft:   #fde9f2;
  --yellow: #f7c948; --yellow-soft: #fdf4d9;

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Segoe UI", "Noto Sans SC", sans-serif;
}

html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ---------- 整体布局 ---------- */
#app { display: flex; height: 100vh; }

#sidebar {
  width: 224px; flex: none;
  background: var(--card);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 20px 14px 14px;
}
.logo { font-size: 19px; font-weight: 800; padding: 4px 10px 18px; letter-spacing: .2px; }

#nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: none; background: none;
  border-radius: 12px; font-size: 15px; font-weight: 600;
  color: var(--muted); cursor: pointer; text-align: left;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--bg); color: var(--ink); }
.nav-icon { font-size: 18px; line-height: 1; }
.nav-badge {
  margin-left: auto; font-size: 11px; font-weight: 700;
  background: var(--red); color: #fff;
  border-radius: 99px; padding: 1px 7px; line-height: 1.5;
}

.sidebar-foot {
  display: flex; flex-direction: column; gap: 6px;
  padding-top: 12px; border-top: 1px solid var(--line);
}
.ghost-btn {
  border: none; background: var(--bg); color: var(--muted);
  font-size: 13px; font-weight: 600; padding: 8px 10px;
  border-radius: 10px; cursor: pointer; text-align: left;
  transition: background .15s, color .15s;
}
.ghost-btn:hover { background: var(--line); color: var(--ink); }
.visit-stat {
  font-size: 12px; color: var(--muted);
  text-align: center; padding-top: 8px;
}

#main { flex: 1; overflow-y: auto; padding: 28px 32px; }

/* ---------- 模块页头 ---------- */
.module-head { margin-bottom: 20px; }
.module-head h1 { font-size: 24px; font-weight: 800; line-height: 1.3; }
.module-sub { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* ---------- 公共组件 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 10px; cursor: pointer;
  font-size: 14px; font-weight: 700; padding: 8px 16px;
  transition: filter .15s, transform .1s;
}
.btn:hover { filter: brightness(.96); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--blue); color: #fff; }
.btn.danger  { background: var(--red);  color: #fff; }
.btn.ghost   { background: var(--bg);   color: var(--ink); }
.btn.small   { font-size: 13px; padding: 5px 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.input, .select, textarea.input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 8px 12px; font-size: 14px; background: #fff; color: var(--ink);
  outline: none; transition: border-color .15s;
}
.input:focus, .select:focus, textarea.input:focus { border-color: var(--blue); }
textarea.input { resize: vertical; line-height: 1.6; }

.field { margin-bottom: 12px; }
.field-label {
  display: block; font-size: 13px; font-weight: 700;
  color: var(--muted); margin-bottom: 5px;
}

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600;
  padding: 2px 9px; border-radius: 99px; line-height: 1.6;
}

.empty-state { text-align: center; color: var(--muted); padding: 48px 20px; font-size: 14px; }
.empty-icon { font-size: 42px; margin-bottom: 10px; line-height: 1; }

/* ---------- 弹窗 ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(30, 35, 45, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; transition: opacity .18s;
}
.modal-overlay.open { opacity: 1; }
.modal {
  background: #fff; border-radius: 18px;
  width: 100%; max-width: 460px; max-height: 86vh; overflow-y: auto;
  padding: 20px 22px; box-shadow: var(--shadow-lift);
  transform: translateY(10px) scale(.98); transition: transform .18s;
}
.modal-overlay.open .modal { transform: none; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h3 { font-size: 17px; font-weight: 800; }
.modal-x {
  border: none; background: var(--bg); color: var(--muted);
  width: 28px; height: 28px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.modal-x:hover { background: var(--line); color: var(--ink); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.confirm-msg { font-size: 14.5px; }

/* ---------- Toast ---------- */
#toast-wrap {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px;
  align-items: center; pointer-events: none;
}
.toast {
  background: var(--ink); color: #fff;
  padding: 9px 16px; border-radius: 12px;
  font-size: 14px; font-weight: 600;
  opacity: 0; transform: translateY(-8px);
  transition: opacity .25s, transform .25s;
  box-shadow: var(--shadow-lift); max-width: 80vw;
}
.toast.show { opacity: 1; transform: none; }
.toast-success { background: var(--green); }
.toast-error   { background: var(--red); }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d3d8e5; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #b9c0d2; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 移动端:侧边栏变顶栏 ---------- */
@media (max-width: 800px) {
  #app { flex-direction: column; height: auto; min-height: 100vh; }
  #sidebar {
    width: 100%; flex-direction: row; align-items: center; gap: 4px;
    padding: 8px 12px; position: sticky; top: 0; z-index: 50;
    border-right: none; border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }
  .logo { padding: 0 6px 0 0; font-size: 16px; white-space: nowrap; }
  .logo span { display: none; }
  #nav { flex-direction: row; flex: 1; gap: 2px; }
  .nav-item { padding: 8px 10px; white-space: nowrap; }
  .nav-name { display: none; }
  .sidebar-foot {
    flex-direction: row; padding-top: 0; border-top: none; flex: none;
  }
  .ghost-btn { white-space: nowrap; font-size: 12px; padding: 6px 8px; }
  #main { padding: 16px; }
}
