/* =========================================================
   TYCHIKOS V4.5 — MODERN APP UI
   Step 6

   - Navy / indigo app visual system
   - Responsive dashboard and editor
   - Active navigation highlighting
   - Refined Pastor Profile
   - Refined Subscription screen
   - Refined Coupons / Promotion Codes
   - Refined Pastor Management cards
   - Preserve sermon editor scrolling behavior
   ========================================================= */


/* =========================
   DESIGN TOKENS
   ========================= */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-indigo: #f5f5ff;

  --text: #172033;
  --text-strong: #0f172a;
  --muted: #64748b;
  --muted-light: #94a3b8;

  --primary: #3730a3;
  --primary-dark: #1e1b4b;
  --primary-hover: #312e81;
  --primary-soft: #eef2ff;
  --primary-border: #c7d2fe;

  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --success: #166534;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;

  --warning-text: #92400e;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;

  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;

  --radius-panel: 16px;
  --radius-control: 11px;
  --radius-small: 9px;
  --radius-pill: 999px;

  --shadow-card:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 8px 24px rgba(15, 23, 42, 0.05);

  --shadow-hover:
    0 2px 4px rgba(15, 23, 42, 0.05),
    0 14px 30px rgba(15, 23, 42, 0.08);

  --shadow-header:
    0 1px 2px rgba(15, 23, 42, 0.025),
    0 5px 18px rgba(15, 23, 42, 0.035);

  --focus-ring:
    0 0 0 3px rgba(79, 70, 229, 0.14);

  --content-width: 1320px;
}


/* =========================
   RESET / BASE
   ========================= */

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;

  background: var(--bg);

  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100%;

  overflow-x: hidden;

  background: var(--bg);
  color: var(--text);

  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;

  font-size: 15px;
  line-height: 1.5;

  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--primary);

  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--primary-hover);
}

img,
svg {
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}

::selection {
  background: #dfe3ff;
  color: var(--primary-dark);
}

hr {
  margin: 24px 0;

  border: 0;
  border-top: 1px solid var(--border);
}


/* =========================
   TYPOGRAPHY
   ========================= */

h1,
h2,
h3 {
  color: var(--text-strong);

  line-height: 1.16;
}

h1 {
  letter-spacing: -0.035em;
}

h2 {
  letter-spacing: -0.02em;
}

h3 {
  letter-spacing: -0.01em;
}

p {
  overflow-wrap: anywhere;
}

strong,
b {
  color: var(--text-strong);
}

.small,
.fine,
small {
  color: var(--muted);

  font-size: 12px;
}

.fine {
  line-height: 1.55;
}

.kicker {
  display: inline-block;

  color: var(--primary);

  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1.2;

  text-transform: uppercase;
}


/* =========================
   APPLICATION HEADER
   ========================= */

.topbar {
  min-height: 78px;

  padding: 12px 24px;

  display: flex;
  justify-content: space-between;
  align-items: center;

  gap: 22px;

  position: relative;
  z-index: 20;

  background: rgba(255, 255, 255, 0.97);

  border-bottom: 1px solid var(--border);

  box-shadow: var(--shadow-header);
}

.brand {
  min-width: max-content;

  display: inline-flex;
  align-items: center;
  gap: 11px;

  color: var(--text-strong);

  text-decoration: none;
}

.brand:hover {
  color: var(--text-strong);
}

.brand__mark {
  display: block;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.08),
    0 5px 14px rgba(15, 23, 42, 0.07);
}

.brand__copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.brand__copy > strong {
  color: var(--primary-dark);

  font-size: 23px;
  font-weight: 850;
  letter-spacing: -0.045em;
  line-height: 1;
}

.brand__copy > span {
  margin-top: 4px;

  color: var(--muted);

  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1.2;

  text-transform: uppercase;
}

.topbar nav {
  min-width: 0;

  display: flex;
  align-items: center;
  justify-content: flex-end;

  gap: 3px;

  flex-wrap: wrap;
}

.topbar nav a,
.link-button {
  min-height: 36px;

  padding: 8px 11px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border: 1px solid transparent;
  border-radius: 10px;

  background: transparent;

  color: #334155;

  font-size: 12px;
  font-weight: 750;
  line-height: 1;

  text-decoration: none;

  cursor: pointer;

  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}

.topbar nav a:hover,
.link-button:hover {
  background: var(--primary-soft);

  border-color: #e0e7ff;

  color: var(--primary);
}


/* =========================
   ACTIVE NAVIGATION
   ========================= */

.topbar nav a.active-nav,
.topbar nav a.active-nav:hover {
  background: var(--primary-soft);

  border-color: var(--primary-border);

  color: var(--primary);

  font-weight: 800;
}

.topbar nav a.active-nav::after {
  content: "";

  width: 5px;
  height: 5px;

  margin-left: 3px;

  flex: 0 0 5px;

  background: var(--primary);

  border-radius: 50%;
}

.topbar nav a:focus-visible,
.link-button:focus-visible {
  outline: none;

  box-shadow: var(--focus-ring);
}

.inline {
  display: inline;

  margin: 0;
}


