:root {
  --bg: #0b0f14;
  --surface: #141b24;
  --surface-hover: #1a2430;
  --border: #243041;
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #ef0027;
  --accent-hover: #ff1a3d;
  --success: #22c55e;
  --danger: #ef4444;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC',
    'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(239, 0, 39, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(239, 0, 39, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 20px 64px;
}

header {
  margin-bottom: 32px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent), #ff6b35);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
}

.subtitle {
  color: var(--muted);
  font-size: 0.9rem;
}

.threshold-hint {
  margin-top: 6px;
  font-size: 0.82rem;
}

.card-compact {
  padding: 16px 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 560px) {
  .form-row {
    flex-direction: row;
    align-items: flex-end;
  }

  .form-row .field-grow {
    flex: 1;
  }
}

.field label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.15s;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
}

.field input::placeholder {
  color: #556275;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}

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

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

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

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.35);
  padding: 6px 12px;
  font-size: 0.85rem;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.1);
}

.btn-danger-solid {
  background: var(--danger);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}

.btn-danger-solid:hover:not(:disabled) {
  background: #dc2626;
}

.address-actions {
  display: flex;
  flex-shrink: 0;
}

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

.count-badge {
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.address-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.address-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s;
}

.address-item:hover {
  border-color: rgba(239, 0, 39, 0.3);
}

.address-info {
  min-width: 0;
  flex: 1;
}

.address-tag {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.address-value {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.82rem;
  color: var(--muted);
  word-break: break-all;
}

.address-meta {
  font-size: 0.75rem;
  color: #556275;
  margin-top: 4px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.empty-state p {
  font-size: 0.9rem;
}

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

.toast {
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  animation: slideIn 0.25s ease;
  max-width: 360px;
}

.toast.success {
  background: #14532d;
  border: 1px solid var(--success);
  color: #bbf7d0;
}

.toast.error {
  background: #450a0a;
  border: 1px solid var(--danger);
  color: #fecaca;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.loading {
  text-align: center;
  padding: 24px;
  color: var(--muted);
}

.hint {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 14px;
  line-height: 1.6;
}

.field textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  resize: vertical;
  min-height: 160px;
}

.field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.bulk-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.bulk-preview {
  font-size: 0.82rem;
  color: var(--muted);
}

.bulk-result {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.7;
}

.bulk-result.success {
  border-color: rgba(34, 197, 94, 0.35);
  color: #bbf7d0;
}

.hidden {
  display: none !important;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.pagination span {
  font-size: 0.85rem;
  color: var(--muted);
}

.btn-secondary {
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 14px;
  font-size: 0.85rem;
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--accent);
}

#search {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
}

#search:focus {
  outline: none;
  border-color: var(--accent);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.modal-panel h3 {
  font-size: 1.1rem;
  margin-bottom: 12px;
}

.modal-address {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.82rem;
  color: var(--muted);
  word-break: break-all;
  margin-bottom: 16px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
