:root {
  --accent: #d4af72; --bg: #08090d; --bg-2: #0e1016; --bg-3: #141720; --line: rgba(255,255,255,.08); --line-2: rgba(255,255,255,.15);
  --text: #ecebe6; --muted: #9a9aa4; --faint: #61626d; --ok: #4ade80; --danger: #f87171; --r: 14px; --ease: cubic-bezier(.2,.7,.2,1);
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14.5px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); }
svg { flex: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border-radius: 11px; font-weight: 500; transition: all .25s var(--ease); white-space: nowrap; }
.btn--sm { padding: 8px 14px; font-size: 13.5px; }
.btn--block { width: 100%; }
.btn--gold { background: linear-gradient(135deg, #ecd3a4, var(--accent) 55%, #b48c4c); color: #111; box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }
.btn--gold:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 24px -8px rgba(212,175,114,.7), inset 0 1px 0 rgba(255,255,255,.35); }
.btn--ghost { border: 1px solid var(--line-2); background: rgba(255,255,255,.03); }
.btn--ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn--danger { background: rgba(248,113,113,.12); color: var(--danger); border: 1px solid rgba(248,113,113,.3); }
.btn--danger:hover { background: rgba(248,113,113,.2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.ibtn { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: var(--muted); border: 1px solid var(--line); background: rgba(255,255,255,.02); transition: all .2s; }
.ibtn:hover:not(:disabled) { color: var(--text); border-color: var(--line-2); }
.ibtn.del:hover { color: var(--danger); border-color: rgba(248,113,113,.4); }
.ibtn:disabled { opacity: .3; cursor: default; }

.logo { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-family: 'Playfair Display', serif; font-size: 22px; color: var(--accent); border: 1px solid rgba(212,175,114,.4); background: linear-gradient(145deg, rgba(212,175,114,.15), transparent); }
.logo--sm { width: 38px; height: 38px; border-radius: 11px; font-size: 15px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(ellipse at 70% 0%, rgba(212,175,114,.13), transparent 55%), radial-gradient(ellipse at 0% 100%, rgba(139,124,246,.12), transparent 55%), var(--bg); }
.login__card { width: min(400px, 100%); padding: 40px 34px; border-radius: 22px; background: rgba(255,255,255,.03); border: 1px solid var(--line); backdrop-filter: blur(20px); display: grid; gap: 16px; box-shadow: 0 40px 100px -40px #000; }
.login__card h1 { font-family: 'Playfair Display', serif; font-weight: 500; font-size: 30px; margin-top: 8px; }
.err { color: var(--danger); font-size: 13.5px; min-height: 20px; }
.back { text-align: center; color: var(--muted); font-size: 13.5px; }
.back:hover { color: var(--accent); }

/* form fields */
.fld { display: grid; gap: 6px; }
.fld > span { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.fld small { color: var(--faint); font-size: 12px; }
input, textarea, select { width: 100%; padding: 10px 13px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); color: var(--text); font: inherit; font-size: 14px; transition: border-color .2s, box-shadow .2s; }
textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(212,175,114,.15); }
input[type=color] { padding: 3px; height: 42px; cursor: pointer; }
input[type=range] { padding: 0; accent-color: var(--accent); border: 0; background: none; box-shadow: none; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 14px; }
.check input { display: none; }
.check .sw { width: 38px; height: 22px; border-radius: 22px; background: var(--bg-3); border: 1px solid var(--line-2); position: relative; transition: background .25s; flex: none; }
.check .sw::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .25s var(--ease), background .25s; }
.check input:checked + .sw { background: rgba(212,175,114,.25); border-color: var(--accent); }
.check input:checked + .sw::after { transform: translateX(16px); background: var(--accent); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.span2 { grid-column: 1 / -1; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row output { min-width: 42px; text-align: right; color: var(--accent); font-weight: 600; }

.img-field { display: flex; gap: 14px; align-items: center; }
.img-field .thumb { width: 84px; height: 64px; border-radius: 10px; border: 1px dashed var(--line-2); background: var(--bg-2) center/cover no-repeat; flex: none; display: grid; place-items: center; color: var(--faint); font-size: 11px; }
.img-field .thumb.round { width: 64px; border-radius: 50%; }
.img-field .ctrls { flex: 1; display: grid; gap: 8px; min-width: 0; }
.img-field .btns { display: flex; gap: 8px; flex-wrap: wrap; }
.upload { position: relative; overflow: hidden; }
.upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* app layout */
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--bg-2); padding: 18px 14px; }
.side__brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 20px; border-bottom: 1px solid var(--line); }
.side__brand small { display: block; color: var(--faint); font-size: 12px; }
.side__nav { display: grid; gap: 2px; padding: 14px 0; overflow-y: auto; flex: 1; align-content: start; }
.side__group { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); padding: 14px 12px 6px; }
.side__link { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 12px; border-radius: 10px; color: var(--muted); font-size: 14px; text-align: left; transition: all .2s; }
.side__link:hover { color: var(--text); background: rgba(255,255,255,.03); }
.side__link.on { color: var(--text); background: rgba(212,175,114,.1); box-shadow: inset 2px 0 0 var(--accent); }
.side__link.on svg { color: var(--accent); }
.side__link .badge { margin-left: auto; background: var(--accent); color: #111; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 10px; }
.side__foot { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 2px; }
.side-scrim { display: none; }

.main { min-width: 0; display: flex; flex-direction: column; height: 100vh; }
.top { display: flex; align-items: center; gap: 16px; padding: 14px 26px; border-bottom: 1px solid var(--line); background: rgba(8,9,13,.8); backdrop-filter: blur(14px); }
.top h2 { font-family: 'Playfair Display', serif; font-weight: 500; font-size: 22px; }
.dirty { color: var(--accent); font-size: 12.5px; }
.top__actions { margin-left: auto; display: flex; gap: 8px; }
.menu-btn { display: none; flex-direction: column; gap: 3px; }
.menu-btn span { width: 14px; height: 1.5px; background: currentColor; display: block; }

.workspace { flex: 1; display: flex; min-height: 0; }
.pane { flex: 1; overflow-y: auto; padding: 28px 26px 80px; min-width: 0; }
.pane > * { max-width: 920px; margin-inline: auto; }
.preview { width: 48%; min-width: 380px; border-left: 1px solid var(--line); display: flex; flex-direction: column; background: var(--bg-2); }
.preview__bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.preview__bar .seg { margin-right: auto; }
.preview__stage { flex: 1; display: grid; place-items: center; overflow: hidden; padding: 10px; }
.preview__stage iframe { width: 100%; height: 100%; border: 1px solid var(--line); border-radius: 10px; background: #07080c; transition: width .4s var(--ease); }
.preview[data-device=tablet] iframe { width: 768px; max-width: 100%; }
.preview[data-device=mobile] iframe { width: 390px; max-width: 100%; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); }
.seg button { padding: 5px 11px; border-radius: 7px; font-size: 12.5px; color: var(--muted); }
.seg button.on { background: var(--bg-3); color: var(--text); }

/* cards */
.box { background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px; padding: 24px; margin-bottom: 20px; }
.box__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.box__head h3 { font-size: 16px; font-weight: 600; }
.box__head p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.intro { color: var(--muted); margin-bottom: 22px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { padding: 20px; border-radius: 16px; border: 1px solid var(--line); background: linear-gradient(160deg, rgba(212,175,114,.06), transparent 60%), var(--bg-2); cursor: pointer; transition: border-color .2s, transform .2s; text-align: left; }
.kpi:hover { border-color: rgba(212,175,114,.4); transform: translateY(-2px); }
.kpi b { display: block; font-family: 'Playfair Display', serif; font-size: 38px; font-weight: 500; color: var(--accent); line-height: 1.1; }
.kpi span { color: var(--muted); font-size: 13px; }
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.quick button, .quick a { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); text-align: left; transition: all .2s; }
.quick button:hover, .quick a:hover { border-color: var(--accent); }
.quick button svg, .quick a svg { color: var(--accent); }

/* list editor */
.items { display: grid; gap: 10px; }
.item { border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); transition: border-color .2s, opacity .2s; }
.item.drag { opacity: .4; }
.item.over { border-color: var(--accent); }
.item__head { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 14px; cursor: pointer; user-select: none; }
.item__head .grip { color: var(--faint); cursor: grab; display: grid; place-items: center; }
.item__title { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item__title small { color: var(--faint); font-weight: 400; margin-left: 8px; }
.item__tools { display: flex; gap: 6px; }
.item__tools .ibtn { width: 30px; height: 30px; }
.item__body { padding: 4px 16px 18px; border-top: 1px solid var(--line); display: none; }
.item.open .item__body { display: block; padding-top: 16px; }
.item .chev { transition: transform .25s; color: var(--faint); }
.item.open .chev { transform: rotate(90deg); }
.item.hidden-sec .item__title { opacity: .45; text-decoration: line-through; }
.add-btn { width: 100%; margin-top: 12px; padding: 13px; border-radius: var(--r); border: 1px dashed var(--line-2); color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 8px; transition: all .2s; }
.add-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(212,175,114,.04); }
.pthumb { width: 46px; height: 34px; border-radius: 7px; background: var(--bg-3) center/cover; flex: none; border: 1px solid var(--line); }
.star-on { color: var(--accent) !important; border-color: rgba(212,175,114,.45) !important; }

