:root {
  color-scheme: light;
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  --ink: #3e2a14;
  --muted: #70573e;
  --gold: #c5a059;
  --accent: #825b1d;
  --line: #d9c49d;
  --surface: rgba(255, 253, 247, .67);
  --input: rgba(255, 253, 248, .82);
  --error: #8d3034;
  --success: #386647;
  --notice: #f6eedb;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(135deg, #fdfbf7, #f4eedb 53%, #e8dcc4);
  line-height: 1.55;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
svg:not(:root) {
  width: 1em; height: 1em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}
h1, h2, h3, p, dl { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.wrap { width: min(100% - 48px, 1040px); margin-inline: auto; }
.sky { position: fixed; z-index: -1; pointer-events: none; inset: 0; overflow: hidden; }
.astrolabe {
  position: absolute; top: -267px; right: -287px; width: 1020px; aspect-ratio: 1;
  background: repeating-conic-gradient(from 1deg, transparent 0deg 9.5deg, #c5a059 9.5deg 9.7deg, transparent 9.7deg 10deg);
  mask-image: radial-gradient(circle, transparent 0 18%, black 18.1% 19%, transparent 19.1% 31%, black 31.1% 32.5%, transparent 32.6% 43%, black 43.1% 45.6%, transparent 45.7% 52%, black 52.1% 53.6%, transparent 53.7% 65%, black 65.1% 69%, transparent 69.1%);
  transform: perspective(1100px) rotateX(57deg) rotateY(-15deg) rotateZ(-25deg);
  opacity: .54;
}
.astrolabe i { display: block; position: absolute; inset: 1.2%; border: 1px solid var(--gold); border-radius: 50%; }
.astrolabe i:nth-child(2) { inset: 12%; border-width: 2px; }
.astrolabe i:nth-child(3) { inset: 18%; border-style: dashed; }
.astrolabe.left { top: auto; right: auto; left: -360px; bottom: -520px; transform: perspective(1000px) rotateX(45deg) rotateZ(16deg); opacity: .31; }
.topbar { border-bottom: 1px solid rgba(146, 106, 46, .17); background: rgba(253, 250, 241, .46); }
.topbar-inner { height: 68px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 750; font-size: 17px; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: #eeddba; color: #7a521d; }
.brand-mark svg { font-size: 20px; }
.nav-link { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 650; }
.hero { padding: 58px 0 42px; text-align: center; }
.hero h1 {
  font-size: 58px; line-height: 1.22; font-weight: 800; color: #89601f;
  background: linear-gradient(110deg, #825614 12%, #ad8137 50%, #805819 85%);
  background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-rule { width: 152px; height: 2px; margin: 15px auto 15px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.hero p { color: var(--muted); font-size: 15px; }
.feedback-layout { display: grid; grid-template-columns: minmax(0, 1.76fr) minmax(0, 1fr); align-items: start; gap: 22px; }
.sidebar { display: grid; gap: 20px; }
.panel { min-width: 0; border: 1px solid var(--line); background: var(--surface); border-radius: 16px; padding: 24px; box-shadow: 0 4px 20px rgba(98, 65, 17, .055); }
.compose { padding: 26px; }
.section-head { display: flex; align-items: center; gap: 11px; margin-bottom: 19px; }
.section-head h2 { font-size: 19px; font-weight: 730; }
.section-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 9px; color: var(--accent); background: rgba(197, 160, 89, .20); }
.section-icon svg { font-size: 19px; }
.stack { display: grid; gap: 13px; }
.stack.compact { gap: 9px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span, legend { font-size: 13px; font-weight: 700; color: var(--muted); }
input:not([type="radio"], [type="checkbox"]), textarea, select {
  width: 100%; min-width: 0; min-height: 43px; padding: 9px 12px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; background: var(--input); font-size: 14px;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
select { padding-right: 26px; }
textarea { min-height: 97px; resize: vertical; }
textarea:focus, input:focus, select:focus { outline-offset: 1px; }
.counter { justify-self: end; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.identity { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { margin-bottom: 7px; padding: 0; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid var(--line); background: rgba(197, 160, 89, .10); border-radius: 9px; }
.segmented label { position: relative; display: block; cursor: pointer; min-width: 0; }
.segmented input, .visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.segmented span { display: flex; justify-content: center; align-items: center; gap: 7px; padding: 7px 6px; border: 1px solid transparent; border-radius: 6px; font-size: 13px; font-weight: 650; color: var(--muted); }
.segmented :checked + span { color: var(--accent); background: var(--input); border-color: var(--line); }
.segmented :focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.fine { font-size: 12px; color: var(--muted); }
.privacy { display: flex; align-items: flex-start; gap: 7px; }
.privacy svg { margin-top: 3px; font-size: 14px; color: var(--accent); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 7px 15px; border: 1px solid transparent; border-radius: 8px; font-size: 14px; font-weight: 700; white-space: nowrap; transition: background .18s, box-shadow .18s; }
.button:hover { text-decoration: none; }
.button svg { font-size: 16px; }
.button.full { width: 100%; }
.primary { color: #fffaf0; background: #825b1d; border-color: #825b1d; }
.primary:hover:not(:disabled) { background: #6c4913; }
.secondary { color: var(--accent); background: rgba(197, 160, 89, .10); border-color: var(--line); }
.secondary:hover:not(:disabled) { background: rgba(197, 160, 89, .25); }
.button:disabled { opacity: .58; }
.icon-button { padding: 6px; width: 40px; }
.poke-copy { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
.poke .fine { margin-top: 10px; }
.message { font-size: 13px; padding: 9px 11px; background: var(--notice); color: var(--muted); border: 1px solid var(--line); border-radius: 8px; overflow-wrap: anywhere; }
.message.error { color: var(--error); border-color: currentColor; }
.message.ok { color: var(--success); }
.poke .message, .receipt .fine, .toolbar + .message { margin-top: 10px; }
.receipt, .lookup-result { border-top: 1px solid var(--line); margin-top: 17px; padding-top: 15px; overflow-wrap: anywhere; }
.input-action { display: flex; gap: 8px; }
.input-action input { flex: 1; }
.receipt-row { margin-top: 9px; }
.receipt-row input { font-family: ui-monospace, Consolas, monospace; }
.board { margin-top: 22px; }
.board-list, .admin-list { display: grid; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0 4px; }
.board-list details, .details-line { border-top: 1px solid var(--line); padding: 11px 0; }
summary { cursor: pointer; overflow-wrap: anywhere; font-weight: 650; }
summary .status { margin-left: 8px; }
.item-title { font-size: 16px; overflow-wrap: anywhere; }
.item-meta { display: flex; flex-wrap: wrap; gap: 5px 10px; align-items: center; margin: 5px 0; color: var(--muted); font-size: 12px; }
.item-text { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.reply { border-left: 2px solid var(--gold); padding: 2px 0 2px 11px; margin-top: 10px; }
.status { display: inline-block; width: max-content; border-radius: 6px; padding: 2px 7px; font-size: 11px; font-weight: 750; background: #eee1c2; color: #705317; }
.status.working { background: #dde9ef; color: #32546a; }
.status.resolved { background: #dbe9da; color: #365b37; }
.status.closed { background: #e9e3e1; color: #604f4c; }
.footer { margin-top: 24px; padding: 18px 0 24px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.footer a { font-weight: 700; }

.admin-main { padding-top: 29px; }
.admin-main h1 { font-size: 27px; margin-bottom: 14px; }
.login { width: min(100%, 425px); margin: 47px auto 0; }
.login h1 { margin-bottom: 0; font-size: 23px; }
.top-actions { display: flex; gap: 12px; align-items: center; }
.admin-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.admin-head h1 { margin: 0; }
.admin-main > .message { margin-bottom: 14px; }
.counts { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 13px; }
.tabs { display: flex; gap: 16px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { appearance: none; padding: 10px 2px; color: var(--muted); font-size: 14px; font-weight: 650; background: transparent; border: 0; border-bottom: 2px solid transparent; }
.tabs button[aria-pressed="true"] { border-bottom-color: var(--accent); color: var(--accent); }
.toolbar { display: grid; grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)) auto; gap: 9px; margin-bottom: 8px; }
.admin-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; border-bottom: 1px solid var(--line); padding: 12px 0; }
.admin-row > div { min-width: 0; }
.pagination { display: flex; margin-top: 14px; gap: 9px; align-items: center; justify-content: end; font-size: 13px; color: var(--muted); }
.category-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.category-add { margin: 16px 0 0; }
.checkline { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.checkline input { accent-color: var(--accent); }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.settings-grid h3 { margin-bottom: 10px; font-size: 16px; }
.detail-dialog { width: min(720px, 100% - 32px); max-height: calc(100dvh - 32px); padding: 22px; border-radius: 16px; background: var(--input); background-color: var(--notice); border: 1px solid var(--line); color: var(--ink); }
.detail-dialog::backdrop { background: rgba(43, 30, 16, .47); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 12px; }
.dialog-head h2 { font-size: 19px; }
.editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.detail-item { margin-bottom: 15px; }
.device-list { display: grid; grid-template-columns: minmax(88px, auto) minmax(0, 1fr); gap: 6px 12px; font-size: 13px; margin-top: 8px; }
.device-list dt { color: var(--muted); }
.device-list dd { margin: 0; overflow-wrap: anywhere; }

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark; --ink: #f1dbb0; --muted: #c7ad80; --accent: #f0d28b; --line: #624d2b;
    --surface: rgba(37, 26, 14, .82); --input: #261c10; --error: #f1a4a3; --success: #a5d2a5; --notice: #332514;
  }
  body { background: linear-gradient(135deg, #251a0d, #1a1108 54%, #100a04); }
  .topbar { background: rgba(40, 29, 16, .72); }
  .brand-mark { background: #5b4425; color: var(--accent); }
  .hero h1 { background-image: linear-gradient(110deg, #c79a49, #f7dda0, #c29851); }
  .primary { color: #241708; background: #d8b36a; border-color: #d8b36a; }
  .primary:hover:not(:disabled) { background: #e9c781; }
  .astrolabe { opacity: .28; }
}
@media (max-width: 760px) {
  .wrap { width: calc(100% - 32px); }
  .topbar-inner { height: 58px; }
  .hero { padding: 36px 0 29px; }
  .hero h1 { font-size: 43px; }
  .feedback-layout, .settings-grid { grid-template-columns: 1fr; gap: 15px; }
  .sidebar { gap: 15px; }
  .panel { padding: 17px; }
  .board { margin-top: 15px; }
  .astrolabe { right: -505px; }
  .astrolabe.left { display: none; }
  .toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar input { grid-column: 1 / -1; }
}
@media (max-width: 400px) {
  .hero h1 { font-size: 38px; }
  .input-action.receipt-row, .editor-grid { flex-direction: column; grid-template-columns: 1fr; }
  .pagination { justify-content: center; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
