/* =====================================================================
   Poseidon Service portal
   Styled to match poseidonmachinery.com: industrial, precise, flat, with
   lots of space. Colors come from the Poseidon site's own CSS. Inter
   (Google Fonts) stands in for the site's licensed trial font.
   ===================================================================== */

:root {
  /* Brand colors (from poseidonmachinery.com) */
  --bg: #eeedea;            /* page background */
  --text: #111111;          /* primary text */
  --ink: #111111;           /* dark surfaces: header, user chat bubbles */
  --ink-2: #1b1b1b;         /* dark surfaces: footer */
  --on-dark: #eeedea;       /* text on dark surfaces */
  --on-dark-muted: rgba(221, 221, 221, 0.6);
  --accent: #e66224;        /* primary accent: buttons, tags, active states */
  --teal: #1aa095;          /* secondary accent: success, thumbs up */
  --line: #dcd8d5;          /* borders and dividers */
  --surface: #ffffff;       /* cards */

  /* Derived, chosen for readable contrast (see notes at the end of the file) */
  --on-accent: #111111;     /* text on orange: 5.5:1 (white on orange is only 3.4:1) */
  --accent-hover: #f07a3c;
  --accent-text: #a8420f;   /* orange for LINK TEXT on light backgrounds: 5.2:1 */
  --teal-text: #0d6d65;     /* teal for text on white: 6.2:1 */
  --text-muted: #5c5a57;    /* secondary text on light: 5.9:1 */
  --field-border: #8a8782;  /* form field edges: 3:1 so inputs are visible */
  --danger: #b3261e;
  --danger-bg: #fbebea;
  --info-bg: #f7e4d9;

  --font: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 2px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-text); }
a:hover { color: var(--text); }

/* Headings: light, uppercase, wide-set, like the Poseidon site */
h1, h2, h3, .heading {
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 0;
}

/* Small orange tag, like the site's "MACHINES" label */
.tag {
  display: inline-block;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1;
  padding: 5px 8px;
  border-radius: var(--radius);
}

