/* ─── HookRelay Dashboard — Warm Minimal ──────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: #FBFAF8;
  color: #1C1917;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
::selection { background: #FF6B5C; color: #fff; }

/* ─── Auth ────────────────────────────────────────────────── */
.auth-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: #FBFAF8; padding: 1rem;
}
.auth-card {
  width: 100%; max-width: 380px;
  background: #fff; border-radius: 16px;
  padding: 2.5rem 2rem;
  box-shadow: 0 4px 32px rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.04);
}
.auth-brand {
  display: flex; align-items: center; justify-content: center; gap: 0.6rem;
  margin-bottom: 0.5rem;
}
.auth-brand-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: 1.4rem; color: #1C1917;
}
.auth-subtitle {
  text-align: center; color: #A8A29E; font-size: 0.9rem;
  margin-bottom: 1.75rem;
}
.auth-tabs {
  display: flex; gap: 0; margin-bottom: 1.5rem;
  background: #F5F5F4; border-radius: 10px; padding: 3px;
}
.auth-tab {
  flex: 1; padding: 0.55rem; border: none;
  background: transparent; color: #A8A29E;
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
  border-radius: 8px; transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}
.auth-tab.active { background: #fff; color: #1C1917; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.auth-form { display: flex; flex-direction: column; gap: 0; }
.auth-form label { font-size: 0.82rem; color: #78716C; font-weight: 500; margin-bottom: 0.35rem; margin-top: 0.75rem; }
.auth-form input {
  width: 100%; padding: 0.7rem;
  background: #FBFAF8; border: 1px solid rgba(0,0,0,0.08);
  border-radius: 10px; color: #1C1917; font-size: 0.9rem;
  outline: none; transition: all 0.15s;
  font-family: 'Inter', sans-serif;
}
.auth-form input:focus { border-color: #FF6B5C; box-shadow: 0 0 0 3px rgba(255,107,92,0.08); }
.auth-form input::placeholder { color: #D4D4D8; }
.auth-error { color: #FF6B5C; font-size: 0.8rem; min-height: 1.2rem; margin-top: 0.75rem; display: none; }
.auth-error.show { display: block; }

/* ─── Buttons ─────────────────────────────────────────────── */
.btn-primary {
  background: #1C1917; color: #FBFAF8;
  font-weight: 600; font-size: 0.9rem;
  padding: 0.75rem 1.5rem; border-radius: 10px;
  border: none; cursor: pointer; transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}
.btn-primary:hover { background: #FF6B5C; transform: translateY(-1px); }
.btn-block { width: 100%; margin-top: 1rem; }
.btn-sm {
  padding: 0.45rem 1rem; border-radius: 8px;
  font-size: 0.82rem; font-weight: 600; cursor: pointer;
  border: 1px solid rgba(0,0,0,0.08); background: #fff;
  color: #1C1917; transition: all 0.15s;
  font-family: 'Inter', sans-serif;
}
.btn-sm:hover { border-color: #1C1917; }
.btn-coral { background: #FF6B5C; color: #fff; border-color: #FF6B5C; }
.btn-coral:hover { background: #E85A4D; border-color: #E85A4D; }
.btn-ghost { background: transparent; border-color: rgba(0,0,0,0.06); color: #78716C; }
.btn-ghost:hover { color: #1C1917; border-color: rgba(0,0,0,0.1); }
.btn-sm.danger { color: #FF6B5C; border-color: rgba(255,107,92,0.2); }
.btn-sm.danger:hover { background: rgba(255,107,92,0.05); border-color: #FF6B5C; }
.btn-sm.success { color: #4CB782; border-color: rgba(76,183,130,0.2); }
.btn-sm.success:hover { background: rgba(76,183,130,0.05); border-color: #4CB782; }

/* ─── Layout ──────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0;
  background: #fff; border-right: 1px solid rgba(0,0,0,0.05);
  padding: 1.5rem 1rem;
  display: flex; flex-direction: column;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 0.5rem;
  margin-bottom: 2rem; padding: 0 0.5rem;
}
.sidebar-brand span {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: 1.1rem; color: #1C1917;
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav div {
  padding: 0.6rem 0.75rem; border-radius: 8px;
  font-size: 0.88rem; color: #78716C; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
}
.sidebar-nav div:hover { color: #1C1917; background: rgba(0,0,0,0.03); }
.sidebar-nav div.active { color: #FF6B5C; background: rgba(255,107,92,0.06); font-weight: 600; }

.sidebar-foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid rgba(0,0,0,0.05); }
.endpoint-box { padding: 0.5rem 0; }
.endpoint-box label {
  display: block; font-size: 0.68rem; font-weight: 600;
  color: #A8A29E; text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 0.35rem; padding: 0 0.5rem;
}
.endpoint-box select {
  width: 100%; background: #FBFAF8;
  border: 1px solid rgba(0,0,0,0.06); border-radius: 8px;
  color: #1C1917; font-size: 0.8rem;
  padding: 0.4rem 0.5rem; outline: none; margin-bottom: 0.4rem;
  font-family: 'Inter', sans-serif;
}
.endpoint-box select:focus { border-color: #FF6B5C; }
.btn-new-endpoint {
  width: 100%; padding: 0.4rem;
  background: rgba(255,107,92,0.06);
  border: 1px solid rgba(255,107,92,0.12); border-radius: 8px;
  color: #FF6B5C; font-size: 0.78rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
  font-family: 'Inter', sans-serif;
}
.btn-new-endpoint:hover { background: rgba(255,107,92,0.12); }

.sidebar-user {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 0.5rem;
}
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: #FF6B5C; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
}
.user-email {
  flex: 1; min-width: 0; font-size: 0.8rem; font-weight: 500;
  color: #1C1917; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.btn-signout {
  background: none; border: none; color: #D4D4D8;
  font-size: 0.75rem; cursor: pointer; transition: color 0.15s;
  font-family: 'Inter', sans-serif;
}
.btn-signout:hover { color: #FF6B5C; }
.back-link {
  display: block; padding: 0.5rem; font-size: 0.78rem;
  color: #A8A29E; text-decoration: none; transition: color 0.15s;
}
.back-link:hover { color: #1C1917; }

/* ─── Main ────────────────────────────────────────────────── */
.main { flex: 1; padding: 2rem; max-width: 1100px; min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 2rem; padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.topbar h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem; font-weight: 700; color: #1C1917;
}
.topbar-sub { font-size: 0.85rem; color: #A8A29E; margin-top: 0.2rem; }
.api-key-display {
  background: #fff; border: 1px solid rgba(0,0,0,0.05);
  border-radius: 8px; padding: 0.5rem 0.9rem;
  font-family: 'JetBrains Mono', monospace; font-size: 0.75rem;
  color: #A8A29E; cursor: pointer; transition: all 0.15s;
  white-space: nowrap;
}
.api-key-display:hover { border-color: #FF6B5C; }
.api-key-display .label { color: #D4D4D8; font-family: 'Inter', sans-serif; font-size: 0.7rem; }

/* ─── Stats ───────────────────────────────────────────────── */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem; margin-bottom: 2rem;
}
.stat {
  background: #fff; border-radius: 12px; padding: 1.25rem;
  border: 1px solid rgba(0,0,0,0.04);
  transition: all 0.2s;
}
.stat:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.04); }
.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.75rem; font-weight: 700; color: #1C1917;
}
.stat-label { font-size: 0.78rem; color: #A8A29E; margin-top: 0.25rem; font-weight: 500; }
.stat-value.green { color: #4CB782; }
.stat-value.amber { color: #F5C451; }
.stat-value.red { color: #FF6B5C; }

/* ─── URL card ────────────────────────────────────────────── */
.url-card {
  background: #fff; border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.04); overflow: hidden;
}
.url-card-head { padding: 1.25rem 1.5rem 0; }
.url-card-head h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem; font-weight: 600; color: #1C1917;
  margin-bottom: 0.3rem;
}
.url-card-head p { font-size: 0.85rem; color: #A8A29E; }
.url-card-body {
  padding: 1rem 1.5rem 1.25rem;
  display: flex; align-items: center; gap: 0.75rem;
}
.url-card-body code {
  font-family: 'JetBrains Mono', monospace; font-size: 1rem;
  color: #FF6B5C; background: rgba(255,107,92,0.06);
  padding: 0.3rem 0.7rem; border-radius: 6px; cursor: pointer;
  transition: background 0.15s;
}
.url-card-body code:hover { background: rgba(255,107,92,0.12); }
.url-hint { font-size: 0.78rem; color: #D4D4D8; }

/* ─── Sections ────────────────────────────────────────────── */
.section { display: none; }
.section.active { display: block; }
.section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.5rem;
}
.section-header h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.15rem; font-weight: 600; color: #1C1917;
}

/* ─── Webhook URL bar ─────────────────────────────────────── */
.webhook-url-bar {
  background: #fff; border: 1px solid rgba(0,0,0,0.04);
  border-radius: 10px; padding: 1rem 1.25rem; margin-bottom: 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
}
.webhook-url-bar .label { font-size: 0.78rem; color: #A8A29E; margin-bottom: 0.2rem; display: block; }
.webhook-url-bar code {
  font-family: 'JetBrains Mono', monospace; font-size: 0.9rem;
  color: #FF6B5C; background: rgba(255,107,92,0.06);
  padding: 0.2rem 0.5rem; border-radius: 4px; cursor: pointer;
}

/* ─── Table ───────────────────────────────────────────────── */
.table-card {
  background: #fff; border: 1px solid rgba(0,0,0,0.04);
  border-radius: 12px; overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 0.7rem 1rem;
  font-size: 0.72rem; font-weight: 600; color: #A8A29E;
  text-transform: uppercase; letter-spacing: 0.04em;
  background: #FAFAF9; border-bottom: 1px solid rgba(0,0,0,0.05);
  white-space: nowrap;
}
td { padding: 0.75rem 1rem; font-size: 0.85rem; color: #57534E; border-bottom: 1px solid rgba(0,0,0,0.03); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(0,0,0,0.01); }
td .badge {
  display: inline-block; padding: 2px 10px; border-radius: 100px;
  font-size: 0.72rem; font-weight: 600; white-space: nowrap;
}
.badge-success { background: rgba(76,183,130,0.08); color: #4CB782; }
.badge-pending { background: rgba(245,196,81,0.1); color: #C4982E; }
.badge-failed { background: rgba(255,107,92,0.08); color: #FF6B5C; }
.mono { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; }
.truncate { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td .actions { display: flex; gap: 0.5rem; }

/* ─── Empty state ─────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1rem; }
.empty-state .icon { font-size: 2rem; margin-bottom: 0.75rem; }
.empty-state h3 { font-size: 1rem; color: #1C1917; margin-bottom: 0.4rem; font-weight: 600; }
.empty-state p { font-size: 0.85rem; color: #A8A29E; }

/* ─── Modal ───────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(28,25,23,0.25); backdrop-filter: blur(4px);
  align-items: center; justify-content: center; z-index: 1000; padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: 16px;
  padding: 2rem; width: 100%; max-width: 440px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.08);
}
.modal h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.15rem; font-weight: 600; color: #1C1917;
  margin-bottom: 1.25rem;
}
.modal label { display: block; font-size: 0.82rem; color: #78716C; font-weight: 500; margin-bottom: 0.35rem; }
.modal input, .modal select {
  width: 100%; background: #FBFAF8;
  border: 1px solid rgba(0,0,0,0.06); border-radius: 10px;
  padding: 0.7rem 0.9rem; color: #1C1917; font-size: 0.9rem;
  outline: none; margin-bottom: 1rem; transition: all 0.15s;
  font-family: 'Inter', sans-serif;
}
.modal input:focus, .modal select:focus { border-color: #FF6B5C; box-shadow: 0 0 0 3px rgba(255,107,92,0.08); }
.modal input::placeholder, .modal select::placeholder { color: #D4D4D8; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 0.5rem; }

/* ─── Copy toast ──────────────────────────────────────────── */
.copy-toast {
  position: fixed; bottom: 2rem; right: 2rem;
  background: #1C1917; color: #fff;
  padding: 0.6rem 1.2rem; border-radius: 10px;
  font-size: 0.85rem; font-weight: 600;
  opacity: 0; transition: all 0.3s;
  z-index: 999; pointer-events: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.copy-toast.show { opacity: 1; transform: translateY(-4px); }

/* ─── Mobile ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%; padding: 0.75rem 1rem;
    flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: 0.5rem; border-right: none;
    border-bottom: 1px solid rgba(0,0,0,0.05);
  }
  .sidebar-brand { margin-bottom: 0; }
  .sidebar-brand span { font-size: 1rem; }
  .sidebar-nav {
    display: flex; order: 1; width: 100%;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    gap: 2px; padding: 0.4rem 0;
  }
  .sidebar-nav div {
    white-space: nowrap; font-size: 0.8rem;
    padding: 0.35rem 0.6rem; flex-shrink: 0;
  }
  .sidebar-foot {
    display: flex; align-items: center; gap: 0.75rem;
    margin-top: 0; padding-top: 0; border-top: none; flex-wrap: wrap;
  }
  .endpoint-box { display: flex; align-items: center; gap: 0.4rem; padding: 0; }
  .endpoint-box label { display: none; }
  .endpoint-box select { width: auto; min-width: 130px; margin-bottom: 0; }
  .btn-new-endpoint { width: auto; padding: 0.35rem 0.6rem; white-space: nowrap; }
  .sidebar-user { padding: 0; }
  .back-link { display: none; }
  .main { padding: 1rem; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .api-key-display { font-size: 0.7rem; padding: 0.4rem 0.7rem; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .stat { padding: 1rem; }
  .stat-value { font-size: 1.4rem; }
  .webhook-url-bar { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .section-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  td { padding: 0.6rem 0.7rem; font-size: 0.8rem; }
  th { padding: 0.6rem 0.7rem; font-size: 0.68rem; }
  .modal { padding: 1.5rem; border-radius: 14px; }
}

@media (max-width: 480px) {
  .stats { gap: 0.5rem; }
  .stat { padding: 0.75rem; }
  .stat-value { font-size: 1.2rem; }
  td { padding: 0.5rem; font-size: 0.75rem; }
  .main { padding: 0.75rem; }
  .endpoint-box select { min-width: 100px; font-size: 0.75rem; }
}
