/* ============================================================
   theme.css —— 全站设计系统（浅色 / 克制 / 产品化）
   前台、登录页、后台共用。设计原则：
     · 中性暖灰打底，只用一种主色（墨绿），颜色数量压到最低
     · 边框 1px、阴影极淡，靠留白和字重分层，不靠渐变发光
     · 圆角统一 6-8px，图标一律线条 SVG（不用 emoji）
   后台专属布局在 style.css。
   ============================================================ */

:root {
  --bg:          #fafaf9;
  --surface:     #ffffff;
  --surface-2:   #f5f5f4;
  --surface-3:   #efefed;

  --border:      #e7e5e4;
  --border-2:    #d6d3d1;

  --text:        #1c1917;
  --text-2:      #57534e;
  --text-3:      #a8a29e;

  --accent:      #1e4d3f;
  --accent-h:    #163b30;
  --accent-tint: #f0f5f3;
  --accent-line: #cfe0da;

  --ok:          #15803d;
  --ok-tint:     #f0fdf4;
  --warn:        #b45309;
  --warn-tint:   #fffbeb;
  --danger:      #b91c1c;
  --danger-tint: #fef2f2;
  --danger-line: #f2d5d5;

  --r:      6px;
  --r-lg:   8px;
  --shadow: 0 1px 2px rgba(28, 25, 23, .04);
  --shadow-md: 0 4px 12px -2px rgba(28, 25, 23, .08), 0 2px 4px -2px rgba(28, 25, 23, .04);
  --h: 34px;                 /* 控件统一高度：按钮 / 输入框对齐 */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 数字一律等宽，表格和时长列不会跳动 */
.tnum, td, .stat, .song-meta { font-variant-numeric: tabular-nums; }

.hidden { display: none !important; }
.muted  { color: var(--text-2); }
.faint  { color: var(--text-3); }
.mono   { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: .94em; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

::selection { background: #d7e6e0; }

hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

/* 线条图标：统一以 currentColor 描边，尺寸靠 font-size 无关的 width/height */
.ico {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.ico-sm { width: 14px; height: 14px; }

/* ============================================================
   顶栏
   ============================================================ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 56px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text) !important;
  text-decoration: none !important;
  flex: 0 0 auto;
}

.brand-mark {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--r);
  background: var(--accent);
  color: #fff;
}

.brand-mark .ico { width: 15px; height: 15px; }

.brand-name { font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; }

.brand-sep { width: 1px; height: 18px; background: var(--border); }

.brand-sub { font-size: 12.5px; color: var(--text-3); }

/* 主导航：文字标签 + 底部指示线，不用胶囊按钮 */
.nav { display: flex; align-items: center; gap: 4px; margin-right: auto; }

.nav-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  font-size: 13.5px;
  color: var(--text-2);
  background: transparent;
  border: 0;
  border-radius: var(--r);
  cursor: pointer;
  transition: color .12s, background .12s;
}

.nav-item:hover { color: var(--text); background: var(--surface-2); }
.nav-item.active { color: var(--text); font-weight: 500; }
.nav-item.active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -12px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.user-area { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }

.who {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

.who b { color: var(--text); font-weight: 500; }

.who .avatar {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-tint);
  border: 1px solid var(--accent-line);
  flex: 0 0 auto;
}

.who .rank {
  font-size: 11.5px;
  color: var(--accent);
  background: var(--accent-tint);
  border: 1px solid var(--accent-line);
  border-radius: 4px;
  padding: 0 5px;
}

/* ============================================================
   布局
   ============================================================ */

main { max-width: 1200px; margin: 0 auto; padding: 28px 24px 80px; }

.panel { display: flex; flex-direction: column; gap: 20px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}

.card-body { padding: 20px; }

/* 区块头：标题 + 右侧操作，1px 分隔线 */
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.card-head h2,
.card-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.head-note { font-size: 12.5px; color: var(--text-3); }

/* 页面标题区：不要大数字卡片，一行文字就够 */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 21px; font-weight: 600; letter-spacing: -.015em; }
.page-head p { margin: 5px 0 0; font-size: 13px; color: var(--text-2); }

.summary { font-size: 13px; color: var(--text-2); }
.summary b { color: var(--text); font-weight: 500; }
.summary .sep { color: var(--border-2); margin: 0 8px; }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ============================================================
   按钮
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--h);
  padding: 0 13px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  box-shadow: 0 1px 1px rgba(28, 25, 23, .03);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none !important;
  transition: background .12s, border-color .12s, color .12s;
}

