:root{
  --bg:#0b1020;
  --card:#121a33;
  --card2:#0f162c;
  --ink:#e9efff;
  --muted:rgba(233,239,255,.66);
  --border:rgba(255,255,255,.10);
  --accent:#6d5efc;
  --good:#18c37e;
  --bad:#ff3b5c;
  --shadow: 0 18px 60px rgba(0,0,0,.35);
  --r:18px;
  --font: system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--font);
  color:var(--ink);
  background:
    radial-gradient(900px 540px at 20% 10%, rgba(109,94,252,.22), transparent 60%),
    radial-gradient(900px 540px at 90% 30%, rgba(24,195,126,.14), transparent 60%),
    var(--bg);
  overflow-x:hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.top{
  position:sticky;
  top:0;
  z-index:10;
  display:flex;
  gap:12px;
  align-items:center;
  justify-content:space-between;
  padding: 14px 14px;
  background: rgba(11,16,32,.82);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--border);
}

.brand{display:flex; gap:12px; align-items:center}
.logo{
  width:42px; height:42px;
  border-radius:14px;
  display:grid; place-items:center;
  border:1px solid var(--border);
  background: rgba(255,255,255,.06);
  box-shadow: 0 12px 30px rgba(0,0,0,.22);
}
.title{font-weight:900; letter-spacing:-.02em}
.sub{font-size:12px; color:var(--muted)}

.actions{display:flex; gap:10px; align-items:center; width:min(520px,60vw)}
.search{
  width:100%;
  padding: 12px 14px;
  border-radius: 999px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--ink);
  outline:0;
  font-size:16px; /* prevents iOS zoom */
}

.wrap{
  display:grid;
  grid-template-columns: 330px 1fr;
  gap: 14px;
  padding: 14px;
}

.panel{
  background: rgba(255,255,255,.06);
  border:1px solid var(--border);
  border-radius: var(--r);
  padding: 14px;
  box-shadow: var(--shadow);
}

.panelHead{display:flex; align-items:center; justify-content:space-between; gap:10px}
.panelTitle{font-weight:900; margin: 10px 0 8px}

.stats{display:flex; flex-direction:column; gap:8px; margin-top:10px}
.stat{display:flex; justify-content:space-between; font-size:14px; color:var(--muted)}
.stat b{color:var(--ink)}

.row{display:flex; gap:10px; margin-top:10px}
.chips{display:flex; flex-wrap:wrap; gap:8px}
.chip{
  padding:10px 12px;
  border-radius:999px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--ink);
  font-weight:800;
  cursor:pointer;
  touch-action: manipulation;
}

.content{
  min-height: 70vh;
}

.head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  margin-bottom: 10px;
}
h1{margin:0; font-size:28px; letter-spacing:-.02em}

.seg{
  display:flex;
  gap:6px;
  padding:6px;
  border-radius: 999px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.06);
  overflow:auto;
}
.segBtn{
  border:0;
  cursor:pointer;
  padding: 10px 12px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight:900;
}
.segBtn.active{
  background: rgba(109,94,252,.18);
  color: var(--ink);
}

.grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 12px;
}
.card{
  background: rgba(255,255,255,.06);
  border:1px solid var(--border);
  border-radius: var(--r);
  padding: 14px;
  box-shadow: var(--shadow);
  cursor:pointer;
  min-height: 150px;
  display:flex;
  flex-direction:column;
  gap:10px;
  touch-action: manipulation;
}
.card:hover{transform: translateY(-2px)}
.name{font-weight:950; letter-spacing:-.02em}
.desc{font-size:13px; color:var(--muted); line-height:1.35}
.tags{display:flex; gap:8px; flex-wrap:wrap; margin-top:auto}
.tag{
  font-size:12px;
  font-weight:900;
  padding:6px 8px;
  border-radius:999px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.06);
}
.tag.good{border-color: rgba(24,195,126,.35); background: rgba(24,195,126,.12)}
.tag.acc{border-color: rgba(109,94,252,.35); background: rgba(109,94,252,.12)}
.tag.bad{border-color: rgba(255,59,92,.35); background: rgba(255,59,92,.12)}

.footer{margin-top:16px; color:var(--muted)}

/* Modal = true fullscreen */
.modal{
  position:fixed; inset:0;
  display:none;
  z-index:50;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(8px);
}
.modal.show{display:block}

