/* Rhema Pulse — design tokens ported 1:1 from the original build (HSL values
   copied from the compiled Tailwind/shadcn output). */
:root {
  --background: 36 33% 98%;
  --foreground: 345 12% 12%;
  --border: 345 10% 88%;
  --card: 0 0% 100%;
  --card-foreground: 345 12% 12%;
  --card-border: 345 10% 90%;
  --popover: 0 0% 100%;
  --popover-foreground: 345 12% 12%;
  --primary: 349 74% 36%;
  --primary-foreground: 0 0% 100%;
  --secondary: 345 16% 93%;
  --secondary-foreground: 345 14% 18%;
  --muted: 36 20% 94%;
  --muted-foreground: 345 8% 38%;
  --accent: 349 30% 93%;
  --accent-foreground: 349 60% 26%;
  --destructive: 0 72% 40%;
  --destructive-foreground: 0 0% 100%;
  --input: 345 10% 76%;
  --ring: 349 74% 36%;
  --chart-1: 349 74% 40%;
  --font-sans: 'Plus Jakarta Sans', Inter, sans-serif;
  --radius: .625rem;
}

.dark {
  --background: 345 12% 8%;
  --foreground: 36 20% 96%;
  --border: 345 8% 20%;
  --card: 345 12% 11%;
  --card-foreground: 36 20% 96%;
  --card-border: 345 8% 18%;
  --popover: 345 12% 13%;
  --popover-foreground: 36 20% 96%;
  --primary: 349 70% 52%;
  --primary-foreground: 0 0% 100%;
  --secondary: 345 8% 20%;
  --secondary-foreground: 36 20% 96%;
  --muted: 345 8% 18%;
  --muted-foreground: 36 10% 68%;
  --accent: 349 25% 22%;
  --accent-foreground: 36 20% 96%;
  --destructive: 0 72% 50%;
  --destructive-foreground: 0 0% 100%;
  --input: 345 8% 32%;
  --ring: 349 70% 52%;
  --chart-1: 349 70% 58%;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.wrap { margin: 0 auto; width: 100%; max-width: 48rem; padding: 0 1rem; }
@media (min-width: 640px) { .wrap { padding: 0 1.5rem; } }

/* Header */
.site-header {
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--card) / .8);
  backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 30;
}
.site-header .wrap { display: flex; align-items: center; gap: .75rem; padding-top: .75rem; padding-bottom: .75rem; }
.brand { display: flex; align-items: center; gap: .625rem; color: hsl(var(--primary)); border-radius: .375rem; }
.brand svg { height: 1.75rem; width: 1.75rem; }
.brand span.name { font-weight: 600; letter-spacing: -0.01em; color: hsl(var(--foreground)); }
.brand span.name em { color: hsl(var(--primary)); font-style: normal; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: .5rem; }

/* Footer */
.site-footer { margin-top: auto; border-top: 1px solid hsl(var(--border)); }
.site-footer .wrap { padding-top: 1.5rem; padding-bottom: 1.5rem; font-size: .75rem; color: hsl(var(--muted-foreground)); }

main.content { flex: 1; width: 100%; padding-top: 2rem; padding-bottom: 2rem; }
@media (min-width: 640px) { main.content { padding-top: 3rem; padding-bottom: 3rem; } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .375rem;
  font-weight: 500; font-size: .875rem; line-height: 1.25rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid transparent;
  padding: .5rem .875rem; cursor: pointer;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-outline { background: transparent; border-color: hsl(var(--border)); color: hsl(var(--foreground)); }
.btn-outline:hover:not(:disabled) { background: hsl(var(--muted)); }
.btn-secondary { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.btn-secondary:hover:not(:disabled) { filter: brightness(1.05); }
.btn-ghost { background: transparent; color: hsl(var(--foreground)); }
.btn-ghost:hover:not(:disabled) { background: hsl(var(--muted)); }
.btn-destructive { background: hsl(var(--destructive)); color: hsl(var(--destructive-foreground)); }
.btn-icon { padding: .5rem; width: 2.25rem; height: 2.25rem; }
.btn-lg { padding: .625rem 1.5rem; font-size: .9375rem; }
.btn-sm { padding: .375rem .625rem; font-size: .8125rem; }

/* Cards */
.card {
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--card-border));
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.card-header { padding: 1.25rem 1.25rem .5rem; }
.card-title { font-size: 1rem; font-weight: 600; line-height: 1.375; }
.card-body { padding: 1.25rem; padding-top: .75rem; }
.card-body.tight { padding-top: 1.25rem; }
.card.border-destructive { border-color: hsl(var(--destructive)); }
.card.border-primary { border-color: hsl(var(--primary) / .5); background: hsl(var(--accent) / .35); }

/* Form controls */
label.field-label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: .375rem; }
input[type=text], input[type=password], input[type=email], textarea, .input {
  width: 100%;
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  border-radius: calc(var(--radius) - 2px);
  padding: .5rem .75rem;
  font-size: .875rem;
}
textarea { resize: vertical; }
input:focus, textarea:focus, button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}
::placeholder { color: hsl(var(--muted-foreground)); opacity: 1; }

