.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 42px;
  padding: 0 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #4f46e5, #6366f1 55%, #7c3aed);
  box-shadow: 0 14px 28px rgba(99, 102, 241, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.btn-primary:hover {
  box-shadow: 0 20px 34px rgba(99, 102, 241, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.74);
  color: var(--c-text-1);
  border: 1px solid var(--c-border-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.btn-secondary:hover {
  background: #fff;
  border-color: var(--c-border-3);
  box-shadow: var(--shadow-sm);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.34);
  color: var(--c-text-2);
  border: 1px solid rgba(15, 23, 42, 0.08);
  backdrop-filter: var(--blur-sm);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.64);
  color: var(--c-text-1);
  border-color: var(--c-border-2);
}

.btn-danger {
  background: var(--c-danger-subtle);
  color: var(--c-danger);
  border: 1px solid rgba(220, 38, 38, 0.16);
}

.btn-danger:hover { background: rgba(220, 38, 38, 0.16); }

.btn-sm { height: 34px; padding: 0 13px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15.5px; border-radius: var(--radius-lg); }
.btn-xl { height: 56px; padding: 0 28px; font-size: 16.5px; border-radius: var(--radius-lg); }
.btn-block { width: 100%; }

.btn-loading { pointer-events: none; opacity: 0.82; }
.btn-loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

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

.form-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--c-text-2);
  letter-spacing: 0.01em;
}

.form-input,
.table-wrap textarea,
.table-wrap input,
.table-wrap select {
  min-height: 44px;
  padding: 11px 15px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--c-border-2);
  border-radius: var(--radius-md);
  color: var(--c-text-1);
  font-size: 15px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.form-input:hover,
.table-wrap textarea:hover,
.table-wrap input:hover,
.table-wrap select:hover {
  border-color: var(--c-border-3);
}

.form-input:focus,
.table-wrap textarea:focus,
.table-wrap input:focus,
.table-wrap select:focus {
  background: #fff;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 4px var(--c-accent-subtle);
}

.form-input::placeholder { color: var(--c-text-4); }

.form-textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.65;
}

.form-input-prefix-wrap { position: relative; }

.form-input-prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--c-text-4);
  font-size: 13px;
  pointer-events: none;
}

.form-input-prefix-wrap .form-input { padding-left: 30px; }
.form-hint { font-size: 12.5px; color: var(--c-text-3); line-height: 1.65; }
.form-error { font-size: 12.5px; color: var(--c-danger); }
.form-input.is-error { border-color: var(--c-danger); box-shadow: 0 0 0 4px var(--c-danger-subtle); }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364758b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
  cursor: pointer;
}

.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.toggle {
  width: 44px;
  height: 26px;
  background: #d8e1f0;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius-full);
  position: relative;
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.toggle::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: #fff;
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.16);
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: all var(--transition-spring);
}

.toggle.is-on { background: var(--c-accent); border-color: var(--c-accent); }
.toggle.is-on::after { left: 20px; }
.toggle-label { font-size: 13.5px; color: var(--c-text-2); }

.card,
.modal {
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-xl);
  padding: 26px;
  box-shadow: var(--shadow-md);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
}

.card-hover {
  transition: transform var(--transition-base), box-shadow var(--transition-base), background var(--transition-base), border-color var(--transition-base);
  cursor: pointer;
}

.card-hover:hover {
  transform: translateY(-3px);
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-lg);
}

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

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--c-text-1);
  letter-spacing: -0.015em;
}

.card-subtitle { font-size: 13px; color: var(--c-text-3); margin-top: 3px; line-height: 1.6; }

.card-glass {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.68)),
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.7), transparent 36%);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.stat-card {
  padding: 22px 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.68));
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: var(--radius-xl);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
  box-shadow: var(--shadow-sm);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(79, 70, 229, 0.42), transparent);
}

.stat-label {
  font-size: 11.5px;
  color: var(--c-text-3);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.stat-value {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.05em;
  color: var(--c-text-1);
  margin: 8px 0 10px;
  line-height: 1;
}

.stat-change {
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-change.up { color: var(--c-success); }
.stat-change.down { color: var(--c-danger); }

.table-wrap {
  border: 1px solid var(--c-border-1);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-sm);
}

.table-wrap table,
.table {
  width: 100%;
  border-collapse: collapse;
}

.table-wrap th,
.table th {
  padding: 12px 16px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--c-text-3);
  text-align: left;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.72);
  border-bottom: 1px solid var(--c-border-1);
  white-space: nowrap;
}

.table-wrap td,
.table td {
  padding: 14px 16px;
  font-size: 13.5px;
  color: var(--c-text-2);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.table-wrap tr:last-child td,
.table tr:last-child td { border-bottom: none; }

.table-wrap tbody tr:hover td,
.table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.9);
  color: var(--c-text-1);
}

