:root {
  --orange: #EF7201; --orange-dk: #C95F00; --orange-lt: #FDEBDC;
  --ink: #1F1F1F; --muted: #666; --line: #E2E2E2; --bg: #F6F6F4; --card: #fff;
  --red: #B42318; --green: #1E7B3A; --amber: #9A6700;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 Arial, Helvetica, sans-serif; color: var(--ink); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--orange-dk); }
h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 17px; margin: 0 0 12px; color: var(--orange-dk); }
h3 { font-size: 14px; margin: 18px 0 6px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: 13px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 24px;
  background: #fff; border-bottom: 3px solid var(--orange); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: bold; font-size: 16px; }
.brand img { height: 40px; }
nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
nav a { text-decoration: none; color: var(--ink); font-size: 14px; } nav a:hover { color: var(--orange-dk); }
.who { color: var(--muted); font-size: 13px; }
.inline { display: inline; margin: 0; }

main.container { max-width: 1150px; width: 100%; margin: 24px auto; padding: 0 20px; flex: 1; }
main.wide { width: 100%; padding: 20px; flex: 1; }
main.auth { flex: 1; display: flex; align-items: center; justify-content: center; padding: 30px 16px; }
.foot { text-align: center; font-size: 12px; color: var(--muted); padding: 14px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 18px 20px; margin-bottom: 18px; }
.card.narrow { max-width: 430px; width: 100%; }
.authlogo { height: 72px; display: block; margin: 0 auto 10px; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 16px; }

label { display: block; font-size: 13px; font-weight: bold; color: #333; margin-bottom: 10px; }
input, textarea, select { display: block; width: 100%; font: inherit; font-weight: normal; color: var(--ink); padding: 7px 9px;
  border: 1px solid #CFCFCF; border-radius: 5px; background: #fff; margin-top: 4px; }
textarea { resize: vertical; overflow: hidden; min-height: 36px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--orange); outline-offset: -1px; border-color: var(--orange); }
input[type=checkbox] { display: inline; width: auto; margin: 0 6px 0 0; }
.check { font-weight: normal; display: flex; align-items: flex-start; gap: 4px; margin: 14px 0; }
.check input { margin-top: 4px; }

.btn { white-space: nowrap; display: inline-block; font: inherit; font-size: 14px; padding: 7px 14px; border-radius: 5px; border: 1px solid #CFCFCF;
  background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; text-align: center; }
.btn:hover { border-color: var(--orange); }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: bold; }
.btn.primary:hover { background: var(--orange-dk); }
.btn.danger { color: var(--red); border-color: #E7B4AE; }
.btn.danger:hover { background: #FDECEA; }
.btn.ghost { border-color: transparent; background: transparent; padding: 4px 7px; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: #F1F1F1; }
.btn.small { font-size: 12px; padding: 4px 9px; }
.btn.wide { display: block; width: 100%; margin-top: 8px; }
.btn:disabled { opacity: .5; cursor: wait; }

.alert { background: #FDECEA; color: var(--red); border-radius: 5px; padding: 8px 12px; margin: 0 0 12px; list-style-position: inside; }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 10px; background: #EEE; color: #444; }
.tag.green { background: #E3F3E7; color: var(--green); } .tag.red { background: #FDECEA; color: var(--red); }
.tag.amber { background: #FFF4D6; color: var(--amber); }
p.tag { border-radius: 5px; padding: 6px 10px; }

table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; background: var(--orange); color: #fff; padding: 7px 9px; font-weight: bold; }
table.list td { padding: 7px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list.small td { font-size: 12.5px; }
td.actions form, td.actions a { margin: 2px 2px; }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row label { flex: 1; min-width: 160px; margin: 0; }

.qr { display: flex; justify-content: center; margin: 12px 0; }
.qr svg { width: 210px; height: 210px; }
code.secret { display: block; word-break: break-all; background: #F4F4F4; padding: 8px; border-radius: 5px; margin: 8px 0; font-size: 14px; }
code.secret.big { font-size: 20px; text-align: center; letter-spacing: .05em; }

/* editor */
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; max-width: 1500px; margin: 0 auto; }
.side .sticky { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; }
.savebar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.section { border-top: 4px solid var(--orange); }
.sechead { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.secnum { font-weight: bold; color: var(--orange-dk); font-size: 17px; }
.sechead input.heading { font-weight: bold; font-size: 16px; color: var(--orange-dk); margin: 0; }
.block { border: 1px dashed #DADADA; border-radius: 6px; padding: 8px 10px 10px; margin: 8px 0; }
.blockhead { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.blockhead .tag { margin-right: auto; }
.rowline { display: flex; align-items: flex-start; gap: 6px; margin: 4px 0; }
.rowline textarea, .rowline input { margin: 0; }
.rowline input.lbl { max-width: 190px; font-weight: bold; }
.dot { padding-top: 7px; color: var(--orange); }
.inline-label { display: inline-flex; align-items: center; gap: 6px; font-weight: normal; margin: 6px 12px 0 0; }
.inline-label select { width: auto; margin: 0; }
.tablewrap { overflow-x: auto; }
table.grid { border-collapse: collapse; width: 100%; margin: 4px 0 8px; }
table.grid th { background: var(--orange-lt); padding: 4px; }
table.grid th input { font-weight: bold; margin: 0; }
table.grid td { padding: 2px; border-bottom: 1px solid #F0F0F0; vertical-align: top; }
table.grid td textarea, table.grid td input { margin: 0; min-width: 90px; }
td.rowact { white-space: nowrap; width: 1%; }
.addblock { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.addblock select { width: auto; margin: 0; }
.insert { text-align: center; margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.hints { list-style: none; padding: 0; margin: 0; max-height: 220px; overflow: auto; font-size: 12px; }
.hints li { padding: 3px 0; border-bottom: 1px solid #F2F2F2; }
.hints code { background: var(--orange-lt); padding: 1px 4px; border-radius: 3px; }
#status.ok { color: var(--green); } #status.err { color: var(--red); } #status.warn { color: var(--amber); }
@media (max-width: 1000px) { .editor-layout { grid-template-columns: 1fr; } .side .sticky { position: static; max-height: none; } .grid2 { grid-template-columns: 1fr; } }
