:root {
  /* Rabah brand */
  --brand-blue: #1e448d; --brand-lime: #89c541; --brand-green: #08723c; --brand-black: #000000;
  --ink: var(--brand-black); --ink-2: #26344f; --paper: #f2f5f9; --panel: #ffffff; --line: #d8dfe9;
  --muted: #5a6475; --route: var(--brand-blue); --route-soft: #e4ebf7; --beacon: var(--brand-lime); --moss: var(--brand-green); --brick: #b3402c;
  --radius: 6px;
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14.5px; line-height: 1.55; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
a { color: var(--route); }
:focus-visible { outline: 3px solid var(--brand-lime); outline-offset: 2px; }

.side { background: var(--brand-blue); color: #dce5f5; padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.beacon { width: 11px; height: 11px; border-radius: 50%; background: var(--beacon); box-shadow: 0 0 0 0 rgba(137,197,65,.6); animation: ping 2.4s ease-out infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(137,197,65,.6); } 70%,100% { box-shadow: 0 0 0 10px rgba(137,197,65,0); } }
@media (prefers-reduced-motion: reduce) { .beacon { animation: none; } }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { color: #dce5f5; text-decoration: none; padding: 8px 10px; border-radius: var(--radius); }
.side nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.side nav a.on { background: rgba(0,0,0,.22); color: #fff; box-shadow: inset 4px 0 0 var(--beacon); font-weight: 600; }
.who { margin-top: auto; font-size: 13px; padding: 0 8px; display: flex; flex-direction: column; gap: 4px; }
.who a { color: #c9d6ee; }

.main { padding: 28px 32px 60px; min-width: 0; }
h1 { font-size: 26px; margin: 0 0 20px; letter-spacing: -.01em; }
h2 { font-size: 18px; margin: 28px 0 10px; }
h3 { font-size: 15px; margin: 18px 0 8px; }
p.hint, .hint { color: var(--muted); font-size: 13px; margin: 4px 0 12px; max-width: 72ch; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
input, select, textarea { font: inherit; font-weight: 400; color: var(--ink); background: #fff; border: 1px solid #bfcac7; border-radius: 4px; padding: 7px 9px; width: 100%; }
textarea { min-height: 140px; resize: vertical; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
.form .wide { grid-column: 1 / -1; }
.chk { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; }
.chk input { width: auto; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 14px; }
.chks { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 18px; }

.btn { display: inline-block; font: inherit; font-weight: 600; font-size: 14px; border: 1px solid var(--route); background: var(--route); color: #fff; padding: 8px 14px; border-radius: 4px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #163569; }
.btn.ghost { background: #fff; color: var(--route); }
.btn.ghost:hover { background: var(--route-soft); }
.btn.warn { background: var(--brick); border-color: var(--brick); }
.btn.go { background: var(--moss); border-color: var(--moss); }
.btn.go:hover { background: #065c30; }
.btn.small { padding: 4px 9px; font-size: 13px; }

table { width: 100%; border-collapse: collapse; background: var(--panel); font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #f6f8fb; }
tr:hover td { background: #fafcfb; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.score { display: inline-block; min-width: 34px; text-align: center; font-weight: 700; border-radius: 3px; padding: 1px 6px; background: #eef1f0; }
.score.hot { background: var(--beacon); color: var(--ink); }
.score.warm { background: #e3f1d0; }

.st { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: #e8ecea; white-space: nowrap; }
.st-interested, .st-demo { background: #e3f1d0; color: #3d6b12; }
.st-pilot, .st-proposal { background: var(--route-soft); color: var(--route); }
.st-won { background: #d3ecdd; color: var(--moss); }
.st-lost { background: #f3dcd7; color: var(--brick); }

.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; background: #e6f3d6; border: 1px solid #bfdd98; }
.flash.err { background: #f7e1dc; border-color: #e6bcb2; }
.flash.warn { background: #fdf1d2; border-color: #f0d68c; }

/* Dashboard pipeline drawn as a route with stops */
.route { display: grid; grid-template-columns: repeat(8, 1fr); position: relative; padding: 26px 0 6px; }
.route::before { content: ""; position: absolute; left: 6%; right: 6%; top: 37px; height: 4px; background: repeating-linear-gradient(90deg, var(--route) 0 14px, transparent 14px 22px); }
.stop.has .dot { border-color: var(--moss); }
.stop { text-align: center; position: relative; text-decoration: none; color: var(--ink); }
.stop .dot { width: 26px; height: 26px; margin: 0 auto 8px; border-radius: 50%; background: #fff; border: 4px solid var(--route); position: relative; }
.stop.has .dot { background: var(--beacon); }
.stop b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stop span { font-size: 12px; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 13px; color: var(--muted); }

.variant { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; background: #fbfcfc; }
.variant textarea { min-height: 120px; }
.pill { font-size: 12px; background: var(--route-soft); color: var(--route); padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.timeline li small { color: var(--muted); display: block; }
code, pre { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; background: #eef2f1; border-radius: 3px; padding: 1px 4px; }
pre { padding: 10px; overflow-x: auto; white-space: pre-wrap; }

.auth { grid-template-columns: 1fr; place-items: center; }
.auth .panel { width: min(400px, 92vw); }

@media (max-width: 820px) {
  body { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .who { margin: 0; flex-direction: row; }
  .main { padding: 20px 14px 50px; }
  .route { grid-template-columns: repeat(4, 1fr); row-gap: 18px; }
  .route::before { display: none; }
}

/* Logo */
.brand { flex-wrap: wrap; }
.logo-tile { background: #fff; border-radius: 6px; padding: 6px 8px; display: inline-flex; max-width: 150px; }
.logo-tile img { max-height: 34px; max-width: 134px; display: block; }
.auth-logo { max-height: 60px; max-width: 220px; display: block; margin-bottom: 10px; }
.logo-preview { border: 1px dashed var(--line); border-radius: var(--radius); padding: 18px; min-height: 90px; display: grid; place-items: center; background: repeating-conic-gradient(#f3f5f8 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.logo-preview img { max-height: 110px; max-width: 100%; }
.sig-preview { border: 1px solid var(--line); border-radius: var(--radius); padding: 0 16px 16px; background: #fff; overflow-x: auto; }

/* Email designs */
.pill-green { background: #e3f1d0; color: var(--moss); }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.tpl-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.tpl-thumb { height: 300px; overflow: hidden; border-bottom: 1px solid var(--line); background: #eef2f7; position: relative; }
.tpl-thumb iframe { width: 700px; height: 857px; border: 0; transform: scale(.42); transform-origin: 0 0; pointer-events: none; position: absolute; left: 50%; margin-left: -147px; }
.tpl-meta { padding: 12px 14px 14px; }
.editor { display: grid; grid-template-columns: minmax(340px, 480px) 1fr; gap: 18px; align-items: start; }
.editor-preview { position: sticky; top: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.editor-preview iframe { width: 100%; height: calc(100vh - 110px); min-height: 560px; border: 1px solid var(--line); border-radius: 4px; background: #fff; display: block; margin: 0 auto; transition: width .2s; }
.swatch { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; }
.swatch input[type=color] { width: 44px; height: 34px; padding: 2px; flex: none; cursor: pointer; }
details.panel summary { cursor: pointer; }
@media (max-width: 1100px) { .editor { grid-template-columns: 1fr; } .editor-preview { position: static; } }
/* Let the signature preview look exactly like the email (undo the app's table styles) */
.sig-preview table { width: auto; background: transparent; font-size: inherit; }
.sig-preview td { border: 0; }
.sig-preview tr:hover td { background: transparent; }
