
  :root{
    --bg:#f4f7fb; --surface:#ffffff; --surface2:#f0f4f9; --line:#e3e9f1;
    --txt:#0f172a; --muted:#5b6b85; --muted2:#8596af;
    --blue:#1976d2; --blue-dark:#1259a8; --blue-soft:#e8f2fd;
    --gold:#f7b32b; --green:#16a34a; --green-soft:#e6f6ee; --red:#dc2626; --red-soft:#fdeaea;
    --orange:#ea8a00; --orange-soft:#fdf2e2; --purple:#7c3aed; --purple-soft:#f1eafd;
    --shadow:0 18px 40px rgba(112,144,176,0.12);
    --shadow-lg:0 30px 60px rgba(112,144,176,0.18);
    --radius:20px; --radius-sm:12px;
  }
  *{box-sizing:border-box;margin:0;padding:0}
  html,body{height:100%}
  body{background:var(--bg);color:var(--txt);font-family:'Poppins',system-ui,sans-serif;
    -webkit-font-smoothing:antialiased;overflow:hidden}

  /* ===== Auth ===== */
  .auth-wrap{position:absolute;inset:0;z-index:20;display:none;align-items:center;justify-content:center;
    background:linear-gradient(160deg,#0b1d33 0%,#123a6b 55%,#1976d2 100%);}
  .auth-card{width:min(420px,92vw);padding:40px 38px 34px;border-radius:20px;background:var(--surface);
    box-shadow:var(--shadow-lg);text-align:center}
  .auth-card .logo-mark{width:54px;height:54px;margin:0 auto 16px;border-radius:14px;overflow:hidden;
    background:linear-gradient(135deg,var(--blue),var(--blue-dark));color:#fff;font-weight:800;font-size:24px;
    display:flex;align-items:center;justify-content:center;box-shadow:0 8px 20px rgba(25,118,210,.35)}
  .auth-card .brand{font-size:22px;font-weight:800;color:var(--txt);letter-spacing:-.3px}
  .auth-card .brand span{color:var(--blue)}
  .auth-card .sub{color:var(--muted);font-size:13px;margin:6px 0 28px}
  .auth-field{width:100%;padding:13px 16px;border-radius:var(--radius-sm);border:1px solid var(--line);
    background:var(--surface2);color:var(--txt);font-size:14px;margin-bottom:13px;outline:none;transition:.15s;font-family:inherit}
  .auth-field:focus{border-color:var(--blue);background:#fff;box-shadow:0 0 0 3px rgba(25,118,210,.12)}
  .auth-error{color:var(--red);font-size:13px;min-height:18px;margin-bottom:10px;text-align:left}
  .btn-primary{width:100%;padding:13px;border:none;border-radius:var(--radius-sm);cursor:pointer;font-weight:600;font-size:15px;
    background:var(--blue);color:#fff;transition:.15s;font-family:inherit}
  .btn-primary:hover{background:var(--blue-dark)}
  .btn-primary:disabled{opacity:.6;cursor:not-allowed}

  /* ===== App shell ===== */
  .app{position:absolute;inset:0;z-index:10;display:none;background:var(--bg)}
  .app.on{display:block}

  .sidebar{position:absolute;top:0;left:0;bottom:0;width:290px;background:var(--surface);border-right:1px solid var(--line);
    display:flex;flex-direction:column;padding:20px 16px;overflow-y:auto;overflow-x:hidden;font-size:13px;box-shadow:0 0 20px rgba(112,144,176,0.08)}
  .sidebar::-webkit-scrollbar{width:6px}
  .sidebar::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:6px}
  .sidebar .brand-row{display:flex;align-items:center;gap:12px;padding:0 8px 22px;border-bottom:1px solid var(--line);margin-bottom:16px}
  .sidebar .logo-mark{width:40px;height:40px;border-radius:11px;flex:none;
    background:linear-gradient(135deg,var(--blue),var(--blue-dark));color:#fff;font-weight:800;font-size:18px;
    display:flex;align-items:center;justify-content:center;overflow:hidden}
  .logo-mark img{width:100%;height:100%;object-fit:contain;display:block}
  .sidebar .brand{font-weight:700;font-size:14px;line-height:1.2}
  .sidebar .brand small{display:block;font-weight:400;font-size:10px;color:var(--muted2)}
  .sidebar .nav-label{font-size:10px;text-transform:uppercase;letter-spacing:.9px;color:var(--muted2);
    font-weight:600;margin:10px 10px 4px}
  .sidebar .nav-item{display:flex;align-items:center;gap:8px;padding:6px 10px;border-radius:var(--radius-sm);
    color:var(--muted);cursor:pointer;font-size:12.5px;font-weight:500;transition:.12s;margin-bottom:1px}
  .sidebar .nav-item .ic{width:20px;text-align:center;font-size:14px}
  .sidebar .nav-item:hover{background:var(--surface2);color:var(--txt)}
  .sidebar .nav-item.active{background:var(--blue-soft);color:var(--blue);font-weight:600}
  .sidebar .foot{margin-top:auto;padding:12px 10px 4px;border-top:1px solid var(--line);flex:none}
  .sidebar .foot .userpic{width:30px;height:30px;border-radius:50%;background:var(--blue-soft);color:var(--blue);
    font-weight:700;display:flex;align-items:center;justify-content:center;font-size:13px}
  .sidebar .foot .who{font-size:12px;font-weight:600}
  .sidebar .foot .who small{display:block;font-weight:400;font-size:10px;color:var(--muted2)}
  .sidebar .foot .signout{margin-top:8px;padding:8px;border-radius:var(--radius-sm);border:1px solid var(--line);
    background:var(--surface);color:var(--muted);cursor:pointer;font-family:inherit;font-size:12px;font-weight:500;width:100%}
  .sidebar .foot .signout:hover{color:var(--red);border-color:var(--red)}

  .main{position:absolute;top:0;left:290px;right:0;bottom:0;display:flex;flex-direction:column}
  .topbar{height:75px;flex:none;display:flex;align-items:center;gap:16px;padding:0 24px;background:rgba(255,255,255,0.9);backdrop-filter:blur(8px);
    border-bottom:1px solid var(--line);position:sticky;top:0;z-index:5}
  .topbar .crumb{font-size:15px;font-weight:600}
  .topbar .crumb span{color:var(--blue)}
  .topbar .status{margin-left:auto;display:flex;align-items:center;gap:8px;font-size:13px;color:var(--muted)}
  .topbar .dot{width:9px;height:9px;border-radius:50%;background:var(--muted2)}
  .topbar .dot.on{background:var(--green)}

  .content{flex:1;overflow-y:auto;padding:8px 8px 20px}
  .content::-webkit-scrollbar{width:10px}
  .content::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:8px;border:2px solid transparent;background-clip:content-box}

  .view{display:none}
  .view.on{display:block}
  .view-head{display:flex;align-items:center;gap:12px;margin-bottom:8px;flex-wrap:wrap}
  .view-head h2{font-size:22px;font-weight:700;letter-spacing:-.3px}
  .view-head .sub{color:var(--muted);font-size:13px;margin-top:2px}
  .view-head .spacer{flex:1}
  .btn{background:var(--blue);border:none;color:#fff;font-weight:600;padding:10px 16px;border-radius:var(--radius-sm);
    cursor:pointer;font-family:inherit;font-size:13.5px;transition:.15s}
  .btn:hover{background:var(--blue-dark)}
  .btn.ghost{background:var(--surface);border:1px solid var(--line);color:var(--txt)}
  .btn.ghost:hover{border-color:var(--blue);color:var(--blue)}
  .btn.danger{background:var(--red-soft);border:1px solid rgba(220,38,38,.25);color:var(--red)}
  .btn.danger:hover{background:var(--red-soft)}

  .stats{display:grid;grid-template-columns:repeat(5,1fr);gap:10px;margin-bottom:12px}
  .stat{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:20px 18px;
    box-shadow:var(--shadow);position:relative;overflow:hidden;display:flex;flex-direction:column;justify-content:flex-end;
    min-height:118px;cursor:default;transition:transform .18s ease,box-shadow .18s ease}
  .stat:hover{transform:translateY(-3px);box-shadow:0 22px 48px rgba(30,40,80,0.22)}
  .stat .lbl{color:rgba(255,255,255,.92);font-size:13px;font-weight:600;margin-bottom:6px;order:0}
  .stat .num{font-size:32px;font-weight:800;letter-spacing:-1px;line-height:1;order:1;color:#fff}
  .stat .total{position:absolute;top:12px;right:12px;font-size:11px;font-weight:600;color:inherit;
    background:rgba(255,255,255,.22);padding:3px 9px;border-radius:20px;color:#fff}
  .stat .total b{font-weight:800}
  .stat.amber{background:linear-gradient(135deg,#F59E0B,#f0a30a)}
  .stat.blue{background:linear-gradient(135deg,#3B82F6,#2f74e8)}
  .stat.violet{background:linear-gradient(135deg,#8B5CF6,#7c4df0)}
  .stat.cyan{background:linear-gradient(135deg,#06B6D4,#05a7c4)}
  .stat.emerald{background:linear-gradient(135deg,#10B981,#0fae78)}
  .stat{border:none;box-shadow:0 8px 18px rgba(30,40,80,.12)}

  .card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:14px;
    box-shadow:var(--shadow)}
  .card h3{font-size:15px;font-weight:700;margin-bottom:16px}
  .grid2{display:grid;grid-template-columns:1fr 1fr;gap:16px}
  .stats.four{grid-template-columns:repeat(4,1fr)}
  .chart{display:flex;gap:14px;align-items:flex-end;padding:14px 4px 0}
  .ch-col{flex:1;display:flex;flex-direction:column;align-items:center;gap:8px}
  .ch-bars{height:150px;display:flex;align-items:flex-end;gap:6px;width:100%;justify-content:center}
  .ch-bar{width:22px;border-radius:6px 6px 0 0;min-height:4px}
  .ch-bar.rev{background:linear-gradient(180deg,#3B82F6,#2f74e8)}
  .ch-bar.prof{background:linear-gradient(180deg,#10B981,#0fae78)}
  .ch-col small{color:var(--muted);font-size:11px}
  .rep-head{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-bottom:20px}
  .rep-head h3{margin-bottom:0;color:var(--blue)}
  .rep-head .sub2{font-size:12px;color:var(--muted2);font-weight:500}
  .arch{position:relative;display:flex;justify-content:space-between;gap:80px;padding:22px 26px;
    background:var(--surface2);border:1px solid var(--line);border-radius:var(--radius-sm)}
  .arch svg{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
  .arch svg path{stroke-dasharray:6 6;stroke-linecap:round;animation:archFlow 1.2s linear infinite}
  @keyframes archFlow{to{stroke-dashoffset:-12}}
  .arch-col{width:min(340px,44%)}
  .arch-lbl{font-size:11px;text-transform:uppercase;letter-spacing:1px;color:var(--muted2);font-weight:600;margin-bottom:12px}
  .arch-node{height:40px;display:flex;align-items:center;gap:9px;background:var(--surface);border:1px solid var(--line);
    border-radius:var(--radius-sm);font-size:13px;font-weight:600;margin-bottom:12px;padding:0 14px;position:relative;z-index:1;
    box-shadow:var(--shadow);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .arch-node.cl{justify-content:center}
  .arch-node .pf-av{flex:none}
  .rep-scroll{max-height:190px;overflow-y:auto}
  .rep-scroll::-webkit-scrollbar{width:8px}
  .rep-scroll::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:8px}
  .fin-head{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:14px}
  .fin-head h3{margin:0}
  .form-input.fin-sel{width:auto;padding:4px 8px;font-size:12px;border-radius:8px}
  .fin-stats{margin-left:auto;display:flex;align-items:center;gap:10px;flex-wrap:wrap;font-size:12.5px;font-weight:700;white-space:nowrap}
  .fin-stats .sep{color:var(--muted2);font-weight:400}
  .fin-scroll{overflow-x:auto}
  td.fin-edit{cursor:text}
  td.fin-edit:hover{background:var(--blue-soft)}
  .fin-cell{width:110px;padding:4px 6px;border:1px solid var(--blue);border-radius:6px;font:inherit;font-weight:700;color:var(--ink,#1e293b);background:var(--surface)}
  th[data-finsort], th[data-projsort]{cursor:pointer;user-select:none}
  th[data-finsort] .sic, th[data-projsort] .sic{font-size:10px;margin-left:4px;color:var(--muted2)}
  th[data-finsort].on, th[data-projsort].on{color:var(--blue)}
  tr.trow td{font-weight:800;border-top:2px solid var(--line);background:var(--surface2)}
  .btn-inv{background:var(--blue-soft);color:var(--blue);border:1px solid var(--blue);border-radius:7px;padding:4px 10px;
    font-size:12px;font-weight:700;cursor:pointer;white-space:nowrap}
  .btn-inv:hover{background:var(--blue);color:#fff}
  .inv-modal{width:min(760px,96vw);max-height:92vh;height:auto;overflow:hidden;display:flex;flex-direction:column;
    padding:10px 14px 12px;box-sizing:border-box}
  .inv-modal #invoiceBody{overflow-y:auto;flex:1 1 auto;min-height:0;padding-bottom:4px;padding-right:6px;margin-right:-6px}
  .inv-modal #invoiceBody::-webkit-scrollbar{width:6px}
  .inv-modal #invoiceBody::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:6px}
  .inv-modal > .no-print, .inv-modal > .modal-actions{flex:none}
  .invoice{border:1px solid var(--line);border-radius:10px;padding:12px;background:var(--surface);overflow:visible;word-break:break-word;font-size:11px;box-sizing:border-box}
  .invoice table{width:100%;table-layout:fixed}
  .invoice td, .invoice th{word-break:break-word;white-space:normal;font-size:11px}
  .invoice img{max-width:120px;max-height:120px;object-fit:contain;display:block}
  .inv-top{display:flex;justify-content:space-between;gap:8px;margin-bottom:10px}
  .inv-brand{font-size:14px;font-weight:800;color:var(--blue)}
  .inv-brand small{display:block;font-size:9px;color:var(--muted);font-weight:500;margin-top:1px}
  .inv-meta{text-align:right}
  .inv-meta .no{font-size:12px;font-weight:800}
  .inv-meta .dt{font-size:10px;color:var(--muted);margin-top:1px}
  .inv-parties{display:flex;gap:12px;margin-bottom:8px;flex-wrap:wrap}
  .inv-parties .lbl{font-size:9px;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);font-weight:700;margin-bottom:2px}
  .inv-parties .nm{font-weight:700;font-size:12px}
  .inv-parties .sub{font-size:10px;color:var(--muted)}
  table.inv-table th{text-align:left;font-size:10px}
  .inv-totals{margin-left:auto;width:min(260px,100%)}
  .inv-totals .ln{display:flex;justify-content:space-between;font-size:11px;padding:3px 0}
  .inv-totals .ln.due{font-weight:800;font-size:12px;border-top:2px solid var(--line);margin-top:3px;padding-top:6px}
  .inv-foot{margin-top:10px;padding-top:6px;border-top:1px solid var(--line);font-size:9.5px;color:var(--muted)}
  .inv-wa{margin-top:12px;padding-top:10px;border-top:1px solid var(--line)}
  .inv-wa .form-label{margin:0 0 4px;font-size:10px}
  .inv-wa-row{display:flex;gap:8px}
  .inv-wa-row .form-input{flex:1}
  .btn.wa{background:#25D366;color:#fff;white-space:nowrap}
  .btn.wa:hover{background:#1fb457}
  /* Landscape / two-column layout on wider screens so the invoice needs less vertical scrolling */
  @media (min-width:680px){
    .invoice{display:grid;grid-template-columns:1fr 1fr;column-gap:16px;grid-template-areas:
      "top top"
      "parties parties"
      "pay pay"
      "summary summary"
      "table totals"
      "milestones milestones"
      "payprint payprint"
      "foot foot"}
    .invoice .inv-top{grid-area:top}
    .invoice .inv-parties{grid-area:parties}
    .invoice .inv-pay-block{grid-area:pay}
    .invoice .inv-summary{grid-area:summary;min-width:0}
    .invoice #invPayPrint{grid-area:payprint;min-width:0}
    .invoice table.inv-table:first-of-type{grid-area:table}
    .invoice .inv-totals{grid-area:totals;margin-left:0;width:100%;align-self:start}
    .invoice .inv-milestones{grid-area:milestones}
    .invoice .inv-foot{grid-area:foot}
  }
  @media (max-height:480px){
    .inv-modal{max-height:98vh;padding:6px 10px 8px}
    .inv-modal h3{display:none}
    .invoice{font-size:10px}
    .inv-brand{font-size:12px}
  }
  @media print{
    @page{margin:0}
    html,body{margin:0;padding:0}
    body *{visibility:hidden}
    #invoiceOverlay{position:absolute;display:block !important;background:none}
    #invoiceBody, #invoiceBody *{visibility:visible}
    #invoiceBody{position:absolute;left:0;top:0;width:100%}
    .inv-modal{box-shadow:none;border:none;max-height:none;overflow:visible;width:100%;border-radius:0;display:block}
    .inv-modal #invoiceBody{overflow:visible}
    .invoice{border:none;padding:15mm;display:block !important}
    .no-print{display:none !important}
  }

  .pf-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(340px,1fr));gap:16px}
  .pf-card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);
    padding:20px;display:flex;flex-direction:column;gap:14px;transition:transform .15s,box-shadow .15s}
  .pf-card.drag-over{outline:2px dashed var(--blue);outline-offset:-4px;transform:scale(1.02);box-shadow:var(--shadow-lg)}
  .pf-head{display:flex;align-items:center;justify-content:space-between;gap:10px}
  .pf-head .nm{font-size:17px;font-weight:800;color:var(--blue)}
  .pf-actions{display:flex;gap:6px}
  .pf-actions button{background:var(--surface2);border:1px solid var(--line);border-radius:7px;padding:6px 10px;
    font-size:12px;font-weight:600;cursor:pointer;color:var(--txt)}
  .pf-actions button:hover{border-color:var(--blue);color:var(--blue)}
  .pf-earn{display:flex;align-items:flex-end;justify-content:space-between;border-top:1px solid var(--line);
    padding-top:14px}
  .pf-earn .amt{font-size:22px;font-weight:800;color:var(--green)}
  .pf-earn .lab{font-size:12px;color:var(--muted)}
  .pf-pills{display:flex;gap:10px}
  .pf-pill{flex:1;text-align:center;background:var(--surface2);border-radius:9px;padding:8px 6px}
  .pf-pill b{display:block;font-size:18px;font-weight:800}
  .pf-pill small{font-size:11px;color:var(--muted)}
  .pf-pill.done b{color:var(--green)} .pf-pill.ongoing b{color:var(--gold)} .pf-pill.pending b{color:var(--red)}
  .pf-projects{display:flex;flex-direction:column;gap:6px;max-height:140px;overflow-y:auto;border-top:1px solid var(--line);padding-top:12px}
  .pf-info{display:flex;flex-direction:column;gap:6px;font-size:12.5px;color:var(--muted);
    border-top:1px solid var(--line);padding-top:12px}
  .pf-info b{color:var(--txt);font-weight:600}
  .pf-proj{display:flex;align-items:center;justify-content:space-between;gap:8px;background:var(--surface2);
    padding:7px 10px;border-radius:8px;font-size:12.5px}
  .pf-proj .nm{font-weight:600}
  .pf-proj .st{font-size:11px;font-weight:700}
  .pf-proj .in{display:flex;align-items:center;gap:5px;color:var(--muted);font-size:11px}
  .pf-av{width:24px;height:24px;border-radius:50%;background:var(--blue-soft);color:var(--blue);
    display:inline-flex;align-items:center;justify-content:center;font-size:11px;font-weight:700}

  /* ── Payment Method Cards ── */
  .pm-card{
    background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
    box-shadow:var(--shadow);display:flex;flex-direction:column;overflow:hidden;
    transition:box-shadow .18s,transform .18s;
  }
  .pm-card:hover{box-shadow:var(--shadow-lg);transform:translateY(-2px)}
  .pm-card.drag-over{outline:2px dashed var(--blue);outline-offset:-4px;transform:scale(1.02)}
  .pm-header{
    display:flex;align-items:center;gap:12px;padding:16px 18px 14px;
    border-bottom:1px solid var(--line);
  }
  .pm-icon{
    width:42px;height:42px;border-radius:10px;flex:none;
    display:flex;align-items:center;justify-content:center;
  }
  .pm-icon.bank{background:linear-gradient(135deg,#1976d2,#1259a8)}
  .pm-icon.wallet{background:linear-gradient(135deg,#16a34a,#0f8a3a)}
  .pm-icon.platform{background:linear-gradient(135deg,#7c3aed,#6328d0)}
  .pm-icon.paypal{background:linear-gradient(135deg,#003087,#009CDE)}
  .pm-icon.paypal svg{fill:#fff;stroke:none}
  .pm-icon svg{width:22px;height:22px;fill:none;stroke:#fff;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
  .pm-title{flex:1;min-width:0}
  .pm-title .name{font-size:15px;font-weight:700;color:var(--txt);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .pm-title .type-badge{
    display:inline-block;margin-top:3px;padding:2px 8px;border-radius:20px;
    font-size:10px;font-weight:700;letter-spacing:.05em;text-transform:uppercase;
  }
  .pm-title .type-badge.bank{background:var(--blue-soft);color:var(--blue)}
  .pm-title .type-badge.wallet{background:var(--green-soft);color:var(--green)}
  .pm-title .type-badge.platform{background:var(--purple-soft);color:var(--purple)}
  .pm-title .type-badge.paypal{background:#e6f0ff;color:#003087}
  .pm-title .type-badge.paypal::before{content:"";}
  .pm-body{padding:14px 18px;flex:1;font-size:12.5px;color:var(--muted);line-height:1.65}
  .pm-body .pm-row{display:flex;gap:6px;align-items:baseline}
  .pm-body .pm-row .lbl{font-size:11px;font-weight:600;color:var(--muted2);min-width:58px;flex:none;text-transform:uppercase;letter-spacing:.04em}
  .pm-body .pm-row .val{color:var(--txt);font-weight:500;word-break:break-all}
  .pm-body .qr-wrap{margin-top:8px;text-align:center}
  .pm-body .qr-wrap img{max-width:140px;border:1px solid var(--line);border-radius:8px}
  .pm-body .qr-link{display:inline-block;margin-top:6px;font-size:12px;color:var(--blue);font-weight:600}
  .pm-footer{
    display:flex;gap:8px;padding:10px 18px 14px;
    border-top:1px solid var(--line);background:var(--surface2);
  }
  .pm-footer button{
    flex:1;padding:7px 10px;border-radius:8px;font-size:12px;font-weight:600;
    cursor:pointer;font-family:inherit;transition:.15s;border:1px solid var(--line);
    background:var(--surface);color:var(--muted);
  }
  .pm-footer button:hover{border-color:var(--blue);color:var(--blue);background:#fff}
  .pm-footer button.del:hover{border-color:var(--red);color:var(--red);background:#fff}

  .kb-board{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;align-items:start}
  .kb-col{border-radius:var(--radius);background:var(--surface2);border:1px solid var(--line);overflow:hidden}
  .kb-col.progress{--accent:#3B82F6;--accent-soft:var(--blue-soft)}
  .kb-col.hold{--accent:#F59E0B;--accent-soft:var(--orange-soft)}
  .kb-col.review{--accent:#8B5CF6;--accent-soft:var(--purple-soft)}
  .kb-col.completed{--accent:#10B981;--accent-soft:var(--green-soft)}
  .kb-head{padding:13px 14px;display:flex;align-items:center;gap:8px;font-weight:700;font-size:13px}
  .kb-head .dot{width:9px;height:9px;border-radius:50%;flex:none;background:var(--accent)}
  .kb-head .kb-count{margin-left:auto;background:var(--surface);border:1px solid var(--line);border-radius:20px;
    padding:2px 10px;font-size:11.5px;font-weight:700;color:var(--muted)}
  .kb-body{padding:10px;display:flex;flex-direction:column;gap:10px;min-height:160px;max-height:560px;overflow-y:auto}
  .kb-body::-webkit-scrollbar{width:6px}
  .kb-body::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:6px}
  .kb-body.dragover{outline:2px dashed var(--accent);outline-offset:-6px}
  .kb-card{background:var(--surface);border:1px solid var(--line);border-left:3px solid var(--accent);
    border-radius:var(--radius-sm);padding:14px;box-shadow:var(--shadow);display:flex;flex-direction:column;gap:10px;
    cursor:grab;transition:transform .15s,box-shadow .15s}
  .kb-card:hover{transform:translateY(-2px);box-shadow:0 10px 26px rgba(16,24,40,.10)}
  .kb-card:active{cursor:grabbing}
  .kb-top{display:flex;align-items:flex-start;justify-content:space-between;gap:8px}
  .kb-title{font-size:14px;font-weight:700;line-height:1.35}
  .kb-icons{display:flex;gap:6px;flex:none}
  .kb-icons button{background:none;border:none;cursor:pointer;color:var(--muted2);font-size:12px;padding:2px}
  .kb-icons button:hover{color:var(--blue)}
  .kb-icons button.del:hover{color:var(--red)}
  .kb-meta{font-size:12px;color:var(--muted)}
  .kb-pill{display:inline-block;background:var(--accent-soft);border-radius:6px;padding:3px 9px;font-size:11px;
    font-weight:600;color:var(--accent);font-family:ui-monospace,Consolas,monospace}
  .kb-bar{height:5px;background:var(--line);border-radius:20px;overflow:hidden}
  .kb-bar>div{height:100%;border-radius:20px;background:var(--accent)}
  .kb-foot{display:flex;align-items:center;justify-content:space-between}
  .kb-due{font-size:12px;color:var(--muted)}

  table{width:100%;border-collapse:collapse}
  th{font-size:11px;text-transform:uppercase;letter-spacing:.7px;color:var(--muted2);text-align:left;
    padding:10px 12px;font-weight:600;border-bottom:1px solid var(--line);position:sticky;top:0;background:var(--surface);z-index:2}
  td{padding:12px 12px;border-bottom:1px solid var(--line);font-size:13.5px}
  tr:last-child td{border-bottom:none}
  tr:hover td{background:var(--surface2)}
  .gantt-head{position:sticky;top:0;background:var(--surface);z-index:2}
  /* Projects List table — gap like Timeline gantt-head */
  #projList table{border:1px solid var(--line);border-radius:12px;overflow:hidden;border-collapse:separate;border-spacing:0}
  #projList thead th{background:var(--surface2);border-bottom:1px solid var(--line);padding:12px}
  #projList thead th:first-child{border-top-left-radius:12px} #projList thead th:last-child{border-top-right-radius:12px}
  #projList{padding:4px 0}
  .badge{display:inline-block;padding:3px 10px;border-radius:20px;font-size:11.5px;font-weight:600}
  .badge.g{background:var(--green-soft);color:var(--green)}
  .badge.o{background:var(--orange-soft);color:var(--orange)}
  .badge.b{background:var(--blue-soft);color:var(--blue)}
  .badge.r{background:var(--red-soft);color:var(--red)}
  .badge.p{background:var(--purple-soft);color:var(--purple)}
  .status-select{appearance:none;-webkit-appearance:none;border:none;border-radius:20px;padding:5px 26px 5px 12px;
    font-size:11.5px;font-weight:600;font-family:inherit;cursor:pointer;outline:none;
    background-repeat:no-repeat;background-position:right 9px center;background-size:9px;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235b6b85' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E")}
  .status-select.progress{background-color:var(--blue-soft);color:var(--blue)}
  .status-select.hold{background-color:var(--orange-soft);color:var(--orange)}
  .status-select.review{background-color:var(--purple-soft);color:var(--purple)}
  .status-select.completed{background-color:var(--green-soft);color:var(--green)}
  .row-actions button{background:none;border:none;color:var(--muted2);cursor:pointer;margin:0 4px;font-size:14px;padding:4px}
  .row-actions button:hover{color:var(--red)}

  /* Business Leads — premium table */
  .biz-tbl-wrap{border:1px solid var(--line);border-radius:16px;background:var(--surface);overflow:auto;
    box-shadow:0 1px 2px rgba(15,23,42,.04), 0 16px 40px -24px rgba(15,23,42,.25)}
  .biz-tbl{min-width:1480px}
  .biz-tbl thead th{position:sticky;top:0;z-index:3;padding:14px;font-size:10px;letter-spacing:1.1px;font-weight:700;
    color:var(--muted2);background:linear-gradient(180deg,#f8fafc,#f1f5f9);border-bottom:1px solid var(--line);white-space:nowrap}
  .biz-tbl thead th:last-child{text-align:right}
  .biz-tbl tbody td{padding:13px 14px;font-size:13px;vertical-align:middle;border-bottom:1px solid #eef2f7}
  .biz-tbl tbody tr:last-child td{border-bottom:none}
  .biz-tbl tbody tr:hover td{background:linear-gradient(90deg,rgba(59,130,246,.055),rgba(59,130,246,.012))}
  .biz-sno{display:inline-flex;width:26px;height:26px;align-items:center;justify-content:center;border-radius:8px;
    background:var(--surface2);border:1px solid var(--line);font-size:11px;font-weight:700;color:var(--muted2)}
  .biz-ctry{font-size:15px;margin-right:4px}
  .biz-chip{display:inline-block;max-width:170px;padding:4px 10px;border-radius:8px;font-size:11px;font-weight:600;
    line-height:1.35;background:linear-gradient(135deg,var(--blue-soft),#eef2ff);color:var(--blue);border:1px solid rgba(59,130,246,.14)}
  .biz-sub{font-size:11px;color:var(--muted2);margin-top:4px}
  .biz-web{display:inline-block;padding:2px 7px;border-radius:6px;font-size:9.5px;font-weight:800;letter-spacing:.4px;
    text-transform:uppercase;vertical-align:middle;background:#ecfdf5;color:#059669;border:1px solid rgba(5,150,105,.25)}
  .biz-co{display:flex;align-items:center;gap:10px;min-width:170px}
  .biz-mono{flex:none;width:34px;height:34px;border-radius:10px;display:flex;align-items:center;justify-content:center;
    font-size:12px;font-weight:800;color:#fff;background:linear-gradient(135deg,#3b82f6,#6366f1);
    box-shadow:0 6px 14px -8px rgba(59,130,246,.85)}
  .biz-co .nm{font-weight:700;font-size:13.5px;line-height:1.25}
  .biz-co .dom{font-size:11px;color:var(--muted2);margin-top:2px;max-width:190px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .biz-person{display:flex;align-items:center;gap:8px}
  .biz-av{flex:none;width:26px;height:26px;border-radius:50%;display:flex;align-items:center;justify-content:center;
    font-size:10px;font-weight:700;background:var(--purple-soft);color:var(--purple);border:1px solid rgba(255,255,255,.7)}
  .biz-link{display:inline-flex;align-items:center;gap:7px;color:var(--blue);text-decoration:none;font-size:12.5px;max-width:220px}
  .biz-link:hover{text-decoration:underline}
  .biz-link.mono{color:inherit}
  .biz-link .ic{flex:none;width:22px;height:22px;border-radius:7px;background:var(--blue-soft);color:var(--blue);
    display:inline-flex;align-items:center;justify-content:center}
  .biz-link .ell{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .biz-pill{display:inline-flex;align-items:center;gap:6px;padding:5px 11px;border-radius:999px;font-size:11px;
    font-weight:700;white-space:nowrap;border:1px solid transparent}
  .biz-pill .dot{width:6px;height:6px;border-radius:50%;background:currentColor;box-shadow:0 0 0 3px rgba(255,255,255,.65)}
  .biz-pill.sent{background:var(--green-soft);color:var(--green);border-color:rgba(22,163,74,.18)}
  .biz-pill.not{background:var(--orange-soft);color:var(--orange);border-color:rgba(234,138,0,.18)}
  .biz-acts{display:flex;gap:5px;justify-content:flex-end}
  .biz-acts button{width:30px;height:30px;padding:0;border-radius:9px;border:1px solid var(--line);background:var(--surface);
    color:var(--muted2);font-size:13px;font-weight:700;display:inline-flex;align-items:center;justify-content:center;
    cursor:pointer;transition:transform .15s,box-shadow .15s,background .15s,color .15s}
  .biz-acts button:hover{transform:translateY(-1px);border-color:var(--blue);color:var(--blue);background:var(--blue-soft);
    box-shadow:0 5px 12px -7px rgba(59,130,246,.8)}
  .biz-acts button.on{background:var(--blue-soft);color:var(--blue);border-color:rgba(59,130,246,.35)}
  .biz-acts button.li{background:#0a66c2;border-color:#0a66c2;color:#fff;font-size:12px;letter-spacing:-.3px}
  .biz-acts button.li:hover{background:#004182;border-color:#004182;color:#fff;box-shadow:0 5px 12px -7px rgba(10,102,194,.9)}
  .biz-acts button.danger:hover{border-color:var(--red);color:var(--red);background:var(--red-soft);
    box-shadow:0 5px 12px -7px rgba(239,68,68,.8)}
  .biz-acts button[disabled]{opacity:.4;pointer-events:none}
  .biz-empty{padding:46px 20px !important;color:var(--muted);font-size:13.5px}

  .empty{color:var(--muted2);text-align:center;padding:34px;font-size:13px}
  .muted{color:var(--muted)}

  .overlay{position:fixed;inset:0;background:rgba(15,23,42,.5);z-index:50;display:none;
    align-items:center;justify-content:center}
  .overlay.on{display:flex}
  .modal{width:min(580px,96vw);max-height:96vh;overflow-y:hidden;border-radius:var(--radius);background:var(--surface);
    padding:12px 16px;box-shadow:var(--shadow-lg);display:flex;flex-direction:column}
  .modal h3{font-size:14px;font-weight:700;margin-bottom:8px}
  .modal .row{display:flex;gap:6px}
  .modal .row > *{flex:1}
  .modal .row.tight{gap:8px}
  .modal .row.tight > *{flex:1 1 0;min-width:0}
  .modal .row.tight .form-input{padding:5px 7px;font-size:11.5px}
  .modal .row.tight .form-label{margin:4px 0 2px;font-size:10px}
  .form-label{font-size:10px;color:var(--muted);display:block;margin:6px 0 3px;font-weight:600}
  .form-input{width:100%;padding:6px 8px;border-radius:var(--radius-sm);border:1px solid var(--line);
    background:var(--surface2);color:var(--txt);font-size:12px;outline:none;font-family:inherit;transition:.15s}
  .form-input:focus{border-color:var(--blue);background:#fff;box-shadow:0 0 0 3px rgba(25,118,210,.12)}
  .modal-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:10px}
  #modalBody{overflow-y:auto;flex:1;min-height:0;padding-right:4px;margin-right:-4px}
  #modalBody::-webkit-scrollbar{width:6px}
  #modalBody::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:6px}

  .toast{position:fixed;bottom:26px;left:50%;transform:translateX(-50%) translateY(120px);z-index:80;
    background:#0f172a;color:#fff;padding:13px 22px;border-radius:var(--radius-sm);font-size:13.5px;
    transition:.3s;box-shadow:var(--shadow-lg)}
  .toast.on{transform:translateX(-50%) translateY(0)}
  .toast.ok{background:#16a34a}
  .toast.err{background:#dc2626}

  .boot{position:fixed;inset:0;z-index:100;background:linear-gradient(160deg,#0b1d33,#1976d2);
    display:flex;align-items:center;justify-content:center;flex-direction:column;gap:18px;transition:opacity .4s}
  .boot.hide{opacity:0;pointer-events:none}
  .boot .ring{width:44px;height:44px;border-radius:50%;border:3px solid rgba(255,255,255,.2);
    border-top-color:#fff;animation:spin 1s linear infinite}
  @keyframes spin{to{transform:rotate(360deg)}}
  .boot small{color:rgba(255,255,255,.85);font-size:13px}

  @media(max-width:1080px){
    .stats{grid-template-columns:repeat(3,1fr) !important}
    .stats[style]{grid-template-columns:repeat(3,1fr) !important}
    .stats.four{grid-template-columns:repeat(2,1fr) !important}
    .grid2{grid-template-columns:1fr}
    .arch{gap:40px}
    .arch-col{width:46%}
    .kb-board{grid-template-columns:repeat(2,1fr)}
    .sidebar{position:fixed;z-index:11;transform:translateX(-100%)}
    .sidebar:not(.collapsed){transform:translateX(0)}
    .sidebar.collapsed{transform:translateX(-100%)}
    .main{left:0}
    .main.expanded{left:0}
    .pf-grid{grid-template-columns:repeat(auto-fill,minmax(300px,1fr))}
    .stat .num{font-size:26px}
    .stat .lbl{font-size:12px}
    .card{padding:18px}
    .view-head h2{font-size:19px}
    td{font-size:12.5px}
  }
  @media(max-width:768px){
    .topbar{height:56px;padding:0 14px;gap:10px}
    .topbar .crumb{font-size:13px}
    .content{padding:14px 12px 24px}
    .view-head{flex-direction:column;align-items:stretch;gap:8px}
    .view-head h2{font-size:16px}
    .view-head .sub{font-size:11px}
    .view-head .spacer{display:none}
    .view-head .btn{width:100%;justify-content:center;font-size:12px;padding:8px 12px}
    .stats{grid-template-columns:repeat(2,1fr) !important;gap:8px}
    .stats[style]{grid-template-columns:repeat(2,1fr) !important}
    .stats.four{grid-template-columns:repeat(2,1fr) !important}
    .stat{min-height:84px;padding:12px 10px}
    .stat .num{font-size:20px}
    .stat .lbl{font-size:11px}
    .stat .total{font-size:8px;padding:2px 6px}
    .card{padding:12px;border-radius:10px}
    .card h3{font-size:13px}
    .grid2{gap:10px}
    .pf-grid{grid-template-columns:1fr;gap:10px}
    .pf-card{padding:12px}
    .pf-head .nm{font-size:13px}
    .pf-info{font-size:11px}
    .pf-earn .amt{font-size:16px}
    .pf-earn .lab{font-size:11px}
    .kb-board{grid-template-columns:1fr;gap:10px}
    .kb-card{padding:10px}
    .kb-title{font-size:12px}
    .arch{flex-direction:column;gap:12px;padding:12px}
    .arch-col{width:100%}
    .arch svg{display:none}
    .fin-head{flex-direction:column;align-items:stretch;gap:8px}
    .fin-stats{margin-left:0;font-size:11px}
    .fin-scroll{margin:0 -12px;padding:0 12px}
    table{font-size:11.5px}
    th{font-size:9px;padding:6px 6px}
    td{padding:8px 6px;font-size:11.5px}
    .badge{font-size:10px;padding:2px 7px}
    .gantt-head{flex-direction:column;align-items:stretch;padding:8px;font-size:12px}
    .gantt-times{margin-left:0;margin-top:6px;overflow-x:auto}
    .gantt-label{width:100px}
    .gantt-label .nm{font-size:11px}
    .gantt-label .sub{font-size:10px}
    .timeline{padding-left:16px}
    .tl-item{flex-direction:column;gap:4px;padding:8px 0}
    .tl-date{font-size:11px;min-width:auto}
    .tl-title{font-size:12px}
    .tl-meta{font-size:11px}
    .modal{width:96vw;padding:10px}
    .modal h3{font-size:13px}
    .modal .row{flex-direction:column;gap:0}
    .modal .row > *{width:100%}
    .form-label{font-size:9px}
    .form-input{font-size:11px;padding:5px 7px}
    .form-input.fin-sel{width:100%;font-size:11px}
    .inv-modal{width:96vw;padding:8px}
    .rep-head{flex-direction:column;align-items:flex-start}
    .rep-head h3{font-size:13px}
    div[style*="grid-template-columns:repeat(4,1fr)"]{grid-template-columns:repeat(2,1fr) !important}
    div[style*="grid-template-columns:repeat(3,1fr)"]{grid-template-columns:repeat(2,1fr) !important}
  }
  @media(max-width:680px){
    .kb-board{grid-template-columns:1fr}
  }
  @media(max-width:480px){
    .content{padding:10px 8px 20px}
    .topbar{padding:0 8px;height:50px}
    .topbar .crumb{font-size:12px}
    .topbar .status{font-size:10px}
    #sidebarToggle{padding:5px 7px;font-size:14px}
    .view-head h2{font-size:15px}
    .view-head .sub{font-size:10px}
    .stats{grid-template-columns:1fr !important}
    .stats[style]{grid-template-columns:1fr !important}
    .stats.four{grid-template-columns:1fr !important}
    .stat{min-height:72px;padding:10px}
    .stat .num{font-size:18px}
    .stat .lbl{font-size:10px}
    .stat .total{position:static !important;display:inline-block;margin-bottom:4px;font-size:8px}
    #repDevCostPct,#repProfitPct{width:28px !important;height:28px !important;font-size:8px !important;left:6px !important;top:6px !important;right:auto !important;bottom:auto !important}
    .card{padding:10px}
    .card h3{font-size:12px}
    .pf-card{padding:10px}
    .pf-head .nm{font-size:12px}
    .btn{padding:7px 10px;font-size:11px}
    table{font-size:11px}
    th{font-size:8px}
    td{font-size:11px}
    .gantt-label{width:80px}
    .auth-card{padding:24px 16px;width:96vw}
    .auth-card .brand{font-size:16px}
    div[style*="grid-template-columns:repeat"]{grid-template-columns:1fr !important}
    .fin-stats{font-size:10px}
  }
  .timeline{position:relative;padding-left:28px}
  .timeline::before{content:'';position:absolute;left:9px;top:6px;bottom:6px;width:2px;background:var(--line);border-radius:2px}
  .tl-item{position:relative;display:flex;gap:14px;align-items:flex-start;padding:12px 0;border-bottom:1px solid var(--line)}
  .tl-item:last-child{border-bottom:none}
  .tl-dot{position:absolute;left:-23px;top:16px;width:12px;height:12px;border-radius:50%;background:var(--blue);border:2px solid #fff;box-shadow:0 0 0 2px var(--blue-soft)}
  .tl-dot.hold{background:var(--orange)}
  .tl-dot.review{background:var(--purple)}
  .tl-dot.completed{background:var(--green)}
  .tl-date{flex:none;min-width:110px;font-size:12px;color:var(--muted);font-weight:600;padding-top:2px}
  .tl-body{flex:1}
  .tl-title{font-size:14px;font-weight:700}
  .tl-meta{font-size:12px;color:var(--muted);margin-top:3px}
  .gantt-wrap{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;display:flex;flex-direction:column;max-height:500px}
  .gantt-head{display:flex;align-items:center;gap:12px;padding:12px 16px;border-bottom:1px solid var(--line);font-size:13px;font-weight:700;color:var(--blue);position:sticky;top:0;background:var(--surface);z-index:5;margin:0;flex:none;box-shadow:0 2px 4px rgba(16,24,40,.08)}
  .gantt-times{flex:1;display:flex;margin-left:200px;gap:8px}
  .gantt-times span{flex:1;text-align:center;font-size:11px;color:var(--muted);font-family:ui-monospace,Consolas,monospace;white-space:nowrap}
  .gantt-wrap > div:nth-child(2){overflow-y:auto;flex:1;min-height:0}
  .gantt-row{display:flex;align-items:center;padding:10px 16px;border-bottom:1px solid var(--line);gap:12px}
  .gantt-row:last-child{border-bottom:none}
  .gantt-label{width:190px;flex:none;overflow:hidden}
  .gantt-label .nm{font-size:12.5px;font-weight:700;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .gantt-label .sub{font-size:11px;color:var(--muted)}
  .gantt-track{flex:1;height:16px;background:var(--surface2);border-radius:20px;position:relative;overflow:hidden;border:1px solid var(--line)}
  .gantt-bar{position:absolute;top:2px;bottom:2px;border-radius:20px;min-width:6px}
  .gantt-bar.progress{background:linear-gradient(90deg,#B45309,#d97706)}
  .gantt-bar.hold{background:linear-gradient(90deg,#D97706,#F59E0B)}
  .gantt-bar.review{background:linear-gradient(90deg,#991B1B,#dc2626)}
  .gantt-bar.completed{background:linear-gradient(90deg,#065F46,#10B981)}
  .gantt-today{position:absolute;top:0;bottom:0;width:1px;background:#dc2626;opacity:.9}
  .gantt-today::before{content:'today';position:absolute;top:-14px;left:50%;transform:translateX(-50%);font-size:9px;color:#dc2626;font-weight:700;white-space:nowrap}
  .gantt-legend{display:flex;gap:16px;padding:10px 16px;border-top:1px solid var(--line);font-size:11.5px;color:var(--muted)}
  .gantt-legend i{width:10px;height:10px;border-radius:3px;display:inline-block;margin-right:5px;vertical-align:middle}
  .sidebar{transition:transform .3s ease, width .3s ease}
  .main{transition:left .3s ease}
  .sidebar.collapsed{transform:translateX(-100%);width:290px}
  .main.expanded{left:0}
  .sidebar-overlay{display:none;position:fixed;inset:0;background:rgba(15,23,42,.35);z-index:9}
  .sidebar-overlay.on{display:block}

  /* ── Searchable country dropdown ── */
  .country-wrap{position:relative}
  .country-dropdown{position:absolute;top:calc(100% + 6px);left:0;right:0;background:var(--surface);border:1px solid var(--line);border-radius:10px;box-shadow:var(--shadow-lg);max-height:220px;overflow-y:auto;z-index:50;display:none}
  .country-dropdown::-webkit-scrollbar{width:6px}
  .country-dropdown::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:6px}
  .country-opt{padding:8px 12px;cursor:pointer;display:flex;gap:8px;align-items:center;font-size:13px;transition:.1s}
  .country-opt:hover{background:var(--surface2)}
  .country-opt.selected{background:var(--blue-soft);color:var(--blue);font-weight:600}
  .country-opt .flag{font-size:15px;flex:none}
  .country-wrap .form-input{padding-right:32px}
  .country-wrap::after{content:'▾';position:absolute;right:12px;top:50%;transform:translateY(-50%);color:var(--muted2);font-size:11px;pointer-events:none}

  /* Horizon Next polish — rounded 20px, soft shadow, 20px gaps */
  .pf-grid{ gap:20px; }
  .card, .pf-card, .pm-card, .kb-col { border-color:#E9EDF2; }
  .stat{ box-shadow:0 18px 40px rgba(112,144,176,0.08); }
  .content{ max-width:100%; margin:0; width:100%; }

  /* Calendar grid — like Taskora/Horizon */
  .cal-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:6px}
  .cal-head{ text-align:center; font-size:12px; color:var(--muted); padding:8px 0; font-weight:600; }
  .cal-cell{ min-height:92px; border:1px solid var(--line); border-radius:8px; padding:6px; background:var(--surface); position:relative; overflow:hidden; }
  .cal-cell.other{ background:var(--surface2); opacity:0.55; }
  .cal-cell.today{ border-color:var(--blue); background:var(--blue-soft); }
  .cal-cell .daynum{ text-align:right; font-size:12px; font-weight:700; color:var(--txt); }
  .cal-cell.today .daynum{ color:var(--blue); }
  .cal-event{ font-size:11px; padding:3px 6px; border-radius:4px; margin-top:4px; cursor:pointer; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-weight:500; line-height:1.2; }
  .cal-event.c1{ background:#ede9fe; color:#6d28d9; }
  .cal-event.c2{ background:#ffedd5; color:#c2410c; }
  .cal-event.c3{ background:#dcfce7; color:#15803d; }
  .cal-event.c4{ background:#fef9c3; color:#854d0e; }
  .cal-event.c5{ background:#fce7f3; color:#be185d; }
  .cal-event.c6{ background:#e0f2fe; color:#0369a1; }
  @media(max-width:768px){
    .cal-grid{ gap:4px; }
    .cal-cell{ min-height:68px; padding:4px; }
    .cal-head{ font-size:11px; padding:4px 0; }
    .cal-event{ font-size:10px; padding:2px 4px; }
  }
  @media(max-width:480px){
    .cal-cell{ min-height:56px; }
    .cal-event{ font-size:9px; }
  }

  /* New Project view — Figma style like screenshot */
  .proj-toolbar{display:flex;align-items:center;gap:12px;margin-bottom:16px;flex-wrap:wrap}
  .proj-search{flex:1;max-width:320px;position:relative}
  .proj-search input{width:100%;padding:10px 12px 10px 36px;border:1px solid var(--line);border-radius:10px;background:var(--surface);font-size:13px;outline:none}
  .proj-search input:focus{border-color:var(--blue);box-shadow:0 0 0 3px rgba(25,118,210,.12)}
  .proj-search svg{position:absolute;left:10px;top:50%;transform:translateY(-50%);width:16px;height:16px;stroke:var(--muted2);fill:none}
  .proj-filter{position:relative}
  .proj-filter-btn{display:flex;align-items:center;gap:6px;padding:9px 12px;border:1px solid var(--line);border-radius:10px;background:var(--surface);font-size:13px;font-weight:500;cursor:pointer}
  .proj-filter-menu{position:absolute;top:calc(100% + 6px);left:0;min-width:160px;background:var(--surface);border:1px solid var(--line);border-radius:10px;box-shadow:var(--shadow-lg);z-index:20;display:none}
  .proj-filter-menu.on{display:block}
  .proj-filter-menu div{padding:9px 12px;font-size:13px;cursor:pointer}
  .proj-filter-menu div:hover{background:var(--surface2)}
  .proj-filter-menu div.active{background:var(--blue-soft);color:var(--blue);font-weight:600}
  .proj-view-toggle{display:flex;border:1px solid var(--line);border-radius:10px;overflow:hidden;margin-left:auto}
  .proj-view-toggle button{padding:8px 12px;border:none;background:var(--surface);font-size:13px;cursor:pointer;display:flex;align-items:center;gap:6px}
  .proj-view-toggle button.on{background:var(--blue-soft);color:var(--blue);font-weight:600}
  .proj-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
  @media(max-width:1080px){ .proj-grid{grid-template-columns:repeat(2,1fr)} }
  @media(max-width:640px){ .proj-grid{grid-template-columns:1fr} }
  .proj-card{background:var(--surface);border:1px solid var(--line);border-radius:16px;padding:16px;box-shadow:var(--shadow);position:relative;overflow:hidden;display:flex;flex-direction:column;gap:12px;transition:transform .15s,box-shadow .15s}
  .proj-card:hover{transform:translateY(-2px);box-shadow:var(--shadow-lg)}
  .proj-card .left-bar{position:absolute;left:0;top:16px;bottom:16px;width:4px;border-radius:0 4px 4px 0}
  .proj-card .left-bar.yellow{background:#f59e0b} .left-bar.blue{background:#3b82f6} .left-bar.green{background:#10b981} .left-bar.gray{background:#94a3b8}
  .proj-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:8px;padding-left:8px}
  .proj-card-title{font-size:15px;font-weight:700;line-height:1.3}
  .proj-card-desc{font-size:12.5px;color:var(--muted);margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .proj-card .star{color:#f59e0b;font-size:14px}
  .proj-card .status-badge{padding:4px 10px;border-radius:20px;font-size:11px;font-weight:600;white-space:nowrap}
  .status-badge.planning{background:#e0f2fe;color:#0284c7} .status-badge.progress{background:#fef9c3;color:#a16207} .status-badge.completed{background:#dcfce7;color:#15803d} .status-badge.hold{background:#fee2e2;color:#dc2626} .status-badge.review{background:#f3e8ff;color:#7c3aed}
  .proj-card .meta-row{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--muted)}
  .proj-card .progress-row{display:flex;align-items:center;justify-content:space-between;font-size:12px;color:var(--muted);font-weight:500}
  .proj-card .progress-bar{height:6px;background:var(--surface2);border-radius:10px;overflow:hidden;margin-top:4px}
  .proj-card .progress-bar>div{height:100%;background:#0f172a;border-radius:10px}
  .proj-card .avatars{display:flex;align-items:center;gap:6px}
  .proj-card .av{width:26px;height:26px;border-radius:50%;background:var(--blue-soft);color:var(--blue);display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;border:2px solid #fff;margin-left:-6px}
  .proj-card .av:first-child{margin-left:0}
  .proj-card .info-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding-top:8px;border-top:1px solid var(--line);font-size:12px}
  .proj-card .info-grid .lbl{font-size:11px;color:var(--muted);font-weight:500}
  .proj-card .info-grid .val{font-weight:600;margin-top:2px}
  .proj-card .priority{padding:3px 8px;border-radius:20px;font-size:11px;font-weight:600}
  .priority.high{background:#fee2e2;color:#dc2626} .priority.medium{background:#fef9c3;color:#a16207} .priority.low{background:#dcfce7;color:#15803d}

  /* ===== Audit Logs ===== */
  .audit-act{display:inline-block;padding:3px 10px;border-radius:7px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
    font-size:12px;background:var(--surface2);border:1px solid var(--line);color:var(--txt)}
  .audit-act.fail{background:var(--red-soft);border-color:#f6cfcf;color:var(--red)}
  #view-auditLogs table td{vertical-align:middle}
  #view-auditLogs #auditSearch{margin-top:2px}
