/* Onyx app shared styles — dark theme matching dashboard.html */
:root {
  --bg: #0a0a0a;
  --surface: #111111;
  --surface-2: #1a1a1a;
  --surface-3: #222222;
  --border: #2a2a2a;
  --border-light: #333333;
  --gold: #c9a84c;
  --gold-bright: #e4b858;
  --gold-dim: #8a7033;
  --gold-glow: rgba(201, 168, 76, 0.15);
  --green: #4caf50;
  --green-dim: #2e7d32;
  --blue: #42a5f5;
  --blue-dim: #1565c0;
  --orange: #ff9800;
  --red: #ef5350;
  --purple: #ab47bc;
  --cyan: #26c6da;
  --text: #e8dcc0;
  --text-soft: #c9bb96;
  --text-muted: #85765e;
}
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
h1, h2, h3, h4 { font-family: 'Fraunces', Georgia, serif; font-weight: 500; letter-spacing: -.01em; color: #f5ebcf; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-bright); }
button { font-family: inherit; cursor: pointer; }

/* ——— App shell ——— */
.app-topbar {
  height: 60px; display: flex; align-items: center; padding: 0 28px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.app-topbar .brand {
  font-family: 'Fraunces', serif; font-size: 20px; font-weight: 500; color: var(--gold);
  letter-spacing: -.02em;
}
.app-topbar .brand span { color: var(--text-muted); font-size: 13px; font-weight: 400; margin-left: 10px; }
.app-topbar nav { margin-left: 40px; display: flex; gap: 4px; }
.app-topbar nav a {
  padding: 8px 14px; color: var(--text-soft); font-size: 14px; font-weight: 500;
  border-radius: 7px; transition: all .15s ease;
}
.app-topbar nav a:hover { background: var(--surface-2); color: var(--gold-bright); }
.app-topbar nav a.active { background: var(--surface-2); color: var(--gold-bright); }
.app-topbar .spacer { flex: 1; }
.app-topbar .userchip {
  display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 100px;
  font-size: 13px; color: var(--text-soft);
}
.app-topbar .userchip .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-dim));
  color: #1a1305; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
}
.app-topbar .userchip .role { font-size: 11px; padding: 2px 8px; border-radius: 4px; background: var(--gold-glow); color: var(--gold-bright); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.app-topbar .logout-btn {
  background: transparent; border: 1px solid var(--border); color: var(--text-muted);
  padding: 7px 14px; border-radius: 8px; font-size: 13px; margin-left: 10px; transition: all .15s;
}
.app-topbar .logout-btn:hover { color: var(--red); border-color: var(--red); }

.app-body { padding: 28px; max-width: 1600px; margin: 0 auto; }

/* ——— Common UI ——— */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden; transition: border-color .2s;
}
.card:hover { border-color: var(--border-light); }
.card-header { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h2 { font-size: 18px; margin: 0; }
.card-header .hint { font-size: 12px; color: var(--text-muted); }
.card-body { padding: 22px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px;
  position: relative; overflow: hidden;
}
.stat::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: .4;
}
.stat .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .1em; font-weight: 600; margin-bottom: 8px; }
.stat .value { font-family: 'Fraunces', serif; font-size: 32px; font-weight: 500; color: var(--gold-bright); line-height: 1; }
.stat .delta { font-size: 12px; color: var(--green); margin-top: 6px; }
.stat .delta.down { color: var(--red); }

/* Buttons */
.btn { display: inline-block; padding: 10px 18px; border-radius: 8px; font-size: 14px; font-weight: 500; border: none; transition: all .15s ease; }
.btn-gold { background: linear-gradient(135deg, var(--gold-bright), var(--gold-dim)); color: #1a1305; }
.btn-gold:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(201, 168, 76, .35); }
.btn-outline { background: transparent; border: 1px solid var(--border-light); color: var(--text-soft); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold-bright); }
.btn-danger { background: transparent; border: 1px solid rgba(239, 83, 80, .4); color: var(--red); }
.btn-danger:hover { background: rgba(239, 83, 80, .1); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600;
  background: var(--surface-2);
}
tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 14px; color: var(--text-soft); }
tbody tr:hover { background: var(--surface-2); }
tbody tr:hover td { color: var(--text); }
tbody tr:last-child td { border-bottom: none; }

/* Status pills */
.pill { display: inline-block; padding: 3px 10px; border-radius: 100px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.pill-scraped { background: rgba(66, 165, 245, .15); color: var(--blue); }
.pill-site_built { background: rgba(171, 71, 188, .15); color: var(--purple); }
.pill-emailed { background: rgba(255, 152, 0, .15); color: var(--orange); }
.pill-clicked { background: rgba(38, 198, 218, .15); color: var(--cyan); }
.pill-replied { background: rgba(201, 168, 76, .2); color: var(--gold-bright); }
.pill-meeting { background: rgba(76, 175, 80, .2); color: var(--green); }
.pill-client { background: var(--green); color: #0a0a0a; }
.pill-not_interested { background: rgba(239, 83, 80, .15); color: var(--red); }
.pill-live { background: var(--green); color: #0a0a0a; }
.pill-onboarding { background: rgba(255, 152, 0, .15); color: var(--orange); }
.pill-paused { background: rgba(133, 118, 94, .25); color: var(--text-muted); }
.pill-cancelled { background: rgba(239, 83, 80, .15); color: var(--red); }
.pill-open { background: rgba(66, 165, 245, .15); color: var(--blue); }
.pill-in_progress { background: rgba(255, 152, 0, .15); color: var(--orange); }
.pill-done { background: rgba(76, 175, 80, .2); color: var(--green); }
.pill-urgent { background: rgba(239, 83, 80, .2); color: var(--red); }
.pill-high { background: rgba(255, 152, 0, .2); color: var(--orange); }
.pill-normal { background: rgba(66, 165, 245, .15); color: var(--blue); }
.pill-low { background: rgba(133, 118, 94, .2); color: var(--text-muted); }
.pill-admin { background: var(--gold); color: #1a1305; }
.pill-teammate { background: rgba(66, 165, 245, .2); color: var(--blue); }
.pill-client-role { background: rgba(171, 71, 188, .2); color: var(--purple); }

/* Forms */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 14px; font-family: inherit;
  transition: border-color .15s, background .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--gold); background: var(--surface-3);
}
.field textarea { resize: vertical; min-height: 100px; }
.field .hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* Toasts */
.onyx-toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 100;
  padding: 14px 22px; background: var(--surface-2); border: 1px solid var(--border-light);
  color: var(--text); font-size: 14px; border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
  transform: translateY(20px); opacity: 0; transition: all .3s ease;
}
.onyx-toast.show { transform: translateY(0); opacity: 1; }
.onyx-toast-success { border-left: 4px solid var(--green); }
.onyx-toast-error { border-left: 4px solid var(--red); }
.onyx-toast-info { border-left: 4px solid var(--gold); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .7); backdrop-filter: blur(6px); z-index: 90; display: none; }
.modal-overlay.open { display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--surface); border: 1px solid var(--border-light); border-radius: 16px; max-width: 520px; width: 100%; max-height: 85vh; overflow-y: auto; }
.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: 20px; }
.modal-body { padding: 24px; }
.modal-footer { padding: 18px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.modal-close { background: transparent; border: none; color: var(--text-muted); font-size: 24px; padding: 0 8px; }
.modal-close:hover { color: var(--text); }

/* Loading */
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--gold); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state h3 { color: var(--text-soft); margin-bottom: 8px; }
