:root {
  color-scheme: light;
  --bg: #f4f5f2;
  --paper: #ffffff;
  --paper-soft: #f9faf7;
  --ink: #14161f;
  --text: #252b35;
  --muted: #6d7480;
  --line: #dde2dc;
  --blue: #2458d3;
  --green: #177245;
  --teal: #0f766e;
  --amber: #a86712;
  --red: #b9423c;
  --violet: #6b4bc3;
  --shadow: 0 12px 30px rgba(18, 24, 32, 0.08);
  --soft-shadow: 0 5px 16px rgba(18, 24, 32, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "MiSans", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 13px;
  background: var(--paper);
  color: var(--text);
  cursor: pointer;
}

button.primary {
  border-color: #1f4eb8;
  background: #2559d6;
  color: #fff;
  box-shadow: 0 8px 18px rgba(36, 88, 211, 0.22);
}

button.ghost {
  border-color: transparent;
  background: transparent;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(36, 88, 211, 0.12);
}

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

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 245, 242, 0.98)),
    var(--bg);
}

.login-card {
  width: min(430px, 100%);
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 4px 0 4px;
  color: var(--ink);
  font-size: 26px;
  line-height: 1.12;
}

.login-card p {
  margin: 0;
  color: var(--muted);
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(221, 226, 220, 0.9);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
}

.brand-block {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.brand-block span,
.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

.brand-block strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 20px;
  font-weight: 880;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
}

.content {
  max-width: 1220px;
  margin: 0 auto;
  display: grid;
  gap: 14px;
  padding: 14px 14px 88px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  box-shadow: 0 -10px 28px rgba(18, 24, 32, 0.08);
}

.bottom-nav button {
  min-width: 0;
  min-height: 46px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #596170;
  font-weight: 820;
}

.bottom-nav button.active {
  background: #eaf1ff;
  color: #173f9b;
}

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

.hero-panel,
.panel,
.metric,
.room-card,
.order-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--soft-shadow);
}

