/* Compass Flipbook – NEARSOL platform look (sidebar + cards) */
:root{
  --cx-navy:#06487d; --cx-navy-2:#073b69; --cx-ink:#0b2b4f;
  --cx-red:#ee3b32; --cx-red-soft:#ff4747;
  --cx-bg:#f8fafc; --cx-line:#e2e8f0; --cx-muted:#64748b; --cx-card:#fff;
  /* sidebar/brand colors: overridden at runtime from Settings */
  --cx-side-1:#06487d; --cx-side-2:#073b69; --cx-side-text:#ffffff; --cx-side-muted:rgba(255,255,255,.62);
  --cx-side-hover:rgba(255,255,255,.08); --cx-side-active:rgba(255,255,255,.14); --cx-side-line:rgba(255,255,255,.12); --cx-side-icobg:rgba(255,255,255,.12);
  --cx-green:#047857; --cx-green-bg:#ecfdf5; --cx-blue-bg:#e8f0fb;
}
*{box-sizing:border-box}
html,body{margin:0}
body.cx{font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  background:var(--cx-bg);color:var(--cx-ink);font-size:14px;line-height:1.5;-webkit-font-smoothing:antialiased}
.cx a{color:inherit}
.cx-shell{display:flex;min-height:100vh}

/* ---------- Sidebar ---------- */
.cx-sidebar{width:253px;flex:0 0 253px;background:linear-gradient(180deg,var(--cx-side-1) 0%,var(--cx-side-2) 100%);
  color:var(--cx-side-text);display:flex;flex-direction:column;position:sticky;top:0;height:100vh;overflow-y:auto;z-index:30}
.cx-brand{padding:26px 26px 22px;border-bottom:1px solid var(--cx-side-line)}
.cx-brand img{display:block;width:auto;height:auto;max-width:190px;max-height:72px}
.cx-nav{padding:10px 12px 24px;flex:1}
.cx-nav-label{margin:22px 12px 8px;font-size:10px;font-weight:700;letter-spacing:.2em;text-transform:uppercase;color:var(--cx-side-muted)}
.cx-nav a{position:relative;display:flex;align-items:center;gap:12px;padding:10px 12px;margin-bottom:4px;border-radius:10px;
  color:var(--cx-side-text);text-decoration:none;font-weight:600;font-size:14px;transition:background .15s}
