/* PauseAI Outreach — design tokens */
:root {
  --pai-orange: #FF9416;       /* brand primary: pause mark, primary buttons */
  --pai-orange-deep: #E07E0A;  /* hover/active */
  --pai-orange-text: #B25E00;  /* orange that passes contrast as text */
  --pai-orange-tint: #FFEAD1;  /* badges, flash background */
  --ink: #1F1B16;              /* warm near-black text */
  --ink-soft: #6B6257;         /* secondary text, table headers, labels */
  --paper: #FFFFFF;            /* surfaces */
  --paper-warm: #FAF7F2;       /* page background */
  --line: #E8E1D8;             /* hairlines and borders */
  --radius: 6px;
}

* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  background: var(--paper-warm);
  color: var(--ink);
  line-height: 1.5;
}

main { max-width: 62rem; margin: 0 auto; padding: 1.5rem 1rem 4rem; }

/* Header: white bar, pause-mark brand left, nav right */
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.site-header-inner {
  max-width: 62rem; margin: 0 auto; padding: 0.7rem 1rem;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.5rem;
}
.brand { display: inline-flex; align-items: center; gap: 0.55rem; text-decoration: none; color: var(--ink); }
.pause-mark { display: inline-flex; gap: 4px; }
.pause-mark::before, .pause-mark::after {
  content: ""; width: 7px; height: 22px; border-radius: 4px;
  background: var(--pai-orange);
}
.wordmark { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.wordmark-soft { font-weight: 400; color: var(--ink-soft); }
.site-header nav a {
  margin-left: 1.1rem; text-decoration: none; font-weight: 600;
  color: var(--ink-soft); font-size: 0.95rem;
}
.site-header nav a:hover { color: var(--ink); border-bottom: 2px solid var(--pai-orange); }

/* Log-out on top, the account email right-aligned beneath it (Benjamin,
   batch-3 addendum: "the email address should be under the logout") */
.nav-account {
  display: inline-flex; flex-direction: column; align-items: flex-end;
  margin-left: 1.1rem; vertical-align: middle;
}
.nav-user {
  color: var(--ink-soft); font-size: 0.8rem;
}

/* Log-out is a form (for POST) styled to sit inline like the other nav links */
.nav-logout { display: inline; }
.nav-logout button {
  font: inherit; margin: 0; padding: 0; border: none; background: none;
  color: var(--ink-soft); font-weight: 600; font-size: 0.95rem;
}
.nav-logout button:hover {
  background: none; color: var(--ink); border-bottom: 2px solid var(--pai-orange);
}

/* Type hierarchy */
h1 { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.01em; margin: 0.5rem 0 1rem; }
h2 {
  font-size: 0.85rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--ink-soft); margin: 2rem 0 0.6rem;
  display: flex; align-items: center; gap: 0.45rem;
}
/* the pause mark, miniaturized, as section marker */
h2::before {
  content: ""; width: 9px; height: 0.85em; border-radius: 1px; flex: none;
  background: linear-gradient(90deg,
    var(--pai-orange) 0 3px, transparent 3px 6px, var(--pai-orange) 6px 9px);
}

a { color: var(--pai-orange-text); }
a:hover { color: var(--pai-orange-deep); }

/* Tables: hairline rows instead of full grid */
table { border-collapse: collapse; margin: 1rem 0; width: 100%; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
th, td { border-bottom: 1px solid var(--line); padding: 0.5rem 0.75rem; text-align: left; }
tr:last-child td { border-bottom: none; }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); background: var(--paper-warm); }
tbody tr:hover td, tr:hover td { background: #FFFDF9; }

/* Buttons: quiet by default, orange for the primary action of a section */
button {
  font: inherit; margin: 0.15rem 0; padding: 0.42rem 0.9rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); color: var(--ink); cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
button:hover { border-color: var(--ink-soft); background: var(--paper-warm); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--pai-orange); border-color: var(--pai-orange); color: #201505; font-weight: 600; }
.btn-primary:hover { background: var(--pai-orange-deep); border-color: var(--pai-orange-deep); }

/* Orange-outline emphasis: stands out without a solid fill that would read
   as THE primary action next to a real one. Used for the start-tutorial
   button (Benjamin's variant-A feedback) and, via .btn-attention, for
   "Send test email" (batch 3 item 5 - the required first step before
   send-all unlocks). */
#start-tutorial-btn, .btn-attention {
  border: 2px solid var(--pai-orange); color: var(--pai-orange-text); font-weight: 600;
}
#start-tutorial-btn:hover, .btn-attention:hover { background: var(--pai-orange-tint); }