.presets { display: flex; flex-wrap: wrap; gap: 10px; }
.preset { display: flex; align-items: center; gap: 8px; padding: 7px 12px 7px 7px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; transition: border-color .2s; }
.preset:hover, .preset.on { border-color: var(--accent); }
.preset i { width: 22px; height: 22px; border-radius: 50%; display: block; }
.icon-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-pick button { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); }
.icon-pick button.on { border-color: var(--accent); color: var(--accent); background: rgba(212,175,114,.08); }

/* messages */
.msg { border: 1px solid var(--line); border-radius: var(--r); padding: 18px; background: var(--bg); }
.msg.unread { border-color: rgba(212,175,114,.4); background: linear-gradient(160deg, rgba(212,175,114,.05), transparent 50%), var(--bg); }
.msg__head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.msg__head b { font-size: 15px; }
.msg__head a { color: var(--accent); font-size: 13px; }
.msg__head time { margin-left: auto; color: var(--faint); font-size: 12px; }
.msg__subj { margin-top: 6px; font-weight: 500; }
.msg__text { margin-top: 8px; color: var(--muted); white-space: pre-wrap; word-break: break-word; }
.msg__actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.notice { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 12px; border: 1px solid rgba(212,175,114,.4); background: rgba(212,175,114,.07); margin-bottom: 20px; font-size: 14px; }
.notice svg { color: var(--accent); }
.notice button { margin-left: auto; }

.dialog { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(0,0,0,.6); backdrop-filter: blur(6px); padding: 20px; }
.dialog__card { width: min(420px, 100%); padding: 26px; border-radius: 18px; background: var(--bg-2); border: 1px solid var(--line-2); display: grid; gap: 10px; }
.dialog__card h3 { font-size: 18px; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 20px); z-index: 110; background: var(--text); color: var(--bg); padding: 11px 20px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .35s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); color: #fff; }

@media (max-width: 1100px) {
  .preview { position: fixed; inset: 0; z-index: 60; width: auto; min-width: 0; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 70; transform: translateX(-100%); transition: transform .3s var(--ease); }
  .side.open { transform: none; }
  .side-scrim.open { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(0,0,0,.5); }
  .menu-btn { display: flex; }
  .top { padding: 12px 16px; flex-wrap: wrap; }
  .top h2 { font-size: 19px; }
  .top__actions .btn span { display: none; }
  .dirty { order: 5; width: 100%; }
  .pane { padding: 20px 16px 80px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .box { padding: 18px; }
  .item__tools .ibtn.mv { display: none; }
}
