﻿/* MasGenCRM — Light theme (warm cream + terracotta) */
:root {
  /* Surfaces — warm cream stack */
  --bg-0: #faf8f1;   /* page background */
  --bg-1: #ffffff;   /* cards */
  --bg-2: #f6f3e8;   /* panels / subtle */
  --bg-3: #efebdc;   /* elevated / hover */
  --bg-4: #e6e0cc;   /* chips / pressed */
  --bg-5: #d9d2b9;
  --border: #e7e1cc;
  --border-strong: #cfc8ad;

  /* Type — warm near-black */
  --text:   #2a2925;
  --text-2: #56544c;
  --text-3: #7d7969;
  --text-4: #a8a48c;

  /* Accent — terracotta (Claude-style) */
  --amber:        oklch(0.66 0.13 38);   /* primary */
  --amber-2:      oklch(0.58 0.15 32);   /* hover / gradient deep */
  --amber-3:      oklch(0.50 0.16 28);   /* darkest */
  --amber-soft:   oklch(0.66 0.13 38 / 0.12);
  --amber-line:   oklch(0.66 0.13 38 / 0.35);

  /* Status — slightly desaturated for light surfaces */
  --emerald:      oklch(0.56 0.13 155);
  --emerald-soft: oklch(0.56 0.13 155 / 0.14);
  --rose:         oklch(0.58 0.18 20);
  --rose-soft:    oklch(0.58 0.18 20 / 0.12);
  --sky:          oklch(0.60 0.12 235);
  --sky-soft:     oklch(0.60 0.12 235 / 0.14);
  --violet:       oklch(0.55 0.14 295);
  --violet-soft:  oklch(0.55 0.14 295 / 0.14);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-1: 0 1px 0 rgba(255,255,255,0.6) inset, 0 1px 2px rgba(60, 50, 30, 0.04);
  --shadow-2: 0 18px 50px -20px rgba(60, 50, 30, 0.18), 0 1px 0 rgba(255,255,255,0.5) inset;
  --shadow-amber: 0 8px 24px -10px oklch(0.58 0.15 32 / 0.45);

  --font-sans: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg-0);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; color: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d9d2b9; border-radius: 10px; border: 2px solid var(--bg-0); }
::-webkit-scrollbar-thumb:hover { background: #c8c09e; }

/* â”€â”€â”€â”€â”€â”€â”€â”€â”€ App Shell â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  grid-template-rows: 56px 1fr;
  grid-template-areas:
    "side top"
    "side main";
  height: 100vh;
  background:
    radial-gradient(1200px 600px at 80% -10%, oklch(0.66 0.13 38 / 0.07), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, oklch(0.50 0.16 28 / 0.05), transparent 60%),
    var(--bg-0);
}

/* Sidebar */
.sidebar {
  grid-area: side;
  background: linear-gradient(180deg, var(--bg-2), #f1ecda);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  height: 56px;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(140deg, var(--amber) 0%, var(--amber-3) 100%);
  display: grid; place-items: center;
  box-shadow: 0 6px 18px -8px oklch(0.58 0.15 32 / 0.55);
  font-weight: 800; color: #fff;
  font-size: 13px;
  letter-spacing: -0.02em;
}
.brand-name { font-weight: 700; letter-spacing: -0.01em; font-size: 15px; }
.brand-sub { color: var(--text-4); font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }

.nav-section { padding: 14px 12px 6px; }
.nav-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-4);
  padding: 0 10px 8px;
}
.nav-list { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  background: transparent;
  border: 0;
  text-align: left;
  width: 100%;
  position: relative;
  transition: background 120ms, color 120ms;
}
.nav-item:hover { background: var(--bg-3); color: var(--text); }
.nav-item.active {
  background: linear-gradient(90deg, var(--amber-soft), transparent);
  color: var(--text);
  font-weight: 600;
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--amber);
  border-radius: 0 3px 3px 0;
}
.nav-item .ico { width: 18px; display: grid; place-items: center; color: var(--text-3); }
.nav-item.active .ico { color: var(--amber); }
.nav-item .badge {
  margin-left: auto;
  font-size: 10.5px;
  background: var(--bg-4);
  color: var(--text-2);
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 600;
  font-family: var(--font-mono);
}
.nav-item.active .badge { background: var(--amber-soft); color: var(--amber); }

.sidebar-scroll { flex: 1; overflow: auto; padding-bottom: 12px; }

