@font-face { font-family: "Plex Arabic"; src: url("/static/fonts/IBMPlexSansArabic-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Arabic"; src: url("/static/fonts/IBMPlexSansArabic-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Plex Arabic"; src: url("/static/fonts/IBMPlexSansArabic-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --brand: #0F5C4D;
  --brand-2: #1F8A70;
  --brand-soft: #E7F2EE;
  --gold: #C9A227;
  --gold-soft: #FBF4DE;
  --ink: #17211F;
  --ink-2: #4A5855;
  --muted: #7C8A87;
  --line: #E3E8E6;
  --bg: #F4F6F5;
  --card: #FFFFFF;
  --side: #0B231E;
  --side-ink: #C9D8D3;
  --danger: #B42318;
  --danger-soft: #FDECEA;
  --warn: #B54708;
  --warn-soft: #FEF4E6;
  --ok: #067647;
  --ok-soft: #E6F6EE;
  --info: #175CD3;
  --info-soft: #EAF2FF;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: "Plex Arabic", Tahoma, Arial, sans-serif; font-size: 15px; line-height: 1.6;
  color: var(--ink); background: var(--bg);
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0 0 10px; }
small, .small { font-size: 13px; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.ltr { direction: ltr; unicode-bidi: embed; text-align: left; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
code, .mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; direction: ltr; unicode-bidi: embed; }
code { background: #EEF2F1; padding: 1px 6px; border-radius: 6px; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex-shrink: 0; background: var(--side); color: var(--side-ink); padding: 18px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px;
}
.brand-mark { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; }
.brand-mark .logo {
  width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--brand-2), var(--gold));
  display: grid; place-items: center; font-weight: 700; color: #fff;
}
.brand-mark b { font-size: 17px; display: block; }
.logo-mark { flex-shrink: 0; display: block; }
.brand-mark span { font-size: 12px; color: var(--side-ink); opacity: .8; }
.nav-label { font-size: 11.5px; color: #7FA197; padding: 14px 10px 4px; letter-spacing: .3px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--side-ink);
  font-weight: 500; text-decoration: none;
}
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.active { background: rgba(31, 138, 112, .28); color: #fff; }
.nav svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; }
.nav .count { margin-inline-start: auto; background: var(--gold); color: #1B1405; font-size: 11.5px; font-weight: 700; border-radius: 99px; padding: 0 7px; }
.sidebar .me { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 13px; }
.sidebar .me a { color: var(--side-ink); }

.main { flex: 1; min-width: 0; padding: 22px 26px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.topbar .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.menu-btn { display: none; }

@media (max-width: 900px) {
  .app { display: block; }
  .sidebar { position: fixed; inset: 0 0 0 auto; z-index: 50; transform: translateX(100%); transition: transform .2s; height: 100%; }
  .sidebar.open { transform: none; box-shadow: -10px 0 30px rgba(0, 0, 0, .25); }
  .main { padding: 14px 16px 60px; }
  .btn.menu-btn { display: inline-flex; }
}

/* ---------- cards & grids ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-side { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }

/* ---------- stat tiles ---------- */
.stat { padding: 16px 18px; }
.stat .label { color: var(--ink-2); font-size: 13px; }
.stat .value { font-size: 28px; font-weight: 700; line-height: 1.2; margin-top: 4px; }
.stat .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ---------- horizontal bars (single series, direct labels) ---------- */
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 44px; align-items: center; gap: 10px; font-size: 13.5px; }
.bar-track { background: #EEF2F1; border-radius: 4px; height: 12px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--brand-2); border-radius: 4px; min-width: 2px; }
.bar-row .num { text-align: left; font-weight: 600; color: var(--ink); direction: ltr; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); border-radius: 9px; padding: 8px 14px; font: inherit; font-weight: 600;
  font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.4;
}
.btn:hover { background: #F6F8F7; text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #0B4A3E; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #1B1405; }
.btn-gold:hover { background: #B8921F; }
.btn-ai { background: linear-gradient(135deg, #F6EBC6, #E3F1EC); border-color: #E2D3A0; color: #3B2F07; }
.btn-danger { color: var(--danger); border-color: #F3C4BF; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn[disabled], .btn.loading { opacity: .6; pointer-events: none; }
.btn.loading::after { content: ""; width: 12px; height: 12px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.inline { display: inline; margin: 0; }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 5px; color: var(--ink-2); }
.field { margin-bottom: 14px; }
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=tel],
input[type=datetime-local], input[type=search], input:not([type]), select, textarea {
  width: 100%; border: 1px solid #D5DDDA; border-radius: 9px; padding: 9px 12px; font: inherit; font-size: 14.5px;
  background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(31, 138, 112, .35); border-color: var(--brand-2); }
textarea { min-height: 110px; resize: vertical; line-height: 1.7; }
input[type=color] { width: 46px; height: 38px; border: 1px solid #D5DDDA; border-radius: 9px; padding: 3px; background: #fff; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--brand); vertical-align: middle; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); margin: 0; cursor: pointer; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.chip-check { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 99px; padding: 5px 12px; background: #fff; font-weight: 500; cursor: pointer; margin: 0; }
.chip-check:has(input:checked) { border-color: var(--brand-2); background: var(--brand-soft); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.filters input, .filters select { width: auto; min-width: 140px; padding: 7px 10px; font-size: 14px; }
.filters input[type=checkbox] { min-width: 0; width: 16px; padding: 0; }
.secret-saved { font-size: 12px; color: var(--ok); font-weight: 600; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #F8FAF9; color: var(--ink-2); font-weight: 600; font-size: 13px; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #FAFCFB; }
td .title { font-weight: 600; color: var(--ink); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 99px; font-size: 12.5px; font-weight: 600; background: #EEF2F1; color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.gold { background: var(--gold-soft); color: #7A5D07; }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.st-new { background: var(--info-soft); color: var(--info); }
.st-contacted { background: #F1F0FE; color: #4E3DC8; }
.st-interested { background: var(--gold-soft); color: #7A5D07; }
.st-qualified { background: var(--brand-soft); color: var(--brand); }
.st-proposal { background: #FDEFF7; color: #A1246B; }
.st-won { background: var(--ok-soft); color: var(--ok); }
.st-lost { background: #F2F4F3; color: var(--muted); }
.pf { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 6px; border-radius: 6px; color: #fff; font-size: 11px; font-weight: 700; direction: ltr; }
.score { display: inline-grid; place-items: center; width: 34px; height: 24px; border-radius: 7px; font-weight: 700; font-size: 12.5px; direction: ltr; }
.score.hi { background: var(--ok-soft); color: var(--ok); }
.score.mid { background: var(--gold-soft); color: #7A5D07; }
.score.lo { background: #F2F4F3; color: var(--muted); }

/* ---------- flashes ---------- */
.flashes { display: grid; gap: 8px; margin-bottom: 16px; }
.flash { padding: 11px 14px; border-radius: 10px; border: 1px solid; font-weight: 500; }
.flash.success { background: var(--ok-soft); border-color: #B7E4CB; color: #05603A; }
.flash.error { background: var(--danger-soft); border-color: #F5C2BC; color: #912018; }
.flash.info { background: var(--info-soft); border-color: #C3D7FB; color: #1849A9; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--ink-2); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ---------- misc components ---------- */
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .icon { font-size: 30px; margin-bottom: 6px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 22px 14px 0; border-right: 2px solid var(--line); margin-right: 6px; }
.timeline li::before { content: ""; position: absolute; right: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--brand-2); }
.timeline .when { font-size: 12px; color: var(--muted); }
.timeline .what { white-space: pre-wrap; word-break: break-word; }
.callout { border: 1px dashed #D9C77F; background: var(--gold-soft); border-radius: 10px; padding: 12px 14px; font-size: 14px; }
.callout.brand { border-color: #A8D3C5; background: var(--brand-soft); }
.steps-setup { display: grid; gap: 8px; }
.steps-setup a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; }
.steps-setup a.done { color: var(--muted); }
.steps-setup .dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #C9D3D0; display: grid; place-items: center; font-size: 12px; }
.steps-setup a.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 14px; }
.copy-box { display: flex; gap: 6px; }
.copy-box input { direction: ltr; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
pre.snippet { background: #0F1F1B; color: #D5EEE6; padding: 12px; border-radius: 10px; overflow-x: auto; direction: ltr; text-align: left; font-size: 12.5px; white-space: pre; }

/* ---------- ideas ---------- */
.ideas { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.idea { display: flex; flex-direction: column; gap: 8px; }
.idea .caption { white-space: pre-wrap; font-size: 14px; color: var(--ink-2); max-height: 190px; overflow: auto; }
.idea .tags { color: var(--brand); font-size: 13px; direction: rtl; }
.idea .foot { margin-top: auto; display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- composer ---------- */
.composer { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .composer { grid-template-columns: 1fr; } }
.preview-box { position: sticky; top: 16px; }
.preview-box img { width: 100%; border-radius: 10px; border: 1px solid var(--line); background: #EEF2F1; display: block; }
.account-pick { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.account-pick label { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin: 0; font-weight: 500; cursor: pointer; color: var(--ink); }
.account-pick label:has(input:checked) { border-color: var(--brand-2); background: var(--brand-soft); }
.counter { font-size: 12px; color: var(--muted); text-align: left; direction: ltr; }
.counter.over { color: var(--danger); font-weight: 700; }

/* ---------- inbox ---------- */
.inbox { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 950px) { .inbox { grid-template-columns: 1fr; } }
.inbox-list { max-height: calc(100vh - 210px); overflow-y: auto; padding: 0; }
.inbox-item { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.inbox-item:hover { background: #F8FAF9; text-decoration: none; }
.inbox-item.active { background: var(--brand-soft); }
.inbox-item .top { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.inbox-item .who { font-weight: 600; }
.inbox-item .text { font-size: 13.5px; color: var(--ink-2); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.inbox-item.unread .who::after { content: ""; display: inline-block; width: 7px; height: 7px; background: var(--info); border-radius: 50%; margin-inline-start: 6px; vertical-align: middle; }
.bubble { background: #F3F6F5; border-radius: 12px; padding: 12px 14px; white-space: pre-wrap; word-break: break-word; }
.bubble.me { background: var(--brand-soft); }
.ai-box { border: 1px solid #E8DCAE; background: linear-gradient(180deg, #FFFCF2, #fff); border-radius: 12px; padding: 12px 14px; }

/* ---------- auth & public ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #0B231E 0%, #0F5C4D 55%, #1F8A70 100%); }
.auth .card { width: 100%; max-width: 400px; padding: 28px; }
.public-wrap { max-width: 560px; margin: 0 auto; padding: 28px 16px 60px; }
.public-head { text-align: center; margin-bottom: 18px; }
.public-head img { max-height: 64px; max-width: 220px; }

/* ---------- signup ---------- */
.signup-card { width: 100%; max-width: 920px; display: grid; grid-template-columns: 1fr 1.15fr; background: #fff; border-radius: 18px; overflow: hidden; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
.signup-side { background: linear-gradient(160deg, #0A3B31, #0F5C4D 60%, #1F8A70); color: #EAF5F1; padding: 34px 30px; display: flex; flex-direction: column; gap: 22px; }
.signup-side .brand-mark { color: #fff; }
.signup-side .brand-mark span { color: #BFE3D6; }
.perks { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; font-size: 15px; }
.perks li { display: flex; gap: 10px; align-items: flex-start; }
.perks li span { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(233, 185, 73, .2); color: #F2CE73; font-weight: 700; flex-shrink: 0; font-size: 13px; }
.side-note { margin-top: auto; font-size: 13px; color: #BFE3D6; }
.signup-form { padding: 32px 30px; }
@media (max-width: 760px) { .signup-card { grid-template-columns: 1fr; } .signup-side { padding: 24px; } .signup-form { padding: 24px; } }

/* honeypot: invisible to people, still in the form for bots (no off-screen offsets — they break RTL scrolling) */
.hp-field { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; border: 0 !important; opacity: 0; pointer-events: none; overflow: hidden; }

/* company switcher (sidebar) */
.org-switch { margin: -6px 8px 10px; }
.org-switch label { color: #7FA197; font-size: 11.5px; font-weight: 500; margin-bottom: 4px; }
.org-switch select { background: rgba(255, 255, 255, .07); color: #fff; border-color: rgba(255, 255, 255, .14); padding: 7px 10px; font-size: 13.5px; }
.org-switch select option { color: #17211F; }
.brand-mark .wordmark { display: block; margin-bottom: 2px; }

/* brand: the logo keeps its original colours, so it sits on a light card */
.lockup { display: inline-flex; align-items: center; gap: 6px; }
.lockup img { display: block; }
.brand-card { display: flex; flex-direction: column; align-items: center; gap: 4px; background: #FBF8F1; border-radius: 14px;
  padding: 10px 12px 8px; margin: 0 4px 14px; text-decoration: none; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.brand-card:hover { text-decoration: none; }
.brand-card > span { font-size: 12px; color: #5C6B67; font-weight: 600; }
.brand-chip { display: inline-flex; background: #FBF8F1; border-radius: 16px; padding: 10px 16px; box-shadow: 0 10px 26px rgba(0, 0, 0, .22); }
.side-tagline { margin-top: 10px; color: #CFE3DC; font-size: 14px; }
.auth .card .brand-mark .lockup { margin-inline-start: -4px; }
