/* =============================================================================
   GETSITEGO ADMIN — shadcn/ui design system, ported to plain CSS.

   shadcn/ui is a React component collection; the admin is server-rendered PHP,
   so what is reproduced here is the system underneath it: the HSL token layer,
   the radius scale, the focus ring, and the component recipes (button, card,
   input, table, badge, alert, tabs). Values are shadcn's "blue" theme, which
   lands close to the GetSiteGo brand.

   Self-contained on purpose — the admin no longer loads the marketing site's
   stylesheets, so restyling the site cannot disturb the admin, or vice versa.
   ========================================================================== */

/* ------------------------------------------------------------------ Tokens */

:root {
  --background:            0 0% 100%;
  --foreground:            222.2 84% 4.9%;

  --card:                  0 0% 100%;
  --card-foreground:       222.2 84% 4.9%;

  --popover:               0 0% 100%;
  --popover-foreground:    222.2 84% 4.9%;

  --primary:               221.2 83.2% 53.3%;
  --primary-foreground:    210 40% 98%;

  --secondary:             210 40% 96.1%;
  --secondary-foreground:  222.2 47.4% 11.2%;

  --muted:                 210 40% 96.1%;
  --muted-foreground:      215.4 16.3% 46.9%;

  --accent:                210 40% 96.1%;
  --accent-foreground:     222.2 47.4% 11.2%;

  --destructive:           0 84.2% 60.2%;
  --destructive-foreground: 210 40% 98%;

  --border:                214.3 31.8% 91.4%;
  --input:                 214.3 31.8% 91.4%;
  --ring:                  221.2 83.2% 53.3%;

  --radius: 0.5rem;
}

/* The admin is a tool, often open late. Follow the operating system. */
@media (prefers-color-scheme: dark) {
  :root {
    --background:            222.2 84% 4.9%;
    --foreground:            210 40% 98%;

    --card:                  222.2 84% 4.9%;
    --card-foreground:       210 40% 98%;

    --popover:               222.2 84% 4.9%;
    --popover-foreground:    210 40% 98%;

    --primary:               217.2 91.2% 59.8%;
    --primary-foreground:    222.2 47.4% 11.2%;

    --secondary:             217.2 32.6% 17.5%;
    --secondary-foreground:  210 40% 98%;

    --muted:                 217.2 32.6% 17.5%;
    --muted-foreground:      215 20.2% 65.1%;

    --accent:                217.2 32.6% 17.5%;
    --accent-foreground:     210 40% 98%;

    --destructive:           0 62.8% 30.6%;
    --destructive-foreground: 210 40% 98%;

    --border:                217.2 32.6% 17.5%;
    --input:                 217.2 32.6% 17.5%;
    --ring:                  224.3 76.3% 48%;
  }
}

/* ------------------------------------------------------------------- Reset */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.875rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
h1 { font-size: 1.5rem; letter-spacing: -0.02em; }
h2 { font-size: 1.125rem; }
h3 { font-size: 0.875rem; }
p  { margin: 0 0 0.75rem; }
a  { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8125rem;
  padding: 0.125rem 0.3rem;
  border-radius: calc(var(--radius) - 4px);
  background: hsl(var(--muted));
}

:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: 2px; }

.admin-body { min-height: 100vh; }

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ----------------------------------------------------------------- Button */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.5rem;
  padding: 0 1rem;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  background: none;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s, opacity .15s;
}
.btn:disabled { opacity: .5; pointer-events: none; }

.btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}
.btn-primary:hover { background: hsl(var(--primary) / .9); }

.btn-outline {
  border-color: hsl(var(--border));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}
.btn-outline:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }

.btn-secondary {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}
.btn-secondary:hover { background: hsl(var(--secondary) / .8); }

.btn-ghost { color: hsl(var(--foreground)); }
.btn-ghost:hover { background: hsl(var(--accent)); }

.btn-destructive {
  background: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
}

.btn-sm { height: 2.25rem; padding: 0 0.75rem; font-size: 0.8125rem; }
.btn-lg { height: 2.75rem; padding: 0 2rem; }
.btn-block { width: 100%; }

/* A link that behaves as a button inside dense rows. */
.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: hsl(var(--muted-foreground));
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: color .15s;
}
.link-btn:hover { color: hsl(var(--foreground)); text-decoration: underline; }
.link-btn.is-danger { color: hsl(var(--destructive)); }

