:root{
  --bg0:#0b1220;
  --bg1:#0f172a;
  --card: rgba(255,255,255,.06);
  --card2: rgba(255,255,255,.08);
  --border: rgba(255,255,255,.10);
  --text:#e5e7eb;
  --muted:#94a3b8;
  --danger:#fb7185;
  --ok:#34d399;
  --warn:#fbbf24;

  --radius:16px;
  --radius2:22px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color:var(--text);
  background:
    radial-gradient(1200px 600px at 20% 0%, rgba(14,165,233,.18), transparent 55%),
    radial-gradient(900px 550px at 100% 20%, rgba(56,189,248,.12), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1) 55%, #0b1020);
}

.app{
  min-height:100%;
  display:flex;
  flex-direction:column;
}

.topbar{
  position:sticky;
  top:0;
  z-index:10;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 14px 10px;
  backdrop-filter: blur(10px);
  background: rgba(10, 15, 30, .65);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.topbar-left{
  display:flex;
  gap:10px;
  align-items:center;
}
.brand-dot{
  width:10px;height:10px;border-radius:99px;
  background: rgba(56,189,248,.95);
  box-shadow: 0 0 0 6px rgba(56,189,248,.12);
}
.title{ font-weight:700; letter-spacing:.2px; }
.subtitle{ font-size:12px; color:var(--muted); margin-top:2px; }

.status-pill{
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  font-size:12px;
  user-select:none;
}
.status-pill .dot{
  width:8px;height:8px;border-radius:99px;
  background: var(--warn);
}
.status-pill[data-state="draft"] .dot{ background: var(--warn); }
.status-pill[data-state="ok"] .dot{ background: var(--ok); }
.status-pill[data-state="err"] .dot{ background: var(--danger); }

.content{
  width:min(980px, 100%);
  margin: 0 auto;
  padding: 14px 14px 90px;
}

.card{
  background: linear-gradient(180deg, var(--card), rgba(255,255,255,.04));
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  box-shadow: var(--shadow);
  padding: 14px;
  margin: 12px 0;
}

.card-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}
.card-head-row{ display:flex; align-items:center; justify-content:space-between; }
.card h2{
  font-size:14px;
  margin:0;
  color: rgba(226,232,240,.95);
  letter-spacing:.2px;
}

.field{ margin: 10px 0; }
label{
  display:block;
  font-size:12px;
  color: var(--muted);
  margin-bottom:6px;
}

.input-row{
  display:flex;
  gap:8px;
  align-items:center;
}

.input, .select, .textarea{
  width:100%;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(3, 7, 18, .55);
  color: var(--text);
  padding: 11px 12px;
  outline:none;
  transition: border-color .15s ease, transform .05s ease;
}

.input::placeholder, .textarea::placeholder{ color: rgba(148,163,184,.75); }

.input:focus, .select:focus, .textarea:focus{
  border-color: rgba(56,189,248,.65);
}

.input-big{
  font-size:16px;
  padding: 13px 12px;
}

.select{
  padding: 11px 10px;
}

.textarea{
  resize: vertical;
  min-height: 80px;
}

.hint{
  margin-top:6px;
  font-size:12px;
  color: rgba(148,163,184,.85);
}

.error{
  margin-top:8px;
  font-size:12px;
  color: var(--danger);
}

.seg{
  display:flex;
  gap:8px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px;
  padding: 6px;
}

.seg-btn{
  flex:1;
  border:0;
  border-radius:999px;
  padding: 10px 10px;
  font-weight:700;
  font-size:13px;
  color: rgba(226,232,240,.9);
  background: transparent;
  cursor:pointer;
  transition: transform .05s ease, background .2s ease, color .2s ease;
}
.seg-btn:active{ transform: translateY(1px); }