/* Inputs */
input, textarea, select {
  font: inherit; margin: 0.15rem 0; padding: 0.4rem 0.6rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); color: var(--ink);
  /* size=/cols= attributes (e.g. the audience-query field, size=70) set an
     intrinsic width that can exceed a narrow viewport or a half-width
     campaign column and force the whole page to scroll horizontally. */
  max-width: 100%; box-sizing: border-box;
}
input::placeholder, textarea::placeholder { color: #A99F92; }
h1 input {
  width: 100%; font-size: 1.45rem; font-weight: 700; letter-spacing: -0.01em;
  border: none; background: transparent; padding: 0.1rem 0;
}
h1 input:hover { background: var(--paper); }

/* Narrow centered card for the login form */
.login-form {
  max-width: 22rem; margin: 2rem auto; padding: 1.5rem;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
}
.login-form input { width: 100%; }
.login-form button { width: 100%; }

/* Keyboard focus, everywhere */
:focus-visible { outline: 2px solid var(--pai-orange); outline-offset: 2px; }

/* Secondary explanatory microcopy next to a button or field */
.hint { font-size: 0.85rem; color: var(--ink-soft); margin-left: 0.5rem; }

/* Flash messages */
.flash {
  background: var(--pai-orange-tint); border: 1px solid var(--pai-orange);
  border-left-width: 4px; border-radius: var(--radius);
  padding: 0.55rem 0.8rem; margin: 0.75rem 0;
}

/* Status badges */
.badge {
  display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px;
  font-size: 0.8rem; font-weight: 600;
}
.badge-sent { background: var(--pai-orange-tint); color: var(--pai-orange-text); }

pre {
  white-space: pre-wrap; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0.8rem;
}

/* Running-job status lines (batch 3 item 9): unmistakably an ACTIVE process -
   the flash-style orange block plus an animated CSS spinner, no assets.
   Shown/hidden by the same job-status polling / server-side render that
   already controls these lines (id="job-status-<kind>"). */
.job-status-line {
  display: flex; align-items: center; gap: 0.6rem;
  background: var(--pai-orange-tint); border: 1px solid var(--pai-orange);
  border-left-width: 4px; border-radius: var(--radius);
  padding: 0.55rem 0.8rem; margin: 0.75rem 0;
  color: var(--pai-orange-text); font-weight: 600;
}
/* display:flex above would defeat the hidden attribute the poller toggles -
   author rules override the UA's [hidden]{display:none}. */
.job-status-line[hidden] { display: none; }
.job-status-line::before {
  content: ""; flex: none; width: 1em; height: 1em; border-radius: 50%;
  border: 3px solid var(--paper); border-top-color: var(--pai-orange);
  animation: job-spin 0.9s linear infinite;
}
@keyframes job-spin { to { transform: rotate(360deg); } }

/* Campaign page: single-column, full-width sections top to bottom
   (contacts, then email, then attachments, then send - wave-2 rebuild).
   A table can still be wider than the viewport (editable inputs in every
   cell); scroll it horizontally within its own box instead of forcing the
   whole page to scroll sideways. */
.table-scroll { overflow-x: auto; max-width: 100%; }
#campaign-email-section input, #campaign-email-section textarea { width: 100%; max-width: 40rem; }
/* Checkboxes are never full-width fields - exempt them from the rule above,
   which otherwise stretches the box itself and shoves its button to the far
   side of the row (Benjamin: "the checkboxes should be closer to Overwrite
   and Save"). */
#campaign-email-section input[type="checkbox"] { width: auto; }
/* A share/overwrite checkbox that belongs to an adjacent action button:
   label text and box glued together, small gap before the button. */
.checkbox-action { display: inline-flex; align-items: center;
  gap: 0.35rem; white-space: nowrap; margin-right: 0.4rem; }
#campaign-contacts-section, #campaign-email-section, #campaign-attachments-section {
  margin-top: 1.5rem;
}
#campaign-templates-section, #campaign-preview-row { margin-top: 1.5rem; }

