/* Glimra – gränssnitt. Färgtema C2: vinröd och mint (oktober 2026) */
:root {
  --bg: #f6f3f4;
  --panel: #ffffff;
  --panel2: #fbf8f9;
  --line: #ece5e8;
  --line2: #ddd2d6;
  --text: #211a1d;
  --muted: #76656c;
  --faint: #a3959b;
  --accent: #8a1c3c;
  --accent-d: #6b1430;
  --accent-l: #f7e5ec;
  --pink: #b23a5e;
  --amber: #5fcfa9;
  --danger: #dc2626;
  --ok: #1f9e78;
  --rail: #1e0d14;
  --rail2: #2d1620;
  --stage: #eee9eb;
  --grad: radial-gradient(ellipse at 12% 15%, #a8284f 0%, rgba(168, 40, 79, 0) 55%), radial-gradient(ellipse at 92% 95%, #6fd9b5 0%, rgba(111, 217, 181, 0) 55%), linear-gradient(120deg, #4d0c22 0%, #3a1a2c 50%, #1d5f4d 100%);
  --shadow-s: 0 1px 2px rgba(20, 16, 40, .06), 0 1px 3px rgba(20, 16, 40, .08);
  --shadow-m: 0 6px 24px rgba(20, 16, 40, .12), 0 2px 6px rgba(20, 16, 40, .06);
  --shadow-l: 0 20px 60px rgba(20, 16, 40, .25);
  --r: 10px;
  --r-s: 7px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { font-family: 'Inter', 'Segoe UI', system-ui, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; user-select: none; }
input, textarea, select { user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }
.ico { display: block; flex: none; }
.icowrap { display: inline-flex; }
a { color: var(--accent); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cfcbe0; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #b6b0cf; background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Knappar och fält ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 9px; border: 1px solid transparent; font-weight: 600; font-size: 14px; background: #fff; white-space: nowrap; transition: background .15s, box-shadow .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-d); }
.btn-grad { background: linear-gradient(120deg, #5fd1ab 0%, #9fe7cf 100%); background-origin: border-box; border: 0; color: #4d0c22; box-shadow: 0 4px 14px rgba(29, 143, 109, .28); }
.btn-grad:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: var(--line2); }
.btn-ghost:hover { background: #f7f1f4; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-soft { background: var(--accent-l); color: var(--accent-d); }
.btn-soft:hover { background: #f1d8e2; }
.btn-block { width: 100%; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px; border: 0; background: transparent; color: inherit; flex: none; }
.icon-btn:hover { background: rgba(138, 28, 60, .09); }
.icon-btn.active { background: var(--accent-l); color: var(--accent-d); }
.icon-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.input, .select { height: 36px; border: 1px solid var(--line2); border-radius: 8px; padding: 0 10px; font: inherit; color: var(--text); background: #fff; outline: none; min-width: 0; }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(138, 28, 60, .15); }
textarea.input { height: auto; padding: 8px 10px; resize: vertical; font-family: inherit; }
.lbl { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 10px 0 5px; }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.sep { width: 1px; align-self: stretch; background: var(--line); margin: 6px 4px; flex: none; }
.search { position: relative; }
.search .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search input { width: 100%; padding-left: 36px; height: 40px; border-radius: 10px; background: #f6f2f4; border-color: transparent; }
.search input:focus { background: #fff; }
input[type=range] { -webkit-appearance: none; appearance: none; height: 4px; background: #e2dff0; border-radius: 4px; outline: none; flex: 1; min-width: 60px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); box-shadow: var(--shadow-s); cursor: pointer; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px; border-radius: 20px; border: 1px solid var(--line2); background: #fff; font-size: 13px; font-weight: 500; white-space: nowrap; }
.chip:hover { border-color: var(--accent); }
.chip.active { background: var(--text); color: #fff; border-color: var(--text); }
.toggle { position: relative; width: 36px; height: 20px; border-radius: 20px; background: #d7d3e6; border: 0; flex: none; transition: background .15s; }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: var(--shadow-s); }
.toggle.on { background: var(--accent); }
.toggle.on::after { left: 18px; }
kbd { font-family: inherit; font-size: 11px; color: var(--faint); margin-left: auto; padding-left: 16px; }

/* ---------- Toast, modal, meny, popover ---------- */
#toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 9999; pointer-events: none; align-items: center; }
.toast { display: flex; align-items: center; gap: 10px; background: #1c1a26; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-m); opacity: 0; transform: translateY(10px); transition: all .25s; font-weight: 500; max-width: 560px; pointer-events: auto; }
.toast.show { opacity: 1; transform: none; }
.toast-ok .ico { color: #4ade80; } .toast-err .ico { color: #f87171; } .toast-warn .ico { color: #fbbf24; } .toast-info .ico { color: #c4b5fd; }
.toast button { background: rgba(255,255,255,.12); border: 0; color: #fff; border-radius: 6px; padding: 4px 10px; font-weight: 600; }
.modal-back { position: fixed; inset: 0; background: rgba(18, 14, 34, .45); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; transition: opacity .18s; padding: 20px; }
.modal-back.show { opacity: 1; }
.modal { background: #fff; border-radius: 16px; box-shadow: var(--shadow-l); max-width: 100%; max-height: calc(100vh - 40px); display: flex; flex-direction: column; transform: scale(.97); transition: transform .18s; }
.modal-back.show .modal { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 6px 22px; }
.modal-head h3 { margin: 0; font-size: 18px; font-weight: 700; }
.modal-body { padding: 8px 22px 18px; overflow: auto; }
.modal-body p { margin: 4px 0 8px; line-height: 1.5; color: #3a3650; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 18px; border-top: 1px solid var(--line); }
.ctx-menu { position: fixed; z-index: 2000; background: #fff; border-radius: 12px; box-shadow: var(--shadow-m); border: 1px solid var(--line); padding: 6px; min-width: 210px; }
.ctx-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: 7px; text-align: left; font-size: 13.5px; }
.ctx-item:hover:not(:disabled) { background: #f8eff3; }
.ctx-item:disabled { opacity: .4; cursor: default; }
.ctx-item.danger { color: var(--danger); }
.ctx-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.popover { position: fixed; z-index: 1500; background: #fff; border-radius: 14px; box-shadow: var(--shadow-m); border: 1px solid var(--line); padding: 14px; max-height: calc(100vh - 16px); overflow-y: auto; }

/* ---------- Splash ---------- */
#splash { position: fixed; inset: 0; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; z-index: 5000; transition: opacity .35s; }
#splash img { width: 88px; height: 88px; animation: pulse 1.6s ease-in-out infinite; }
#splash .name { font-size: 30px; font-weight: 800; letter-spacing: -.5px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
#splash .msg { color: var(--muted); font-size: 13px; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* ---------- Startsida ---------- */
#view-home { display: flex; height: 100vh; }
.home-side { width: 248px; flex: none; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 14px; gap: 6px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand img { width: 36px; height: 36px; }
.brand span { font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.nav-btn { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: 10px; border: 0; background: none; font-weight: 500; font-size: 14.5px; color: #3b3752; text-align: left; }
.nav-btn:hover { background: #f4f2fa; }
.nav-btn.active { background: var(--accent-l); color: var(--accent-d); font-weight: 600; }
.home-side .spacer { flex: 1; }
.home-side .foot { font-size: 12px; color: var(--faint); padding: 8px 12px; line-height: 1.5; }
.home-main { flex: 1; overflow: auto; padding: 26px 40px 60px; }
.home-main > section { max-width: 1400px; margin: 0 auto; }
.hero { position: relative; border-radius: 22px; padding: 46px 40px 34px; background: var(--grad); color: #fff; overflow: hidden; margin-bottom: 30px; }
.hero::before, .hero::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255,255,255,.07); }
.hero::before { width: 380px; height: 380px; right: -90px; top: -160px; }
.hero::after { width: 220px; height: 220px; left: 38%; bottom: -150px; }
.hero h1 { margin: 0 0 22px; font-size: 38px; font-weight: 800; letter-spacing: -.8px; text-align: center; position: relative; }
.hero .search { max-width: 640px; margin: 0 auto; position: relative; z-index: 1; }
.hero .search input { height: 50px; font-size: 15px; background: #fff; border-radius: 14px; box-shadow: 0 8px 24px rgba(50, 0, 20, .25); }
.quick { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; margin-top: 26px; position: relative; z-index: 1; }
.quick button { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 104px; border: 0; background: none; color: #fff; font-size: 12.5px; font-weight: 600; }
.quick button .qi { width: 56px; height: 56px; border-radius: 50%; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); transition: transform .15s, background .15s; }
.quick button:hover .qi { transform: translateY(-3px); background: rgba(255,255,255,.32); }
.sec-head { display: flex; align-items: center; justify-content: space-between; margin: 28px 0 14px; gap: 12px; }
.sec-head h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.3px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px; }
.card { cursor: pointer; }
.card .thumb { position: relative; border-radius: 12px; background: #efe9ec; overflow: hidden; display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; transition: box-shadow .15s, transform .15s; }
.card:hover .thumb { box-shadow: 0 0 0 2px var(--accent), var(--shadow-m); }
.card .thumb img { max-width: 88%; max-height: 88%; box-shadow: 0 2px 10px rgba(0,0,0,.14); border-radius: 3px; background: #fff; }
.card .thumb .badge { position: absolute; left: 8px; top: 8px; font-size: 11px; font-weight: 600; background: rgba(23,21,31,.72); color: #fff; padding: 3px 8px; border-radius: 6px; }
.card .meta { padding: 9px 2px 0; }
.card .meta .t { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card .more { position: absolute; right: 8px; top: 8px; background: #fff; box-shadow: var(--shadow-s); opacity: 0; }
.card:hover .more { opacity: 1; }
.tpl-grid { columns: 5 220px; column-gap: 18px; }
.tpl-grid .tcard { break-inside: avoid; margin-bottom: 18px; cursor: pointer; display: inline-block; width: 100%; }
.tpl-grid .tcard .ti { border-radius: 10px; overflow: hidden; background: #efe9ec; min-height: 120px; transition: box-shadow .15s, transform .15s; }
.tpl-grid .tcard .ti img { display: block; width: 100%; }
.tpl-grid .tcard:hover .ti { box-shadow: 0 0 0 2px var(--accent), var(--shadow-m); transform: translateY(-2px); }
.tpl-grid .tcard .tn { font-size: 13px; font-weight: 600; margin-top: 7px; }
.tpl-grid .tcard .tf { font-size: 12px; color: var(--muted); }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); border: 2px dashed var(--line2); border-radius: 16px; }
.empty .ico { margin: 0 auto 10px; color: var(--faint); }
.formats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.fmt { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-align: left; }
.fmt:hover { border-color: var(--accent); background: #fcf7f9; }
.fmt .fi { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-l); color: var(--accent-d); display: flex; align-items: center; justify-content: center; flex: none; }
.fmt .fn { font-weight: 600; font-size: 13.5px; }
.fmt .fs { font-size: 11.5px; color: var(--muted); }
.brand-page .box { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; margin-bottom: 18px; }
.brand-page h3 { margin: 0 0 4px; font-size: 16px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.swatch-lg { width: 64px; height: 64px; border-radius: 14px; border: 1px solid rgba(0,0,0,.08); position: relative; cursor: pointer; }
.swatch-lg .x { position: absolute; right: -6px; top: -6px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-s); display: none; align-items: center; justify-content: center; border: 0; padding: 0; }
.swatch-lg:hover .x { display: flex; }
.swatch-add { width: 64px; height: 64px; border-radius: 14px; border: 2px dashed var(--line2); display: flex; align-items: center; justify-content: center; color: var(--muted); background: none; }
.logo-tile { width: 120px; height: 90px; border-radius: 12px; border: 1px solid var(--line); background: #f6f5fa center/contain no-repeat; position: relative; }

/* ---------- Editor ---------- */
#view-editor { display: flex; flex-direction: column; height: 100vh; }
.topbar { height: 56px; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 12px; background: var(--grad); color: #fff; }
.topbar .icon-btn:hover { background: rgba(255,255,255,.16); }
.topbar .icon-btn:disabled { background: none; }
.topbar .tb-btn { height: 36px; padding: 0 12px; border-radius: 8px; border: 0; background: transparent; color: #fff; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; }
.topbar .tb-btn:hover { background: rgba(255,255,255,.16); }
.topbar .home-logo { width: 34px; height: 34px; border-radius: 9px; border: 0; padding: 0; background: rgba(255,255,255,.18) center/24px no-repeat; display: flex; align-items: center; justify-content: center; }
.topbar .title { flex: 1; display: flex; justify-content: center; align-items: center; gap: 10px; min-width: 0; }
.topbar .title input { background: transparent; border: 1px solid transparent; color: #fff; font: inherit; font-weight: 600; font-size: 15px; text-align: center; height: 34px; border-radius: 8px; padding: 0 10px; width: 300px; max-width: 34vw; outline: none; }
.topbar .title input:hover { border-color: rgba(255,255,255,.4); }
.topbar .title input:focus { background: rgba(0,0,0,.15); border-color: rgba(255,255,255,.6); }
.topbar .save-state { font-size: 12px; opacity: .85; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.topbar .btn-export { background: #fff; color: var(--accent-d); height: 38px; }
.topbar .btn-export:hover { background: #f5efff; }
.ed-main { flex: 1; display: flex; min-height: 0; }
.rail { width: 76px; flex: none; background: var(--rail); display: flex; flex-direction: column; align-items: stretch; padding: 8px 0; gap: 2px; overflow-y: auto; }
.rail button { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 2px; border: 0; background: none; color: #b9b5cc; font-size: 11px; font-weight: 500; }
.rail button .ri { width: 40px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; transition: background .15s; }
.rail button:hover { color: #fff; }
.rail button:hover .ri { background: var(--rail2); }
.rail button.active { color: #fff; }
.rail button.active .ri { background: linear-gradient(135deg, #a8284f 0%, #6b1430 55%, #1d8f6d 125%); }
.panel { width: 340px; flex: none; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; transition: margin-left .2s; position: relative; }
.panel.closed { margin-left: -340px; }
.panel-head { padding: 14px 16px 8px; }
.panel-head h3 { margin: 0 0 10px; font-size: 16px; font-weight: 700; }
.panel-body { flex: 1; overflow-y: auto; padding: 4px 16px 24px; }
.panel-close { position: absolute; right: -16px; top: 50%; transform: translateY(-50%); width: 16px; height: 64px; border: 1px solid var(--line); border-left: 0; background: #fff; border-radius: 0 8px 8px 0; z-index: 5; display: flex; align-items: center; justify-content: center; padding: 0; color: var(--muted); }
.ph { font-size: 13px; font-weight: 700; margin: 18px 0 10px; display: flex; align-items: center; justify-content: space-between; }
.ph button { border: 0; background: none; color: var(--accent); font-size: 12px; font-weight: 600; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.tile { aspect-ratio: 1; border-radius: 10px; background: #f6f2f4; border: 1px solid transparent; display: flex; align-items: center; justify-content: center; padding: 10px; cursor: pointer; transition: background .12s, border-color .12s; overflow: hidden; }
.tile:hover { background: #ece8f8; border-color: #d6ccf5; }
.tile svg { width: 100%; height: 100%; }
.tile img { max-width: 100%; max-height: 100%; border-radius: 4px; }
.tile.icon-tile { padding: 14px; color: #2b2840; }
.tile.photo-tile { padding: 0; }
.tile.photo-tile img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.emoji-tile { font-size: 26px; font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif; padding: 0; }
.text-preset { display: block; width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 12px 14px; text-align: left; margin-bottom: 8px; }
.text-preset:hover { border-color: var(--accent); background: #fcfbff; }
.combo { border: 1px solid var(--line); border-radius: 10px; padding: 14px 10px; text-align: center; cursor: pointer; background: #fff; overflow: hidden; min-height: 92px; display: flex; flex-direction: column; justify-content: center; }
.combo:hover { border-color: var(--accent); }
.mini-tpl { border-radius: 8px; overflow: hidden; cursor: pointer; background: #efe9ec; border: 2px solid transparent; transition: border-color .12s; }
.mini-tpl:hover { border-color: var(--accent); }
.mini-tpl img { display: block; width: 100%; }
.tpl-cols { columns: 2; column-gap: 8px; }
.tpl-cols .mini-tpl { break-inside: avoid; margin-bottom: 8px; display: inline-block; width: 100%; }
.color-dot { width: 100%; aspect-ratio: 1; border-radius: 8px; border: 1px solid rgba(0,0,0,.08); cursor: pointer; }
.color-dot:hover { transform: scale(1.06); }
.dropzone { border: 2px dashed var(--line2); border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); font-size: 13px; margin-top: 10px; }
.dropzone.over { border-color: var(--accent); background: var(--accent-l); }
.layer { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; margin-bottom: 4px; background: #fbf8f9; }
.layer:hover { border-color: var(--line2); }
.layer.sel { border-color: var(--accent); background: var(--accent-l); }
.layer .lt { width: 34px; height: 34px; border-radius: 6px; background: #fff; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; flex: none; color: var(--muted); overflow: hidden; }
.layer .lt img { max-width: 100%; max-height: 100%; }
.layer .ln { flex: 1; min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer .icon-btn { width: 28px; height: 28px; color: var(--muted); }
.layer.dragover { border-top: 2px solid var(--accent); }

.workspace { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--stage); }
.ctxbar { min-height: 52px; flex: none; background: #fff; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 7px 10px; }
.ctxbar > * { flex: none; }
.ctxbar > .grow { flex: 1 1 0; min-width: 0; }
.ctxbar::-webkit-scrollbar { height: 0; }
.ctxbar .icon-btn { width: 36px; height: 36px; }
.ctxbar .cb { height: 36px; padding: 0 10px; border-radius: 8px; border: 0; background: transparent; display: inline-flex; align-items: center; gap: 7px; font-weight: 500; white-space: nowrap; }
.ctxbar .cb:hover { background: #f7eef1; }
.ctxbar .cb.active { background: var(--accent-l); color: var(--accent-d); }
.ctxbar .font-btn { min-width: 150px; justify-content: space-between; border: 1px solid var(--line2); }
.ctxbar .size-ctl { display: flex; align-items: center; border: 1px solid var(--line2); border-radius: 8px; height: 36px; overflow: hidden; }
.ctxbar .size-ctl button { width: 30px; height: 100%; border: 0; background: none; display: flex; align-items: center; justify-content: center; }
.ctxbar .size-ctl button:hover { background: #f7eef1; }
.ctxbar .size-ctl input { width: 46px; height: 100%; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; font: inherit; outline: none; }
.color-btn { width: 36px; height: 36px; border-radius: 8px; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.color-btn:hover { background: #f7eef1; }
.color-btn .sw { width: 24px; height: 24px; border-radius: 6px; border: 1px solid rgba(0,0,0,.12); background-size: cover; }
.color-btn .bar { width: 22px; height: 5px; border-radius: 3px; border: 1px solid rgba(0,0,0,.12); }
.checker { background-image: linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%); background-size: 10px 10px; background-position: 0 0, 0 5px, 5px -5px, -5px 0; }
.ctx-hint { color: var(--muted); font-size: 13px; padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1500px) { .ctx-hint.tip { display: none; } }
.stage { flex: 1; overflow: auto; position: relative; display: flex; }
.stage-inner { margin: auto; padding: 56px; }
.page-holder { position: relative; box-shadow: 0 2px 4px rgba(0,0,0,.06), 0 8px 30px rgba(30, 20, 60, .14); background: #fff; }
.page-label { position: absolute; top: -28px; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.page-label .pa { display: flex; gap: 2px; }
.page-label .icon-btn { width: 26px; height: 26px; }
.stage.drop-over .page-holder { box-shadow: 0 0 0 3px var(--accent), 0 8px 30px rgba(30, 20, 60, .14); }
.pagebar { height: 112px; flex: none; background: #fff; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 14px; }
.pages { flex: 1; display: flex; gap: 10px; overflow-x: auto; align-items: center; height: 100%; padding: 8px 2px; }
.pthumb { flex: none; height: 76px; position: relative; cursor: pointer; display: flex; flex-direction: column; align-items: center; }
.pthumb .pi { height: 64px; border-radius: 6px; border: 2px solid transparent; overflow: hidden; background: #f0eff6; display: flex; box-shadow: var(--shadow-s); }
.pthumb .pi img { height: 100%; display: block; }
.pthumb.active .pi { border-color: var(--accent); }
.pthumb .pn { font-size: 11px; color: var(--muted); margin-top: 3px; }
.pthumb.dragover .pi { box-shadow: -4px 0 0 var(--accent); }
.padd { flex: none; width: 64px; height: 64px; border-radius: 8px; border: 2px dashed var(--line2); background: none; color: var(--muted); display: flex; align-items: center; justify-content: center; margin-top: -12px; }
.padd:hover { border-color: var(--accent); color: var(--accent); }
.zoom { display: flex; align-items: center; gap: 6px; width: 260px; flex: none; }
.zoom .zv { width: 52px; text-align: center; font-size: 13px; font-weight: 600; border: 1px solid var(--line2); border-radius: 7px; padding: 5px 0; cursor: pointer; background: #fff; }

.props.closed { display: none; }
.props { width: 280px; flex: none; background: #fff; border-left: 1px solid var(--line); overflow-y: auto; padding: 14px 16px 30px; }
.props h4 { margin: 18px 0 10px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); display: flex; align-items: center; justify-content: space-between; }
.props h4:first-child { margin-top: 2px; }
.pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.nf { display: flex; align-items: center; border: 1px solid var(--line2); border-radius: 8px; height: 34px; padding-left: 10px; background: #fff; }
.nf span { font-size: 12px; color: var(--faint); width: 14px; font-weight: 600; }
.nf input { border: 0; outline: none; width: 100%; height: 100%; font: inherit; background: none; padding: 0 6px; min-width: 0; }
.nf:focus-within { border-color: var(--accent); }
.slider-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.slider-row label { font-size: 12.5px; width: 86px; flex: none; color: #3d3954; }
.slider-row .val { width: 40px; text-align: right; font-size: 12px; color: var(--muted); flex: none; }
.btn-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.btn-row button { height: 34px; border: 1px solid var(--line2); border-radius: 8px; background: #fff; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; }
.btn-row button:hover { border-color: var(--accent); background: #fcf7f9; }
.btn-row button.active { border-color: var(--accent); background: var(--accent-l); color: var(--accent-d); }
.prop-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; font-size: 13px; }
.preset-filters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.preset-filters button { border: 2px solid transparent; border-radius: 8px; padding: 0; background: #f6f2f4; overflow: hidden; font-size: 11px; }
.preset-filters button img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.preset-filters button span { display: block; padding: 4px 0; }
.preset-filters button.active { border-color: var(--accent); }

/* Färgväljare */
.cp { width: 284px; }
.cp-tabs { display: flex; gap: 4px; background: #f7f1f4; border-radius: 9px; padding: 3px; margin-bottom: 12px; }
.cp-tabs button { flex: 1; border: 0; background: none; border-radius: 7px; height: 30px; font-size: 13px; font-weight: 600; color: var(--muted); }
.cp-tabs button.active { background: #fff; color: var(--text); box-shadow: var(--shadow-s); }
.cp-sv { position: relative; height: 150px; border-radius: 10px; cursor: crosshair; overflow: hidden; }
.cp-sv .w { position: absolute; inset: 0; background: linear-gradient(to right, #fff, rgba(255,255,255,0)); }
.cp-sv .b { position: absolute; inset: 0; background: linear-gradient(to top, #000, rgba(0,0,0,0)); }
.cp-sv .k { position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.3), 0 1px 4px rgba(0,0,0,.3); transform: translate(-50%, -50%); pointer-events: none; }
.cp-hue { position: relative; height: 14px; border-radius: 8px; margin: 12px 0; background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); cursor: pointer; }
.cp-hue .k { position: absolute; top: 50%; width: 18px; height: 18px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25), 0 1px 4px rgba(0,0,0,.3); transform: translate(-50%, -50%); pointer-events: none; }
.cp-sw { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.cp-sw button { aspect-ratio: 1; border-radius: 6px; border: 1px solid rgba(0,0,0,.1); padding: 0; }
.cp-sw button:hover { transform: scale(1.1); }
.cp-sw button.sel { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); }
.cp h5 { font-size: 11.5px; font-weight: 700; color: var(--muted); margin: 12px 0 7px; }
.cp-stops { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.cp-stops .stop { width: 34px; height: 34px; border-radius: 8px; border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,.1); }
.cp-stops .stop.sel { border-color: var(--accent); }
.cp-prev { height: 34px; border-radius: 8px; flex: 1; border: 1px solid rgba(0,0,0,.1); }

/* Typsnittsväljare */
.fp { width: 300px; padding: 10px; }
.fp-list { max-height: 380px; overflow-y: auto; margin-top: 8px; }
.fp-item { display: flex; align-items: center; justify-content: space-between; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: 8px; font-size: 19px; text-align: left; }
.fp-item:hover { background: #f8eff3; }
.fp-item.sel { background: var(--accent-l); }
.fp-item small { font-family: Inter, sans-serif; font-size: 11px; color: var(--faint); }
.fp-cat { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; padding: 10px 10px 4px; }

/* Exportdialog */
.exp-opt { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.exp-opt button { border: 1px solid var(--line2); border-radius: 10px; background: #fff; padding: 10px 12px; text-align: left; display: flex; gap: 10px; align-items: center; }
.exp-opt button.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(138, 28, 60,.18); background: #fcf7f9; }
.exp-opt button b { display: block; font-size: 13.5px; }
.exp-opt button small { color: var(--muted); font-size: 11.5px; }
.resize-list { max-height: 340px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.resize-list label { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 7px; cursor: pointer; font-size: 13.5px; }
.resize-list label:hover { background: #f6f4fb; }
.resize-list .rg { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; padding: 8px 8px 4px; }
.tpl-preview { display: flex; gap: 22px; }
.tpl-preview .big { flex: 1; display: flex; align-items: center; justify-content: center; background: #efeef5; border-radius: 12px; padding: 18px; min-height: 380px; }
.tpl-preview .big img { max-width: 100%; max-height: 52vh; box-shadow: var(--shadow-m); }
.tpl-preview .side { width: 240px; display: flex; flex-direction: column; gap: 10px; }
.tpl-preview .pages-mini { display: flex; flex-wrap: wrap; gap: 6px; max-height: 260px; overflow: auto; }
.tpl-preview .pages-mini img { height: 54px; border-radius: 4px; border: 2px solid transparent; cursor: pointer; }
.tpl-preview .pages-mini img.sel { border-color: var(--accent); }
.bgr-prev { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bgr-prev div { border-radius: 10px; overflow: hidden; display: flex; align-items: center; justify-content: center; height: 300px; }
.bgr-prev img { max-width: 100%; max-height: 100%; }
.chart-table { width: 100%; border-collapse: collapse; }
.chart-table td { padding: 3px; }
.chart-table input { width: 100%; }

/* ---------- Matchinfo ---------- */
.mi-modal .modal-body { padding-top: 4px; }
.mi { display: grid; grid-template-columns: 320px 1fr; gap: 22px; align-items: start; }
.mi-left { background: var(--panel2); border: 1px solid var(--line); border-radius: 14px; padding: 14px; position: sticky; top: 0; }
.mi-sec { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 16px 0 8px; }
.mi-form > .mi-sec:first-child { margin-top: 0; }
.mi-row { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 10px; }
.mi-row > .icon-btn { margin-bottom: 2px; flex: none; }
.mi-fld { display: flex; flex-direction: column; gap: 4px; min-width: 0; margin-bottom: 0; }
.mi-form > .mi-fld { margin-bottom: 10px; }
.mi-fld > span { font-size: 12px; font-weight: 600; color: #4f3c45; }
.mi-fld .row { gap: 8px; }
.mi-fld .row > .input { flex: 1; }
.mi-fld .row > b { color: var(--muted); }
.mi-shot { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1.5px dashed var(--line2); border-radius: 12px; background: #fff; cursor: pointer; margin-bottom: 8px; transition: border-color .12s, background .12s; outline: none; }
.mi-shot:hover, .mi-shot:focus-visible, .mi-shot.over { border-color: var(--accent); background: #fcf7f9; }
.mi-shot .fi { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-l); color: var(--accent-d); display: flex; align-items: center; justify-content: center; flex: none; }
.mi-shot .fn { font-weight: 600; font-size: 13.5px; }
.mi-shot .fs { font-size: 11.5px; color: var(--muted); }
.mi-status { min-height: 18px; margin: 0 0 8px; display: flex; align-items: center; gap: 6px; line-height: 1.35; }
.mi-status svg { color: var(--ok); flex: none; }
.mi-raw { margin-top: 10px; }
.mi-raw summary { cursor: pointer; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.input.mi-new { border-color: #f59e0b; background: #fffbeb; }
.logo-slot { width: 36px; height: 36px; flex: none; border-radius: 8px; border: 1.5px dashed var(--line2); background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); padding: 0; cursor: pointer; overflow: hidden; }
.logo-slot span { display: none; }
.logo-slot:hover { border-color: var(--accent); color: var(--accent); }
.logo-slot.has { border-style: solid; border-color: var(--line); background: #f6f2f4; }
.logo-slot img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.mi-cands { max-height: 60vh; overflow: auto; }
.mi-cands .fmt { cursor: pointer; }
@media (max-width: 900px) { .mi { grid-template-columns: 1fr; } .mi-left { position: static; } }

/* ---------- Mallpaket ---------- */
.pack-banner { display: flex; align-items: center; gap: 22px; padding: 18px 22px; border-radius: 18px; background: linear-gradient(120deg, #2a0f14 0%, #7a1f2b 55%, #24402b 120%); color: #fff; cursor: pointer; margin-bottom: 8px; transition: transform .15s, box-shadow .15s; }
.pack-banner:hover { transform: translateY(-2px); box-shadow: var(--shadow-m); }
.pack-banner .pk-ico { width: 54px; height: 54px; border-radius: 14px; background: rgba(255,255,255,.14); display: flex; align-items: center; justify-content: center; flex: none; }
.pack-banner .pk-t { font-size: 19px; font-weight: 800; letter-spacing: -.3px; }
.pack-banner .pk-s { font-size: 13px; opacity: .85; margin-top: 2px; }
.pack-banner .pk-thumbs { margin-left: auto; display: flex; gap: 10px; }
.pack-banner .pk-thumbs img { height: 96px; border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.35); background: rgba(255,255,255,.1); aspect-ratio: 4 / 5; object-fit: cover; }
.pack-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: #7a1f2b; background: #fbecee; border-radius: 20px; padding: 3px 9px; }
.tpl-grid .tcard .tf .pack-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #7a1f2b; margin-right: 5px; vertical-align: 1px; }
.club-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; margin-top: 10px; }
.club-tile { position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 12px 10px 10px; text-align: center; background: #fff; }
.club-tile .cl-img { height: 64px; background: center / contain no-repeat; margin-bottom: 8px; }
.club-tile .cl-n { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.club-tile .x { position: absolute; right: -6px; top: -6px; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 0; box-shadow: var(--shadow-s); display: none; align-items: center; justify-content: center; }
.club-tile:hover .x { display: flex; }
.club-add { border: 1.5px dashed var(--line2); border-radius: 12px; background: #fff; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 118px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.club-add:hover { border-color: var(--accent); color: var(--accent); }
.ctxbar .cb.cb-accent { background: var(--accent-l); color: var(--accent-d); font-weight: 600; }
.ctxbar .cb.cb-accent:hover { background: #f1d8e2; }

/* ---------- Klubbmärken: väljare och import ---------- */
.cp-modal .modal-body { min-height: 360px; }
.cp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; max-height: 56vh; overflow: auto; padding: 2px; }
.cp-tile { border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 10px 8px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; transition: border-color .12s, box-shadow .12s; min-width: 0; }
.cp-tile:hover, .cp-tile:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(138, 28, 60, .12); outline: none; }
.cp-tile.best { border-color: var(--accent); background: #fcf7f9; }
.cp-img { width: 72px; height: 72px; display: flex; align-items: center; justify-content: center; }
.cp-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cp-n { font-size: 12px; font-weight: 600; text-align: center; line-height: 1.25; max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cp-empty { grid-column: 1 / -1; text-align: center; padding: 40px 20px; color: var(--muted); border: 2px dashed var(--line2); border-radius: 14px; }
.cp-empty b { display: block; color: var(--text); margin: 8px 0 4px; }
.ci-list { max-height: 52vh; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.ci-row { display: grid; grid-template-columns: 22px 48px 1fr auto; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); cursor: default; }
.ci-row:last-child { border-bottom: 0; }
.ci-img { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: #f6f2f4; border-radius: 8px; }
.ci-img img { max-width: 38px; max-height: 38px; object-fit: contain; }
.ci-st { font-size: 11.5px; font-weight: 600; color: var(--ok); white-space: nowrap; }
.ci-st.rep { color: #b45309; }
.tile.club-mini { flex-direction: column; gap: 4px; padding: 8px 6px 6px; }
.tile.club-mini img { max-height: 46px; max-width: 100%; object-fit: contain; }
.tile.club-mini span { font-size: 10.5px; font-weight: 600; text-align: center; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* ---------- Förenkla logga ---------- */
.sp { display: grid; grid-template-columns: 1fr 290px; gap: 22px; align-items: start; }
.sp-stage { height: 460px; border-radius: 14px; display: flex; align-items: center; justify-content: center; padding: 28px; border: 1px solid var(--line); }
.sp-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.sp-stage.dark { background: #26232f; }
.sp-stage.light { background: #f6f2f4; }
.sp-stage.check { background: repeating-conic-gradient(#d9d6e3 0% 25%, #f7f6fb 0% 50%) 50% / 22px 22px; }
.sp-orig { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 14px; background: #fff; }
.sp-orig img { width: 52px; height: 52px; object-fit: contain; }
.sp-orig span { font-size: 12px; color: var(--muted); font-weight: 600; }
.sp-sw { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.sp-dot { width: 30px; height: 30px; border-radius: 50%; border: 1px solid #c9c5d8; padding: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: #4f3c45; background: #fff; }
.sp-dot.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); }
.sp-side input[type=range] { width: 100%; accent-color: var(--accent); }
.sp-side .lbl { font-size: 12px; font-weight: 700; color: #4f3c45; margin-bottom: 4px; }
@media (max-width: 900px) { .sp { grid-template-columns: 1fr; } .sp-stage { height: 300px; } }
.sp-colors { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-chip { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 9px 0 4px; border-radius: 18px; border: 1px solid var(--line2); background: #fff; cursor: pointer; opacity: .6; }
.sp-chip .sw { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(0,0,0,.18); }
.sp-chip .ck { display: inline-flex; color: var(--muted); }
.sp-chip .pc { font-size: 11px; color: var(--muted); }
.sp-chip.on { opacity: 1; border-color: var(--accent); background: #fcf7f9; box-shadow: 0 0 0 1px var(--accent); }
.sp-chip.on .ck { color: var(--accent-d); }

/* ---------------- Fotoredigerare ---------------- */
.pe-wrap { position: fixed; inset: 0; z-index: 900; display: flex; flex-direction: column; background: #17101a; color: #fff; }
.pe-top { height: 58px; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 14px; background: var(--grad); }
.pe-top-left, .pe-top-right { display: flex; align-items: center; gap: 6px; }
.pe-title { display: inline-flex; align-items: center; gap: 8px; margin-right: 10px; font-size: 16px; }
.pe-tb { height: 36px; min-width: 36px; padding: 0 9px; border: 0; border-radius: 10px; background: rgba(255,255,255,.12); color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; font: inherit; font-size: 14px; }
.pe-tb:hover:not(:disabled) { background: rgba(255,255,255,.22); }
.pe-tb:disabled { opacity: .4; cursor: default; }
.pe-tb.pe-text { padding: 0 12px; font-weight: 600; }
.pe-main { flex: 1; display: flex; min-height: 0; }
.pe-stage { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; min-width: 0;
  background-color: #221a24; background-image: linear-gradient(45deg, #2a2030 25%, transparent 25%), linear-gradient(-45deg, #2a2030 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #2a2030 75%), linear-gradient(-45deg, transparent 75%, #2a2030 75%);
  background-size: 24px 24px; background-position: 0 0, 0 12px, 12px -12px, -12px 0; }
.pe-canvas { display: block; box-shadow: 0 10px 40px rgba(0,0,0,.45); }
.pe-overlay { position: absolute; inset: 0; pointer-events: none; }
.pe-overlay.hidden { display: none; }
.pe-crop { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(10,6,12,.62); cursor: move; pointer-events: auto; touch-action: none; }
.pe-grid { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to right, transparent calc(33.33% - .5px), rgba(255,255,255,.45) calc(33.33% - .5px), rgba(255,255,255,.45) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgba(255,255,255,.45) calc(66.66% - .5px), rgba(255,255,255,.45) calc(66.66% + .5px), transparent calc(66.66% + .5px)),
              linear-gradient(to bottom, transparent calc(33.33% - .5px), rgba(255,255,255,.45) calc(33.33% - .5px), rgba(255,255,255,.45) calc(33.33% + .5px), transparent calc(33.33% + .5px), transparent calc(66.66% - .5px), rgba(255,255,255,.45) calc(66.66% - .5px), rgba(255,255,255,.45) calc(66.66% + .5px), transparent calc(66.66% + .5px)); }
.pe-hd { position: absolute; width: 16px; height: 16px; background: #fff; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.4); z-index: 1; }
.pe-nw { left: -8px; top: -8px; cursor: nwse-resize; } .pe-ne { right: -8px; top: -8px; cursor: nesw-resize; }
.pe-sw { left: -8px; bottom: -8px; cursor: nesw-resize; } .pe-se { right: -8px; bottom: -8px; cursor: nwse-resize; }
.pe-n { left: calc(50% - 12px); top: -5px; width: 24px; height: 10px; cursor: ns-resize; } .pe-s { left: calc(50% - 12px); bottom: -5px; width: 24px; height: 10px; cursor: ns-resize; }
.pe-w { top: calc(50% - 12px); left: -5px; width: 10px; height: 24px; cursor: ew-resize; } .pe-e { top: calc(50% - 12px); right: -5px; width: 10px; height: 24px; cursor: ew-resize; }
.pe-info { position: absolute; left: 14px; bottom: 12px; font-size: 12px; color: rgba(255,255,255,.75); background: rgba(0,0,0,.35); padding: 4px 8px; border-radius: 8px; }
.pe-compare { position: absolute; right: 14px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 10px; padding: 7px 11px; background: rgba(0,0,0,.45); color: #fff; font: inherit; font-size: 13px; cursor: pointer; user-select: none; }
.pe-compare:active { background: rgba(0,0,0,.7); }
.pe-side { width: 330px; flex: none; background: #fff; color: var(--text); display: flex; flex-direction: column; border-left: 1px solid var(--line); }
.pe-tabs { display: flex; gap: 4px; padding: 10px; border-bottom: 1px solid var(--line); }
.pe-tabs button { flex: 1; height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font: inherit; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; }
.pe-tabs button.active { background: var(--accent-l); color: var(--accent); }
.pe-side-body { flex: 1; overflow-y: auto; padding: 6px 16px 20px; }
.pe-h { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 16px 0 8px; }
.pe-row { margin-bottom: 10px; }
.pe-row input[type=range] { width: 100%; accent-color: var(--accent); }
.pe-lab { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 2px; }
.pe-val { color: var(--muted); font-variant-numeric: tabular-nums; }
.pe-note { font-size: 12px; color: var(--muted); line-height: 1.45; margin: 6px 0 10px; }
.pe-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pe-preset { border: 2px solid transparent; border-radius: 12px; padding: 4px; background: var(--panel2); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; font: inherit; font-size: 12px; color: var(--text); }
.pe-preset img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }
.pe-preset.active { border-color: var(--accent); }
.pe-aspects { display: flex; flex-wrap: wrap; gap: 6px; }
.pe-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pe-ibtn { justify-content: flex-start; gap: 8px; }
.pe-check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; margin-top: 14px; line-height: 1.4; }

/* Ikonstil och elementkombinationer */
.seg { display: flex; gap: 4px; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; margin: 0 0 10px; }
.seg button { flex: 1; height: 30px; border: 0; border-radius: 8px; background: transparent; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.active { background: #fff; color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.tile.combo-tile { padding: 6px; }

/* Emoji-byggare */
.em { display: grid; grid-template-columns: 280px 1fr; gap: 22px; }
.em-left { display: flex; flex-direction: column; align-items: center; }
.em-prev { width: 260px; height: 260px; border-radius: 18px; background: var(--panel2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.em-prev-img { width: 236px; height: 236px; }
.em-cap { margin-top: 10px; font-weight: 600; text-align: center; font-size: 14px; }
.em-note { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.45; margin-top: 10px; }
.em-right { max-height: 60vh; overflow-y: auto; padding-right: 6px; }
.em-h { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 14px 0 8px; }
.em-h:first-child { margin-top: 0; }
.em-sub { font-size: 12px; color: var(--muted); margin: 8px 0 6px; }
.em-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; }
.em-tile { aspect-ratio: 1; border-radius: 12px; background: #f6f2f4; border: 2px solid transparent; cursor: pointer; padding: 3px; display: flex; align-items: center; justify-content: center; }
.em-tile:hover { border-color: var(--line2); }
.em-tile.active { border-color: var(--accent); background: var(--accent-l); }
.em-tile img { width: 100%; height: 100%; display: block; }
.em-none { font-size: 12px; color: var(--muted); font-weight: 600; }
.em-sws { display: flex; gap: 8px; flex-wrap: wrap; }
.em-sw { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line2); cursor: pointer; padding: 0; }
.em-sw.active { box-shadow: 0 0 0 2px var(--accent); }
.tile.em-more { flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--accent); }

/* Förlopp vid import av bilder */
.imp-bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.imp-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #5fd1ab, #1d8f6d); border-radius: 99px; transition: width .2s ease; }

/* Redigera mallen */
.tpl-banner { flex: none; display: flex; align-items: center; gap: 10px; padding: 9px 14px; background: #eaf8f2; border-bottom: 1px solid #bfe8d7; color: #14513f; font-size: 13px; line-height: 1.4; }
.tpl-banner.hidden { display: none; }
.tpl-banner .tb-ico { flex: none; width: 32px; height: 32px; border-radius: 9px; background: #fff; display: grid; place-items: center; color: #1d8f6d; }
.tpl-banner .tb-txt { flex: 1; min-width: 0; }
.tpl-banner .tb-txt b { font-weight: 650; }
.tpl-banner .tb-pk { color: #2c7a62; }
.tpl-banner .tb-sub { color: #3b6f60; font-size: 12px; margin-top: 1px; }
.tpl-banner .btn { flex: none; }
.tpl-banner .btn-ghost { background: #fff; }
.tpl-mode #btn-resize, .tpl-mode .pg-op, .tpl-mode #pages .padd { display: none !important; }
.tpl-mode #doc-title { cursor: default; }
.tpl-grid .tcard .ti { position: relative; }
.mini-tpl { position: relative; }
.tpl-edited { position: absolute; top: 7px; left: 7px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 99px; background: rgba(255,255,255,.94); color: #1d8f6d; font-size: 11px; font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.18); pointer-events: none; }
.mini-tpl .tpl-edited { top: 5px; left: 5px; padding: 3px; }

/* Matchinfo: förhandsvisning av skärmbilden som läses */
.mi-shotprev { display: block; max-width: 100%; max-height: 110px; margin: 0 auto 8px; border-radius: 8px; border: 1px solid var(--line); background: #fff; object-fit: contain; }
.mi-shotprev.hidden { display: none; }
