/* 钢琴报修系统 — 设计稿
   设计原则参考 unslop by Damir Sokolovsky (@heydamir), CC BY 4.0 */

:root {
  /* 一条暖灰中性色阶，取自钢琴木与琴键的世界 */
  --bg: #f7f5f1;
  --surface: #ffffff;
  --raised: #f2efe9;
  --line: rgba(31, 27, 22, 0.09);
  --line-strong: rgba(31, 27, 22, 0.16);
  --ink: #201d19;
  --ink-2: #58524a;
  --ink-3: #8a8379;

  /* 单一强调色，取自黄铜/琴键木的暖琥珀 */
  --accent: #a5641f;
  --accent-hover: #8b5318;
  --accent-tint: #f6ede0;

  /* 语义色，压低饱和度 */
  --ok: #2f6b4f;
  --ok-soft: #e9f1ec;
  --urgent: #b0392e;
  --urgent-soft: #f9eae8;
  --warn: #8a6414;
  --warn-soft: #f8f0dd;

  --radius-control: 8px;
  --radius-card: 16px;
  --shadow-sm: 0 1px 2px rgba(32, 29, 25, 0.05);
  --shadow-card: 0 8px 24px rgba(32, 29, 25, 0.06);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(180deg, rgba(247,245,241,0.90) 0%, rgba(247,245,241,0.84) 45%, rgba(247,245,241,0.92) 100%),
    url("assets/hero.jpg");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- 顶栏 ---------- */

.topbar {
  height: 64px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; flex-shrink: 0; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; object-fit: cover; display: block; }
.brand-text { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }

.nav { display: flex; gap: 4px; align-items: center; }
.nav-btn {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  padding: 8px 16px;
  border-radius: var(--radius-control);
  font-size: 14px;
  font-weight: 400;
  min-height: 36px;
  white-space: nowrap;
  transition: background-color 140ms var(--ease), color 140ms var(--ease);
}
.nav-btn:hover { background: var(--raised); color: var(--ink); }
.nav-btn.active { background: var(--raised); color: var(--ink); font-weight: 500; }

.menu-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-control);
  width: 40px; height: 40px;
  padding: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
}
.menu-toggle span { display: block; width: 18px; height: 1.5px; background: var(--ink); border-radius: 2px; }

/* ---------- 主区域 ---------- */

main { max-width: 1240px; margin: 0 auto; padding: 48px 32px 96px; }
.view { animation: rise 320ms var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.eyebrow { margin: 0 0 16px; color: var(--accent); font-size: 13px; font-weight: 500; letter-spacing: 0.01em; }
h1 { margin: 0 0 16px; font-size: 48px; line-height: 1.1; letter-spacing: -0.03em; font-weight: 500; }
h2 { margin: 0 0 4px; font-size: 20px; font-weight: 500; letter-spacing: -0.01em; }
h3.subhead { margin: 32px 0 12px; font-size: 15px; font-weight: 500; }

.hero-sub { margin: 0; color: var(--ink-2); font-size: 16px; line-height: 1.65; max-width: 30rem; }
.muted { color: var(--ink-2); font-size: 13px; margin: 4px 0 0; }
.small { font-size: 12px; }
.center { text-align: center; }
.required { color: var(--accent); }

/* ---------- 报修页：非对称分栏 ---------- */

.report-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 48px;
  align-items: start;
  padding-top: 32px;
}
.report-intro { padding-top: 24px; min-width: 0; }
.intro-foot { margin: 24px 0 0; color: var(--ink-3); font-size: 13px; letter-spacing: 0.02em; }