/* Empty-table skeleton rows (plan 3a): muted placeholder cells so an empty
   contacts table still visibly reads as a table, not a blank area. */
.skeleton-row td { background: var(--paper-warm); color: transparent; }

/* Add-contact row: its own row with comfortable spacing between the three
   inputs, instead of them running together. */
.add-contact-row td { padding: 0.9rem 0.75rem; }
.add-contact-row input { margin-right: 0.5rem; }

.contacts-upload-row { margin: 1rem 0; display: flex; align-items: center;
  gap: 1rem; flex-wrap: wrap; }

/* Placeholder pills (plan 3b): small buttons that insert {key} at the
   cursor - visually distinct from regular actions. */
#campaign-placeholders { margin: 0.5rem 0; display: flex; align-items: center;
  gap: 0.4rem; flex-wrap: wrap; }
.pill {
  font-size: 0.8rem; padding: 0.15rem 0.55rem; border-radius: 999px;
  background: var(--pai-orange-tint); border-color: var(--pai-orange);
  color: var(--pai-orange-text);
}
.pill:hover { background: var(--pai-orange); color: #201505; }

/* Salutation pattern editor (batch 5): one compact wrapping row under the
   pills - keep each m/f label glued to its input instead of letting the
   section-wide full-width input rule stack them apart. */
#salutation-settings { margin: 0.5rem 0; display: flex; align-items: center;
  gap: 0.4rem 1rem; flex-wrap: wrap; }
#salutation-settings label { display: inline-flex; align-items: center;
  gap: 0.35rem; white-space: nowrap; }
#campaign-email-section #salutation-settings input { width: 15rem; }

/* A row of related actions presented as one coherent group (e.g. the
   replies page's Refresh + Tutorial - Benjamin asked for a button group
   on its own line instead of scattered controls). */
.button-row {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  margin: 0.5rem 0 1rem;
}
.button-row form { margin: 0; display: inline; }

/* Pager links styled as a grouped pair of buttons so "which way is which"
   reads at a glance (labels are per-page, e.g. Newer/Older replies). */
.pager { display: flex; gap: 0.5rem; margin: 0.75rem 0; flex-wrap: wrap;
  align-items: center; }
/* "Page X of Y — N contacts" between the client-side pager's buttons */
.pager-info { color: var(--ink-soft); font-size: 0.9rem; padding: 0 0.3rem; }
.pager[hidden] { display: none; }
.pager a {
  display: inline-block; padding: 0.42rem 0.9rem; text-decoration: none;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); color: var(--ink);
}
.pager a:hover { border-color: var(--ink-soft); background: var(--paper-warm); }

/* Narrow windows */
@media (max-width: 640px) {
  table { display: block; overflow-x: auto; }
  .site-header-inner { justify-content: center; }
}

/* Tutorial overlay: a spotlight ring around the current step's target
   (box-shadow dims everything else) plus a floating explanation panel.
   The transparent backdrop blocks every click on the page below (the
   spotlighted element included - it's a demonstration, not a control);
   only the panel, stacked above it, stays clickable. */