/* =========================
   MAIN LAYOUT
   ========================= */

.shell {
  width: 100%;
  max-width: var(--content-width);

  margin: 0 auto;

  padding: 28px 24px 36px;
}

.narrow {
  width: 100%;
  max-width: 680px;

  margin: 48px auto;

  padding: 0 20px 36px;
}

.panel {
  min-width: 0;

  padding: 22px;

  background: var(--surface);

  border: 1px solid var(--border);
  border-radius: var(--radius-panel);

  box-shadow: var(--shadow-card);
}

.panel h1 {
  margin: 8px 0 22px;

  font-size: clamp(30px, 4vw, 38px);
}

.panel h2 {
  margin-top: 8px;
  margin-bottom: 10px;
}

.panel h3 {
  margin-top: 22px;
  margin-bottom: 10px;
}

.narrow > .panel {
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 18px 45px rgba(15, 23, 42, 0.07);
}


/* =========================
   FORMS
   ========================= */

form {
  min-width: 0;
}

label {
  display: block;

  margin: 14px 0 7px;

  color: #334155;

  font-size: 12px;
  font-weight: 750;
}

input,
textarea,
select {
  width: 100%;
  max-width: 100%;

  padding: 10px 12px;

  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);

  outline: none;

  background: var(--surface);
  color: var(--text-strong);

  line-height: 1.4;

  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

input:hover,
textarea:hover,
select:hover {
  border-color: #aebbd0;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #818cf8;

  box-shadow: var(--focus-ring);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-light);
}

input:disabled,
textarea:disabled,
select:disabled {
  background: #f1f5f9;
  color: var(--muted);

  cursor: not-allowed;
}

input[type="radio"],
input[type="checkbox"] {
  width: auto;
  min-width: 16px;
  height: 16px;

  margin: 1px 0 0;
  padding: 0;

  accent-color: var(--primary);

  box-shadow: none;
}

textarea {
  min-height: 105px;

  resize: vertical;
}

textarea.large {
  min-height: 175px;
}

fieldset {
  min-width: 0;

  margin: 20px 0;
  padding: 14px;

  background: var(--surface-soft);

  border: 1px solid var(--border);
  border-radius: 14px;
}

legend {
  padding: 0 7px;

  color: #334155;

  font-size: 12px;
  font-weight: 800;
}

.field-help {
  margin: 6px 0 0;

  color: var(--muted);

  font-size: 11px;
  line-height: 1.45;
}


/* =========================
   BUTTONS
   ========================= */

.primary,
.outline,
.button {
  min-height: 40px;

  padding: 9px 14px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  gap: 6px;

  border: 1px solid transparent;
  border-radius: var(--radius-control);

  font: inherit;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.15;

  text-align: center;
  text-decoration: none;

  white-space: nowrap;

  cursor: pointer;

  transition:
    transform 0.12s ease,
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}

.primary {
  background: var(--primary);

  border-color: var(--primary);

  color: #fff;

  box-shadow:
    0 5px 14px rgba(55, 48, 163, 0.16);
}

.primary:hover {
  background: var(--primary-hover);

  border-color: var(--primary-hover);

  color: #fff;

  box-shadow:
    0 7px 18px rgba(55, 48, 163, 0.20);
}

.outline {
  background: var(--surface);

  border-color: var(--border-strong);

  color: #334155;

  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.03);
}

.outline:hover {
  background: var(--primary-soft);

  border-color: var(--primary-border);

  color: var(--primary);
}

.primary:active,
.outline:active,
.button:active {
  transform: translateY(1px);
}

.primary:focus-visible,
.outline:focus-visible,
.button:focus-visible {
  outline: none;

  box-shadow: var(--focus-ring);
}

.primary:disabled,
.outline:disabled,
.button:disabled {
  opacity: 0.45;

  cursor: not-allowed;

  transform: none;
  box-shadow: none;
}

form > .primary,
form > .outline {
  margin-top: 18px;
}


/* =========================
   ALERTS / STATUS
   ========================= */

.error,
.warning {
  margin: 12px 0;

  padding: 11px 13px;

  border-radius: 11px;

  font-size: 13px;
  line-height: 1.5;
}

.error {
  background: var(--danger-bg);

  border: 1px solid var(--danger-border);

  color: var(--danger);
}

.error strong,
.error b {
  color: var(--danger);
}

.warning {
  background: var(--warning-bg);

  border: 1px solid var(--warning-border);

  color: var(--warning-text);
}

.warning strong,
.warning b {
  color: #78350f;
}

.language-badge,
.status-pill,
.badge,
.pill {
  width: fit-content;
  max-width: 100%;

  padding: 5px 9px;

  display: inline-flex;
  align-items: center;

  gap: 5px;

  background: var(--primary-soft);

  border: 1px solid var(--primary-border);
  border-radius: var(--radius-pill);

  color: var(--primary);

  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.02em;

  overflow-wrap: anywhere;
}

.language-badge {
  margin: 5px 0 0;

  padding: 4px 8px;
}

.status-pill--success {
  background: var(--success-bg);

  border-color: var(--success-border);

  color: var(--success);
}

