/* ============ Base ============ */
:root{
  --bg: #0b1020;
  --card: rgba(255,255,255,.08);
  --card2: rgba(255,255,255,.10);
  --stroke: rgba(255,255,255,.14);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.65);
  --muted2: rgba(255,255,255,.50);

  --primary: #6ee7ff;
  --primary2: #a78bfa;
  --danger: #ff6b6b;
  --ok: #2ee59d;
  --shadow: 0 14px 60px rgba(0,0,0,.45);
  --radius: 18px;
}

*{ box-sizing:border-box; }
html, body { height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(1200px 800px at 30% 15%, #1d2a62 0%, transparent 60%),
              radial-gradient(1000px 700px at 80% 30%, #3a1b4b 0%, transparent 60%),
              var(--bg);
  color: var(--text);
  overflow-x:hidden;
}

/* Background blobs */
.bg-blobs{ position:fixed; inset:0; pointer-events:none; overflow:hidden; }
.blob{
  position:absolute;
  width:520px; height:520px;
  filter: blur(45px);
  opacity:.35;
  border-radius:50%;
}
.b1{ left:-120px; top:-140px; background: #46b4ff; }
.b2{ right:-160px; top:120px; background: #b56cff; }
.b3{ left:20%; bottom:-240px; background:#2ee59d; opacity:.18; }

.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}

/* ============ App Shell ============ */
.app{
  width:min(980px, 92vw);
  margin: 18px auto 90px;
  position:relative;
}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding: 14px 6px;
}

.brand{
  display:flex; gap:12px; align-items:center;
}
.logo{
  width:44px; height:44px;
  display:grid; place-items:center;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.06);
  border-radius: 14px;
  font-weight:800;
  letter-spacing:.5px;
}

.logoImg{
  width:90px;
  height:90px;
  filter: drop-shadow(0 0 10px rgba(74,163,255,0.22))
          drop-shadow(0 0 10px rgba(33,208,122,0.18));
}
.title{ font-weight:800; font-size: 18px; line-height:1.1; }
.subtitle{ color:var(--muted2); font-size: 13px; margin-top:2px; }

.top-actions{ display:flex; gap:10px; align-items:center; }
.icon-btn{
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.05);
  color: var(--text);
  padding: 10px 11px;
  border-radius: 12px;
  cursor:pointer;
  transition: transform .12s ease, background .12s ease, border .12s ease;
}
.icon-btn:hover{ transform: translateY(-1px); background: rgba(255,255,255,.08); }
.icon-btn:active{ transform: translateY(0px) scale(.98); }

.segmented{
  display:flex;
  gap:8px;
  padding: 8px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.05);
  border-radius: 16px;
  backdrop-filter: blur(10px);
}

.seg-btn{
  flex:1;
  padding: 10px 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 12px;
  cursor:pointer;
  font-weight: 700;
  letter-spacing:.6px;
}
.seg-btn.active{
  background: linear-gradient(135deg, rgba(110,231,255,.18), rgba(167,139,250,.16));
  border-color: rgba(255,255,255,.18);
  color: var(--text);
}

.controls{
  display:flex;
  gap:10px;
  margin-top: 12px;
  flex-wrap:wrap;
}

.search{
  flex:1;
  min-width: 240px;
  position:relative;
}
.search input{
  width:100%;
  padding: 12px 86px 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.05);
  color: var(--text);
  outline:none;
}
.search input::placeholder{ color: rgba(255,255,255,.45); }
.kbd{
  position:absolute; right:10px; top:50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: rgba(255,255,255,.55);
  border:1px solid rgba(255,255,255,.18);
  padding: 4px 8px;
  border-radius: 10px;
  background: rgba(0,0,0,.20);
}

.sort select:hover{
  background: linear-gradient(
    135deg,
    rgba(110,231,255,.28),
    rgba(167,139,250,.26)
  );
}

.sort select option{
  background: #1d2a62;
  color: white;
}

