/* ============================================================================
   Update 121: Monday-style look for the whole CRM.
   Loaded LAST (after style.css, chips.css, dashboard.css) so it only re-skins:
   colours, type, spacing and the new left-sidebar shell. No layout logic lives here
   that the JS depends on, so deleting this file brings the old look straight back
   (apart from the sidebar markup in index.html).
   Palette (all pass contrast with their text colour):
     blue  #0073EA (primary)   green #00854D   red #D2304A   orange #FDAB3D (dark text)
     purple #401694            violet #7E4FD8  grey #C3C6D4
   ============================================================================ */
/* Figtree (SIL Open Font License), served from /fonts so the CSP stays 'self'-only. */
@font-face { font-family: Figtree; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/figtree-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: Figtree; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/figtree-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: Figtree; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/figtree-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: Figtree; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/figtree-latin-700-normal.woff2') format('woff2'); }

:root {
  --green: #0073EA;        /* primary action colour (kept the old name so every existing rule follows) */
  --green-dark: #0060B9;
  --bg: #F6F7FB;
  --card: #FFFFFF;
  --text: #323338;
  --muted: #676879;
  --border: #E6E9EF;
  --ff-blue: #0073EA;
  --ff-green: #00854D;
  --ff-red: #D2304A;
  --ff-orange: #FDAB3D;
  --ff-purple: #401694;
  --ff-violet: #7E4FD8;
  --ff-active: #DCE9FC;
  --ff-hover: #F0F2F7;
  --ff-sidebar-w: 252px;
}
body {
  font-family: Figtree, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Login ---------- */
.login-wrap { background: var(--bg); }
.login-card { border: none; border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,0.08); }
.login-card input { border: 1px solid #C3C6D4; border-radius: 4px; }
.login-card button { border-radius: 4px; background: var(--ff-blue); }
.login-card button:hover { background: var(--green-dark); }

/* ---------- Shell: sidebar + main ---------- */
/* style.css sets overflow-x: hidden on html/body, which stops position: sticky working;
   clip keeps the same "never scroll sideways" safety net without that side effect. */
html, body { overflow-x: clip; }
#app-screen { display: block; min-height: 100vh; }
.ff-sidebar {
  width: var(--ff-sidebar-w);
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 1500; overflow-y: auto;
  background: #FFFFFF; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 12px 14px; box-sizing: border-box;
}
.ff-brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 18px; }
.ff-brand img { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.ff-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.ff-brand-text strong { font-size: 16px; font-weight: 700; }
.ff-brand-text span { font-size: 12px; color: var(--muted); }
.ff-side-label {
  font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.6px; padding: 4px 10px 8px;
}
.ff-nav { display: flex; flex-direction: column; gap: 2px; }
.ff-nav-row { display: flex; align-items: center; border-radius: 6px; }
.ff-nav-row:hover { background: var(--ff-hover); }
.ff-nav .tab {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px;
  min-height: 42px; padding: 0 10px; border: none; border-radius: 6px;
  color: var(--text); text-decoration: none; font-size: 15px; font-weight: 500;
  white-space: nowrap; cursor: pointer; box-sizing: border-box;
}
.ff-nav .tab .ff-nav-label { overflow: hidden; text-overflow: ellipsis; }
.ff-nav .tab.tab-group::after { content: none; }
.ff-nav .tab.active { background: var(--ff-active); color: #0B4F96; font-weight: 600; }
.ff-nav .tab.in-group:not(.active) { color: #0B4F96; }
.ff-nav-icon { flex-shrink: 0; }
.ff-nav-chev {
  width: 36px; height: 36px; flex-shrink: 0; border: none; background: transparent;
  color: var(--muted); cursor: pointer; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.ff-nav-chev:hover { background: #E6E9EF; color: var(--text); }
.ff-nav-chev svg { transition: transform .15s; }
.ff-nav-row.open .ff-nav-chev svg { transform: rotate(90deg); }
.ff-nav-subs { display: none; flex-direction: column; gap: 1px; padding: 2px 0 6px 20px; }
.ff-nav-subs.open { display: flex; }
.ff-nav .subtab { min-height: 38px; font-size: 14px; font-weight: 400; gap: 10px; }
.ff-nav .subtab:hover { background: var(--ff-hover); }
.ff-nav .subtab.active { background: var(--ff-active); color: #0B4F96; font-weight: 600; }
.ff-nav-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.ff-nav .tab .tab-badge { margin-left: auto; }
.ff-side-foot {
  margin-top: auto; padding: 14px 8px 0; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
}
.ff-side-foot .who { font-size: 13px; font-weight: 600; color: var(--text); }
.ff-logout {
  border: 1px solid #C3C6D4; background: #FFFFFF; color: var(--text); border-radius: 4px;
  padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer;
}
.ff-logout:hover { background: var(--ff-hover); }

.ff-main { margin-left: var(--ff-sidebar-w); min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.ff-backdrop { display: none; }
.ff-menu-btn {
  display: none; width: 40px; height: 40px; border-radius: 6px; flex-shrink: 0;
  border: 1px solid #C3C6D4 !important; background: #FFFFFF !important; color: var(--text) !important;
  align-items: center; justify-content: center; padding: 0 !important;
}

/* ---------- Top bar (search + New Contact) ---------- */
.app-header {
  background: #FFFFFF; color: var(--text); padding: 12px 28px;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100;
}
.header-search-wrap { max-width: 440px; }
.header-search-wrap input {
  border: 1px solid #C3C6D4; border-radius: 4px; padding: 9px 12px; font-size: 14px; font-family: inherit;
}
.header-search-wrap input:focus { outline: 2px solid var(--ff-blue); outline-offset: -1px; border-color: transparent; }
.app-header .header-actions button, .app-header > .header-actions button {
  background: var(--ff-blue); border-radius: 4px; padding: 9px 16px; font-size: 14px; font-weight: 500; font-family: inherit;
}
.app-header .header-actions button:hover { background: var(--green-dark); }

.content { padding: 24px 28px 48px; max-width: 1480px; width: 100%; box-sizing: border-box; }

/* ---------- Buttons & inputs ---------- */
.btn {
  background: var(--ff-blue); border-radius: 4px; padding: 8px 16px; font-size: 14px;
  font-weight: 500; font-family: inherit; line-height: 1.3;
}
.btn:hover { background: var(--green-dark); }
.btn.secondary { background: #FFFFFF; color: var(--text); border: 1px solid #C3C6D4; }
.btn.secondary:hover { background: var(--ff-hover); }
select, textarea, input[type=text], input[type=number], input[type=email], input[type=password], input[type=date] {
  border-color: #C3C6D4; border-radius: 4px; font-family: inherit;
}
select:focus, textarea:focus, input[type=text]:focus, input[type=number]:focus, input[type=email]:focus, input[type=date]:focus {
  outline: 2px solid var(--ff-blue); outline-offset: -1px;
}
.icon-btn { border-color: #C3C6D4; color: var(--muted); border-radius: 4px; }
.icon-btn:hover { background: var(--ff-blue); border-color: var(--ff-blue); color: #FFFFFF; }
.icon-btn.danger { border-color: #F2B8C2; color: var(--ff-red); }
.icon-btn.danger:hover { background: var(--ff-red); border-color: var(--ff-red); color: #FFFFFF; }

/* ---------- Cards & boards (Monday "groups") ---------- */
.card {
  border: none; border-radius: 8px; padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.02);
}
.card { scroll-margin-top: 84px; } /* sidebar jumps (Sample/Quote Requests) land below the sticky top bar */
.card h3 { font-size: 17px; font-weight: 600; }
.segment-row {
  border: none; border-left: 6px solid var(--seg, #C3C6D4); border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06); padding: 14px 16px;
}
.segment-row h3 { font-size: 16px; font-weight: 600; }
.segment-row h3 .seg-name { gap: 8px; }
.segment-row h3 .dot { width: 10px; height: 10px; border-radius: 3px; }
.segment-row.dragover { outline-color: var(--ff-blue); }
.board-toggle { color: var(--muted); }

/* Contact chips: white "items" on the board */
.contact-chip, .inv-chip {
  background: #FFFFFF; border: 1px solid var(--border); border-radius: 8px;
  transition: box-shadow .12s, border-color .12s;
}
.contact-chip:hover, .inv-chip:hover { border-color: #C3C6D4; box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.contact-chip.custom-domain-chip { border-bottom: 3px solid var(--ff-blue); }
.priority-dot { width: 12px; height: 12px; border: none; }

/* Inventory status badges -> Monday status colours */
.inv-chip .chip-badge { border-radius: 4px; font-size: 10px; padding: 3px 7px; }
.inv-chip .chip-badge.badge-low-stock { background: var(--ff-red); }
.inv-chip .chip-badge.badge-on-order { background: var(--ff-blue); }
.inv-chip .chip-badge.badge-not-selling { background: var(--ff-orange); color: #3A2300; }
.inv-chip .chip-badge.badge-hero { background: var(--ff-purple); }
.inv-chip .chip-badge.badge-oversold { background: #8B1A2E; }
.inv-chip.fast-seller { background: #E5F6EE; }
.inv-order-board { border: 2px dashed #A8C8F5; border-radius: 8px; }

/* Red count badges */
.tab-badge { background: var(--ff-red); min-width: 20px; height: 20px; font-size: 11.5px; }

/* Needs Attention dashboard tiles */
.att-tile { border: none; border-left: 6px solid var(--tc); border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); padding: 12px 14px; }
.att-tile-name { color: var(--text); font-size: 13px; }
.att-tile-num { color: var(--text); font-size: 26px; }

/* Wholesale Management cards: coloured title strip per function */
.wm-card { border-top: 6px solid var(--ff-blue); }
#tab-wholesale .wm-card:has(#wm-quotes) { border-top-color: var(--ff-violet); }
#tab-wholesale .wm-card:has(#wm-samples) { border-top-color: var(--ff-orange); }

/* Modals */
.modal-overlay { background: rgba(41, 47, 76, 0.55); }
.modal-box { border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,0.25); }

/* ---------- Settings: Export / Connections / Tier 2 / Tier 3 ---------- */
.ff-settings-section { margin-bottom: 28px; }
.ff-settings-head {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; margin-bottom: 12px; border-radius: 8px; color: #FFFFFF;
}
.ff-settings-head h2 { margin: 0; font-size: 18px; font-weight: 700; }
.ff-settings-head p { margin: 0; font-size: 13px; opacity: 0.95; }
.ff-settings-section[data-section="export"] .ff-settings-head { background: var(--ff-blue); }
.ff-settings-section[data-section="connections"] .ff-settings-head { background: var(--ff-green); }
.ff-settings-section[data-section="tier2"] .ff-settings-head { background: var(--ff-orange); color: #3A2300; }
.ff-settings-section[data-section="tier3"] .ff-settings-head { background: var(--ff-red); }

/* ---------- Phone / tablet: sidebar slides in from the left ---------- */
@media (max-width: 900px) {
  .ff-main { margin-left: 0; }
  .ff-sidebar {
    transform: translateX(-105%); transition: transform .2s ease;
    box-shadow: 0 0 30px rgba(0,0,0,0.2);
  }
  body.ff-nav-open .ff-sidebar { transform: none; }
  body.ff-nav-open .ff-backdrop { display: block; position: fixed; inset: 0; background: rgba(41,47,76,0.45); z-index: 1400; }
  .ff-menu-btn { display: inline-flex; }
  .app-header { padding: 10px 14px; flex-wrap: nowrap; }
  .header-search-wrap { min-width: 0; }
  .content { padding: 16px 12px 40px; }
}