.status-pill--warning {
  background: var(--warning-bg);

  border-color: var(--warning-border);

  color: var(--warning-text);
}

.status-pill--danger {
  background: var(--danger-bg);

  border-color: var(--danger-border);

  color: var(--danger);
}


/* =========================
   PAGE HEADINGS
   ========================= */

.page-head,
.editor-head {
  min-width: 0;

  display: flex;
  justify-content: space-between;
  align-items: center;

  gap: 20px;

  margin-bottom: 20px;
}

.page-head > *,
.editor-head > * {
  min-width: 0;
}

.page-head h1 {
  margin: 5px 0;

  font-size: clamp(34px, 4.5vw, 42px);
}

.page-head p {
  margin: 8px 0 0;

  color: var(--muted);
}


/* =========================
   SERMON PROJECT HEADER
   ========================= */

.editor-head {
  gap: 24px;

  margin-bottom: 16px;
}

.editor-head > div:first-child {
  flex: 1 1 auto;
}

.title-input {
  width: min(100%, 560px);
  max-width: 560px;

  display: block;

  margin-top: 4px;

  padding: 2px 2px 4px;

  background: transparent;

  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;

  color: var(--text-strong);

  font-size: clamp(26px, 3.4vw, 32px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;

  box-shadow: none;
}

.title-input:hover {
  background: transparent;

  border-color: transparent;
  border-bottom-color: var(--border-strong);

  box-shadow: none;
}

.title-input:focus {
  background: transparent;

  border-color: transparent;
  border-bottom-color: #818cf8;

  box-shadow: none;
}

.toolbar {
  min-width: 0;

  flex: 0 1 auto;

  display: flex;
  align-items: center;
  justify-content: flex-end;

  gap: 6px;

  flex-wrap: wrap;
}

.toolbar .primary,
.toolbar .outline {
  min-height: 38px;

  padding: 8px 13px;
}

#saveState {
  min-height: 27px;

  padding: 5px 9px;

  display: inline-flex;
  align-items: center;

  background: #eefdf4;

  border: 1px solid #d4f5df;
  border-radius: var(--radius-pill);

  color: #35724a;

  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}


/* =========================
   HELP / TOOLTIP ICONS
   ========================= */

.toolbar-help {
  display: inline-flex;
  align-items: center;

  gap: 5px;
}

.toolbar .tooltip-btn,
.help {
  width: 24px;
  height: 24px;

  min-width: 24px;
  min-height: 24px;

  flex: 0 0 24px;

  padding: 0;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: var(--surface);

  border: 1px solid var(--border-strong);
  border-radius: 50%;

  color: var(--primary);

  box-shadow: none;

  font-size: 12px;
  font-weight: 850;
  line-height: 1;

  cursor: pointer;

  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}

.toolbar .tooltip-btn:hover,
.help:hover {
  background: var(--primary-soft);

  border-color: var(--primary-border);

  color: var(--primary-hover);
}

.toolbar .tooltip-btn:focus-visible,
.help:focus-visible {
  outline: none;

  box-shadow: var(--focus-ring);
}


/*
   editor.ejs contains local tooltip styles.
*/

.field-label-row .tooltip-btn,
.pastor-notes-heading .tooltip-btn {
  width: 22px;
  height: 22px;

  min-width: 22px;
  min-height: 22px;

  padding: 0;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: var(--surface);

  border: 1px solid var(--border-strong);
  border-radius: 50%;

  color: var(--primary);

  font-size: 12px;
  font-weight: 850;
  line-height: 1;

  box-shadow: none;
}

.field-label-row .tooltip-btn:hover,
.field-label-row .tooltip-btn:focus,
.pastor-notes-heading .tooltip-btn:hover,
.pastor-notes-heading .tooltip-btn:focus {
  background: var(--primary-soft);

  border-color: var(--primary-border);

  color: var(--primary-hover);

  outline: none;
}

.tooltip-wrap .tooltip-box {
  padding: 11px 13px;

  background: #fff;

  border: 1px solid var(--border);
  border-radius: 12px;

  color: var(--text);

  font-size: 12px;
  line-height: 1.5;

  box-shadow: var(--shadow-hover);
}


/* =========================
   DASHBOARD
   ========================= */

.cards {
  display: grid;

  grid-template-columns:
    repeat(3, minmax(0, 1fr));

  gap: 18px;
}

