* { margin:0; padding:0; box-sizing:border-box; }
:root {
  --navy:#101230; --navy2:#1a1d42; --navy3:#262a55;
  --bg:#f3f4fa; --card:#ffffff; --border:#e8e9f4;
  --text:#1c1d33; --muted:#7a7c9c; --accent:#4f6df5; --accent2:#eef1fe;
  --green:#2e9e5b; --greenbg:#dff5e3; --blue:#3b6fe0; --bluebg:#e3ecff;
  --amber:#b98a1d; --amberbg:#fff4d6; --orange:#d97b1d; --orangebg:#ffe9d6;
  --red:#d93b3b; --redbg:#ffe1e1; --gray:#6b6d8c; --graybg:#ececf5;
  --purple:#7a4fe0; --purplebg:#efe7fd;
}
html,body { height:100%; font-family:'Heebo',system-ui,sans-serif; background:var(--bg); color:var(--text); font-size:14px; }
#root { min-height:100vh; }
.app { display:flex; min-height:100vh; direction:ltr; }
.sidebar, .main { direction:rtl; }

/* ===== sidebar (dark, LEFT per mockups) ===== */
.sidebar { order:-1; width:232px; flex:0 0 232px; background:var(--navy); color:#c9cbe4; display:flex; flex-direction:column; position:sticky; top:0; height:100vh; overflow-y:auto; }
.sb-logo { display:flex; align-items:center; gap:10px; padding:18px 16px 14px; }
.sb-logo .lg { width:34px; height:34px; border-radius:50%; background:linear-gradient(135deg,#4f6df5,#8a5cf6); display:flex; align-items:center; justify-content:center; font-size:16px; }
.sb-logo b { color:#fff; font-size:15px; display:block; line-height:1.15; }
.sb-logo small { color:#8b8fb8; font-size:10.5px; }
.sb-nav { padding:6px 10px; display:flex; flex-direction:column; gap:2px; }
.sb-item { display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:9px; cursor:pointer; font-size:13px; color:#c9cbe4; border:none; background:none; width:100%; text-align:right; font-family:inherit; }
.sb-item:hover { background:var(--navy2); }
.sb-item.active { background:var(--accent); color:#fff; font-weight:600; }
.sb-item .ic { width:17px; text-align:center; flex:0 0 17px; }
.sb-badge { margin-right:auto; background:#e0483e; color:#fff; border-radius:9px; font-size:10.5px; min-width:18px; text-align:center; padding:1px 5px; font-weight:700; }
.sb-badge.gray { background:#3a3f6e; }
.sb-sec { color:#6f739f; font-size:10.5px; font-weight:700; letter-spacing:.6px; padding:14px 12px 6px; }
.sb-new { margin:14px 12px 18px; margin-top:auto; }
.sb-new button { width:100%; background:var(--accent); color:#fff; border:none; border-radius:10px; padding:10px; font-family:inherit; font-size:13px; font-weight:700; cursor:pointer; }
.sb-new button:hover { background:#3f5ce0; }

/* ===== main ===== */
.main { flex:1; min-width:0; display:flex; flex-direction:column; }
.topbar { display:flex; align-items:center; gap:12px; padding:12px 22px; background:rgba(255,255,255,.75); backdrop-filter:blur(6px); border-bottom:1px solid var(--border); position:sticky; top:0; z-index:20; }
.search { flex:0 1 420px; display:flex; align-items:center; gap:8px; background:#fff; border:1px solid var(--border); border-radius:10px; padding:7px 12px; color:var(--muted); font-size:12.5px; }
.search input { border:none; outline:none; flex:1; font-family:inherit; font-size:12.5px; background:none; }
.tb-right { margin-right:auto; display:flex; align-items:center; gap:8px; }
.chip-flag { border:1px solid var(--border); background:#fff; border-radius:9px; padding:5px 10px; font-size:12px; cursor:pointer; font-family:inherit; }
.chip-flag.active { border-color:var(--accent); background:var(--accent2); font-weight:700; }
.avatar { width:30px; height:30px; border-radius:50%; background:linear-gradient(135deg,#4f6df5,#8a5cf6); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:12px; }
.content { padding:20px 22px 40px; }

/* ===== hero / banners ===== */
.hero { border-radius:16px; padding:22px 24px; color:#fff; background:linear-gradient(120deg,#2b3170,#4f6df5 80%); position:relative; overflow:hidden; margin-bottom:16px; }
.hero:after { content:""; position:absolute; inset:0; background:radial-gradient(circle at 85% 20%, rgba(255,255,255,.18), transparent 45%); }
.hero h1 { font-size:21px; font-weight:800; position:relative; }
.hero p { font-size:12.5px; opacity:.85; margin-top:4px; position:relative; }
.hero .pill-status { position:absolute; top:18px; left:20px; background:rgba(255,255,255,.2); border-radius:20px; padding:3px 12px; font-size:11.5px; font-weight:700; }

/* ===== stat cards ===== */
.stats { display:grid; grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); gap:12px; margin-bottom:16px; }
.stat { background:var(--card); border:1px solid var(--border); border-radius:13px; padding:13px 15px; display:flex; align-items:center; gap:11px; }
.stat .num { font-size:21px; font-weight:800; }
.stat .lbl { font-size:11.5px; color:var(--muted); margin-top:1px; }
.stat .ic { width:34px; height:34px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:15px; flex:0 0 34px; }

/* ===== grid & cards ===== */
.grid { display:grid; gap:14px; }
.card { background:var(--card); border:1px solid var(--border); border-radius:14px; padding:15px 16px; }
.card h3 { font-size:14px; font-weight:700; margin-bottom:10px; display:flex; align-items:center; gap:7px; }
.card h3 .more { margin-right:auto; font-size:11px; color:var(--accent); cursor:pointer; font-weight:600; }

/* ===== pills ===== */
.pill { display:inline-block; border-radius:7px; padding:2px 9px; font-size:11px; font-weight:600; white-space:nowrap; }
.p-blue { background:var(--bluebg); color:var(--blue); } .p-green { background:var(--greenbg); color:var(--green); }
.p-amber { background:var(--amberbg); color:var(--amber); } .p-orange { background:var(--orangebg); color:var(--orange); }
.p-red { background:var(--redbg); color:var(--red); } .p-gray { background:var(--graybg); color:var(--gray); }
.p-purple { background:var(--purplebg); color:var(--purple); }

/* ===== kanban ===== */
.kanban { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; }
.kb-col { border-radius:13px; padding:10px; min-height:120px; }
.kb-head { display:flex; align-items:center; gap:7px; font-size:12.5px; font-weight:700; margin-bottom:9px; padding:0 2px; }
.kb-count { background:rgba(0,0,0,.08); border-radius:9px; font-size:10.5px; padding:1px 7px; }
.kb-card { background:#fff; border:1px solid var(--border); border-radius:10px; padding:9px 11px; margin-bottom:8px; cursor:pointer; }
.kb-card:hover { box-shadow:0 2px 8px rgba(30,30,80,.09); }
.kb-card .t { font-size:12px; font-weight:600; line-height:1.35; }
.kb-card .m { display:flex; align-items:center; gap:6px; margin-top:7px; }

/* ===== tables ===== */
table.tbl { width:100%; border-collapse:collapse; background:#fff; border-radius:13px; overflow:hidden; border:1px solid var(--border); }
.tbl th { text-align:right; font-size:11.5px; color:var(--muted); padding:10px 12px; border-bottom:1px solid var(--border); font-weight:600; background:#fafafe; }
.tbl td { padding:10px 12px; border-bottom:1px solid #f0f1f8; font-size:12.5px; vertical-align:middle; }
.tbl tr:last-child td { border-bottom:none; }
.tbl tbody tr { cursor:pointer; } .tbl tbody tr:hover { background:#f7f8fd; }
.tbl tbody tr.sel { background:var(--accent2); }
.idc { font-weight:700; color:var(--accent); font-size:11.5px; white-space:nowrap; }

/* ===== split view (table + right detail) ===== */
.split { display:flex; gap:14px; align-items:flex-start; }
.split .grow { flex:1 1 600px; min-width:0; }
.split .detail { flex:0 0 330px; position:sticky; top:66px; }
.detail .card { padding:16px; }
.d-title { font-size:14.5px; font-weight:800; line-height:1.4; }
.d-row { display:flex; align-items:center; gap:8px; margin-top:9px; font-size:12.5px; }
.d-row .k { color:var(--muted); flex:0 0 76px; }
.d-sec { border-top:1px solid var(--border); margin-top:12px; padding-top:11px; font-size:12.5px; line-height:1.55; }
.d-sec b { display:block; font-size:11.5px; color:var(--muted); margin-bottom:3px; font-weight:600; }
select.inp, input.inp, textarea.inp { font-family:inherit; font-size:12.5px; padding:6px 9px; border:1px solid var(--border); border-radius:8px; background:#fff; outline:none; max-width:100%; }
select.inp:focus, input.inp:focus, textarea.inp:focus { border-color:var(--accent); }

/* ===== buttons ===== */
.btn { background:var(--accent); color:#fff; border:none; border-radius:9px; padding:8px 15px; font-family:inherit; font-size:12.5px; font-weight:700; cursor:pointer; }
.btn:hover { background:#3f5ce0; } .btn:disabled { opacity:.5; cursor:default; }
.btn.ghost { background:#fff; color:var(--text); border:1px solid var(--border); }
.btn.ghost:hover { background:#f5f6fc; }

/* ===== tabs / toggles ===== */
.tabs { display:flex; gap:3px; border-bottom:1px solid var(--border); margin-bottom:14px; flex-wrap:wrap; }
.tab { padding:8px 13px; font-size:12.5px; color:var(--muted); cursor:pointer; border:none; background:none; font-family:inherit; border-bottom:2.5px solid transparent; font-weight:600; }
.tab.active { color:var(--accent); border-bottom-color:var(--accent); }
.seg { display:inline-flex; background:#eceef8; border-radius:9px; padding:3px; gap:2px; }
.seg button { border:none; background:none; font-family:inherit; font-size:12px; padding:5px 12px; border-radius:7px; cursor:pointer; color:var(--muted); font-weight:600; }
.seg button.active { background:#fff; color:var(--text); box-shadow:0 1px 3px rgba(30,30,80,.12); }

/* ===== agents ===== */
.ag-cards { display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:11px; margin-bottom:14px; }
.ag-card { background:#fff; border:1.5px solid var(--border); border-radius:13px; padding:13px; cursor:pointer; }
.ag-card.active { border-color:var(--accent); box-shadow:0 2px 10px rgba(79,109,245,.15); }
.ag-ic { width:34px; height:34px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:15px; color:#fff; font-weight:800; margin-bottom:8px; }
.ag-name { font-weight:700; font-size:13px; display:flex; align-items:center; gap:6px; }
.ag-stats { display:flex; gap:8px; margin-top:9px; }
.ag-stat { flex:1; text-align:center; } .ag-stat b { display:block; font-size:15px; } .ag-stat span { font-size:9.5px; color:var(--muted); }
.dot { width:7px; height:7px; border-radius:50%; display:inline-block; }
.dot.g { background:var(--green); } .dot.o { background:var(--orange); } .dot.gr { background:#b9bbcf; }

/* ===== feed ===== */
.feed { display:flex; flex-direction:column; gap:9px; }
.feed-item { display:flex; gap:9px; font-size:12px; align-items:flex-start; }
.feed-item .fi-ic { width:24px; height:24px; border-radius:7px; flex:0 0 24px; display:flex; align-items:center; justify-content:center; font-size:11px; }
.feed-item .fi-t { color:var(--muted); font-size:10.5px; margin-top:1px; }

/* ===== mail ===== */
.mailwrap { display:flex; gap:14px; align-items:flex-start; }
.mail-list { flex:0 0 400px; background:#fff; border:1px solid var(--border); border-radius:13px; overflow:hidden; }
.mail-row { display:flex; gap:10px; padding:11px 13px; border-bottom:1px solid #f0f1f8; cursor:pointer; align-items:flex-start; }
.mail-row:hover { background:#f7f8fd; } .mail-row.sel { background:var(--accent2); }
.mail-row .av { width:32px; height:32px; border-radius:50%; flex:0 0 32px; display:flex; align-items:center; justify-content:center; color:#fff; font-weight:700; font-size:12px; }
.mail-row .s { font-weight:700; font-size:12.5px; }
.mail-row .sub { font-size:12px; margin-top:1px; }
.mail-row .snip { font-size:11px; color:var(--muted); margin-top:1px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:250px; }
.mail-row .tm { margin-right:auto; font-size:10.5px; color:var(--muted); flex:0 0 auto; }
.mail-read { flex:1 1 480px; }
.mnav { display:flex; gap:5px; flex-wrap:wrap; margin-bottom:12px; }
.mnav button { border:1px solid var(--border); background:#fff; border-radius:9px; padding:6px 11px; font-family:inherit; font-size:12px; cursor:pointer; font-weight:600; color:var(--muted); }
.mnav button.active { background:var(--accent2); border-color:var(--accent); color:var(--accent); }
.mnav button .n { background:var(--redbg); color:var(--red); border-radius:8px; font-size:10px; padding:0 6px; margin-right:5px; font-weight:700; }

/* ===== progress donut ===== */
.donut-wrap { display:flex; align-items:center; gap:14px; }
.legend { display:flex; flex-direction:column; gap:5px; font-size:11.5px; }
.legend .li { display:flex; align-items:center; gap:6px; }
.legend .li b { margin-right:auto; }

/* ===== projects list ===== */
.proj-card { background:#fff; border:1px solid var(--border); border-radius:13px; padding:14px 16px; cursor:pointer; display:flex; align-items:center; gap:13px; }
.proj-card:hover { box-shadow:0 2px 10px rgba(30,30,80,.08); }
.proj-card .flag { font-size:20px; }
.proj-card .nm { font-weight:700; font-size:13.5px; }
.proj-card .mt { font-size:11px; color:var(--muted); margin-top:3px; }

/* ===== gate ===== */
.gate { min-height:100vh; display:flex; align-items:center; justify-content:center; background:linear-gradient(140deg,#101230,#2b3170); }
.gate .card { width:340px; text-align:center; padding:30px 26px; }
.gate h2 { font-size:17px; margin-bottom:6px; } .gate p { color:var(--muted); font-size:12px; margin-bottom:16px; }
.gate input { width:100%; padding:10px 12px; border:1px solid var(--border); border-radius:10px; font-family:inherit; font-size:13.5px; margin-bottom:12px; text-align:center; }
.gate .err { color:var(--red); font-size:11.5px; margin-top:9px; min-height:15px; }

.muted { color:var(--muted); } .small { font-size:11.5px; }
.empty { text-align:center; color:var(--muted); padding:34px 10px; font-size:12.5px; }
.hz { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
@media (max-width:1100px) { .kanban { grid-template-columns:repeat(2,1fr); } .split .detail { position:static; } .split { flex-wrap:wrap; } .mailwrap { flex-wrap:wrap; } .mail-list { flex:1 1 100%; } }
/* ===== mobile nav strip (hidden on desktop) ===== */
.m-nav{display:none}
.m-only{display:none}
/* ===== mobile ===== */
@media (max-width:760px) {
  .sidebar { display:none; }
  .m-nav{display:flex;gap:6px;flex-wrap:wrap;padding:8px 12px;background:#fff;border-bottom:1px solid var(--border);position:sticky;top:55px;z-index:15}
  .m-only{display:inline-block;margin-bottom:8px}
  .mailwrap.m-sel .mail-list{display:none}
  .m-item{flex:0 0 auto;border:1px solid #e6e8f4;background:#f7f8fd;border-radius:999px;padding:6px 12px;font-size:12.5px;font-family:inherit;cursor:pointer;white-space:nowrap}
  .m-item.active{background:var(--accent);color:#fff;border-color:var(--accent)}
  .kanban { grid-template-columns:1fr; }
  .content{padding:14px 12px 32px;overflow-x:hidden}
  .topbar{padding:10px 12px;flex-wrap:wrap}
  .search{flex:1 1 100%;order:2}
  .tb-right{margin-right:auto;gap:6px}
  .tb-right .muted.small{display:none}
  .hero{padding:16px}
  .hero-art{display:none}
  .stats{grid-template-columns:repeat(2,1fr)}
  .grid{grid-template-columns:1fr !important}
  .mailwrap{flex-direction:column}
  .mail-list{flex:1 1 100%}
  .split{flex-direction:column}
  .split .detail{position:static;width:auto}
  table.tbl{display:block;overflow-x:auto}
  .review-bar .btn{flex:1;padding:12px}
  .mr-comment{min-height:80px}
  .ag-cards{grid-template-columns:1fr 1fr}
  .qacts .qact{flex:1 1 45%;justify-content:center}
  .mail-body{max-height:none}
}

.flagchip { display:inline-flex; align-items:center; justify-content:center; width:22px; height:22px; border-radius:6px; color:#fff; font-size:9.5px; font-weight:800; }
.fc-es { background:#c60b1e; } .fc-il { background:#0038b8; } .fc-fr { background:#0055a4; } .fc-all { background:#5b5e86; }
/* wave 2 */
.hero{position:relative;overflow:hidden}
.hero-art{position:absolute;inset-inline-end:0;top:0;bottom:0;width:340px;opacity:.9;pointer-events:none}
.hero-art svg{width:100%;height:100%;display:block}
.hero-art.sm{width:260px;opacity:.7}
.hero h1,.hero p{position:relative;z-index:1}
.sync-chip{font-size:11px;color:#16a34a;background:#eafaf0;border-radius:999px;padding:3px 9px;white-space:nowrap}
.qacts{display:flex;gap:10px;flex-wrap:wrap}
.qact{display:flex;align-items:center;gap:8px;border:1px solid #e6e8f4;background:#fff;border-radius:12px;padding:9px 13px;font-size:13px;font-weight:600;cursor:pointer;font-family:inherit}
.qact:hover{border-color:var(--accent)}
.qic{width:26px;height:26px;border-radius:8px;display:flex;align-items:center;justify-content:center;font-size:14px}
.kb-tabs{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:10px}
.kb-tab{border:1px solid #e6e8f4;background:#f7f8fd;border-radius:999px;padding:4px 11px;font-size:12px;cursor:pointer;font-family:inherit}
.kb-tab.active{background:var(--accent);color:#fff;border-color:var(--accent)}
.kanban{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:10px;align-items:start}
.kb-single{display:flex;flex-direction:column;gap:8px}
.kb-col{border-radius:12px;padding:8px;min-height:60px}
.kb-col.k-red{background:#fdf0f0}.kb-col.k-blue{background:#eef4fd}.kb-col.k-amber{background:#fdf8ec}.kb-col.k-green{background:#eefaf2}
.kb-card .m{display:flex;align-items:center;gap:6px;margin-top:6px}
.dom-row{display:flex;align-items:center;gap:8px;margin:7px 0;font-size:12.5px}
.dom-lbl{width:52px;flex:none}
.dom-bar{flex:1;height:8px;background:#eef0fa;border-radius:99px;overflow:hidden}
.dom-bar span{display:block;height:100%;background:linear-gradient(90deg,var(--accent),#8ea2f7);border-radius:99px}
.mail-body{white-space:pre-wrap;background:#f7f8fd;border-radius:10px;padding:10px;font-size:12.5px;line-height:1.6;margin-top:5px;max-height:220px;overflow:auto;unicode-bidi:plaintext;text-align:start}
.d-sec b{display:block;margin-bottom:2px}
.review-bar{display:flex;gap:8px;margin-top:10px}
.btn.ghost{background:#fff;border:1px solid #e6e8f4;color:#333}
.mr-comment{width:100%;min-height:64px;margin-top:8px;border:1px solid #e6e8f4;border-radius:10px;padding:8px;font-family:inherit;font-size:12.5px;resize:vertical}
.review-state{margin-top:10px;background:#f7f8fd;border-radius:10px;padding:10px;display:flex;flex-direction:column;gap:5px}
.ag-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:10px;margin-bottom:14px}
.ag-detail-stats{display:flex;gap:18px;margin:8px 0 12px;flex-wrap:wrap}
.ag-stat{text-align:center}
.ag-stat b{display:block;font-size:18px}
.ag-stat span{font-size:11px;color:#8a8fa8}
