:root {
  --bg: #f3f4f7; --card: #fff; --line: #dfe3ea; --ink: #1b2130; --mute: #6b7487;
  --accent: #2f6fed; --accent-ink: #fff; --ok: #1f9d6b; --warn: #c97a06; --bad: #c0392b;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 15px; margin: 0 0 12px; }
button, input, select, textarea { font: inherit; color: inherit; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: #b9c1d0; background: #fafbfc; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #245fd6; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 8px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: default; }

input[type=text], input[type=password], input[type=number], input[type=url], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
textarea { resize: vertical; min-height: 80px; }
textarea.code { font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-all; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(47, 111, 237, .35); border-color: var(--accent); }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12px; color: var(--mute); margin-bottom: 4px; }
label.c { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; cursor: pointer; }
.hint { font-size: 12px; color: var(--mute); margin: -6px 0 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; min-width: 0; }
.row > .fix { flex: 0 0 130px; }

.top { display: flex; align-items: center; gap: 4px; padding: 0 16px; background: #1d2433; color: #fff; height: 48px; position: sticky; top: 0; z-index: 20; }
.top .brand { font-weight: 600; margin-right: 16px; }
.top .tab { padding: 14px 12px; color: #c4cbdb; cursor: pointer; border: 0; background: none; border-bottom: 2px solid transparent; }
.top .tab:hover { color: #fff; }
.top .tab.on { color: #fff; border-bottom-color: var(--accent); }
.top .grow { flex: 1; }
.top .site { color: #c4cbdb; text-decoration: none; margin-right: 8px; }
.top .site:hover { color: #fff; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; background: #e8ecf3; color: #3d465a; }
.badge.ok { background: #dff3ea; color: #14704b; }
.badge.warn { background: #fdefd6; color: #8a5200; }
.badge.bad { background: #fbe1dd; color: #96281b; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.head h1 { margin: 0; flex: 1; }

table.list { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.list th { text-align: left; font-size: 12px; font-weight: 500; color: var(--mute); padding: 9px 12px; border-bottom: 1px solid var(--line); background: #fafbfc; }
table.list td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list td.actions { white-space: nowrap; text-align: right; }
table.list td.actions .btn { margin-left: 4px; }
table.list .slug { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
table.list .title { color: var(--mute); max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.login { max-width: 340px; margin: 12vh auto; }
.error { color: var(--bad); margin: 8px 0; min-height: 20px; }
.note { padding: 10px 12px; border-radius: 6px; background: #fdefd6; color: #6f4300; margin-bottom: 16px; }

.overlay { position: fixed; inset: 0; background: rgba(20, 26, 40, .5); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 100; overflow: auto; }
.modal { background: #fff; border-radius: 10px; width: 100%; max-width: 560px; padding: 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal.wide { max-width: 900px; }
.modal h2 { font-size: 17px; margin-bottom: 16px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #1d2433; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 200; box-shadow: 0 6px 24px rgba(0, 0, 0, .3); max-width: 90vw; }
.toast.bad { background: var(--bad); }

.editor { position: fixed; inset: 0; display: flex; flex-direction: column; background: #8a93a6; z-index: 50; }
.editor .bar { display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 48px; background: #1d2433; color: #fff; flex: 0 0 auto; }
.editor .bar .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #c4cbdb; }
.editor .bar .btn { background: #2c3650; border-color: #2c3650; color: #fff; }
.editor .bar .btn:hover { background: #3a4662; }
.editor .bar .btn.primary { background: var(--accent); border-color: var(--accent); }
.editor .bar .btn.on { background: #fff; color: #1d2433; }
.editor .stage { flex: 1; display: flex; justify-content: center; min-height: 0; }
.editor iframe { border: 0; background: #fff; height: 100%; width: 100%; }

.lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; max-height: 62vh; overflow: auto; }
.lib .item { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; cursor: pointer; background: #fff; text-align: left; }
.lib .item:hover { border-color: var(--accent); background: #f5f8ff; }
.lib .item b { display: block; margin-bottom: 2px; }
.lib .item small { color: var(--mute); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.menu-item { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.menu-item input { flex: 1; }
.menu-item .btn { flex: 0 0 auto; }
.redirect-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.redirect-row input { flex: 1; }
.redirect-row select { flex: 0 0 90px; }
.count { float: right; color: var(--mute); }
.count.over { color: var(--warn); }
.wrap.wide { max-width: 1400px; }
.bulk-res { max-height: 55vh; overflow: auto; }
