:root {
  --bg: #f5f7fa;
  --card: #fff;
  --ink: #1a2332;
  --muted: #6b7684;
  --line: #e1e4e8;
  --primary: #0066ff;
  --primary2: #0052cc;
  --ok: #0d9b6b;
  --success: #0d9b6b;
  --danger: #d1293d;
  --warn: #b56a00;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --radius: 12px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  background-image: radial-gradient(circle at 15% 0%, rgba(0, 102, 255, 0.08), transparent 40%),
    radial-gradient(circle at 100% 20%, rgba(13, 155, 107, 0.06), transparent 35%);
}

a { color: inherit; text-decoration: none; }

/* ============ Layout ============ */
.topbar {
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar strong { font-size: 18px; font-weight: 700; }
.topbar span { margin-left: 12px; color: var(--muted); font-size: 12px; }
.topbar nav { display: flex; gap: 20px; font-size: 14px; font-weight: 600; }
.topbar nav a:hover { color: var(--primary); }

.page { max-width: 1000px; margin: 0 auto; padding: 40px 20px; }

/* ============ Cards ============ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
  transition: all var(--transition);
}

.card:hover { border-color: rgba(0, 102, 255, 0.2); box-shadow: var(--shadow-lg); }

/* ============ Form & Input ============ */
.form-stack { display: flex; flex-direction: column; gap: 20px; }
label { display: block; font-size: 14px; font-weight: 700; color: var(--ink); }
.label-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }

.input-with-status { position: relative; }
input, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font: inherit;
  outline: none;
  transition: all var(--transition);
}
input:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1); }

.status-indicator { font-size: 12px; font-weight: 600; }
.status-indicator.ok { color: var(--success); }
.status-indicator.error { color: var(--danger); }
.status-indicator.pending { color: var(--primary); }

.phone-check-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--success);
  font-weight: bold;
}

/* ============ Buttons ============ */
button {
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary { background: var(--primary); color: #fff; }
button.primary:hover:not(:disabled) { background: var(--primary2); box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3); }
button.secondary { background: #f0f2f5; color: var(--ink); border: 1px solid var(--line); }
button.secondary:hover:not(:disabled) { background: #e4e6e9; }
button.danger { background: rgba(209, 41, 61, 0.1); color: var(--danger); }
button.ghost { background: transparent; color: var(--primary); border: 1px solid rgba(0, 102, 255, 0.2); }
button.mini { padding: 6px 12px; font-size: 12px; }
.wide { width: 100%; }

/* ============ Result Boxes ============ */
.result-box {
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.6;
  border-left: 4px solid transparent;
  animation: slideIn var(--transition);
}
.result-box.success { background: rgba(13, 155, 107, 0.08); color: #0d9b6b; border-left-color: #0d9b6b; }
.result-box.error { background: rgba(209, 41, 61, 0.08); color: #d1293d; border-left-color: #d1293d; }
.hidden { display: none !important; }

/* ============ Table ============ */
.table-wrap { overflow-x: auto; margin: 0 -24px; padding: 0 24px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 12px; color: var(--muted); border-bottom: 2px solid var(--line); }
td { padding: 12px; border-bottom: 1px solid var(--line); }
.empty { text-align: center; padding: 40px; color: var(--muted); }

/* ============ Badge ============ */
.badge { padding: 4px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; }
.badge.ok { background: rgba(0, 200, 83, 0.1); color: #00c853; }
.badge.off { background: rgba(255, 82, 82, 0.1); color: #ff5252; }

/* ============ Overlay ============ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.loader-content { text-align: center; }
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 102, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

.dropzone {
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  color: var(--muted);
  transition: all var(--transition);
}
.dropzone:hover { border-color: var(--primary); background: rgba(0, 102, 255, 0.02); }