.table-mono { font-family: var(--font-mono); font-size: 12.5px; color: var(--c-text-3); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-success { background: var(--c-success-subtle); color: var(--c-success); }
.badge-danger { background: var(--c-danger-subtle); color: var(--c-danger); }
.badge-warning { background: var(--c-warning-subtle); color: var(--c-warning); }
.badge-info { background: var(--c-info-subtle); color: var(--c-info); }
.badge-default { background: rgba(15, 23, 42, 0.06); color: var(--c-text-3); }
.badge-accent { background: var(--c-accent-subtle); color: var(--c-accent); }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-success { background: var(--c-success); box-shadow: 0 0 0 8px rgba(22, 163, 74, 0.12); animation: pulse 2s infinite; }
.dot-danger { background: var(--c-danger); }
.dot-warning { background: var(--c-warning); }

.modal-backdrop,
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(244, 247, 253, 0.72);
  backdrop-filter: blur(14px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.modal-backdrop.is-open,
.modal-overlay.show,
.modal-overlay.is-open {
  display: flex;
  opacity: 1;
}

.modal {
  width: 100%;
  max-width: 520px;
  transform: scale(.98) translateY(8px);
  transition: all var(--transition-spring);
}

.modal-backdrop.is-open .modal,
.modal-overlay.show .modal,
.modal-overlay.is-open .modal {
  transform: scale(1) translateY(0);
}

.modal-title { font-size: 18px; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 6px; }
.modal-desc { font-size: 13.5px; color: var(--c-text-3); margin-bottom: 24px; line-height: 1.7; }

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  border-top: 1px solid var(--c-border-1);
  padding-top: 20px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 18px;
  color: var(--c-text-3);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  color: var(--c-text-1);
  min-width: 280px;
  max-width: 420px;
  transform: translateX(100%);
  opacity: 0;
  transition: all var(--transition-spring);
}

.toast.is-show { transform: translateX(0); opacity: 1; }
.toast-success { border-color: rgba(22, 163, 74, 0.2); }
.toast-danger { border-color: rgba(220, 38, 38, 0.18); }
.toast-warning { border-color: rgba(217, 119, 6, 0.18); }
.toast-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(79, 70, 229, 0.1);
  color: var(--c-accent);
  font-size: 12px;
  font-weight: 800;
}

.icon-shell {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.12), rgba(56, 189, 248, 0.12));
  color: var(--c-accent);
  border: 1px solid rgba(79, 70, 229, 0.14);
}

.empty-state {
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--c-text-3);
}

.empty-state svg {
  width: 56px;
  height: 56px;
  color: var(--c-text-4);
}

.split-line {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--c-text-3);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.split-line::before,
.split-line::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--c-border-2), transparent);
}

.stepper {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.step {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--c-text-3);
}

.step-node {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--c-border-2);
  background: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 800;
}

.step.is-active { color: var(--c-text-1); }
.step.is-active .step-node {
  border-color: rgba(79, 70, 229, 0.24);
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.segmented {
  display: inline-flex;
  gap: 6px;
  padding: 5px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--c-border-1);
}

.segmented button {
  min-width: 84px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--c-text-2);
  font-weight: 600;
  transition: all var(--transition-fast);
}

.segmented button.is-active {
  background: rgba(255, 255, 255, 0.92);
  color: var(--c-accent);
  box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.16), 0 10px 24px rgba(79, 70, 229, 0.08);
}

.chart-panel {
  position: relative;
  min-height: 260px;
}

.mono-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  font-family: var(--font-mono);
  font-size: 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--c-border-1);
  color: var(--c-text-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

@media (max-width: 768px) {
  .toast-container {
    left: 16px;
    right: 16px;
    top: auto;
    bottom: 16px;
  }

  .toast {
    min-width: 0;
    max-width: none;
  }
}

@media (max-width: 560px) {
  .btn {
    height: 40px;
    padding: 0 16px;
    font-size: 13.5px;
  }

  .btn-sm {
    height: 32px;
    padding: 0 12px;
    font-size: 12.5px;
  }

  .btn-lg {
    height: 44px;
    padding: 0 18px;
    font-size: 14.5px;
  }

  .btn-xl {
    height: 48px;
    padding: 0 20px;
    font-size: 15px;
  }

  .form-label {
    font-size: 13px;
  }

  .form-input,
  .table-wrap textarea,
  .table-wrap input,
  .table-wrap select {
    min-height: 40px;
    padding: 10px 13px;
    font-size: 14px;
  }

  .card,
  .modal {
    padding: 20px;
  }

  .card-title {
    font-size: 15px;
  }

  .card-subtitle {
    font-size: 12.5px;
  }

  .stat-card {
    padding: 18px 18px;
  }
}
