:root {
  --bg: #f4f3ef;
  --card: #fffdf8;
  --panel: #ffffff;
  --ink: #1f1c18;
  --muted: #766f66;
  --line: #e4dfd6;
  --brand: #b45309;
  --brand-dark: #8f3f06;
  --brand-soft: #fff3d8;
  --green: #15803d;
  --green-soft: #dcfce7;
  --red: #b91c1c;
  --red-soft: #fee2e2;
  --blue: #1d4ed8;
  --blue-soft: #dbeafe;
  --shadow: 0 18px 50px rgba(31, 28, 24, 0.08);
  --sidebar: 280px;
  font-family:
    system-ui,
    -apple-system,
    "PingFang SC",
    "Hiragino Sans GB",
    "Microsoft YaHei",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(180, 83, 9, 0.06), transparent 28%),
    linear-gradient(225deg, rgba(21, 128, 61, 0.06), transparent 30%),
    var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.12);
}

h1,
h2,
h3,
p {
  margin: 0;
}

.os-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.86);
  backdrop-filter: blur(12px);
  padding: 24px;
}

.brand {
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--ink);
  color: #fffaf0;
  font-size: 25px;
  font-weight: 900;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.1;
}

.brand p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  min-height: 44px;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  padding: 6px 8px;
  text-align: left;
  font-weight: 750;
}

.nav-item span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
}

.nav-item:hover,
.nav-item.active {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
}

.sync-card {
  display: grid;
  gap: 10px;
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.sync-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.sync-row strong {
  color: var(--ink);
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow,
.label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.topbar h2 {
  margin-top: 4px;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.grid {
  display: grid;
  gap: 16px;
  align-items: start;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr);
}

.two-col {
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

.music-grid {
  grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1fr);
}

.wide {
  grid-column: span 1;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.metric {
  padding: 16px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 34px;
  line-height: 1;
}

.metric p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head h3 {
  margin-top: 3px;
  font-size: 19px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.pill.ok {
  background: var(--green-soft);
  color: var(--green);
}

.pill.warn {
  background: var(--brand-soft);
  color: var(--brand);
}

.pill.danger {
  background: var(--red-soft);
  color: var(--red);
}

.pill.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0 14px;
  font-weight: 800;
}

.primary-button {
  background: var(--brand);
  color: white;
}

.primary-button:hover {
  background: var(--brand-dark);
}

.secondary-button {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
}

.danger-button {
  background: var(--red-soft);
  color: var(--red);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  padding: 0;
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
}

.icon-button.large {
  width: 54px;
  height: 54px;
  font-size: 17px;
}

.icon-button.play {
  background: var(--ink);
  color: #fffaf0;
}

.stack,
.timeline {
  display: grid;
  gap: 10px;
}

.item,
.timeline-item,
.room-card,
.scene-card,
.module-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  padding: 12px;
}

.item-top,
.room-top,
.scene-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.item strong,
.timeline-item strong,
.room-card strong,
.scene-card strong,
.module-card strong {
  display: block;
  font-size: 15px;
}

.item p,
.timeline-item p,
.room-card p,
.scene-card p,
.module-card p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.timeline-item {
  display: grid;
  grid-template-columns: 76px 1fr auto;
  align-items: center;
  gap: 12px;
}

.time {
  color: var(--brand);
  font-weight: 900;
}

.form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.chip-list,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  padding: 4px 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.mini-button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.mini-button.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 12px;
  font-weight: 750;
}

.segmented button.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}

.room-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
}

.room-card {
  min-height: 112px;
}

.room-card[data-status="可入住"] {
  background: var(--green-soft);
  border-color: rgba(21, 128, 61, 0.28);
}

.room-card[data-status="待打扫"] {
  background: var(--brand-soft);
  border-color: rgba(180, 83, 9, 0.3);
}

.room-card[data-status="清洁中"] {
  background: var(--blue-soft);
  border-color: rgba(29, 78, 216, 0.24);
}

.room-card[data-status="维修"] {
  background: var(--red-soft);
  border-color: rgba(185, 28, 28, 0.25);
}

.now-playing {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  padding: 18px;
}

.now-playing span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.now-playing strong {
  font-size: 38px;
  line-height: 1;
}

.now-playing p {
  color: var(--muted);
}

.player-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
}

.deploy-box {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  padding: 14px;
}

pre {
  overflow: auto;
  margin: 14px 0 0;
  border-radius: 12px;
  background: var(--ink);
  color: #fffaf0;
  padding: 14px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  min-width: 260px;
  max-width: min(420px, calc(100vw - 40px));
  transform: translateY(120%);
  border-radius: 12px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  opacity: 0;
  transition: transform 160ms ease, opacity 160ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1180px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .two-col,
  .music-grid {
    grid-template-columns: 1fr;
  }

  .room-board {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }
}

@media (max-width: 860px) {
  .os-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

  .nav {
    grid-template-columns: repeat(7, minmax(150px, 1fr));
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .sync-card {
    display: none;
  }

  .workspace {
    padding: 16px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .metrics {
    grid-template-columns: 1fr;
  }

  .topbar-actions,
  .inline-form {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .room-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }
}
