/* Overpipe App Styles */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --ink: #0a0a0a;
  --chalk: #fafaf9;
  --lime: #c8ff00;
  --lime-dark: #a8d600;
  --lime-muted: #e8ff80;
  --slate: #6b7280;
  --slate-light: #9ca3af;
  --border: #e5e5e5;
  --border-dark: #d1d5db;
  --bg-card: #ffffff;
  --bg-subtle: #f5f5f4;
  --red: #ef4444;
  --green: #22c55e;
  --blue: #3b82f6;
  --orange: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--chalk);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3, h4 { font-family: 'Space Grotesk', sans-serif; letter-spacing: -0.5px; }

/* Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--ink);
  color: var(--chalk);
  padding: 24px 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s;
}

.sidebar-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  padding: 0 24px;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-logo .dot {
  width: 10px;
  height: 10px;
  background: var(--lime);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

.sidebar-nav { flex: 1; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  color: var(--chalk);
  background: rgba(255,255,255,0.05);
}

.sidebar-nav a.active {
  color: var(--lime);
  border-left-color: var(--lime);
  background: rgba(200,255,0,0.05);
}

.sidebar-nav a svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-bottom {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-logout {
  color: rgba(255,255,255,0.4);
  text-decoration: none;
  font-size: 0.8rem;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
}

.sidebar-logout:hover { color: var(--red); }

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 240px;
  padding: 32px 40px;
  min-height: 100vh;
}

.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.page-header p {
  color: var(--slate);
  font-size: 0.95rem;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

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

.card-title {
  font-size: 1rem;
  font-weight: 600;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

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

.stat-label {
  font-size: 0.8rem;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.stat-value.lime { color: var(--lime-dark); }
.stat-value.green { color: var(--green); }
.stat-value.blue { color: var(--blue); }
.stat-value.orange { color: var(--orange); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--ink);
  color: var(--chalk);
}

.btn-primary:hover {
  background: #1a1a1a;
  box-shadow: var(--shadow-md);
}

.btn-lime {
  background: var(--lime);
  color: var(--ink);
  font-weight: 600;
}

.btn-lime:hover {
  background: var(--lime-dark);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
}

.btn-outline:hover {
  border-color: var(--ink);
  background: var(--bg-subtle);
}

.btn-danger {
  background: var(--red);
  color: white;
}

.btn-danger:hover { opacity: 0.9; }

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

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

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 6px;
}

.form-group small {
  display: block;
  font-size: 0.75rem;
  color: var(--slate);
  margin-top: 4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--bg-card);
  color: var(--ink);
  transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(10,10,10,0.05);
}

textarea { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Tags input */
.tags-input {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  min-height: 42px;
  cursor: text;
}

.tags-input:focus-within {
  border-color: var(--ink);
}

.tags-input .tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.8rem;
}

.tags-input .tag-remove {
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  opacity: 0.5;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
}

.tags-input .tag-remove:hover { opacity: 1; color: var(--red); }

.tags-input input {
  border: none;
  outline: none;
  padding: 2px 4px;
  font-size: 0.85rem;
  background: transparent;
  flex: 1;
  min-width: 80px;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 10px 16px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--slate);
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}