/* Expandable submenus (nav items whose main menu has multiple routes) */
.nav-item .nav-caret { margin-inline-start: auto; color: var(--text-4); display: inline-grid; place-items: center; }
.nav-item.active .nav-caret { color: var(--amber); }
.nav-sublist { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 6px; padding-inline-start: 34px; }
.nav-subitem {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 500;
  background: transparent;
  border: 0;
  text-align: start;
  width: 100%;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.nav-subitem:hover { background: var(--bg-3); color: var(--text); }
.nav-subitem.active {
  color: var(--text);
  font-weight: 600;
  background: linear-gradient(90deg, var(--amber-soft), transparent);
}

.workspace {
  margin: 12px;
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-1);
  display: flex;
  align-items: center;
  gap: 10px;
}
.workspace-name { font-size: 13px; font-weight: 600; }
.workspace-plan { font-size: 11px; color: var(--text-3); }

/* Logout card — same shell as .workspace (reuses that class), sits directly BELOW the
   MasGen Arabia panel, pinned at the bottom. Uses the PRIMARY action style (amber
   gradient + white text) so it reads as the app's primary button, matching New Lead/Save. */
.logout-card {
  margin-top: 0;                 /* override .workspace margin-top:auto so it hugs the panel above */
  width: auto;
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  text-align: start;
  cursor: pointer;
  gap: 12px;
  background: linear-gradient(180deg, var(--amber), var(--amber-2));
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-amber);
  transition: filter 120ms, transform 80ms;
}
.logout-card:hover { filter: brightness(1.05); }
.logout-card:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.logout-card:active { transform: translateY(1px); }
.logout-card .logout-ico { display: inline-grid; place-items: center; color: #fff; }
/* Specificity guard: `.workspace` (shared shell) also sets a background; this ensures the
   primary-gradient (same token as the Sign In button / .btn.primary) always wins. */
.sidebar .logout-card { background: linear-gradient(180deg, var(--amber), var(--amber-2)); color: #fff; }
.sidebar .logout-card .logout-ico,
.sidebar .logout-card .logout-lbl { color: #fff; }
.logout-card .logout-lbl { flex: 1; min-width: 0; }

/* Topbar */
.topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(250, 248, 241, 0.8);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 5;
}
.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-3);
}
.crumb .here { color: var(--text); font-weight: 600; }

.search {
  flex: 1;
  max-width: 540px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-3);
  font-size: 13px;
}
.search input {
  background: transparent;
  border: 0;
  outline: 0;
  flex: 1;
  color: var(--text);
  font-size: 13px;
}
.search input::placeholder { color: var(--text-3); }
.search kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-3);
  color: var(--text-3);
  border: 1px solid var(--border);
}
.top-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-2);
  position: relative;
}
.icon-btn:hover { background: var(--bg-3); color: var(--text); border-color: var(--border); }
.icon-btn .dot {
  position: absolute; top: 7px; right: 8px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 2px var(--bg-0);
}

.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, oklch(0.66 0.13 38), oklch(0.50 0.16 28));
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }
.avatar.sm { width: 22px; height: 22px; font-size: 9.5px; }
.avatar.ring { box-shadow: 0 0 0 2px var(--bg-1), 0 0 0 3px var(--border); }

/* Main content */
.main { grid-area: main; overflow: auto; min-height: 0; }
.page {
  padding: 22px 28px 60px;
  max-width: 1600px;
  margin: 0 auto;
}
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}
.page-sub { color: var(--text-3); font-size: 13px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-1);
  color: var(--text);
  transition: background 120ms, border-color 120ms, transform 80ms;
}
.btn:hover { background: var(--bg-3); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, var(--amber), var(--amber-2));
  color: #fff;
  border-color: transparent;
  box-shadow: var(--shadow-amber);
}
.btn.primary:hover { filter: brightness(1.05); background: linear-gradient(180deg, var(--amber), var(--amber-2)); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--bg-3); color: var(--text); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn.lg { padding: 11px 18px; font-size: 14px; }
.btn.danger { color: var(--rose); }
.btn.danger:hover { background: var(--rose-soft); border-color: transparent; }

/* Card */
.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.card .head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card .head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.card .head .sub { font-size: 12px; color: var(--text-3); }
.card .body { padding: 18px; }

