/* RoomLink 商务版视觉迁移层。保留现有页面结构、元素编号和业务事件。 */
:root {
  --ink: #1a1a2e;
  --muted: #73788a;
  --line: #e2e5eb;
  --soft-line: #eef0f4;
  --paper: #ffffff;
  --mist: #f7f8fa;
  --blue: #1a2b4a;
  --blue-2: #2d4a7a;
  --cyan: #3b6cb4;
  --green: #2d8659;
  --amber: #b97920;
  --red: #c0392b;
  --steel: #34445d;
  --shadow: 0 8px 26px rgba(26, 43, 74, .08);
  --radius: 8px;
  --font-body: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  --font-display: "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI Semibold", sans-serif;
  --roomlink-primary: #1a2b4a;
  --roomlink-accent: #3b6cb4;
  --roomlink-accent-soft: #e8f0fb;
  --roomlink-success-soft: #eaf6f0;
  --roomlink-warning-soft: #fdf5e6;
  --roomlink-danger-soft: #fceae8;
}

html {
  background: var(--mist);
}

body {
  min-width: 0;
  background: var(--mist);
  color: var(--ink);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  letter-spacing: 0;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(59, 108, 180, .2);
  outline-offset: 2px;
}

.app {
  grid-template-columns: 220px minmax(0, 1fr);
  background: var(--mist);
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 100vh;
  min-width: 0;
  overflow: hidden;
  padding: 20px 12px 16px;
  gap: 12px;
  border-right: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.brand {
  min-width: 0;
  min-height: 48px;
  gap: 10px;
  padding: 0 8px 18px;
  border-bottom: 1px solid var(--soft-line);
}

.logo-mark {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
  border-radius: 6px;
  background: var(--roomlink-primary);
  box-shadow: none;
}

.logo-mark svg {
  width: 26px;
  height: 26px;
}

.brand-title {
  overflow: hidden;
  color: var(--roomlink-primary);
  font-size: 16px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-sub {
  overflow: hidden;
  color: #8a8a9a;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav {
  min-height: 0;
  flex: 1;
  align-content: start;
  gap: 2px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.nav button {
  min-width: 0;
  min-height: 40px;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 5px;
  color: #4a4a5e;
  transition: background-color .15s ease, color .15s ease;
}

.nav button:hover {
  background: #f4f6f8;
  color: var(--ink);
}

.nav button.active {
  background: var(--roomlink-primary);
  color: #fff;
}

.nav .glyph {
  width: 20px;
  height: 20px;
  border-radius: 0;
  background: transparent;
}

.nav svg {
  width: 17px;
  height: 17px;
}

.count {
  min-width: 0;
  max-width: 64px;
  overflow: hidden;
  padding: 2px 7px;
  border: 0;
  border-radius: 10px;
  background: #f1f3f6;
  color: #808596;
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav button.active .count {
  background: rgba(255, 255, 255, .18);
  color: #fff;
}

.side-panel {
  margin-top: 4px;
  padding: 12px;
  border: 0;
  border-radius: 8px;
  background: var(--mist);
}

.side-panel h3 {
  margin-bottom: 8px;
  color: #8a8a9a;
  font-size: 11px;
}

.mini-row {
  padding: 4px 0;
  border: 0;
  color: #666b7c;
  font-size: 11px;
}

.mini-row strong {
  color: var(--ink);
  font-weight: 600;
}

.workspace {
  min-width: 0;
  background: var(--mist);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 76px;
  padding: 15px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px);
  box-shadow: none;
}

.eyebrow {
  margin-bottom: 4px;
  color: #8a8a9a;
  font-size: 11px;
}

.eyebrow > span:not(.status-pill) {
  display: none;
}

.title {
  max-width: 760px;
  color: var(--ink);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
}

.top-actions {
  gap: 8px;
}

.status-pill,
.tag,
.chip {
  min-height: 26px;
  padding: 4px 9px;
  border-color: var(--line);
  background: #fff;
  color: #5f6677;
}

.dot {
  background: var(--green);
}

.role-switch,
.scope-switch {
  min-height: 38px;
  border-color: var(--line);
  border-radius: 6px;
  background: #fff;
  color: #666b7c;
}

.role-switch select {
  color: var(--ink);
}

main {
  width: 100%;
  min-width: 0;
  padding: 28px 32px 44px;
}

.view {
  min-width: 0;
}

.grid,
.panel,
.metric,
.asset-card,
.screen-card,
.permission-item,
.integration-row,
.ops-layout,
.device-detail-layout,
.room-map,
.room-identity,
.card-actions {
  min-width: 0;
}

.panel,
.metric,
.asset-card,
.screen-card,
.permission-item,
.ops-room,
.device-card,
.log-item {
  border-color: var(--soft-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
}

.panel {
  padding: 20px;
}

.panel-head {
  gap: 16px;
  margin-bottom: 16px;
}

.panel-title {
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}

.panel-sub {
  color: #7d8292;
  font-size: 12px;
  line-height: 1.55;
}

.metric {
  min-height: 132px;
  padding: 18px 20px;
  transition: transform .16s ease, box-shadow .16s ease;
}

.metric:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 18px rgba(26, 43, 74, .06);
}

.metric-label {
  color: #8a8a9a;
  font-size: 12px;
}

.metric-value {
  color: var(--ink);
  font-size: 32px;
  font-variant-numeric: tabular-nums;
}

.metric-note {
  color: #8a8a9a;
}

button.primary,
.primary,
.btn-primary {
  border-color: var(--roomlink-primary);
  border-radius: 6px;
  background: var(--roomlink-primary);
  color: #fff;
  box-shadow: none;
}

button.primary:hover,
.primary:hover,
.btn-primary:hover {
  border-color: var(--blue-2);
  background: var(--blue-2);
  color: #fff;
}

button.secondary,
.secondary,
button.ghost,
.ghost,
.icon-btn {
  border-color: var(--line);
  border-radius: 6px;
  background: #fff;
  color: #4a4a5e;
  box-shadow: none;
}

button.secondary:hover,
.secondary:hover,
button.ghost:hover,
.ghost:hover,
.icon-btn:hover {
  border-color: var(--roomlink-accent);
  color: var(--roomlink-accent);
}

button.danger,
.danger {
  color: var(--red);
}

.field label {
  color: #555b6d;
  font-size: 12px;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  min-width: 0;
  border-color: #dfe3ea;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--roomlink-accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 108, 180, .1);
}

.table,
table {
  color: var(--ink);
}

.table th,
th {
  color: #858a99;
  font-size: 12px;
  font-weight: 600;
}

.table td,
td {
  border-color: var(--soft-line);
}

tr:hover td {
  background: #fafbfc;
}

.live-room-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.live-room-grid .room-block {
  min-height: 104px;
  border-width: 1px;
  border-radius: 8px;
}

.timeline-item,
.log-item {
  border-color: var(--soft-line);
}

.asset-list,
.screen-grid,
.permission-grid,
.log-list,
.modal-list {
  gap: 10px;
}

.log-list {
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
}

.log-item {
  grid-template-columns: minmax(58px, max-content) minmax(0, 1fr) max-content;
  min-width: 0;
  max-width: 100%;
}

.log-item > div {
  min-width: 0;
  overflow-wrap: anywhere;
}

.asset-card {
  gap: 16px;
  padding: 14px;
}

.asset-card:hover,
.screen-card:hover,
.permission-item:hover {
  border-color: #ccd8e8;
  box-shadow: 0 5px 18px rgba(26, 43, 74, .05);
}

.room-photo {
  width: 132px;
  min-width: 132px;
  height: 88px;
  border-color: var(--soft-line);
  border-radius: 7px;
}

.asset-meta {
  margin-top: 5px;
  color: #777d8e;
  line-height: 1.65;
}

.screen-card.selected {
  border-color: var(--roomlink-accent);
  box-shadow: inset 0 0 0 1px var(--roomlink-accent);
}

.integration-row {
  border-color: var(--soft-line);
  border-radius: 8px;
  background: #fff;
}

.notice-only,
.audit-note,
.ai-result {
  border-color: #c9d9ee;
  border-left-color: var(--roomlink-accent);
  border-radius: 7px;
  background: #f5f8fd;
  color: #4f6078;
}

.booking-integrated-panel {
  overflow: hidden;
  padding: 0;
  border: 0;
  background: transparent;
}

.booking-integrated-frame {
  display: block;
  width: 100%;
  min-height: calc(100vh - 148px);
  border: 0;
  border-radius: 8px;
  background: var(--mist);
}

.room-editor-modal,
.system-modal,
.login-panel {
  border-color: #d7dde7;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(26, 43, 74, .18);
}

.system-modal-head,
.system-modal-actions,
.modal-list-row {
  border-color: var(--soft-line);
}

.login-gate {
  background: rgba(244, 246, 249, .96);
}

.auth-locked .app {
  visibility: hidden;
}

.login-mark {
  border-radius: 6px;
  background: var(--roomlink-primary);
}

.empty-state {
  border-color: #ccd8e8;
  border-radius: 8px;
  background: #fafbfd;
  color: #737b8d;
}

.toast {
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.api-loading::after {
  border-color: var(--line);
  border-radius: 8px;
  color: var(--roomlink-primary);
  box-shadow: var(--shadow);
}

@media (max-width: 1280px) {
  .app {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .sidebar {
    padding: 16px 8px;
  }

  .brand {
    justify-content: center;
    padding-inline: 0;
  }

  .brand > div:last-child,
  .nav button > span:nth-child(2),
  .nav .count,
  .side-panel {
    display: none;
  }

  .nav button {
    grid-template-columns: 1fr;
    justify-items: center;
    padding-inline: 8px;
  }

  .topbar {
    padding-inline: 24px;
  }

  main {
    padding-inline: 24px;
  }
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .top-actions .status-pill:last-of-type,
  #syncBtn {
    display: none;
  }

  .cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .app {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: 0;
    display: flex;
    height: 100vh;
    padding: 12px 7px;
  }

  .nav {
    display: grid;
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 14px 16px;
  }

  main {
    padding: 16px;
  }

  .title {
    font-size: 20px;
  }

  .room-photo {
    width: 96px;
    min-width: 96px;
    height: 70px;
  }
}

@media (max-width: 620px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 10px 12px;
  }

  .brand {
    display: none;
  }

  .nav {
    display: flex;
    overflow-x: auto;
  }

  .nav button {
    min-width: 44px;
    flex: 0 0 44px;
  }

  .cols-4,
  .cols-3,
  .cols-2,
  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