/* ------------------------------------------------------------------ Input */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
select,
textarea {
  display: block;
  width: 100%;
  height: 2.5rem;
  padding: 0 0.75rem;
  border: 1px solid hsl(var(--input));
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: inherit;
  font-size: 0.875rem;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: hsl(var(--muted-foreground)); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / .25);
}
select {
  appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
}

.form-field { display: grid; gap: 0.5rem; text-align: left; }
.form-field label {
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  color: hsl(var(--foreground));
}

/* ------------------------------------------------------------------- Card */

.panel,
.template-card,
.fb-item,
.stat,
.login-card {
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
}

/* ------------------------------------------------------------------ Badge */

.fb-badge, .pill {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.625rem;
  border: 1px solid transparent;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.35;
}
.fb-badge, .pill-ok {
  background: hsl(var(--primary) / .1);
  color: hsl(var(--primary));
}
.pill-bad {
  background: hsl(var(--destructive) / .12);
  color: hsl(var(--destructive));
}

/* ------------------------------------------------------------------ Alert */

.admin-note, .admin-error, .preview-result {
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  font-size: 0.875rem;
}
.admin-note, .preview-result.is-ok {
  border-color: hsl(var(--primary) / .35);
  background: hsl(var(--primary) / .07);
}
.admin-error, .preview-result.is-bad {
  border-color: hsl(var(--destructive) / .4);
  background: hsl(var(--destructive) / .08);
  color: hsl(var(--destructive));
}
.admin-error-detail {
  display: block;
  margin-top: 0.5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  opacity: .85;
}

.admin-empty {
  padding: 3rem 1.5rem;
  margin-bottom: 1rem;
  border: 1px dashed hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  color: hsl(var(--muted-foreground));
  text-align: center;
}
.admin-empty a { color: hsl(var(--primary)); font-weight: 500; }

/* --------------------------------------------------------------- Top bar */

.admin-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--background) / .85);
  backdrop-filter: blur(8px);
}
.admin-bar-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  max-width: 1180px;
  margin-inline: auto;
  height: 3.5rem;
  padding-inline: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-right: auto;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: hsl(var(--foreground));
}
.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-size: 0.75rem;
  font-weight: 700;
}

.admin-nav { display: flex; align-items: center; gap: 1.25rem; }
.admin-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  transition: color .15s;
}
.admin-nav a:hover,
.admin-nav a.is-active { color: hsl(var(--foreground)); }

/* ------------------------------------------------------------------- Page */

.admin-main {
  max-width: 1180px;
  margin-inline: auto;
  padding: 2rem 1.5rem 4rem;
}

.admin-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.admin-head-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1rem;
}

.page-lede {
  max-width: 46rem;
  margin: -0.5rem 0 1.5rem;
  color: hsl(var(--muted-foreground));
}

/* Stat cards — a muted label under a large figure, as shadcn dashboards do. */
.stat-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.stat {
  display: flex;
  flex-direction: column-reverse;
  gap: 0.25rem;
  min-width: 6.5rem;
  padding: 0.75rem 1rem;
}
.stat-num { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.stat-label { font-size: 0.75rem; font-weight: 500; color: hsl(var(--muted-foreground)); }

/* ---------------------------------------------------------------- Toolbar */

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.admin-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}
.admin-toolbar form { display: inline-flex; gap: 0.5rem; }

/* Tabs: a muted track with a raised active pill. */
.filter-tabs {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--muted));
}
.filter-tabs a {
  padding: 0.35rem 0.75rem;
  border-radius: calc(var(--radius) - 4px);
  font-size: 0.8125rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  transition: background-color .15s, color .15s;
}
.filter-tabs a:hover { color: hsl(var(--foreground)); }
.filter-tabs a.is-active {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: 0 1px 2px hsl(var(--foreground) / .08);
}

.admin-search { display: inline-flex; gap: 0.5rem; }
.admin-search input[type="search"] { width: 16rem; }
.admin-clear {
  align-self: center;
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}
.admin-clear:hover { color: hsl(var(--foreground)); }

/* ----------------------------------------------------------- Feedback list */

.fb-list { list-style: none; display: grid; gap: 0.75rem; }
.fb-item { padding: 1.25rem; }
.fb-item.is-unread { border-left: 3px solid hsl(var(--primary)); }

.fb-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}
.fb-who { font-weight: 600; color: hsl(var(--foreground)); }
.fb-email { color: hsl(var(--primary)); }
.fb-email:hover { text-decoration: underline; }
.fb-time { margin-left: auto; font-variant-numeric: tabular-nums; }

