:root{
  --bg:#0b1020;
  --panel:#101a33;
  --panel2:#0f1630;
  --text:#e8eeff;
  --muted:#9fb1e8cc;
  --border:#22305f;
  --brand:#6ae4ff;
  --brand2:#a78bfa;
  --danger:#ff5c7a;
  --ok:#68f0b3;
  --shadow: 0 18px 55px 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";
  background:
    radial-gradient(1200px 900px at 10% 0%, rgba(106,228,255,.16), transparent 55%),
    radial-gradient(1100px 700px at 90% 20%, rgba(167,139,250,.14), transparent 55%),
    radial-gradient(900px 900px at 40% 110%, rgba(104,240,179,.10), transparent 55%),
    var(--bg);
  color:var(--text);
}

a{color:var(--brand)}

.topbar{
  position:sticky; top:0; z-index:10;
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 16px;
  background: linear-gradient(180deg, rgba(11,16,32,.92), rgba(11,16,32,.68));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(34,48,95,.65);
}
.brand{display:flex; align-items:center; gap:12px}
.logo{
  width:40px; height:40px; border-radius:12px;
  background:
    radial-gradient(circle at 20% 25%, rgba(255,255,255,.35), transparent 45%),
    radial-gradient(circle at 75% 35%, rgba(255,255,255,.22), transparent 45%),
    linear-gradient(135deg, rgba(106,228,255,.9), rgba(167,139,250,.85));
  box-shadow: 0 14px 30px rgba(0,0,0,.35);
}
.brand-title{font-weight:750; letter-spacing:.2px}
.brand-subtitle{font-size:12px; color:var(--muted)}

.btn{
  appearance:none;
  border:1px solid rgba(34,48,95,.9);
  background: rgba(16,26,51,.7);
  color:var(--text);
  padding:9px 12px;
  border-radius:12px;
  cursor:pointer;
  transition: transform .05s ease, border-color .15s ease, background .15s ease;
}
.btn:hover{border-color: rgba(106,228,255,.55)}
.btn:active{transform: translateY(1px)}
.btn.primary{
  border-color: rgba(106,228,255,.65);
  background: linear-gradient(135deg, rgba(106,228,255,.18), rgba(167,139,250,.10));
}
.btn.danger{border-color: rgba(255,92,122,.65)}
.btn.ok{border-color: rgba(104,240,179,.65)}
.btn.small{padding:7px 10px; border-radius:11px; font-size:13px}
.btn:disabled{opacity:.6; cursor:not-allowed}
.filelike{display:inline-flex; gap:8px; align-items:center}
.filelike input{display:none}
.top-actions{display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end}

.layout{
  display:grid;
  grid-template-columns: 330px 1fr;
  min-height: calc(100vh - 66px);
}

.sidebar{
  border-right:1px solid rgba(34,48,95,.55);
  padding:16px;
  background: linear-gradient(180deg, rgba(16,26,51,.55), rgba(16,26,51,.25));
}
.search input{
  width:100%;
  padding:11px 12px;
  border-radius:14px;
  border:1px solid rgba(34,48,95,.9);
  background: rgba(15,22,48,.55);
  color:var(--text);
  outline:none;
}
.search input:focus{border-color: rgba(106,228,255,.65)}
.filters{display:flex; flex-wrap:wrap; gap:8px; margin:14px 0}
.chip{
  border:1px solid rgba(34,48,95,.9);
  background: rgba(15,22,48,.4);
  color:var(--text);
  padding:7px 10px;
  border-radius:999px;
  cursor:pointer;
  font-size:13px;
}
.chip.is-active{border-color: rgba(106,228,255,.65); background: rgba(106,228,255,.12)}

.sidebar-actions{display:grid; gap:10px; margin:10px 0 16px}
.panel{
  border:1px solid rgba(34,48,95,.7);
  background: rgba(15,22,48,.35);
  border-radius:18px;
  padding:12px;
  box-shadow: 0 12px 30px rgba(0,0,0,.22);
}
.panel-title{font-weight:700; margin-bottom:8px}
.flashback{min-height:56px}
.hint{margin-top:14px; color:var(--muted); font-size:12px; line-height:1.35}
.muted{color:var(--muted)}
.pill{
  display:inline-flex; align-items:center; justify-content:center;
  min-width:24px; height:22px;
  padding:0 8px;
  border-radius:999px;
  border:1px solid rgba(34,48,95,.85);
  color:var(--muted);
  font-size:12px;
}

