/* Forum CRM — base styles
   Palette: deep navy, champagne brass (NOT mustard), warm cream, slate.
   Typography: Cormorant Garamond display, Inter body.
*/

:root {
  /* Navy — RCorp brand, slightly deeper than docx version for app chrome */
  --navy:       #1A2F4B;
  --navy-deep:  #0F2540;
  --navy-soft:  #2C4365;

  /* Champagne brass — replaces the old mustard #B8860B */
  --gold:       #C9A961;     /* primary accent */
  --gold-soft:  #E5CD9A;     /* tint, hover backgrounds */
  --gold-deep:  #8C7338;     /* contrast-safe text on light */

  /* Neutrals */
  --paper:      #FFFFFF;     /* cards */
  --cream:      #FAF7F0;     /* page background, warm */
  --ink:        #16203A;     /* heading text */
  --gray-9:     #1F2937;
  --gray-7:     #475569;
  --gray-5:     #64748B;
  --gray-4:     #94A3B8;
  --gray-3:     #CBD5E1;
  --gray-2:     #E2E8F0;
  --gray-1:     #F1F5F9;

  /* States */
  --danger:     #B91C3F;
  --danger-bg:  #FCE8EC;
  --ok:         #166D4D;
  --ok-bg:      #DEF1E5;
  --warn:       #8C5A00;
  --warn-bg:    #FBEDD0;

  /* Geometry */
  --max-w:      1200px;
  --radius:     6px;
  --radius-lg:  10px;

  /* Type stacks */
  --serif:      'Cormorant Garamond', Georgia, 'Palatino Linotype', serif;
  --sans:       'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono:       ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font: 15px/1.55 var(--sans);
  color: var(--gray-7);
  background: var(--cream);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--gold-deep); text-decoration: none; transition: color 0.12s; }
a:hover { color: var(--navy); text-decoration: underline; }

h1, h2, h3 {
  font-family: var(--serif);
  color: var(--ink);
  margin: 0 0 0.6em;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.005em;
}
h1 { font-size: 2rem;    font-weight: 600; text-wrap: balance; }
h2 { font-size: 1.4rem;  font-weight: 600; margin-top: 0.4em; text-wrap: balance; }
h3 { font-size: 1.1rem;  font-weight: 600; text-wrap: balance; }

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

code {
  font: 0.92em/1 var(--mono);
  background: var(--gray-1);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--gray-9);
}
small { color: var(--gray-5); font-size: 0.85em; }
.muted { color: var(--gray-5); }

/* ========================================================================
   Top nav
   ======================================================================== */
.topnav {
  background: var(--navy);
  color: #fff;
  position: sticky; top: 0; z-index: 30;
  border-bottom: 1px solid rgba(201, 169, 97, 0.35);
  box-shadow: 0 1px 0 var(--gold);
}
.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0.5rem 1.5rem;
  display: flex; align-items: center; gap: 2rem;
  min-height: 160px;
}

.brand {
  color: #fff; text-decoration: none;
  display: flex; align-items: center; gap: 0.7rem;
}
.brand:hover { text-decoration: none; color: #fff; }
.brand-logo {
  height: 144px; width: auto;
  display: block;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.45));
}
.brand-name {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 2rem;
  letter-spacing: 0.01em;
  color: #fff;
  line-height: 1;
}

.nav-links {
  list-style: none; padding: 0; margin: 0;
  display: flex; gap: 0.15rem; flex: 1;
}
.navlink {
  color: rgba(255,255,255,0.72);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.005em;
  transition: all 0.12s;
}
.navlink:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
  text-decoration: none;
}
.navlink.is-active {
  color: var(--gold);
  background: rgba(201, 169, 97, 0.08);
}
.navlink-admin {
  margin-left: auto;
  color: var(--gold-soft);
  border: 1px solid rgba(201, 169, 97, 0.3);
}
.navlink-admin:hover { border-color: var(--gold); }

.nav-right { display: flex; align-items: center; gap: 0.65rem; }

.workspace-switcher, .user-menu { position: relative; }
.workspace-switcher summary, .user-menu summary {
  list-style: none; cursor: pointer;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.06);
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.86rem;
  color: rgba(255,255,255,0.92);
  font-weight: 500;
  transition: background 0.12s;
}
.workspace-switcher summary::-webkit-details-marker,
.user-menu summary::-webkit-details-marker { display: none; }
.workspace-switcher summary::marker,
.user-menu summary::marker { display: none; }
.workspace-switcher summary:hover, .user-menu summary:hover {
  background: rgba(255,255,255,0.12);
}
.ws-caret { font-size: 0.7rem; opacity: 0.7; }
.ws-static { font-size: 0.86rem; color: rgba(255,255,255,0.72); padding: 0.3rem 0.5rem; }

.ws-menu, .user-menu-list {
  position: absolute; top: calc(100% + 0.4rem); right: 0;
  background: #fff; color: var(--gray-7);
  border: 1px solid var(--gray-2);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 28px -8px rgba(15, 37, 64, 0.18), 0 2px 4px rgba(0,0,0,0.04);
  min-width: 240px;
  padding: 0.4rem;
  list-style: none;
  margin: 0;
  z-index: 40;
  font-size: 0.9rem;
}
.ws-menu li, .user-menu-list li { padding: 0; }
.ws-menu a {
  display: block; padding: 0.55rem 0.75rem;
  color: var(--gray-7);
  border-radius: var(--radius);
}
.ws-menu a:hover { background: var(--gray-1); text-decoration: none; }
.ws-menu a.is-current { color: var(--gold-deep); font-weight: 600; background: var(--gray-1); }
.ws-menu-heading {
  padding: 0.5rem 0.75rem 0.35rem;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gray-5);
  font-weight: 700;
}
.ws-menu-divider {
  height: 1px;
  background: var(--gray-2);
  margin: 0.4rem 0;
}
.ws-menu a.ws-new {
  color: var(--gold-deep);
  font-weight: 600;
}
.ws-menu a.ws-manage {
  color: var(--gray-6);
  font-size: 0.88rem;
}

.user-menu-info {
  display: block;
  padding: 0.7rem 0.85rem 0.5rem;
  border-bottom: 1px solid var(--gray-2);
  margin-bottom: 0.3rem;
}
.user-menu-info strong { display: block; color: var(--ink); }
.user-menu-info small { color: var(--gray-5); }
.logout-button {
  background: none; border: 0; padding: 0.5rem 0.85rem;
  width: 100%; text-align: left; cursor: pointer;
  color: var(--gray-7); font: inherit;
  border-radius: var(--radius);
  transition: all 0.12s;
}
.logout-button:hover { background: var(--danger-bg); color: var(--danger); }

.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-deep) 100%);
  color: var(--navy);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.95rem;
  font-family: var(--serif);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* ========================================================================
   Main + footer
   ======================================================================== */
/* ========== App shell: topnav + sidebar + main ========== */
.app-shell {
  display: flex;
  align-items: stretch;
  min-height: calc(100vh - 60px - 60px); /* topnav + footer */
}

