:root {
  --bg: #0f1115;
  --panel: #181b22;
  --panel2: #20242d;
  --border: #2a2f3a;
  --text: #e6e9ef;
  --muted: #9aa3b2;
  --accent: #4f8cff;
  --accent2: #2f6fe0;
  --green: #36d399;
  --red: #f87272;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
}
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.brand { font-weight: 700; font-size: 16px; }
.status { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot.off { background: var(--red); }
.icon-btn { background: none; border: none; color: var(--text); font-size: 18px; cursor: pointer; }

.panel {
  background: var(--panel); border-bottom: 1px solid var(--border);
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
}
.panel.hidden, .hidden { display: none; }
.panel h3 { margin: 0 0 4px; }
label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; }
input[type=text], input[type=password], input:not([type]) {
  background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 9px 10px; font-size: 14px; outline: none;
}
input:focus { border-color: var(--accent); }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.chk { flex-direction: row; align-items: center; gap: 6px; color: var(--text); }
button {
  border: 1px solid var(--border); background: var(--panel2); color: var(--text);
  border-radius: 8px; padding: 8px 12px; cursor: pointer; font-size: 13px;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent2); color: #fff; font-weight: 600; }
button.primary:hover { background: var(--accent2); }
button.ghost { background: transparent; }
button.small { padding: 4px 8px; font-size: 12px; }
.hint { color: var(--muted); font-size: 12px; }

main { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.compose { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
textarea {
  width: 100%; min-height: 70px; resize: vertical; background: var(--panel2);
  border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 10px; font-size: 14px;
  font-family: inherit; outline: none;
}
textarea:focus { border-color: var(--accent); }
.img-preview { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.img-preview img { max-height: 140px; border-radius: 8px; border: 1px solid var(--border); }

.history-head { display: flex; justify-content: space-between; align-items: center; }
.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.item {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; display: flex; flex-direction: column; gap: 8px;
}
.item .meta { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.badge { padding: 1px 7px; border-radius: 999px; font-size: 11px; background: var(--panel2); border: 1px solid var(--border); }
.badge.text { color: var(--accent); }
.badge.image { color: var(--green); }
.item .content { white-space: pre-wrap; word-break: break-word; font-size: 14px; max-height: 220px; overflow: auto; }
.item img.thumb { max-height: 160px; border-radius: 8px; border: 1px solid var(--border); }
.item .actions { display: flex; gap: 8px; }
.empty { color: var(--muted); text-align: center; padding: 30px 0; }

.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  padding: 10px 16px; border-radius: 999px; font-size: 13px; box-shadow: 0 6px 24px rgba(0,0,0,.4);
}