.content{padding:16px}
.content-header{display:flex; align-items:flex-end; justify-content:space-between; gap:12px}
.content-title{display:flex; align-items:center; gap:10px; font-size:18px; font-weight:750}
.content-subtitle{font-size:12px}
.split{
  margin-top:14px;
  display:grid;
  grid-template-columns: minmax(260px, 420px) 1fr;
  gap:14px;
  height: calc(100vh - 66px - 16px - 44px - 18px);
}
.list{
  overflow:auto;
  border:1px solid rgba(34,48,95,.55);
  border-radius:18px;
  background: rgba(15,22,48,.25);
}
.list-item{
  padding:12px;
  border-bottom:1px solid rgba(34,48,95,.4);
  cursor:pointer;
  display:grid;
  gap:6px;
}
.list-item:hover{background: rgba(106,228,255,.06)}
.list-item.is-selected{background: rgba(106,228,255,.10)}
.li-top{display:flex; align-items:center; justify-content:space-between; gap:10px}
.li-title{font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.li-meta{display:flex; gap:8px; flex-wrap:wrap}
.badge{
  font-size:12px;
  color:var(--muted);
  border:1px solid rgba(34,48,95,.7);
  padding:2px 8px;
  border-radius:999px;
  background: rgba(16,26,51,.45);
}
.badge.danger{border-color: rgba(255,92,122,.55); color: rgba(255,92,122,.95); background: rgba(255,92,122,.08)}
.badge.ok{border-color: rgba(104,240,179,.55); color: rgba(104,240,179,.95); background: rgba(104,240,179,.08)}
.badge.brand{border-color: rgba(106,228,255,.55); color: rgba(106,228,255,.95); background: rgba(106,228,255,.08)}
.li-snippet{color:var(--muted); font-size:12px; line-height:1.35; max-height:2.7em; overflow:hidden}

.detail{
  overflow:auto;
  border:1px solid rgba(34,48,95,.55);
  border-radius:18px;
  background: rgba(15,22,48,.22);
  padding:14px;
}
.detail .empty{
  padding:24px;
  border:1px dashed rgba(34,48,95,.8);
  border-radius:18px;
  background: rgba(16,26,51,.25);
  color:var(--muted);
  line-height:1.5;
}
.d-title{font-size:22px; font-weight:800; letter-spacing:.2px}
.d-body{margin-top:10px; white-space:pre-wrap; line-height:1.5}
.d-row{display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; margin-top:12px}
.d-actions{display:flex; gap:10px; flex-wrap:wrap}
.attachments{
  margin-top:12px;
  display:grid;
  gap:10px;
}
.att{
  border:1px solid rgba(34,48,95,.55);
  border-radius:16px;
  padding:10px;
  background: rgba(16,26,51,.25);
}
.att-top{display:flex; align-items:center; justify-content:space-between; gap:10px}
.att-name{font-weight:650; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.att-preview{margin-top:8px}
.att-preview img{max-width:100%; border-radius:14px; display:block; border:1px solid rgba(34,48,95,.55)}
.att-preview audio{width:100%}
.att-preview .url{
  display:flex; flex-wrap:wrap; gap:8px; align-items:center; justify-content:space-between;
  padding:10px;
  border-radius:14px;
  border:1px solid rgba(34,48,95,.5);
  background: rgba(15,22,48,.3);
}

.modal-root{
  position:fixed; inset:0; z-index:50;
  display:grid; place-items:center;
  background: rgba(0,0,0,.62);
}
.modal-root[hidden]{display:none}
.modal{
  width: min(900px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow:auto;
  background: linear-gradient(180deg, rgba(16,26,51,.98), rgba(12,18,39,.98));
  border:1px solid rgba(34,48,95,.85);
  border-radius:20px;
  box-shadow: var(--shadow);
  padding:14px;
}
.modal-head{display:flex; align-items:flex-start; justify-content:space-between; gap:10px}
.modal-title{font-size:18px; font-weight:800}
.grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
  margin-top:12px;
}
.field label{display:block; color:var(--muted); font-size:12px; margin:0 0 6px 2px}
.field input, .field textarea, .field select{
  width:100%;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid rgba(34,48,95,.9);
  background: rgba(15,22,48,.55);
  color:var(--text);
  outline:none;
}
.field textarea{min-height:110px; resize:vertical}
.field input:focus, .field textarea:focus, .field select:focus{border-color: rgba(106,228,255,.65)}
.span2{grid-column: 1 / -1}
.row{display:flex; gap:10px; flex-wrap:wrap; align-items:center}
.quick-buttons{display:flex; gap:8px; flex-wrap:wrap}
.sep{height:1px; background: rgba(34,48,95,.55); margin:12px 0}
.kbd{border:1px solid rgba(34,48,95,.8); border-bottom-width:2px; border-radius:8px; padding:2px 8px; font-size:12px; color:var(--muted); background: rgba(15,22,48,.35)}

@media (max-width: 980px){
  .layout{grid-template-columns: 1fr}
  .sidebar{border-right:none; border-bottom:1px solid rgba(34,48,95,.55)}
  .split{grid-template-columns: 1fr; height:auto}
}
