:root{
  --bg:#070b16;
  --card: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.12);
  --text:#eaf0ff;
  --muted: rgba(234,240,255,0.70);
  --accent:#1f6feb;
  --danger:#ff5a6a;
  --ok:#4cd964;
  --shadow: 0 14px 40px rgba(0,0,0,0.45);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  display:flex;
  align-items:flex-start;
  justify-content:center;
  overflow-y:auto;
  padding: 22px 16px 40px;
}

.wrap{
  width:100%;
  max-width:560px;
}

.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.header{
  padding: 24px 18px 18px;
  text-align:center;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap: 14px;
}

.brand img{
  width: 100%;
  max-width: 420px;
  height: auto;
  object-fit: contain;
}

.title{
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

.sub{
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.content{ padding: 18px; }

.btn{
  width: 100%;
  font-size: 18px;
  font-weight: 750;
  padding: 16px 18px;
  border-radius: 14px;
  border: 0;
  background: var(--accent);
  color: white;
  cursor: pointer;
  touch-action: manipulation;
  position: relative;
  overflow: hidden;
  transition: transform 120ms ease, opacity 200ms ease, filter 200ms ease;
}

.btn:hover{ filter: brightness(1.03); }
.btn:active{ transform: scale(0.99); }
.btn[disabled]{ opacity: 0.55; cursor: not-allowed; }

.btn .ripple{
  position:absolute;
  border-radius: 999px;
  transform: translate(-50%,-50%);
  pointer-events:none;
  background: rgba(255,255,255,0.25);
  animation: ripple 520ms ease-out;
}

@keyframes ripple{
  from{ width: 0; height: 0; opacity: 0.65; }
  to{ width: 420px; height: 420px; opacity: 0; }
}

.helpLink{ margin-top: 10px; text-align:center; font-size: 13px; }
.helpLink a{ color: rgba(234,240,255,0.75); text-decoration: underline; text-underline-offset: 3px; }

.status{
  margin-top: 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 14px;
}

.row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 9px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.row:last-child{ border-bottom: 0; }

.label{ color: var(--muted); font-size: 13px; }
.value{ font-size: 13px; font-weight: 650; text-align:right; }

.pill{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  font-size: 13px;
  font-weight: 700;
}

.dot{
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: var(--ok);
  transition: background 200ms ease, box-shadow 200ms ease;
  box-shadow: 0 0 0 0 rgba(76,217,100,0.0);
}

/* Status themes */
.pill.sending { background: rgba(255, 193, 7, 0.14); }
.pill.received { background: rgba(31,111,235,0.18); }
.pill.inprogress { background: rgba(255,90,106,0.14); }
.pill.complete { background: rgba(76,217,100,0.14); }
.pill.timeout { background: rgba(255, 140, 0, 0.16); }

.dot.sending { background: rgba(255, 193, 7, 0.95); box-shadow: 0 0 0 6px rgba(255, 193, 7, 0.14); }
.dot.received { background: rgba(31,111,235,0.95); box-shadow: 0 0 0 6px rgba(31,111,235,0.14); }
.dot.inprogress { background: rgba(255,90,106,0.95); box-shadow: 0 0 0 6px rgba(255,90,106,0.14); }
.dot.complete { background: rgba(76,217,100,0.95); box-shadow: 0 0 0 6px rgba(76,217,100,0.14); }
.dot.timeout { background: rgba(255, 140, 0, 0.95); box-shadow: 0 0 0 6px rgba(255, 140, 0, 0.14); }
.activity{
  margin-top: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  padding: 12px;
}

.activityTitle{
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}

#activityList{
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.actRow{
  display:flex;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 8px;
}
.actRow:last-child{ margin-bottom: 0; }

.actRow.resolved{ opacity: 0.55; }

.actDot{
  width: 10px;
  height: 10px;
  border-radius: 99px;
  margin-top: 4px;
  background: rgba(234,240,255,0.35);
}
.actDot.ok{ background: rgba(76,217,100,0.90); }
.actDot.warn{ background: rgba(255,90,106,0.90); }
.actDot.info{ background: rgba(31,111,235,0.90); }

.actMain{ flex: 1; min-width: 0; }

.actLine1{
  font-size: 13px;
  font-weight: 750;
  color: rgba(234,240,255,0.92);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}

.actTime{
  font-size: 12px;
  font-weight: 650;
  color: rgba(234,240,255,0.60);
  white-space: nowrap;
}

.actLine2{
  margin-top: 4px;
  font-size: 12px;
  color: rgba(234,240,255,0.70);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.resolveBtn{
  border: 0;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  background: rgba(76,217,100,0.20);
  color: rgba(234,240,255,0.92);
  white-space: nowrap;
  align-self: flex-start;
}
.resolveBtn[disabled]{ opacity: 0.6; cursor: not-allowed; }

.badge{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: rgba(234,240,255,0.80);
  margin-left: 8px;
}

.msg{
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
  min-height: 18px;
  text-align:center;
}

.footer{
  margin-top: 12px;
  text-align:center;
  color: rgba(234,240,255,0.45);
  font-size: 12px;
}

/* Bottom sheet modal */
.sheetBackdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display:none;
  align-items:flex-end;
  justify-content:center;
  padding: 14px;
}
.sheetBackdrop.show{ display:flex; }

.sheet{
  width: 100%;
  max-width: 560px;
  background: rgba(20,26,45,0.96);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.6);
  padding: 14px;
}

.sheetHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 6px 6px 10px;
}

.sheetTitle{ font-weight: 800; font-size: 15px; }

.closeBtn{
  border: 0;
  background: rgba(255,255,255,0.08);
  color: rgba(234,240,255,0.85);
  border-radius: 12px;
  padding: 8px 10px;
  cursor:pointer;
}

.chips{
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
  padding: 6px;
}
.chip{
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: rgba(234,240,255,0.85);
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 13px;
  cursor:pointer;
  user-select:none;
}
.chip.active{
  border-color: rgba(31,111,235,0.55);
  background: rgba(31,111,235,0.18);
}

.field{ padding: 6px; }

textarea{
  width: 100%;
  min-height: 90px;
  resize: vertical;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: rgba(234,240,255,0.92);
  padding: 12px;
  font-size: 14px;
  outline: none;
}

.sheetActions{ display:flex; gap: 10px; padding: 6px; }

.sendBtn{
  width: 100%;
  padding: 14px 14px;
  border-radius: 14px;
  border: 0;
  font-size: 15px;
  font-weight: 800;
  background: rgba(255,90,106,0.92);
  color: white;
  cursor:pointer;
}
.sendBtn[disabled]{ opacity: 0.6; cursor: not-allowed; }

@media (max-width: 420px){
  .title{ font-size: 20px; }
  .btn{ font-size: 17px; }
  #activityList{ max-height: 280px; }
}