.seg-btn.is-active{
  color: #0b1220;
  background:
    radial-gradient(1200px 600px at 20% 0%, rgba(14,165,233,.35), transparent 55%),
    radial-gradient(900px 550px at 100% 20%, rgba(56,189,248,.28), transparent 55%),
    linear-gradient(180deg, #e5f2ff, #cceaff);
  box-shadow: 0 8px 18px rgba(56,189,248,.18);
}

.btn{
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 14px;
  cursor:pointer;
  font-weight:700;
  transition: transform .05s ease, background .2s ease, border-color .2s ease;
  user-select:none;
}
.btn:active{ transform: translateY(1px); }

.btn-ghost{
  background: rgba(255,255,255,.05);
}

.btn-primary{
  background:
    radial-gradient(1200px 600px at 20% 0%, rgba(14,165,233,.28), transparent 55%),
    radial-gradient(900px 550px at 100% 20%, rgba(56,189,248,.20), transparent 55%),
    linear-gradient(180deg, rgba(255,255,255,.15), rgba(255,255,255,.06));
  border-color: rgba(56,189,248,.35);
}

.btn-secondary{
  background: rgba(255,255,255,.06);
}

.btn-row{ display:flex; gap:8px; align-items:center; }

.chips{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:10px;
}
.chip{
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
  color: rgba(226,232,240,.92);
  padding: 7px 10px;
  border-radius: 999px;
  font-size:12px;
  cursor:pointer;
}

.chipgrid{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.chipbtn{
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
  color: rgba(226,232,240,.92);
  padding: 9px 10px;
  border-radius: 999px;
  font-size:12px;
  cursor:pointer;
  user-select:none;
}
.chipbtn.is-on{
  border-color: rgba(56,189,248,.45);
  background: rgba(56,189,248,.18);
}

.grid2{
  display:grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.sms{
  margin: 0;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(3,7,18,.55);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-wrap;
}

.accordion{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  border:0;
  background: transparent;
  color: rgba(226,232,240,.95);
  font-weight:800;
  padding: 4px 0;
  cursor:pointer;
}
.chev{ opacity:.85; }

.accordion-body{
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.08);
  margin-top: 8px;
}

.spacer{ height: 60px; }

.bottombar{
  position:fixed;
  left:0; right:0; bottom:0;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  display:flex;
  gap:10px;
  backdrop-filter: blur(12px);
  background: rgba(10, 15, 30, .72);
  border-top: 1px solid rgba(255,255,255,.08);
  justify-content:center;
}
.bottombar .btn{
  width:min(520px, 100%);
  padding: 14px 14px;
  border-radius: 16px;
}
.bottombar .btn-secondary{
  width: min(280px, 40%);
}

/* Modal */
.modal-backdrop{
  position:fixed; inset:0;
  background: rgba(0,0,0,.55);
  display:flex;
  align-items:flex-end;
  justify-content:center;
  padding: 14px;
  z-index: 50;
}

.modal-backdrop[hidden] { display: none !important; }

.modal{
  width:min(520px, 100%);
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(12, 18, 34, .96);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.modal-body{ padding: 14px; }
.modal-foot{
  display:flex;
  gap:10px;
  justify-content:flex-end;
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.toast{
  position:fixed;
  left:50%;
  bottom: 88px;
  transform: translateX(-50%);
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(10px);
  color: rgba(226,232,240,.95);
  font-size: 12px;
  z-index: 80;
}

/* Desktop */
@media (min-width: 860px){
  .grid2{
    grid-template-columns: 1fr 1fr;
  }
  .bottombar{
    justify-content:center;
  }
}

.dd[hidden]{ display:none !important; }

.dd{
  margin-top:8px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(3,7,18,.92);
  border-radius: 16px;
  overflow:hidden;
  box-shadow: 0 14px 34px rgba(0,0,0,.45);
}

.dd-item{
  padding: 10px 12px;
  cursor:pointer;
  display:flex;
  flex-direction:column;
  gap:2px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.dd-item:first-child{ border-top:0; }

.dd-item:hover{
  background: rgba(56,189,248,.10);
}

.dd-main{
  font-weight:800;
  font-size:13px;
  color: rgba(226,232,240,.95);
}
.dd-sub{
  font-size:12px;
  color: rgba(148,163,184,.9);
}

.dd-empty{
  padding: 10px 12px;
  color: rgba(148,163,184,.9);
  font-size: 12px;
}

/* Make typeahead feel like a select */
.pick{
  position: relative;
}

.pick .dd{
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
  max-height: 280px;
  overflow: auto;
}

/* nicer scrollbar (optional) */
.pick .dd::-webkit-scrollbar{ width: 10px; }
.pick .dd::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,.10);
  border-radius: 999px;
}
.pick .dd::-webkit-scrollbar-track{
  background: rgba(255,255,255,.02);
}

.input.is-picked{
  border-color: rgba(56,189,248,.55);
  box-shadow: 0 0 0 3px rgba(56,189,248,.10);
}