.cx-nav a:hover{background:var(--cx-side-hover)}
.cx-nav a.active{background:var(--cx-side-active)}
.cx-nav a.active::before{content:"";position:absolute;left:-12px;top:6px;bottom:6px;width:3px;border-radius:0 3px 3px 0;background:var(--cx-red-soft)}
.cx-ico{width:28px;height:28px;border-radius:8px;background:var(--cx-side-icobg);color:var(--cx-side-text);display:grid;place-items:center;flex:0 0 28px}
.cx-ico svg{width:15px;height:15px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

/* ---------- Main ---------- */
.cx-main{flex:1;min-width:0;display:flex;flex-direction:column}
.cx-topbar{height:88px;background:#fff;border-bottom:1px solid var(--cx-line);padding:0 32px;display:flex;align-items:center;gap:16px;position:sticky;top:0;z-index:20}
.cx-menu-btn{display:none;border:1px solid var(--cx-line);background:#fff;border-radius:8px;width:38px;height:38px;cursor:pointer}
.cx-eyebrow{font-size:10.5px;font-weight:700;letter-spacing:.2em;text-transform:uppercase;color:var(--cx-red)}
.cx-topbar h1{margin:2px 0 0;font-size:22px;font-weight:800;color:var(--cx-ink)}
.cx-user{margin-left:auto;display:flex;align-items:center;gap:12px}
.cx-avatar{width:40px;height:40px;border-radius:50%;background:var(--cx-blue-bg);color:var(--cx-navy);display:grid;place-items:center;font-weight:800;font-size:13px;border:1px solid var(--cx-line)}
.cx-user-meta{text-align:right;line-height:1.25}
.cx-user-meta strong{display:block;font-size:13.5px}
.cx-user-meta span{font-size:12px;color:var(--cx-muted)}

.cx-content{padding:34px 48px 60px;width:100%;max-width:1400px;margin:0 auto}
.cx-page-head{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;margin-bottom:24px;flex-wrap:wrap}
.cx-page-head h2{margin:2px 0 4px;font-size:28px;font-weight:800;color:var(--cx-ink)}
.cx-page-head p{margin:0;color:var(--cx-muted)}

/* ---------- Buttons ---------- */
.cx-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;height:40px;padding:0 16px;border-radius:9px;
  border:1px solid var(--cx-line);background:#fff;color:var(--cx-navy);font-weight:700;font-size:13.5px;cursor:pointer;text-decoration:none;font-family:inherit}
.cx-btn:hover{background:#f1f5f9}
.cx-btn.primary{background:var(--cx-navy);border-color:var(--cx-navy);color:#fff}
.cx-btn.primary:hover{background:var(--cx-navy-2)}
.cx-btn.danger{color:#b91c1c;border-color:#fecaca}
.cx-btn.danger:hover{background:#fef2f2}
.cx-btn.sm{height:34px;padding:0 12px;font-size:12.5px}

/* ---------- Cards ---------- */
.cx-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:18px;margin-bottom:24px}
.cx-stat{background:var(--cx-card);border:1px solid var(--cx-line);border-top:3px solid var(--cx-navy);border-radius:14px;padding:20px 22px;box-shadow:0 1px 2px rgba(15,23,42,.04)}
.cx-stat:nth-child(even){border-top-color:var(--cx-red-soft)}
.cx-stat .l{color:#475569;font-size:13.5px;font-weight:500}
.cx-stat .v{margin:8px 0 4px;font-size:30px;font-weight:800;color:var(--cx-navy);line-height:1.1}
.cx-stat .h{color:#94a3b8;font-size:12px}
.cx-panel{background:var(--cx-card);border:1px solid var(--cx-line);border-radius:14px;box-shadow:0 1px 2px rgba(15,23,42,.04);overflow:hidden;margin-bottom:24px}
.cx-panel-head{padding:18px 24px;border-bottom:1px solid var(--cx-line);display:flex;align-items:center;justify-content:space-between;gap:12px}
.cx-panel-head h3{margin:2px 0 0;font-size:16px;font-weight:700}
.cx-panel-body{padding:24px}

/* ---------- Flipbook grid ---------- */
.cx-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:20px}
.cx-book{background:#fff;border:1px solid var(--cx-line);border-radius:14px;overflow:hidden;display:flex;flex-direction:column;box-shadow:0 1px 2px rgba(15,23,42,.04);transition:box-shadow .15s,transform .15s}
.cx-book:hover{box-shadow:0 8px 24px rgba(6,72,125,.12);transform:translateY(-2px)}
.cx-thumb{aspect-ratio:4/3;background:linear-gradient(135deg,#e8f0fb,#f8fafc);display:grid;place-items:center;overflow:hidden;border-bottom:1px solid var(--cx-line)}
.cx-thumb img{width:100%;height:100%;object-fit:contain;display:block}
.cx-thumb span{font-size:12px;color:var(--cx-muted)}
.cx-book-body{padding:16px 18px 18px;display:flex;flex-direction:column;gap:10px;flex:1}
.cx-book h4{margin:0;font-size:15px;font-weight:700;color:var(--cx-ink);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cx-meta{color:var(--cx-muted);font-size:12px}
.cx-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:auto}
.cx-actions form{margin:0}

.cx-pill{display:inline-block;padding:3px 10px;border-radius:999px;font-size:11.5px;font-weight:700;background:var(--cx-blue-bg);color:var(--cx-navy)}
.cx-pill.green{background:var(--cx-green-bg);color:var(--cx-green)}
.cx-pill.gray{background:#f1f5f9;color:#475569}

/* ---------- Forms ---------- */
.cx-form label{display:block;margin:16px 0 6px;font-size:12.5px;font-weight:700;color:#334155}
.cx-form label:first-child{margin-top:0}
.cx-input,.cx-select{width:100%;height:42px;padding:0 12px;border:1px solid #cbd5e1;border-radius:9px;font-size:14px;font-family:inherit;color:var(--cx-ink);background:#fff;outline:none}
.cx-input:focus,.cx-select:focus{border-color:var(--cx-navy);box-shadow:0 0 0 3px rgba(6,72,125,.12)}
.cx-drop{border:2px dashed #cbd5e1;border-radius:12px;padding:28px;text-align:center;background:#f8fafc;color:var(--cx-muted)}
.cx-drop input{margin-top:10px}
.cx-error{margin:0 0 16px;padding:12px 14px;border-radius:9px;background:#fef2f2;border:1px solid #fecaca;color:#b91c1c;font-size:13px}
.cx-flash{margin:0 0 20px;padding:12px 16px;border-radius:9px;background:var(--cx-green-bg);border:1px solid #a7f3d0;color:var(--cx-green);font-weight:600;font-size:13.5px}
.cx-row-3{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;align-items:end}

/* ---------- Table ---------- */
.cx-table{width:100%;border-collapse:collapse}
.cx-table th{padding:12px 24px;text-align:left;font-size:10.5px;letter-spacing:.14em;text-transform:uppercase;color:#64748b;border-bottom:1px solid var(--cx-line);background:#f8fafc}
.cx-table td{padding:14px 24px;border-bottom:1px solid #f1f5f9;vertical-align:middle}
.cx-table tr:last-child td{border-bottom:0}
.cx-person{display:flex;align-items:center;gap:12px}
.cx-person small{display:block;color:var(--cx-muted)}
.cx-inline{display:inline-flex;gap:8px;align-items:center;margin:0}
details.cx-reset summary{list-style:none;display:inline-flex}
details.cx-reset summary::-webkit-details-marker{display:none}
details.cx-reset form{margin-top:8px;display:flex;gap:8px}
details.cx-reset .cx-input{height:34px;width:170px}

.cx-pager{margin-top:22px}
.cx-pager nav svg{width:18px;height:18px}

/* ---------- Processing ---------- */
.cx-center{max-width:520px;margin:40px auto;text-align:center}
.cx-progress{height:10px;border-radius:999px;background:#e2e8f0;overflow:hidden;margin:22px 0 10px}
.cx-progress>div{height:100%;width:0;background:linear-gradient(90deg,var(--cx-navy),var(--cx-red-soft));transition:width .25s}
.cx-pct{font-size:30px;font-weight:800;color:var(--cx-navy)}
.cx-status{color:var(--cx-muted);margin-top:6px}

/* ---------- Login ---------- */
body.cx-login{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px;
  background:linear-gradient(160deg,var(--cx-side-1) 0%,var(--cx-side-2) 100%)}
.cx-login-card{width:100%;max-width:420px;background:#fff;border-radius:16px;padding:34px;box-shadow:0 24px 60px rgba(0,0,0,.3)}
.cx-login-logo{background:linear-gradient(160deg,var(--cx-side-1),var(--cx-side-2));margin:-34px -34px 26px;padding:28px 34px;border-radius:16px 16px 0 0}
.cx-login-logo img{display:block;width:auto;height:auto;max-width:230px;max-height:90px;margin:0 auto}
.cx-login-card h1{margin:0 0 4px;font-size:22px;font-weight:800}
.cx-login-card .sub{margin:0 0 20px;color:var(--cx-muted);font-size:13.5px}
.cx-remember{display:flex;align-items:center;gap:8px;margin-top:14px;font-size:13px;color:#475569}
.cx-login-card .cx-btn{width:100%;height:44px;margin-top:20px}
.cx-field-error{margin-top:6px;color:#b91c1c;font-size:12px}

/* ---------- Responsive ---------- */
@media (max-width:1100px){.cx-stats{grid-template-columns:repeat(2,minmax(0,1fr))}.cx-row-3{grid-template-columns:1fr 1fr}}
@media (max-width:860px){
  .cx-sidebar{position:fixed;left:0;transform:translateX(-100%);transition:transform .2s}
  body.cx-nav-open .cx-sidebar{transform:none}
  .cx-menu-btn{display:grid;place-items:center}
  .cx-content{padding:24px 18px 48px}.cx-topbar{padding:0 16px}.cx-user-meta{display:none}
  .cx-row-3{grid-template-columns:1fr}
}

/* ---------- Settings page ---------- */
.cx-settings-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:24px;align-items:start}
.cx-brand-preview{border-radius:12px;padding:22px 26px;min-height:110px;display:flex;align-items:center;background:linear-gradient(180deg,var(--cx-side-1),var(--cx-side-2));border:1px solid var(--cx-line)}
.cx-brand-preview img{display:block;width:auto;height:auto;max-width:210px;max-height:72px}
.cx-help{margin:8px 0 0;color:var(--cx-muted);font-size:12.5px}
.cx-swatches{display:flex;flex-wrap:wrap;gap:10px;margin-top:12px}
.cx-swatch{width:34px;height:34px;border-radius:50%;border:2px solid #fff;box-shadow:0 0 0 1px var(--cx-line);cursor:pointer;padding:0}
.cx-swatch:hover{transform:scale(1.08)}
.cx-colorrow{display:flex;gap:12px;align-items:center}
.cx-colorrow input[type=color]{width:56px;height:42px;padding:2px;border:1px solid #cbd5e1;border-radius:9px;background:#fff;cursor:pointer}
.cx-colorrow .cx-input{max-width:150px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace}
.cx-mini{display:flex;border:1px solid var(--cx-line);border-radius:12px;overflow:hidden;margin-top:18px;height:170px;background:#f8fafc}
.cx-mini-side{width:120px;padding:14px 12px;display:flex;flex-direction:column;gap:8px}
.cx-mini-side img{display:block;max-width:96px;max-height:34px;width:auto;height:auto;margin-bottom:6px}
.cx-mini-item{height:20px;border-radius:6px;font-size:10px;font-weight:700;display:flex;align-items:center;padding:0 8px}
.cx-mini-main{flex:1;padding:14px}
.cx-mini-main i{display:block;height:10px;border-radius:5px;background:#e2e8f0;margin-bottom:10px}
@media (max-width:1000px){.cx-settings-grid{grid-template-columns:1fr}}
