:root {
  --bg: #f4f6fb;
  --sidebar: #ffffff;
  --card: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e8ecf3;
  --primary: #6366f1;
  --primary-soft: #eef2ff;
  --primary-dark: #4f46e5;
  --blue: #3b82f6;
  --blue-soft: #eff6ff;
  --teal: #14b8a6;
  --teal-soft: #f0fdfa;
  --green: #059669;
  --green-soft: #ecfdf5;
  --green-btn: #0d9488;
  --orange: #f59e0b;
  --orange-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.04);
  --font: "DM Sans", "Segoe UI", sans-serif;
  --sidebar-w: 260px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ——— App shell ——— */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.35rem 0.5rem 1.25rem;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}
.sidebar-brand:hover { text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}
.brand-mark svg { width: 18px; height: 18px; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background .15s, color .15s;
  position: relative;
}
.nav-link svg { width: 18px; height: 18px; opacity: 0.85; flex-shrink: 0; }
.nav-link:hover {
  background: #f8fafc;
  color: var(--ink);
  text-decoration: none;
}
.nav-link.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 600;
}
.nav-link.active::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  margin-left: auto;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.usage-block { padding: 0.5rem 0.35rem 0.85rem; }
.usage-row { margin-bottom: 0.75rem; }
.usage-row:last-child { margin-bottom: 0; }
.usage-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}
.progress {
  height: 6px;
  background: #eef2f7;
  border-radius: 99px;
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--primary);
}
.progress.teal > span { background: var(--teal); }

.btn-upgrade {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1rem;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  margin-bottom: 0.85rem;
}
.btn-upgrade:hover {
  background: #e0e7ff;
  text-decoration: none;
  color: var(--primary-dark);
}