/* ---------- header (dark) ---------- */
.site-header {
  background: var(--ink);
  color: var(--on-dark);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand .logo { display: block; height: 34px; width: auto; }
.header-right { display: flex; align-items: center; gap: 14px; min-width: 0; }
.who {
  font-size: 13px;
  color: var(--on-dark-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}
.accent-strip { height: 3px; background: var(--accent); }

/* ---------- buttons ---------- */
button.primary,
.chat-input-row button,
.fb-submit {
  background: var(--accent);
  color: var(--on-accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 20px;
  min-height: 44px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
}
button.primary:hover,
.chat-input-row button:hover,
.fb-submit:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.primary:disabled,
.chat-input-row button:disabled,
.fb-submit:disabled { opacity: 0.55; cursor: default; }
button:focus-visible,
a:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.logout-btn {
  background: transparent;
  color: var(--on-dark);
  border: 1px solid rgba(238, 237, 234, 0.4);
  border-radius: var(--radius);
  padding: 8px 14px;
  min-height: 36px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.logout-btn:hover { border-color: var(--accent); color: var(--accent); }
.logout-btn:focus-visible { outline-color: var(--on-dark); }

/* ---------- auth pages ---------- */
.auth-main {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 64px 24px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.auth-head { padding: 32px 32px 0; }
.auth-head h1 { font-size: 22px; margin: 14px 0 8px; }
.auth-head p { margin: 0; font-size: 14px; color: var(--text-muted); }
.auth-card form { padding: 24px 32px 32px; display: grid; gap: 18px; }

.field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.field input {
  width: 100%;
  padding: 12px 14px;
  min-height: 46px;
  font-size: 16px; /* 16px stops iPhones zooming in on focus */
  font-family: var(--font);
  font-weight: 500;
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--text); }

.auth-switch {
  padding: 18px 32px 24px;
  font-size: 14px;
  color: var(--text-muted);
  border-top: 1px solid var(--line);
}

.message { font-size: 14px; padding: 12px 14px; border-radius: var(--radius); margin: 0; }
.message.error { background: var(--danger-bg); color: var(--danger); border-left: 3px solid var(--danger); }
.message.info { background: var(--info-bg); color: var(--text); border-left: 3px solid var(--accent); }

.consent {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  cursor: pointer;
}
.consent input { margin-top: 3px; flex: none; width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- chat portal ---------- */
.portal-shell { min-height: 100vh; display: flex; flex-direction: column; }

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 40px 32px;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.bubble { max-width: 100%; }
.bubble .sender {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.bubble.from-customer { align-self: flex-end; max-width: 85%; text-align: right; }
.bubble.from-customer .sender { color: var(--text-muted); }
.bubble.from-customer .content {
  display: inline-block;
  text-align: left;
  background: var(--ink);
  color: var(--on-dark);
  padding: 12px 16px;
  border-radius: var(--radius);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.bubble.from-agent .sender {
  display: inline-block;
  background: var(--accent);
  color: var(--on-accent);
  padding: 5px 8px;
  line-height: 1;
  border-radius: var(--radius);
}
.bubble.from-agent .content {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.bubble.from-agent.pending .content { color: var(--text-muted); }

.empty-state { color: var(--text-muted); text-align: center; margin-top: 8px; }
.empty-state .intro { margin: 0 auto; max-width: 560px; font-size: 18px; font-weight: 300; color: var(--text); line-height: 1.5; }

.disclaimer {
  max-width: 640px;
  margin: 32px auto 0;
  padding: 18px 20px;
  text-align: left;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
}
.disclaimer p { margin: 0 0 10px; }
.disclaimer p:last-child { margin-bottom: 0; }
.disclaimer strong { color: var(--text); font-weight: 600; }

/* input row */
.chat-input-bar { border-top: 1px solid var(--line); background: var(--surface); padding: 16px 32px; }
.chat-input-row { max-width: 800px; margin: 0 auto; display: flex; gap: 12px; align-items: stretch; }
.chat-input-row textarea {
  flex: 1;
  resize: none;
  min-height: 46px;
  font-family: var(--font);
  font-weight: 500;
  font-size: 16px;
  padding: 11px 14px;
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.chat-input-row textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--text); }

/* dark footer line */
.site-footer {
  background: var(--ink-2);
  color: var(--on-dark-muted);
  padding: 14px 32px;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}
.site-footer p { margin: 0; }
.site-footer a { color: var(--on-dark); }
.site-footer a:hover { color: var(--accent); }
.site-footer a:focus-visible { outline-color: var(--on-dark); }

/* ---------- feedback under each answer ---------- */
.feedback { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; }
.feedback-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fb-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0;
  background: var(--surface); color: var(--text-muted);
  border: 1px solid var(--field-border); border-radius: var(--radius);
  cursor: pointer;
}
.fb-btn:hover { color: var(--text); border-color: var(--text); }
.fb-btn:disabled { opacity: 0.5; cursor: default; }
.fb-up.active { background: var(--teal); border-color: var(--teal); color: #fff; }
.fb-down.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.fb-link {
  background: none; border: none; padding: 6px 2px; cursor: pointer;
  color: var(--accent-text); text-decoration: underline; font: inherit; font-size: 13px;
}
.fb-link:hover { color: var(--text); }
.fb-status { color: var(--text-muted); }
.fb-status.error { color: var(--danger); }
.fb-correction textarea {
  width: 100%; margin-top: 12px; padding: 11px 14px;
  font-family: var(--font); font-weight: 500; font-size: 16px;
  border: 1px solid var(--field-border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
}
.fb-correction textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--text); }
.fb-actions { display: flex; align-items: center; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.fb-note { color: var(--text-muted); font-size: 12px; }

/* ---------- expert: save to knowledge base ---------- */
.fb-kb-host { margin-top: 12px; }
.kb-review { background: var(--bg); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 16px; }
.kb-review-title { margin: 0 0 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.kb-field { display: block; margin-bottom: 12px; }
.kb-label { display: block; margin: 0 0 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.kb-field input, .kb-field select, .kb-field textarea {
  width: 100%; padding: 10px 12px; font-family: var(--font); font-weight: 500; font-size: 16px;
  border: 1px solid var(--field-border); border-radius: var(--radius); background: var(--surface); color: var(--text);
}
.kb-field input:focus, .kb-field select:focus, .kb-field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--text); }
.kb-none { margin: 0 0 12px; color: var(--text-muted); font-size: 13px; }
.kb-similar { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.kb-similar li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; font-size: 13px; }
.kb-meta { color: var(--text-muted); }
.kb-excerpt { margin-top: 4px; color: var(--text-muted); overflow-wrap: anywhere; }

.forgot-link { justify-self: start; font-size: 13px; }
.auth-notice:empty { display: none; }
.auth-notice { padding: 20px 32px 24px; }
form[hidden] { display: none; }

.access-note { max-width: 560px; margin: 0 auto 24px; padding: 14px 16px; text-align: left; font-size: 14px; line-height: 1.6; color: var(--text); background: var(--info-bg); border-left: 3px solid var(--accent); border-radius: var(--radius); }
.chat-input-row textarea:disabled { background: var(--bg); color: var(--text-muted); cursor: not-allowed; }

/* training-guide pictures inside answers */
.guide-fig { margin: 14px 0; padding: 0; white-space: normal; }
.guide-fig a { display: block; line-height: 0; }
.guide-fig img { display: block; max-width: 100%; max-height: 420px; width: auto; height: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.guide-fig figcaption { margin-top: 6px; font-size: 12px; line-height: 1.5; color: var(--text-muted); }

/* ---------- landing page, signup plans, checkout placeholder ---------- */
[hidden] { display: none !important; }

.site-nav { display: flex; align-items: center; gap: 18px; }
.nav-group { display: inline-flex; align-items: center; gap: 18px; }
.nav-link {
  color: var(--on-dark);
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  text-decoration: none; padding: 8px 2px; border-bottom: 2px solid transparent;
}
.nav-link:hover { color: var(--accent); border-bottom-color: var(--accent); }
.nav-link:focus-visible, .nav-cta:focus-visible { outline: 2px solid var(--on-dark); outline-offset: 3px; }
.nav-cta {
  background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent); border-radius: var(--radius);
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  text-decoration: none; padding: 10px 16px;
}
.nav-cta:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }

.fineprint { font-size: 13px; line-height: 1.6; color: var(--text-muted); }

.card-title { font-size: 22px; margin: 14px 0 8px; }
.card-actions { padding: 8px 32px 28px; display: grid; }
.primary-link {
  display: block; text-align: center; text-decoration: none;
  background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 13px 20px; min-height: 44px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
}
.primary-link:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.link-btn { background: none; border: none; padding: 0; font: inherit; color: var(--accent-text); text-decoration: underline; cursor: pointer; }
.link-btn:hover { color: var(--text); }
.auth-card.wide { max-width: 560px; }
.auth-head p { margin-top: 6px; }

.plans { border: none; margin: 0; padding: 0; min-width: 0; }
.plans legend { padding: 0; margin-bottom: 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: stretch; }
.plan { position: relative; display: flex; cursor: pointer; } /* flex so both boxes in a row are the same height */
.plan input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.plan-body { display: grid; flex: 1; width: 100%; gap: 4px; padding: 16px; border: 1px solid var(--field-border); border-radius: var(--radius); background: var(--surface); min-height: 112px; align-content: start; }
.plan input:checked + .plan-body { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.plan input:focus-visible + .plan-body { outline: 2px solid var(--text); outline-offset: 2px; }
.plan-name { font-weight: 600; font-size: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.plan-badge { background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; padding: 3px 6px; border-radius: var(--radius); }
.plan-price { font-size: 26px; font-weight: 300; letter-spacing: 0.02em; }
.plan-price small { font-size: 13px; font-weight: 500; color: var(--text-muted); letter-spacing: 0; }
.plan-note { font-size: 13px; color: var(--text-muted); }
.plan-includes { margin: 12px 0 0; font-size: 14px; color: var(--text-muted); }

@media (max-width: 600px) {
  .nav-group { gap: 12px; }
  .site-nav { gap: 10px; }
  .nav-link, .nav-cta { white-space: nowrap; font-size: 11px; letter-spacing: 0.06em; }
  .nav-cta { padding: 9px 11px; }
  .logout-btn { white-space: nowrap; }
  .plan-grid { grid-template-columns: 1fr; }
  .plan-body { min-height: 0; }
  .card-actions { padding: 8px 20px 24px; }
}

/* ---------- send to a technician ---------- */
.handoff { margin-top: 12px; }
.handoff-prompt { padding: 14px 16px; background: var(--bg); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); }
.handoff-text { margin: 0 0 10px; font-size: 14px; line-height: 1.5; }
.handoff-btn {
  background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 10px 16px; min-height: 44px; font-family: var(--font); font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em; cursor: pointer;
}
.handoff-btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.handoff-btn:disabled { opacity: 0.55; cursor: default; }
.handoff-host:not(:empty) { margin-top: 10px; }
/* Inside the prompt box the form is not a second card: no extra border, background or padding. */
.handoff-prompt .kb-review { border: none; background: transparent; padding: 0; }
.handoff-prompt.handoff-open .handoff-text { display: none; }
.handoff-prompt.handoff-open .handoff-host:not(:empty) { margin-top: 0; }
/* After sending: one box, with the confirmation as plain text and a green edge. */
.handoff-prompt .handoff-done { background: transparent; border: none; padding: 0; }
.handoff-prompt.handoff-sent { border-left-color: var(--teal); }
.handoff-done { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--teal); border-radius: var(--radius); padding: 12px 14px; }

/* ---------- small screens ---------- */
@media (max-width: 600px) {
  body { font-size: 15px; }
  .site-header { padding: 12px 16px; }
  .brand .logo { height: 26px; }
  .who { display: none; }
  .auth-main { padding: 28px 16px; min-height: calc(100vh - 68px); }
  .auth-head { padding: 24px 20px 0; }
  .auth-card form { padding: 20px 20px 24px; }
  .auth-switch { padding: 16px 20px 20px; }
  .auth-notice { padding: 16px 20px 20px; }
  .chat-log { padding: 24px 16px; gap: 20px; }
  .bubble.from-customer { max-width: 94%; }
  .empty-state .intro { font-size: 16px; }
  .disclaimer { padding: 14px 16px; margin-top: 24px; }
  .chat-input-bar { padding: 12px 16px; }
  .chat-input-row { gap: 8px; }
  .chat-input-row button { padding: 12px 14px; }
  .chat-input-row .attach-btn { padding: 0; }
  .site-footer { padding: 12px 16px; }
}

/* ---------------------------------------------------------------------
   Contrast notes (WCAG ratios, checked when this was written)
   #111 text on orange #e66224 ........ 5.5:1  (used for every orange button/tag)
   white on orange ..................... 3.4:1  (too low for small text, not used)
   orange #e66224 on #eeedea ........... 2.9:1  (too low for text, so links use #a8420f)
   link #a8420f on #eeedea / white ..... 5.2:1 / 6.1:1
   #eeedea on #111 / #1b1b1b ........... 16.1:1 / 14.7:1
   muted text #5c5a57 on #eeedea ....... 5.9:1
   muted text on dark rgba(221,221,221,.6): 5.3:1 on #1b1b1b
   --------------------------------------------------------------------- */

@media (max-width: 360px) {
  .site-header { flex-wrap: wrap; row-gap: 10px; }
}

/* ---------- header menu, dashboard ---------- */
.header-right .site-nav { gap: 20px; margin-right: 6px; }
.nav-link[aria-current="page"] { border-bottom-color: var(--accent); }
.card-second { display: block; text-align: center; margin-top: 14px; font-size: 14px; }

.dash { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 40px 32px 56px; }
.dash-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 36px; }
.dash-title { margin-top: 12px; font-size: 28px; }
.dash-new { display: inline-block; width: auto; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.dash-h2 { font-size: 16px; }
.dash-sub { margin: 6px 0 16px; font-size: 14px; color: var(--text-muted); }
.dash-list { display: flex; flex-direction: column; gap: 10px; }
.dash-empty { margin: 0; padding: 16px; font-size: 14px; color: var(--text-muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.dash-empty.error, .dash-meta.error { color: var(--danger); }
.dash-card { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none; }
.dash-link:hover { border-color: var(--accent); color: var(--text); }
.dash-card-title { font-size: 15px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.dash-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--text-muted); }
.dash-ticket-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dash-actions { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 2px; }
.dash-replies { margin-top: 6px; display: flex; flex-direction: column; gap: 8px; }
.reply { padding: 10px 12px; background: var(--bg); border-left: 3px solid var(--accent); border-radius: var(--radius); }
.reply-you { border-left-color: var(--line); }
.reply-from { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.reply-body { margin: 4px 0 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.pill { display: inline-block; flex: none; padding: 3px 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; line-height: 1.3; border-radius: var(--radius); background: var(--bg); color: var(--text); border: 1px solid var(--line); }
.pill-ticket { background: var(--info-bg); border-color: var(--info-bg); }
.pill-new, .pill-open { background: var(--info-bg); border-color: var(--info-bg); }
.pill-pending { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.pill-solved, .pill-closed { background: #d9eeec; border-color: #d9eeec; color: var(--teal-text); }

@media (max-width: 900px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
}
@media (max-width: 600px) {
  .dash { padding: 24px 16px 40px; }
  .dash-title { font-size: 22px; }
  .dash-new { width: 100%; }
  .header-right { gap: 10px; }
  .header-right .site-nav { gap: 12px; margin-right: 0; }
}

.reply-form { margin-top: 4px; display: flex; flex-direction: column; gap: 8px; }
.reply-form textarea { width: 100%; margin-top: 6px; padding: 10px 12px; font-family: var(--font); font-size: 16px; font-weight: 500; border: 1px solid var(--field-border); border-radius: var(--radius); background: var(--surface); color: var(--text); resize: vertical; }
.reply-form textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--text); }
.reply-form .kb-label { display: block; }

.dash-search { margin-bottom: 28px; max-width: 560px; }
.dash-search input { width: 100%; min-height: 44px; padding: 10px 14px; font-family: var(--font); font-size: 16px; font-weight: 500; border: 1px solid var(--field-border); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.dash-search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--text); }
.dash-search .dash-meta { margin: 8px 0 0; }
.dash-snippet { font-size: 13px; color: var(--text-muted); overflow-wrap: anywhere; }
.dash-toggle { align-self: flex-start; padding: 6px 2px; }

.kb-saved { margin-top: 8px; font-size: 13px; }
.kb-saved summary { cursor: pointer; color: var(--accent-text); }
.kb-saved p { margin: 6px 0 0; }
.kb-saved-title { font-weight: 600; }
.kb-saved-body { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }

/* ---------- experts: correct the last answer from the chat box ---------- */
.correct-bar { max-width: 800px; margin: 0 auto 10px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.correct-toggle { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.correct-toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.correct-hint { color: var(--text-muted); }
.correct-on { padding: 8px 12px; background: var(--info-bg); border-left: 3px solid var(--accent); border-radius: var(--radius); }
.correct-on .correct-hint { color: var(--text); }

/* ---------- subscription card on the dashboard ---------- */
.billing-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--teal); border-radius: var(--radius); }
.billing-line { margin: 6px 0 0; font-size: 14px; }
.billing-warn { color: var(--danger); font-weight: 600; }
.billing-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.billing-actions .primary-link { width: auto; display: inline-block; }
@media (max-width: 600px) { .billing-actions, .billing-actions > * { width: 100%; } }

/* Subscribe form: the form already has side padding, so its button and note must not add more. */
#panel-pay .card-actions { padding: 8px 0 4px; }
#panel-pay .auth-switch { padding: 16px 0 4px; margin-top: 12px; }

/* ---------- photos in the chat ---------- */
.chat-input-row .attach-btn {
  flex: none; width: 46px; min-height: 46px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--text); border: 1px solid var(--field-border); border-radius: var(--radius); cursor: pointer;
  text-transform: none; letter-spacing: 0;
}
.chat-input-row .attach-btn svg { display: block; width: 22px; height: 22px; }
.chat-input-row .attach-btn:hover:not(:disabled) { background: var(--surface); border-color: var(--accent); color: var(--accent-text); }
.chat-input-row .attach-btn:disabled { opacity: 0.45; cursor: default; }
.chat-input-row .attach-btn.has-photos { border-color: var(--accent); background: var(--info-bg); }
.attach-previews { max-width: 800px; margin: 0 auto 10px; display: flex; gap: 10px; flex-wrap: wrap; }
.attach-thumb { position: relative; width: 72px; height: 72px; }
.attach-thumb img { width: 100%; height: 100%; object-fit: cover; border: 1px solid var(--line); border-radius: var(--radius); display: block; }
.attach-remove {
  position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; padding: 0; line-height: 1; font-size: 16px;
  background: var(--ink); color: var(--on-dark); border: 2px solid var(--surface); border-radius: 50%; cursor: pointer;
}
.attach-note { max-width: 800px; margin: 0 auto 8px; font-size: 13px; color: var(--danger); }
.chat-photos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.photos-only .chat-photos { margin-top: 0; }
.chat-photos a { display: block; line-height: 0; }
.chat-photos img { max-width: 180px; max-height: 140px; width: auto; height: auto; border-radius: var(--radius); border: 1px solid rgba(238, 237, 234, 0.35); display: block; }

/* ---------- manage account, team, invitations ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.account { max-width: 760px; }
.acct-section { margin-bottom: 36px; }
.acct-h3 { margin: 22px 0 10px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.seat-line { margin: 0 0 4px; font-size: 14px; }
.team-row { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.team-row-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.invite-form { margin-top: 22px; }
.invite-row { display: flex; gap: 10px; flex-wrap: wrap; }
.invite-row input { flex: 1 1 240px; min-width: 0; min-height: 44px; padding: 10px 14px; font-family: var(--font); font-size: 16px; font-weight: 500; border: 1px solid var(--field-border); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.invite-row input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--text); }
.invite-result { margin-top: 16px; padding: 14px 16px; background: var(--info-bg); border-left: 3px solid var(--accent); border-radius: var(--radius); }
.invite-result .dash-meta { margin: 8px 0 0; }
.seat-actions { margin: 18px 0; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.acct-note { margin: 18px 0; padding: 12px 14px; font-size: 14px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--teal); border-radius: var(--radius); }
.team-link { display: inline-block; width: auto; }
.team-banner { margin: 0 0 20px; padding: 12px 14px; font-size: 14px; background: var(--info-bg); border-left: 3px solid var(--accent); border-radius: var(--radius); }
.dark-btn { color: var(--text); border-color: var(--field-border); }
.dark-btn:hover { color: var(--accent-text); border-color: var(--accent); }
.dash-meta.error, .dash-meta[role="status"].error { color: var(--danger); }
#member-filter { min-height: 44px; padding: 8px 12px; font-family: var(--font); font-size: 16px; font-weight: 500; border: 1px solid var(--field-border); border-radius: var(--radius); background: var(--surface); color: var(--text); max-width: 100%; }
.join-terms { padding: 4px 32px 0; font-size: 14px; }
.join-terms ul { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 6px; }
.join-actions { display: flex; gap: 18px; align-items: center; }
.join-msg { margin: 0 32px 20px; font-size: 14px; color: var(--danger); }
.team-readonly { max-width: 800px; margin: 0 auto; }
@media (max-width: 600px) {
  .join-terms { padding: 4px 20px 0; }
  .join-msg { margin: 0 20px 20px; }
  .team-row { align-items: flex-start; }
}

/* ---------- version log ---------- */
.versions { max-width: 760px; }
.version-card { margin-top: 28px; padding: 20px 22px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); }
.version-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 18px; letter-spacing: 0.04em; text-transform: none; }
.version-num { font-weight: 600; color: var(--accent-text); }
.version-title { font-weight: 500; }
.version-items { margin: 4px 0 0; padding-left: 20px; display: grid; gap: 8px; font-size: 15px; }
.site-footer a#version-link { white-space: nowrap; }

/* =====================================================================
   Landing page (mobile first). Dark band with the pitch and the log in card, then short sections.
   ===================================================================== */
.lp-top { background: var(--ink); color: var(--on-dark); padding: 22px 16px 28px; }
.lp-top-inner { max-width: 1100px; margin: 0 auto; display: grid; gap: 20px; }
.lp-hero .tag { margin-bottom: 14px; }
.lp-title { color: var(--on-dark); font-size: clamp(25px, 7vw, 52px); line-height: 1.15; letter-spacing: 0.06em; margin: 0 0 10px; }
.lp-sub { margin: 0; font-size: clamp(16px, 4.4vw, 22px); font-weight: 300; line-height: 1.45; color: rgba(238, 237, 234, 0.82); max-width: 40ch; }
.lp-login .auth-card { max-width: none; margin: 0; color: var(--text); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); }
.lp-login .card-title { color: var(--text); margin: 0; }
.lp-login .auth-head { padding-bottom: 4px; }
.lp-new { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 20px; border-top: 1px solid var(--line); font-size: 14px; color: var(--text-muted); }
.lp-create {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 18px; text-decoration: none;
  color: var(--text); border: 1px solid var(--text); border-radius: var(--radius);
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
}
.lp-create:hover { background: var(--text); color: var(--on-dark); }

.lp-section { max-width: 1100px; margin: 0 auto; padding: 36px 16px; }
.lp-alt { max-width: none; background: var(--surface); border-block: 1px solid var(--line); }
/* A full-width band whose content lines up with the 1100px column of the other sections, however wide the screen. */
.lp-alt { padding-left: max(16px, calc((100% - 1100px) / 2 + 16px)); padding-right: max(16px, calc((100% - 1100px) / 2 + 16px)); }
.lp-h2 { font-size: 13px; color: var(--text-muted); margin: 0 0 18px; }

.lp-icon { display: inline-flex; width: 48px; height: 48px; align-items: center; justify-content: center; color: var(--accent-text); background: var(--info-bg); border-radius: var(--radius); flex: none; }
.lp-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lp-tiles li { display: grid; gap: 6px; align-content: start; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.lp-tiles .lp-icon { margin-bottom: 6px; }
.lp-tiles strong { font-weight: 600; font-size: 15px; line-height: 1.3; }
.lp-tiles li > span:last-child { font-size: 13px; line-height: 1.4; color: var(--text-muted); }

.lp-cards { display: grid; gap: 16px; }
.lp-card { padding: 24px 22px; background: var(--bg); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: var(--radius); display: grid; gap: 10px; align-content: start; }
.lp-card .lp-icon { width: 52px; height: 52px; margin-bottom: 4px; }
.lp-card h3 { font-size: 18px; line-height: 1.3; letter-spacing: 0.04em; text-transform: none; font-weight: 500; margin: 0; }
.lp-card p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--text-muted); max-width: 46ch; }

.lp-price { max-width: 1100px; margin: 8px 16px 0; padding: 26px 20px; text-align: center; background: var(--ink); color: var(--on-dark); border-radius: var(--radius); border-bottom: 3px solid var(--accent); }
.lp-price-title { color: var(--on-dark); font-size: 26px; line-height: 1.2; margin: 0 0 6px; letter-spacing: 0.06em; }
.lp-price-title span { display: block; margin-top: 4px; font-size: 16px; color: rgba(238, 237, 234, 0.8); letter-spacing: 0.04em; }
.lp-price-sub { margin: 0 0 18px; font-size: 14px; color: rgba(238, 237, 234, 0.8); }
.lp-price-cta { display: inline-block; width: auto; padding-left: 28px; padding-right: 28px; }
.lp-fine { max-width: 1100px; margin: 24px auto 40px; padding: 0 16px; font-size: 13px; line-height: 1.6; color: var(--text-muted); text-align: center; }

@media (min-width: 700px) {
  .lp-top { padding: 48px 32px 56px; }
  .lp-tiles { grid-template-columns: repeat(4, 1fr); }
  .lp-cards { grid-template-columns: 1fr 1fr; gap: 24px; }
  .lp-card { padding: 32px 30px; }
  .lp-card h3 { font-size: 20px; }
  .lp-section { padding: 56px 32px; }
  .lp-alt { padding-left: max(32px, calc((100% - 1100px) / 2 + 32px)); padding-right: max(32px, calc((100% - 1100px) / 2 + 32px)); }
  .lp-price { margin: 16px auto 0; width: min(1036px, calc(100% - 64px)); padding: 36px 24px; } /* lines up with the sections above */
  .lp-price-title span { display: inline; margin: 0 0 0 10px; }
}
@media (min-width: 960px) {
  .lp-top { padding: 72px 32px 80px; }
  .lp-top-inner { grid-template-columns: minmax(0, 1fr) 420px; gap: 72px; align-items: center; }
}

/* ---------- Manage software (staff) ---------- */
.admin { max-width: 1100px; }
.admin-guide, .admin-log { margin: 0 0 26px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--teal); border-radius: var(--radius); }
.admin-guide summary, .admin-log summary { cursor: pointer; font-weight: 600; font-size: 15px; }
.admin-tabs { display: flex; gap: 4px; margin: 0 0 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.admin-tab { appearance: none; background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px; padding: 12px 16px; min-height: 44px; font-family: var(--font); font-size: 15px; font-weight: 500; color: inherit; cursor: pointer; white-space: nowrap; }
.admin-tab[aria-selected="true"] { border-bottom-color: var(--accent); font-weight: 600; }
.admin-sub { margin-top: 28px; }
.admin-guide-title { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.admin-qa { border-top: 1px solid var(--line); padding: 10px 0; }
.admin-qa:first-of-type { border-top: 0; }
.admin-qa summary { cursor: pointer; font-weight: 500; font-size: 15px; min-height: 28px; }
.admin-qa p { margin: 8px 0 2px; font-size: 14px; line-height: 1.55; color: var(--text-muted); }
.admin-guide ol { margin: 12px 0 8px; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; line-height: 1.55; }
.admin-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 24px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.stat-n { font-size: 28px; font-weight: 300; line-height: 1.1; }
.stat-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.admin-tools { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 8px; }
.admin-tools input, .admin-tools select { width: 100%; min-height: 44px; padding: 8px 12px; font-family: var(--font); font-size: 16px; font-weight: 500; border: 1px solid var(--field-border); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.admin-list { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.admin-card { display: grid; grid-template-columns: 1fr; gap: 12px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.admin-card.is-paused { border-left: 3px solid var(--danger); }
.admin-who { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.admin-who .dash-card-title { overflow-wrap: anywhere; }
.admin-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.admin-field .kb-label { margin: 0; }
.admin-field select { width: 100%; min-height: 40px; padding: 6px 10px; font-family: var(--font); font-size: 14px; font-weight: 500; border: 1px solid var(--field-border); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.admin-val { font-size: 14px; white-space: pre-line; overflow-wrap: anywhere; }
.admin-actions { display: flex; align-items: center; }
.admin-pause { color: var(--danger); }
@media (min-width: 700px) {
  .admin-summary { grid-template-columns: repeat(4, 1fr); }
  .admin-tools { grid-template-columns: 2fr 1fr; }
}
@media (min-width: 1000px) {
  .admin-card { grid-template-columns: minmax(0, 2fr) minmax(190px, 1.3fr) minmax(0, 1.1fr) minmax(0, 1.1fr) minmax(0, 1.4fr) auto; align-items: start; gap: 16px; }
}

.join-form { padding: 0 32px 8px; }
.join-sub { margin: 0 0 14px; font-size: 14px; color: var(--text-muted); }
@media (max-width: 600px) { .join-form { padding: 0 20px 8px; } }
