* {
  box-sizing: border-box;
}

:root {
  --header-h: 120px;
  --bg-deep: #060b14;
  --bg-panel: rgba(10, 18, 32, 0.72);
  --bg-card: rgba(12, 22, 40, 0.85);
  --border: rgba(56, 189, 248, 0.18);
  --border-strong: rgba(56, 189, 248, 0.45);
  --cyan: #22d3ee;
  --cyan-dim: #0891b2;
  --blue: #3b82f6;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --text-muted: #64748b;
  --green: #34d399;
  --amber: #fbbf24;
  --glow: 0 0 20px rgba(34, 211, 238, 0.25);
  --font-display: 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, monospace;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg-deep);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC',
    'Microsoft YaHei', sans-serif;
}

body {
  overscroll-behavior-y: contain;
}

/* 背景层 */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(34, 211, 238, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 211, 238, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 20%, transparent 75%);
}

.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  animation: float 12s ease-in-out infinite;
}

.bg-glow-a {
  width: 320px;
  height: 320px;
  top: -80px;
  left: -60px;
  background: #0e7490;
}

.bg-glow-b {
  width: 280px;
  height: 280px;
  bottom: 10%;
  right: -40px;
  background: #1d4ed8;
  animation-delay: -6s;
}

@keyframes float {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(20px, 16px) scale(1.08);
  }
}

.app.app-locked {
  visibility: hidden;
  pointer-events: none;
}

/* 访问验证 */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(6, 11, 20, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.auth-gate.hidden {
  display: none;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  padding: 28px 24px 24px;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, rgba(12, 22, 40, 0.95) 0%, rgba(10, 18, 32, 0.92) 100%);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45), var(--glow);
  text-align: center;
}

.auth-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.08);
}

.auth-icon svg {
  width: 26px;
  height: 26px;
}

.auth-card h2 {
  margin: 0 0 8px;
  font-size: 18px;
  color: #f8fafc;
}

.auth-card p {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-dim);
}

.auth-field input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.7);
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.auth-field input:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12);
}

.auth-error {
  margin: 10px 0 0;
  font-size: 12px;
  color: #f87171;
}

.auth-error.hidden {
  display: none;
}

.auth-submit {
  width: 100%;
  height: 44px;
  margin-top: 16px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.25) 0%, rgba(59, 130, 246, 0.25) 100%);
  color: var(--cyan);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.app {
  position: relative;
  z-index: 1;
  height: 100%;
  max-width: 720px;
  margin: 0 auto;
}

/* 固定顶栏 */
.app-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 720px;
  z-index: 30;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: linear-gradient(
    180deg,
    rgba(6, 11, 20, 0.95) 0%,
    rgba(6, 11, 20, 0.88) 100%
  );
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.topbar {
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(34, 211, 238, 0.08);
}

.brand {
  min-width: 0;
}

.brand-text h1 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #f8fafc;
  text-shadow: 0 0 24px rgba(34, 211, 238, 0.3);
}

.brand-text p {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: rgba(226, 232, 240, 0.88);
}

/* 搜索栏 */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 12px;
}

.search-shell {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.6);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-shell:focus-within {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.1), var(--glow);
}

.search-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--cyan-dim);
}

.search-shell input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}

.search-shell input::placeholder {
  color: var(--text-muted);
}

.search-shell input::-webkit-search-cancel-button {
  display: none;
}

.btn-search {
  flex-shrink: 0;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.2) 0%, rgba(59, 130, 246, 0.2) 100%);
  color: var(--cyan);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
}

.btn-search:hover:not(:disabled) {
  box-shadow: var(--glow);
}

.btn-search:active:not(:disabled) {
  transform: scale(0.97);
}

.btn-search:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-clear {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.5);
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.btn-clear svg {
  width: 16px;
  height: 16px;
}

.btn-clear:hover {
  color: var(--cyan);
  border-color: var(--border-strong);
}

/* 列表区 */
.list-wrap {
  height: 100%;
  padding-top: var(--header-h);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-left: 14px;
  padding-right: 14px;
  padding-bottom: 28px;
}

.pull-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 0;
  overflow: hidden;
  font-size: 12px;
  color: var(--text-muted);
  transition: height 0.2s ease;
}

.pull-indicator.active {
  height: 32px;
}

.pull-indicator.ready {
  color: var(--cyan);
}

.pull-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  opacity: 0;
  transition: opacity 0.2s;
}

.pull-indicator.active .pull-dot {
  opacity: 1;
  animation: blink 1s ease infinite;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}


.tenant-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 8px;
}

/* 卡片 */
.tenant-card {
  position: relative;
  border-radius: 10px;
  padding: 1px;
  background: linear-gradient(
    135deg,
    rgba(34, 211, 238, 0.3) 0%,
    rgba(59, 130, 246, 0.12) 50%,
    rgba(34, 211, 238, 0.06) 100%
  );
  animation: card-in 0.35s ease both;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tenant-card-inner {
  position: relative;
  border-radius: 9px;
  padding: 10px 11px 9px;
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  overflow: hidden;
}

.tenant-card-inner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.5), transparent);
}

.card-corner {
  position: absolute;
  width: 8px;
  height: 8px;
  border-color: var(--cyan);
  border-style: solid;
  opacity: 0.4;
}

.card-corner-tl {
  top: 6px;
  left: 6px;
  border-width: 1px 0 0 1px;
}

.card-corner-br {
  bottom: 6px;
  right: 6px;
  border-width: 0 1px 1px 0;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.room-block {
  min-width: 0;
}

.room {
  font-size: 15px;
  font-weight: 700;
  color: #f1f5f9;
}

.card-project {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
}

.tag {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
}

.tag-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.tag-active {
  color: var(--green);
  background: rgba(52, 211, 153, 0.1);
  border-color: rgba(52, 211, 153, 0.3);
}

.tag-active .tag-dot {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

.tag-moved_out {
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.1);
  border-color: rgba(148, 163, 184, 0.3);
}

.tag-moved_out .tag-dot {
  background: #94a3b8;
  box-shadow: 0 0 6px rgba(148, 163, 184, 0.5);
}

.card-divider {
  height: 1px;
  margin: 6px 0 7px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.info-item.full {
  grid-column: 1 / -1;
}

.info-item .label {
  font-size: 11px;
  color: var(--text-muted);
}

.info-item .value {
  font-size: 13px;
  color: #f1f5f9;
  word-break: break-all;
  line-height: 1.35;
}

.info-item .value.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #bae6fd;
}

.phone-link {
  display: inline-block;
  text-decoration: none;
  color: #7dd3fc;
  -webkit-tap-highlight-color: transparent;
}

.phone-link:active {
  opacity: 0.75;
}

.copyable {
  display: inline-block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.copyable.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #bae6fd;
}

.copyable:active {
  opacity: 0.7;
}

.copy-toast {
  position: fixed;
  left: 50%;
  bottom: 72px;
  z-index: 200;
  transform: translateX(-50%) translateY(12px);
  padding: 10px 18px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--border-strong);
  color: #e2e8f0;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.copy-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.copy-toast.hidden {
  opacity: 0;
}

.empty-state {
  padding: 40px 16px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: rgba(10, 18, 32, 0.5);
}

.empty-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 10px;
  color: var(--text-muted);
  opacity: 0.6;
}

.empty-title {
  margin: 0 0 4px;
  font-size: 14px;
  color: var(--text-dim);
}

.empty-desc {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.empty-state.error .empty-title {
  color: #f87171;
}

.load-more-sentinel {
  height: 1px;
}

.list-footer {
  padding: 12px 0 6px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}
