/* reoXapp — shared brand + component styles */

:root {
  --navy: #1e3a5c;
  --navy-ink: #16293f;
  --red: #9c2b3a;
  --red-deep: #7c2029;
  --gold: #e0a539;
  --gold-soft: #f6d99b;
  --gray: #6b7280;

  --bg: #f5f4f1;
  --bg-elevated: #ffffff;
  --bg-sunken: #ebe9e5;
  --text: #1c2126;
  --text-secondary: #5c626b;
  --text-tertiary: #8a8f96;
  --border: #e1ded7;
  --border-strong: #cbc7bd;

  --accent: var(--gold);
  --accent-hover: #c78f2c;
  --accent-contrast: #221703;

  --ok: #2f7d5b;
  --ok-bg: #e6f3ec;
  --warn: var(--red);
  --warn-bg: #f5e3e3;

  --shadow-card: 0 1px 2px rgba(30, 25, 15, 0.05), 0 10px 28px -14px rgba(30, 25, 15, 0.16);
  --shadow-pop: 0 20px 48px -16px rgba(20, 20, 22, 0.28);
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --bg-elevated: #1c1f24;
    --bg-sunken: #20242a;
    --text: #f1f0ec;
    --text-secondary: #a3a8b0;
    --text-tertiary: #6f747c;
    --border: #2c3038;
    --border-strong: #3a3f48;
    --navy: #6f97c4;
    --navy-ink: #dbe6f2;
    --gold: #eab654;
    --gold-soft: #f6d99b;
    --red: #d8626f;
    --accent: var(--gold);
    --accent-hover: #f4c877;
    --accent-contrast: #241a06;
    --ok: #5fc294;
    --ok-bg: #133024;
    --warn: #d8626f;
    --warn-bg: #34191c;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 28px -14px rgba(0, 0, 0, 0.6);
    --shadow-pop: 0 20px 48px -16px rgba(0, 0, 0, 0.65);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14161a; --bg-elevated: #1c1f24; --bg-sunken: #20242a;
  --text: #f1f0ec; --text-secondary: #a3a8b0; --text-tertiary: #6f747c;
  --border: #2c3038; --border-strong: #3a3f48;
  --navy: #6f97c4; --navy-ink: #dbe6f2; --gold: #eab654; --gold-soft: #f6d99b; --red: #d8626f;
  --accent: var(--gold); --accent-hover: #f4c877; --accent-contrast: #241a06;
  --ok: #5fc294; --ok-bg: #133024; --warn: #d8626f; --warn-bg: #34191c;
  --shadow-card: 0 1px 2px rgba(0,0,0,.35), 0 10px 28px -14px rgba(0,0,0,.6);
  --shadow-pop: 0 20px 48px -16px rgba(0,0,0,.65);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f5f4f1; --bg-elevated: #ffffff; --bg-sunken: #ebe9e5;
  --text: #1c2126; --text-secondary: #5c626b; --text-tertiary: #8a8f96;
  --border: #e1ded7; --border-strong: #cbc7bd;
  --navy: #1e3a5c; --navy-ink: #16293f; --gold: #e0a539; --gold-soft: #f6d99b; --red: #9c2b3a;
  --accent: var(--gold); --accent-hover: #c78f2c; --accent-contrast: #221703;
  --ok: #2f7d5b; --ok-bg: #e6f3ec; --warn: var(--red); --warn-bg: #f5e3e3;
  --shadow-card: 0 1px 2px rgba(30,25,15,.05), 0 10px 28px -14px rgba(30,25,15,.16);
  --shadow-pop: 0 20px 48px -16px rgba(20,20,22,.28);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { text-wrap: balance; margin: 0; }
p { margin: 0; }
button, input { font-family: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

/* ---------- Buttons ---------- */
.btn {
  appearance: none; border: none; cursor: pointer;
  border-radius: 999px;
  font-size: 14.5px; font-weight: 600;
  padding: 12px 22px;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background-color .16s ease, color .16s ease, opacity .16s ease, transform .1s ease, border-color .16s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { background: var(--border-strong); color: var(--text-tertiary); cursor: not-allowed; }
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--border-strong); }
.btn-secondary:hover { border-color: var(--text-secondary); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover:not(:disabled) { background: var(--navy-ink); }
.btn-navy:disabled { background: var(--border-strong); color: var(--text-tertiary); cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.field input, .field select {
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 15px;
}
.field input:focus, .field select:focus { border-color: var(--gold); }

.error-text { color: var(--warn); font-size: 13.5px; }

.flag-item { padding: 10px 0; border-top: 1px solid var(--border); }
.flag-item:first-child { border-top: none; padding-top: 0; }
.flag-text { font-weight: 600; font-size: 13.5px; margin-bottom: 7px; }
.flag-answered-tag { font-weight: 600; color: var(--accent); font-size: 12px; margin-left: 6px; }
.flag-options { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 7px; }
.flag-option-btn {
  appearance: none; cursor: pointer; font-size: 12.5px; font-weight: 600;
  padding: 5px 12px; border-radius: 999px;
  background: var(--bg-elevated); color: var(--text); border: 1px solid var(--border-strong);
  transition: background-color .14s ease, color .14s ease, border-color .14s ease;
}
.flag-option-btn:hover { border-color: var(--text-secondary); }
.flag-option-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.flag-answer-input {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text);
  border-radius: var(--radius-sm); padding: 8px 11px; font-size: 13.5px; font-family: inherit;
}
.flag-answer-input:focus { border-color: var(--gold); }

/* ---------- Beta banner ---------- */
.beta-banner {
  background: var(--navy);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  padding: 8px 16px;
  letter-spacing: 0.01em;
}
.beta-banner strong { color: var(--gold); }

/* ---------- Support widget ("Message us / Need help?") ---------- */
.support-widget-btn {
  position: fixed; right: 20px; bottom: 20px; z-index: 999;
  background: var(--navy); color: #fff; border: none; border-radius: 999px;
  padding: 13px 20px; font-size: 13.5px; font-weight: 700; cursor: pointer;
  box-shadow: var(--shadow-pop);
  transition: background-color .16s ease, transform .1s ease;
}
.support-widget-btn:hover { background: var(--navy-ink); }
.support-widget-btn:active { transform: scale(0.98); }
.support-widget-panel {
  position: fixed; right: 20px; bottom: 82px; z-index: 999;
  width: 320px; max-width: calc(100vw - 40px);
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop); padding: 20px; display: none;
}
.support-widget-panel.is-open { display: block; }
.support-widget-panel h3 { font-size: 15px; margin: 0 0 4px; color: var(--text); }
.support-widget-panel p { font-size: 12.5px; color: var(--text-secondary); margin: 0 0 12px; line-height: 1.5; }
.support-widget-panel textarea,
.support-widget-panel input {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text);
  border-radius: var(--radius-sm); padding: 9px 11px; font-size: 13.5px; font-family: inherit;
  margin-bottom: 10px;
}
.support-widget-panel textarea { min-height: 90px; resize: vertical; }
.support-widget-panel textarea:focus,
.support-widget-panel input:focus { border-color: var(--gold); }
.support-widget-close {
  position: absolute; top: 10px; right: 12px; background: none; border: none;
  color: var(--text-tertiary); cursor: pointer; font-size: 20px; line-height: 1; padding: 4px;
}
.support-widget-close:hover { color: var(--text); }
.support-widget-status { font-size: 12.5px; margin-top: 8px; min-height: 16px; }
.support-widget-status.ok { color: var(--ok); }
.support-widget-status.err { color: var(--warn); }

/* ---------- Messages (staff) ---------- */
.message-card {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px 24px; box-shadow: var(--shadow-card); margin-bottom: 16px;
}
.message-card.is-new { border-color: var(--gold); }
.message-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.message-card-who { font-size: 13.5px; font-weight: 700; color: var(--text); }
.message-card-meta { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }
.message-card-body { font-size: 14px; line-height: 1.55; color: var(--text); white-space: pre-wrap; margin-bottom: 12px; }
.message-status-pill { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 3px 9px; border-radius: 999px; }
.message-status-pill.new { background: var(--gold-soft); color: var(--accent-contrast); }
.message-status-pill.read { background: var(--bg-sunken); color: var(--text-tertiary); }
