﻿/* 画户型网页版样式：配色和尺寸沿用鸿蒙版（vp → px 一一对应） */

:root {
  --accent: #2563EB;
  --red: #DC2626;
  --chip-bg: #F1F5F9;
  --chip-text: #334155;
  --line: #EDF2F7;
  --amber-bg: #FEF3C7;
  --amber-text: #B45309;
  --muted: #64748B;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #FFFFFF;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: #0F172A;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

.hidden {
  display: none !important;
}

.view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}

/* ======================= 首页 ======================= */

.home-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid var(--line);
  background: #FFFFFF;
}

.home-bar h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.home-new {
  border: 0;
  background: var(--accent);
  color: #FFFFFF;
  font-size: 14px;
  padding: 8px 18px;
  border-radius: 10px;
  cursor: pointer;
}

.home-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cloud-status {
  border: 0;
  background: var(--chip-bg);
  color: #64748B;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.cloud-status.is-ok {
  background: #DCFCE7;
  color: #15803D;
}

.cloud-status.is-warn {
  background: var(--amber-bg);
  color: var(--amber-text);
}

.cloud-status.is-off {
  background: var(--chip-bg);
  color: #94A3B8;
}

.plan-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.plan-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 6px;
  flex: none;
  line-height: 16px;
}

.plan-badge.is-cloud {
  background: #DBEAFE;
  color: #1D4ED8;
}

.plan-badge.is-local {
  background: var(--chip-bg);
  color: #64748B;
}

/* ======================= 访问口令 ======================= */

.gate {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  padding: 20px;
}

.gate-box {
  background: #FFFFFF;
  border-radius: 16px;
  padding: 18px;
  width: min(420px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.3);
}

.gate-input {
  height: 44px;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 15px;
  outline: none;
}

.gate-input:focus {
  border-color: var(--accent);
}

.home-new:active {
  filter: brightness(0.94);
}

.plan-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}

.plan-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  background: #FFFFFF;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  cursor: pointer;
}

.plan-card:active {
  background: #F8FAFC;
}

.plan-thumb {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: #F1F5F9;
  flex: none;
  object-fit: cover;
  display: block;
}

.plan-thumb-empty {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: #F1F5F9;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94A3B8;
  font-size: 12px;
}

.plan-main {
  flex: 1;
  min-width: 0;
}

.plan-name {
  font-size: 15px;
  font-weight: 500;
  color: #0F172A;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 0;
}

.plan-cust {
  font-size: 12px;
  color: var(--accent);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-time {
  font-size: 11px;
  color: #94A3B8;
  margin-top: 3px;
}

.plan-more {
  border: 0;
  background: transparent;
  color: #94A3B8;
  font-size: 20px;
  line-height: 1;
  padding: 8px 6px;
  cursor: pointer;
  flex: none;
}

.empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #94A3B8;
}

.empty-plus {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  border: 1px dashed #CBD5E1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #CBD5E1;
}

.empty-title {
  font-size: 15px;
  color: #475569;
  margin-top: 6px;
}

.empty-sub {
  font-size: 12px;
}

.home-tip {
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  font-size: 11px;
  color: #94A3B8;
  text-align: center;
  border-top: 1px solid var(--line);
}

/* ======================= 编辑器：顶栏 ======================= */

.action-bar {
  display: flex;
  gap: 6px;
  padding: calc(6px + env(safe-area-inset-top)) 8px 6px;
  background: #FFFFFF;
  border-bottom: 1px solid var(--line);
  flex: none;
}

.top-chip {
  flex: 1;
  height: 32px;
  border: 0;
  border-radius: 9px;
  background: var(--chip-bg);
  color: var(--chip-text);
  font-size: 12px;
  cursor: pointer;
}

.top-chip:active {
  filter: brightness(0.95);
}

.top-chip-primary {
  background: var(--accent);
  color: #FFFFFF;
}

/* ======================= 编辑器：画布 ======================= */

.canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #FFFFFF;
  overflow: hidden;
}

#cv {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.name-chip {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 70%;
  padding: 5px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
  text-align: center;
  cursor: pointer;
  user-select: none;
  pointer-events: auto;
}

