:root { --fg: #111827; --muted: #6b7280; --border: #e5e7eb; --shadow: 0 1px 2px rgba(0,0,0,.05); --primary: #2563eb; }
* { box-sizing: border-box; }
body { font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; background: #f8fafc; color: var(--fg); max-width: 1200px; margin: 24px auto; padding: 0 16px; }
h1 { font-size: 28px; margin: 10px 0 6px; }
h2 { font-size: 22px; margin: 0 0 10px; }
h3 { font-size: 18px; margin: 0 0 10px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); }
label { display: block; font-size: 13px; color: var(--muted); margin-top: 10px; }
input, textarea, select { width: 100%; padding: 10px 12px; margin-top: 6px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
input:focus, textarea:focus, select:focus { outline: none; border-color: rgba(37,99,235,.55); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
a { color: var(--primary); text-decoration: none; }
.muted { color: var(--muted); font-size: 13px; }
ul { margin: 10px 0 0; padding-left: 18px; }
.topbar { display: flex; align-items: center; gap: 10px; margin: 10px 0 6px; }
.topbar h1 { margin: 0; }
.icon { width: 26px; height: 26px; display: block; }
.list { list-style: none; padding: 0; margin: 10px 0 0; }
.list > li + li { margin-top: 10px; }
.rowlink { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.rowlink:hover { background: #f3f4f6; }
.rowleft { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.iconlink { border-radius: 10px; padding: 6px 10px; transition: background-color .12s ease; }
.iconlink:hover { background: #e2e8f4; }
.statnum { font-size: 22px; font-weight: 800; color: var(--fg); margin-top: 4px; }
.rowname { font-weight: 700; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; font-size: 12px; color: var(--muted); background: #fff; white-space: nowrap; }
.badge.iconlink:hover { background: #e2e8f4; }
.badge-success { border-color: rgba(22,163,74,.25); color: #16a34a; }
.badge-danger { border-color: rgba(220,38,38,.35); color: #dc2626; }
.btn-icon { width: 18px; height: 18px; display: block; }
.btn.btn-primary .btn-icon, .btn.btn-danger .btn-icon { filter: brightness(0) invert(1); }
.btn-iconbtn { width: 44px; min-width: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.input-group > .btn.btn-iconbtn { flex: 0 0 auto; transform: translateY(2px); }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 5px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); transition: background-color .12s ease; }
.iconbtn:hover { background: #e2e8f4; }
.iconbtn svg { width: 24px; height: 24px; display: block; }
.iconbtn img { width: 24px !important; height: 24px !important; display: block; object-fit: contain; }
.iconbtn:focus, .iconbtn:focus-visible { outline: none; box-shadow: none; }
a.iconbtn { color: inherit; }
.iconbtn-danger { border-color: rgba(220,38,38,.35); color: #dc2626; }
.iconbtn-danger:hover { background: rgba(220,38,38,.08); }
.rowactions { display: inline-flex; align-items: center; gap: 10px; }
.rowactions form { margin: 0; }
.editbox { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.editgrid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.editactions { display: flex; gap: 10px; justify-content: flex-end; }
.btn-ghost { background: #fff; color: var(--primary); }
.toast { position: fixed; right: 16px; bottom: 16px; z-index: 9999; min-width: 260px; max-width: 420px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.12); opacity: 0; transform: translateY(10px); transition: opacity .18s ease, transform .18s ease; display: flex; gap: 10px; align-items: flex-start; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast .t { font-weight: 800; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.toast .m { margin-top: 2px; font-size: 13px; color: var(--fg); }
.toast .x { margin-left: auto; border: 0; background: transparent; padding: 0; width: 22px; height: 22px; line-height: 22px; border-radius: 6px; cursor: pointer; color: var(--muted); }
.toast.success { border-color: rgba(22,163,74,.25); }
.toast.success .t { color: #16a34a; }
.toast.info { border-color: rgba(37,99,235,.25); }
.toast.info .t { color: #2563eb; }
.toast.error { border-color: rgba(220,38,38,.25); }
.toast.error .t { color: #dc2626; }
@media (max-width: 980px) { .grid { grid-template-columns: 1fr; } }

.navbar .nav-link { border-radius: 10px; padding-left: 10px; padding-right: 10px; }
.navbar .nav-link:hover { background: #f3f4f6; }

.confirm-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: none; align-items: center; justify-content: center; z-index: 10000; padding: 16px; }
.confirm-backdrop.show { display: flex; }
.confirm-modal { width: 100%; max-width: 520px; background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 18px 60px rgba(0,0,0,.22); padding: 16px; }
.confirm-modal h3 { margin: 0 0 6px; font-size: 16px; }
.confirm-modal-actions { margin-top: 14px; display: flex; gap: 10px; justify-content: flex-end; }

pre { margin: 0; white-space: pre-wrap; word-wrap: break-word; background: #f3f4f6; padding: 10px; border-radius: 10px; border: 1px solid var(--border); font-size: 12px; }
details summary { cursor: pointer; color: var(--primary); font-weight: 700; }

.tool-doc-body { font-size: 14px; line-height: 1.55; color: var(--fg); }
.tool-doc-body > :first-child { margin-top: 0; }
.tool-doc-body > :last-child { margin-bottom: 0; }
.tool-doc-body h1, .tool-doc-body h2, .tool-doc-body h3, .tool-doc-body h4 { margin: 14px 0 8px; line-height: 1.25; }
.tool-doc-body h1 { font-size: 20px; }
.tool-doc-body h2 { font-size: 18px; }
.tool-doc-body h3 { font-size: 16px; }
.tool-doc-body p { margin: 8px 0; }
.tool-doc-body a { text-decoration: underline; text-underline-offset: 2px; }
.tool-doc-body code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 12px; background: rgba(243,244,246,.9); border: 1px solid var(--border); padding: 1px 6px; border-radius: 8px; }
.tool-doc-body pre { margin: 10px 0; padding: 12px; background: #0b1220; color: #e5e7eb; border: 1px solid rgba(229,231,235,.15); border-radius: 12px; overflow: auto; white-space: pre; }
.tool-doc-body pre code { background: transparent; border: 0; padding: 0; color: inherit; font-size: 12px; }
.tool-doc-body ul, .tool-doc-body ol { margin: 8px 0; padding-left: 20px; }
.tool-doc-body li { margin: 4px 0; }
.tool-doc-body hr { margin: 14px 0; border: 0; border-top: 1px solid var(--border); }
.tool-doc-body blockquote { margin: 10px 0; padding: 10px 12px; border-left: 4px solid rgba(37,99,235,.35); background: rgba(37,99,235,.06); border-radius: 10px; }
.tool-doc-body table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.tool-doc-body th, .tool-doc-body td { border: 1px solid var(--border); padding: 8px 10px; vertical-align: top; }
.tool-doc-body th { background: #f3f4f6; font-weight: 800; }

.memx .row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 0; }
.memx .tabs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.memx .tabpanel { display: none; }
.memx .tabpanel.active { display: block; }
.memx .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.memx .actions { display: flex; gap: 10px; margin-top: 12px; align-items: center; }
.memx .hr { height: 1px; background: var(--border); margin: 12px 0; }
.memx .results { margin-top: 12px; }
.memx pre { white-space: pre-wrap; word-break: break-word; background: #0b1020; color: #e5e7eb; padding: 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,.08); }
.memx table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.memx th, .memx td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.memx th { font-size: 12px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.memx td .mini { font-size: 12px; color: var(--muted); }
.memx .rowactions { display: inline-flex; gap: 8px; align-items: center; }
.memx .rowactions button:not(.btn) { padding: 6px 10px; font-weight: 800; }
.memx .rowactions .danger:not(.btn) { border-color: rgba(220,38,38,.35); background: #fff; color: #dc2626; }
.memx .rowactions .ghost:not(.btn) { border-color: var(--border); background: #fff; color: var(--fg); }
.memx button:not(.btn):not(.navbar-toggler) { padding: 10px 12px; cursor: pointer; border-radius: 10px; border: 1px solid var(--primary); background: var(--primary); color: #fff; font-weight: 700; }
@media (max-width: 980px) { .memx .row { grid-template-columns: 1fr; } .memx .grid2 { grid-template-columns: 1fr; } }
