/* ============================================================================
 * 安康智护（MedCare+）V2 临床高定设计系统 Token
 * 美学哲学：瑞士医疗极简主义 · 温润瓷白画布 · 极细微描边 · 植物翠玉主色 · 克制高级留白
 * ========================================================================== */

:root {
  --bg-canvas: #f4f6f5;
  --bg-surface: #ffffff;
  --bg-subtle: #f7f9f8;
  --bg-muted: #ecf0ee;

  --text-primary: #111f1b;
  --text-secondary: #51625d;
  --text-muted: #869691;
  --text-inverse: #ffffff;

  /* 沉稳深植物翠玉主色，克制而不刺眼 */
  --primary: #0a7c64;
  --primary-hover: #086853;
  --primary-soft: #e7f3ef;
  --primary-tint: #f2f9f6;

  /* 柔和莫兰迪语义色板 */
  --indigo: #5c71b8;
  --indigo-soft: #eef1fa;
  --emerald: #0e8f6d;
  --emerald-soft: #e7f5f0;
  --rose: #bf4c72;
  --rose-soft: #fbeef2;
  --amber: #c47422;
  --amber-soft: #fdf3e7;
  --danger: #c63b42;
  --danger-soft: #fcedee;
  --blue: #2d6bc4;
  --blue-soft: #edf3fc;

  --dot-ok: #2ea46b;
  --dot-warn: #dc8233;
  --dot-empty: #dce2df;

  --border-subtle: rgba(17, 31, 27, 0.068);
  --border-strong: rgba(17, 31, 27, 0.13);

  --radius-sm: 9px;
  --radius-md: 13px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 9999px;

  --shadow-card: 0 1px 2px rgba(17, 31, 27, 0.028), 0 6px 20px rgba(17, 31, 27, 0.032);
  --shadow-float: 0 8px 30px rgba(17, 31, 27, 0.09);
  --shadow-fab: 0 8px 20px rgba(10, 124, 100, 0.28);

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Helvetica Neue", sans-serif;
  --transition: 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

.ico {
  display: inline-block;
  vertical-align: -0.18em;
  flex-shrink: 0;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* 卡片：极细描边 + 轻盈环境阴影 */
.card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
}

/* 按钮体系：克制比例、无浮夸渐变 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: -0.005em;
  transition: transform var(--transition), background var(--transition), border-color var(--transition), color var(--transition), opacity var(--transition);
  white-space: nowrap;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

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

.btn-primary {
  background: var(--primary);
  color: var(--text-inverse);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-soft {
  background: var(--primary-soft);
  color: var(--primary);
}

.btn-soft:hover:not(:disabled) {
  background: #daede6;
}

.btn-outline {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
}

.btn-outline:hover:not(:disabled) {
  background: var(--bg-subtle);
  border-color: rgba(17, 31, 27, 0.22);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger-soft {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-danger-soft:hover:not(:disabled) {
  background: #f8dfe1;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

/* 精致低饱和状态徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.01em;
}

.badge-ok {
  background: var(--emerald-soft);
  color: #0b6e53;
}

.badge-warn {
  background: var(--amber-soft);
  color: #9e5612;
}

.badge-danger {
  background: var(--danger-soft);
  color: #a92b32;
}

.badge-blue {
  background: var(--blue-soft);
  color: #1f53a0;
}

.badge-neutral {
  background: var(--bg-muted);
  color: var(--text-secondary);
}

/* 表单控件 */
.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 10px 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-muted);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(10, 124, 100, 0.1);
}

.textarea {
  resize: vertical;
  min-height: 76px;
}

/* 轻盈克制 Toast */
#toast-container {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 400px);
  pointer-events: none;
}

.toast {
  background: #14221e;
  color: #ffffff;
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-float);
  animation: toastIn 0.22s ease;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.toast-success {
  background: #0a5b48;
}

.toast.toast-error {
  background: #a42a30;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 弹窗 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(14, 24, 21, 0.42);
  backdrop-filter: blur(5px);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.16s ease;
}

.modal-panel {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  width: min(100%, 520px);
  max-height: 88vh;
  overflow-y: auto;
  padding: 22px;
  box-shadow: var(--shadow-float);
  animation: slideUp 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.modal-title {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-muted);
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}

.icon-btn:hover {
  background: #dfe6e3;
  color: var(--text-primary);
}

/* Lightbox */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 16, 14, 0.92);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.lightbox-toolbar {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  z-index: 2010;
}

.lightbox-toolbar button {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 600;
  backdrop-filter: blur(8px);
}

.lightbox-stage {
  max-width: 96vw;
  max-height: 82vh;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-stage img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 12px;
  transition: transform 0.2s ease;
}

/* 医疗合规声明条（极致柔和，不抢视觉焦点） */
.compliance-banner {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 11px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  line-height: 1.6;
}

/* Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  background: #cdd5d2;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
}

.switch-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16);
  transition: transform 0.2s;
}

.switch input:checked + .switch-slider {
  background: var(--primary);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(20px);
}

.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-muted);
  font-size: 13.5px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