/* 键盘视觉：产品世界里唯一的丰富时刻 */
.keyboard-visual {
  position: relative;
  margin-top: 48px;
  height: 176px;
  max-width: 460px;
  border-radius: 12px;
  background: #23201d;
  padding: 20px 20px 0;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.keyboard-keys { display: flex; gap: 3px; height: 128px; position: relative; z-index: 1; }
.keyboard-keys span {
  flex: 1;
  background: linear-gradient(180deg, #fdfcf9 0%, #eee9e0 100%);
  border-radius: 0 0 5px 5px;
  box-shadow: inset -1px 0 0 rgba(32,29,25,0.12), 0 2px 0 rgba(0,0,0,0.25);
}
.keyboard-keys.black {
  position: absolute;
  top: 20px; left: 20px; right: 20px;
  height: 78px;
  z-index: 2;
  gap: 3px;
  pointer-events: none;
}
.keyboard-keys.black span { display: none; }
.keyboard-keys.black span:nth-child(1) { display:block; margin-left: 4%; }
.keyboard-keys.black span:nth-child(2) { display:block; margin-left: 4%; }
.keyboard-keys.black span:nth-child(3) { display:block; margin-left: 7.5%; }
.keyboard-keys.black span:nth-child(4) { display:block; margin-left: 4%; }
.keyboard-keys.black span:nth-child(5) { display:block; margin-left: 7.5%; }
.keyboard-keys.black span:nth-child(6) { display:block; margin-left: 7.5%; }
.keyboard-keys.black span:nth-child(7) { display:block; margin-left: 4%; }
.keyboard-keys.black span:nth-child(8) { display:block; margin-left: 4%; }
.keyboard-keys.black span:nth-child(9) { display:block; margin-left: 7.5%; }
.keyboard-keys.black span {
  flex: 0 0 4.2%;
  height: 100%;
  background: linear-gradient(180deg, #33302c 0%, #14120f 100%);
  border-radius: 0 0 4px 4px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 3px 4px rgba(0,0,0,0.35);
}
.keyboard-felt { position: absolute; left: 0; right: 0; bottom: 20px; height: 8px; background: var(--accent); z-index: 3; }

.report-form-col { min-width: 0; }

/* ---------- 卡片与表单 ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.form-card { width: 100%; }
#report-card { background: transparent; border-color: transparent; box-shadow: none; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.pill { background: var(--raised); color: var(--ink-2); border-radius: 6px; padding: 4px 10px; font-size: 12px; white-space: nowrap; }

.field { margin-bottom: 20px; flex: 1; min-width: 0; }
.field-row { display: flex; gap: 16px; }
label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 8px; color: var(--ink); }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: var(--radius-control);
  padding: 11px 12px;
  min-height: 44px;
  font-size: 14px;
  outline: none;
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
textarea { resize: vertical; min-height: 104px; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
input[type="checkbox"] { width: auto; min-height: 0; }
input[readonly] { background: var(--raised); color: var(--ink-2); }

.btn {
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  padding: 12px 20px;
  min-height: 44px;
  font-weight: 500;
  font-size: 14px;
  transition: background-color 140ms var(--ease), color 140ms var(--ease), border-color 140ms var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn.ghost:hover { background: var(--raised); }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.inline { display: flex; gap: 12px; align-items: center; }
.inline input { flex: 1; }
.actions { margin-top: 12px; }

.form-error, .field-error { color: var(--urgent); font-size: 13px; min-height: 18px; margin: 4px 0 8px; }
.field-error { min-height: 0; margin: 4px 0 0; }

/* ---------- 成功卡片 ---------- */

.success-card { padding: 40px 28px; text-align: center; }
.success-icon { width: 52px; height: 52px; margin: 0 auto 20px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; font-size: 24px; font-weight: 500; }
.success-card .btn { margin-top: 20px; }
.feedback-code-box { background: var(--accent-tint); border: 1px solid rgba(165,100,31,0.2); border-radius: 12px; padding: 16px; margin: 20px 0 8px; }
.feedback-code-box p { margin: 0 0 8px; }
.feedback-code-box strong { font-size: 22px; letter-spacing: 0.14em; color: var(--accent); user-select: all; font-variant-numeric: tabular-nums; }

/* ---------- 进度查询 ---------- */

.query-result { margin-top: 24px; }
.query-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.query-card h3 { margin: 0 0 12px; font-size: 18px; font-weight: 500; font-variant-numeric: tabular-nums; }
.query-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.query-row:last-child { border-bottom: 0; }
.query-row span:first-child { color: var(--ink-2); }
.query-done { background: var(--ok-soft); color: var(--ok); border-radius: 12px; padding: 16px; margin-top: 16px; font-size: 14px; }

/* ---------- 后台 ---------- */

.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 28px; }
.admin-head h1 { font-size: 32px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; box-shadow: var(--shadow-sm); }
.stat strong { display: block; font-size: 28px; line-height: 1.15; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat span { color: var(--ink-2); font-size: 13px; }
.stat.urgent strong { color: var(--urgent); }

.tabs, .admin-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab, .admin-tab { border: 0; background: transparent; padding: 12px 16px; color: var(--ink-2); border-bottom: 2px solid transparent; font-size: 14px; white-space: nowrap; min-height: 44px; transition: color 140ms var(--ease); }
.tab.active, .admin-tab.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 500; }
.login-card { max-width: 440px; margin: 40px auto; }

.toolbar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; padding: 16px; }
.toolbar select, .toolbar input { width: auto; flex: 1; min-width: 160px; }
.ticket-list { display: grid; gap: 12px; }
.ticket { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; box-shadow: var(--shadow-sm); }
.ticket-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.ticket-title { font-weight: 500; font-size: 16px; }
.ticket-meta { color: var(--ink-2); font-size: 12px; margin-top: 4px; }
.ticket-desc { margin: 12px 0; color: var(--ink); font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.ticket-bottom { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 12px; }
.ticket-bottom select { width: auto; padding: 10px 12px; }
.ticket-bottom input[type="text"] { width: 240px; padding: 10px 12px; }
.badge { border-radius: 6px; padding: 4px 10px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge.status-待处理 { background: var(--warn-soft); color: var(--warn); }
.badge.status-处理中 { background: var(--accent-tint); color: var(--accent); }
.badge.status-已完成 { background: var(--ok-soft); color: var(--ok); }
.badge.urgency-紧急 { background: var(--urgent-soft); color: var(--urgent); }
.badge.urgency-普通 { background: var(--raised); color: var(--ink-2); }
.empty { text-align: center; color: var(--ink-2); padding: 48px 12px; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: 12px; }

.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-top: 24px; }
.qr-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; text-align: center; background: var(--surface); }
.qr-card img, .qr-card canvas { width: 160px; height: 160px; image-rendering: pixelated; }
.qr-card strong { display: block; margin-top: 12px; font-size: 14px; font-weight: 500; }
.qr-card .btn { margin-top: 12px; padding: 8px 12px; font-size: 12px; min-height: 36px; }

.switch { position: relative; display: inline-block; width: 44px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #d5cec4; border-radius: 999px; transition: background-color 140ms var(--ease); }
.switch span:before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform 140ms var(--ease); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span:before { transform: translateX(18px); }
.notice { background: var(--raised); border-left: 2px solid var(--accent); color: var(--ink-2); font-size: 13px; padding: 16px; border-radius: 8px; margin: 16px 0; line-height: 1.7; }
.notice strong { color: var(--ink); font-weight: 500; }
.notify-log-tools { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.notify-log-tools input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: var(--surface); font-size: 13px; }
.notify-log-count { color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.notify-log { display: grid; gap: 8px; }
.notify-log-pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 12px; color: var(--ink-2); font-size: 12px; }
.notify-log-pager button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 6px; padding: 5px 10px; font-size: 12px; }
.notify-log-pager button:disabled { opacity: 0.45; cursor: not-allowed; }
.notify-log-item { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.notify-log-item .ok { color: var(--ok); }
.notify-log-item .fail { color: var(--urgent); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 8px; font-size: 14px; z-index: 50; box-shadow: var(--shadow-card); max-width: calc(100vw - 32px); text-align: center; }

.site-foot { max-width: 1240px; margin: 0 auto; padding: 0 32px 36px; color: var(--ink-3); font-size: 12px; letter-spacing: 0.02em; text-align: center; }

/* ---------- 响应式：平板 ---------- */

@media (max-width: 960px) {
  .report-split { gap: 40px; }
  h1 { font-size: 40px; }
  .keyboard-visual { height: 148px; }
  .keyboard-keys { height: 104px; }
  .keyboard-keys.black { height: 60px; }
}

/* ---------- 响应式：手机 ---------- */

@media (max-width: 720px) {
  body { background-attachment: scroll; background-position: center top; }
  .topbar { height: 56px; padding: 0 16px; }
  .brand-mark { width: 28px; height: 28px; border-radius: 7px; }
  .brand-text { font-size: 15px; }
  .menu-toggle { display: flex; }

  .nav {
    display: none;
    position: absolute;
    top: 56px; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 8px 16px 16px;
    box-shadow: var(--shadow-card);
  }
  .nav.open { display: flex; }
  .nav-btn { text-align: left; padding: 12px; min-height: 44px; }

  main { padding: 32px 16px 64px; }
  .site-foot { padding: 0 16px 28px; }
  h1 { font-size: 36px; letter-spacing: -0.02em; }
  .hero-sub { font-size: 15px; }

  .report-split { display: flex; flex-direction: column; gap: 32px; padding-top: 0; }
  .report-intro { padding-top: 0; width: 100%; }
  .keyboard-visual { margin-top: 32px; height: 132px; max-width: 100%; padding: 14px 14px 0; }
  .keyboard-keys { height: 92px; }
  .keyboard-keys.black { top: 14px; left: 14px; right: 14px; height: 52px; }
  .keyboard-felt { bottom: 14px; }
  .intro-foot { margin-top: 16px; }
  .report-form-col { width: 100%; }

  .card { padding: 20px; border-radius: 12px; }
  .card-head { margin-bottom: 20px; }
  .field-row { flex-direction: column; gap: 0; }
  .field { margin-bottom: 16px; }

  .stats { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat { padding: 16px; }
  .stat strong { font-size: 24px; }
  .admin-head { align-items: flex-start; }
  .admin-head h1 { font-size: 26px; }
  .ticket-bottom select, .ticket-bottom input[type="text"] { width: 100%; }
  .admin-tabs { gap: 0; }
  .tab, .admin-tab { padding: 12px; }
  .toolbar select, .toolbar input { width: 100%; flex: none; }
  .notify-log-tools { flex-direction: column; align-items: stretch; gap: 8px; }
  .notify-log-item { flex-direction: column; gap: 4px; }
  .inline.actions .btn { flex: 1; }
}

@media (max-width: 380px) {
  h1 { font-size: 32px; }
  .brand-text { font-size: 14px; }
  .card { padding: 16px; }
}
