:root {
  --cream: #faf7f1; --cream-2: #f3eee4; --paper: #fff; --ink: #1a1d1a; --ink-soft: #41463f;
  --muted: #757a6f; --line: #e6e0d4; --line-soft: #efeae0; --green: #1c5d3f; --green-deep: #134430;
  --green-tint: #e7f0e9; --brass: #b0894f; --danger: #b23a3a;
  --shadow-sm: 0 1px 2px rgba(26,29,26,.05), 0 2px 8px rgba(26,29,26,.05);
  --shadow-md: 0 6px 18px rgba(26,29,26,.08); --shadow-lg: 0 24px 60px rgba(19,35,26,.2);
  --radius: 14px; --radius-sm: 9px; --r-pill: 999px; --ease: cubic-bezier(.22,.61,.36,1);
  --serif: 'Fraunces', Georgia, serif; --sans: 'Inter', system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--sans); background: var(--cream); color: var(--ink); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--serif); margin: 0; letter-spacing: -.01em; }
a { color: inherit; }
input, textarea, button, select { font-family: inherit; }

.brand__mark { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 32% 30%, #3a8a63, var(--green) 55%, var(--green-deep)); display: inline-block; }

/* knappar */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .7rem 1.3rem; border-radius: var(--r-pill); border: 1px solid transparent; font-weight: 500; font-size: .94rem; transition: background .2s, border-color .2s, transform .12s, box-shadow .2s; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--green); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--green-deep); }
.btn--ghost { background: var(--paper); color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--ink); }
.btn--sm { padding: .5rem .9rem; font-size: .86rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.iconbtn { width: 38px; height: 38px; border-radius: 50%; border: none; background: var(--cream-2); font-size: 1.4rem; line-height: 1; color: var(--ink); transition: background .2s; }
.iconbtn:hover { background: var(--line); }
.muted { color: var(--muted); }
.form-error { color: var(--danger); font-size: .9rem; }

/* fält */
.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 0; }
.field label { font-size: .82rem; font-weight: 600; color: var(--ink-soft); }
.field input, .field textarea { font-size: .95rem; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); transition: border-color .2s, box-shadow .2s; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-tint); }
.field textarea { resize: vertical; }
.field--check { justify-content: flex-end; }
.field--check label { display: flex; align-items: center; gap: .5rem; font-weight: 500; cursor: pointer; }
.field--check input { width: 18px; height: 18px; accent-color: var(--green); }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login__card { background: var(--paper); border: 1px solid var(--line-soft); border-radius: 20px; box-shadow: var(--shadow-md); padding: 2.4rem; width: min(380px, 100%); display: flex; flex-direction: column; gap: 1rem; }
.login__brand { display: flex; align-items: center; gap: .6rem; font-family: var(--serif); font-weight: 700; font-size: 1.4rem; letter-spacing: .03em; }
.login__sub { color: var(--muted); margin: -.4rem 0 .4rem; font-size: .95rem; }

/* ---------- Topbar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0 clamp(1rem, 4vw, 2.5rem); height: 66px; background: color-mix(in srgb, var(--cream) 85%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar__brand { display: flex; align-items: center; gap: .55rem; font-family: var(--serif); font-weight: 700; letter-spacing: .03em; }
.tabs { display: flex; gap: .3rem; background: var(--cream-2); padding: .25rem; border-radius: var(--r-pill); }
.tab { border: none; background: transparent; padding: .5rem 1.1rem; border-radius: var(--r-pill); font-weight: 500; color: var(--ink-soft); font-size: .92rem; transition: background .2s, color .2s; }
.tab.is-active { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-sm); }
.topbar__right { display: flex; align-items: center; gap: 1rem; }
.link-out { font-size: .88rem; color: var(--muted); text-decoration: none; }
.link-out:hover { color: var(--ink); }

/* ---------- Panel ---------- */
.panel { width: min(1080px, 94vw); margin: 2rem auto; }
.panel__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.panel__head h1 { font-size: 1.9rem; }

