.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
  white-space: nowrap;
}

.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: #6dd5fa; }
.btn-primary:active { transform: scale(0.97); }

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

.btn-ghost { background: transparent; color: var(--text-primary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-hover); }

.btn-sm { padding: 6px 14px; min-height: 36px; font-size: 0.8rem; }
.btn-block { width: 100%; }

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  min-height: unset;
}
.btn-icon svg { width: 20px; height: 20px; fill: currentColor; }

.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #000;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: transform 0.2s;
}
.fab:hover { transform: scale(1.05); }
.fab:active { transform: scale(0.95); }
.fab svg { width: 24px; height: 24px; fill: currentColor; }

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

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

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-actions {
  display: flex;
  gap: 8px;
}

.card-body { font-size: 0.9rem; color: var(--text-secondary); }

.card-info .info-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.card-info .info-row:last-child { border-bottom: none; }
.card-info .info-label { color: var(--text-secondary); }
.card-info .info-value { color: var(--text-primary); font-weight: 500; }

.input-group { margin-bottom: 16px; }

.input-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
  min-height: 44px;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--text-muted); }

.textarea {
  min-height: 80px;
  resize: vertical;
  font-family: inherit;
}

.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 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.input-number { width: 80px; text-align: center; }

.toggle-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}
.toggle-label { font-size: 0.95rem; color: var(--text-primary); }
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  cursor: pointer;
}
.toggle-input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-hover);
  border-radius: 14px;
  transition: background 0.3s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s;
}
.toggle-input:checked + .toggle-slider { background: var(--accent); }
.toggle-input:checked + .toggle-slider::before { transform: translateX(20px); }

.slider-group { margin-bottom: 16px; }
.slider-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
}
.slider-row { display: flex; align-items: center; gap: 12px; }
.slider-value { font-size: 0.85rem; color: var(--accent); min-width: 32px; text-align: right; font-weight: 600; }
.slider-input {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--bg-hover);
  border-radius: 3px;
  outline: none;
}
.slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
}

.list { display: flex; flex-direction: column; gap: 2px; }
.list-empty {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s;
}
.list-item:hover { background: var(--bg-hover); }
.list-item-left, .list-item-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.list-item-main { flex: 1; min-width: 0; }
.list-item-title { font-size: 0.95rem; font-weight: 500; }
.list-item-subtitle { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner-sm { width: 20px; height: 20px; border-width: 2px; }
.spinner-lg { width: 48px; height: 48px; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

.dialog-overlay, .modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.2s;
  padding: 20px;
}
.dialog-show, .modal-overlay.dialog-show { opacity: 1; }
.dialog-fade-out { opacity: 0; }

.dialog, .modal {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 360px;
  transform: scale(0.95);
  transition: transform 0.2s;
}
.dialog-show .dialog, .dialog-show .modal { transform: scale(1); }

.dialog-title, .modal-title { font-size: 1.1rem; margin-bottom: 8px; }
.dialog-msg { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 20px; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.modal-body { max-height: 60vh; overflow-y: auto; }

.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: #fff;
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.3s;
  pointer-events: auto;
  max-width: 300px;
  box-shadow: 0 4px 12px var(--shadow);
}
.toast-show { opacity: 1; transform: translateX(0); }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--accent-dim); }
.toast-icon { font-size: 1rem; }

.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--warning);
  color: #000;
  text-align: center;
  padding: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
