/* ===== Reset & Base ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f0f2f5;
  --card: #ffffff;
  --primary: #07c160;
  --primary-hover: #06ad56;
  --danger: #e74c3c;
  --danger-hover: #c0392b;
  --blue: #3498db;
  --text: #1f2328;
  --text-secondary: #606770;
  --border: #e1e4e8;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

/* ===== Header ===== */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; background: var(--card);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.header h1 { font-size: 20px; font-weight: 700; }
.header-right { display: flex; align-items: center; gap: 12px; }
.tag { background: var(--primary); color: #fff; padding: 2px 10px; border-radius: 20px; font-size: 12px; }

/* ===== Stats ===== */
.stats {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.stat-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; text-align: center;
}
.stat-num { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.stat-fail .stat-num { color: var(--danger); }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.tab {
  padding: 8px 20px; border: none; background: transparent;
  border-bottom: 3px solid transparent; cursor: pointer; font-size: 14px;
  color: var(--text-secondary); transition: all 0.2s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== Card ===== */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 16px;
}
.card h3 { font-size: 16px; margin-bottom: 12px; }

/* ===== Table ===== */
.table-wrapper { overflow-x: auto; margin-bottom: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { background: #fafafa; font-weight: 600; color: var(--text-secondary); font-size: 12px; text-transform: uppercase; }
.table tbody tr:hover { background: #f9f9f9; }
.table td { word-break: break-all; }

/* ===== Toolbar ===== */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.toolbar-left, .toolbar-right { display: flex; gap: 8px; align-items: center; }

/* ===== Buttons ===== */
.btn {
  padding: 6px 14px; border: none; border-radius: 6px; cursor: pointer;
  font-size: 13px; transition: all 0.15s; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-secondary { background: #e9ecef; color: var(--text); }
.btn-secondary:hover { background: #dee2e6; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ===== Form ===== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; color: var(--text-secondary); }
.input, .select {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 14px; outline: none; transition: border 0.2s;
}
.input:focus, .select:focus { border-color: var(--primary); }
textarea.input { resize: vertical; }

/* ===== Result Box ===== */
.result-box { margin-top: 12px; padding: 12px; border-radius: 6px; font-size: 13px; display: none; }
.result-box.success { background: #d4edda; color: #155724; display: block; }
.result-box.error { background: #f8d7da; color: #721c24; display: block; }

/* ===== Pagination ===== */
.pagination { display: flex; justify-content: center; gap: 4px; margin-top: 12px; }
.pagination button {
  padding: 4px 10px; border: 1px solid var(--border); background: var(--card);
  border-radius: 4px; cursor: pointer; font-size: 13px;
}
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== Client Info ===== */
.client-info pre {
  background: #f6f8fa; padding: 14px; border-radius: 6px;
  font-size: 12px; overflow-x: auto; margin-top: 10px;
}
details { margin-top: 12px; }
summary { cursor: pointer; color: var(--blue); font-size: 13px; }

/* ===== Status Badge ===== */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.badge-pending { background: #fff3cd; color: #856404; }
.badge-processing { background: #cce5ff; color: #004085; }
.badge-added { background: #d4edda; color: #155724; }
.badge-sent { background: var(--primary); color: #fff; }
.badge-failed { background: #f8d7da; color: #721c24; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal { background: var(--card); border-radius: var(--radius); padding: 24px; width: 500px; max-width: 95vw; }
.modal h3 { margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ===== Misc ===== */
.text-muted { color: var(--text-secondary); font-size: 12px; }
.text-danger { color: var(--danger); }
.text-success { color: var(--primary); }
.gap-8 { gap: 8px; }
