:root{
  --navy:#0A1F5C; --navy-deep:#071647; --blue:#0B5ED7; --blue-2:#1E88E5; --blue-dark:#0B47B8;
  --gold:#F5B301; --gold-deep:#E59A00; --gold-text:#8F5B00; --gold-soft:#FFF4D6;
  --muted:#4B5563; --line:#E6E9F0; --soft:#F4F6FB; --green:#166534; --green-soft:#DCFCE7; --orange:#9A3412;
  --font:'Inter',system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
  --display:'Plus Jakarta Sans','Inter',system-ui,sans-serif;
}
*{box-sizing:border-box}
[hidden]{display:none!important}
body{margin:0;font-family:var(--font);color:var(--navy);background:var(--soft);line-height:1.5}
h1,h2{font-family:var(--display);margin:0}
:focus-visible{outline:3px solid var(--gold);outline-offset:2px}
.muted{color:var(--muted)}

.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:0 18px;border-radius:12px;border:0;font:inherit;font-weight:700;font-size:15px;cursor:pointer;text-decoration:none}
.btn:disabled{opacity:.5;cursor:not-allowed}
.btn-blue{background:linear-gradient(135deg,var(--blue),var(--blue-2));color:#fff;box-shadow:0 8px 20px rgba(11,94,215,.28)}
.btn-gold{background:linear-gradient(135deg,var(--gold),var(--gold-deep));color:var(--navy)}
.btn-ghost{background:#fff;border:1px solid #CBD2E0;color:var(--navy)}
.btn-ghost-light{background:rgba(255,255,255,.12);color:#fff;border:1px solid rgba(255,255,255,.3)}
.btn-block{width:100%}
.btn-sm{min-height:36px;padding:0 12px;font-size:13px;border-radius:10px}
.link{background:none;border:0;color:var(--blue);font:inherit;font-weight:600;cursor:pointer;padding:6px 0;font-size:14px}

/* Login */
.login{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px;background:radial-gradient(circle at 85% 10%,rgba(30,136,229,.55),rgba(30,136,229,0) 45%),linear-gradient(135deg,var(--navy-deep),var(--navy) 45%,var(--blue-dark))}
.login-card{background:#fff;border-radius:24px;padding:36px 28px;max-width:380px;width:100%;display:flex;flex-direction:column;gap:14px;text-align:center;box-shadow:0 24px 60px rgba(0,0,0,.35)}
.login-logo{width:200px;height:auto;margin:0 auto 6px}
.login-card p{margin:0;color:var(--muted)}
.err{color:#B91C1C!important;font-size:14px;min-height:20px}

/* Layout */
.app{display:flex;flex-wrap:wrap;min-height:100vh}
.side{flex:1 1 250px;max-width:100%;background:linear-gradient(180deg,var(--navy) 0%,#0B3A9E 100%);color:#fff;padding:22px 14px;display:flex;flex-direction:column;gap:22px}
.side-top{display:flex;flex-direction:column;gap:8px;padding:0 6px}
.logo-chip{background:#fff;border-radius:14px;padding:8px 12px;align-self:flex-start}
.logo-chip img{height:46px;width:auto;display:block}
.side-sub{font-size:12px;color:#D3DEF7}
.tabs{display:flex;flex-direction:column;gap:4px}
.tabs button{display:flex;align-items:center;justify-content:space-between;text-align:left;min-height:44px;padding:0 14px;border:0;border-radius:12px;background:transparent;color:#fff;font:inherit;font-size:15px;font-weight:500;cursor:pointer}
.tabs button:hover{background:rgba(255,255,255,.08)}
.tabs button.on{background:var(--gold);color:var(--navy);font-weight:700}
.count{background:#fff;color:var(--blue);font-size:12px;font-weight:700;border-radius:999px;padding:1px 8px}
.count:empty{display:none}
.me{margin-top:auto;border-top:1px solid rgba(255,255,255,.18);padding:14px 6px 0;display:flex;align-items:center;gap:10px;font-size:13px}
.me .link{color:var(--gold);padding:0;display:block}
.avatar{width:36px;height:36px;border-radius:50%;background:rgba(255,255,255,.15);display:flex;align-items:center;justify-content:center;font-weight:700;overflow:hidden;flex:none}
.avatar img{width:100%;height:100%;object-fit:cover}
.main{flex:999 1 560px;min-width:0;padding:26px 28px 60px;display:flex;flex-direction:column;gap:22px}
.top{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:14px}
.top h1{font-size:28px}

@media (max-width:820px){
  .side{flex-basis:100%;padding:14px 12px;gap:12px}
  .side-top{flex-direction:row;align-items:center;justify-content:space-between}
  .logo-chip img{height:36px}
  .tabs{flex-direction:row;overflow-x:auto;gap:6px;padding-bottom:4px;scrollbar-width:none}
  .tabs button{white-space:nowrap;flex:none;min-height:40px}
  .me{display:none}
  .main{padding:18px 14px 60px}
  .top h1{font-size:22px}
  .top .btn{display:none}
}

/* Stats */
.stats{display:grid;gap:14px;grid-template-columns:repeat(auto-fit,minmax(170px,1fr))}
.stat{background:#fff;border:1px solid var(--line);border-radius:16px;padding:18px;display:flex;flex-direction:column;gap:4px}
.stat span{font-size:13px;color:var(--muted)}
.stat strong{font-family:var(--display);font-size:30px}
.stat .green{color:var(--green)} .stat .orange{color:var(--orange)}
.hero-stat{background:linear-gradient(135deg,var(--navy),var(--blue));color:#fff;border:0;box-shadow:0 12px 28px rgba(11,94,215,.28)}
.hero-stat span{color:#D3DEF7}

.cols{display:flex;flex-wrap:wrap;gap:18px;align-items:flex-start}
.grow2{flex:2 1 460px;min-width:0}
.grow1{flex:1 1 280px;min-width:0}
.panel{background:#fff;border:1px solid var(--line);border-radius:18px;padding:18px}
.panel-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px}
.panel-head h2{font-size:17px}
.list>div{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px;padding:12px 0;border-top:1px solid #EEF0F5}
.list>div:first-child{border-top:0}
.list .t{display:flex;flex-direction:column;gap:2px;min-width:0}
.list .t strong{font-size:15px}
.list .t span{font-size:13px;color:var(--muted)}
.fb-text{font-size:14px;color:#1F2937;flex-basis:100%}
.stars-txt{color:var(--gold-deep);letter-spacing:1px}
.empty{color:var(--muted);text-align:center;padding:24px 0;margin:0}

.chip{font-size:12px;font-weight:700;padding:4px 10px;border-radius:999px;white-space:nowrap}
.chip.New{background:#DBEAFE;color:#1E40AF} .chip.Talked{background:#FEF3C7;color:#92400E}
.chip.Paid{background:var(--green-soft);color:var(--green)} .chip.Lost{background:#F3F4F6;color:#374151}
.chip.gold{background:var(--gold-soft);color:#7A4D00} .chip.off{background:#FEE2E2;color:#991B1B}

/* Toolbar + table */
.toolbar{display:flex;flex-wrap:wrap;gap:10px}
.toolbar input,.toolbar select{min-height:44px;border:1px solid #CBD2E0;border-radius:12px;padding:0 12px;font:inherit;font-size:15px;background:#fff;color:var(--navy)}
.toolbar input{flex:1 1 240px}
.table-box{padding:0;overflow-x:auto}
table{width:100%;min-width:820px;border-collapse:collapse;font-size:14px}
th{text-align:left;color:var(--muted);font-weight:600;padding:14px 16px;border-bottom:1px solid var(--line)}
td{padding:12px 16px;border-bottom:1px solid #EEF0F5;vertical-align:middle}
td select{min-height:36px;border:1px solid #CBD2E0;border-radius:10px;padding:0 8px;font:inherit;font-size:13px;background:#fff}
.wa{background:var(--green-soft);color:var(--green);text-decoration:none;padding:7px 12px;border-radius:10px;font-weight:700;font-size:13px;white-space:nowrap}
.del{background:none;border:0;color:#B91C1C;cursor:pointer;font-size:13px;padding:6px}

/* Shops */
.shop-grid{display:grid;gap:16px;grid-template-columns:repeat(auto-fill,minmax(290px,1fr))}
.shop{background:#fff;border:1px solid var(--line);border-radius:18px;padding:18px;display:flex;flex-direction:column;gap:12px}
.shop-top{display:flex;gap:12px;align-items:center}
.shop-logo{width:48px;height:48px;border-radius:14px;background:var(--gold-soft);color:var(--gold-text);display:flex;align-items:center;justify-content:center;font-weight:800;flex:none;overflow:hidden}
.shop-logo img{width:100%;height:100%;object-fit:cover}
.shop-top .t{flex:1;min-width:0}
.shop-top strong{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.shop-top a{font-size:13px;color:var(--blue);text-decoration:none}
.shop-nums{display:flex;gap:18px;font-size:13px;color:var(--muted)}
.shop-nums b{font-size:19px;color:var(--navy);font-family:var(--display)}
.shop-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}

/* Forms */
.form{display:flex;flex-direction:column;gap:14px}
.narrow{max-width:560px}
.fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
@media (max-width:560px){.fields{grid-template-columns:1fr}}
.form label{display:flex;flex-direction:column;gap:6px;font-size:14px;font-weight:600}
.form input,.form select{min-height:46px;padding:0 12px;border-radius:12px;border:1px solid #CBD2E0;font:inherit;font-size:15px;font-weight:400;background:#fff;color:var(--navy);width:100%}
.form input[type=file]{padding:10px;min-height:auto}
.prefix{display:flex;border:1px solid #CBD2E0;border-radius:12px;overflow:hidden}
.prefix span{background:#F1F3F8;padding:0 10px;display:flex;align-items:center;color:var(--muted);font-weight:400;font-size:14px;white-space:nowrap}
.prefix input{border:0!important;border-radius:0!important}
.help{margin:-6px 0 0;font-size:13px;color:var(--muted)}
.row{display:flex;flex-wrap:wrap;gap:10px}
.msg{min-height:20px;margin:0;font-size:14px;font-weight:600;color:var(--green)}
.msg.bad{color:#B91C1C}

.qr-panel{background:linear-gradient(160deg,var(--navy),var(--blue-dark));color:#fff;border:0;display:flex;flex-direction:column;align-items:center;gap:14px;text-align:center}
.kick{color:var(--gold);font-size:13px;font-weight:700}
.qr-box{width:200px;height:200px;background:#fff;border-radius:16px;display:flex;align-items:center;justify-content:center;padding:10px;font-size:13px}
.qr-box canvas{width:100%;height:100%;image-rendering:pixelated}
#qrLink{word-break:break-all}

.toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%) translateY(120px);background:var(--navy);color:#fff;padding:12px 18px;border-radius:12px;font-weight:600;transition:transform .25s;z-index:99;max-width:90vw}
.toast.show{transform:translateX(-50%) translateY(0)}
[data-view]{display:flex;flex-direction:column;gap:18px}
.list .t .stars-txt{color:var(--gold-deep);font-size:15px}

.standee-box{width:220px;aspect-ratio:2/3;background:rgba(255,255,255,.95);border-radius:14px;display:flex;align-items:center;justify-content:center;overflow:hidden;font-size:13px;box-shadow:0 10px 30px rgba(0,0,0,.25)}
.standee-box canvas{width:100%;height:100%;display:block}
.fu{display:flex;flex-direction:column;gap:6px;min-width:170px}
.fu input{min-height:34px;border:1px solid #CBD2E0;border-radius:8px;padding:0 8px;font:inherit;font-size:13px;width:100%}
.fu input.due{border-color:#DC2626;background:#FEF2F2}
.act{display:flex;flex-direction:column;gap:6px;align-items:flex-start}
.mini{background:#EEF1F8;color:var(--navy);border:0;border-radius:8px;padding:7px 10px;font:inherit;font-size:12px;font-weight:700;cursor:pointer;white-space:nowrap;text-decoration:none}
.shop-actions .full{grid-column:1/-1}
.btn-warn{background:#FEF3C7;color:#92400E;border:1px solid #FCD34D}

.plan-list{display:grid;gap:16px;grid-template-columns:repeat(auto-fill,minmax(320px,1fr))}
.plan{background:#fff;border:1px solid var(--line);border-radius:18px;padding:18px;display:flex;flex-direction:column;gap:12px}
.plan.popular{border:2px solid var(--gold);box-shadow:0 10px 26px rgba(245,179,1,.18)}
.plan.off{opacity:.6}
.plan-top{display:flex;justify-content:space-between;align-items:center;gap:8px}
.plan-top strong{font-family:var(--display);font-size:16px}
.plan-tools{display:flex;gap:6px}
.plan-tools button{width:36px;height:36px;border-radius:10px;border:1px solid #CBD2E0;background:#fff;cursor:pointer;font-size:15px;color:var(--navy)}
.plan-tools button.danger{color:#B91C1C;border-color:#FCA5A5}
.plan label{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:600}
.plan input[type=text],.plan input[type=number],.plan textarea{min-height:42px;padding:8px 10px;border-radius:10px;border:1px solid #CBD2E0;font:inherit;font-size:14px;font-weight:400;color:var(--navy);width:100%}
.plan textarea{min-height:120px;resize:vertical;line-height:1.5}
.plan .two{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.checks{display:flex;flex-wrap:wrap;gap:14px}
.checks label{flex-direction:row!important;align-items:center;gap:8px!important;font-weight:500!important;min-height:36px}
.checks input{width:18px;height:18px}
.save-bar{position:sticky;bottom:12px;display:flex;justify-content:flex-end;align-items:center;gap:14px;background:rgba(244,246,251,.95);padding:10px;border-radius:14px}

.plan select{min-height:42px;padding:0 10px;border-radius:10px;border:1px solid #CBD2E0;font:inherit;font-size:14px;font-weight:400;background:#fff;color:var(--navy);width:100%}
.work-thumb{height:120px;border-radius:12px;display:flex;align-items:center;justify-content:center;color:#fff;font-weight:800;font-family:var(--display);text-align:center;padding:10px;overflow:hidden;position:relative}
.work-thumb img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.img-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.img-row input[type=file]{font-size:13px;max-width:100%}

.btn-danger{background:#fff;color:#B91C1C;border:1px solid #FCA5A5}
.btn-danger:hover{background:#FEF2F2}
