:root {
  --bg: #0b0d12;
  --bg2: #11151d;
  --glass: rgba(28, 33, 45, 0.55);
  --glass-brd: rgba(255, 255, 255, 0.08);
  --fg: #e8ecf4;
  --muted: #8b93a7;
  --accent: #5b8cff;
  --accent2: #7c5bff;
  --good: #3ad29f;
  --bad: #ff6b6b;
  --warn: #ffcc66;
  --radius: 16px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(91,140,255,0.18), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(124,91,255,0.16), transparent 55%),
    var(--bg);
  color: var(--fg);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--bad); min-height: 18px; font-size: 13px; margin-top: 8px; }

.glass {
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--shadow);
}

.brand { font-weight: 700; font-size: 18px; letter-spacing: 0.2px; display: flex; align-items: center; gap: 8px; }
.bolt { filter: drop-shadow(0 0 8px rgba(91,140,255,0.8)); }

/* Buttons / inputs */
button { font: inherit; cursor: pointer; border: none; border-radius: 12px; padding: 10px 16px; color: var(--fg); background: rgba(255,255,255,0.06); transition: 0.15s; }
button:hover { background: rgba(255,255,255,0.12); }
button.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: white; font-weight: 600; }
button.primary:hover { filter: brightness(1.1); }
button.ghost { background: transparent; border: 1px solid var(--glass-brd); }
.icon-btn { padding: 8px 12px; font-size: 16px; }
input, textarea, select {
  font: inherit; color: var(--fg); width: 100%;
  background: rgba(0,0,0,0.25); border: 1px solid var(--glass-brd);
  border-radius: 12px; padding: 11px 13px; outline: none;
}
input:focus, textarea:focus { border-color: var(--accent); }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 5px; }

/* Overlay / setup */
.overlay { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px;
  background: rgba(5,7,11,0.6); backdrop-filter: blur(6px); z-index: 50; }
.setup-card { width: min(420px, 100%); border-radius: var(--radius); padding: 26px; }
.setup-card .brand { margin-bottom: 6px; }
.setup-card button { width: 100%; margin-top: 16px; }
.setup-card button.ghost { margin-top: 8px; }

/* App layout */
.app { max-width: 820px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; min-height: 100%; }
.topbar { position: sticky; top: 10px; z-index: 10; display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-radius: var(--radius); }
.topbar .status { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.dot.online { background: var(--good); box-shadow: 0 0 10px var(--good); }
.dot.offline { background: var(--bad); }

.composer { border-radius: var(--radius); padding: 14px; position: relative; }
.composer textarea { resize: vertical; min-height: 64px; }
.composer-actions { display: flex; gap: 10px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.composer-actions select { width: auto; }
.file-btn { background: rgba(255,255,255,0.06); padding: 10px 16px; border-radius: 12px; cursor: pointer; user-select: none; }
.file-btn:hover { background: rgba(255,255,255,0.12); }
.drop-hint { display: none; position: absolute; inset: 0; border-radius: var(--radius);
  border: 2px dashed var(--accent); background: rgba(91,140,255,0.12);
  align-items: center; justify-content: center; font-weight: 600; }
.composer.dragover .drop-hint { display: flex; }

/* Tabs */
.tabs { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tab { padding: 8px 14px; border-radius: 999px; background: rgba(255,255,255,0.05); font-size: 14px; }
.tab.active { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: white; }
.search { margin-left: auto; width: auto; flex: 1; min-width: 140px; max-width: 260px; padding: 8px 13px; }

/* List */
.list { display: flex; flex-direction: column; gap: 10px; padding-bottom: 40px; }
.card { border-radius: 14px; padding: 14px; display: flex; gap: 12px; align-items: flex-start;
  background: var(--glass); border: 1px solid var(--glass-brd); animation: pop 0.18s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.card .ic { font-size: 22px; line-height: 1; margin-top: 2px; }
.card .body { flex: 1; min-width: 0; }
.card .title { font-weight: 600; margin-bottom: 2px; word-break: break-word; }
.card .text { color: var(--fg); white-space: pre-wrap; word-break: break-word; max-height: 8em; overflow: hidden; }
.card .text a { color: var(--accent); }
.card .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--muted); }
.chip { padding: 2px 9px; border-radius: 999px; background: rgba(124,91,255,0.18); color: #c5b8ff; font-size: 11px; }
.chip.cat { background: rgba(58,210,159,0.16); color: #8ff0cf; }
.tag { padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,0.07); font-size: 11px; }
.card .actions { display: flex; flex-direction: column; gap: 6px; }
.card .actions button { padding: 6px 10px; font-size: 13px; }
.summary { font-size: 12px; color: var(--muted); font-style: italic; margin-top: 4px; }
.empty { text-align: center; color: var(--muted); padding: 60px 20px; }

/* Toast */
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(100px);
  background: var(--bg2); border: 1px solid var(--glass-brd); padding: 12px 18px; border-radius: 12px;
  box-shadow: var(--shadow); transition: transform 0.25s; z-index: 100; }
#toast.show { transform: translateX(-50%) translateY(0); }

@media (max-width: 560px) {
  .app { padding: 10px; }
  .card .actions { flex-direction: row; }
}
