/*
 * Ronell Franklin (RF) client portal prototype — styles.
 *
 * BRAND COLORS: the brand-* values below were SAMPLED from Ronell's own artwork
 * (RF badge + NYC skyline banner) and then adjusted for readable contrast. They are
 * working values for this prototype, NOT official brand hex codes. See README "Brand".
 *   deep navy/black   sampled ~#000A16 (banner), ~#000105 (badge)
 *   mid navy          sampled ~#07254A / ~#01234F
 *   electric blue     sampled ~#1073D8 (banner), ~#016CEF (badge)
 *   silver lettering  sampled ~#EEEEF0 / ~#F9FAFC
 *   warm city lights  sampled ~#F79D4A / ~#F5973E  (used only for "Needs attention")
 * The green used for "Handled" is a functional status color, not a brand color.
 */
:root {
  --brand-black: #000a16;
  --brand-navy: #07254a;
  --brand-blue: #1073d8;
  --brand-blue-bright: #3d9bff;
  --brand-silver: #eeeef0;
  --brand-warm: #f79d4a;

  --bg: #f2f4f8;
  --surface: #ffffff;
  --surface-sunk: #e9edf4;
  --text: #0b1728;
  --text-muted: #4a5a70;
  --border: #d3dae6;
  --border-strong: #9aa8bd;
  --accent: #0e69c9;          /* buttons, on white: 5.4:1 */
  --accent-hover: #0a56a8;
  --accent-text: #0a56a8;     /* links and small accent text */
  --accent-tint: #e6f0fc;
  --on-accent: #ffffff;
  --focus: #0e69c9;

  --attention-bg: #fdeeda;
  --attention-text: #7a3d05;
  --attention-mark: #e0801f;
  --handled-bg: #e2f1e9;
  --handled-text: #1a5a3c;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0, 10, 22, 0.06), 0 4px 14px rgba(0, 10, 22, 0.06);
  --font: "Avenir Next", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --page-max: 1120px;
  --gutter: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #020b17;
    --surface: #0a1829;
    --surface-sunk: #06111f;
    --text: #eef1f6;
    --text-muted: #a9b6c9;
    --border: #1d3150;
    --border-strong: #3b557c;
    --accent: #1073d8;
    --accent-hover: #2b87ea;
    --accent-text: #7bb8ff;
    --accent-tint: #0d2748;
    --focus: #7bb8ff;
    --attention-bg: #3a2509;
    --attention-text: #ffc98f;
    --attention-mark: #f79d4a;
    --handled-bg: #0f2e22;
    --handled-text: #93dab6;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 18px rgba(0, 0, 0, 0.35);
  }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: var(--accent-text); }
img { max-width: 100%; height: auto; display: block; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}
main:focus, h1:focus, h2:focus { outline: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-weight: 600;
}
.skip-link:focus { top: 8px; }

.icon { width: 1.1em; height: 1.1em; flex: none; }
.muted { color: var(--text-muted); }

/* ---- Demo strip + header (brand area, always dark like the RF artwork) --------------- */
.demo-strip {
  margin: 0;
  padding: 6px var(--gutter);
  background: var(--attention-bg);
  color: var(--attention-text);
  font-size: 0.8125rem;
  text-align: center;
}

