:root { --ink: #1d2433; --muted: #5f6b7d; --line: #dfe4ec; --bg: #f5f7fa; --acc: #ffd23f; --blue: #1f6feb; --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
.loading { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); background: rgba(29,36,51,.85); color: #fff; padding: 7px 14px; border-radius: 99px; font-size: 13px; }
html, body { margin: 0; height: 100%; font: 15px/1.45 var(--font); color: var(--ink); background: var(--bg); }
button, input, select { font: inherit; color: inherit; }
a { color: var(--blue); }
.top { height: 54px; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 19px; color: var(--ink); text-decoration: none; }
.brand svg { width: 28px; height: 28px; }
.tag { color: var(--muted); font-size: 14px; }
.acts { margin-left: auto; display: flex; gap: 8px; }
.acts button, .btns button, .viewbtns button, .edtools button, .edtools .up { border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 7px 11px; cursor: pointer; font-weight: 600; font-size: 14px; }
button:hover { border-color: #b8c2d2; }
.primary { background: var(--ink) !important; color: #fff !important; border-color: var(--ink) !important; border-radius: 9px; padding: 8px 14px; font-weight: 700; cursor: pointer; }
.primary:disabled { opacity: .4; cursor: default; }
.app { display: grid; grid-template-columns: 380px 1fr; height: calc(100vh - 54px); height: calc(100dvh - 54px); }
.panel { overflow: auto; background: #fff; border-right: 1px solid var(--line); padding: 6px 16px 16px; }
.panel section { padding: 14px 0; border-bottom: 1px solid var(--line); }
.panel h2 { font-size: 16px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.panel h2 span { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--acc); font-size: 13px; }
.row { display: flex; gap: 8px; }
.row input, .row select { flex: 1; min-width: 0; }
input, select { border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; background: #fff; width: 100%; }
input:focus, select:focus { outline: 2px solid #9ec5ff; border-color: #6aa4f8; }
.grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 10px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid label, .slider { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.slider { margin: 10px 0 4px; } .slider b { color: var(--ink); }
.slider input { padding: 0; accent-color: var(--ink); }
.wide { width: 100%; margin-top: 10px; border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 9px; font-weight: 700; cursor: pointer; }
.btns { display: flex; flex-wrap: wrap; gap: 6px; }
.link { border: 0; background: none; color: var(--blue); padding: 6px 0; cursor: pointer; }
.small { font-size: 13px; } .muted { color: var(--muted); }
.err { color: #c0392b; font-size: 13px; margin: 6px 0 0; min-height: 0; }
.err:empty { display: none; }
.warn { margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.warn.ok { background: #e6f7ec; } .warn.mid { background: #fff3dc; } .warn.bad { background: #fde7e5; }
.foot { margin-top: 14px; }
.stage { position: relative; min-width: 0; }
#view { width: 100%; height: 100%; display: block; touch-action: none; }
.viewbtns { position: absolute; top: 12px; right: 12px; display: flex; gap: 6px; }
.compass { position: absolute; left: 14px; top: 12px; width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.9); display: grid; place-items: center; font-weight: 800; font-size: 13px; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; opacity: 0; transition: .25s; pointer-events: none; z-index: 50; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* dialogs */
.dlg { position: fixed; inset: 0; background: rgba(15,20,30,.55); display: flex; align-items: center; justify-content: center; z-index: 40; padding: 14px; }
.dlg[hidden] { display: none; }
.box { background: #fff; border-radius: 16px; width: min(1100px, 100%); height: min(820px, 100%); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.box header { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.box header h3 { margin: 0; font-size: 17px; }
.box header .row { flex: 1; min-width: 240px; }
.box footer { padding: 10px 14px; border-top: 1px solid var(--line); display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.box footer p { margin: 0; flex: 1; min-width: 200px; }
#map { flex: 1; }
.tabs { display: flex; gap: 6px; }
.tabs button { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 6px 12px; cursor: pointer; font-weight: 600; }
.tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.edtools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.edtools button.on { background: var(--acc); border-color: #e0b400; }
.edtools .h { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-left: auto; }
.edtools .h input { width: 70px; }
.edstage { position: relative; flex: 1; min-height: 0; }
#edCanvas { width: 100%; height: 100%; display: block; touch-action: none; }
.calib { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); background: #fff; border-radius: 12px; padding: 10px; display: flex; gap: 8px; align-items: end; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.calib label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.calib input { width: 110px; }

@media (max-width: 820px) {
  .tag { display: none; }
  .app { grid-template-columns: 1fr; grid-template-rows: 52vh auto; height: auto; }
  .stage { order: -1; height: 52vh; position: sticky; top: 0; z-index: 2; }
  .panel { border-right: 0; }
  .grid { grid-template-columns: 1fr 1fr; }
  .box { height: 100%; border-radius: 12px; }
}

.params { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.params summary { cursor: pointer; font-weight: 700; font-size: 14px; }
.params textarea { width: 100%; margin: 8px 0; font: 12px/1.4 ui-monospace, Menlo, monospace; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }

.box.acc { width: min(560px, 100%); height: auto; max-height: 100%; }
.accbody { padding: 14px; overflow: auto; }
.stack label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.icon-x { margin-left: auto; border: 0; background: none; font-size: 18px; cursor: pointer; }
.projlist { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.projlist li { display: flex; gap: 6px; }
.projlist .open { flex: 1; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.projlist .open:hover { border-color: #9aa7bb; }
.projlist .del { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 0 12px; cursor: pointer; color: #c0392b; }

.viewbtns .walkbtn { background: #1f6f43; color: #fff; border-color: #1f6f43; }
.viewbtns.walking #persp, .viewbtns.walking #top { display: none; }
.walkui { position: absolute; inset: 0; pointer-events: none; }
.walkui #walkExit { pointer-events: auto; position: absolute; top: 12px; left: 64px; border: 0; background: rgba(16,22,34,.82); color: #fff; border-radius: 10px; padding: 9px 14px; font-weight: 700; cursor: pointer; }
.walkui p { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); margin: 0; background: rgba(16,22,34,.7); color: #fff; font-size: 13px; padding: 6px 12px; border-radius: 999px; white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; }
.walkhint { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -150%); background: rgba(16,22,34,.82); color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 600; }
.walkui .cross { position: absolute; top: 50%; left: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: rgba(255,255,255,.85); box-shadow: 0 0 0 1px rgba(0,0,0,.35); }

.btns.tools { flex-wrap: wrap; margin: 10px 0 6px; }
.btns.tools button.on { background: #1f2937; color: #fff; border-color: #1f2937; }
button.wide { width: 100%; }
label.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; margin: 6px 0; }

/* Plan3D: header extras, orders, credits */
.acts { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.acts select { width: auto; padding: 6px 8px; font-weight: 600; font-size: 13px; }
.box.ord { width: min(640px, 96vw); }
.box.ord > .tabs { padding: 10px 14px 0; flex-wrap: wrap; }
.box.ord textarea, .fixform textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; font: inherit; resize: vertical; box-sizing: border-box; }
.box.ord label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); margin: 8px 0; }
.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 14px; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 8px 0; }
.drop.over { border-color: var(--blue); background: #eef4ff; }
.drop .up { display: inline-block; border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 7px 11px; cursor: pointer; font-weight: 700; color: var(--ink); margin: 0; }
.drop ul { flex-basis: 100%; margin: 0; padding-left: 18px; }
.ordlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ordlist > li { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.ordlist p { margin: 4px 0; overflow-wrap: anywhere; }
.ohead { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.st { font-size: 13px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--bg); }
.st.ready { background: #e6f7ec; } .st.awaiting_credit { background: #fff3dc; } .st.fix_requested, .st.in_progress { background: #eef4ff; }
.msg { font-size: 13px; padding: 6px 8px; border-radius: 8px; background: var(--bg); }
.msg.admin { background: #e6f7ec; }
.packs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.pack { border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; font: inherit; text-align: left; }
.pack b { font-size: 16px; } .pack span { font-size: 22px; font-weight: 800; }
.pack em { font-style: normal; font-size: 12px; font-weight: 700; background: var(--acc); border-radius: 99px; padding: 2px 8px; }
.pack:hover, .pack.best { border-color: var(--ink); }
.paylist { list-style: none; padding: 0; margin: 4px 0; }
@media (max-width: 760px) { .tag { display: none; } .acts { gap: 4px; } .acts button { padding: 6px 8px; font-size: 13px; } #share, #png { display: none; } .packs { grid-template-columns: 1fr; } }
