:root {
  --bg: #10141b;
  --bg2: #161c26;
  --panel: #1b2330;
  --line: #2a3546;
  --text: #e8eef6;
  --muted: #8b9bb0;
  --accent: #4aa3ff;
  --coruna: #8aa4ff;
  --ds: #3dce8e;
  --warn: #e0a14a;
  --danger: #e36b6b;
  --ok: #3dce8e;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.layout { display: flex; min-height: 100vh; }
.side { width: 220px; background: var(--bg2); border-right: 1px solid var(--line); padding: 22px 16px; position: sticky; top: 0; height: 100vh; }
.brand { font-size: 15px; font-weight: 650; letter-spacing: .04em; margin: 0 0 28px; color: #fff; }
.brand span { color: var(--accent); }
.nav a { display: block; color: var(--muted); padding: 9px 12px; border-radius: 8px; margin-bottom: 4px; text-decoration: none; }
.nav a:hover, .nav a.on { background: var(--panel); color: var(--text); }
.main { flex: 1; min-width: 0; padding: 22px 28px 48px; }
.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; }
.top h1 { font-size: 20px; margin: 0; font-weight: 600; }
.top-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.btn-mnemonic-reveal { font-size: 13px; padding: 6px 12px; }
.muted { color: var(--muted); }
.user { color: var(--muted); font-size: 13px; }
.user a { margin-left: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
input, select, textarea, button { font: inherit; }
input[type=text], input[type=password], select, textarea {
  background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
button, .btn {
  background: var(--accent); color: #061018; border: 0; border-radius: 8px;
  padding: 8px 14px; font-weight: 600; cursor: pointer; display: inline-block;
}
button.ghost, .btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.danger, .btn.danger { background: var(--danger); color: #1a0b0b; }
.table .btn.danger { padding: 4px 10px; font-size: 12px; }
.grow { flex: 1; }
.photo-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.photo-item { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.photo-thumb { position: relative; display: block; }
.photo-scan-badge { position: absolute; top: 6px; right: 6px; z-index: 2; font-size: 11px; padding: 2px 7px; box-shadow: 0 1px 4px rgba(0,0,0,.35); pointer-events: none; }
.photo-item img { width: 100%; height: 160px; object-fit: cover; display: block; }
.photo-meta { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 4px; }
.photo-meta code { font-size: 11px; word-break: break-all; }
.swal2-popup.adm-swal { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; }
.swal2-popup.adm-swal .swal2-title { color: var(--text); font-size: 18px; }
.swal2-popup.adm-swal .swal2-html-container { color: var(--muted); }
.swal2-popup.adm-swal .swal2-actions { gap: 10px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 550; font-size: 12px; }
.table tr:hover td { background: rgba(255,255,255,.02); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.coruna { background: rgba(138,164,255,.15); color: var(--coruna); }
.badge.darksword { background: rgba(61,206,142,.15); color: var(--ds); }
.badge.on { background: rgba(61,206,142,.15); color: var(--ds); }
.badge.off { background: rgba(139,155,176,.12); color: var(--muted); }
.badge.pending { background: rgba(224,161,74,.15); color: var(--warn); }
.badge.sent { background: rgba(74,163,255,.15); color: var(--accent); }
.badge.done { background: rgba(61,206,142,.15); color: var(--ds); }
.badge.likely { background: rgba(255,107,107,.18); color: #ff8a8a; }
.photo-scan-badge.likely { font-size: 10px; max-width: 92%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { padding: 7px 12px; border-radius: 8px; color: var(--muted); background: var(--bg); text-decoration: none; }
.tabs a.on { color: #061018; background: var(--accent); font-weight: 600; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; }
.kv b { color: var(--muted); font-weight: 500; }
.pager { margin-top: 14px; color: var(--muted); }
.pager a { margin-right: 8px; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box { width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.login-box h1 { margin: 0 0 6px; font-size: 20px; }
.login-box p { margin: 0 0 20px; color: var(--muted); }
.login-box label { display: block; margin: 12px 0 6px; color: var(--muted); }
.login-box input { width: 100%; }
.login-box button { width: 100%; margin-top: 18px; }
.err { color: var(--danger); margin: 0 0 10px; }
.ok { color: var(--ok); }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.photos a { display: block; background: var(--bg); border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.photos .photo-thumb { position: relative; }
.photos img { width: 100%; height: 140px; object-fit: cover; display: block; }
.note-list-tg { display: flex; flex-direction: column; gap: 2px; }
.note-row-tg { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: inherit; border: 1px solid var(--line); background: var(--bg); margin-bottom: 6px; }
.note-row-tg:hover { background: rgba(255,255,255,.03); }
.note-row-device a { text-decoration: none; }
.note-row-device a:hover code { color: var(--accent); }
.note-row-meta .btn.ghost { padding: 4px 10px; font-size: 12px; white-space: nowrap; }
.note-detail-block p { margin: 0 0 10px; text-align: left; }
.note-detail-body { max-height: 420px; text-align: left; margin: 0; }
.note-row-device { flex: 0 0 auto; max-width: 28%; }
.note-row-device code { font-size: 11px; word-break: break-all; }
.note-row-main { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.note-row-meta { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.note-item { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.note-item h3 { margin: 6px 0 8px; font-size: 15px; font-weight: 600; }
.pre { white-space: pre-wrap; word-break: break-all; background: var(--bg); padding: 10px; border-radius: 8px; font-size: 12px; color: #c9d6e5; max-height: 280px; overflow: auto; }
.secret { background: #23181b; border: 1px solid #4a2c32; padding: 10px 12px; border-radius: 8px; margin-bottom: 8px; }
.secret code { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-all; }
.secret-cell { min-width: 280px; max-width: 560px; }
.wallet-group h3 { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.wallet-pair { border: 1px solid #3a2a30; border-radius: 10px; padding: 10px 12px 4px; margin-bottom: 14px; background: rgba(0,0,0,.12); }
.wallet-pair .secret { margin-bottom: 8px; }
.wallet-pair .wallet-fold { margin-top: 0; }
.wallet-fold { border: 1px solid var(--line); border-radius: 8px; margin: 10px 0; background: var(--bg); }
.wallet-fold summary { cursor: pointer; padding: 10px 12px; color: var(--text); list-style: none; display: flex; gap: 8px; align-items: center; }
.wallet-fold summary::-webkit-details-marker { display: none; }
.wallet-fold summary::before { content: "▸"; color: var(--muted); }
.wallet-fold[open] summary::before { content: "▾"; }
.wallet-fold .table { margin: 0 10px 10px; width: calc(100% - 20px); }
.cmd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.apps-all { display: none; margin-top: 12px; }
.apps-all.show { display: block; }
.pagination { display: flex; gap: 6px; list-style: none; padding: 0; margin: 12px 0 0; }
.pagination li a, .pagination li span { display: inline-block; padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); }
.pagination li.active span { background: var(--accent); color: #061018; border-color: var(--accent); }
.swal-json {
  max-height: 70vh;
  overflow: auto;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-word;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 0;
}
.swal-json .jk { color: #7dd3fc; }
.swal-json .js { color: #86efac; }
.swal-json .jn { color: #fcd34d; }
.swal-json .jl { color: #f472b6; }

@media (max-width: 900px) {
  .layout { display: block; }
  .side { width: auto; height: auto; position: relative; }
  .cmd-grid { grid-template-columns: 1fr; }
}