.sort select{
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.18);
  background: linear-gradient(
    135deg,
    rgba(110,231,255,.18),
    rgba(167,139,250,.16)
  );
  color: var(--text);
  font-weight: 700;
  outline: none;
  cursor: pointer;
}

.stats{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:10px;
  margin-top: 12px;
}
.stat{
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.05);
  border-radius: 16px;
  padding: 12px 14px;
}
.stat-num{ font-size: 22px; font-weight: 900; }
.stat-label{ color: var(--muted2); font-size: 12px; margin-top:2px; }

.card{
  margin-top: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,.05);
  border-radius: var(--radius);
  padding: 12px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.card-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  padding: 4px 6px 10px;
}
.card-title{
  margin: 0;
  font-size: 16px;
  letter-spacing:.2px;
}
.card-actions{ display:flex; gap:8px; flex-wrap:wrap; }

.mini-btn{
  border:1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 10px;
  cursor:pointer;
  font-weight: 700;
  font-size: 13px;
}
.mini-btn:hover{ background: rgba(255,255,255,.09); }
.mini-btn.danger{ border-color: rgba(255,107,107,.35); }

.list{
  display:flex;
  flex-direction:column;
  gap:10px;
  padding: 6px;
  min-height: 120px;
}

.item{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.18);
  transition: transform .12s ease, border .12s ease, background .12s ease;
  position:relative;
}
.item:hover{
  transform: translateY(-1px);
  border-color: rgba(255,255,255,.18);
  background: rgba(0,0,0,.22);
}

.left{
  display:flex; gap:12px; flex:1;
}

.check{
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.04);
  display:grid; place-items:center;
  cursor:pointer;
  flex: 0 0 auto;
}
.check svg{ opacity:0; transform: scale(.85); transition: .12s ease; }
.item.done .check{
  border-color: rgba(46,229,157,.7);
  background: rgba(46,229,157,.08);
}
.item.done .check svg{ opacity:1; transform: scale(1); }

.content{ flex:1; min-width: 0; }
.row1{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.task-title{
  font-weight: 800;
  line-height:1.25;
  word-break: break-word;
}

.item {
  position: relative;
  z-index: 0;
}

.item.menu-open {
  z-index: 30;
  box-shadow: 0 25px 80px rgba(0,0,0,.6);
}

.item.done .task-title{
  text-decoration: line-through;
  color: rgba(255,255,255,.55);
}

.badges{ display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
.badge{
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  color: rgba(255,255,255,.8);
  background: rgba(255,255,255,.06);
}
.dot{
  width: 10px; height: 10px;
  border-radius: 50%;
  display:inline-block;
  border: 1px solid rgba(255,255,255,.25);
}
.dot.low{ background: rgba(110,231,255,.75); }
.dot.med{ background: rgba(167,139,250,.75); }
.dot.high{ background: rgba(255,107,107,.85); }

.note{
  margin-top: 6px;
  color: rgba(255,255,255,.65);
  font-size: 13px;
  line-height: 1.35;
  word-break: break-word;
}

.right{
  display:flex; align-items:center; gap:8px;
}
.more{
  border:1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 10px;
  cursor:pointer;
}

.menu{
  position:absolute;
  right: 10px;
  top: 48px;
  background: rgba(10,14,28,.98);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 14px;
  min-width: 160px;
  overflow:hidden;
  box-shadow: 0 18px 50px rgba(0,0,0,.50);
  display:none;
  z-index: 20;
}
.menu.open{ display:block; }
.menu button{
  width:100%;
  text-align:left;
  padding: 10px 12px;
  background: transparent;
  border:0;
  color: rgba(255,255,255,.88);
  cursor:pointer;
  font-weight: 700;
}
.menu button:hover{ background: rgba(255,255,255,.08); }
.menu button.danger{ color: rgba(255,107,107,.95); }

.empty{
  display:none;
  text-align:center;
  padding: 36px 12px 26px;
  color: rgba(255,255,255,.7);
}
.empty-emoji{ font-size: 34px; }
.empty-title{ font-weight: 900; margin-top: 8px; }
.empty-sub{ color: rgba(255,255,255,.55); margin-top: 6px; }

/* Floating add button */
.fab{
  width: 56px;
  height: 56px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.18);
  background: linear-gradient(135deg, rgba(110,231,255,.30), rgba(167,139,250,.25));
  color: var(--text);
  font-size: 30px;
  font-weight: 900;
  cursor:pointer;
  box-shadow: 0 18px 55px rgba(0,0,0,.45);
}
.fab:hover{ filter: brightness(1.05); }
.fab:active{ transform: scale(.98); }

/* Modal */
.modal-backdrop{
  position: fixed;
  inset:0;
  background: rgba(0,0,0,.55);
  display:none;
  align-items:center;
  justify-content:center;
  padding: 18px;
  z-index: 50;
}
.modal-backdrop.show{ display:flex; }
.modal{
  width: min(560px, 96vw);
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(10,14,28,.95);
  box-shadow: 0 18px 70px rgba(0,0,0,.65);
  overflow:hidden;
}
.modal-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}
.modal-head h3{ margin:0; font-size: 16px; letter-spacing:.2px; }
.form{ padding: 14px; display:flex; flex-direction:column; gap:12px; }

