:root {
  --bg: #f3f5f8; --card: #fff; --text: #1d2433; --muted: #6b7385; --line: #e1e5ec;
  --primary: #007bff; --primary-ink: #fff; --danger: #d93025; --ok: #1e8e3e; --warn: #b26a00;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--primary); }
code { background: #eef1f6; padding: .1em .35em; border-radius: 4px; font-size: .92em; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 20px; background: var(--primary); color: #fff; flex-wrap: wrap; }
.bar nav { display: flex; gap: 8px; }
.bar .btn.ghost { color: #fff; border-color: rgba(255,255,255,.6); background: transparent; }
.tabs { display: flex; gap: 4px; padding: 0 16px; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 12px 14px; font: inherit; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
main { padding: 16px; max-width: 1500px; margin: 0 auto; }
.tab { display: none; } .tab.on { display: block; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.card.narrow { max-width: 420px; }
h2 { margin: 0 0 10px; font-size: 1.15em; } h3 { font-size: 1em; margin: 16px 0 6px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.row.between { justify-content: space-between; margin-top: 0; }
.muted { color: var(--muted); } .small { font-size: .88em; }
.btn { display: inline-block; padding: 7px 14px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--text); font: inherit; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--primary); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn.danger { color: var(--danger); border-color: #f3c3bf; }
.btn.sm { padding: 3px 9px; font-size: .88em; }
.btn:disabled { opacity: .6; cursor: wait; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; }
.flash.ok { background: #e6f4ea; color: var(--ok); } .flash.error { background: #fce8e6; color: var(--danger); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .82em; font-weight: 600; margin: 1px 2px; }
.pill.ok { background: #e6f4ea; color: var(--ok); } .pill.warn { background: #fff3cd; color: var(--warn); }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 28px 16px; border: 2px dashed #b9c4d6; border-radius: 10px; text-align: center; cursor: pointer; color: var(--muted); }
.dropzone.over { border-color: var(--primary); background: #eef5ff; }
.dropzone .big { font-size: 1.2em; color: var(--text); font-weight: 600; }
.dropzone .fname { color: var(--primary); font-weight: 600; }
.chk { display: flex; gap: 8px; align-items: center; }
.tablewrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr.current td { background: #f0f7ff; }
table.list td.fn { max-width: 340px; overflow-wrap: anywhere; }
td.actions { white-space: nowrap; } td.actions form { display: inline; }
label { display: block; margin: 8px 0; }
label input:not([type=checkbox]):not([type=color]):not([type=range]), label select { display: block; width: 100%; margin-top: 3px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
label input[type=range] { display: block; width: 100%; }
label.chk { display: flex; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 14px; padding: 6px 14px 10px; }
legend { font-weight: 600; padding: 0 6px; }
.val { float: right; color: var(--primary); font-weight: 600; }
.cfg { display: grid; grid-template-columns: minmax(320px, 440px) 1fr; gap: 16px; align-items: start; }
.cfg-form { max-height: calc(100vh - 150px); overflow-y: auto; }
.preview { position: sticky; top: 12px; }
.pvbox { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: #ddd; }
.pvbox iframe { border: 0; transform-origin: 0 0; position: absolute; left: 0; top: 0; background: #fff; }
table.cols { width: 100%; border-collapse: collapse; }
table.cols td, table.cols th { padding: 3px 4px; text-align: left; font-size: .92em; }
table.cols input:not([type=checkbox]) { width: 100%; padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px; font: inherit; }
table.cols td:last-child { width: 80px; }
.colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px 10px; }
label.color { display: flex; gap: 8px; align-items: center; margin: 3px 0; }
label.color input { width: 36px; height: 28px; border: 1px solid var(--line); border-radius: 5px; padding: 0; background: none; }
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.card.login { width: 100%; max-width: 360px; display: grid; gap: 8px; }
@media (max-width: 960px) {
  .cfg { grid-template-columns: 1fr; }
  .cfg-form { max-height: none; }
  .preview { position: static; }
}
.bar nav { align-items: center; }
.bar .who { opacity: .85; font-size: .9em; }
form.inline { display: inline; margin: 0; }
