/* Editor UI. Same tokens as the published themes, quieter layout. */
:root {
  --ink: #0b1324; --body: #334155; --muted: #64748b; --line: #e2e8f0; --line-2: #cbd5e1;
  --bg: #f6f8fb; --card: #fff; --brand: #1d5bd8; --brand-ink: #1748ad; --brand-soft: #e8f0fe;
  --navy: #0a1931; --danger: #b42318; --danger-soft: #fdecec; --ok: #0b6b49; --ok-soft: #e7f8f0; --warn: #92400e; --warn-soft: #fef3c7;
  --radius: 12px; --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font: 15px/1.55 var(--font); color: var(--body); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-ink); text-decoration: underline; }
h1, h2 { color: var(--ink); line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.7rem; letter-spacing: -0.015em; }
h2 { font-size: 1.12rem; }
p { margin: 0 0 1em; }
code, .mono { font-family: var(--mono); font-size: .9em; }
:focus-visible { outline: 3px solid #10b4c8; outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.topbar { background: var(--navy); color: #cbd5e1; }
.topbar-in { max-width: 1080px; margin: 0 auto; padding: 0 20px; height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; letter-spacing: -0.01em; }
.logo:hover { color: #fff; text-decoration: none; }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(135deg, #1d5bd8, #10b4c8); font-size: .85rem; }
.topnav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.topnav a, .link-btn { color: #cbd5e1; padding: 7px 10px; border-radius: 7px; font: inherit; font-size: .92rem; }
.topnav a:hover, .link-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }
.topnav form { margin: 0; }
.link-btn { background: none; border: 0; cursor: pointer; }
.acting { background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid #fcd34d; display: flex; justify-content: center; align-items: center; gap: 14px; padding: 8px 16px; font-size: .92rem; flex-wrap: wrap; }
.acting form { margin: 0; }

.container { max-width: 1080px; margin: 0 auto; padding: 28px 20px 64px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.panel.flush { padding: 0; overflow-x: auto; }
.panel.narrow { max-width: 460px; margin: 32px auto; }
.panel.danger { border-color: #f5c2c0; }
.panel-head { margin-bottom: 14px; }
.panel-head.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head h2 { margin-bottom: .2em; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: .15em; }
.kicker { font-size: .76rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); margin: 0 0 4px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.crumbs { font-size: .88rem; color: var(--muted); margin-bottom: 8px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.center { text-align: center; }
.right { text-align: right; }
.empty { color: var(--muted); padding: 8px 0; margin: 0; }
.flash { background: var(--ok-soft); color: var(--ok); border-radius: 10px; padding: 10px 14px; font-weight: 600; }
.alert { background: var(--danger-soft); color: var(--danger); border-radius: 10px; padding: 10px 14px; }
.alert.info { background: var(--brand-soft); color: var(--brand-ink); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 .92rem/1 var(--font); padding: 10px 15px; border-radius: 9px; border: 1px solid var(--line-2); background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink); color: var(--ink); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
.btn-danger { color: var(--danger); border-color: #f5c2c0; }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { padding: 7px 11px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line-2); background: #fff; cursor: pointer; font-size: 1rem; color: var(--ink); }
.icon-btn:hover:not([disabled]) { border-color: var(--ink); }
.icon-btn[disabled] { opacity: .35; cursor: default; }
.toggle { min-width: 76px; padding: 7px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: #f1f5f9; color: var(--muted); font: 600 .82rem/1 var(--font); cursor: pointer; }
.toggle.on { background: var(--ok-soft); border-color: #9ee2c4; color: var(--ok); }
.badge { display: inline-block; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 4px 9px; border-radius: 999px; background: #f1f5f9; color: var(--muted); vertical-align: middle; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }

.section-list, .item-list { list-style: none; margin: 0; padding: 0; }
.section-row, .item-list li { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.section-row:first-child, .item-list li:first-child { border-top: 0; }
.section-row.off .sr-title { color: var(--muted); }
.sr-main { display: flex; flex-direction: column; min-width: 0; flex: 1 1 240px; }
.sr-title { font-weight: 650; color: var(--ink); }
.sr-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sr-actions form { margin: 0; }

.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.grid-form .wide { grid-column: 1 / -1; }
.field { margin-bottom: 16px; }
.field label, fieldset legend { display: block; font-weight: 600; font-size: .9rem; color: var(--ink); margin-bottom: 6px; }
.req { color: var(--danger); }
input[type=text], input[type=email], input[type=url], input[type=password], input[type=date], input:not([type]), select, textarea {
  width: 100%; font: inherit; font-size: .96rem; color: var(--ink); padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 9px; background: #fff;
}
textarea { resize: vertical; }
textarea.mono { font-family: var(--mono); font-size: .88rem; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.has-error input, .has-error textarea, .has-error select { border-color: var(--danger); }
.help { font-size: .82rem; color: var(--muted); margin: 5px 0 0; }
.error { font-size: .85rem; color: var(--danger); margin: 5px 0 0; font-weight: 600; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 8px 0; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }
.inline-form { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.inline-form input { flex: 1 1 260px; width: auto; }
.image-field { display: flex; gap: 14px; align-items: flex-start; }
.thumb { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); flex: none; }
.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input[type=color] { width: 48px; height: 40px; padding: 2px; border: 1px solid var(--line-2); border-radius: 9px; background: #fff; flex: none; }
.themes { border: 0; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.theme-card { position: relative; display: flex; flex-direction: column; gap: 4px; border: 1.5px solid var(--line-2); border-radius: 12px; padding: 12px; cursor: pointer; }
.theme-card:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.theme-card input { position: absolute; top: 14px; right: 14px; }
.theme-swatch { height: 64px; border-radius: 8px; margin-bottom: 6px; }
.theme-horizon { background: linear-gradient(135deg, #0a1931 55%, #1d5bd8); }
.theme-paper { background: linear-gradient(#fff, #fff) padding-box, #faf9f6; border: 1px solid var(--line-2); box-shadow: inset 0 18px 0 #faf9f6, inset 0 20px 0 #cbd5e1; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #fbfcfe; }
.table tr:last-child td { border-bottom: 0; }
.creds { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 16px 0 20px; }
.creds dt { font-weight: 600; color: var(--ink); }
.creds dd { margin: 0; word-break: break-all; }
.secret { background: var(--warn-soft); color: var(--warn); padding: 3px 8px; border-radius: 6px; font-size: 1rem; }

@media (max-width: 700px) {
  .grid-form { grid-template-columns: 1fr; }
  .topbar-in { height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
}