/* produktlista */
.prod-list { display: flex; flex-direction: column; gap: .75rem; }
.prow { display: grid; grid-template-columns: 56px 1fr auto auto; gap: 1rem; align-items: center; background: var(--paper); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: .8rem 1.1rem; box-shadow: var(--shadow-sm); cursor: pointer; transition: border-color .2s, transform .12s; }
.prow:hover { border-color: var(--line); transform: translateY(-1px); }
.prow__thumb { width: 56px; height: 56px; border-radius: 10px; overflow: hidden; background: var(--cream-2); display: grid; place-items: center; }
.prow__thumb img { width: 100%; height: 100%; object-fit: cover; }
.prow__thumb .ph { width: 60%; height: 60%; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #cfe0d4, #9fc1ad); }
.prow__name { font-weight: 600; }
.prow__meta { font-size: .82rem; color: var(--muted); margin-top: .15rem; }
.prow__price { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; }
.tag { font-size: .68rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; padding: .22rem .55rem; border-radius: var(--r-pill); }
.tag--draft { background: #efe6d4; color: #8a6d2e; }
.tag--out { background: #f6e3e0; color: var(--danger); }
.tag--ok { background: var(--green-tint); color: var(--green); }

/* ---------- Editor ---------- */
.editor { position: fixed; inset: 0; z-index: 100; }
.editor[hidden] { display: none; }
.editor__backdrop { position: absolute; inset: 0; background: rgba(20,30,24,.42); backdrop-filter: blur(3px); }
.editor__panel { position: relative; width: min(640px, 96vw); max-height: 92vh; margin: 4vh auto; background: var(--paper); border-radius: 20px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: pop .3s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.98); } }
.editor__head { display: flex; align-items: center; justify-content: space-between; padding: 1.4rem 1.6rem; border-bottom: 1px solid var(--line-soft); }
.editor__head h2 { font-size: 1.4rem; }
.editor__body { padding: 1.5rem 1.6rem; overflow: auto; }
.editor__foot { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.6rem; border-top: 1px solid var(--line-soft); }
.editor__foot .spacer { flex: 1; }

.pform { display: flex; flex-direction: column; gap: 1rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* bilder */
.images-block { border-top: 1px solid var(--line-soft); padding-top: 1rem; }
.images-label { font-size: .82rem; font-weight: 600; color: var(--ink-soft); display: block; margin-bottom: .6rem; }
.img-grid { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: .7rem; }
.img-cell { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.img-cell img { width: 100%; height: 100%; object-fit: cover; }
.img-cell button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: none; background: rgba(0,0,0,.6); color: #fff; font-size: .9rem; line-height: 1; display: grid; place-items: center; cursor: pointer; }
.img-cell button:hover { background: var(--danger); }
.uploader { display: flex; align-items: center; justify-content: center; padding: 1.1rem; border: 1.5px dashed var(--line); border-radius: var(--radius-sm); color: var(--muted); font-size: .9rem; cursor: pointer; text-align: center; transition: border-color .2s, background .2s, color .2s; }
.uploader:hover, .uploader.drag { border-color: var(--green); background: var(--green-tint); color: var(--green); }
.hint { font-size: .85rem; color: var(--muted); background: var(--cream-2); padding: .7rem .9rem; border-radius: var(--radius-sm); }

/* ---------- Ordrar ---------- */
.order-list { display: flex; flex-direction: column; gap: .8rem; }
.order { background: var(--paper); border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.order__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.2rem; cursor: pointer; }
.order__id { font-family: var(--serif); font-weight: 600; }
.order__cust { color: var(--ink-soft); font-size: .92rem; }
.order__total { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; }
.order__date { font-size: .82rem; color: var(--muted); }
.order__body { padding: 0 1.2rem 1.2rem; border-top: 1px solid var(--line-soft); display: none; }
.order.open .order__body { display: block; }
.order__items { margin: 1rem 0; }
.order__items div { display: flex; justify-content: space-between; padding: .35rem 0; border-bottom: 1px solid var(--line-soft); font-size: .92rem; }
.order__contact { font-size: .9rem; color: var(--ink-soft); line-height: 1.7; }
.order__contact a { color: var(--green); }
.status-pills { display: flex; gap: .4rem; margin-top: .9rem; }
.status-pill { border: 1px solid var(--line); background: var(--paper); padding: .4rem .8rem; border-radius: var(--r-pill); font-size: .82rem; cursor: pointer; }
.status-pill.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: .8rem 1.3rem; border-radius: var(--r-pill); box-shadow: var(--shadow-lg); font-size: .92rem; z-index: 200; opacity: 0; transition: opacity .3s, transform .3s var(--ease); pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }

@media (max-width: 640px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .tabs { order: 3; }
  .topbar { flex-wrap: wrap; height: auto; padding-block: .7rem; }
  .prow { grid-template-columns: 48px 1fr auto; }
  .prow__price { display: none; }
}