/* Pills / Badges */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--bg-3);
  color: var(--text-2);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.amber { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.pill.emerald { background: var(--emerald-soft); color: var(--emerald); border-color: transparent; }
.pill.rose { background: var(--rose-soft); color: var(--rose); border-color: transparent; }
.pill.sky { background: var(--sky-soft); color: var(--sky); border-color: transparent; }
.pill.violet { background: var(--violet-soft); color: var(--violet); border-color: transparent; }

/* KPI tile */
.kpi {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.kpi .label { font-size: 12px; color: var(--text-3); font-weight: 500; }
.kpi .value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 6px;
}
.kpi .delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--emerald);
  margin-top: 4px;
}
.kpi .delta.down { color: var(--rose); }
.kpi .spark { position: absolute; right: 14px; bottom: 12px; opacity: 0.9; }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: 12px 14px; font-size: 13px; }
.tbl thead th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  position: sticky; top: 0; z-index: 1;
}
.tbl tbody tr { border-bottom: 1px solid var(--border); transition: background 80ms; }
.tbl tbody tr:hover { background: var(--bg-2); }
.tbl tbody tr:last-child { border-bottom: 0; }
.tbl .check { width: 30px; }
.tbl .num { font-family: var(--font-mono); }

.checkbox {
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-1);
  display: inline-grid; place-items: center;
}
.checkbox.on { background: var(--amber); border-color: var(--amber); color: #fff; }

/* Form controls */
.input {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  outline: 0;
  transition: border-color 120ms, background 120ms, box-shadow 120ms;
}
.input:focus { border-color: var(--amber-line); box-shadow: 0 0 0 3px var(--amber-soft); }
.input::placeholder { color: var(--text-3); }
.label {
  font-size: 11.5px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  display: block;
  margin-bottom: 6px;
}

/* Misc utilities */
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.between { justify-content: space-between; }
.muted { color: var(--text-3); }
.mono { font-family: var(--font-mono); }
.divider { height: 1px; background: var(--border); border: 0; margin: 0; }

/* Funnel-specific */
.funnel-wrap {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 18px;
}
.funnel-stages { display: flex; flex-direction: column; gap: 10px; }
.stage-row {
  display: grid;
  grid-template-columns: 28px 1fr 220px 130px 130px 110px;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 120ms, background 120ms;
  cursor: pointer;
}
.stage-row:hover { border-color: var(--border-strong); }
.stage-row.active { border-color: var(--amber-line); background: linear-gradient(90deg, var(--amber-soft), var(--bg-1) 30%); }
.stage-idx {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-3);
  color: var(--text-2);
}
.stage-row.active .stage-idx { background: var(--amber); color: #fff; }
.stage-name { font-weight: 600; font-size: 14px; }
.stage-meta { color: var(--text-3); font-size: 11.5px; margin-top: 2px; }
.stage-bar {
  height: 8px;
  background: var(--bg-3);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.stage-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--amber-3), var(--amber));
}
.stage-stat { display: flex; flex-direction: column; }
.stage-stat .lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-4); font-weight: 700; }
.stage-stat .val { font-family: var(--font-mono); font-size: 14px; font-weight: 600; }
.stage-conv { display: flex; flex-direction: column; align-items: flex-end; }
.stage-conv .pct { font-family: var(--font-mono); font-size: 16px; font-weight: 600; }
.stage-conv.warn .pct { color: var(--rose); }
.stage-conv.ok .pct { color: var(--emerald); }

/* Funnel shape (visual SVG) */
.funnel-visual {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-1);
}