.site-header {
  background: linear-gradient(180deg, var(--brand-black) 0%, #031226 100%);
  color: var(--brand-silver);
  border-bottom: 2px solid var(--brand-blue);
  box-shadow: 0 1px 12px rgba(16, 115, 216, 0.35);
}
.site-header-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 10px var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: inherit;
  text-decoration: none;
  min-height: 48px;
}
.brand-mark {
  height: 60px; width: auto; flex: none; margin: -4px 0 -4px -14px;
  /* Soften the crop edges so the logo's own dark backdrop melts into the header. */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 11%, #000 89%, transparent), linear-gradient(180deg, transparent, #000 8%, #000 93%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, transparent, #000 11%, #000 89%, transparent), linear-gradient(180deg, transparent, #000 8%, #000 93%, transparent 100%);
  mask-composite: intersect;
}
.brand-text { display: flex; flex-direction: column; gap: 2px; text-transform: uppercase; }
.brand-name { font-size: 1rem; font-weight: 600; letter-spacing: 0.2em; line-height: 1.2; color: #f4f6fa; }
.brand-tag { font-size: 0.625rem; font-weight: 500; letter-spacing: 0.22em; color: #c9d3e2; white-space: nowrap; }
.brand-tag i { font-style: normal; color: var(--brand-blue-bright); padding: 0 0.3em; }

.role-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid #23406a;
  border-radius: 999px;
  background: rgba(7, 37, 74, 0.55);
}
.role-switch-label { padding: 0 8px 0 10px; font-size: 0.8125rem; color: #c9d3e2; }
.role-switch a {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; min-width: 76px; padding: 4px 16px;
  border-radius: 999px;
  color: #e6ebf3; font-size: 0.9375rem; font-weight: 600; text-decoration: none;
}
.role-switch a:hover { background: rgba(61, 155, 255, 0.18); }
.role-switch a[aria-current="true"] { background: var(--brand-blue); color: #fff; }
.site-header :focus-visible, .preview-bar :focus-visible { outline-color: #9cc9ff; }

/* ---- Page scaffolding ---------------------------------------------------------------- */
main { flex: 1; }
.page { max-width: var(--page-max); margin: 0 auto; padding: 24px var(--gutter) 40px; }

.eyebrow {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted);
}
.page-head { margin-bottom: 18px; }
.page-head h1, .welcome-intro h1 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2rem); line-height: 1.2; margin: 4px 0 6px; text-wrap: balance; }
.lede { color: var(--text-muted); max-width: 62ch; }
.lede strong, .lede-count { color: var(--text); }
.lede-count { font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 9px 18px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--accent-text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--accent-tint); border-color: var(--accent-text); }
.btn-quiet { background: transparent; color: var(--text-muted); border-color: var(--border-strong); min-height: 40px; font-weight: 500; font-size: 0.875rem; }
.btn-quiet:hover { color: var(--text); background: var(--surface-sunk); }
.btn-on-dark { background: #fff; color: #06213f; }
.btn-on-dark:hover { background: #dbe9fb; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 7px; border-radius: 999px;
  font-size: 0.8125rem; font-weight: 600; line-height: 1.4; white-space: nowrap;
}
.badge-needs_attention { background: var(--attention-bg); color: var(--attention-text); }
.badge-handled { background: var(--handled-bg); color: var(--handled-text); }

.notice, .empty, .detail-placeholder {
  padding: 28px 20px; text-align: center;
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  color: var(--text-muted); background: var(--surface);
}
.empty h1, .empty h2 { font-size: 1.125rem; color: var(--text); margin-bottom: 6px; }
.empty .btn { margin-top: 14px; }

/* ---- Welcome ------------------------------------------------------------------------- */
.hero {
  background: var(--brand-black);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; justify-content: center;
  box-shadow: var(--shadow);
}
.hero-banner { width: 100%; }
.page-welcome { max-width: 932px; }
.welcome-intro { margin: 24px 0 18px; }
.choice-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.choice-card {
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
  padding: 20px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.choice-card h2 { font-size: 1.25rem; }
.choice-card p { color: var(--text-muted); flex: 1; }
.about-demo { margin-top: 28px; padding: 18px 20px; background: var(--surface-sunk); border-radius: var(--radius); }
.about-demo h2 { font-size: 1rem; margin-bottom: 8px; }
.about-demo ul { list-style: disc; padding-left: 1.25em; color: var(--text-muted); display: grid; gap: 4px; }

/* ---- Client view: filters, list, details --------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filter {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 8px 14px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 999px;
  font-weight: 600; font-size: 0.9375rem; text-decoration: none;
}
.filter:hover { border-color: var(--accent-text); background: var(--accent-tint); }
.filter.is-current { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.filter-count {
  min-width: 1.6em; padding: 0 6px; border-radius: 999px; text-align: center;
  background: var(--surface-sunk); color: var(--text); font-size: 0.8125rem; font-variant-numeric: tabular-nums;
}
.filter.is-current .filter-count { background: rgba(255, 255, 255, 0.22); color: #fff; }

.split { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); align-items: start; }

.msg-list { display: grid; gap: 10px; }
.msg {
  display: grid; gap: 4px;
  padding: 14px 16px 14px 18px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-left: 5px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  text-decoration: none;
}
.msg-needs_attention { border-left-color: var(--attention-mark); }
.msg:hover { border-color: var(--accent-text); }
.msg-needs_attention:hover { border-left-color: var(--attention-mark); }
.msg.is-selected { border-color: var(--accent); background: var(--accent-tint); box-shadow: 0 0 0 1px var(--accent); }
.msg-needs_attention.is-selected { border-left-color: var(--attention-mark); }
.msg-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; }
.msg-caller { font-size: 1.0625rem; font-weight: 700; }
.msg-time { font-size: 0.875rem; color: var(--text-muted); white-space: nowrap; }
.msg-inquiry { font-weight: 600; }
.msg-summary {
  color: var(--text-muted); font-size: 0.9375rem;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.msg-foot { margin-top: 6px; }

.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; margin-bottom: 8px; font-weight: 600; text-decoration: none;
}
.back-link:hover { text-decoration: underline; }

.detail {
  padding: 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.detail-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; }
.detail-head h2 { font-size: 1.5rem; line-height: 1.25; margin-top: 2px; }
.facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 20px;
  margin: 16px 0 4px; padding: 14px 16px; background: var(--surface-sunk); border-radius: var(--radius-sm);
}
.facts dt, .client-facts dt { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.facts dd { font-weight: 600; font-variant-numeric: tabular-nums; }
.detail-section { margin-top: 18px; }
.detail-section h3 { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
.detail-section p { max-width: 65ch; }
.detail-inquiry { font-size: 1.125rem; font-weight: 600; }
.detail-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border);
}
.hint { font-size: 0.8125rem; color: var(--text-muted); }

/* Phone / narrow: show the list OR the opened message, never both. */
.detail-placeholder { display: none; }
.page.has-selection .list-pane,
.page.has-selection .filters,
.page.has-selection .page-head .lede { display: none; }
.page:not(.has-selection) .detail-pane { display: none; }

@media (min-width: 900px) {
  .split { grid-template-columns: minmax(320px, 5fr) minmax(0, 7fr); }
  .page.has-selection .list-pane { display: block; }
  .page.has-selection .filters { display: flex; }
  .page.has-selection .page-head .lede { display: block; }
  .page:not(.has-selection) .detail-pane { display: block; }
  .detail-placeholder { display: block; padding: 56px 20px; }
  .detail-pane { position: sticky; top: 16px; }
  .back-link { display: none; }
}

/* ---- Preview bar ----------------------------------------------------------------------- */
.preview-bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 16px;
  padding: 10px var(--gutter);
  background: var(--brand-navy); color: #f1f5fb;
  border-bottom: 2px solid var(--brand-blue-bright);
}
.preview-bar p { max-width: 70ch; }
.preview-note { color: #c5d4ea; }
.preview-bar .btn { min-height: 40px; padding: 6px 16px; flex: none; }

/* ---- Owner view ------------------------------------------------------------------------ */
.client-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.client-card {
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.client-card h2 { font-size: 1.1875rem; line-height: 1.3; text-wrap: balance; }
.client-card-head .muted { font-size: 0.875rem; }
.client-facts { display: grid; gap: 10px; flex: 1; align-content: start; }
.client-facts > div { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 8px; align-items: baseline; }
.client-facts dd { font-variant-numeric: tabular-nums; }
.agent-list { display: grid; gap: 2px; }
.agent-list .muted { font-size: 0.875rem; }
.client-card .btn { align-self: stretch; }

/* ---- Footer ---------------------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); }
.site-footer-inner {
  max-width: var(--page-max); margin: 0 auto; padding: 14px var(--gutter);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px;
  font-size: 0.8125rem; color: var(--text-muted);
}
.site-footer p { max-width: 70ch; }

/* ---- Small screens --------------------------------------------------------------------- */
@media (max-width: 560px) {
  .site-header-inner { justify-content: center; }
  .brand-mark { height: 50px; margin-left: -10px; }
  .brand { gap: 4px; }
  .brand-name { font-size: 0.9375rem; letter-spacing: 0.18em; }
  .brand-tag { font-size: 0.5625rem; letter-spacing: 0.16em; }
  .role-switch { width: 100%; justify-content: space-between; }
  .role-switch a { flex: 1; }
  .preview-bar { flex-wrap: nowrap; justify-content: space-between; text-align: left; font-size: 0.875rem; line-height: 1.4; }
  .preview-bar p { flex: 1; }
  .preview-note { display: none; }
  .preview-bar .btn { min-height: 44px; }
  .filters { gap: 6px; }
  .filter { padding: 8px 12px; }
  .detail { padding: 16px; }
  .detail-actions .btn { width: 100%; }
  .client-facts > div { grid-template-columns: 7.5rem minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

@media (forced-colors: active) {
  .msg.is-selected, .filter.is-current, .role-switch a[aria-current="true"] { outline: 2px solid Highlight; }
}
