/* Layout Maker — same visual language as measure.del-duca.com (quiet, light, thin borders). */
:root {
  --bg: #f4f5f9; --panel: #ffffff; --border: #dfe1ea; --text: #1f2233; --muted: #6b6f86;
  --accent: #5b5bd6; --accent-text: #ffffff; --input: #ffffff; --hover: #eceefc; --selected: #e3e4fb;
  --canvas: #e9eaf0; --danger: #e53935; --ok: #2e7d32; --warn: #b26a00; --warn-bg: #fff3cd; --shadow: 0 10px 30px rgba(20,20,40,.18);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--accent); }
h1 { font-size: 22px; margin: 0 0 8px; }
h2 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .pad { padding: 8px 6px; }
.error { color: var(--danger); font-weight: 600; margin: 6px 0; } .ok { color: var(--ok); font-weight: 600; margin: 6px 0; }
button, .button, input, select, textarea { font: inherit; color: inherit; }
button, .button { background: var(--input); border: 1px solid var(--border); border-radius: 6px; padding: 6px 12px; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .button:hover { background: var(--hover); }
button:disabled { opacity: .45; cursor: default; }
button.primary, .button.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; font-weight: 600; }
button.danger { color: var(--danger); }
button.link { background: none; border: none; color: var(--accent); padding: 0; }
button.active, button.checked { background: var(--selected); border-color: var(--accent); color: var(--accent); font-weight: 600; }
button.small { padding: 2px 8px; font-size: 12px; }
input[type=text], input[type=password], input[type=number], input:not([type]), select, textarea {
  background: var(--input); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input[type=color] { width: 40px; height: 26px; padding: 1px 2px; border: 1px solid var(--border); border-radius: 6px; background: var(--input); }
label { display: block; margin: 8px 0 4px; } label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
label.inline select, label.inline input { width: auto; }
.row { display: flex; align-items: center; } .row.gap { gap: 8px; } .row.between { justify-content: space-between; } .row.wrap { flex-wrap: wrap; } .row.top { align-items: flex-start; } .row.top .table { flex: 1 1 320px; width: auto; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; margin-bottom: 16px; }
.card-page { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.card-page .card { width: 100%; max-width: 380px; box-shadow: var(--shadow); }
.card-page button.primary { width: 100%; margin-top: 12px; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--border); }
.topbar .brand { font-weight: 700; text-decoration: none; color: var(--text); font-size: 16px; }
.topbar nav { display: flex; gap: 16px; align-items: center; } .topbar nav a { text-decoration: none; }
.content { max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; } .content.narrow { max-width: 620px; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 14px; }
.project-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.project-card .thumb { display: block; width: 100%; height: 140px; object-fit: contain; border-radius: 8px; background: #fff; border: 1px solid var(--border); }
.project-card .thumb.empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
.project-card .name { font-weight: 700; font-size: 15px; text-decoration: none; color: var(--text); }
.project-card .name:hover { color: var(--accent); }
.project-card .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.project-card .actions button { padding: 4px 8px; font-size: 12px; }
.project-card.deleted { border-style: dashed; }
.badge { display: inline-block; background: var(--selected); color: var(--accent); border-radius: 6px; padding: 1px 7px; font-size: 11px; font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 40px; }
.table { width: 100%; border-collapse: collapse; margin: 10px 0; } .table th, .table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; } .table td.actions { white-space: nowrap; } .table td.actions button { padding: 3px 8px; font-size: 12px; margin-right: 4px; }
.invite-result { display: flex; gap: 8px; margin: 10px 0; } .invite-result input { flex: 1; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.drop-overlay { position: fixed; inset: 0; background: rgba(91,91,214,.18); border: 4px dashed var(--accent); display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; color: var(--accent); z-index: 50; pointer-events: none; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1f2233; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); z-index: 200; font-weight: 600; opacity: 0; transition: opacity .2s; }
.toast.show { opacity: 1; }
.usage-totals { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 4px 0 8px; }
.usage-totals .stat .value { font-size: 22px; font-weight: 700; }
.logo { display: block; width: 260px; max-width: 100%; margin: 0 auto 14px; }
.logo-small { height: 26px; display: block; } .logo-tb { height: 22px; display: block; }
.brand-btn { padding: 3px 6px; }

/* ---------------------------------------------------------------- editor frame */
body.editor { overflow: hidden; }
#app { display: flex; flex-direction: column; height: calc(100vh - var(--ss-h, 0px)); }
.small-screen { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: #b42318; color: #fff; font-size: 14px; line-height: 1.35; }
.small-screen span { flex: 1; } .small-screen b { font-weight: 700; }
.small-screen button { flex: none; background: #fff; color: #b42318; border: none; border-radius: 6px; padding: 6px 10px; font-weight: 600; }
.toolbar { display: flex; align-items: center; gap: 4px; padding: 5px 8px; background: var(--panel); border-bottom: 1px solid var(--border); flex-wrap: nowrap; overflow-x: auto; }
.tb-btn { border: 1px solid transparent; background: transparent; padding: 5px 9px; border-radius: 6px; white-space: nowrap; text-decoration: none; color: var(--text); }
.tb-btn:hover { background: var(--hover); } .tb-btn.active { background: var(--selected); color: var(--accent); font-weight: 600; }
.tb-btn.toggle.active { border-color: var(--accent); }
.tb-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; } .tb-spacer { flex: 1; }
.tb-title { font-weight: 700; padding: 4px 8px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: text; }
.tb-title.dirty::before { content: "• "; color: var(--accent); }
.tb-nav { display: flex; align-items: center; gap: 2px; } .tb-nav .tb-btn { color: var(--muted); padding: 5px 7px; } .tb-nav .tb-btn:hover { color: var(--text); }
.workspace { flex: 1; display: flex; min-height: 0; }
.side { width: 270px; flex: none; display: flex; flex-direction: column; background: var(--bg); border-right: 1px solid var(--border); min-height: 0; }
.side.right { width: 320px; border-right: none; border-left: 1px solid var(--border); }
.panel { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.panel > header { padding: 7px 12px; font-weight: 600; border-bottom: 1px solid var(--border); background: var(--bg); }
.panel-body { flex: 1; overflow: auto; padding: 8px; }
.panel > footer { padding: 6px 8px; border-top: 1px solid var(--border); } .panel > footer button { padding: 4px 8px; font-size: 12px; }
.tabs { display: flex; border-bottom: 1px solid var(--border); background: var(--bg); }
.tab { flex: 1; border: none; border-radius: 0; background: transparent; padding: 8px; } .tab.active { color: var(--accent); font-weight: 600; box-shadow: inset 0 -2px var(--accent); }
.canvas-wrap { flex: 1; position: relative; min-width: 0; background: var(--canvas); overflow: hidden; }
#stage { position: absolute; inset: 0; outline: none; }
.canvas-empty { position: absolute; inset: 40px; border: 2px dashed #b9bcd0; border-radius: 14px; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--muted); font-size: 18px; pointer-events: none; }
.canvas-empty .small { font-size: 13px; }
.statusbar { display: flex; justify-content: space-between; padding: 4px 12px; background: var(--panel); border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }
.statusbar .right { display: flex; gap: 18px; }
.text-editor { position: absolute; border: 1px dashed var(--accent); background: rgba(255,255,255,.96); padding: 0; margin: 0; resize: none; overflow: hidden; outline: none; z-index: 20; white-space: pre-wrap; }

/* image list */
.asset-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; cursor: grab; }
.asset-row:hover { background: var(--hover); } .asset-row.dragging { opacity: .5; }
.asset-row .pic { width: 52px; height: 52px; flex: none; border-radius: 4px; border: 1px solid var(--border); background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Crect width='8' height='8' fill='%23e5e6ec'/%3E%3Crect x='8' y='8' width='8' height='8' fill='%23e5e6ec'/%3E%3C/svg%3E"); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.asset-row .pic img { max-width: 100%; max-height: 100%; display: block; }
.asset-row .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.asset-row .meta .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.asset-row .meta .sub { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-row .meta .sub.warn { color: var(--warn); } .asset-row .meta .sub.err { color: var(--danger); }
.asset-row .btns { display: flex; flex-direction: column; gap: 3px; } .asset-row .btns button { padding: 2px 7px; font-size: 11px; }
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* properties panel */
.group { border: 1px solid var(--border); border-radius: 8px; padding: 10px 10px 6px; margin-bottom: 10px; background: var(--panel); }
.group > .gtitle { font-weight: 600; color: var(--muted); margin: -4px 0 8px; font-size: 12px; }
.frow { display: grid; grid-template-columns: 88px 1fr; gap: 6px 10px; align-items: center; margin-bottom: 7px; }
.frow > .flabel { text-align: right; color: var(--muted); font-size: 12px; }
.frow input[type=number] { width: 78px; } .frow input[type=range] { width: 100%; }
.frow .inline { display: flex; align-items: center; gap: 8px; } .frow .inline input[type=number] { width: 64px; }
.seg { display: flex; gap: 3px; } .seg button { flex: 1; padding: 4px 4px; font-size: 12px; min-width: 0; }
.colors { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; } .colors button { width: 22px; height: 22px; padding: 0; border-radius: 11px; border: 1px solid rgba(0,0,0,.25); }
.colors button.checked { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--text); }
.check { display: flex; align-items: center; gap: 6px; margin: 4px 0; } .check input { width: auto; }
.section-title { font-weight: 700; font-size: 14px; margin: 4px 0 10px; }
.btnrow { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; } .btnrow button { font-size: 12px; padding: 5px 8px; }
.note { font-size: 12px; color: var(--muted); margin: 4px 0 8px; }
.note.warn { color: var(--warn); } .note.err { color: var(--danger); }

/* dialogs + menus */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; min-width: 330px; max-width: min(560px, 94vw); box-shadow: var(--shadow); pointer-events: auto; max-height: 92vh; overflow: auto; }
.modal.wide { max-width: min(1200px, 96vw); width: 96vw; }
.modal h3 { margin: 0 0 10px; font-size: 15px; }
.modal .buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.modal .hint { color: var(--muted); font-size: 12px; margin-top: 8px; }
.modal textarea { min-height: 70px; resize: vertical; }
.modal table.kv td { padding: 3px 10px 3px 0; } .modal table.kv td:first-child { font-weight: 600; white-space: nowrap; }
.menu { position: absolute; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 4px; box-shadow: var(--shadow); z-index: 150; min-width: 200px; }
.menu button { display: block; width: 100%; text-align: left; border: none; background: none; padding: 6px 12px; border-radius: 5px; }
.menu button:hover { background: var(--hover); } .menu hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.menu button.checked::before { content: "✓ "; } .menu button.unchecked::before { content: "\2003"; }

/* cutout editor */
.cut { display: flex; gap: 14px; min-height: 0; }
.cut .view { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.cut .stagebox { position: relative; height: min(72vh, 760px); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Crect width='10' height='10' fill='%23e9eaef'/%3E%3Crect x='10' y='10' width='10' height='10' fill='%23e9eaef'/%3E%3C/svg%3E"); }
.cut .stagebox canvas { position: absolute; left: 0; top: 0; touch-action: none; }
.cut .stagebox.solid { background: #fff; }
.cut .busy { position: absolute; right: 8px; top: 8px; background: rgba(255,255,255,.9); border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; font-size: 12px; }
.cut .viewbar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cut .viewbar .seg { width: auto; } .cut .viewbar .seg button { flex: none; padding: 4px 10px; }
.cut .side { width: 300px; flex: none; border: none; background: transparent; overflow: auto; max-height: min(78vh, 820px); padding-right: 4px; }
.cut .side .frow { grid-template-columns: 96px 1fr; }
.cut .val { font-size: 11px; color: var(--muted); min-width: 26px; text-align: right; }
.cut .check-result { border-radius: 8px; padding: 8px 10px; font-size: 12px; margin-bottom: 10px; border: 1px solid var(--border); background: var(--panel); }
.cut .check-result.warn { background: var(--warn-bg); border-color: #f0c36d; color: #7a4d00; }
.cut .check-result.good { color: var(--ok); }
.swatch { display: inline-block; width: 20px; height: 20px; border-radius: 4px; border: 1px solid rgba(0,0,0,.25); vertical-align: middle; }
.brush-cursor { position: absolute; border: 1.5px solid #5b5bd6; border-radius: 50%; pointer-events: none; transform: translate(-50%, -50%); box-shadow: 0 0 0 1px rgba(255,255,255,.8); }
.brush-cursor.square { border-radius: 0; }
@media (max-width: 1100px) { .side { width: 230px; } .side.right { width: 280px; } }

/* public share page */
.share-page { max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; }
.share-page h1 { font-size: 24px; margin: 4px 0 14px; }
.share-pic { position: relative; background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.share-pic img { display: block; width: 100%; height: auto; }
.share-pic .hotspot { position: absolute; display: block; border-radius: 6px; }
.share-pic .hotspot:hover, .share-pic .hotspot:focus { outline: 2px solid var(--accent); background: rgba(91,91,214,.08); }
.share-list { margin: 8px 0 18px; padding-left: 20px; } .share-list li { padding: 3px 0; font-size: 15px; }
.share-box { display: flex; gap: 8px; margin: 8px 0; } .share-box input { flex: 1; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }

.sibling-title { margin: 30px 0 4px; font-size: 18px; } #siblingProjects .project-card .name { display: block; margin-top: 6px; }