.user-chip {
  position: relative;
  padding: 0;
  border-radius: 14px;
  background: #fafbfc;
  border: 1px solid var(--line);
}
.user-chip-btn {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  padding: 0.55rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  border-radius: 14px;
}
.user-chip-btn:hover { background: #f3f4f6; }
.user-chevron {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.75rem;
  transition: transform .15s;
}
.user-chip.open .user-chevron { transform: rotate(180deg); }
.user-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  padding: 0.35rem;
  z-index: 50;
}
.user-dropdown a,
.user-dropdown .logout-btn {
  display: block;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.user-dropdown a:hover { background: #f8fafc; text-decoration: none; }
.user-dropdown form { margin: 0; }
.user-dropdown .logout-btn {
  color: var(--danger);
  border-top: 1px solid var(--line);
  margin-top: 0.25rem;
  border-radius: 0 0 8px 8px;
}
.user-dropdown .logout-btn:hover { background: var(--danger-soft); }

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a78bfa, #6366f1);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.user-meta { min-width: 0; flex: 1; }
.user-meta .name {
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.user-meta .email {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plan-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 6px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.app-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  padding: 1.75rem 1.75rem 3rem;
}

.mobile-top {
  display: none;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.burger {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  width: 40px;
  height: 40px;
  cursor: pointer;
}

/* ——— Guest / marketing ——— */
.guest-body { background: var(--bg); }
.guest-header {
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.guest-header .inner {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.95rem 0;
}
.guest-main {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3.5rem;
}

/* ——— Typography / page ——— */
.page-head { margin-bottom: 1.5rem; }
.page-title {
  margin: 0 0 0.3rem;
  font-size: clamp(1.55rem, 2.4vw, 1.9rem);
  letter-spacing: -0.035em;
  font-weight: 800;
}
.page-sub { margin: 0; color: var(--muted); font-size: 0.98rem; }

.section-title {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ——— Cards ——— */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.2rem 1.3rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.15rem;
}
.metric-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.2rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.metric-card .label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}
.metric-card .value {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}
.metric-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.metric-icon svg { width: 18px; height: 18px; }
.metric-icon.blue { background: var(--blue-soft); color: var(--blue); }
.metric-icon.purple { background: var(--primary-soft); color: var(--primary); }
.metric-icon.teal { background: var(--teal-soft); color: var(--teal); }
.metric-icon.orange { background: var(--orange-soft); color: var(--orange); }

.plan-card {
  display: grid;
  grid-template-columns: 1.1fr 1.6fr;
  gap: 1.25rem;
  align-items: center;
  margin-bottom: 1.15rem;
}
.plan-left h3 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.plan-left p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.plan-usage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
.plan-box {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.95rem 1rem;
}
.plan-box .top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}
.plan-box .top strong {
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.plan-box .top span { font-size: 0.82rem; color: var(--muted); }
.plan-box .remain {
  margin-top: 0.55rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.tip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.tip-card {
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  border: 1px solid transparent;
  box-shadow: var(--shadow);
}
.tip-card.purple {
  background: linear-gradient(180deg, #f5f3ff 0%, #eef2ff 100%);
  border-color: #e0e7ff;
}
.tip-card.green {
  background: linear-gradient(180deg, #ecfdf5 0%, #f0fdfa 100%);
  border-color: #d1fae5;
}
.tip-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  margin-bottom: 0.75rem;
}
.tip-card.purple .tip-icon { background: #ddd6fe; color: #7c3aed; }
.tip-card.green .tip-icon { background: #a7f3d0; color: #047857; }
.tip-card .eyebrow {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.tip-card h3 {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.tip-card p {
  margin: 0 0 1rem;
  color: #4b5563;
  font-size: 0.92rem;
}
.tip-card .btn { margin-top: 0.15rem; }

.dash-bottom {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem;
}

/* ——— Buttons ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 0;
  border-radius: 10px;
  padding: 0.65rem 1.05rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.9rem;
  font-family: inherit;
  transition: transform .12s, filter .12s, background .12s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-purple { background: var(--primary); color: #fff; }
.btn-purple:hover { background: var(--primary-dark); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: #047857; color: #fff; }
.btn-secondary { background: #f1f5f9; color: var(--ink); }
.btn-secondary:hover { background: #e2e8f0; color: var(--ink); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.82rem; border-radius: 8px; }
.btn-block { width: 100%; }

/* ——— Forms ——— */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}
.form-group .hint { color: var(--muted); font-size: 0.82rem; margin-top: 0.3rem; }
.form-control, textarea.form-control, select.form-control {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
.form-control:focus, textarea.form-control:focus {
  outline: 2px solid rgba(99, 102, 241, 0.25);
  border-color: var(--primary);
}
textarea.form-control { min-height: 110px; resize: vertical; }
.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0.75rem 0;
}
.checkbox input { margin-top: 0.2rem; }

/* ——— Tables / misc ——— */
.alert {
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid;
  font-size: 0.92rem;
}
.alert-success { background: var(--green-soft); border-color: #a7f3d0; color: var(--green); }
.alert-error { background: var(--danger-soft); border-color: #fecaca; color: var(--danger); }

.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
table.data th, table.data td {
  text-align: left;
  padding: 0.8rem 0.55rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.data th {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
table.data tr:last-child td { border-bottom: 0; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}
.badge-ok { background: var(--green-soft); color: var(--green); }
.badge-off { background: #f1f5f9; color: var(--muted); }

.codebox {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
  word-break: break-all;
}
.copy-row { display: flex; gap: 0.5rem; align-items: stretch; }
.copy-row .codebox { flex: 1; }

.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.muted { color: var(--muted); }
.stack { display: grid; gap: 1rem; }
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.auth-wrap {
  max-width: 420px;
  margin: 2.5rem auto;
}
.auth-wrap .card { padding: 1.6rem 1.5rem; }

.hero {
  padding: 3.5rem 0 1.5rem;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 2rem;
  align-items: center;
}
.hero h1 {
  font-size: clamp(2.1rem, 4.5vw, 3rem);
  letter-spacing: -0.045em;
  margin: 0 0 0.85rem;
  max-width: 14ch;
  line-height: 1.05;
}
.hero p {
  color: var(--muted);
  font-size: 1.08rem;
  max-width: 40ch;
  margin: 0 0 1.5rem;
}
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.hero-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 1.25rem;
}
.hero-panel .mini-metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}
.hero-panel .mini-metric:last-child { border-bottom: 0; }

.payload-table td:first-child { width: 30%; font-weight: 600; }
pre.json {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 10px;
  overflow: auto;
  font-size: 0.82rem;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 35;
}

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plan-card, .tip-grid, .dash-bottom, .hero { grid-template-columns: 1fr; }
  .plan-usage { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .sidebar {
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .app-main { margin-left: 0; padding: 1.1rem 1rem 2.5rem; }
  .mobile-top { display: flex; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* ——— Form settings (Formzen-like) ——— */
.form-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.form-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  color: var(--ink);
  flex-shrink: 0;
  text-decoration: none;
  box-shadow: var(--shadow);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: #f8fafc; text-decoration: none; }
.form-top-identity { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.form-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c7d2fe, #a5b4fc);
  color: #4338ca;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.form-avatar svg { width: 20px; height: 20px; }
.form-top-title {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}
.form-key-copy {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}
.form-key-copy svg { width: 13px; height: 13px; }
.form-key-copy.copied { color: var(--green); }

.form-tabs {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.28rem;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.form-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  color: #374151;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
}
.form-tab svg { width: 15px; height: 15px; }
.form-tab:hover { background: #f8fafc; text-decoration: none; color: var(--ink); }
.form-tab.active {
  background: var(--primary);
  color: #fff;
}
.form-tab.active:hover { background: var(--primary-dark); color: #fff; }

.settings-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.settings-card-head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.25rem 1.35rem;
  border-bottom: 1px solid var(--line);
}
.settings-head-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: #4b5563;
  background: #fafbfc;
  flex-shrink: 0;
}
.settings-head-icon svg { width: 18px; height: 18px; }
.settings-card-head h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.settings-card-head p {
  margin: 0.15rem 0 0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.settings-row {
  display: grid;
  grid-template-columns: minmax(200px, 0.95fr) minmax(240px, 1.2fr);
  gap: 1.25rem;
  align-items: center;
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid var(--line);
}
.settings-row:last-child { border-bottom: 0; }
.settings-label strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}
.settings-label span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}
.settings-control { min-width: 0; }
.settings-control-end { display: flex; justify-content: flex-end; }
.settings-input {
  border-radius: 12px !important;
  padding: 0.8rem 0.95rem !important;
  background: #fff;
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #d1d5db;
  transition: .2s;
  border-radius: 999px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  top: 3px;
  background: #fff;
  transition: .2s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider:before { transform: translateX(20px); }

.settings-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}
.settings-danger {
  margin-top: 1rem;
  padding-top: 0.25rem;
}
.settings-empty {
  padding: 1.5rem 1.35rem;
  color: var(--muted);
}
.endpoint-box {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
}
.endpoint-box code {
  flex: 1;
  font-size: 0.8rem;
  word-break: break-all;
}
.setup-code {
  margin: 0;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  font-size: 0.8rem;
  overflow: auto;
  white-space: pre-wrap;
}
.setup-block { display: grid; gap: 0.5rem; }
.setup-block .btn { justify-self: start; }

@media (max-width: 900px) {
  .settings-row {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }
  .settings-control-end { justify-content: flex-start; }
  .form-top-title { max-width: 180px; }
}

/* ——— Inbox submissions list ——— */
.inbox { margin-top: 0.25rem; }
.inbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: #eef1f6;
  border-radius: 14px;
  padding: 0.7rem 1rem;
  margin-bottom: 0.85rem;
}
.inbox-select-all {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
  font-size: 0.92rem;
  color: #374151;
  cursor: pointer;
}
.inbox-select-all input { width: 16px; height: 16px; }
.inbox-toolbar-actions { display: flex; gap: 0.45rem; }
.inbox-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid #c5ccd8;
  background: transparent;
  display: grid;
  place-items: center;
  color: #4b5563;
  text-decoration: none;
}
.inbox-icon-btn svg { width: 16px; height: 16px; }
.inbox-icon-btn:hover { background: #fff; color: var(--ink); text-decoration: none; }

.inbox-list { display: grid; gap: 0.65rem; }
.inbox-row {
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  display: grid;
  grid-template-columns: auto auto minmax(100px, 0.65fr) minmax(140px, 1.2fr) auto auto auto;
  align-items: center;
  gap: 0.85rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow);
}
.inbox-check { display: grid; place-items: center; }
.inbox-check input { width: 16px; height: 16px; }
.inbox-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.inbox-field { min-width: 0; }
.inbox-field-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #9ca3af;
  margin-bottom: 0.15rem;
}
.inbox-field-value {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inbox-field-msg .inbox-field-value { font-weight: 600; color: #1f2937; }
.inbox-actions { display: flex; gap: 0.4rem; }
.inbox-action {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1.5px solid #6ee7b7;
  color: #059669;
  display: grid;
  place-items: center;
  text-decoration: none;
  background: #fff;
}
.inbox-action svg { width: 15px; height: 15px; }
.inbox-action:hover { background: #ecfdf5; text-decoration: none; }
.inbox-time {
  color: #9ca3af;
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  justify-self: end;
}
.inbox-empty {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 900px) {
  .inbox-row {
    grid-template-columns: auto auto 1fr auto;
    grid-template-areas:
      "check avatar main actions"
      "check avatar msg msg"
      "check avatar time time";
  }
  .inbox-check { grid-area: check; }
  .inbox-avatar { grid-area: avatar; }
  .inbox-field-main { grid-area: main; }
  .inbox-field-msg { grid-area: msg; }
  .inbox-actions { grid-area: actions; }
  .inbox-time { grid-area: time; justify-self: start; }
}

/* ——— Forms grid cards ——— */
.forms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.1rem;
}
.forms-empty { padding: 2rem; text-align: center; }
.form-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1.15rem 1.2rem 1.2rem;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
.form-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}
.form-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.form-card-icon svg { width: 18px; height: 18px; }
.form-card-menu { position: relative; }
.form-card-more {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  font-size: 1.2rem;
  line-height: 1;
  color: #9ca3af;
  cursor: pointer;
}
.form-card-more:hover { background: #f3f4f6; color: var(--ink); }
.form-card-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  min-width: 150px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(15,23,42,.12);
  padding: 0.3rem;
  z-index: 20;
}
.form-card-dropdown a {
  display: block;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
}
.form-card-dropdown a:hover { background: #f8fafc; text-decoration: none; }
.form-card-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  font-weight: 800;
}
.form-card-meta {
  margin: 0 0 0.65rem;
  color: #9ca3af;
  font-size: 0.88rem;
}
.form-card-key {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 0;
  background: transparent;
  color: #6b7280;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  margin-bottom: 1rem;
  font-family: inherit;
}
.form-card-key svg { width: 13px; height: 13px; }
.form-card-key:hover { color: var(--primary); }
.form-card-stats {
  background: #f8fafc;
  border: 1px solid #eef2f7;
  border-radius: 12px;
  padding: 0.85rem 0.9rem;
  margin-bottom: 1rem;
}
.form-card-stats-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  color: #9ca3af;
  margin-bottom: 0.55rem;
}
.form-card-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  text-align: center;
}
.form-card-stats-row strong {
  display: block;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}
.form-card-stats-row span {
  font-size: 0.72rem;
  color: #9ca3af;
  font-weight: 600;
}
.form-card-cta {
  display: block;
  text-align: center;
  background: #1e293b;
  color: #fff !important;
  font-weight: 700;
  border-radius: 12px;
  padding: 0.8rem 1rem;
  text-decoration: none !important;
  margin-top: auto;
}
.form-card-cta:hover { background: #0f172a; }


/* Notify status badges */
.notify-badges { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.notify-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.notify-ok { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.notify-fail { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.notify-skip { background: #f3f4f6; color: #6b7280; border: 1px solid #e5e7eb; }
.notify-detail-list { display: grid; gap: 0.55rem; }
.notify-detail-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.notify-error { color: #b91c1c; font-size: 0.82rem; }
.inbox-notify { min-width: 0; }

.inbox-row:hover {
  border-color: #c7d2fe;
  box-shadow: 0 4px 16px rgba(99,102,241,0.08);
}

.notify-pending { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