.hero-panel {
  min-height: 118px;
  display: flex;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
  padding: 18px;
  background:
    linear-gradient(135deg, #fff 0%, #f8fbff 56%, #f3fbf7 100%);
}

.hero-panel h2,
.section-title h2 {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 28px;
  line-height: 1.08;
}

.douyin-pill {
  flex: 0 0 auto;
  display: grid;
  gap: 2px;
  justify-items: end;
  border: 1px solid #f0d3b0;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff8ed;
  color: var(--amber);
}

.douyin-pill.live,
.chip.live {
  border-color: #bde5cc;
  background: #eaf8ef;
  color: var(--green);
}

.douyin-pill b {
  font-size: 14px;
}

.douyin-pill span {
  font-size: 12px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  min-height: 102px;
  display: grid;
  align-content: space-between;
  padding: 14px;
}

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

.metric strong {
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}

.metric em {
  color: #77808c;
  font-size: 12px;
  font-style: normal;
}

.panel {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.panel.subdued {
  background: #fbfcfb;
}

.panel code {
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #f7f8f6;
}

.panel-head,
.section-title,
.group-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.panel-head strong,
.group-head strong {
  color: var(--ink);
  font-size: 17px;
  font-weight: 850;
}

.panel-head span,
.group-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
}

.section-title strong {
  color: var(--ink);
  font-size: 30px;
}

.form-grid {
  display: grid;
  gap: 10px;
}

.compact-form {
  grid-template-columns: 1fr;
}

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

.order-list {
  display: grid;
  gap: 10px;
}

.event-list {
  display: grid;
  gap: 8px;
}

.event-card {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfb;
}

.event-card.done {
  border-color: #c9e9d4;
  background: #f2fbf5;
}

.event-card.failed {
  border-color: #f0c0bc;
  background: #fff5f4;
}

.event-card div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.event-card strong,
.event-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-card strong {
  color: var(--ink);
  font-size: 13px;
}

.event-card span {
  color: var(--muted);
  font-size: 12px;
}

.event-card em {
  max-width: 46%;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 780;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-list.compact {
  gap: 8px;
}

.order-card {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
}

.order-card div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.order-card strong,
.order-card span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-card strong {
  color: var(--ink);
  font-size: 14px;
}

.order-card span {
  color: var(--muted);
  font-size: 12px;
}

.order-card b {
  color: var(--ink);
  font-size: 16px;
  text-align: right;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  background: #f1f3f5;
  color: #4d5865;
  font-size: 12px;
  font-style: normal;
  font-weight: 820;
  white-space: nowrap;
}

.status-free {
  border-color: #c9e9d4;
  background: #eaf8ef;
  color: var(--green);
}

.status-booked,
.status-assigned {
  border-color: #c8d7ff;
  background: #edf3ff;
  color: var(--blue);
}

.status-checked_in {
  border-color: #b9e6df;
  background: #e6f7f4;
  color: var(--teal);
}

.status-pending_clean,
.status-cleaning {
  border-color: #efd9aa;
  background: #fff6df;
  color: var(--amber);
}

.status-maintenance,
.status-locked {
  border-color: #f0c0bc;
  background: #fff0ef;
  color: var(--red);
}

.status-pending_manual {
  border-color: #d8c8ff;
  background: #f1ecff;
  color: var(--violet);
}

.status-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.status-strip::-webkit-scrollbar {
  display: none;
}

.room-group {
  display: grid;
  gap: 10px;
}

.room-grid {
  display: grid;
  gap: 10px;
}

.room-card {
  display: grid;
  gap: 12px;
  padding: 13px;
}

.room-card header {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.room-card header div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.room-card header strong {
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
}

.room-card header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef1ed;
}

.progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2559d6, #1d9a8a);
}

.day-row {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 1px;
  scrollbar-width: none;
}

.day-row::-webkit-scrollbar {
  display: none;
}

.day {
  flex: 0 0 58px;
  min-height: 58px;
  display: grid;
  gap: 3px;
  place-items: center;
  padding: 6px 5px;
  border-radius: 8px;
  box-shadow: none;
}

.day b {
  font-size: 11px;
}

.day span {
  max-width: 48px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 820;
}

.douyin-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.douyin-status article {
  min-height: 78px;
  display: grid;
  align-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--paper-soft);
}

.douyin-status span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.douyin-status strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 15px;
}

.mini-grid,
.rate-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-grid span,
.rate-list span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fbfcfb;
  color: var(--text);
  font-size: 13px;
  font-weight: 720;
}

.toast {
  border: 1px solid #bad3ff;
  border-radius: 8px;
  padding: 10px 12px;
  background: #edf5ff;
  color: #17467d;
  box-shadow: var(--soft-shadow);
}

.toast.error {
  border-color: #f1beb9;
  background: #fff0ef;
  color: var(--red);
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcfb;
  color: var(--muted);
}

@media (max-width: 390px) {
  .top-actions button {
    min-height: 36px;
    padding: 7px 10px;
  }

  .hero-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .douyin-pill {
    justify-items: start;
  }
}

@media (min-width: 720px) {
  .content {
    padding: 20px 20px 96px;
  }

  .metric-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
  }

  .compact-form {
    grid-template-columns: 1fr 1fr auto;
  }

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

@media (min-width: 1100px) {
  .app-shell {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .topbar {
    grid-column: 2;
    padding: 16px 24px;
  }

  .content {
    grid-column: 2;
    padding: 24px;
  }

  .bottom-nav {
    position: fixed;
    top: 0;
    right: auto;
    bottom: 0;
    width: 220px;
    grid-template-columns: 1fr;
    align-content: start;
    gap: 8px;
    padding: 90px 14px 14px;
    border-top: 0;
    border-right: 1px solid var(--line);
    box-shadow: none;
  }

  .bottom-nav::before {
    content: "抖音来客房态助手";
    position: fixed;
    left: 18px;
    top: 22px;
    width: 184px;
    color: var(--ink);
    font-size: 18px;
    font-weight: 880;
  }

  .bottom-nav button {
    justify-content: flex-start;
    text-align: left;
  }

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