td {
  padding: 12px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:hover td { background: var(--bg-subtle); }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-new { background: #dbeafe; color: #1d4ed8; }
.badge-contacted { background: #fef3c7; color: #92400e; }
.badge-replied { background: #d1fae5; color: #065f46; }
.badge-booked { background: #dcfce7; color: #166534; }
.badge-lost { background: #fee2e2; color: #991b1b; }
.badge-draft { background: #f3f4f6; color: #4b5563; }
.badge-active { background: #dcfce7; color: #166534; }
.badge-paused { background: #fef3c7; color: #92400e; }
.badge-confirmed { background: #dcfce7; color: #166534; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-completed { background: #dbeafe; color: #1d4ed8; }
.badge-pending { background: #f3f4f6; color: #4b5563; }
.badge-scheduled { background: #f5f3ff; color: #7c3aed; }
.badge-sent { background: #dbeafe; color: #1d4ed8; }
.badge-opened { background: #fef3c7; color: #92400e; }
.badge-clicked { background: #dcfce7; color: #166534; }
.badge-failed { background: #fee2e2; color: #991b1b; }
.badge-bounced { background: #fee2e2; color: #991b1b; }
.badge-spam { background: #fecaca; color: #7f1d1d; }

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}

/* Score bar */
.score-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-bar-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  max-width: 60px;
}

.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--lime-dark);
}

.score-bar span {
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 28px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--slate);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state h3 {
  font-size: 1.1rem;
  color: var(--ink);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.9rem;
  margin-bottom: 20px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 { font-size: 1.1rem; }

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--slate);
  line-height: 1;
}

.modal-body { padding: 24px; }

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

/* Auth pages */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--chalk);
}

.auth-card {
  max-width: 400px;
  width: 100%;
}

.auth-card .logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auth-card h2 {
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 8px;
}

.auth-card .subtitle {
  text-align: center;
  color: var(--slate);
  margin-bottom: 32px;
  font-size: 0.95rem;
}

.auth-card .switch {
  text-align: center;
  margin-top: 24px;
  font-size: 0.9rem;
  color: var(--slate);
}

.auth-card .switch a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.auth-card .switch a:hover { text-decoration: underline; }

.error-msg {
  background: #fef2f2;
  color: #991b1b;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
  border: 1px solid #fecaca;
}

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--slate);
  font-size: 0.9rem;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 10px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Grid layouts */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }

/* Checkbox */
.checkbox-cell { width: 40px; }
.checkbox-cell input { cursor: pointer; width: 16px; height: 16px; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 20px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* Mobile menu toggle */
.mobile-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 60;
  background: var(--ink);
  color: var(--chalk);
  border: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.2rem;
}

@media (max-width: 768px) {
  .mobile-toggle { display: block; }
}

/* Sections */
.section { margin-bottom: 32px; }
.section-title { font-size: 1rem; font-weight: 600; margin-bottom: 16px; }

/* Utility */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }

/* Booking link display */
.booking-link-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  word-break: break-all;
}

.booking-link-box code {
  flex: 1;
  font-family: monospace;
  color: var(--ink);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 0.9rem;
  z-index: 300;
  animation: slideUp 0.3s ease;
  box-shadow: var(--shadow-md);
}

.toast-success { background: var(--green); }
.toast-error { background: var(--red); }

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* === Deliverability Page === */
.deliverability-check {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
}

.deliverability-check p {
  font-size: 0.8rem;
  color: var(--slate);
  margin-top: 2px;
}

.check-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.check-todo { background: var(--border); color: var(--slate); }
.check-done { background: var(--lime); color: var(--ink); }

.guide-section { padding-top: 8px; }

.guide-section h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--ink);
}

.guide-steps {
  list-style: decimal;
  padding-left: 20px;
  color: var(--slate);
  font-size: 0.9rem;
  line-height: 1.8;
}

.guide-steps li strong { color: var(--ink); }
.guide-steps a { color: var(--blue); text-decoration: none; }
.guide-steps a:hover { text-decoration: underline; }

.dns-table {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: 0.85rem;
}

.dns-row {
  display: grid;
  grid-template-columns: 70px 200px 1fr 80px;
  gap: 0;
}

.dns-header {
  background: var(--bg-subtle);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--slate);
}

.dns-row > span {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  word-break: break-all;
}

.dns-row:last-child > span { border-bottom: none; }
.dns-row > span:last-child { border-right: none; }

.dns-value { word-break: break-all; }

.btn-copy {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: white;
  cursor: pointer;
  font-size: 0.75rem;
  font-family: inherit;
  color: var(--slate);
  transition: all 0.15s;
}

.btn-copy:hover { border-color: var(--lime-dark); color: var(--ink); }

.info-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.85rem;
  color: #1e40af;
  line-height: 1.5;
}

.info-box a { color: #1d4ed8; }

.info-tip {
  background: #fefce8;
  border-color: #fde68a;
  color: #78350f;
}

.info-tip a { color: #92400e; }

.policy-card {
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  text-align: center;
}

.policy-card code {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  margin: 6px 0;
}

.policy-card p {
  font-size: 0.8rem;
  color: var(--slate);
  margin-top: 4px;
}

.policy-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.policy-none { background: #f0fdf4; }
.policy-none code { color: #15803d; }
.policy-quarantine { background: #fffbeb; }
.policy-quarantine code { color: #b45309; }
.policy-reject { background: #fef2f2; }
.policy-reject code { color: #dc2626; }

.best-practice-card {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.bp-icon { font-size: 1.4rem; flex-shrink: 0; line-height: 1; padding-top: 2px; }

.best-practice-card strong { font-size: 0.9rem; display: block; margin-bottom: 4px; }
.best-practice-card p { font-size: 0.82rem; color: var(--slate); line-height: 1.5; }
.best-practice-card code { font-size: 0.78rem; background: var(--border); padding: 1px 4px; border-radius: 3px; }

.tool-card {
  display: block;
  padding: 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  transition: all 0.15s;
}

.tool-card:hover {
  border-color: var(--lime-dark);
  background: rgba(200,255,0,0.05);
  transform: translateY(-1px);
}

.tool-name { font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; }
.tool-desc { font-size: 0.82rem; color: var(--slate); line-height: 1.4; margin-bottom: 8px; }
.tool-link { font-size: 0.8rem; color: var(--blue); font-weight: 500; }

@media (max-width: 768px) {
  .dns-row { grid-template-columns: 1fr; }
  .dns-row > span { border-right: none; }
}

/* === ANALYTICS === */
.stats-grid-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

@media (max-width: 1200px) {
  .stats-grid-5 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
  .stats-grid-5 { grid-template-columns: repeat(2, 1fr); }
}

.stat-rate {
  font-size: 0.72rem;
  color: var(--slate);
  margin-top: 6px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

/* Conversion Funnel */
.funnel-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 0;
}

.funnel-step {
  display: flex;
  align-items: center;
  gap: 16px;
}

.funnel-bar {
  height: 38px;
  min-width: 3%;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 12px;
  transition: width 0.6s ease;
  flex-shrink: 0;
}

.funnel-bar-label {
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
}

.funnel-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 160px;
}

.funnel-label {
  font-size: 0.85rem;
  color: var(--ink);
  font-weight: 600;
}

.funnel-rate {
  font-size: 0.75rem;
  color: var(--slate);
  background: var(--bg-subtle);
  padding: 2px 8px;
  border-radius: 100px;
  font-weight: 500;
}