/* Badges */
.badge { display: inline-flex; align-items: center; border-radius: 9999px; padding: .125rem .625rem; font-size: .75rem; font-weight: 500; }
.badge-primary { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.badge-secondary { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }

/* Rating buttons */
.rating-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.rating-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem;
  min-height: 4rem; border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--border)); background: hsl(var(--background));
  color: hsl(var(--foreground)); padding: .5rem .25rem; text-align: center; cursor: pointer;
}
.rating-btn strong { font-size: 1rem; font-weight: 600; line-height: 1; }
.rating-btn span { font-size: 10px; line-height: 1.1; color: hsl(var(--muted-foreground)); }
.rating-btn.selected { border-color: hsl(var(--primary)); background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.rating-btn.selected span { color: hsl(var(--primary-foreground) / .9); }

/* Toggle-ish checkboxes/switches for admin editor */
.check-row { display: inline-flex; align-items: center; gap: .5rem; font-size: .875rem; }
.check-row input[type=checkbox] { width: 1rem; height: 1rem; accent-color: hsl(var(--primary)); }
.switch { position: relative; display: inline-block; width: 2.25rem; height: 1.25rem; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; background: hsl(var(--border)); border-radius: 9999px; cursor: pointer; transition: .15s;
}
.switch .slider::before {
  content: ""; position: absolute; height: .875rem; width: .875rem; left: .1875rem; top: .1875rem;
  background: hsl(var(--card)); border-radius: 50%; transition: .15s;
}
.switch input:checked + .slider { background: hsl(var(--primary)); }
.switch input:checked + .slider::before { transform: translateX(1rem); }

hr.sep { border: none; border-top: 1px solid hsl(var(--border)); margin: 0; }
.vsep { display: inline-block; width: 1px; height: 1.5rem; background: hsl(var(--border)); }

/* Utility layout */
.stack { display: flex; flex-direction: column; }
.gap-1 { gap: .25rem; } .gap-2 { gap: .5rem; } .gap-3 { gap: .75rem; } .gap-4 { gap: 1rem; } .gap-6 { gap: 1.5rem; }
.row { display: flex; align-items: center; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; }
.mt-1 { margin-top: .25rem; } .mt-2 { margin-top: .5rem; } .mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; } .mt-6 { margin-top: 1.5rem; }
.text-xs { font-size: .75rem; } .text-sm { font-size: .875rem; } .text-base { font-size: 1rem; } .text-xl { font-size: 1.25rem; }
.text-muted { color: hsl(var(--muted-foreground)); }
.text-destructive { color: hsl(var(--destructive)); }
.text-primary { color: hsl(var(--primary)); }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.tracking-tight { letter-spacing: -0.01em; }
.tabular { font-variant-numeric: tabular-nums; }
.text-center { text-align: center; }
.max-w-md { max-width: 28rem; margin: 0 auto; }
.uppercase { text-transform: uppercase; letter-spacing: .04em; }

/* Empty / status states */
.status-panel { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 3.5rem 1rem; text-align: center; }
.status-panel svg { color: hsl(var(--muted-foreground)); }

/* Anonymity notice */
.anon-notice {
  border-radius: var(--radius); border: 1px solid hsl(var(--primary) / .25);
  background: hsl(var(--accent) / .6); padding: 1rem 1.25rem; display: flex; gap: .75rem;
}
.anon-notice svg { color: hsl(var(--primary)); flex-shrink: 0; margin-top: 2px; }

/* Comments */
.comment-item {
  border-left: 2px solid hsl(var(--primary) / .4); background: hsl(var(--muted) / .5);
  border-radius: calc(var(--radius) - 2px); padding: .5rem .75rem; font-size: .875rem; margin-bottom: .5rem;
}

/* Simple bar chart (replaces recharts) */
.chart { height: 12rem; width: 100%; display: flex; align-items: flex-end; gap: .5rem; padding-top: .5rem; }
.chart-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.chart-bar { width: 100%; max-width: 3rem; background: hsl(var(--chart-1)); border-radius: 4px 4px 0 0; min-height: 2px; transition: height .2s ease; }
.chart-label { font-size: .75rem; color: hsl(var(--muted-foreground)); margin-top: .375rem; }