.sidenav {
  width: 220px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--gray-2);
  padding: 1.5rem 0.85rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
}
.sidenav-group { display: flex; flex-direction: column; gap: 0.25rem; }
.sidenav-heading {
  margin: 0 0.55rem 0.45rem;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gray-5);
  font-weight: 700;
}
.sidenav-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.sidelink {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.5rem 0.7rem;
  color: var(--gray-7);
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--radius);
  text-decoration: none;
}
.sidelink:hover { background: var(--gray-1); color: var(--ink); text-decoration: none; }
.sidelink.is-active {
  background: var(--navy);
  color: var(--gold-soft);
  font-weight: 600;
}
.sidelink.is-active .sidelink-icon { color: var(--gold); }
.sidelink-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  font-size: 0.95rem;
  color: var(--gold-deep);
  font-family: "Cormorant Garamond", Georgia, serif;
}
.sidelink-admin.is-active { background: linear-gradient(180deg, var(--navy), var(--navy-deep)); }
.sidenav-footer {
  margin-top: auto;
  padding: 0.85rem 0.7rem;
  border-top: 1px solid var(--gray-2);
}
.sidenav-mini { margin: 0; font-size: 0.85rem; color: var(--gray-7); line-height: 1.4; }

main {
  flex: 1;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}
main.page.with-sidenav {
  max-width: calc(var(--max-w) + 220px);
  margin: 0;
  padding: 2rem 2rem 4rem;
}
main.standalone {
  display: flex; align-items: center; justify-content: center;
  min-height: calc(100vh - 60px);
  max-width: var(--max-w);
}

/* Mobile: collapse sidebar to a top bar of pills */
@media (max-width: 820px) {
  .app-shell { flex-direction: column; }
  .sidenav {
    position: static; height: auto; width: 100%;
    flex-direction: row; flex-wrap: wrap;
    border-right: 0; border-bottom: 1px solid var(--gray-2);
    padding: 0.75rem 1rem; gap: 0.5rem 1rem;
    overflow-x: auto; overflow-y: visible;
  }
  .sidenav-group { flex-direction: row; align-items: center; gap: 0.5rem; }
  .sidenav-heading { display: none; }
  .sidenav-links { flex-direction: row; flex-wrap: nowrap; }
  .sidelink { padding: 0.4rem 0.75rem; font-size: 0.88rem; }
  .sidenav-footer { display: none; }
  main.page.with-sidenav { padding: 1.25rem 1rem 3rem; }
}

.site-footer {
  padding: 1.5rem 1rem;
  color: var(--gray-5); font-size: 0.82rem;
  display: flex; gap: 0.5rem; justify-content: center; align-items: center;
  border-top: 1px solid var(--gray-2);
  background: var(--cream);
}
.site-footer strong { color: var(--ink); font-weight: 600; font-family: var(--serif); font-style: italic; font-size: 1rem; }
.footer-dot { color: var(--gold); }

/* Login screen logo */
.auth-logo {
  display: block;
  height: 48px; width: auto;
  margin: 0 auto 1rem;
}

/* ========================================================================
   Auth
   ======================================================================== */
.auth-card {
  background: #fff;
  border: 1px solid var(--gray-2);
  border-radius: var(--radius-lg);
  padding: 2.75rem 2.25rem 2.25rem;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 10px 30px -10px rgba(15, 37, 64, 0.1), 0 1px 3px rgba(0,0,0,0.04);
  text-align: center;
}
.auth-card .auth-form,
.auth-card .ws-picker { text-align: left; }
.auth-title {
  text-wrap: balance;
  font-family: var(--serif);
  font-size: 1.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--ink);
}
.auth-sub {
  color: var(--gray-5);
  margin-top: 0; margin-bottom: 2rem;
  font-size: 0.92rem;
}
.auth-form label { display: block; margin-bottom: 1.1rem; }
.auth-form label > span {
  display: block; font-size: 0.82rem;
  font-weight: 600; margin-bottom: 0.35rem;
  color: var(--gray-9); letter-spacing: 0.01em;
}
.auth-foot {
  color: var(--gray-5); font-size: 0.82rem;
  margin-top: 1.5rem; text-align: center;
}

/* ========================================================================
   Page heads
   ======================================================================== */
.page-head {
  display: flex; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap; gap: 1rem; margin-bottom: 1.75rem;
}
.page-head h1 { margin: 0; font-size: 1.85rem; }
.page-sub { color: var(--gray-5); margin: 0; font-size: 0.92rem; }
.page-head.with-back { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
.back-link {
  font-size: 0.85rem; color: var(--gray-5);
  font-weight: 500;
}
.back-link:hover { color: var(--navy); }
.head-actions { display: flex; gap: 0.55rem; }

/* ========================================================================
   KPIs — luxury serif numerals
   ======================================================================== */
.kpi-grid {
  display: grid; gap: 1rem; margin-bottom: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.kpi {
  background: #fff;
  border: 1px solid var(--gray-2);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
  position: relative;
  overflow: hidden;
  transition: border-color 0.12s, transform 0.12s;
}
.kpi::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--gold);
  opacity: 0; transition: opacity 0.15s;
}
.kpi:hover { border-color: var(--gold); }
.kpi:hover::before { opacity: 1; }
.kpi-label {
  font-size: 0.72rem;
  color: var(--gray-5);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.kpi-value {
  font-family: var(--serif);
  font-size: 2.6rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.05;
  margin-top: 0.4rem;
  font-feature-settings: "lnum" 1;
}

/* ========================================================================
   Cards
   ======================================================================== */
.card {
  background: #fff;
  border: 1px solid var(--gray-2);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.6rem;
  margin-bottom: 1.25rem;
}
.card h2 { margin-top: 0; }

/* ========================================================================
   Filters
   ======================================================================== */
.filters {
  display: flex; gap: 0.55rem; flex-wrap: wrap; align-items: center;
  margin-bottom: 1.25rem;
}
.filters input[type="search"] { flex: 1; min-width: 220px; }
.filters select { min-width: 150px; }

/* ========================================================================
   Tables
   ======================================================================== */
table.data {
  width: 100%;
  background: #fff;
  border: 1px solid var(--gray-2);
  border-radius: var(--radius-lg);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  font-size: 0.92rem;
}
table.data th, table.data td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-2);
}
table.data th {
  background: var(--gray-1);
  font-weight: 600;
  color: var(--gray-9);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background 0.1s; }
table.data tbody tr:hover td { background: var(--cream); }
table.data a { color: var(--navy); font-weight: 500; }
table.data a:hover { color: var(--gold-deep); }

.pager {
  display: flex; gap: 1.5rem; justify-content: center;
  padding: 1.5rem 0; align-items: center;
}
.pager a {
  color: var(--navy); font-weight: 500;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--gray-2);
  border-radius: var(--radius);
}
.pager a:hover { border-color: var(--gold); text-decoration: none; }

/* ========================================================================
   Pills
   ======================================================================== */