.modalCard{
  position:absolute; inset:0;
  display:flex;
  flex-direction:column;
  background: rgba(15,22,44,.98);
}
.modalTop{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding: 12px;
  border-bottom:1px solid rgba(255,255,255,.08);
}
.modalInfo{flex:1; min-width:0}
.modalTitle{font-weight:950}
.modalSub{font-size:12px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.modalBtns{display:flex; gap:8px}

.modalBody{
  flex:1;
  overflow:auto;
  padding: 14px;
}
.modalBottom{
  padding: 12px 14px;
  border-top:1px solid rgba(255,255,255,.08);
}
.hint{color:var(--muted); font-size:12px; margin-bottom:8px}

/* Buttons */
.btn{
  border:1px solid rgba(255,255,255,.12);
  background: linear-gradient(135deg, rgba(109,94,252,.95), rgba(109,94,252,.70));
  color:#fff;
  font-weight:950;
  padding: 12px 14px;
  border-radius: 14px;
  cursor:pointer;
  min-height:44px;
  touch-action: manipulation;
}
.btn.small{padding:10px 12px; min-height:40px}
.btn.ghost{
  background: rgba(255,255,255,.06);
  color: var(--ink);
}
.btn.danger{
  background: linear-gradient(135deg, rgba(255,59,92,.95), rgba(255,59,92,.70));
}

/* Drawer */
.drawer{position:fixed; inset:0; display:none; z-index:60; background: rgba(0,0,0,.45); backdrop-filter: blur(8px)}
.drawer.show{display:block}
.drawerCard{
  position:absolute;
  right: 10px; top: 10px; bottom: 10px;
  width: min(420px, 92vw);
  border-radius: 20px;
  background: rgba(15,22,44,.98);
  border:1px solid rgba(255,255,255,.10);
  box-shadow: var(--shadow);
  display:flex; flex-direction:column;
}
.drawerTop{display:flex; justify-content:space-between; align-items:center; padding:12px; border-bottom:1px solid rgba(255,255,255,.08)}
.drawerTitle{font-weight:950}
.drawerBody{padding:12px; display:flex; flex-direction:column; gap:14px; overflow:auto}
.setting{display:flex; justify-content:space-between; align-items:center; gap:12px}
.settingTitle{font-weight:950}
.settingSub{font-size:12px; color:var(--muted)}

/* Switch */
.switch{position:relative; display:inline-block; width:52px; height:30px}
.switch input{opacity:0; width:0; height:0}
.slider{
  position:absolute; inset:0;
  border-radius:999px;
  background: rgba(255,255,255,.10);
  border:1px solid rgba(255,255,255,.12);
  transition:.18s;
}
.slider:before{
  content:"";
  position:absolute;
  width:24px; height:24px;
  left:3px; top:2.5px;
  background:#fff;
  border-radius:999px;
  transition:.18s;
}
.switch input:checked + .slider{
  background: rgba(24,195,126,.20);
  border-color: rgba(24,195,126,.28);
}
.switch input:checked + .slider:before{transform: translateX(21px)}

/* Toasts */
.toasts{
  position:fixed;
  right:14px; top:14px;
  z-index:90;
  display:flex; flex-direction:column; gap:10px;
}
.toast{
  width: min(340px, calc(100vw - 28px));
  background: rgba(15,22,44,.98);
  border:1px solid rgba(255,255,255,.10);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  opacity:0; transform: translateX(16px);
  transition: .22s ease;
}
.toast.show{opacity:1; transform: translateX(0)}
.toastTitle{font-weight:950}
.toastText{color:var(--muted); font-size:13px; margin-top:4px}

/* Help */
.help{position:fixed; inset:0; display:none; z-index:70; background: rgba(0,0,0,.45); backdrop-filter: blur(8px)}
.help.show{display:block}
.helpCard{
  position:absolute; left:50%; top:50%;
  transform: translate(-50%,-50%);
  width: min(680px, 92vw);
  max-height: min(76vh, 720px);
  background: rgba(15,22,44,.98);
  border:1px solid rgba(255,255,255,.10);
  border-radius: 20px;
  box-shadow: var(--shadow);
  display:flex; flex-direction:column;
  overflow:hidden;
}
.helpTop{display:flex; justify-content:space-between; align-items:center; padding:12px; border-bottom:1px solid rgba(255,255,255,.08)}
.helpTitle{font-weight:950}
.helpBody{padding:12px; color:var(--muted); overflow:auto; line-height:1.5}

/* Mobile */
@media (max-width: 900px){
  .wrap{grid-template-columns: 1fr}
  .grid{grid-template-columns: repeat(2, minmax(0,1fr))}
}
@media (max-width: 520px){
  .actions{width:100%}
  .top{flex-wrap:wrap}
  .grid{grid-template-columns: 1fr}
}