/* Rounds list (admin) */
.round-row { display: flex; align-items: center; gap: .25rem; border-radius: calc(var(--radius) - 2px); border: 1px solid hsl(var(--border)); padding-right: .25rem; }
.round-row.active { border-color: hsl(var(--primary)); background: hsl(var(--accent) / .6); }
.round-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: .75rem; padding: .625rem .75rem; text-align: left; background: none; border: none; cursor: pointer; border-radius: calc(var(--radius) - 2px); }
.round-btn:hover { background: hsl(var(--muted) / .6); }
.round-btn p.title { font-size: .875rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.round-btn p.meta { font-size: .75rem; color: hsl(var(--muted-foreground)); }

/* Tabs */
.tabs-list { display: inline-flex; gap: .25rem; background: hsl(var(--muted)); padding: .25rem; border-radius: calc(var(--radius) - 2px); }
.tab-btn { padding: .375rem .875rem; font-size: .8125rem; font-weight: 500; border-radius: calc(var(--radius) - 4px); background: none; border: none; cursor: pointer; color: hsl(var(--muted-foreground)); }
.tab-btn.active { background: hsl(var(--card)); color: hsl(var(--foreground)); }
.tab-panel { display: none; padding-top: 1rem; }
.tab-panel.active { display: block; }

/* Toast */
#toast-region { position: fixed; bottom: 1rem; right: 1rem; z-index: 100; display: flex; flex-direction: column; gap: .5rem; max-width: 22rem; }
.toast { background: hsl(var(--popover)); color: hsl(var(--popover-foreground)); border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: .75rem 1rem; box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.toast.destructive { border-color: hsl(var(--destructive)); }
.toast .toast-title { font-size: .875rem; font-weight: 600; }
.toast .toast-desc { font-size: .8125rem; color: hsl(var(--muted-foreground)); margin-top: .125rem; }

/* Delete confirmation modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 90; padding: 1rem; }
.modal-box { background: hsl(var(--popover)); color: hsl(var(--popover-foreground)); border-radius: var(--radius); border: 1px solid hsl(var(--border)); max-width: 28rem; width: 100%; padding: 1.5rem; }
.modal-box h2 { font-size: 1.0625rem; font-weight: 600; margin-bottom: .5rem; }
.modal-box p { font-size: .875rem; color: hsl(var(--muted-foreground)); }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.5rem; }

.spin { animation: pulse-spin 1s linear infinite; display: inline-block; }
@keyframes pulse-spin { to { transform: rotate(360deg); } }

.editor-card .q-row { display: flex; align-items: flex-start; gap: .5rem; }
.editor-card .q-num { padding-top: .625rem; font-size: .75rem; font-weight: 600; color: hsl(var(--muted-foreground)); }
.editor-card .q-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; padding-left: 1.5rem; margin-top: .75rem; }
.editor-card .q-actions { margin-left: auto; display: flex; align-items: center; gap: .25rem; }

.grid-new-round { display: grid; gap: .75rem; }
@media (min-width: 640px) { .grid-new-round { grid-template-columns: 1fr 10rem auto; align-items: end; } }

/* WYSIWYG email editor */
.wysiwyg-toolbar {
  display: flex; flex-wrap: wrap; gap: .25rem;
  border: 1px solid hsl(var(--input)); border-bottom: none;
  border-radius: calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0 0;
  padding: .375rem; background: hsl(var(--muted) / .5);
}
.wysiwyg-btn {
  border: 1px solid hsl(var(--border)); background: hsl(var(--card)); color: hsl(var(--foreground));
  border-radius: 4px; padding: .25rem .5rem; font-size: .75rem; cursor: pointer; line-height: 1.2;
}
.wysiwyg-btn:hover { background: hsl(var(--muted)); }
.wysiwyg-bold { font-weight: 700; }
.wysiwyg-italic { font-style: italic; }
.wysiwyg-underline { text-decoration: underline; }
.wysiwyg-survey-link { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); border-color: hsl(var(--primary) / .4); font-weight: 600; }
.wysiwyg-editor {
  min-height: 9rem; max-height: 22rem; overflow: auto;
  border: 1px solid hsl(var(--input));
  border-radius: 0 0 calc(var(--radius) - 2px) calc(var(--radius) - 2px);
  padding: .625rem .75rem; font-size: .875rem; background: hsl(var(--background));
}
.wysiwyg-editor:focus {
  outline: none;
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}
.wysiwyg-editor p { margin: 0 0 .75rem; }
.wysiwyg-editor p:last-child { margin-bottom: 0; }
.wysiwyg-editor a { color: hsl(var(--primary)); text-decoration: underline; }
.wysiwyg-editor ul, .wysiwyg-editor ol { margin: 0 0 .75rem 1.25rem; padding: 0; }
.email-hint { font-size: .75rem; color: hsl(var(--muted-foreground)); margin-top: .375rem; }
.email-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