.name-chip-name {
  font-size: 13px;
  color: #475569;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.name-chip-cust {
  font-size: 11px;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ======================= 编辑器：门窗条 / 底栏 ======================= */

.door-bar {
  display: flex;
  padding: 4px 8px 0;
  background: #FFFFFF;
  flex: none;
}

.door-chip {
  border: 0;
  width: 200px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

.door-kind {
  font-size: 13px;
  font-weight: 500;
}

.door-hint {
  font-size: 10px;
  color: #BFDBFE;
}

.mode-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px calc(6px + env(safe-area-inset-bottom));
  background: #FFFFFF;
  border-top: 1px solid var(--line);
  flex: none;
}

.mode-chip {
  border: 0;
  width: 104px;
  height: 40px;
  flex: none;
  border-radius: 10px;
  background: var(--accent);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-chip {
  flex: 1;
  min-width: 0;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: var(--chip-bg);
  color: var(--chip-text);
  font-size: 13px;
  cursor: pointer;
}

.tool-chip:active,
.mode-chip:active {
  filter: brightness(0.95);
}

.undo-group {
  display: flex;
  gap: 4px;
  flex: none;
}

.icon-btn {
  width: 44px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn:active {
  background: var(--chip-bg);
}

.icon-btn.is-disabled {
  color: #CBD5E1;
  cursor: default;
}

/* ======================= 底部面板 ======================= */

.panel-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.panel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.panel-sheet {
  position: relative;
  background: #FFFFFF;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -2px 20px rgba(15, 23, 42, 0.2);
  padding: 4px 16px calc(16px + env(safe-area-inset-bottom));
  max-height: 82vh;
  overflow-y: auto;
}

.panel-sheet::before {
  content: "";
  display: block;
  width: 38px;
  height: 4px;
  border-radius: 2px;
  background: #E2E8F0;
  margin: 8px auto 4px;
}

.panel-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-title {
  font-size: 15px;
  font-weight: 500;
  color: #0F172A;
}

.panel-sub {
  font-size: 11px;
  color: #94A3B8;
  line-height: 1.5;
}

.panel-row {
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 11px 14px;
  background: #FFFFFF;
  cursor: pointer;
}

.panel-row:active {
  background: #F8FAFC;
}

.panel-row-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-row.is-dim {
  background: #F1F5F9;
}

.panel-row-title {
  font-size: 14px;
  color: #0F172A;
}

.panel-row-sub {
  font-size: 11px;
  color: #94A3B8;
  margin-top: 2px;
}

.panel-state {
  font-size: 12px;
  color: #16A34A;
}

.panel-state.is-off {
  color: #94A3B8;
}

.panel-cur {
  font-size: 12px;
  color: var(--accent);
}

.dot {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  flex: none;
}

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

.chip-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  background: var(--chip-bg);
  color: var(--chip-text);
  font-size: 14px;
  padding: 8px 15px;
  border-radius: 9px;
  cursor: pointer;
}

.chip-tag.is-active {
  background: #E0EDFF;
  border-color: var(--accent);
  color: var(--accent);
}

.chip-tag .dot {
  width: 14px;
  height: 14px;
}

.panel-btn {
  height: 42px;
  border: 0;
  border-radius: 10px;
  background: var(--chip-bg);
  color: var(--chip-text);
  font-size: 14px;
  cursor: pointer;
}

.panel-btn-primary {
  background: var(--accent);
  color: #FFFFFF;
}

.panel-btn:active {
  filter: brightness(0.95);
}

.panel-btn-row {
  display: flex;
  gap: 10px;
}

.panel-btn-row .panel-btn {
  flex: 1;
}

.panel-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-field label {
  width: 76px;
  font-size: 13px;
  color: var(--muted);
  flex: none;
}

.panel-field input {
  flex: 1;
  min-width: 0;
  height: 42px;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 15px;
  color: #0F172A;
  background: #FFFFFF;
  outline: none;
}

.panel-field input:focus {
  border-color: var(--accent);
}

/* ======================= 弹层菜单 ======================= */

.pop-menu {
  background: #FFFFFF;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.22);
  border: 1px solid #E2E8F0;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 160px;
}

.pop-item {
  border: 0;
  background: transparent;
  text-align: left;
  font-size: 14px;
  color: #0F172A;
  padding: 11px 14px;
  border-radius: 10px;
  cursor: pointer;
}

.pop-item:active {
  background: #F1F5F9;
}

.pop-item.is-danger {
  color: #DC2626;
}

/* ======================= 提示 ======================= */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(80px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.88);
  color: #FFFFFF;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 10px;
  max-width: 82vw;
  text-align: center;
  z-index: 40;
  pointer-events: none;
  line-height: 1.4;
}

/* 桌面端：面板不要铺满整个屏宽 */
@media (min-width: 720px) {
  .panel-sheet {
    max-width: 560px;
    margin: 0 auto;
    border-radius: 18px;
    margin-bottom: 24px;
  }

  .toast {
    bottom: 40px;
  }

  .mode-chip {
    width: 120px;
  }
}