.fb-message {
  margin: 0 0 1rem;
  color: hsl(var(--foreground));
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.fb-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid hsl(var(--border));
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}
.fb-page { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.fb-actions { display: flex; gap: 1rem; }
.fb-actions form { display: inline; }

.admin-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}
.admin-pager a { font-weight: 500; color: hsl(var(--foreground)); }
.admin-pager a:hover { text-decoration: underline; }

/* ----------------------------------------------------------------- Panels */

.panel { padding: 1.25rem; margin-bottom: 1rem; }
.panel h2 { margin-bottom: 1rem; }
.panel-empty { margin: 0; color: hsl(var(--muted-foreground)); }
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.panel-note {
  max-width: 40rem;
  margin: 1.5rem auto 0;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  text-align: center;
}

/* ------------------------------------------------------------------ Table */

.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th,
.data-table td {
  padding: 0.625rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid hsl(var(--border));
}
.data-table th {
  font-size: 0.75rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: hsl(var(--muted) / .5); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ Chart */

.chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 11rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid hsl(var(--border));
}
.chart-col { flex: 1 1 0; min-width: 3px; height: 100%; display: flex; align-items: flex-end; }
.chart-bar {
  width: 100%;
  border-radius: 2px 2px 0 0;
  background: hsl(var(--primary) / .85);
  transition: background-color .15s;
}
.chart-col:hover .chart-bar { background: hsl(var(--primary)); }
.chart-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

/* --------------------------------------------------------- Email templates */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17.5rem, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.template-card { display: flex; flex-direction: column; padding: 1.25rem; }
.template-card h2 { margin-bottom: 0.5rem; }
.template-card p {
  flex: 1;
  margin-bottom: 1.25rem;
  color: hsl(var(--muted-foreground));
}
.template-preview-link {
  align-self: flex-start;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--primary));
}
.template-preview-link:hover { text-decoration: underline; }
.template-card.is-placeholder { border-style: dashed; background: transparent; }
.template-card.is-placeholder h2 { color: hsl(var(--muted-foreground)); }

/* ---------------------------------------------------------- Preview window */

.preview-body { background: hsl(var(--muted) / .4); }
.preview-shell { max-width: 48rem; margin-inline: auto; padding: 1.5rem 1.5rem 3rem; }

.preview-result { font-weight: 500; }

.preview-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card));
}
.preview-bar-title { display: grid; gap: 0.125rem; }
.preview-bar-title strong { font-size: 0.875rem; font-weight: 600; }
.preview-subject { font-size: 0.75rem; color: hsl(var(--muted-foreground)); }

.preview-send { display: flex; align-items: center; gap: 0.5rem; }
.preview-send input { width: 15rem; }

.preview-note {
  margin: 1rem 0 0.75rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  text-align: center;
}
.preview-note a { color: hsl(var(--primary)); font-weight: 500; }

.preview-frame {
  width: 100%;
  height: 45rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: #FFFFFF;   /* the email's own canvas, not the admin theme */
}

/* ----------------------------------------------------------- Login / setup */

.login-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background: hsl(var(--muted) / .4);
}
.login-card {
  width: 100%;
  max-width: 22rem;
  padding: 1.75rem;
  box-shadow: 0 1px 3px hsl(var(--foreground) / .06);
}
.login-card .brand { margin: 0 0 1.25rem; }
.login-card h1 { margin-bottom: 1.25rem; font-size: 1.25rem; }
.login-form { display: grid; gap: 1rem; }
.setup-note { margin: 1rem 0 0; font-size: 0.75rem; color: hsl(var(--muted-foreground)); }

/* ------------------------------------------------------------------ Narrow */

@media (max-width: 860px) {
  .panel-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .admin-bar-inner { height: auto; padding-block: 0.75rem; flex-wrap: wrap; gap: 0.75rem; }
  .admin-main { padding: 1.5rem 1rem 3rem; }
  .admin-head-right { align-items: stretch; width: 100%; }
  .stat-row { width: 100%; }
  .stat { flex: 1; }
  .admin-toolbar-right { margin-left: 0; }
  .admin-search input[type="search"] { width: 100%; }
  .fb-time { margin-left: 0; width: 100%; }
  .preview-send { width: 100%; }
  .preview-send input { flex: 1; width: auto; }
}