.sermon-card {
  min-width: 0;
  min-height: 195px;

  padding: 22px;

  display: block;

  position: relative;

  overflow: hidden;

  background:
    linear-gradient(
      180deg,
      #ffffff 0%,
      #ffffff 78%,
      #fbfcff 100%
    );

  border: 1px solid var(--border);
  border-radius: var(--radius-panel);

  box-shadow: var(--shadow-card);

  color: var(--text);

  text-decoration: none;

  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.sermon-card::before {
  content: "";

  position: absolute;

  left: 0;
  top: 0;

  width: 100%;
  height: 3px;

  background:
    linear-gradient(
      90deg,
      var(--primary),
      #6366f1
    );

  opacity: 0.9;
}

.sermon-card:hover {
  transform: translateY(-3px);

  border-color: #c7d2fe;

  color: var(--text);

  box-shadow: var(--shadow-hover);
}

.sermon-card:hover::before {
  height: 4px;
}

.sermon-card .kicker {
  color: #4f46e5;
}

.sermon-card h2 {
  margin: 15px 0 8px;

  color: var(--text-strong);

  font-size: 21px;
}

.sermon-card p {
  margin: 0 0 12px;

  color: #475569;

  line-height: 1.5;
}

.sermon-card .language-badge {
  margin-top: 4px;
}

.sermon-card small {
  display: block;

  margin-top: 14px;

  color: #64748b;
}

.empty {
  padding: 34px;

  background: var(--surface);

  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-panel);

  box-shadow: var(--shadow-card);

  text-align: center;
}

.empty h2 {
  margin-top: 0;
}


/* =========================
   GENERAL GRIDS
   ========================= */

.grid2,
.profile-grid {
  min-width: 0;

  display: grid;

  gap: 16px;
}

.grid2 {
  grid-template-columns:
    repeat(2, minmax(0, 1fr));
}

.profile-grid {
  grid-template-columns:
    minmax(0, 1.3fr)
    minmax(300px, 0.7fr);
}

.grid2 > *,
.profile-grid > *,
.cards > * {
  min-width: 0;
}


/* =========================
   ADMIN DASHBOARD
   ========================= */

