/* ===== 页面级样式 ===== */

/* 登录页 */
.login-view {
  display: grid;
  min-height: calc(100vh - 112px);
  place-items: center;
}

.login-panel {
  display: grid;
  width: min(420px, 100%);
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-panel h2 { margin: 0; font-size: 24px; }
.login-panel p { margin: 0; color: var(--muted); line-height: 1.6; }

.login-panel label {
  display: grid;
  gap: 6px;
}

.login-panel label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.login-panel input {
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: none;
}

.login-alert {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--rose-soft);
  color: var(--rose);
  font-size: 13px;
  font-weight: 700;
}

/* 弹窗 */
.modal-backdrop {
  position: fixed;
  inset: 0; z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(12, 18, 15, 0.42);
  animation: fadeIn 0.15s ease;
}

.modal {
  width: min(960px, 100%);
  max-height: min(760px, calc(100vh - 44px));
  overflow: auto;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: slideUp 0.2s ease;
}

.modal-header {
  position: sticky;
  top: 0; z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.modal-header h3 { margin: 0; font-size: 20px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 18px;
}

.field { display: grid; gap: 6px; }
.field.wide { grid-column: span 2; }
.field.full { grid-column: 1 / -1; }

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.required-mark {
  color: var(--rose);
  margin-left: 2px;
}

/* 省市区级联选择器 */
.region-cascade .region-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.region-cascade .region-row select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  padding: 0 10px;
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition);
}

.region-cascade .region-row select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 127, 120, 0.1);
}

.field input,
.field select,
.field textarea { padding: 0 10px; }

.field textarea {
  min-height: 86px;
  padding: 10px;
  resize: vertical;
}

.field .field-error {
  color: var(--rose);
  font-size: 12px;
  display: none;
}

.form-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

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

/* 加载覆盖层 */
.loading-overlay {
  position: fixed;
  inset: 0; z-index: 60;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(245, 246, 243, 0.72);
  backdrop-filter: blur(4px);
}

.loading-overlay.is-active { display: grid; }

.loading-panel {
  display: grid;
  min-width: min(320px, 100%);
  gap: 10px;
  justify-items: center;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.loading-panel strong { font-size: 16px; }
.loading-panel span { color: var(--muted); font-size: 13px; }

.loading-spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--line);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* 地图 */
.map-picker {
  display: grid;
  gap: 10px;
}

.map-picker.is-hidden { display: none; }

.map-toolbar {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.map-toolbar input {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: none;
}

.map-canvas {
  width: 100%; height: 360px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #eef3ef;
}

.map-canvas-slot { position: relative; }

.map-canvas-host {
  width: 100%; height: 100%;
  min-height: 100%;
  border: 0;
  border-radius: 0;
}

.map-canvas-host.is-detached {
  position: fixed;
  left: -10000px; top: -10000px;
  width: 360px; height: 240px;
  pointer-events: none;
}

/* 地图搜索自动补全下拉 */
.map-ac-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  max-height: 240px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
  display: none;
}

.map-ac-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}

.map-ac-item:last-child { border-bottom: 0; }

.map-ac-item:hover,
.map-ac-item:focus { background: var(--fill-hover); }

.map-ac-name {
  display: block;
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
}

.map-ac-addr {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
}

.map-toolbar { position: relative; }

/* 危险hover */
.ghost-button.danger-hover:hover {
  color: var(--rose);
}

/* Radio 单选项 */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.radio-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
  user-select: none;
}

.radio-item:hover {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.radio-item:has(input:checked) {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 700;
}

.radio-item input[type="radio"] {
  accent-color: var(--teal);
  width: 16px;
  height: 16px;
  margin: 0;
}

.radio-label {
  color: inherit;
  font-size: inherit;
}

/* 日期选择器 - 原生 date input */
.date-input-native {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}

.date-input-native:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 127, 120, 0.1);
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