/* Kanban (Deals) */
.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.board-col {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  min-height: 460px;
}
.board-col .head {
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.board-col .head .name { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.board-col .head .count { font-family: var(--font-mono); font-size: 12px; color: var(--text-3); }
.board-col .body { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.deal-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  transition: border-color 120ms, transform 100ms, box-shadow 120ms;
  cursor: grab;
  box-shadow: var(--shadow-1);
}
.deal-card:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: 0 6px 16px -8px rgba(60,50,30,0.18); }
.deal-card .co { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.deal-card .title { font-size: 14px; font-weight: 600; margin: 6px 0 8px; letter-spacing: -0.01em; }
.deal-card .meta { display: flex; align-items: center; gap: 10px; font-size: 11.5px; color: var(--text-3); }
.deal-card .amt { font-family: var(--font-mono); font-weight: 700; color: var(--text); }

.co-tile {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--bg-3);
  display: grid; place-items: center;
  font-size: 10px; font-weight: 700;
  color: var(--text-2);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* Inbox */
.inbox {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  height: calc(100vh - 56px - 44px - 60px);
  min-height: 540px;
}
.inbox-list {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-1);
}
.inbox-list .head { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.inbox-list .items { overflow: auto; flex: 1; }
.thread {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 100ms;
}
.thread:hover { background: var(--bg-2); }
.thread.active { background: linear-gradient(90deg, var(--amber-soft), transparent); }
.thread .name { font-size: 13px; font-weight: 600; display: flex; gap: 6px; align-items: center; }
.thread .preview { font-size: 12px; color: var(--text-3); margin-top: 2px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread .time { font-size: 11px; color: var(--text-3); font-family: var(--font-mono); }
.thread.unread .name::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); margin-left: 2px; }

.inbox-view {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.inbox-view .head { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.inbox-view .conv { flex: 1; overflow: auto; padding: 20px; background: var(--bg-2); }
.msg-in, .msg-out {
  max-width: 78%;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.55;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}
.msg-in { background: var(--bg-1); border-top-left-radius: 4px; }
.msg-out { background: linear-gradient(180deg, var(--amber-soft), oklch(0.66 0.13 38 / 0.05)); border-color: var(--amber-line); margin-left: auto; border-top-right-radius: 4px; }
.msg-meta { font-size: 11px; color: var(--text-3); margin-bottom: 4px; display: flex; gap: 8px; }

.composer {
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-1);
}
.composer .input { flex: 1; }

/* Activities calendar */
.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-1);
}
.cal-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--text-3);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.cal-cell {
  min-height: 110px;
  padding: 8px 10px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
  background: var(--bg-1);
}
.cal-cell .d { font-size: 12px; font-weight: 600; color: var(--text-2); font-family: var(--font-mono); }
.cal-cell.today .d { color: var(--amber); }
.cal-cell.faded { background: var(--bg-2); }
.cal-cell.faded .d { color: var(--text-4); }
.evt {
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 5px;
  border-left: 2px solid var(--amber);
  background: var(--bg-2);
  color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.evt.sky { border-color: var(--sky); }
.evt.emerald { border-color: var(--emerald); }
.evt.violet { border-color: var(--violet); }
.evt.rose { border-color: var(--rose); }

/* AI */
.ai-card {
  background:
    radial-gradient(600px 200px at 100% 0%, oklch(0.66 0.13 38 / 0.10), transparent 60%),
    linear-gradient(180deg, var(--bg-1), #faf6e9);
  border: 1px solid var(--amber-line);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow-1);
}
.ai-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid var(--amber-line);
}

/* Responsive */
@media (max-width: 1100px) {
  .funnel-wrap { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 64px 1fr; }
  .brand-name, .brand-sub, .nav-label, .nav-item span.lbl, .nav-item .badge, .workspace-name, .workspace-plan, .logout-lbl { display: none; }
  .nav-item { justify-content: center; padding: 10px; }
  .brand { padding: 12px; justify-content: center; }
  .brand-mark { margin: 0; }
  .workspace { justify-content: center; }
  .search { display: none; }
  .stage-row { grid-template-columns: 28px 1fr 140px 110px; }
  .stage-row .stage-stat.hide-sm { display: none; }
  .inbox { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .inbox-list { max-height: 320px; }
}
@media (max-width: 640px) {
  .page { padding: 16px; }
  .page-header { flex-direction: column; align-items: flex-start; }
}

/* Smooth fade for screen swaps */
.screen-enter { animation: fade 200ms ease both; }
@keyframes fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ RTL / Arabic â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
body.lang-ar {
  font-family: "IBM Plex Sans Arabic", "Manrope", ui-sans-serif, system-ui, sans-serif;
}
body.lang-ar .mono { font-family: "JetBrains Mono", "IBM Plex Sans Arabic", monospace; }

[dir="rtl"] .nav-item.active::before {
  left: auto;
  right: -12px;
  border-radius: 3px 0 0 3px;
}
/* Flip directional chevrons used as visual arrows in nav/back/forward — but
   NOT chevron-down (which is vertical). The arrowRight/arrowLeft/chevronRight/
   chevronLeft icons are scaled âˆ’1 on x when in RTL. */
[dir="rtl"] .crumb svg,
[dir="rtl"] .btn svg.flip-rtl,
[dir="rtl"] svg.flip-rtl { transform: scaleX(-1); }

/* Nav active-state slim accent bar lives on the LEFT of the sidebar visually,
   but the sidebar itself flips to the right side of the screen. The ::before
   override above moves the accent strip onto the visible inside-edge. */

/* Stage row's grid is already mirrored by browser; conv-label still right-aligns
   numerically. Force LTR on monospace numerics so SAR amounts read normally. */
[dir="rtl"] .mono, [dir="rtl"] .num, [dir="rtl"] .kpi .value, [dir="rtl"] .stage-conv .pct {
  direction: ltr;
  unicode-bidi: embed;
}

/* Search input alignment */
[dir="rtl"] .search input { text-align: right; }

/* Inbox + lead detail drawer should drop in from the LEFT side in RTL */
[dir="rtl"] .lead-drawer { right: auto; left: 0; border-left: 0; border-right: 1px solid var(--border); box-shadow: 30px 0 60px -20px rgba(60,50,30,0.18); }

/* Tab underline alignment for RTL tabs */
[dir="rtl"] .tbl th, [dir="rtl"] .tbl td { text-align: right; }
[dir="rtl"] .tbl .num { text-align: left; }

/* Conversation bubbles flip side */
[dir="rtl"] .msg-out { border-top-right-radius: 12px; border-top-left-radius: 4px; margin-left: 0; margin-right: auto; }
[dir="rtl"] .msg-in  { border-top-left-radius: 12px; border-top-right-radius: 4px; }

/* Calendar day numbers stay aligned to inline-start naturally */
[dir="rtl"] .evt { border-left: 0; border-right: 2px solid var(--amber); }
[dir="rtl"] .evt.sky { border-right-color: var(--sky); }
[dir="rtl"] .evt.emerald { border-right-color: var(--emerald); }
[dir="rtl"] .evt.violet { border-right-color: var(--violet); }
[dir="rtl"] .evt.rose { border-right-color: var(--rose); }
[dir="rtl"] .cal-cell { border-right: 0; border-left: 1px solid var(--border); border-bottom: 1px solid var(--border); }

/* Sidebar border flips */
[dir="rtl"] .sidebar { border-right: 0; border-left: 1px solid var(--border); }

/* Brand mark: a single Latin "M" reads better LTR even when page is RTL */
.brand-mark { direction: ltr; }

/* Lang switch pill */
.lang-switch {
  display: inline-flex;
  padding: 3px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 9px;
  gap: 2px;
}
.lang-switch button {
  border: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--text-3);
  cursor: pointer;
  font-family: var(--font-sans);
}
.lang-switch button.on {
  background: var(--bg-3);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset;
}
.lang-switch button[data-l="ar"] { font-family: "IBM Plex Sans Arabic", var(--font-sans); }