.pill {
  display: inline-block;
  padding: 0.18rem 0.6rem;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--gray-1);
  color: var(--gray-7);
  border: 1px solid var(--gray-2);
}
.pill-lead       { background: #E8EEF5; color: var(--navy);     border-color: #C9D6E5; }
.pill-mql        { background: #F2EAD2; color: var(--gold-deep);border-color: #DCC79B; }
.pill-sql        { background: #FFE8C4; color: #8C5A00;         border-color: #E8C68A; }
.pill-customer   { background: var(--ok-bg); color: var(--ok);  border-color: #B7DCC0; }
.pill-evangelist { background: var(--danger-bg); color: var(--danger); border-color: #E8B7BF; }

/* ========================================================================
   Forms
   ======================================================================== */
input[type="text"], input[type="email"], input[type="tel"], input[type="search"],
input[type="password"], input[type="number"], input[type="url"],
select, textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--gray-3);
  border-radius: var(--radius);
  background: #fff;
  font: inherit;
  color: var(--gray-9);
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, select:focus, textarea:focus {
  outline: 0;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.18);
}
textarea { min-height: 84px; resize: vertical; font: inherit; }

.form-card label { display: block; margin-bottom: 1rem; }
.form-card label > span {
  display: block; font-size: 0.82rem;
  font-weight: 600; margin-bottom: 0.35rem;
  color: var(--gray-9); letter-spacing: 0.01em;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 540px) { .grid-2 { grid-template-columns: 1fr; } }
.form-actions {
  display: flex; gap: 0.6rem; margin-top: 1.25rem; align-items: center;
  padding-top: 1rem; border-top: 1px solid var(--gray-2);
}

/* ========================================================================
   Buttons
   ======================================================================== */
.btn {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  font: 600 0.9rem/1.3 var(--sans);
  letter-spacing: 0.005em;
  cursor: pointer;
  border: 1px solid var(--gray-3);
  background: #fff;
  color: var(--gray-9);
  text-decoration: none;
  transition: all 0.12s;
  white-space: nowrap;
}
.btn:hover {
  background: var(--gray-1);
  border-color: var(--gray-4);
  text-decoration: none;
}
.btn-primary {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.btn-primary:hover {
  background: var(--navy-deep);
  border-color: var(--navy-deep);
  color: #fff;
  box-shadow: 0 4px 12px -4px rgba(15, 37, 64, 0.3);
}
.btn-gold {
  background: var(--gold);
  color: var(--navy);
  border-color: var(--gold);
}
.btn-gold:hover {
  background: var(--gold-deep);
  color: #fff;
  border-color: var(--gold-deep);
}
.btn-danger {
  background: #fff;
  color: var(--danger);
  border-color: var(--gray-3);
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-link {
  background: transparent;
  border-color: transparent;
  color: var(--gray-5);
  padding: 0.55rem 0.5rem;
}
.btn-link:hover { color: var(--navy); background: transparent; }
.btn-block { width: 100%; padding: 0.75rem; }

/* ========================================================================
   Contact detail
   ======================================================================== */
.contact-detail {
  display: grid;
  grid-template-columns: minmax(280px, 320px) 1fr;
  gap: 1.75rem;
}
@media (max-width: 800px) { .contact-detail { grid-template-columns: 1fr; } }

.contact-card {
  background: #fff;
  border: 1px solid var(--gray-2);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.6rem;
  align-self: start;
}
.contact-card h1 {
  font-size: 1.4rem;
  margin: 0 0 0.5rem;
  color: var(--ink);
}

dl.kv { margin: 1rem 0 0; }
dl.kv dt {
  font-size: 0.72rem;
  color: var(--gray-5);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.95rem;
  font-weight: 600;
}
dl.kv dd { margin: 0.2rem 0 0; color: var(--gray-9); }

/* ========================================================================
   Timeline
   ======================================================================== */
.timeline {
  list-style: none; padding: 0; margin: 0;
  border-left: 2px solid var(--gray-2);
  margin-left: 0.5rem;
}
.timeline-item {
  padding: 0.85rem 0 0.85rem 1.4rem;
  position: relative;
  border-bottom: 1px solid var(--gray-1);
}
.timeline-item:last-child { border-bottom: 0; }
.timeline-item:before {
  content: "";
  position: absolute; left: -7px; top: 1.15rem;
  width: 12px; height: 12px;
  background: var(--gold); border-radius: 50%;
  border: 3px solid var(--cream);
  box-shadow: 0 0 0 1px var(--gold);
}
.timeline-time {
  display: block;
  font-size: 0.74rem;
  color: var(--gray-5);
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.activity-list { list-style: none; padding: 0; margin: 0; }
.activity-list li {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--gray-1);
  font-size: 0.92rem;
}
.activity-list li:last-child { border-bottom: 0; }
.activity-type {
  display: inline-block;
  padding: 0.12rem 0.55rem;
  border-radius: 99px;
  background: var(--gray-1);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--gray-7);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 0.55rem;
}
.type-form_submit   { background: #E8EEF5; color: var(--navy); }
.type-email_sent    { background: #F2EAD2; color: var(--gold-deep); }
.type-email_opened  { background: #FFE8C4; color: #8C5A00; }
.type-email_clicked { background: var(--ok-bg); color: var(--ok); }
.type-note          { background: var(--danger-bg); color: var(--danger); }

.note-form-card { margin-bottom: 1rem; }
.note-form-card textarea { width: 100%; }

/* ========================================================================
   Form builder
   ======================================================================== */
.field-builder {
  display: flex; flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr 130px 100px 32px;
  gap: 0.55rem; align-items: center;
  background: var(--gray-1);
  padding: 0.5rem;
  border-radius: var(--radius);
}
.field-row label.inline {
  display: flex; align-items: center; gap: 0.35rem;
  font-size: 0.85rem; margin: 0;
  color: var(--gray-7);
}
.field-row label.inline input[type="checkbox"] { width: auto; margin: 0; }
.field-remove {
  background: none; border: 0; color: var(--gray-5);
  font-size: 1.4rem; line-height: 1;
  cursor: pointer; padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  transition: all 0.12s;
}
.field-remove:hover { color: var(--danger); background: var(--danger-bg); }
@media (max-width: 720px) {
  .field-row { grid-template-columns: 1fr 1fr; }
  .field-row select, .field-row label.inline, .field-remove { grid-column: span 1; }
}

label.inline {
  display: flex; align-items: center; gap: 0.5rem;
  margin-bottom: 0.5rem;
}
label.inline input[type="checkbox"] {
  width: auto; margin: 0;
}

/* Embed code block */
.embed-code {
  background: #0F2540;
  color: #E5CD9A;
  border: 1px solid var(--navy);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  font: 0.82rem/1.5 var(--mono);
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-x: auto;
  margin: 0.6rem 0 0;
}
.embed-code-actions {
  display: flex; gap: 0.6rem; align-items: center;
  margin-top: 0.6rem;
}
.embed-option {
  border: 1px solid var(--gray-2);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  margin-bottom: 0.65rem;
  background: var(--cream);
}
.embed-option summary {
  cursor: pointer;
  font-size: 0.95rem;
  list-style: none;
  user-select: none;
}
.embed-option summary::-webkit-details-marker,
.embed-option summary::marker { display: none; }
.embed-option summary::before {
  content: "▸ ";
  color: var(--gold-deep);
  display: inline-block;
  transition: transform 0.15s;
}
.embed-option[open] summary::before {
  transform: rotate(90deg);
}
.embed-option[open] {
  background: #fff;
}

/* Mode toggle for form builder */
.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 0.5rem 0 1rem;
}
@media (max-width: 600px) { .mode-toggle { grid-template-columns: 1fr; } }
.mode-option {
  display: flex; gap: 0.7rem; align-items: flex-start;
  padding: 0.85rem 1rem;
  border: 1.5px solid var(--gray-2);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.12s;
  background: #fff;
  margin: 0;
}
.mode-option:hover { border-color: var(--gold-soft); }
.mode-option > input { width: auto; margin-top: 4px; flex-shrink: 0; accent-color: var(--gold-deep); }
.mode-option > div { display: block; }
.mode-option strong { display: block; color: var(--ink); margin-bottom: 0.15rem; }
.mode-option span { display: block; font-size: 0.85rem; color: var(--gray-5); font-weight: 400; }
.mode-option:has(input:checked) {
  border-color: var(--gold);
  background: var(--cream);
  box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.12);
}

.ai-prompt {
  background: var(--gray-1);
  border: 1px solid var(--gray-2);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.85rem;
  font-size: 0.88rem;
}
.ai-prompt summary { cursor: pointer; font-weight: 500; color: var(--gold-deep); }

/* Segment picker (email composer) */
.segment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.5rem;
  margin: 0.5rem 0 1rem;
}
.segment-option {
  display: flex; gap: 0.6rem; align-items: flex-start;
  padding: 0.7rem 0.85rem;
  border: 1.5px solid var(--gray-2);
  border-radius: var(--radius);
  cursor: pointer;
  background: #fff;
  margin: 0;
  transition: all 0.12s;
}
.segment-option:hover { border-color: var(--gold-soft); }
.segment-option > input { width: auto; margin-top: 4px; flex-shrink: 0; accent-color: var(--gold-deep); }
.segment-option strong { display: block; color: var(--ink); font-size: 0.95rem; margin-bottom: 0.15rem; }
.segment-option span { display: block; font-size: 0.82rem; color: var(--gray-5); }
.segment-option:has(input:checked) {
  border-color: var(--gold);
  background: var(--cream);
}

/* ========================================================================
   Kanban
   ======================================================================== */
.kanban {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding: 0.5rem 0 1.5rem;
  margin: 0 -1.5rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  scroll-snap-type: x proximity;
}
.kanban-col {
  flex: 0 0 280px;
  background: var(--gray-1);
  border: 1px solid var(--gray-2);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-height: 75vh;
  scroll-snap-align: start;
}
.kanban-col-head {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--gray-2);
  display: flex; justify-content: space-between; align-items: baseline;
  background: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.kanban-col-head strong { color: var(--ink); font-size: 0.95rem; }
.kanban-col-head span { font-size: 0.78rem; }
.kanban-cards {
  flex: 1;
  overflow-y: auto;
  padding: 0.6rem;
  display: flex; flex-direction: column;
  gap: 0.55rem;
}
.kanban-cards.is-drop-target {
  background: rgba(201, 169, 97, 0.12);
  outline: 2px dashed var(--gold);
  outline-offset: -4px;
}
.kanban-empty {
  text-align: center; padding: 1rem 0;
  font-size: 0.85rem;
  font-style: italic;
}
.deal-card {
  display: block;
  background: #fff;
  border: 1px solid var(--gray-2);
  border-radius: var(--radius);
  padding: 0.7rem 0.85rem;
  cursor: grab;
  text-decoration: none;
  color: inherit;
  transition: all 0.12s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.deal-card:hover {
  border-color: var(--gold);
  box-shadow: 0 4px 10px -4px rgba(15, 37, 64, 0.12);
  text-decoration: none;
}
.deal-card.is-dragging {
  opacity: 0.4;
  cursor: grabbing;
}
.deal-card strong { display: block; color: var(--ink); font-size: 0.92rem; margin-bottom: 0.2rem; }
.deal-amount {
  display: inline-block;
  font-family: var(--serif);
  font-weight: 600;
  color: var(--gold-deep);
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}
.deal-contact {
  display: block;
  font-size: 0.82rem;
  color: var(--gray-7);
  margin-top: 0.2rem;
}
.deal-date {
  display: block;
  font-size: 0.72rem;
  margin-top: 0.25rem;
}

/* ========================================================================
   Workflows
   ======================================================================== */
.workflow-steps {
  list-style: none; padding: 0; margin: 0.5rem 0 0;
  counter-reset: wf;
}
.workflow-step {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border: 1px solid var(--gray-2);
  border-radius: var(--radius-lg);
  margin-bottom: 0.55rem;
  background: #fff;
  transition: border-color 0.12s, transform 0.12s;
}
.workflow-step:hover { border-color: var(--gold); }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--gold-soft), var(--gold));
  border-radius: 50%;
  color: var(--navy);
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1rem;
}
.step-body strong { display: block; color: var(--ink); margin-bottom: 0.15rem; }
.step-body .muted { font-size: 0.88rem; }
.step-actions { display: flex; gap: 0.4rem; }
.step-actions .btn { font-size: 0.85rem; padding: 0.4rem 0.65rem; }

/* Trigger / step pane toggles */
.trigger-pane, .step-pane {
  background: var(--gray-1);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 0.5rem 0 1rem;
  border: 1px solid var(--gray-2);
}

/* Stage builder uses field-row layout */
.stage-builder { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.5rem; }

.sparkline {
  display: block;
  width: 100%; height: 60px;
}

pre { margin: 0; }

/* ========================================================================
   Settings grid
   ======================================================================== */
.settings-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.settings-card {
  background: #fff;
  border: 1px solid var(--gray-2);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.6rem;
  color: inherit;
  transition: all 0.15s;
  display: block;
}
.settings-card:hover {
  border-color: var(--gold);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -8px rgba(15, 37, 64, 0.15);
}
.settings-card h3 {
  margin-top: 0;
  color: var(--ink);
  font-size: 1.1rem;
}
.settings-card p {
  color: var(--gray-7);
  font-size: 0.9rem;
}
.settings-card small {
  color: var(--gold-deep);
  font-weight: 600;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.settings-admin { border-color: var(--gold); }

/* ========================================================================
   Empty + Flash
   ======================================================================== */
.empty {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--gray-5);
  background: #fff;
  border: 1px dashed var(--gray-3);
  border-radius: var(--radius-lg);
}
.empty-large { padding: 4rem 1.5rem; }
.empty h1 {
  font-size: 4.5rem;
  color: var(--gray-3);
  margin: 0 0 0.5rem;
  font-family: var(--serif);
}
.empty strong { color: var(--ink); }

.flash {
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  border: 1px solid;
  font-size: 0.92rem;
  font-weight: 500;
}
.flash-ok    { background: var(--ok-bg);     color: var(--ok);     border-color: #B7DCC0; }
.flash-error { background: var(--danger-bg); color: var(--danger); border-color: #E8B7BF; }
.flash-warn  { background: var(--warn-bg);   color: var(--warn);   border-color: #DCC79B; }

/* ========================================================================
   Workspace picker
   ======================================================================== */
.ws-picker { list-style: none; padding: 0; margin: 1rem 0 0; }
.ws-picker li { margin-bottom: 0.55rem; }
.ws-picker a {
  display: block;
  padding: 0.95rem 1.1rem;
  border: 1px solid var(--gray-2);
  border-radius: var(--radius-lg);
  color: var(--gray-9);
  transition: all 0.12s;
}
.ws-picker a:hover {
  border-color: var(--gold);
  background: var(--cream);
  text-decoration: none;
  transform: translateX(2px);
}
.ws-picker strong { color: var(--ink); display: block; }
.ws-picker small {
  display: block;
  color: var(--gray-5);
  margin-top: 0.2rem;
  font-family: var(--mono);
  font-size: 0.78rem;
}

/* === nav v6 2026-05-21: top nav (primary) + sidebar (secondary), no duplicates === */

/* Slim navy top bar */
.topnav { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 30; border-bottom: 0; box-shadow: 0 1px 0 var(--gold); }
.nav-inner {
  max-width: 100% !important;
  margin: 0 !important;
  height: 64px !important;
  min-height: 0 !important;
  padding: 0 1.5rem !important;
  display: flex !important;
  align-items: center !important;
  gap: 1.2rem !important;
}
.brand { display: flex !important; align-items: center !important; gap: 0 !important; flex-shrink: 0; }
.brand-logo { height: 40px !important; width: auto !important; filter: none !important; display: block; }
.brand-name { display: none !important; }

/* Primary nav links */
.nav-links { list-style: none; padding: 0; margin: 0; display: flex !important; align-items: center; gap: .15rem; flex: 1; min-width: 0; }
.nav-links li { margin: 0; }
.navlink {
  display: inline-flex; align-items: center;
  color: rgba(255,255,255,.78);
  padding: .42rem .8rem;
  border-radius: 6px;
  font-size: .92rem;
  font-weight: 500;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
  transition: background .12s, color .12s;
}
.navlink:hover { background: rgba(212,165,71,.16); color: #fff; text-decoration: none; }
.navlink.is-active { background: rgba(212,165,71,.22); color: #fff; font-weight: 600; box-shadow: inset 0 -2px 0 var(--gold); }

/* Inbox red pulse badge */
.nav-badge { display: inline-block; min-width: 18px; padding: 2px 6px; margin-left: .4rem; background: #9B2C2C; color: #fff; font-size: .68rem; font-weight: 700; border-radius: 999px; text-align: center; line-height: 1; vertical-align: middle; }
.nav-badge-pulse { animation: badge-pulse 2.2s ease-in-out infinite; box-shadow: 0 0 0 0 rgba(155,44,44,.6); }
@keyframes badge-pulse {
  0% { box-shadow: 0 0 0 0 rgba(155,44,44,.6); }
  70% { box-shadow: 0 0 0 7px rgba(155,44,44,0); }
  100% { box-shadow: 0 0 0 0 rgba(155,44,44,0); }
}

/* Right-side controls */
.nav-right { display: flex !important; align-items: center !important; gap: .55rem !important; flex-shrink: 0; }

.quick-create { position: relative; }
.quick-create > summary { list-style: none; cursor: pointer; padding: .45rem .9rem; background: var(--gold); color: #0A2C54; border-radius: 6px; font-weight: 700; font-size: .86rem; line-height: 1; display: inline-flex; align-items: center; white-space: nowrap; }
.quick-create > summary::-webkit-details-marker { display: none; }
.quick-create > summary:hover, .quick-create[open] > summary { background: #e6c167; }
.qc-menu { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid #e5e5e5; border-radius: 8px; box-shadow: 0 8px 24px rgba(10,44,84,.18); min-width: 200px; padding: .35rem 0; margin: 0; list-style: none; z-index: 60; }
.qc-menu li a { display: block; padding: .5rem .95rem; color: #0A2C54; text-decoration: none; font-size: .9rem; }
.qc-menu li a:hover { background: #f8f6ee; }

.workspace-switcher { position: relative; }
.workspace-switcher > summary { list-style: none; cursor: pointer; padding: .42rem .75rem; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2); border-radius: 6px; color: #fff; font-size: .86rem; font-weight: 500; display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; max-width: 200px; }
.workspace-switcher > summary::-webkit-details-marker { display: none; }
.workspace-switcher > summary:hover { background: rgba(255,255,255,.16); }
.ws-label { overflow: hidden; text-overflow: ellipsis; max-width: 140px; color: #fff; }
.ws-caret { font-size: .7rem; opacity: .7; }
.ws-menu { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid #e5e5e5; border-radius: 8px; box-shadow: 0 8px 24px rgba(10,44,84,.18); min-width: 220px; padding: .35rem 0; margin: 0; list-style: none; z-index: 60; }
.ws-menu li a { display: block; padding: .45rem .9rem; color: #0A2C54; text-decoration: none; font-size: .9rem; }
.ws-menu li a:hover { background: #f8f6ee; }
.ws-menu li a.is-current { background: #f0ecda; font-weight: 600; }
.ws-menu-heading { padding: .4rem .9rem .25rem; color: #999; font-size: .72rem; text-transform: uppercase; letter-spacing: .4px; font-weight: 700; }
.ws-menu-divider { height: 1px; background: #e5e5e5; margin: .3rem 0; }

.user-menu { position: relative; }
.user-menu > summary { list-style: none; cursor: pointer; }
.user-menu > summary::-webkit-details-marker { display: none; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; background: var(--gold); color: #0A2C54; font-weight: 700; font-size: .95rem; border-radius: 999px; }
.avatar:hover { background: #e6c167; }
.user-menu-list { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid #e5e5e5; border-radius: 8px; box-shadow: 0 8px 24px rgba(10,44,84,.18); min-width: 240px; padding: .35rem 0; margin: 0; list-style: none; z-index: 60; }
.user-menu-info { padding: .6rem .95rem; border-bottom: 1px solid #f0eee5; }
.user-menu-info strong { display: block; color: #0A2C54; font-size: .95rem; }
.user-menu-info small { display: block; color: #888; font-size: .78rem; margin-top: .15rem; }
.user-menu-list form { margin: 0; padding: .25rem 0 0; }
.logout-button { display: block; width: 100%; padding: .5rem .95rem; background: none; border: 0; text-align: left; color: #9B2C2C; font-size: .9rem; cursor: pointer; font-weight: 500; }
.logout-button:hover { background: #fbf0f0; }

/* ===== Sidebar (secondary nav) sits side-by-side with main ===== */
.app-shell { display: flex !important; align-items: stretch; min-height: calc(100vh - 64px); }

.sidenav {
  display: block !important;
  width: 240px;
  flex-shrink: 0;
  background: #fafaf6;
  border-right: 1px solid #e8e2c5;
  padding: 1.2rem .65rem;
  box-sizing: border-box;
}
.sidenav-group { margin-bottom: 1.2rem; }
.sidenav-heading { margin: 0 .8rem .4rem; color: #8b7d4f; font-size: .7rem; text-transform: uppercase; letter-spacing: .6px; font-weight: 700; }
.sidenav-links { list-style: none; margin: 0; padding: 0; }
.sidenav-links li { margin: .08rem 0; }
.sidelink { display: flex; align-items: center; gap: .65rem; padding: .48rem .85rem; color: #3a3a3a; text-decoration: none; font-size: .92rem; font-weight: 500; border-radius: 6px; line-height: 1.25; transition: background .12s, color .12s; }
.sidelink:hover { background: #f0ecda; color: #0A2C54; }
.sidelink.is-active { background: #0A2C54; color: #fff; font-weight: 600; }
.sidelink.is-active .sidelink-icon { color: var(--gold); }
.sidelink-icon { display: inline-flex; width: 18px; justify-content: center; color: #8b7d4f; font-size: .95rem; flex-shrink: 0; }

.sidenav-footer { margin-top: 1.5rem; padding: .8rem .85rem 0; border-top: 1px solid #e8e2c5; }
.sidenav-mini { margin: 0; font-size: .78rem; color: #666; line-height: 1.4; }
.sidenav-mini strong { color: #0A2C54; font-size: .85rem; display: block; }
.sidenav-mini .muted { color: #999; font-size: .72rem; }

main.page,
main.page.with-sidenav {
  flex: 1;
  min-width: 0;
  /* padding kept by next rule */
  background: transparent;
}

/* ========================================================================
   v7 UI polish — 2026-06-01
   Layered on the existing system (icons are now inline SVG, not glyphs):
   elevation scale, custom select chevrons, focus-visible rings, icon
   sizing/alignment, cohesive inline editors. Placed BEFORE the responsive
   cluster below so mobile touch-target overrides still win.
   ======================================================================== */
:root {
  --shadow-sm:   0 1px 2px rgba(15, 37, 64, 0.06), 0 1px 3px rgba(15, 37, 64, 0.05);
  --shadow-md:   0 2px 4px rgba(15, 37, 64, 0.06), 0 6px 16px rgba(15, 37, 64, 0.08);
  --shadow-lg:   0 10px 28px -8px rgba(15, 37, 64, 0.16), 0 2px 6px rgba(15, 37, 64, 0.06);
  --ring:        0 0 0 3px rgba(201, 169, 97, 0.35);
}

/* Inline SVG icons: crisp, inherit text color, optically centered with text */
.ico { display: inline-block; vertical-align: -0.15em; flex: none; }
svg.ico { stroke: currentColor; }

/* Icon-only action buttons (archive / restore / delete on campaigns) */
.btn-icon { display: inline-flex; align-items: center; justify-content: center; }
.btn-icon svg { display: block; }

/* Event-timeline badges: white icon on the colored status circle */
.event-icon { color: #fff; }
.event-icon svg { display: block; }

/* Cards / KPIs / tables: gentle elevation + lift on hover */
.card       { box-shadow: var(--shadow-sm); transition: box-shadow .16s ease, transform .16s ease, border-color .16s ease; }
.kpi        { box-shadow: var(--shadow-sm); }
.kpi:hover  { transform: translateY(-2px); box-shadow: var(--shadow-md); }
table.data  { box-shadow: var(--shadow-sm); }

/* Native selects: suppress the OS chevron, draw a brand one */
select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  padding-right: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 16px 16px;
}
select::-ms-expand { display: none; }

/* Accessible, on-brand keyboard focus ring (there was none) */
a:focus-visible, button:focus-visible, summary:focus-visible,
.btn:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid transparent; box-shadow: var(--ring); border-radius: var(--radius);
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 0; border-color: var(--gold); box-shadow: var(--ring);
}

/* Buttons: whisper depth + tactile press */
.btn         { box-shadow: var(--shadow-sm); }
.btn:active  { transform: translateY(1px); }
.btn-primary { box-shadow: 0 1px 2px rgba(15, 37, 64, 0.18); }

/* Sidebar icons (SVG) */
.sidelink-icon { width: 20px; height: 20px; }
.sidelink-icon svg { display: block; width: 18px; height: 18px; }
.sidelink:hover .sidelink-icon { color: var(--navy); }

/* Top-nav workspace caret */
.ws-caret { display: inline-flex; align-items: center; }
.ws-caret svg { display: block; }

/* Dashboard quick-action tile icons */
.qa-icon svg { width: 20px; height: 20px; display: block; }

/* Activity-feed inline markers + empty-state check */
.af-type  { display: inline-flex; align-items: center; gap: 5px; }
.af-type svg { flex: none; opacity: .82; }
.empty-ok { display: inline-flex; align-items: center; gap: 6px; }
.empty-ok svg { color: var(--ok); flex: none; }

/* Contacts inline stage/program editors → one cohesive control */
.move-form   { display: inline-flex; align-items: center; gap: 5px; }
.move-select { width: auto; max-width: 168px; padding-top: .4rem; padding-bottom: .4rem; font-size: .86rem; }
.move-go {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0; flex: none;
  border: 1px solid var(--gray-3); border-radius: var(--radius);
  background: #fff; color: var(--gray-5); cursor: pointer; box-shadow: none;
  transition: background .12s, border-color .12s, color .12s;
}
.move-go:hover { background: var(--navy); border-color: var(--navy); color: #fff; }
.move-go svg   { display: block; }

/* Responsive */
@media (max-width: 1280px) {
  .nav-inner { padding: 0 1rem !important; gap: .8rem !important; }
  .navlink { padding: .38rem .65rem; font-size: .88rem; }
  .ws-label { max-width: 90px; }
}
@media (max-width: 980px) {
  .sidenav { width: 64px; padding: 1.2rem .35rem; }
  .sidenav-heading, .sidelink span:not(.sidelink-icon), .sidenav-footer { display: none; }
  .sidelink { justify-content: center; padding: .55rem .35rem; }
  .sidelink-icon { width: auto; font-size: 1.1rem; }
  .ws-label { max-width: 60px; }
  .navlink { padding: .35rem .55rem; font-size: .85rem; }
}

/* ====== Global page padding for inner pages (sidebar layout) ====== */
.with-sidenav-pad, main.page.with-sidenav {
  padding: 24px 28px 40px !important;
  max-width: 1380px;
  margin: 0 auto;
  box-sizing: border-box;
}
@media (max-width: 900px) {
  main.page.with-sidenav { padding: 16px 14px 32px !important; }
}

/* ============================================================
   Mobile UI fixes (Zeus 2026-05-22) — phone-only, no desktop impact
   ============================================================ */
.m-toggle { display: none !important; }
.m-burger { display: none; }

@media (max-width: 600px) {
  /* --- Top nav: hamburger replaces inline link list --- */
  .nav-inner { flex-wrap: wrap; gap: 0.4rem; padding: 0.5rem 0.75rem !important; }
  .brand-logo { height: 32px !important; }
  .m-burger {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 38px; height: 38px;
    padding: 9px 7px;
    background: transparent;
    border: 1px solid var(--gray-2, #e8e2d5);
    border-radius: 8px;
    cursor: pointer;
    margin-left: auto;
    order: 2;
  }
  .m-burger span {
    display: block;
    height: 2px;
    background: var(--ink, #0A2C54);
    border-radius: 2px;
    transition: transform 0.18s, opacity 0.18s;
  }
  .m-toggle:checked ~ .m-burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .m-toggle:checked ~ .m-burger span:nth-child(2) { opacity: 0; }
  .m-toggle:checked ~ .m-burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  .nav-links {
    order: 4;
    width: 100% !important;
    flex-basis: 100% !important;
    flex-direction: column !important;
    gap: 0 !important;
    padding: 0.5rem 0 !important;
    margin: 0.5rem -0.75rem -0.5rem !important;
    border-top: 1px solid var(--gray-2, #e8e2d5);
    background: #fff;
    display: none !important;
  }
  .m-toggle:checked ~ .nav-links { display: flex !important; }
  .nav-links li { width: 100%; }
  .navlink {
    display: block;
    padding: 0.85rem 1rem !important;
    border-radius: 0 !important;
    border-bottom: 1px solid var(--gray-2, #e8e2d5);
    font-size: 1rem !important;
  }
  .navlink.is-active { background: var(--cream, #fdf8ea); }

  .nav-right { order: 3; gap: 0.4rem; }
  .nav-right .ws-label { display: none; }
  .quick-create summary, .workspace-switcher summary, .user-menu summary {
    padding: 0.45rem 0.7rem !important;
    font-size: 0.85rem !important;
  }

  /* --- Email Campaigns dashboard --- */
  .email-list-hdr { flex-direction: column; align-items: stretch; gap: 10px; }
  .email-list-title { font-size: 1.45rem !important; }
  .btn-primary-large { padding: 10px 16px; font-size: 0.92rem; justify-content: center; }

  .email-list-kpis { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
  .elk-tile { padding: 11px 12px; }
  .elk-num { font-size: 1.5rem; }
  .elk-cap { font-size: 0.85rem; }
  .elk-sub { font-size: 0.7rem; }

  .email-tabs { gap: 2px; padding-bottom: 2px; flex-wrap: wrap; overflow-x: auto; }
  .email-tab { padding: 8px 11px; font-size: 0.85rem; flex: 0 0 auto; }
  .email-tab[style*="margin-left:auto"] { margin-left: 0 !important; }

  .email-list-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .email-search { flex: 1 1 auto; }
  .email-filter-chips { gap: 4px; }
  .chip { padding: 4px 9px; font-size: 0.78rem; }

  .campaign-cards { grid-template-columns: 1fr !important; gap: 10px; }
  .camp-card { padding: 14px 16px 16px; }
  .camp-card-hdr { padding-right: 80px; }
  .camp-card-hdr h3 { font-size: 1.05rem; }
  .camp-card-stats { gap: 6px; padding: 10px 0; }
  .cstat-num { font-size: 1.25rem; }
  .cstat-lbl { font-size: 0.65rem; }
  .camp-card-actions { top: 8px; right: 8px; gap: 3px; }
  .btn-icon { width: 32px; height: 32px; font-size: 15px; }

  /* --- Page padding overall --- */
  .dash-page { padding: 1rem 0.75rem !important; }
  main.page.with-sidenav { padding: 1rem 0.75rem 3rem !important; }

  /* --- Data tables (e.g. transactional list) scroll horizontally --- */
  .data-transactional { font-size: 0.85rem; }
  table.data { display: block; overflow-x: auto; white-space: nowrap; }

  /* --- Site footer tighter --- */
  .site-footer { padding: 1rem 0.75rem; font-size: 0.75rem; flex-wrap: wrap; }
}

/* Google Ads nav pill — green pulsing dot signals leads coming in */
.navlink-ga{position:relative}
.ga-dot{display:inline-block;width:8px;height:8px;background:#1a8754;border-radius:50%;margin-right:6px;vertical-align:middle;box-shadow:0 0 0 0 rgba(26,135,84,.6);animation:gaDotPulse 2.2s infinite}
@keyframes gaDotPulse{0%{box-shadow:0 0 0 0 rgba(26,135,84,.6)}70%{box-shadow:0 0 0 8px rgba(26,135,84,0)}100%{box-shadow:0 0 0 0 rgba(26,135,84,0)}}

/* ============================================================
   Mobile audit fixes (2026-05-23) — global lift for all pages
   All inside @media (max-width: 600px) implicit scope below.
   ============================================================ */
@media (max-width: 600px) {

  /* Tables: card-style at phone width (every td flows as a row inside a card) */
  table.data, table.data thead, table.data tbody, table.data tr, table.data td {
    display: block; width: 100%;
  }
  table.data thead { display: none; }
  table.data tr {
    border: 1px solid var(--gray-2, #e8e2d5); border-radius: 10px;
    margin-bottom: 0.6rem; padding: 0.7rem 0.9rem; background: #fff;
    box-shadow: 0 1px 2px rgba(10,44,84,.04);
  }
  table.data td {
    border: 0; padding: 0.3rem 0; white-space: normal;
    display: flex; justify-content: space-between; gap: 1rem;
    font-size: 0.88rem;
  }
  table.data td::before {
    content: attr(data-label); font-size: 0.7rem;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--gray-5, #6b7685); font-weight: 600;
    white-space: nowrap;
  }
  /* Fallback for tables that lack data-label — keep them scrollable */
  table.data:not(:has(td[data-label])) {
    display: table; width: 100%;
  }
  table.data:not(:has(td[data-label])) thead { display: table-header-group; }
  table.data:not(:has(td[data-label])) tr { display: table-row; padding: 0; }
  table.data:not(:has(td[data-label])) td {
    display: table-cell; white-space: nowrap; padding: 0.5rem 0.75rem;
  }
  table.data:not(:has(td[data-label])) td::before { content: none; }

  /* Wrap table in horizontal-scroll container at phone width if not already */
  .card > table.data, main.page > table.data {
    overflow-x: auto; display: block;
  }

  /* Kanban: snap-scroll cleanly */
  .kanban { margin: 0 -0.75rem; padding: 0 0.75rem; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
  .kanban-col { flex: 0 0 88vw; max-width: 340px; scroll-snap-align: start; }

  /* Page heads: wrap action buttons */
  .page-head, .head-actions { flex-wrap: wrap !important; }
  .head-actions { width: 100%; gap: 0.5rem; }
  .head-actions .btn, .page-head .btn { min-height: 44px; padding: 0.7rem 1rem; flex: 1 1 auto; }
  .page-head [style*="display:flex"], .page-head [style*="display: flex"] { flex-wrap: wrap !important; gap: 0.5rem !important; width: 100%; }
  .page-head [style*="display:flex"] .btn, .page-head [style*="display: flex"] .btn { flex: 1 1 auto; }

  /* Filters bar */
  .filters { gap: 0.45rem; flex-wrap: wrap; }
  .filters input[type="search"], .filters input[type="text"] { flex: 1 1 100%; min-width: 0; min-height: 42px; }
  .filters select, .filters .chip { flex: 1 1 calc(50% - 0.25rem); min-width: 0; min-height: 38px; }

  /* KPI grid */
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .kpi { padding: 0.9rem 1rem; }
  .kpi-value, .kpi-num { font-size: 1.65rem; }

  /* Workflow steps */
  .workflow-step { flex-wrap: wrap; gap: 0.5rem; }
  .workflow-step .step-num { flex: 0 0 auto; }
  .workflow-step .step-body { flex: 1 1 100%; }
  .step-actions { width: 100%; justify-content: flex-end; }
  .step-actions .btn { min-height: 40px; padding: 0.5rem 0.85rem; }

  /* Inbox cards (no prior mobile CSS — adding from scratch) */
  .inbox-list { display: flex; flex-direction: column; gap: 0.6rem; }
  .inbox-card { background: #fff; border: 1px solid var(--gray-2, #e8e2d5); border-radius: 12px; padding: 1rem; box-shadow: 0 1px 3px rgba(10,44,84,.04); }
  .inbox-card-head { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.6rem; }
  .inbox-card-head h3 { margin: 0; font-size: 1rem; }
  .inbox-card-head .muted { font-size: 0.82rem; }
  .inbox-payload dl, .inbox-payload { margin: 0.4rem 0; }
  .inbox-payload dt { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-5, #6b7685); margin-top: 0.5rem; font-weight: 600; }
  .inbox-payload dd { margin: 0.2rem 0 0; font-size: 0.92rem; line-height: 1.45; }
  .inbox-actions { display: grid; gap: 0.5rem; margin-top: 0.8rem; }
  .inbox-actions select, .inbox-actions input { min-height: 44px; padding: 0.55rem 0.75rem; }
  .inbox-actions .btn { min-height: 44px; }
  .inbox-buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; }
  .inbox-buttons .btn, .inbox-buttons button { flex: 1 1 auto; min-height: 44px; }

  /* Universal touch targets */
  .btn, button.btn-sm, .chip, summary { min-height: 38px; }
  .btn-primary, .btn-primary-large, button[type="submit"] { min-height: 44px; }

  /* Form rows in builders (form_form.php field-row, etc.) */
  .field-row { grid-template-columns: 1fr 1fr !important; gap: 0.5rem; }
  .field-row > * { min-width: 0; }
  .field-remove { min-height: 36px; min-width: 36px; }

  /* Settings grid: 1-col on phone, generous tap targets */
  .settings-grid, .grid-2, .grid-3 { grid-template-columns: 1fr !important; gap: 1rem; }

  /* Embed code block */
  .embed-code { font-size: 0.72rem; padding: 0.7rem 0.8rem; }
  .embed-code-actions { flex-wrap: wrap; gap: 0.5rem; }
  .embed-code-actions .btn { flex: 1 1 auto; }

  /* Modal / pane content padding */
  .pane, .modal { padding: 1rem; max-width: calc(100vw - 1rem) !important; }

  /* Deal / contact detail */
  .contact-detail, .deal-detail { grid-template-columns: 1fr !important; gap: 1rem; }

  /* Forms with side-by-side fields force-stack */
  .form-row, label.inline { flex-wrap: wrap; }

  /* Tabs that don't already wrap */
  .tabs, nav.tabs { flex-wrap: wrap; gap: 0.3rem; }
  .tabs a, nav.tabs a { padding: 0.6rem 0.85rem; font-size: 0.88rem; }
}

/* ============================================================
   Sidebar mobile override (2026-05-23 fix #2)
   Defeats the `display: block !important; width: 240px` override at line ~1222
   ============================================================ */
@media (max-width: 820px) {
  .app-shell { flex-direction: column !important; }
  .sidenav {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    height: auto !important;
    position: static !important;
    border-right: 0 !important;
    border-bottom: 1px solid var(--gray-2, #e8e2c5) !important;
    padding: 0.6rem 0.9rem !important;
    gap: 0.4rem 0.9rem !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
  }
  .sidenav-group { flex-direction: row !important; align-items: center !important; gap: 0.4rem !important; margin-bottom: 0 !important; }
  .sidenav-heading { display: none !important; }
  .sidenav-links { flex-direction: row !important; flex-wrap: nowrap !important; gap: 0.25rem !important; }
  .sidelink { padding: 0.4rem 0.7rem !important; font-size: 0.85rem !important; white-space: nowrap !important; }
  .sidenav-footer { display: none !important; }
  main.page.with-sidenav { padding: 1rem 0.85rem 2.5rem !important; }
}

@media (max-width: 600px) {
  /* On true phone width — hide sidebar entirely. Hamburger nav covers everything. */
  .sidenav { display: none !important; }
  main.page.with-sidenav { padding: 0.9rem 0.75rem 2.5rem !important; }

  /* Force email_show recipients/links tables to card-style at phone width (beat any inline overrides) */
  .data-recipients, .data-links {
    display: block !important; width: 100% !important;
  }
  .data-recipients thead, .data-links thead { display: none !important; }
  .data-recipients tbody, .data-links tbody { display: block !important; width: 100% !important; }
  .data-recipients tr, .data-links tr {
    display: block !important;
    border: 1px solid #e8e2d5 !important;
    border-radius: 10px !important;
    margin: 0 0 0.6rem 0 !important;
    padding: 0.7rem 0.85rem !important;
    background: #fff !important;
    box-shadow: 0 1px 2px rgba(10,44,84,.04) !important;
  }
  .data-recipients td, .data-links td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 0.8rem !important;
    padding: 0.3rem 0 !important;
    border: 0 !important;
    border-bottom: 0 !important;
    white-space: normal !important;
    font-size: 0.86rem !important;
    word-break: break-word !important;
  }
  .data-recipients td:not(:last-child), .data-links td:not(:last-child) {
    border-bottom: 1px solid #f0ede5 !important;
  }
  .data-recipients td::before, .data-links td::before {
    content: attr(data-label);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7685;
    font-weight: 600;
    white-space: nowrap;
    flex: 0 0 auto;
  }
  /* If td has no data-label, hide the empty pseudo-label */
  .data-recipients td:not([data-label])::before, .data-links td:not([data-label])::before { display: none; }

  /* Make sure the table parent isn't a horizontal-overflow trap */
  main.page table, main.page .card { overflow: visible !important; }
}