.btn:hover { background: var(--surface-2); }
.btn:active { background: var(--surface-3); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

.btn.primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 1px 1px rgba(28, 25, 23, .06);
}
.btn.primary:hover { background: var(--accent-h); border-color: var(--accent-h); }
.btn.primary:active { background: #102d25; }

.btn.danger { color: var(--danger); border-color: var(--danger-line); }
.btn.danger:hover { background: var(--danger-tint); }

.btn.plain { border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.plain:hover { background: var(--surface-2); color: var(--text); }

.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.lg { height: 38px; padding: 0 18px; font-size: 13.5px; }
.btn.block { width: 100%; }

/* ============================================================
   表单
   ============================================================ */

input[type="text"],
input[type="password"],
input[type="search"],
input[type="file"],
select,
textarea {
  width: 100%;
  min-width: 0;
  height: var(--h);
  padding: 0 11px;
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  box-shadow: 0 1px 1px rgba(28, 25, 23, .03);
  transition: border-color .12s, box-shadow .12s;
}

textarea { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; line-height: 1.6; }

input::placeholder, textarea::placeholder { color: var(--text-3); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30, 77, 63, .1);
}

input[type="file"] { padding: 5px 10px; cursor: pointer; font-size: 13px; color: var(--text-2); }
input[type="file"]::file-selector-button {
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  height: 24px;
  margin-right: 10px;
  padding: 0 10px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 5px;
  cursor: pointer;
}
input[type="file"]::file-selector-button:hover { background: var(--surface-3); }

select { cursor: pointer; }

label.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

.field-hint { font-size: 12px; color: var(--text-3); font-weight: 400; }

/* 搜索框：图标内嵌 */
.search { position: relative; flex: 1 1 260px; min-width: 0; }
.search input { padding-left: 33px; }
.search .ico {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

/* ============================================================
   表格
   ============================================================ */

.table-wrap { width: 100%; overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th {
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  text-align: left;
  white-space: nowrap;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

th:first-child { border-top-left-radius: var(--r-lg); }
th:last-child { border-top-right-radius: var(--r-lg); }

td {
  padding: 11px 14px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fcfcfb; }
td.actions { white-space: nowrap; }

.cell-sub { font-size: 12px; color: var(--text-3); }

/* ============================================================
   徽标：圆点 + 文字，低饱和
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 21px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 4px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}

.badge.pending  { color: var(--warn);   background: var(--warn-tint);   border-color: #f0dfc0; }
.badge.approved { color: var(--ok);     background: var(--ok-tint);     border-color: #d3e8d8; }
.badge.rejected { color: var(--danger); background: var(--danger-tint); border-color: var(--danger-line); }
.badge.muted    { color: var(--text-2); background: var(--surface-2);   border-color: var(--border); }

/* ============================================================
   曲库列表（行式，信息密度高于卡片网格）
   ============================================================ */

.song-list { margin: 0; padding: 0; list-style: none; }

.song-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}

.song-row:last-child { border-bottom: 0; }
.song-row:hover { background: #fcfcfb; }

.song-row .idx {
  width: 22px;
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.song-row .info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.song-row .name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-row .by { font-size: 12.5px; color: var(--text-3); }

.song-row .facts {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 0 0 auto;
  font-size: 12.5px;
  color: var(--text-2);
}

.song-row .facts span { display: inline-flex; align-items: baseline; gap: 5px; }
.song-row .facts i { font-style: normal; color: var(--text-3); font-size: 11.5px; }

.song-row .ops { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

/* ============================================================
   步骤（提交向导）
   ============================================================ */

.steps { display: flex; align-items: center; gap: 0; }
.steps .step { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-3); }
.steps .step .n {
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 11.5px;
  font-weight: 500;
  border: 1px solid var(--border-2);
  background: var(--surface);
}
.steps .step.on { color: var(--text); font-weight: 500; }
.steps .step.on .n { color: #fff; background: var(--accent); border-color: var(--accent); }
.steps .line { width: 30px; height: 1px; background: var(--border); margin: 0 12px; }

/* ============================================================
   音符表
   ============================================================ */

.notes {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  /* 音数上千时用 content-visibility 让浏览器跳过视口外的布局计算 */
  content-visibility: auto;
  contain-intrinsic-size: auto 320px;
}

.note-row {
  display: grid;
  grid-template-columns: 68px 62px 1fr;
  gap: 12px;
  align-items: center;
  padding: 5px 12px;
  font-size: 12.5px;
  color: var(--text-2);
  border-bottom: 1px solid #f5f5f4;
  content-visibility: auto;
  contain-intrinsic-size: 27px;
}

.note-row:last-child { border-bottom: 0; }
.note-row .t { color: var(--text-3); font-variant-numeric: tabular-nums; }
.note-row .p { color: var(--text); font-weight: 500; font-family: ui-monospace, Consolas, monospace; }
.note-row .d { color: var(--text-3); font-variant-numeric: tabular-nums; }

.note-row.playing {
  background: var(--accent-tint);
  box-shadow: inset 2px 0 0 var(--accent);
}
.note-row.playing .p { color: var(--accent); }

/* ============================================================
   空状态 / 提示
   ============================================================ */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 56px 24px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

.empty .ico { width: 22px; height: 22px; color: var(--border-2); }

.note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 14px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-2);
  background: var(--accent-tint);
  border: 1px solid var(--accent-line);
  border-radius: var(--r);
}

.note .ico { margin-top: 2px; color: var(--accent); }

/* 元信息行 */
.meta { display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); }
.meta b { color: var(--text); font-weight: 500; }
.meta .k { color: var(--text-3); }

/* ============================================================
   Toast / 模态
   ============================================================ */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 90;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  box-shadow: var(--shadow-md);
  max-width: min(88vw, 520px);
}

.toast.ok::before,
.toast.err::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.toast.ok::before { background: var(--ok); }
.toast.err::before { background: var(--danger); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(28, 25, 23, .32);
}

.modal[hidden] { display: none; }

.modal .box {
  width: 380px;
  max-width: 100%;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
}

.modal .box h3 { margin: 0; font-size: 15px; font-weight: 600; }

/* ============================================================
   登录 / 注册页：居中窄卡片，不做大 hero
   ============================================================ */

.auth-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 384px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.auth-head { text-align: center; margin-bottom: 22px; }

.auth-head .brand-mark { width: 34px; height: 34px; margin: 0 auto 14px; border-radius: 8px; }
.auth-head .brand-mark .ico { width: 18px; height: 18px; }

.auth-head h1 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.auth-head p { margin: 5px 0 0; font-size: 13px; color: var(--text-2); }

.toggle {
  display: flex;
  padding: 3px;
  margin-bottom: 20px;
  background: var(--surface-2);
  border-radius: var(--r);
}

.toggle button,
.toggle .auth-tab {
  flex: 1;
  height: 30px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  transition: color .12s, background .12s;
}

.toggle button:hover,
.toggle .auth-tab:hover { color: var(--text); }

.toggle button.active,
.toggle .auth-tab.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(28, 25, 23, .06);
}

.auth-form { display: flex; flex-direction: column; gap: 15px; }
.auth-form .tip { font-size: 12.5px; color: var(--text-3); }
.auth-form .err { font-size: 12.5px; color: var(--danger); min-height: 19px; }

.auth-foot {
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  line-height: 1.7;
}

.page-foot { margin-top: 24px; font-size: 12px; color: var(--text-3); }

/* ============================================================
   响应式
   ============================================================ */

@media (max-width: 860px) {
  .topbar-inner { height: auto; min-height: 56px; flex-wrap: wrap; gap: 12px; padding: 10px 16px; }
  .nav { order: 3; width: 100%; margin: 0; overflow-x: auto; }
  .nav-item.active::after { bottom: -10px; }
  main { padding: 20px 16px 64px; }
  .user-area { margin-left: auto; }
  .who { padding-left: 0; border-left: 0; }
  .brand-sub, .brand-sep { display: none; }

  .song-row { flex-wrap: wrap; gap: 10px; }
  .song-row .facts { gap: 14px; }
  .song-row .ops { margin-left: auto; }
  .card-head { padding: 12px 16px; }
  .card-body { padding: 16px; }
}

@media (max-width: 560px) {
  .page-head h1 { font-size: 18px; }
  .song-row { padding: 12px 16px; }
  .song-row .idx { display: none; }
  .toast { left: 16px; right: 16px; transform: none; max-width: none; }
  .auth-card { padding: 22px; border: 0; box-shadow: none; background: transparent; }
}