.tutorial-backdrop { position: fixed; inset: 0; z-index: 9997; pointer-events: auto; }
.tutorial-spotlight {
  position: fixed; z-index: 9998; border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(31, 27, 22, 0.65);
  outline: 3px solid var(--pai-orange); outline-offset: 2px;
  pointer-events: none; transition: top 150ms ease, left 150ms ease,
    width 150ms ease, height 150ms ease;
}
.tutorial-panel {
  position: fixed; z-index: 9999; width: min(24rem, 92vw);
  /* Benjamin (twice): the tutorial text was too small - the panel runs a
     step above the page's base size, with air between the lines. */
  font-size: 1.1rem; line-height: 1.5;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem 1.1rem;
  box-shadow: 0 8px 24px rgba(31, 27, 22, 0.3);
}
.tutorial-panel h3 { margin: 0 0.4rem 0.5rem 0; font-size: 1.2rem; }
.tutorial-panel p { margin: 0 0 0.75rem; }
.tutorial-step-count { font-size: 0.85rem; color: var(--ink-soft); margin-right: auto; }
.tutorial-controls { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.tutorial-key-hint { margin: 0.5rem 0 0; font-size: 0.8rem; color: var(--ink-soft); }
.tutorial-close {
  position: absolute; top: 0.3rem; right: 0.4rem; background: none; border: none;
  font-size: 1.15rem; line-height: 1; cursor: pointer; color: var(--ink-soft);
  padding: 0.3rem 0.5rem;
}
.tutorial-close:hover { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  /* Non-animated spinner fallback: the two-tone ring stays as a static busy
     symbol, only the rotation goes. */
  .job-status-line::before { animation: none; }
}

/* Attendee picker (wave-2 T4): Benjamin's ruling - attendee selection is a
   search field with autocomplete, sitting a bit further right than the
   plain form fields around it. */
.attendee-picker { margin-left: 2.5rem; }
.attendee-picker #attendee-search { min-width: 24rem; max-width: 100%; }
.attendee-picker .autocomplete-wrap { max-width: 100%; }
.attendee-selected { list-style: none; padding-left: 0; margin: 0.3rem 0; }
.attendee-selected li { margin: 0.2rem 0; }
.attendee-selected button { margin-left: 0.5rem; }

/* Sent answers in the reply view (batch 4 item 1): indented under the
   incoming message so the exchange reads as a thread. */
.reply-answer { margin-left: 2.5rem; }
.reply-answer pre { border-left: 4px solid var(--pai-orange); }
.reply-answer-meta {
  margin: 0.75rem 0 0.25rem; font-size: 0.85rem; font-weight: 600;
  color: var(--ink-soft);
}

/* Shared custom autocomplete (batch 4 item 2): a small dropdown anchored
   under the search field - at most the 5 best matches, never the browser
   datalist popup (whose suggestion list can cover the whole page). */
.autocomplete-wrap { position: relative; display: inline-block; vertical-align: middle; }
/* the input keeps sizing the wrap; inside the email section the wrap takes
   the section's usual field width instead (inputs there are width:100%) */
#campaign-email-section .autocomplete-wrap { width: 100%; max-width: 40rem; }
.autocomplete-list {
  position: absolute; top: 100%; left: 0; z-index: 100;
  min-width: 100%; max-width: min(30rem, 90vw);
  margin: 2px 0 0; padding: 0.25rem; list-style: none;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(31, 27, 22, 0.18);
}
.autocomplete-list li {
  padding: 0.35rem 0.6rem; border-radius: 4px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.autocomplete-list li:hover, .autocomplete-list li.active {
  background: var(--pai-orange-tint); color: var(--pai-orange-text);
}

/* A pattern-validated field mid-edit (e.g. the 24-hour meeting time):
   autosave holds off while invalid, so make the state visible.
   :user-invalid, not :invalid - an untouched empty required field must
   not open the page covered in red borders. */
input:user-invalid { border-color: #C0392B; }

/* Inline send-all confirm step (wave-2 T4): replaces the native confirm()
   dialog, which blocks the automation extension. */
#send-all-confirm-text { font-weight: 600; margin-right: 0.5rem; }

/* Campaign rename cue (plan 4e): the title has always been an autosave
   input; the pencil makes that discoverable. Clicking it focuses the
   input (it is a <label for=...>). */
.editable-title { display: flex; align-items: center; gap: 0.4rem; }
.editable-title input { flex: 1; }
.rename-cue { font-size: 1rem; color: var(--ink-soft); cursor: pointer; font-weight: 400; }
