/* VILCA - modern, simple, consistent */
:root{
  --bg1:#F7F7FF;
  --bg2:#F3F0FF;
  --card:#FFFFFF;
  --text:#0F172A;
  --muted:#64748B;
  --line:rgba(15,23,42,0.10);
  --accent:#5E17EB;
  --accent2:#5E17EB;
  --ok:#16A34A;
  --bad:#DC2626;
  --shadow: 0 20px 60px rgba(15,23,42,0.10);
  --shadow2: 0 10px 30px rgba(15,23,42,0.08);
}
*{box-sizing:border-box}
html,body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  color:var(--text);
  background: var(--accent);
}

.shell{max-width:1100px;margin:0 auto;padding:18px}
.header{padding-top:22px}
.brand{display:flex;align-items:center;justify-content:space-between;gap:16px}
.brandLeft{display:flex;align-items:center;gap:14px;min-width:0}
.brandLogo{width:52px;height:52px;border-radius:16px;background:#fff;box-shadow:var(--shadow2)}
.brandText{display:flex;flex-direction:column;gap:2px}
.brandName{font-size:28px;font-weight:950;letter-spacing:-0.02em;color:#fff}
.brandSub{color:rgba(255,255,255,0.85);font-weight:650}
.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:28px;
  box-shadow:var(--shadow);
  padding:20px;
  margin:16px 0;
}
.h1{margin:0 0 6px;font-size:22px;font-weight:950;letter-spacing:-0.02em}
.h2{font-size:18px;font-weight:950}
h2{margin:0 0 6px;font-size:18px;font-weight:950}
h3{margin:10px 0 8px;font-size:16px;font-weight:950}
p{margin:8px 0}
.muted{color:var(--muted);font-weight:650}
.small{font-size:12px}
.hint{font-size:12px;color:var(--muted);margin-top:6px}
.pill{
  padding:10px 14px;border-radius:999px;border:1px solid rgba(109,40,217,0.22);
  background:linear-gradient(135deg, rgba(109,40,217,0.10), rgba(124,58,237,0.08));
  color:#4c1d95;font-weight:900;white-space:nowrap
}
.pill.ok{border-color:rgba(22,163,74,0.25);background:rgba(22,163,74,0.10);color:var(--ok)}
.pill.bad{border-color:rgba(220,38,38,0.25);background:rgba(220,38,38,0.08);color:var(--bad)}
.formGrid{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-top:10px}
.field{display:flex;flex-direction:column;gap:6px}
label{font-weight:900}
input,select,textarea{
  border:1px solid var(--line);border-radius:16px;padding:12px 12px;
  font-size:14px;outline:none;background:#fff;
}
textarea{resize:vertical}
input:focus,select:focus,textarea:focus{border-color:rgba(109,40,217,0.45);box-shadow:0 0 0 4px rgba(109,40,217,0.10)}
.actions{display:flex;gap:10px;align-items:center;margin-top:14px;flex-wrap:wrap}
.btn{
  border:1px solid rgba(94,23,235,0.35);
  background:var(--accent);
  color:#fff;
  border-radius:999px;
  padding:11px 16px;
  font-weight:950;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  text-decoration:none;
}
.btn:visited{color:#fff}
.btn:hover{filter:brightness(0.98)}
.btn.primary{background:var(--accent); color:#fff; border:1px solid rgba(94,23,235,0.35);}
.btn.primary:hover{filter:brightness(0.98)}
.btn.ghost{background:var(--accent);}
.msg{margin-top:10px;font-weight:800}
.msg.ok{color:var(--ok)}
.msg.bad{color:var(--bad)}
.rowBetween{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;flex-wrap:wrap}
.sectionHeader{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-top:12px}
.grid3{display:grid;grid-template-columns:1fr 1fr 1fr;gap:14px;margin-top:12px}
.box{
  border:1px solid var(--line);
  border-radius:22px;
  padding:14px;
  box-shadow:var(--shadow2);
  background:#fff;
}
.miniTitle{font-weight:950;margin-bottom:6px}
.score{font-size:40px;font-weight:1000;letter-spacing:-0.02em;margin-top:6px}
.status{font-weight:950;margin-top:4px}
.status.ok{color:var(--ok)}
.divider{height:1px;background:var(--line);margin:16px 0}
.twoCol{display:grid;grid-template-columns:1.4fr 0.9fr;gap:14px;align-items:start}
.itemsGrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:12px}
.itemCard{
  border:1px solid var(--line);border-radius:24px;padding:12px;background:#fff;
  box-shadow:var(--shadow2);
  display:flex;gap:12px;align-items:stretch
}
.itemImg{width:110px;height:86px;border-radius:18px;overflow:hidden;flex:0 0 auto;border:1px solid var(--line)}
.itemImg img{width:100%;height:100%;object-fit:cover}
.itemInfo{flex:1;display:flex;flex-direction:column;gap:4px}
.itemName{font-weight:950}
.itemDesc{font-size:12px;color:var(--muted);font-weight:650}
.itemPrice{font-weight:950}
.itemActions{display:flex;gap:8px;align-items:center;margin-top:auto;flex-wrap:wrap}
.qty{width:92px}
.tabs{display:flex;gap:8px;flex-wrap:wrap;margin-top:6px}
.tab{
  border:1px solid var(--line); background:#fff; border-radius:999px; padding:8px 12px;
  cursor:pointer; font-weight:900; color:var(--text);
}
.tab.active{
  border-color:rgba(109,40,217,0.35);
  background:rgba(109,40,217,0.08);
  color:#4c1d95;
}
.cart{
  position:sticky;top:14px;
  border:1px solid var(--line);
  border-radius:28px;
  padding:14px;
  box-shadow:var(--shadow);
  background:#fff;
}
.cartHeader{display:flex;align-items:center;justify-content:space-between;gap:10px}
.cartList{display:flex;flex-direction:column;gap:10px;margin:12px 0;max-height:320px;overflow:auto}
.cartRow{
  border:1px solid var(--line);
  border-radius:18px;
  padding:10px;
  display:flex;gap:10px;justify-content:space-between;align-items:flex-start
}
.cartRowLeft{min-width:0}
.cartRowName{font-weight:950;line-height:1.15}
.cartRowMeta{font-size:12px;color:var(--muted);font-weight:650}
.cartRowRight{display:flex;flex-direction:column;align-items:flex-end;gap:6px}
.cartRowPrice{font-weight:950}
.cartMiniBtns{display:flex;gap:6px}
.iconMini{width:30px;height:30px;border-radius:12px;border:1px solid rgba(94,23,235,0.35);background:var(--accent);cursor:pointer;font-weight:950;color:#fff}
.total{font-size:22px;font-weight:1000}
.cartActions{display:flex;gap:8px;align-items:center;justify-content:space-between;flex-wrap:wrap;margin-top:10px}
.footer{padding:24px 0;color:rgba(255,255,255,0.75);text-align:center;font-weight:650}

/* Support FAB / Drawer */
.fab{
  position:fixed;right:18px;bottom:18px;
  border:1px solid rgba(109,40,217,0.22);
  background:linear-gradient(135deg, rgba(109,40,217,0.12), rgba(124,58,237,0.10));
  border-radius:999px;
  padding:12px 14px;
  display:none;
  align-items:center;gap:10px;
  cursor:pointer;
  box-shadow:var(--shadow);
  z-index:50
}
body.auth .fab{display:flex}
.fabIcon{width:34px;height:34px;border-radius:999px;display:grid;place-items:center;background:var(--accent);color:#fff;font-weight:1000}
.fabText{font-weight:1000;color:var(--accent)}
.modal{position:fixed;inset:0;z-index:60}
.modal[hidden]{display:none !important}
.modalBackdrop{position:absolute;inset:0;background:rgba(2,6,23,0.55);backdrop-filter:blur(6px)}
.modalPanel{
  position:absolute;right:0;top:0;height:100%;
  width:min(520px,92vw);
  background:#fff;border-left:1px solid var(--line);
  box-shadow:var(--shadow);
  padding:16px;
  display:flex;flex-direction:column;
}
.modalHeader{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;padding-bottom:12px;border-bottom:1px solid var(--line)}
.iconBtn{width:42px;height:42px;border-radius:14px;border:1px solid rgba(94,23,235,0.35);background:var(--accent);cursor:pointer;font-weight:1000;color:#fff}
.iconBtn:hover{background:#fafafa}
.modalFooter{margin-top:auto;padding-top:12px;border-top:1px solid var(--line);display:flex;justify-content:flex-end}
.accordion{padding:10px 0;overflow:auto}
.acc{
  border:1px solid var(--line);border-radius:22px;background:#fff;
  box-shadow:var(--shadow2);
  margin:10px 0;
}
.acc > summary{
  list-style:none;cursor:pointer;padding:14px 14px;
  font-weight:1000;
}
.acc > summary::-webkit-details-marker{display:none}
.acc[open] > summary{border-bottom:1px solid var(--line);background:rgba(109,40,217,0.06)}
.acc ul{margin:10px 16px 12px;padding-left:18px;color:var(--muted);font-weight:650}
.soon{
  margin:0 16px 14px;
  padding:10px 12px;
  border-radius:16px;
  border:1px dashed rgba(109,40,217,0.25);
  background:rgba(109,40,217,0.07);
  color:#4c1d95;
  font-weight:900;
  font-size:12px;
}

@media (max-width: 980px){
  .twoCol{grid-template-columns:1fr}
  .cart{position:relative;top:auto}
}
@media (max-width: 780px){
  .formGrid{grid-template-columns:1fr}
  .grid2{grid-template-columns:1fr}
  .grid3{grid-template-columns:1fr}
  .itemsGrid{grid-template-columns:1fr}
}

/* === Equal height cards for rating / contract section === */
.grid2{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:18px;
  align-items:stretch;
}
.grid2 .box{
  height:100%;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
}

/* === Mobile: prevent button overflow in small cards === */
.box .btn{
  width:100%;
  justify-content:center;
  text-align:center;
  white-space:normal;
  line-height:1.2;
  padding:12px 14px;
}
@media (max-width: 520px){
  .grid2{grid-template-columns:1fr; gap:14px;}
  .grid2 .box{min-height:auto;}
  .box{padding:14px;}
  .box .btn{border-radius:18px;}
}

/* === Audit modal (history) === */
.modalOverlay{
  position:fixed; inset:0; background:rgba(2,6,23,0.55);
  display:none; align-items:center; justify-content:center;
  padding:18px; z-index:120;
}
.modalOverlay.open{display:flex;}
.modalCard{
  width:min(760px, 100%);
  background:#fff;
  border:1px solid rgba(148,163,184,0.35);
  border-radius:22px;
  box-shadow:0 18px 80px rgba(2,6,23,0.25);
  overflow:hidden;
}
.modalHead{
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 18px; border-bottom:1px solid rgba(148,163,184,0.25);
}
.modalTitle{font-weight:1000; font-size:16px;}
.modalBody{padding:14px 18px; max-height:70vh; overflow:auto;}
.auditList{display:flex; flex-direction:column; gap:10px;}
.auditRow{
  display:flex; gap:12px; align-items:flex-start; justify-content:space-between;
  border:1px solid rgba(148,163,184,0.25);
  border-radius:16px; padding:12px 12px;
  background:#fff;
}
.auditLeft{display:flex; flex-direction:column; gap:4px; min-width:0;}
.findings{
  margin:6px 0 0;
  padding-left:18px;
  color:rgba(15,23,42,0.82);
  font-size:13px;
  line-height:1.35;
}
.findings li{ margin:3px 0; }
.pill.warn{background:rgba(234,179,8,0.14); color:#854d0e; border-color:rgba(234,179,8,0.28);}
.notice{
  margin-top:10px;
  border-radius:16px;
  padding:12px 12px;
  border:1px solid rgba(148,163,184,0.25);
}
.notice.warn{background:rgba(234,179,8,0.10); border-color:rgba(234,179,8,0.25); color:#854d0e;}
.notice.bad{background:rgba(239,68,68,0.10); border-color:rgba(239,68,68,0.25); color:#991b1b;}
.notice.ok{background:rgba(34,197,94,0.10); border-color:rgba(34,197,94,0.25); color:#15803d;}


/* Drawer (hamburger menu) */
.topActions{display:flex;gap:10px;align-items:center}
.drawerOverlay{
  position:fixed;inset:0;
  background:rgba(15,23,42,0.45);
  opacity:0;pointer-events:none;
  transition:opacity .18s ease;
  z-index:80;
}
.drawerOverlay.open{opacity:1;pointer-events:auto}

.drawer{
  position:fixed;top:0;right:0;height:100vh;
  width:min(420px, 92vw);
  background:#fff;
  border-left:1px solid var(--line);
  box-shadow:0 24px 90px rgba(2,6,23,.25);
  transform:translateX(105%);
  transition:transform .22s ease;
  z-index:90;
  display:flex;flex-direction:column;
}
.drawer.open{transform:translateX(0)}
.drawerHeader{
  display:flex;align-items:center;justify-content:space-between;
  padding:14px 16px;
  border-bottom:1px solid var(--line);
}
.drawerTitle{font-weight:900;font-size:16px;color:var(--text)}
.drawerBody{
  padding:16px;
  overflow:auto;
  display:flex;
  flex-direction:column;
  gap:14px;
}
.drawerBody .card{margin:0}
.drawerBody .grid2{margin-top:12px}
