/* Custom Support Stack — design system + components.
   A clean, modern SaaS look. Loaded by every template. */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-2: #4b5563;
  --muted: #9ca3af;

  /* Brand teal — matches the Strapify website / contact form (#0e7c7b). */
  --primary: #0e7c7b;
  --primary-hover: #0b5e5d;
  --primary-soft: #e6f3f3;
  --primary-soft-text: #0b5e5d;

  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --purple: #7c3aed;
  --purple-soft: #f3e8ff;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .08), 0 2px 4px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

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

.muted { color: var(--muted); font-size: .85em; }

/* --- buttons --- */
.btn {
  font: inherit;
  font-weight: 600;
  font-size: .85rem;
  padding: .5rem .9rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .12s, box-shadow .12s, border-color .12s;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  line-height: 1;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text-2); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); padding: .4rem .6rem; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: .35rem .6rem; font-size: .78rem; }
.icon-btn {
  background: transparent; border: 1px solid var(--border); color: var(--text-2);
  width: 2rem; height: 2rem; border-radius: var(--radius-sm); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1rem;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }

/* --- form controls --- */
.input, .select, textarea.input {
  font: inherit; font-size: .88rem;
  padding: .5rem .65rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
.input:focus, .select:focus, textarea.input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.select { cursor: pointer; }
label { font-size: .82rem; color: var(--text-2); }

/* --- chips / tags / badges --- */
.tag {
  display: inline-flex; align-items: center; gap: .2rem;
  font-size: .68rem; font-weight: 600;
  padding: .12rem .5rem; border-radius: var(--radius-pill);
  background: var(--primary-soft); color: var(--primary-soft-text);
  margin: .12rem .15rem 0 0; cursor: pointer; white-space: nowrap;
}
.tag .x { cursor: pointer; opacity: .55; font-weight: 700; }
.tag .x:hover { opacity: 1; }

.badge {
  display: inline-flex; align-items: center;
  font-size: .66rem; font-weight: 700; letter-spacing: .01em;
  padding: .15rem .5rem; border-radius: var(--radius-pill);
}
.badge.p-top { background: var(--danger-soft); color: var(--danger); }
.badge.p-urgent { background: var(--warning-soft); color: var(--warning); }
.badge.p-angry { background: var(--purple-soft); color: var(--purple); }
.badge.p-low { background: #f3f4f6; color: var(--text-2); }

.channel-chip {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .7rem; font-weight: 600; color: var(--text-2);
}
.verified { color: var(--success); font-size: .72rem; font-weight: 600; }

/* --- avatar --- */
.avatar {
  flex: none; width: 2.25rem; height: 2.25rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem; color: #fff; text-transform: uppercase;
}

/* --- status pill (delivery) --- */
.status-dot { display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; }
.status-sent { background: var(--success); }
.status-failed { background: var(--danger); }
.status-queued { background: var(--warning); }

/* --- card / auth pages --- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 2rem;
}
.auth-card { width: 22rem; max-width: 100%; }
.auth-card h1 { font-size: 1.3rem; margin: 0 0 .25rem; }
.auth-card .brand { font-size: 1.6rem; margin-bottom: 1rem; }
.field { margin-bottom: 1rem; }
.field label { display: block; margin-bottom: .3rem; font-weight: 600; }
.form-error { background: var(--danger-soft); color: var(--danger); padding: .6rem .8rem;
  border-radius: var(--radius-sm); font-size: .85rem; margin-bottom: 1rem; }

/* --- generic page shell (settings, reports) --- */
.page { max-width: 60rem; margin: 0 auto; padding: 1.5rem; }
.page-narrow { max-width: 42rem; }
.page h1 { font-size: 1.4rem; margin: 0 0 .25rem; }
.page h2 { font-size: 1.05rem; margin: 1.8rem 0 .6rem; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
table.tbl { border-collapse: collapse; width: 100%; font-size: .85rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table.tbl th, table.tbl td { padding: .55rem .7rem; text-align: left; border-bottom: 1px solid var(--border); }
table.tbl th { background: var(--surface-2); font-weight: 600; color: var(--text-2); }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* --- toasts --- */
#toasts { position: fixed; bottom: 1.25rem; right: 1.25rem; display: flex; flex-direction: column;
  gap: .5rem; z-index: 100; }
.toast {
  background: var(--text); color: #fff; padding: .7rem .9rem; border-radius: var(--radius-sm);
  max-width: 20rem; font-size: .82rem; cursor: pointer; box-shadow: var(--shadow-lg);
  animation: toast-in .18s ease-out;
}
.toast strong { display: block; margin-bottom: .15rem; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Rendered (sanitised) email HTML inside a message bubble — keep it contained + readable. */
.email-html { overflow-wrap: anywhere; }
.email-html img { max-width: 100%; height: auto; }
.email-html table { max-width: 100%; border-collapse: collapse; }
.email-html a { color: var(--primary); }
.email-html blockquote { margin: .4rem 0; padding-left: .6rem; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.email-html p { margin: .3rem 0; }