.page-head + .grid2 > .panel {
  min-height: 165px;

  position: relative;

  overflow: hidden;

  padding: 22px 23px;

  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.page-head + .grid2 > .panel::before {
  content: "";

  position: absolute;

  left: 0;
  top: 0;

  width: 4px;
  height: 100%;

  background:
    linear-gradient(
      180deg,
      var(--primary),
      #818cf8
    );

  opacity: 0.82;
}

.page-head + .grid2 > .panel:hover {
  transform: translateY(-2px);

  border-color: #d6dbeb;

  box-shadow: var(--shadow-hover);
}

.page-head + .grid2 > .panel .kicker {
  color: #6366f1;
}

.page-head + .grid2 > .panel > h2 {
  margin-top: 12px;
  margin-bottom: 8px;

  color: var(--primary-dark);

  font-size: clamp(25px, 3vw, 31px);
  line-height: 1.05;
}

.page-head + .grid2 > .panel > p {
  color: #475569;
}

.page-head + .grid2 > .panel > small {
  display: block;

  margin-top: 8px;
}


/* =========================
   PASTOR MANAGEMENT CARDS
   ========================= */

.cards > .panel {
  position: relative;

  overflow: hidden;

  align-self: start;

  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.cards > .panel::before {
  content: "";

  position: absolute;

  left: 0;
  right: 0;
  top: 0;

  height: 3px;

  background:
    linear-gradient(
      90deg,
      var(--primary),
      #818cf8
    );

  opacity: 0.75;
}

.cards > .panel:hover {
  transform: translateY(-2px);

  border-color: #d6dbeb;

  box-shadow: var(--shadow-hover);
}

.cards > .panel h2 {
  margin-top: 12px;

  font-size: 22px;
}

.cards > .panel p {
  margin: 11px 0;

  color: #475569;

  line-height: 1.45;
}

.cards > .panel p strong {
  color: #334155;

  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.cards > .panel p.small {
  margin-top: 13px;
  margin-bottom: 0;

  padding-top: 11px;

  border-top: 1px solid var(--border);

  color: var(--muted);
}


/* =========================
   SERMON EDITOR
   ========================= */

.editor-grid {
  min-width: 0;

  display: grid;

  grid-template-columns:
    300px minmax(0, 1fr);

  gap: 18px;

  align-items: start;
}


/*
   CRITICAL SCROLLING RULE

   Keep both editor columns in normal document flow.
   Do not add fixed heights, sticky positioning,
   or independent vertical scroll containers.
*/

.sidebar,
.workspace {
  width: 100%;
  min-width: 0;

  height: auto;
  max-height: none;

  overflow: visible;

  position: static;
}


/* =========================
   SIDEBAR WORKFLOW
   ========================= */

.sidebar nav {
  display: flex;
  flex-direction: column;

  gap: 6px;

  margin-top: 20px;
}

.workflow-section-label {
  margin: 10px 10px 1px;
  color: #94a3b8;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.12em;
}

.workflow-section-label:first-child {
  margin-top: 0;
}

.sidebar nav button {
  width: 100%;
  min-height: 39px;

  padding: 9px 11px;

  border: 1px solid transparent;
  border-radius: 10px;

  background: transparent;

  color: #475569;

  font-size: 12px;
  font-weight: 750;
  line-height: 1.3;

  text-align: left;

  cursor: pointer;

  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}

.sidebar nav button:hover {
  background: #f8fafc;

  border-color: var(--border);

  color: var(--text-strong);
}

.sidebar nav button.active {
  background: var(--primary);

  border-color: var(--primary);

  color: #fff;

  box-shadow:
    0 5px 14px rgba(55, 48, 163, 0.14);
}

.sidebar nav button:focus-visible {
  outline: none;

  box-shadow: var(--focus-ring);
}


/* =========================
   WORKSPACE
   ========================= */

.workspace-head {
  min-width: 0;

  display: flex;
  justify-content: space-between;
  align-items: flex-start;

  gap: 12px;
}

.workspace-head > * {
  min-width: 0;
}

.workspace-head h1 {
  margin: 3px 0 0;

  font-size: clamp(28px, 4vw, 36px);
}

.help-copy {
  margin-top: 10px;

  padding: 11px 13px;

  background: var(--primary-soft);

  border: 1px solid var(--primary-border);
  border-radius: 11px;

  color: #4338a8;

  font-size: 12px;
  line-height: 1.5;
}

.actions {
  margin: 18px 0;

  display: flex;
  align-items: center;

  gap: 8px;

  flex-wrap: wrap;
}

.actions .primary,
.actions .outline,
.actions .button {
  margin-top: 0;
}

.output {
  width: 100%;
  min-width: 0;
  min-height: 250px;

  padding: 18px;

  background: var(--surface-soft);

  border: 1px solid var(--border);
  border-radius: 13px;

  color: #263449;

  overflow-wrap: anywhere;

  line-height: 1.55;
}


/*
 * Generated sermon content is already converted
 * into semantic HTML by the editor renderer.
 * Keep the reading layout compact for practical
 * sermon preparation rather than preserving the
 * renderer's source-code whitespace.
 */
.formatted-output {
  white-space: normal;
}

.formatted-output .output-heading {
  margin: 16px 0 6px;

  color: var(--text-strong);

  font-size: 14px;
  line-height: 1.35;
}

.formatted-output .output-heading:first-child {
  margin-top: 0;
}

.formatted-output p {
  margin: 0 0 9px;

  line-height: 1.55;
}

.formatted-output p:last-child {
  margin-bottom: 0;
}

.formatted-output ul,
.formatted-output ol {
  margin: 6px 0 10px;
  padding-left: 24px;
}

.formatted-output li {
  margin: 3px 0;

  line-height: 1.5;
}

.navrow {
  margin-top: 22px;
  padding-top: 18px;

  display: flex;
  justify-content: space-between;
  align-items: center;

  gap: 10px;

  border-top: 1px solid var(--border);
}


/* =========================
   PROFILE / SUBSCRIPTION
   ========================= */

.profile-grid > .panel {
  position: relative;

  overflow: hidden;
}

.profile-grid > .panel:first-child::before,
.profile-grid > .panel:last-child::before {
  content: "";

  position: absolute;

  left: 0;
  right: 0;
  top: 0;

  height: 3px;
}

.profile-grid > .panel:first-child::before {
  background:
    linear-gradient(
      90deg,
      var(--primary),
      #6366f1
    );
}

.profile-grid > .panel:last-child::before {
  background:
    linear-gradient(
      90deg,
      #6366f1,
      #a5b4fc
    );
}

.profile-grid > .panel:last-child {
  background:
    linear-gradient(
      180deg,
      #ffffff 0%,
      #ffffff 65%,
      #fbfcff 100%
    );
}

.profile-grid > .panel:last-child > h2 {
  margin-top: 12px;

  color: var(--primary-dark);

  font-size: 25px;
}

.profile-grid > .panel:last-child > p {
  color: #475569;
}

.profile-grid > .panel:last-child > p b {
  display: inline-flex;

  padding: 4px 8px;

  background: var(--success-bg);

  border: 1px solid var(--success-border);
  border-radius: var(--radius-pill);

  color: var(--success);

  font-size: 11px;
}

#profileList {
  display: grid;

  gap: 9px;

  margin-top: 12px;
}

#profileList .mini-profile {
  margin: 0;

  padding: 13px 14px;

  background: var(--surface-soft);

  border: 1px solid var(--border);
  border-radius: 11px;
}

#profileList .mini-profile b {
  display: block;

  margin-bottom: 5px;

  color: var(--primary-dark);
}

#profileList .mini-profile p {
  margin: 0;

  line-height: 1.55;
}

#theologyForm {
  margin-top: 12px;

  padding: 16px;

  background: #fbfcff;

  border: 1px solid var(--border);
  border-radius: 13px;
}

#theologyForm label:first-of-type {
  margin-top: 0;
}

#theologyMsg,
#planMsg {
  min-height: 18px;

  margin-bottom: 0;
}

#changePlan {
  margin-top: 12px;
}

.profile-grid .panel form label:has(input[type="radio"]) {
  margin: 8px 0;

  padding: 11px 12px;

  display: flex;
  align-items: center;

  gap: 9px;

  background: var(--surface-soft);

  border: 1px solid var(--border);
  border-radius: 10px;

  cursor: pointer;

  transition:
    background 0.16s ease,
    border-color 0.16s ease;
}

.profile-grid .panel form label:has(input[type="radio"]:checked) {
  background: var(--primary-soft);

  border-color: #a5b4fc;
}


/* =========================
   SUBSCRIPTION PLAN SCREEN
   ========================= */

.subscription {
  position: relative;

  overflow: hidden;
}

