/* Insyn: the tavla editor (dotted canvas, Figma feel), the presenter and the admin pages.
   Always light; Hyllkoll red is the selection colour. */

/* ---------- editor shell ---------- */
.ed { position: fixed; inset: 4px 0 0 0; display: grid; grid-template-columns: 176px minmax(0, 1fr) 280px; grid-template-rows: 56px minmax(0, 1fr);
  grid-template-areas: 'top top top' 'pages canvas props'; background: var(--page); }
.ed-top { grid-area: top; display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--card); border-bottom: 1px solid var(--line); min-width: 0; }
.ed-top .grow { flex: 1; }
.ed-name { border: 1px solid transparent; background: transparent; font: 700 16px/1.2 "Inter Tight", Inter, sans-serif; padding: 6px 8px; border-radius: 6px; width: 240px; min-width: 0; }
.ed-name:hover, .ed-name:focus { border-color: var(--line); background: var(--card); outline: none; }
.ed-sep { width: 1px; height: 24px; background: var(--line); }
.ed-top .tool { font-size: 16px; }
.ed-top .tool[disabled] { opacity: .35; cursor: default; }

/* page strip */
.ed-pages { grid-area: pages; background: var(--card); border-right: 1px solid var(--line); overflow: auto; padding: 12px 10px; display: flex; flex-direction: column; gap: 10px; }
.ed-pagelist { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.ed-pagelist li { position: relative; }
.thumb { display: flex; gap: 6px; align-items: flex-start; border: 0; background: none; padding: 0; cursor: pointer; width: 100%; }
.thumb-n { font-size: 11px; color: var(--muted); width: 12px; text-align: right; padding-top: 2px; flex-shrink: 0; }
.thumb-box { display: block; position: relative; overflow: hidden; border-radius: 4px; border: 1px solid var(--line); box-shadow: var(--shadow); flex-shrink: 0; }
.ed-pagelist li.on .thumb-box { outline: 2px solid var(--red); outline-offset: 1px; }
.thumb-page { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; overflow: hidden; }
.thumb-tools { position: absolute; right: 2px; bottom: 2px; display: none; background: var(--card); border: 1px solid var(--line); border-radius: 6px; }
.ed-pagelist li:hover .thumb-tools, .ed-pagelist li:focus-within .thumb-tools { display: flex; }
.thumb-tools .tool { padding: 2px 6px; }
.thumb-tools .tool[disabled] { opacity: .3; }
.ed-addpage { justify-content: center; }

/* the canvas: tiny dots, the page in the middle */
.ed-canvas { grid-area: canvas; position: relative; min-width: 0; min-height: 0; background-color: #ECECE8;
  background-image: radial-gradient(circle, #BDBCB6 1px, transparent 1.4px); background-size: 16px 16px; }
.ed-scroll { position: absolute; inset: 0; overflow: auto; display: flex; padding: 64px 40px 40px; }
.ed-stage { position: relative; flex-shrink: 0; margin: auto; }
.ed-board { position: absolute; left: 0; top: 0; transform-origin: 0 0; overflow: hidden;
  box-shadow: 0 1px 3px rgba(20, 20, 20, .08), 0 12px 40px rgba(20, 20, 20, .10); }
.ed.dragging .ed-board::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 30;
  background-image: radial-gradient(circle, rgba(20, 20, 20, .22) 1px, transparent 1.4px); background-size: 16px 16px; }
.ed.placing .ed-board { cursor: crosshair; }
.ed-tools { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 5; display: flex; gap: 2px; padding: 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); }
.ed-tools button { border: 0; background: transparent; border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.ed-tools button:hover { background: var(--hover); color: var(--ink); }
.ed-tools button[aria-pressed="true"] { background: var(--ink); color: var(--card); }
.ed-mobile { display: none; }

/* elements on a page (editor, page strip and presenter) */
.el { position: absolute; }
.el-text { width: 100%; height: 100%; white-space: pre-wrap; overflow-wrap: anywhere; border-radius: 6px; outline: none; letter-spacing: -.005em; }
.el-text[contenteditable="true"] { cursor: text; box-shadow: inset 0 0 0 1px rgba(223, 16, 22, .35); }
.el-image img { width: 100%; height: 100%; display: block; border-radius: 6px; }
.el > .card { width: 100%; height: 100%; }
.el.fresh { animation: fresh 2.4s ease-out; border-radius: var(--radius); }
.ed-board .el:hover { outline: 1px solid rgba(223, 16, 22, .45); }
.ed-board .el.on:hover { outline: none; }
.ed-board .el .card * { pointer-events: none; }   /* a click on a card selects it; the chart never steals the drag */
.ed-sel { position: absolute; pointer-events: none; outline: calc(1.5px / var(--s, 1)) solid var(--red); z-index: 40; }
.ed-sel .hd { position: absolute; width: calc(10px / var(--s, 1)); height: calc(10px / var(--s, 1)); background: #fff; pointer-events: auto;
  border: calc(1.5px / var(--s, 1)) solid var(--red); border-radius: calc(2px / var(--s, 1)); transform: translate(-50%, -50%); }
.hd-nw { left: 0; top: 0; cursor: nwse-resize; } .hd-n { left: 50%; top: 0; cursor: ns-resize; } .hd-ne { left: 100%; top: 0; cursor: nesw-resize; }
.hd-e { left: 100%; top: 50%; cursor: ew-resize; } .hd-se { left: 100%; top: 100%; cursor: nwse-resize; } .hd-s { left: 50%; top: 100%; cursor: ns-resize; }
.hd-sw { left: 0; top: 100%; cursor: nesw-resize; } .hd-w { left: 0; top: 50%; cursor: ew-resize; }
/* several selected: each one outlined, a dashed box round them all, no resize handles */
.ed-sel.group { outline-style: dashed; }
.ed-sel.group .hd { display: none; }
.ed-board.multi .el.on, .ed-board.multi .el.on:hover { outline: calc(1px / var(--s, 1)) solid var(--red); }
.ed-marquee { position: fixed; z-index: 60; border: 1px solid var(--red); background: rgba(223, 16, 22, .06); pointer-events: none; }
/* align + distribute (top of the properties panel) */
.abar { display: grid; gap: 4px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.abar-row { display: flex; align-items: center; gap: 2px; }
.abtn { width: 30px; height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-2); display: grid; place-items: center; cursor: pointer; padding: 0; flex-shrink: 0; }
.abtn svg { width: 16px; height: 16px; }
.abtn:hover { background: var(--hover); color: var(--ink); }
.abtn[disabled] { opacity: .3; cursor: default; }
.abtn[disabled]:hover { background: transparent; }
.abar-sep { width: 1px; height: 18px; background: var(--line); margin: 0 6px; flex-shrink: 0; }
.abar-hint { font-size: 12px; color: var(--muted); margin: 0 0 0 8px; }

/* properties */
.ed-props { grid-area: props; background: var(--card); border-left: 1px solid var(--line); overflow: auto; padding: 16px; display: grid; gap: 14px; align-content: start; }
.ed-props h3 { font-size: 15px; font-weight: 700; }
.prow { display: grid; gap: 6px; }
.plabel { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.pval { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pactions { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.sw { width: 26px; height: 26px; border-radius: 6px; border: 1px solid rgba(20, 20, 20, .18); cursor: pointer; padding: 0; position: relative;
  display: grid; place-items: center; font-size: 13px; color: var(--ink-2); background: var(--card); }
.sw[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ink); }
.sw-none { background: linear-gradient(135deg, transparent 45%, var(--red) 46%, var(--red) 54%, transparent 55%), var(--card); }
.sw-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.pnums { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.pnum { display: grid; gap: 2px; font-size: 11px; color: var(--muted); }
.pnum input { width: 100%; min-height: 30px; border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; font-size: 13px; background: var(--card); }
.ptips { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); display: grid; gap: 4px; }
.ed-props .seg button { padding: 4px 10px; font-size: 12px; }
.qlist .pick { width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.qlist .pick:hover { border-color: var(--ink-2); }
.pick-name { flex: 1; font-weight: 600; }

/* ---------- presenter (always light) ---------- */
.pres { position: fixed; inset: 0; z-index: 200; background: var(--page); display: grid; place-items: center; outline: none; }
.pres-stage { position: relative; cursor: pointer; }
.pres-wrap { position: absolute; inset: 0; }
.pres-slide { position: absolute; left: 0; top: 0; transform-origin: 0 0; overflow: hidden; box-shadow: 0 2px 6px rgba(20, 20, 20, .06), 0 20px 60px rgba(20, 20, 20, .10); }
.pres .card .sub { display: none; }
.pres-bar { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; align-items: center; gap: 6px; background: var(--card);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px; box-shadow: var(--shadow); transition: opacity .3s; z-index: 2; }
.pres.idle .pres-bar { opacity: 0; }
.pres-btn { border: 0; background: transparent; border-radius: 999px; min-width: 34px; height: 34px; font-size: 18px; color: var(--ink); cursor: pointer; }
.pres-btn:hover { background: var(--hover); }
.pres-btn[disabled] { opacity: .3; cursor: default; }
.pres-end { font-size: 13px; font-weight: 600; padding: 0 12px; }
.pres-count { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; min-width: 44px; text-align: center; }
.pres-prog { position: fixed; left: 0; right: 0; bottom: 0; height: 3px; }
.pres-prog span { display: block; height: 100%; width: 0; background: var(--red); transition: width .4s; }

/* ---------- admin + brand pages ---------- */
.badge { background: var(--red); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 0 7px; line-height: 18px; }
.adm-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.adm-col { display: grid; gap: 16px; min-width: 0; }
.adm-sec { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 10px; box-shadow: var(--shadow); min-width: 0; }
.adm-sec h3 { font-size: 15px; font-weight: 700; }
.adm-sec .big { font-size: 18px; font-weight: 700; margin: 0; }
.adm-sec .field { margin: 0; }
.complist, .namelist { list-style: none; margin: 0; padding: 0; display: grid; }
.complist label, .namelist > li { display: flex; gap: 10px; align-items: baseline; padding: 7px 2px; border-bottom: 1px solid var(--line); font-size: 14px; flex-wrap: wrap; }
.namelist label { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; width: 100%; }
.complist input, .namelist input { accent-color: var(--ink); }
.cname { font-weight: 600; }
.cwhy { color: var(--muted); font-size: 13px; }
.namelist li > span:first-child, .namelist label > span:first-of-type { min-width: 120px; color: var(--ink-2); }
.add-person { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto auto; gap: 6px; }
.add-person input, .add-person select { min-height: 34px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); min-width: 0; }
.adm-found { display: grid; gap: 10px; }
.auth-card .btn-red, .auth-card .btn { width: 100%; justify-content: center; min-height: 44px; margin-top: 6px; }
.auth-card .note .linkbtn { margin: 0; }

/* ---------- phones ---------- */
@media (max-width: 900px) {
  .ed { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: 'top' 'canvas' 'pages'; }
  .ed-props, .ed-tools, .ed-top select, .ed-top .ed-sep, .ed-top .tool, .ed-name { display: none; }
  .ed-top { flex-wrap: wrap; }
  .ed-pages { border-right: 0; border-top: 1px solid var(--line); flex-direction: row; overflow-x: auto; padding: 8px; }
  .ed-pagelist { display: flex; }
  .ed-addpage { display: none; }
  .ed-mobile { display: block; position: absolute; left: 12px; right: 12px; top: 10px; text-align: center; font-size: 12px; color: var(--ink-2);
    background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; z-index: 5; }
  .ed-scroll { padding: 52px 12px 12px; }
  .adm-grid { grid-template-columns: minmax(0, 1fr); }
  .add-person { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
