: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; }
.promo-link-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.promo-iframe-wrap { margin-top: 10px; max-width: 520px; }
.promo-iframe-snippet { display: block; font-size: 11px; line-height: 1.45; word-break: break-all; white-space: pre-wrap; padding: 8px 10px; background: var(--bg); border-radius: 8px; border: 1px solid var(--line); color: #c9d6e5; }
button.btn-toggle-iframe.on { border-color: var(--accent); color: var(--accent); }
.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; }

/* Readability refresh: keep the existing pages and actions, update only presentation. */
:root {
  color-scheme: light;
  --bg: #f4f6fa;
  --bg2: #ffffff;
  --panel: #ffffff;
  --line: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --accent: #2563eb;
  --coruna: #5b5bd6;
  --ds: #16845b;
  --warn: #a96708;
  --danger: #c43b4d;
  --ok: #16845b;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

a { color: #2459c5; }
a:hover { color: #1745a6; }

.layout { min-height: 100vh; }
.side {
  flex: 0 0 244px;
  width: 244px;
  padding: 24px 14px;
  background: #fff;
  border-right: 1px solid var(--line);
  box-shadow: 3px 0 18px rgba(15, 23, 42, .025);
}
.brand {
  margin: 0 8px 20px;
  padding: 2px 4px 18px;
  border-bottom: 1px solid var(--line);
  color: #172033;
  font-size: 16px;
  letter-spacing: .02em;
}
.brand span { color: var(--accent); }
.nav { display: grid; gap: 3px; }
.nav a {
  margin: 0;
  padding: 9px 12px;
  border-radius: 8px;
  color: #526176;
  font-weight: 500;
  transition: background .15s ease, color .15s ease;
}
.nav a:hover { background: #f3f6fb; color: #1e293b; }
.nav a.on {
  background: #edf4ff;
  color: #1d4ed8;
  box-shadow: inset 3px 0 #2563eb;
  font-weight: 650;
}

.main { padding: 28px clamp(18px, 3vw, 42px) 52px; }
.top {
  min-height: 48px;
  padding-bottom: 16px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.top h1 { color: #172033; font-size: 23px; letter-spacing: -.02em; }
.user { color: #526176; }
.user a { margin-left: 10px; font-weight: 600; }

.card {
  overflow-x: auto;
  padding: 18px 20px;
  margin-bottom: 18px;
  border-color: #e5eaf1;
  border-radius: 12px;
  box-shadow: 0 3px 12px rgba(15, 23, 42, .035);
}
.row { gap: 10px; }
input[type=text], input[type=password], select, textarea {
  min-height: 38px;
  background: #fff;
  color: var(--text);
  border-color: #cbd5e1;
  border-radius: 7px;
}
input::placeholder, textarea::placeholder { color: #94a3b8; }
input:focus, select:focus, textarea:focus {
  border-color: #5b8def;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
button, .btn {
  min-height: 36px;
  background: var(--accent);
  color: #fff;
  border-radius: 7px;
  transition: background .15s ease, box-shadow .15s ease;
}
button:hover, .btn:hover { background: #1d4ed8; text-decoration: none; }
button:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .3);
  outline-offset: 2px;
}
button.ghost, .btn.ghost {
  background: #fff;
  color: #334155;
  border-color: #cbd5e1;
}
button.ghost:hover, .btn.ghost:hover { background: #f8fafc; }
button.danger, .btn.danger { background: #c43b4d; color: #fff; }
button.danger:hover, .btn.danger:hover { background: #a92e3f; }

.table {
  min-width: 920px;
  font-size: 13px;
}
.table th, .table td { padding: 11px 10px; }
.table th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: #526176;
  border-bottom-color: #dbe3ee;
  font-size: 12px;
  letter-spacing: .015em;
  white-space: nowrap;
}
.table td { color: #334155; }
.table tr:hover td { background: #f8faff; }
.table code, code {
  color: #334155;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.badge { padding: 3px 9px; font-size: 11px; line-height: 1.45; }
.badge.coruna { background: #eeefff; color: #4b4bb4; }
.badge.darksword, .badge.on, .badge.done { background: #e8f7ef; color: #16734f; }
.badge.off { background: #eef2f6; color: #64748b; }
.badge.pending { background: #fff4df; color: #94600d; }
.badge.sent { background: #eaf2ff; color: #2459c5; }
.badge.likely { background: #fff0f0; color: #bd3544; }
.pager, .pagination { color: var(--muted); }
.pagination li.active span { background: var(--accent); color: #fff; border-color: var(--accent); }
.tabs a { background: #f1f5f9; color: #526176; }
.tabs a.on { background: var(--accent); color: #fff; }
.pre, .promo-iframe-snippet, .swal-json {
  background: #f8fafc;
  color: #334155;
  border-color: var(--line);
}
.secret { background: #fff7f7; border-color: #f0d6da; }
.wallet-pair { background: #fbf8f8; border-color: #eadde0; }
.wallet-fold { background: #fff; }
.wallet-fold summary { color: var(--text); }
.login-wrap {
  padding: 24px;
  background: radial-gradient(ellipse at top, #e6efff 0, var(--bg) 58%);
}
.login-box {
  width: min(400px, 100%);
  padding: 32px;
  border-color: #e5eaf1;
  box-shadow: 0 18px 55px rgba(15, 23, 42, .1);
}
.login-box h1 { color: #172033; font-size: 22px; }

@media (max-width: 900px) {
  .side { width: auto; padding: 16px; }
  .brand { margin-bottom: 12px; padding-bottom: 12px; }
  .nav { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
  .nav a { flex: 0 0 auto; }
  .nav a.on { box-shadow: inset 0 -3px #2563eb; }
  .main { padding: 22px 18px 40px; }
  .cmd-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .main { padding: 18px 12px 32px; }
  .top { align-items: flex-start; flex-direction: column; }
  .top-right { justify-content: flex-start; }
  .card { padding: 14px; }
  .row { align-items: stretch; }
  .row input, .row select { max-width: 100%; }
  .kv { grid-template-columns: 1fr; gap: 3px; }
  .kv b { margin-top: 8px; }
}

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