.field{ display:flex; flex-direction:column; gap:6px; }
.field-label{ font-size: 12px; color: rgba(255,255,255,.68); font-weight: 800; letter-spacing:.3px; }
.hint{ font-size: 12px; color: rgba(255,255,255,.45); }

input[type="text"], input[type="date"], textarea, select{
  width:100%;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.05);
  color: var(--text);
  outline:none;
}
textarea{ resize: vertical; }
.grid2{ display:grid; grid-template-columns: 1fr 1fr; gap:10px; }

.modal-foot{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top: 4px;
  flex-wrap:wrap;
}
.btn{
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  color: var(--text);
  cursor:pointer;
  font-weight: 900;
}
.btn.primary{
  background: linear-gradient(135deg, rgba(110,231,255,.25), rgba(167,139,250,.20));
  border-color: rgba(255,255,255,.22);
}
.btn.ghost{
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.85);
}

.toast{
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 18px;
  background: rgba(10,14,28,.96);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 16px;
  padding: 10px 12px;
  display:flex;
  gap:12px;
  align-items:center;
  box-shadow: 0 18px 60px rgba(0,0,0,.55);
  opacity:0;
  pointer-events:none;
  transition: opacity .15s ease, transform .15s ease;
  z-index: 60;
}
.toast.show{
  opacity:1;
  pointer-events:auto;
  transform: translateX(-50%) translateY(-2px);
}
.toast-btn{
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 10px;
  cursor:pointer;
  font-weight: 900;
}


/* Bottom Right Container */
.bottom-right{
  position: fixed;
  right: max(18px, calc((100vw - 980px)/2 + 18px));
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 50;
}

/* Branding */
.branding{
  display: flex;
  align-items: center;
  gap: 10px;
}

.powered{
  font-size: 12px;
  color: rgba(255,255,255,.6);
  white-space: nowrap;
}

.powered strong{
  font-weight: 800;
  color: rgba(255,255,255,.9);
}

.brand-links{
  display: flex;
  gap: 6px;
}

.brand-links a{
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.18);
  transition: all .15s ease;
}

.brand-links img{
  width: 14px;
  height: 14px;
  filter: invert(1);
  opacity: .8;
}

.brand-links a:hover{
  transform: translateY(-2px);
  background: linear-gradient(135deg, rgba(110,231,255,.25), rgba(167,139,250,.20));
}

.brand-links a:hover img{
  opacity: 1;
}


/* Responsive */
@media (max-width: 640px){
  .stats{ grid-template-columns: 1fr; }
  .grid2{ grid-template-columns: 1fr; }
  .fab{ right:18px; }
  .bottom-right{
  right: 18px;
}
}