.subscription::before {
  content: "";

  position: absolute;

  left: 0;
  right: 0;
  top: 0;

  height: 4px;

  background:
    linear-gradient(
      90deg,
      var(--primary),
      #6366f1,
      #818cf8
    );
}

.subscription > .kicker {
  margin-top: 4px;
}

.subscription h1 {
  margin-bottom: 24px;
}

.plan-choice {
  margin: 8px 0;

  padding: 12px 13px;

  display: flex;
  gap: 10px;
  align-items: flex-start;

  background: var(--surface);

  border: 1px solid var(--border);
  border-radius: 12px;

  cursor: pointer;

  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.plan-choice:hover {
  background: var(--primary-soft);

  border-color: var(--primary-border);
}

.plan-choice:has(input:checked) {
  background: var(--primary-soft);

  border-color: #a5b4fc;

  box-shadow:
    0 0 0 1px rgba(99, 102, 241, 0.05);
}

.plan-card {
  margin: 11px 0;

  padding: 18px;

  display: flex;

  gap: 14px;

  align-items: flex-start;

  background: var(--surface);

  border: 1px solid var(--border);
  border-radius: 14px;

  cursor: pointer;

  transition:
    transform 0.14s ease,
    background 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.plan-card:hover {
  transform: translateY(-1px);

  background: #fbfcff;

  border-color: var(--primary-border);

  box-shadow: var(--shadow-card);
}

.plan-card:has(input:checked) {
  background:
    linear-gradient(
      135deg,
      #f5f5ff,
      #eef2ff
    );

  border-color: #a5b4fc;

  box-shadow:
    0 0 0 1px rgba(99, 102, 241, 0.06),
    0 8px 20px rgba(55, 48, 163, 0.07);
}

.plan-card span {
  width: 100%;
  min-width: 0;
}

.plan-card b {
  display: block;

  margin-bottom: 7px;

  color: var(--text-strong);

  font-size: 15px;
}

.plan-card strong {
  margin-right: 3px;

  color: var(--primary-dark);

  font-size: 31px;
  line-height: 1;
}

.plan-card em {
  display: block;

  margin-top: 8px;

  color: var(--muted);

  font-size: 12px;
  font-style: normal;
  line-height: 1.45;
}

#langWrap {
  margin-top: 15px;

  padding: 14px;

  background: var(--surface-soft);

  border: 1px solid var(--border);
  border-radius: 12px;
}

#langWrap label {
  margin-top: 0;
}

.terms {
  margin: 20px 0;

  padding: 14px 0;

  display: flex;

  gap: 8px;

  flex-wrap: wrap;

  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);

  color: var(--muted);

  font-size: 11px;
}

.terms > * {
  padding: 5px 9px;

  background: var(--surface-soft);

  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}

.terms > b:first-child {
  background: var(--success-bg);

  border-color: var(--success-border);

  color: var(--success);
}

.subscription .primary {
  width: 100%;
  min-height: 44px;
}


/* =========================
   COUPONS / PROMOTION CODES
   ========================= */

/*
   These selectors intentionally override the metric-card
   styling that can otherwise apply to the two creation forms.
*/

section.panel:has(form[action="/admin/coupons"]),
section.panel:has(form[action="/admin/promotion-codes"]) {
  min-height: 0;

  position: relative;

  overflow: hidden;

  padding: 22px;
}

section.panel:has(form[action="/admin/coupons"])::before,
section.panel:has(form[action="/admin/promotion-codes"])::before {
  content: "";

  position: absolute;

  left: 0;
  right: 0;
  top: 0;

  width: 100%;
  height: 3px;

  background:
    linear-gradient(
      90deg,
      var(--primary),
      #818cf8
    );

  opacity: 0.85;
}

section.panel:has(form[action="/admin/coupons"]) > h2,
section.panel:has(form[action="/admin/promotion-codes"]) > h2 {
  margin-top: 10px;

  color: var(--text-strong);

  font-size: 24px;
  line-height: 1.15;
}

section.panel:has(form[action="/admin/coupons"]) .actions,
section.panel:has(form[action="/admin/promotion-codes"]) .actions {
  margin-bottom: 0;
}

main.shell > section.panel {
  position: relative;

  overflow: hidden;
}

main.shell > section.panel > .kicker {
  color: #6366f1;
}

main.shell > section.panel > h2 {
  color: var(--primary-dark);

  font-size: 27px;
}

main.shell > section.panel > .mini-profile {
  margin: 10px 0 0;

  padding: 14px 15px;

  background: var(--surface-soft);

  border: 1px solid var(--border);
  border-radius: 11px;
}

main.shell > section.panel > .mini-profile + .mini-profile {
  margin-top: 9px;
}

main.shell > section.panel > .mini-profile p {
  margin: 5px 0;

  color: #475569;
}

main.shell > section.panel > .mini-profile p:first-child {
  margin-top: 0;

  font-size: 14px;
}

main.shell > section.panel > .mini-profile p:last-child {
  margin-bottom: 0;
}

