:root {
  --bg: oklch(0.975 0.008 85);
  --card: oklch(1 0 0);
  --ink: oklch(0.18 0.02 65);
  --muted: oklch(0.48 0.02 65);
  --line: oklch(0.9 0.015 85);
  --gold: oklch(0.72 0.12 78);
  --gold-deep: oklch(0.55 0.11 70);
  --gold-soft: oklch(0.72 0.12 78 / 0.14);
  --dark: oklch(0.15 0.02 65);
  --dark-2: oklch(0.22 0.03 65);
  --red: oklch(0.55 0.18 28);
  --green: oklch(0.55 0.12 150);
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--gold-deep); }
h1, h2 { font-family: var(--serif); font-weight: 700; line-height: 1.1; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.loading { padding: 40px; color: var(--muted); }

/* Knappar */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); font-weight: 600; font-size: .9rem; cursor: pointer; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--gold); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--dark); }
.btn.gold:hover { background: oklch(0.76 0.12 78); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 12px; font-size: .85rem; }
.btn.full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 2px; }

/* Ram */
#app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--dark); color: oklch(0.9 0.01 85); padding: 22px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; }
.brand { display: flex; flex-direction: column; text-decoration: none; padding: 0 10px; }
.brand .b1 { font-family: var(--serif); font-size: 1.5rem; font-weight: 700; color: #fff; line-height: 1; }
.brand .b2 { font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); font-weight: 700; margin-top: 4px; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a, .side-foot a, .side-foot button { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
  color: oklch(0.85 0.01 85); text-decoration: none; font-weight: 500; background: none; border: 0; cursor: pointer; text-align: left; font-size: .92rem; }
.side nav a:hover, .side-foot a:hover, .side-foot button:hover { background: var(--dark-2); color: #fff; }
.side nav a.on { background: var(--gold-soft); color: var(--gold); }
.ico { width: 20px; text-align: center; opacity: .85; }
.side-foot { margin-top: auto; border-top: 1px solid var(--dark-2); padding-top: 12px; display: flex; flex-direction: column; gap: 2px; }

.main { min-width: 0; outline: none; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 16px 32px;
  background: oklch(0.975 0.008 85 / 0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top h1 { font-size: 1.9rem; margin-right: auto; }
.state { font-size: .85rem; color: var(--green); font-weight: 600; }
.state::before { content: "● "; }
.state.warn { color: var(--gold-deep); }
.page { padding: 28px 32px 80px; max-width: 920px; }
.intro { color: var(--muted); max-width: 640px; margin: 0 0 22px; }
.block { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px; margin-bottom: 20px; }
.block h2 { font-size: 1.45rem; margin-bottom: 14px; }

/* Fält */
.fld { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; min-width: 0; }
.lab { font-weight: 600; font-size: .85rem; }
.hint { font-size: .78rem; color: var(--muted); }
.fld input[type=text], .fld input[type=number], .fld input[type=password], .fld select, .fld textarea, .srow input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.fld input:focus, .fld select:focus, .fld textarea:focus, .srow input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.fld textarea { resize: vertical; line-height: 1.55; min-height: 64px; }
.fld input:disabled { background: var(--bg); }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 14px; }
.btns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.pill { background: var(--gold-soft); border-radius: 999px; padding: 6px 12px; font-size: .85rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.chk { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.chk input { accent-color: var(--gold-deep); width: 18px; height: 18px; }

.media { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.prev { width: 200px; aspect-ratio: 16/10; border-radius: 10px; overflow: hidden; background: var(--bg); border: 1px dashed var(--line);
  display: grid; place-items: center; color: var(--muted); font-size: .85rem; }
.prev img, .prev video { width: 100%; height: 100%; object-fit: cover; }
.media .btns { flex: 1; min-width: 180px; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.th { position: relative; margin: 0; aspect-ratio: 4/3; border-radius: 10px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); }
.th img { width: 100%; height: 100%; object-fit: cover; }
.th .hb { position: absolute; top: 6px; left: 6px; background: var(--gold); color: var(--dark); font-size: .68rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.th-btns { position: absolute; inset: auto 0 0 0; display: flex; justify-content: space-between; gap: 4px; padding: 6px; background: linear-gradient(transparent, oklch(0 0 0 / .55)); }
.th-btns button { width: 26px; height: 26px; font-size: .8rem; border-radius: 50%; border: 0; background: #fff; cursor: pointer; font-weight: 700; }
.th-btns button:disabled { opacity: .35; }
.th-btns .del { margin-left: auto; background: var(--red); color: #fff; }
.th.add { border: 2px dashed var(--gold); background: var(--gold-soft); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 600; color: var(--gold-deep); }
.th.add small { font-weight: 400; color: var(--muted); }

.strings { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.srow { display: flex; gap: 6px; width: 100%; }
.ib { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 700; display: grid; place-items: center; }
.ib:hover { border-color: var(--gold); }
.ib:disabled { opacity: .3; cursor: default; }
.ib.del { color: var(--red); }
.ib.del:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* Listor */
.list { margin: 6px 0 16px; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.count { margin-left: 8px; font-size: .8rem; color: var(--muted); }
.empty { color: var(--muted); padding: 14px; border: 1px dashed var(--line); border-radius: 12px; text-align: center; }
.card { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; background: var(--card); }
.card.open { border-color: var(--gold); box-shadow: 0 8px 24px -14px oklch(0.18 0.02 65 / .35); }
.card-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px; cursor: pointer; border-radius: 12px; }
.card-head:hover { background: var(--bg); }
.cthumb { width: 56px; height: 42px; flex: none; border-radius: 8px; overflow: hidden; background: var(--bg); }
.cthumb img { width: 100%; height: 100%; object-fit: cover; }
.ctext { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ctitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.csub { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cbtns { display: flex; gap: 4px; }
.chev { font-size: 1.4rem; color: var(--muted); transition: transform .2s; width: 16px; text-align: center; }
.card.open .chev { transform: rotate(90deg); }
.card-body { padding: 6px 16px 4px; border-top: 1px solid var(--line); }
.card-body { padding-top: 14px; }
.fld input[type=text], .fld input[type=number], .fld select { height: 44px; }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 16px 40px -16px oklch(0.18 0.02 65 / .4); padding: 6px; min-width: 210px; display: flex; flex-direction: column; }
.menu[hidden] { display: none; }
.menu button { text-align: left; padding: 9px 12px; border: 0; background: none; border-radius: 8px; cursor: pointer; font-weight: 500; }
.menu button:hover { background: var(--gold-soft); }
.menu button:last-child { border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; color: var(--muted); }

/* Översikt */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; }
.tile:hover { border-color: var(--gold); }
.tile .big { font-family: var(--serif); font-size: 2.6rem; font-weight: 700; line-height: 1; color: var(--gold-deep); }
.tile small { color: var(--muted); }
.quick { display: flex; flex-wrap: wrap; gap: 10px; }

/* Inloggning */
.login { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: var(--dark); }
.login-box { width: min(400px, 100%); background: var(--card); border-radius: 20px; padding: 30px; display: flex; flex-direction: column; gap: 12px; }
.login-box h1 { font-size: 2rem; }
.login-box .eyebrow { margin: 0; font-size: .72rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--gold-deep); }
.login-box p { margin: 0; }
.login-box .bad { color: var(--red); font-weight: 600; }
.login-box > a { text-align: center; text-decoration: none; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 60;
  background: var(--dark); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 500; transition: .25s; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--red); }

/* Mobil */
@media (max-width: 820px) {
  #app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; padding: 14px 16px 10px; gap: 10px; }
  .side nav { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .side nav a { white-space: nowrap; padding: 7px 12px; }
  .side-foot { flex-direction: row; flex-wrap: wrap; border-top: 0; padding-top: 0; margin-top: 0; }
  .side-foot a, .side-foot button { padding: 4px 8px; font-size: .82rem; }
  .top { padding: 12px 16px; }
  .top h1 { font-size: 1.5rem; }
  .state { display: none; }
  .page { padding: 18px 16px 80px; }
  .block { padding: 16px; }
  .prev { width: 100%; }
  .cbtns .ib { width: 30px; height: 30px; }
  .cthumb { display: none; }
}
.size { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; font-weight: 600; }
.size select { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }

/* ---------- Bildbanken ---------- */
.bb-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.bb-q { flex: 1; min-width: 200px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.bb-q:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.bb-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: .82rem; cursor: pointer; }
.chip span { color: var(--muted); font-weight: 500; margin-left: 2px; }
.chip.on { background: var(--dark); color: #fff; border-color: var(--dark); }
.chip.on span { color: var(--gold); }
/* max-content: annars trycks bilderna ihop till tunna streck när det finns många bilder i rutan */
.bb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); grid-auto-rows: max-content; align-content: start; gap: 12px; }
.bb-item { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.bb-item.pickable { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.bb-item.pickable:hover { border-color: var(--gold); }
.bb-item.on { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.bb-img { position: relative; aspect-ratio: 4/3; background: var(--bg); }
.bb-img img { width: 100%; height: 100%; object-fit: cover; }
.bb-tag { position: absolute; left: 6px; top: 6px; font-size: .65rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #fff; }
.bb-tag.wix { background: oklch(0.95 0.05 80); color: oklch(0.45 0.1 60); }
.bb-check { position: absolute; right: 6px; top: 6px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid var(--line); color: transparent; font-weight: 700; }
.bb-item.on .bb-check { background: var(--gold); border-color: var(--gold); color: var(--dark); }
.bb-item figcaption { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; font-size: .75rem; }
.bb-item figcaption strong { font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-item figcaption span { color: var(--muted); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bb-item figcaption span.unused { color: oklch(0.55 0.12 60); font-weight: 600; }
.bb-modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: oklch(0.15 0.02 65 / .6); }
.bb-dialog { width: min(1000px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--bg); border-radius: 18px; padding: 20px; }
.bb-dialog .bb-grid { overflow-y: auto; flex: 1; min-height: 200px; padding: 2px; }
.bb-dialog .bb-tabs { margin: 0; }
.bb-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.bb-head h2 { font-size: 1.6rem; }
.bb-foot { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding-top: 14px; border-top: 1px solid var(--line); margin-top: 12px; }
.bb-foot .muted { margin-right: auto; }
.th.add.bank { border-style: solid; border-width: 1px; background: var(--card); }
.move-menu { min-width: 180px; z-index: 80; }
.move-menu .mm-h { font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 6px 12px 4px; }
.move-menu button:last-child { border-top: 0; color: inherit; }

.more-imgs { margin-top: 12px; padding: 12px; border: 1px dashed var(--line); border-radius: 12px; }
.more-imgs .fld { margin-bottom: 0; }
.more-btns { margin-top: 10px; }
.color-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.color-row input[type=color] { width: 52px; height: 40px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; }
.color-val { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
/* Version: huvudsidan eller sida 3 */
.ver { margin: 0 4px; padding: 10px; border-radius: 12px; background: var(--dark-2); }
.ver-h { display: block; font-size: .66rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: oklch(0.7 0.02 80); margin-bottom: 6px; }
.ver-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.ver-btns button { padding: 7px 6px; border-radius: 8px; border: 0; background: transparent; color: oklch(0.85 0.01 85); font-weight: 600; font-size: .82rem; cursor: pointer; }
.ver-btns button:hover { background: oklch(1 0 0 / .08); }
.ver-btns button.on { background: var(--gold); color: var(--dark); }
@media (max-width: 820px) { .ver { margin: 0; } }
.order-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; max-width: 460px; }
.order-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.order-list li strong { flex: 1; font-weight: 600; }
.order-list .on { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--gold-soft); color: var(--gold-deep); font-size: .8rem; font-weight: 700; }
.pw-dialog { width: min(460px, 100%); gap: 12px; }
.pw-dialog > p { margin: 0 0 12px; }
.pw-dialog .hint.bad { color: var(--red); font-weight: 600; }
.pw-dialog .chk { border: 0; padding: 0; margin-bottom: 8px; }
