/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --success: #16a34a;
  --warning: #d97706;
  --info: #0891b2;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1);
  --shadow-md: 0 4px 6px rgba(0,0,0,.1);
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: var(--gray-900); background: var(--gray-50); line-height: 1.6; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Navbar */
.navbar { display: flex; align-items: center; gap: 1.5rem; padding: 0.75rem 1.5rem; background: #fff; border-bottom: 1px solid var(--gray-200); box-shadow: var(--shadow); }
.nav-brand a { font-weight: 700; font-size: 1.1rem; color: var(--gray-900); display: flex; align-items: center; gap: 0.5rem; }
.nav-brand a:hover { text-decoration: none; }
.nav-logo { width: 24px; height: 24px; border-radius: 4px; }
.nav-links { display: flex; gap: 1rem; }
.nav-links a { color: var(--gray-500); font-weight: 500; padding: 0.25rem 0.5rem; border-radius: 4px; }
.nav-links a:hover { color: var(--gray-900); text-decoration: none; background: var(--gray-100); }
.nav-links a.active { color: var(--primary); background: #eff6ff; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.nav-user { color: var(--gray-500); font-size: 0.875rem; }
.current-client { font-size: 0.8rem; color: var(--gray-500); background: var(--gray-100); padding: 0.25rem 0.75rem; border-radius: 999px; }

/* Container */
.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

/* Page header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; }
.page-header-actions { display: flex; align-items: center; gap: 1rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; padding: 0.5rem 1rem; border: 1px solid transparent; border-radius: var(--radius); font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: #fff; color: var(--gray-700); border-color: var(--gray-300); }
.btn-outline:hover { background: var(--gray-100); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-sm { padding: 0.25rem 0.625rem; font-size: 0.8rem; }
.btn-block { width: 100%; justify-content: center; }

/* Tables */
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th { text-align: left; padding: 0.75rem 1rem; background: var(--gray-50); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-500); border-bottom: 2px solid var(--gray-200); }
.table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--gray-100); font-size: 0.875rem; }
.table tbody tr:hover { background: var(--gray-50); }
.table-responsive { overflow-x: auto; }
.actions-cell { white-space: nowrap; display: flex; gap: 0.5rem; }
.inline-form { display: inline; }
.url-cell { max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.8rem; color: var(--gray-500); }
.prompt-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Badges */
.badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #cffafe; color: #155e75; }
.badge-default { background: var(--gray-100); color: var(--gray-700); }

/* Alerts */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.875rem; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* Forms */
.form-card { max-width: 700px; background: #fff; padding: 1.5rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; font-size: 0.875rem; margin-bottom: 0.375rem; color: var(--gray-700); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--gray-300); border-radius: var(--radius);
  font-size: 0.875rem; transition: border-color 0.15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }

/* Auth */
.auth-container { display: flex; justify-content: center; align-items: center; min-height: 70vh; }
.auth-card { width: 100%; max-width: 420px; background: #fff; padding: 2rem; border-radius: var(--radius); box-shadow: var(--shadow-md); }
.auth-card h1 { font-size: 1.5rem; margin-bottom: 1.5rem; text-align: center; }
.auth-link { text-align: center; margin-top: 1rem; font-size: 0.875rem; color: var(--gray-500); }

/* Dashboard */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.metric-card { background: #fff; padding: 1.25rem; border-radius: var(--radius); box-shadow: var(--shadow); text-align: center; }
.metric-value { font-size: 1.75rem; font-weight: 700; color: var(--primary); }
.metric-label { font-size: 0.8rem; color: var(--gray-500); margin-top: 0.25rem; text-transform: uppercase; letter-spacing: 0.05em; }
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.dashboard-section { background: #fff; padding: 1.25rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.dashboard-section h2 { font-size: 1rem; margin-bottom: 1rem; color: var(--gray-700); }

/* Client selector */
.client-selector { display: flex; align-items: center; gap: 0.5rem; }
.client-selector label { font-size: 0.8rem; font-weight: 500; color: var(--gray-500); }
.client-selector select { padding: 0.375rem 0.625rem; border: 1px solid var(--gray-300); border-radius: var(--radius); font-size: 0.8rem; }

/* Filter bar */
.filter-bar { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; padding: 1rem; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
.filter-group { display: flex; flex-direction: column; gap: 0.25rem; }
.filter-group label { font-size: 0.75rem; font-weight: 500; color: var(--gray-500); }
.filter-group input, .filter-group select { padding: 0.375rem 0.5rem; border: 1px solid var(--gray-300); border-radius: var(--radius); font-size: 0.8rem; }

/* Empty state */
.empty-state { text-align: center; padding: 3rem 1rem; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
.empty-state p { color: var(--gray-500); margin-bottom: 1rem; }

/* Confirmation pages */
.text-center { text-align: center; }
.confirmation-icon { font-size: 3rem; margin-bottom: 1rem; line-height: 1; }
.confirmation-icon-success { color: var(--success); }
.confirmation-text { font-size: 1.05rem; color: var(--gray-700); margin-bottom: 0.75rem; line-height: 1.6; }
.confirmation-subtext { font-size: 0.9rem; color: var(--gray-500); line-height: 1.5; }
.confirmation-divider { border: none; border-top: 1px solid var(--gray-200); margin: 1.5rem 0; }
.confirmation-help { font-size: 0.85rem; color: var(--gray-500); }

/* Footer */
.footer { text-align: center; padding: 2rem 1rem; color: var(--gray-500); font-size: 0.8rem; }
.text-muted { color: var(--gray-500); font-size: 0.875rem; }

/* Responsive */
@media (max-width: 768px) {
  .navbar { flex-wrap: wrap; }
  .nav-links { order: 3; width: 100%; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; align-items: stretch; }
}