main.shell > section.panel > .mini-profile .small {
  display: inline-flex;

  width: fit-content;

  margin-top: 8px;

  padding: 4px 7px;

  background: var(--primary-soft);

  border: 1px solid var(--primary-border);
  border-radius: var(--radius-pill);

  color: var(--primary);

  font-size: 9px;
  font-weight: 800;
}


/* =========================
   GENERIC MINI PROFILE
   ========================= */

.mini-profile {
  margin-top: 10px;

  padding: 13px 0;

  border-top: 1px solid var(--border);
}

.mini-profile:first-child {
  margin-top: 0;
}

.mini-profile p {
  margin: 5px 0;

  color: #475569;

  font-size: 12px;
  line-height: 1.5;
}


/* =========================
   ADMIN / LIST CONTENT
   ========================= */

.grid2 > .panel > .kicker + h2 {
  margin-top: 10px;
  margin-bottom: 8px;
}

.grid2 > .panel h2 {
  overflow-wrap: anywhere;
}

.grid2 > .panel > h2:first-of-type {
  color: var(--primary-dark);
}

.grid2 > .panel > p:last-child {
  margin-bottom: 0;
}


/* =========================
   GENERIC TABLE SUPPORT
   ========================= */

.table-wrap {
  width: 100%;

  overflow-x: auto;

  background: var(--surface);

  border: 1px solid var(--border);
  border-radius: 12px;
}

table {
  width: 100%;

  border-collapse: collapse;

  background: var(--surface);

  color: var(--text);

  font-size: 13px;
}

th,
td {
  padding: 11px 12px;

  border-bottom: 1px solid var(--border);

  text-align: left;
  vertical-align: top;
}

th {
  background: var(--surface-soft);

  color: #475569;

  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;

  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}


/* =========================
   SMALL QUALITY OF LIFE
   ========================= */

[hidden] {
  display: none !important;
}

:target {
  scroll-margin-top: 20px;
}


/* =========================================================
   TABLET / SMALL LAPTOP
   ========================================================= */

@media (max-width: 1023px) {

  .shell {
    padding: 20px 16px 30px;
  }


  /* Two-tier tablet header */

  .topbar {
    min-height: auto;

    padding: 12px 18px;

    flex-direction: column;
    align-items: stretch;

    gap: 8px;
  }

  .brand {
    align-self: flex-start;
  }

  .topbar nav {
    width: 100%;

    justify-content: flex-start;

    gap: 4px;

    flex-wrap: wrap;
  }

  .topbar nav a,
  .link-button {
    min-height: 34px;

    padding: 7px 9px;

    font-size: 11.5px;
  }


  /* Main responsive grids */

  .editor-grid,
  .grid2,
  .profile-grid {
    grid-template-columns: 1fr;
  }


  /* Dashboard and pastor cards */

  .cards {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));

    gap: 16px;
  }


  /* Editor header */

  .editor-head {
    flex-direction: column;
    align-items: stretch;

    gap: 10px;

    margin-bottom: 14px;
  }

  .editor-head > div {
    width: 100%;
    min-width: 0;
  }

  .title-input {
    width: 100%;
    max-width: 100%;
  }

  .toolbar {
    width: 100%;
    max-width: 100%;

    justify-content: flex-start;
  }


  /*
     Preserve one normal page scrollbar.
  */

  .sidebar,
  .workspace {
    height: auto;
    max-height: none;

    overflow: visible;

    position: static;
  }

  .page-head + .grid2 > .panel {
    min-height: auto;
  }


  /* Profile */

  .profile-grid > .panel:last-child {
    margin-top: 0;
  }
}


/* =========================================================
   SMALL TABLET / LARGE PHONE
   ========================================================= */

@media (max-width: 699px) {

  .cards {
    grid-template-columns: 1fr;
  }
}


/* =========================
   MOBILE LANDSCAPE
   ========================= */

@media (max-width: 900px) and (orientation: landscape) {

  .topbar {
    min-height: auto;

    padding: 9px 16px;

    gap: 5px;
  }

  .topbar nav {
    gap: 2px;
  }

  .topbar nav a,
  .link-button {
    min-height: 31px;

    padding: 6px 7px;

    font-size: 11px;
  }

  .shell {
    padding-top: 14px;
  }

  .panel {
    padding: 18px;
  }

  .editor-grid {
    grid-template-columns: 1fr;
  }

  .editor-head {
    gap: 8px;
  }

  .language-badge {
    margin-top: 4px;
  }

  .toolbar {
    gap: 5px;
  }

  .toolbar .primary,
  .toolbar .outline {
    min-height: 38px;
  }

  .toolbar .tooltip-btn,
  .help {
    width: 24px;
    height: 24px;

    min-width: 24px;
    min-height: 24px;

    flex-basis: 24px;
  }
}


/* =========================
   PHONES
   ========================= */

