/* Nexus Markets — Business dashboard + public store (shared) */
:root{
  --ink:#16243d;--muted:#6b7c96;--line:#e4eaf4;--bg:#f4f7fc;--card:#fff;
  --blue:#3478f6;--blue-d:#2459c9;--blue-l:#eaf1ff;--green:#149b79;--green-l:#e3f6f0;
  --orange:#e8832a;--orange-l:#fff1e3;--red:#d4493f;--red-l:#fdeceb;
  --r:14px;--shadow:0 1px 2px rgba(24,48,90,.05),0 8px 24px rgba(24,48,90,.06);
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;min-height:100vh;color:var(--ink);background:var(--bg);
  font:14px/1.5 Inter,"Noto Sans Khmer",ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif}
body.no-scroll{overflow:hidden}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer}
[hidden]{display:none!important}
a{color:var(--blue);text-decoration:none}a:hover{text-decoration:underline}
h1,h2,h3{margin:0;letter-spacing:-.01em}
.muted{color:var(--muted)}.small{font-size:12px}

/* ---------- layout ---------- */
.app{display:grid;grid-template-columns:248px minmax(0,1fr);min-height:100vh}
.side{position:sticky;top:0;height:100vh;overflow-y:auto;background:#fff;border-right:1px solid var(--line);padding:18px 14px;display:flex;flex-direction:column;gap:6px}
.brand{display:flex;align-items:center;gap:10px;padding:4px 8px 16px;font-weight:800;font-size:16px;color:var(--ink)}
.brand i{width:34px;height:34px;border-radius:11px;background:linear-gradient(145deg,#6db0ff,#2f65e9);color:#fff;display:grid;place-items:center;font-style:normal;font-size:18px;box-shadow:0 6px 14px rgba(53,116,239,.3)}
.brand small{display:block;font-weight:600;font-size:11px;color:var(--muted)}
.nav{display:flex;flex-direction:column;gap:2px}
.nav-label{font-size:10px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:#9aa8bd;margin:14px 10px 4px}
.nav a{display:flex;align-items:center;gap:11px;padding:9px 11px;border-radius:10px;color:#42566f;font-weight:600;font-size:13.5px;text-decoration:none}
.nav a svg{width:18px;height:18px;flex:0 0 auto;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.nav a:hover{background:#f1f5fb}
.nav a.active{background:var(--blue-l);color:var(--blue-d)}
.nav a .tag{margin-left:auto;font-size:10px;font-weight:700;color:#8c9bb2;background:#eef2f8;border-radius:99px;padding:1px 7px}
.side-foot{margin-top:auto;padding:12px 8px 0;font-size:12px}
.main{min-width:0;display:flex;flex-direction:column}
.top{position:sticky;top:0;z-index:30;display:flex;align-items:center;gap:10px;padding:12px 24px;background:rgba(244,247,252,.85);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);border-bottom:1px solid var(--line)}
.top .grow{flex:1}
.burger{display:none}
.switch{max-width:230px;height:38px;border:1px solid var(--line);border-radius:10px;background:#fff;padding:0 10px;font-weight:650}
.who{display:flex;align-items:center;gap:9px;font-weight:650;font-size:13px}
.avatar{width:32px;height:32px;border-radius:50%;background:var(--blue-l) center/cover;color:var(--blue-d);display:grid;place-items:center;font-weight:800;font-size:12px;flex:0 0 auto}
.content{padding:26px 24px 60px;width:100%;max-width:1180px;margin:0 auto}
.page-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;flex-wrap:wrap;margin-bottom:20px}
.page-head h1{font-size:24px}
.page-head p{margin:4px 0 0;color:var(--muted)}

/* ---------- components ---------- */
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--r);box-shadow:var(--shadow);padding:20px}
.card h3{font-size:15px;margin-bottom:4px}
.grid{display:grid;gap:16px}
.g2{grid-template-columns:repeat(2,minmax(0,1fr))}
.g3{grid-template-columns:repeat(3,minmax(0,1fr))}
.g4{grid-template-columns:repeat(4,minmax(0,1fr))}
.stat .k{font-size:12px;color:var(--muted);font-weight:650}
.stat .v{font-size:24px;font-weight:800;margin-top:6px;letter-spacing:-.02em}
.stat .s{font-size:12px;color:var(--muted);margin-top:2px}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;height:38px;padding:0 16px;border-radius:10px;border:1px solid transparent;font-weight:700;font-size:13px;text-decoration:none;white-space:nowrap}
.btn:hover{text-decoration:none}
.btn:disabled{opacity:.55;cursor:not-allowed}
.btn-primary{background:var(--blue);color:#fff;box-shadow:0 6px 14px rgba(52,120,246,.28)}
.btn-primary:hover:not(:disabled){background:var(--blue-d)}
.btn-ghost{background:#fff;border-color:var(--line);color:#33475f}
.btn-ghost:hover:not(:disabled){background:#f4f7fc}
.btn-danger{background:var(--red);color:#fff}
.btn-sm{height:32px;padding:0 12px;font-size:12px}
.icon-btn{width:34px;height:34px;border-radius:10px;border:1px solid var(--line);background:#fff;font-size:20px;line-height:1;color:#51647d}
.badge{display:inline-flex;align-items:center;gap:5px;border-radius:99px;padding:2px 10px;font-size:11.5px;font-weight:700;background:#eef2f8;color:#4a5d78}
.badge.green{background:var(--green-l);color:var(--green)}
.badge.orange{background:var(--orange-l);color:var(--orange)}
.badge.red{background:var(--red-l);color:var(--red)}
.badge.blue{background:var(--blue-l);color:var(--blue-d)}
.lbl{display:block;font-size:12px;font-weight:700;color:#41556f;margin:14px 0 6px}
.hint{font-size:11.5px;color:var(--muted);margin-top:5px}
.hint.ok{color:var(--green)}.hint.bad{color:var(--red)}
input[type=text],input[type=email],input[type=tel],input[type=url],input[type=search],select,textarea{width:100%;border:1px solid #d6deeb;border-radius:10px;background:#fff;padding:0 12px;height:40px;outline:0}
textarea{height:auto;min-height:88px;padding:10px 12px;resize:vertical}
input:focus,select:focus,textarea:focus{border-color:var(--blue);box-shadow:0 0 0 3px rgba(52,120,246,.15)}
input[readonly]{background:#f4f7fc;color:#6b7c96}
.row2{display:grid;grid-template-columns:1fr 1fr;gap:0 14px}
.form-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:22px;flex-wrap:wrap}
.err-line{color:var(--red);font-size:12.5px;margin-top:12px;min-height:18px}
.switchrow{display:flex;align-items:center;gap:12px;padding:12px 14px;border:1px solid var(--line);border-radius:12px;background:#fafcff;margin-top:14px}
.switchrow .t{flex:1}.switchrow b{display:block}
.toggle{position:relative;width:44px;height:25px;flex:0 0 auto}
.toggle input{position:absolute;inset:0;opacity:0;margin:0;cursor:pointer;z-index:1}
.toggle span{position:absolute;inset:0;border-radius:99px;background:#cdd6e4;transition:.2s}
.toggle span::after{content:"";position:absolute;top:3px;left:3px;width:19px;height:19px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.25);transition:.2s}
.toggle input:checked+span{background:var(--green)}
.toggle input:checked+span::after{transform:translateX(19px)}
.toggle input:disabled{cursor:not-allowed}

/* tables */
.table-wrap{overflow-x:auto;border:1px solid var(--line);border-radius:12px;background:#fff}
table{width:100%;border-collapse:collapse;min-width:560px}
th{font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:#8795ab;text-align:left;padding:10px 14px;background:#f8fafd;border-bottom:1px solid var(--line)}
td{padding:12px 14px;border-bottom:1px solid #eef2f8;vertical-align:middle}
tr:last-child td{border-bottom:0}
.person{display:flex;align-items:center;gap:10px;min-width:0}
.person b{display:block}
td select{height:34px;width:auto;min-width:150px}

/* business cards */
.biz-card{display:flex;flex-direction:column;overflow:hidden;padding:0}
.biz-cover{height:92px;background:linear-gradient(120deg,#7fb0ff,#b79bff 60%,#ffb98a) center/cover}
.biz-body{padding:0 18px 18px;position:relative}
.biz-logo{width:60px;height:60px;border-radius:16px;border:3px solid #fff;margin-top:-30px;background:var(--blue-l) center/cover;display:grid;place-items:center;font-weight:800;color:var(--blue-d);font-size:20px;box-shadow:0 4px 10px rgba(24,48,90,.12)}
.biz-body h3{margin-top:10px;font-size:16px}
.biz-meta{display:flex;gap:6px;flex-wrap:wrap;margin:10px 0 14px}
.biz-card.current{outline:2px solid var(--blue)}

/* checklist */
.check{display:flex;align-items:center;gap:12px;padding:11px 0;border-bottom:1px solid #eef2f8}
.check:last-child{border-bottom:0}
.check .dot{width:22px;height:22px;border-radius:50%;border:2px solid #cdd6e4;display:grid;place-items:center;flex:0 0 auto;font-size:12px;color:#fff}
.check.done .dot{background:var(--green);border-color:var(--green)}
.check.done .tx{color:var(--muted);text-decoration:line-through}
.check .tx{flex:1;font-weight:600}
.bar{height:8px;border-radius:99px;background:#e8eef8;overflow:hidden;margin-top:10px}
.bar i{display:block;height:100%;background:linear-gradient(90deg,#6aa6ff,#2f6be8);border-radius:99px}

/* image field */
.img-row{display:flex;align-items:center;gap:14px}
.img-prev{width:132px;height:74px;border-radius:12px;border:1px dashed #c3cfe2;background:#f4f7fc center/cover no-repeat;flex:0 0 auto}
.img-prev.round{width:74px;border-radius:18px}
.img-prev.empty{background-image:none!important}
.img-btns{display:flex;gap:8px;flex-wrap:wrap}

/* empty / soon */
.empty{text-align:center;padding:48px 20px}
.empty .ico{width:56px;height:56px;margin:0 auto 14px;border-radius:18px;background:var(--blue-l);color:var(--blue-d);display:grid;place-items:center;font-size:26px}
.empty .ico svg{width:26px;height:26px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.empty h3{font-size:18px}.empty p{max-width:460px;margin:8px auto 18px;color:var(--muted)}
.url-box{display:flex;gap:8px;align-items:center;flex-wrap:wrap;background:#f4f7fc;border:1px solid var(--line);border-radius:12px;padding:10px 12px}
.url-box code{flex:1;min-width:160px;word-break:break-all;font-size:12.5px}
.perm td,.perm th{text-align:center;padding:8px 10px;font-size:12px}
.perm td:first-child,.perm th:first-child{text-align:left}
.perm .y{color:var(--green);font-weight:800}.perm .n{color:#c3cbd8}.perm .p{color:#8795ab}
.activity{list-style:none;margin:0;padding:0}
.activity li{display:flex;gap:10px;justify-content:space-between;padding:9px 0;border-bottom:1px solid #eef2f8;font-size:13px}
.activity li:last-child{border-bottom:0}

/* skeleton */
.skel{border-radius:12px;background:linear-gradient(90deg,#eaeff7 25%,#f5f8fc 37%,#eaeff7 63%);background-size:400% 100%;animation:sk 1.3s ease infinite}
@keyframes sk{0%{background-position:100% 50%}100%{background-position:0 50%}}

/* modal, toast */
.modal-back{position:fixed;inset:0;z-index:100;background:rgba(18,32,58,.45);display:flex;align-items:flex-start;justify-content:center;padding:4vh 14px;overflow-y:auto;backdrop-filter:blur(3px)}
.modal{width:100%;max-width:520px;background:#fff;border-radius:18px;box-shadow:0 30px 80px rgba(18,32,58,.35)}
.modal.wide{max-width:720px}
.modal-head{display:flex;align-items:center;justify-content:space-between;padding:18px 22px;border-bottom:1px solid var(--line)}
.modal-head h3{font-size:17px}
.modal-body{padding:6px 22px 22px}
#toasts{position:fixed;left:50%;bottom:22px;transform:translateX(-50%);z-index:200;display:flex;flex-direction:column;gap:8px;align-items:center;width:max-content;max-width:calc(100vw - 28px)}
.toast{background:#1b2a44;color:#fff;border-radius:12px;padding:11px 16px;font-weight:600;font-size:13px;box-shadow:0 12px 30px rgba(0,0,0,.25);animation:tin .25s ease}
.toast.err{background:#b63b33}.toast.ok{background:#0f7f64}
@keyframes tin{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}

/* gate */
.gate{min-height:100vh;display:grid;place-items:center;padding:20px}
.gate .card{max-width:460px;text-align:center;padding:34px}
.gate .brand{justify-content:center}
.code{background:#f4f7fc;border:1px solid var(--line);border-radius:10px;padding:10px 12px;font:12px/1.5 ui-monospace,Menlo,Consolas,monospace;text-align:left;margin:12px 0;word-break:break-all}

/* ---------- public store page ---------- */
.shop{max-width:980px;margin:0 auto;padding:0 0 60px}
.shop-banner{height:220px;background:linear-gradient(120deg,#7fb0ff,#b79bff 60%,#ffb98a) center/cover;border-radius:0 0 22px 22px}
.shop-head{display:flex;gap:18px;align-items:flex-end;padding:0 22px;margin-top:-42px;flex-wrap:wrap}
.shop-logo{width:92px;height:92px;border-radius:24px;border:4px solid #fff;background:var(--blue-l) center/cover;display:grid;place-items:center;font-weight:800;font-size:30px;color:var(--blue-d);box-shadow:0 8px 20px rgba(24,48,90,.18)}
.shop-title{flex:1;min-width:220px;padding-bottom:4px}
.shop-title h1{font-size:26px}
.shop-body{padding:22px;display:grid;gap:16px}
.links{display:flex;gap:8px;flex-wrap:wrap}
.topline{display:flex;justify-content:space-between;align-items:center;padding:14px 22px;max-width:980px;margin:0 auto}

/* ---------- responsive ---------- */
@media(max-width:1000px){.g4{grid-template-columns:repeat(2,minmax(0,1fr))}.g3{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:900px){
  .app{grid-template-columns:1fr}
  .side{position:fixed;inset:0 auto 0 0;width:276px;z-index:90;transform:translateX(-102%);transition:transform .25s;box-shadow:0 0 60px rgba(0,0,0,.25)}
  body.nav-open .side{transform:none}
  body.nav-open::after{content:"";position:fixed;inset:0;background:rgba(18,32,58,.4);z-index:80}
  .burger{display:inline-grid;place-items:center}
  .top{padding:10px 14px}.content{padding:20px 14px 70px}
  .who span{display:none}
}
@media(max-width:620px){
  .g2,.g3,.g4,.row2{grid-template-columns:1fr}
  .switch{max-width:150px}
  .shop-banner{height:150px}
  .img-row{flex-wrap:wrap}
}