/* ───── Conflict overrides for the CRM shell ─────
   Why: NewLayoutStyle.css (legacy HR theme) sets `body { font-family:Cairo Light !important; font-weight:500; }`
   and `.page { background:#f1d3df70 !important; }`; Bootstrap sets `.row > * { width:100%; max-width:100%; ... }`
   for its 12-col grid. Both files are kept for the legacy MainLayout pages, so neutralize them only inside the .app shell. */
.app {
  font-family: var(--font-sans) !important;
  font-weight: 400 !important;
  font-size: 14px !important;
}
.app *:not(svg):not(svg *) {
  font-family: inherit;
}
.app .mono,
.app kbd,
.app .kpi .value,
.app .num,
.app .stage-conv .pct,
.app .stage-stat .val,
.app .stage-idx,
.app .thread .time {
  font-family: var(--font-mono);
}
.app .page,
.app > main,
.app .main {
  background-color: transparent !important;
}
.app .row {
  margin-left: 0;
  margin-right: 0;
  margin-top: 0;
}
.app .row > * {
  width: auto;
  max-width: none;
  flex-shrink: 1;
  padding-left: 0;
  padding-right: 0;
  margin-top: 0;
}

/* ───── Toast alerts (themed for the CRM shell) ─────
   Legacy pages emit .custom-alert markup for success/error toasts; these rules
   previously lived only in the old MainLayout. Re-themed here with design tokens
   so pages moved onto MasGenCRMLayout keep consistent, styled toasts. */
.custom-alert-container {
  position: fixed;
  top: 72px;
  right: 22px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 420px;
}
[dir="rtl"] .custom-alert-container { right: auto; left: 22px; }
.custom-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-1);
  color: var(--text);
  box-shadow: var(--shadow-2);
  animation: fadeInRight 0.35s ease-out both;
}
.custom-alert-success {
  background: var(--emerald-soft);
  color: var(--emerald);
  border-color: transparent;
  border-left: 3px solid var(--emerald);
}
.custom-alert-danger {
  background: var(--rose-soft);
  color: var(--rose);
  border-color: transparent;
  border-left: 3px solid var(--rose);
}
.custom-close-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  line-height: 1;
  color: inherit;
  cursor: pointer;
  padding: 0;
  opacity: 0.7;
}
.custom-close-btn:hover { opacity: 1; }
@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}