@media (max-width: 600px) {

  body {
    font-size: 14px;
  }

  .shell {
    padding: 14px 12px 26px;
  }

  .narrow {
    margin: 24px auto;

    padding: 0 12px 28px;
  }


  /* Compact mobile header */

  .topbar {
    padding: 10px 12px;

    flex-direction: column;
    align-items: stretch;

    gap: 6px;
  }

  .brand {
    min-width: 0;
  }

  .brand__copy > strong {
    font-size: 20px;
  }

  .brand__mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    border-radius: 10px;
  }

  .brand__copy > span {
    margin-top: 3px;

    font-size: 7.5px;
  }

  .topbar nav {
    width: 100%;

    justify-content: flex-start;

    column-gap: 2px;
    row-gap: 1px;
  }

  .topbar nav a,
  .link-button {
    min-height: 31px;

    padding: 5px 6px;

    font-size: 11px;
  }


  /* Panels */

  .panel {
    padding: 17px;

    border-radius: 14px;
  }

  .panel h1 {
    font-size: 30px;
  }


  /* Page heading */

  .page-head {
    flex-direction: column;
    align-items: stretch;

    gap: 12px;
  }

  .page-head > .primary,
  .page-head > .outline,
  .page-head > .button {
    align-self: flex-start;
  }

  .page-head h1 {
    font-size: 34px;
  }


  /* Editor heading */

  .editor-head {
    gap: 8px;

    margin-bottom: 12px;
  }

  .title-input {
    margin-top: 3px;

    padding: 2px 1px 4px;

    font-size: 27px;
  }

  .language-badge {
    margin-top: 4px;
  }


  /* Standard form controls */

  input,
  textarea,
  select {
    font-size: 16px;
  }

  textarea.large {
    min-height: 155px;
  }


  /* Editor toolbar */

  .toolbar {
    gap: 6px;
  }

  .toolbar > a,
  .toolbar > button,
  .toolbar-help > a,
  .toolbar-help > button:not(.tooltip-btn) {
    min-height: 40px;
  }

  .toolbar .primary,
  .toolbar .outline {
    padding: 8px 12px;
  }


  /* Toolbar help icons */

  .toolbar .tooltip-btn,
  .help {
    width: 26px;
    height: 26px;

    min-width: 26px;
    min-height: 26px;

    flex: 0 0 26px;

    padding: 0;

    border-radius: 50%;

    font-size: 13px;
    line-height: 1;
  }


  /* Field help icons */

  .field-label-row .tooltip-btn,
  .pastor-notes-heading .tooltip-btn {
    width: 24px;
    height: 24px;

    min-width: 24px;
    min-height: 24px;

    font-size: 13px;
    line-height: 1;
  }


  /* Mobile tooltip */

  .tooltip-wrap .tooltip-box {
    position: fixed;

    left: 12px;
    right: 12px;

    top: auto;
    bottom: 16px;

    width: auto;
    max-width: none;

    padding: 14px;

    border: 1px solid var(--border);
    border-radius: 14px;

    font-size: 14px;
    line-height: 1.5;

    box-shadow:
      0 18px 45px rgba(15, 23, 42, 0.18);
  }


  /* Workspace */

  .workspace-head h1 {
    font-size: 30px;
  }

  #workflow button {
    width: 100%;
  }

  .actions {
    align-items: stretch;
  }

  .actions button,
  .actions a {
    min-height: 42px;
  }

  .navrow {
    align-items: stretch;
  }

  .navrow .primary,
  .navrow .outline,
  .navrow .button {
    white-space: normal;
  }


  /* Dashboard cards */

  .sermon-card {
    min-height: auto;

    padding: 19px;
  }

  .sermon-card h2 {
    font-size: 20px;
  }

  .cards > .panel {
    transform: none;
  }


  /* Profile */

  #theologyForm {
    padding: 14px;
  }

  #profileList .mini-profile {
    padding: 12px;
  }


  /* Subscription */

  .plan-card {
    padding: 15px;
  }

  .plan-card strong {
    font-size: 27px;
  }

  #langWrap {
    padding: 12px;
  }


  /* Coupons */

  section.panel:has(form[action="/admin/coupons"]),
  section.panel:has(form[action="/admin/promotion-codes"]) {
    padding: 17px;
  }

  main.shell > section.panel > .mini-profile {
    padding: 12px;
  }
}


/* =========================
   VERY SMALL PHONES
   ========================= */

@media (max-width: 380px) {

  .topbar nav {
    gap: 1px;
  }

  .topbar nav a,
  .link-button {
    padding-left: 5px;
    padding-right: 5px;

    font-size: 10.25px;
  }

  .panel {
    padding: 15px;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar > a,
  .toolbar > button {
    white-space: normal;
  }

  .toolbar .primary,
  .toolbar .outline {
    padding-left: 10px;
    padding-right: 10px;
  }
}


/* =========================
   REDUCED MOTION
   ========================= */

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;

    transition-duration: 0.01ms !important;

    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}


/* Approved PreacherDesk member-header brand standard */
.brand__copy > strong {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.055em;
  line-height: 0.95;
}

.brand__preacher {
  color: #080d18;
}

.brand__desk {
  color: #0868d7;
}

.brand__copy > span {
  margin-top: 4px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
  text-transform: none;
}

@media (max-width: 600px) {
  .brand__copy > strong {
    font-size: 24px;
  }

  .brand__copy > span {
    font-size: 10px;
  }
}
