/**
 * 量衡 · Meter - 全局样式表
 * 延续 WorkLabs 极客暗黑科技调性与优雅排版。
 */

:root {
  --bg: #0b1220;
  --bg-gradient: radial-gradient(1200px 600px at 50% -10%, #152342 0%, var(--bg) 65%);
  --panel: #111a2c;
  --panel-glass: rgba(17, 26, 44, 0.75);
  --panel-hover: #182642;
  --line: rgba(148, 173, 214, 0.14);
  --line-strong: rgba(148, 173, 214, 0.28);
  --text: #e8eefb;
  --text-dim: #8fa3c3;
  --text-faint: #5f7396;
  --accent: #f5a623;
  --accent-glow: rgba(245, 166, 35, 0.25);
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.2);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.2);
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-sans);
  min-height: 100vh;
  padding: 24px 20px 60px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1200px;
  margin: 0 auto;
}

/* 顶部导航与品牌区 */
header.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1e3156, #0e172a);
  border: 1px solid rgba(245, 166, 35, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.brand-text h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-tag {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(245, 166, 35, 0.15);
  color: var(--accent);
  border: 1px solid rgba(245, 166, 35, 0.3);
}

.brand-text p {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 按钮通用风格 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 15px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.btn-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.btn:hover:not(:disabled) .btn-icon:not(.spin) {
  transform: scale(1.1);
}

.btn:hover {
  background: var(--panel-hover);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

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

/* 重新查询主按钮专属质感 */
.btn-primary {
  background: linear-gradient(135deg, #f5a623 0%, #ea9119 50%, #d47a0f 100%);
  border: 1px solid rgba(255, 220, 140, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 2px 8px rgba(245, 166, 35, 0.28);
  color: #0c111c;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #ffb53a 0%, #f59f23 50%, #df8515 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 4px 16px rgba(245, 166, 35, 0.42);
  border-color: rgba(255, 235, 170, 0.6);
  transform: translateY(-1.5px);
}

/* 冷却或禁用态：优雅的暗调磨砂态，摒弃粗糙的灰黄断层 */
.btn-primary:disabled {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text-dim);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-dim);
}

.btn-ghost:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

/* 旋转动效 */
@keyframes spinClockwise {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.spin {
  animation: spinClockwise 0.85s linear infinite;
}

/* 顶部状态通知条 */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--panel-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  margin-bottom: 24px;
}

.status-left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-dim);
}

.pulse-indicator {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
  display: inline-block;
  animation: pulse 2s infinite;
}

.pulse-indicator.warning {
  background: var(--warning);
  box-shadow: 0 0 10px var(--warning);
}

.pulse-indicator.error {
  background: var(--danger);
  box-shadow: 0 0 10px var(--danger);
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.status-right {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
}

.demo-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text-dim);
}

/* 开关组件 */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #243552;
  transition: .3s;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent);
}

input:checked + .slider:before {
  transform: translateX(16px);
}

/* 标签切换导航 */
.nav-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.tab-btn {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* 抽屉 / 模态弹层 */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(4, 8, 16, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: #111a2c;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  padding: 24px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 600;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  justify-content: space-between;
}

.form-hint {
  font-size: 11px;
  color: var(--text-faint);
}

.form-input {
  background: #090f1a;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.2s;
}

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

/* 输入框操作套件：显示密码与单独清空 */
.input-action-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-action-wrap .form-input {
  width: 100%;
}

.input-action-wrap.has-toggle .form-input {
  padding-right: 68px;
}

.input-action-wrap:not(.has-toggle) .form-input {
  padding-right: 38px;
}

.input-actions {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.input-action-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 5px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  line-height: 1;
}

.input-action-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.input-action-btn:active {
  transform: scale(0.92);
}

.input-action-btn.btn-clear:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.12);
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* 全景矩阵静态表格与搜索 */
.matrix-notice-banner {
  background: rgba(243, 128, 32, 0.08);
  border: 1px solid rgba(243, 128, 32, 0.25);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  line-height: 1.5;
}

.matrix-notice-banner strong {
  color: #f38020;
}

.matrix-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.matrix-filters-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 280px;
}

.category-chips, .payment-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
}

.chip:hover {
  border-color: var(--text-dim);
  color: var(--text);
}

.chip.active {
  background: rgba(245, 166, 35, 0.15);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.chip-payment {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(148, 173, 214, 0.06);
  border: 1px solid var(--line);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chip-payment:hover {
  border-color: var(--text-dim);
  color: var(--text);
}

.chip-payment.active {
  background: rgba(245, 166, 35, 0.15);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.chip-payment.active[data-pay="free"] {
  background: rgba(16, 185, 129, 0.18);
  border-color: #10b981;
  color: #34d399;
}

.chip-payment.active[data-pay="required"] {
  background: rgba(239, 68, 68, 0.18);
  border-color: #ef4444;
  color: #f87171;
}

.search-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  min-width: 240px;
}

.matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}

.matrix-card {
  background: var(--panel-glass);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s, border-color 0.2s;
}

.matrix-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.matrix-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.service-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.service-quota-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin: 6px 0;
}

.service-desc-row {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 8px;
}

.service-tip-box {
  background: rgba(11, 18, 32, 0.7);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 10px;
  line-height: 1.5;
}

.badge-payment {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.badge-payment-free {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-payment-required {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.service-payment-row {
  border-top: 1px dashed rgba(148, 173, 214, 0.12);
  padding-top: 8px;
  margin-top: 6px;
}

.payment-warn-text {
  color: #f87171;
  font-weight: 600;
}

.payment-free-text {
  color: #34d399;
}

/* 避坑锦囊布局 */
.synergy-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
}

.synergy-card {
  background: linear-gradient(180deg, var(--panel) 0%, rgba(17, 26, 44, 0.6) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.synergy-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.synergy-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.synergy-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.synergy-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
}

/* 响应式断点 */
@media (max-width: 768px) {
  body {
    padding: 16px 12px 40px;
  }
  .matrix-grid, .synergy-list {
    grid-template-columns: 1fr;
  }
  .header-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
