/* =========================================================================
   vigilante-editor.css — the editor's own chrome: a top bar, the framed page,
   and the side panel. Deliberately plain, so the page is the loud thing.
   ========================================================================= */
:root {
    --bg: #ecebe8; --card: #ffffff; --ink: #16181d; --mute: #646a75; --line: #dcdad5;
    --blue: #2f6fed; --blue-soft: #e8f0fe; --red: #c8281c;
    --bar-h: 54px; --panel-w: 380px;
    --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); overflow: hidden; }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ── top bar ────────────────────────────────────────────────────────────── */
.bar {
    height: var(--bar-h); display: flex; align-items: center; gap: 12px; padding: 0 14px;
    background: var(--card); border-bottom: 1px solid var(--line);
}
.bar-id { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; margin-right: auto; }
.bar-id span { color: var(--mute); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-mid, .bar-end { display: flex; align-items: center; gap: 6px; }
.bar-end { margin-left: auto; }
.bar-sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
.bar button {
    height: 36px; padding: 0 13px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); font-weight: 600;
}
.bar button:hover:not(:disabled) { background: #f4f3f0; }
.bar button:disabled { opacity: .4; cursor: default; }
.bar button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.bar button.is-main { background: var(--blue); border-color: var(--blue); color: #fff; }
.bar button.is-main:hover { background: #1f57c8; }
.seg { display: flex; }
.seg button { border-radius: 0; margin-left: -1px; }
.seg button:first-child { border-radius: 9px 0 0 9px; margin-left: 0; }
.seg button:last-child { border-radius: 0 9px 9px 0; }
.bar-save { color: var(--mute); font-size: 12px; margin-right: 6px; white-space: nowrap; }
.bar-save.is-bad { color: var(--red); font-weight: 600; }

/* ── page + panel ───────────────────────────────────────────────────────── */
.work { height: calc(100% - var(--bar-h)); display: flex; }
.stage { position: relative; flex: 1 1 auto; min-width: 0; display: flex; justify-content: center; background: #cfcdc8; }
#ed-frame { display: block; width: 100%; height: 100%; border: 0; background: #000; }
.stage.is-phone { padding: 18px 0; }
.stage.is-phone #ed-frame { width: 390px; max-width: 100%; height: 100%; max-height: 844px; border-radius: 26px; box-shadow: 0 0 0 8px #16181d, 0 18px 50px rgba(0, 0, 0, .35); }
.hint {
    position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); margin: 0; padding: 9px 16px;
    background: #14161a; color: #fff; border-radius: 999px; font-size: 13px; font-weight: 500; white-space: nowrap;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .3); pointer-events: none; transition: opacity .3s;
}
.hint.is-off { opacity: 0; }

.panel {
    flex: none; width: var(--panel-w); background: var(--card); border-left: 1px solid var(--line);
    display: flex; flex-direction: column; min-height: 0;
}
.work.is-closed .panel { display: none; }
.pn-top { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.pn-top h2 { margin: 0; font-size: 17px; line-height: 1.25; }
.pn-top p { margin: 5px 0 0; color: var(--mute); font-size: 13px; }
.pn-back { border: 0; background: none; padding: 0; margin: 0 0 8px; color: var(--blue); font-weight: 600; }
.pn-body { flex: 1 1 auto; overflow-y: auto; padding: 12px 14px 28px; }
.pn-foot { padding: 12px 18px; border-top: 1px solid var(--line); color: var(--mute); font-size: 12px; display: flex; flex-direction: column; gap: 8px; }
.pn-foot div { display: flex; gap: 8px; align-items: center; }
.link { border: 0; background: none; padding: 0; color: var(--blue); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.link.is-danger { color: var(--red); }

/* the list of sections */
.secs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sec {
    display: flex; align-items: center; gap: 2px; min-height: 48px; padding: 0 6px 0 2px;
    background: var(--card); border: 1px solid var(--line); border-radius: 11px;
}
.sec.is-fixed { background: #f6f5f2; }
.sec.is-hidden .sec-name b { color: var(--mute); text-decoration: line-through; }
.sec.is-drag { opacity: .4; }
.sec.is-over-top { box-shadow: 0 -3px 0 var(--blue); }
.sec.is-over-bottom { box-shadow: 0 3px 0 var(--blue); }
.sec-grip { flex: none; width: 26px; height: 44px; display: grid; place-items: center; color: #a4a8b0; cursor: grab; font-size: 16px; letter-spacing: -2px; user-select: none; }
.sec.is-fixed .sec-grip { visibility: hidden; }
.sec-name { flex: 1 1 auto; min-width: 0; text-align: left; border: 0; background: none; height: 46px; padding: 0 4px; display: flex; flex-direction: column; justify-content: center; line-height: 1.2; }
.sec-name b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec-name small { color: var(--mute); font-size: 12px; }
.sec-name:hover b { color: var(--blue); }
.ib {
    flex: none; width: 32px; height: 32px; border-radius: 8px; border: 0; background: none; display: grid; place-items: center;
    color: #4a4f59; font-size: 15px; line-height: 1;
}
.ib:hover:not(:disabled) { background: #eeede9; color: var(--ink); }
.ib:disabled { opacity: .25; cursor: default; }
.ib.is-del:hover:not(:disabled) { background: #fde8e6; color: var(--red); }
.ib svg { width: 18px; height: 18px; }
.secs-note { margin: 14px 4px 0; color: var(--mute); font-size: 12.5px; }

/* fields */
.f { display: block; margin: 0 0 12px; }
.f > span, .f-label { display: block; margin-bottom: 5px; font-size: 12.5px; font-weight: 600; color: #3b4049; }
.f input[type="text"], .f input[type="time"], .f textarea, .f select, .f .rich {
    display: block; width: 100%; padding: 9px 11px; background: #fff; border: 1px solid #c9c7c1; border-radius: 9px; font-size: 14px; line-height: 1.4;
}
.f textarea { resize: vertical; min-height: 76px; }
.f .rich { min-height: 90px; max-height: 260px; overflow-y: auto; }
.f .rich p { margin: 0 0 .6em; }
.f .rich p:last-child { margin-bottom: 0; }
.f input:focus, .f textarea:focus, .f select:focus, .f .rich:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
.f small { display: block; margin-top: 4px; color: var(--mute); font-size: 12px; }
.f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.photo { display: flex; align-items: center; gap: 12px; }
.photo-thumb { flex: none; width: 76px; height: 76px; border-radius: 10px; background: #e6e4df center / cover no-repeat; border: 1px solid var(--line); display: grid; place-items: center; color: var(--mute); font-size: 11px; text-align: center; }
.photo-act { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.btn2 { height: 34px; padding: 0 12px; border-radius: 9px; border: 1px solid #c9c7c1; background: #fff; font-weight: 600; font-size: 13px; }
.btn2:hover { background: #f4f3f0; }
.btn2.is-add { width: 100%; height: 40px; border-style: dashed; color: var(--blue); border-color: #9db9f5; background: var(--blue-soft); }
.btn2.is-add:hover { background: #dbe7fd; }
.days { display: flex; gap: 4px; }
.days button { flex: 1 1 0; height: 34px; padding: 0; border-radius: 8px; border: 1px solid #c9c7c1; background: #fff; font-size: 12px; font-weight: 600; }
.days button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.color { display: flex; align-items: center; gap: 10px; }
.color input[type="color"] { width: 44px; height: 34px; padding: 2px; border: 1px solid #c9c7c1; border-radius: 9px; background: #fff; }

/* a list inside a section: its items as cards */
.grp { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
.grp:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.grp > h3 { margin: 0 0 10px; font-size: 14px; }
.grp > h3 small { font-weight: 400; color: var(--mute); margin-left: 6px; }
.items { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.item { border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.item.is-open { border-color: #9db9f5; box-shadow: 0 0 0 3px var(--blue-soft); }
.item-head { display: flex; align-items: center; gap: 2px; min-height: 46px; padding: 0 6px 0 4px; }
.item-name { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 6px; border: 0; background: none; text-align: left; font-weight: 600; }
.item-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-name i { flex: none; width: 32px; height: 32px; border-radius: 7px; background: #e6e4df center / cover no-repeat; }
.item-body { padding: 6px 12px 2px; border-top: 1px solid var(--line); }
.empty { margin: 0 0 10px; color: var(--mute); font-size: 13px; }

@media (max-width: 900px) {
    .bar-id span, .bar-save { display: none; }
    .panel { position: fixed; top: var(--bar-h); right: 0; bottom: 0; width: min(var(--panel-w), 100%); z-index: 5; box-shadow: -10px 0 40px rgba(0, 0, 0, .25); }
}
@media (max-width: 620px) {
    .bar-mid .seg, .bar-sep { display: none; }
    .bar { gap: 6px; padding: 0 8px; }
    .bar button { padding: 0 10px; }
}
