/* Adminpanelen – bygger vidare på butikens färger och knappar i style.css */
body.admin { background: #fafcfa; }
.error { color: #b3261e; font-weight: 600; font-size: .93rem; }
.pill { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--y); font-size: .78rem; font-weight: 700; margin-left: 4px; }
.form select { border: 2px solid var(--g-soft); border-radius: 14px; padding: 12px 14px; background: var(--w); font-weight: 400; outline: none; }
.form select:focus { border-color: var(--g); box-shadow: 0 0 0 4px var(--y-soft); }
.form input[type="color"] { padding: 4px; height: 48px; width: 100%; cursor: pointer; }
.form .check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.form .check input { width: 20px; height: 20px; accent-color: var(--g); }
.form small { color: var(--g-mute); font-weight: 400; }

/* Inloggning */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(400px, 100%); background: var(--w); border: 2px solid var(--g-soft); border-radius: 28px; padding: 32px; text-align: center; animation: modal .5s var(--bounce); }
.login-card img { margin: 0 auto; }
.login-card h1 { font-size: 2.6rem; }
.login-card > p { color: var(--g-mute); }
.login-card label { text-align: left; }
.login-card .link { justify-self: center; border: 0; font-size: .93rem; }
.form .btn-block { justify-self: stretch; }

/* Ram */
body.admin .header-in { height: auto; flex-wrap: wrap; padding: 10px 0; row-gap: 8px; }
body.admin .nav.admin-tabs { display: flex; flex-direction: row; flex: 0 1 auto; order: 0; max-height: none; visibility: visible; overflow: visible; margin-right: auto; }
body.admin .nav.admin-tabs a { padding: 8px 13px; font-size: 1rem; border: 0; border-radius: 999px; background: none; }
body.admin .nav.admin-tabs a::after { display: block; }
body.admin .brand { margin-right: 12px; }
.admin-main { padding: 36px 0 80px; }
.admin-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.admin-head p { color: var(--g-mute); margin-top: 6px; }
.panel { background: var(--w); border: 2px solid var(--g-soft); border-radius: 22px; overflow: hidden; }
.panel + .panel, .panel + .admin-head { margin-top: 32px; }
.panel-pad { padding: 24px; }
.none { padding: 40px 20px; text-align: center; color: var(--g-mute); }

/* Produktlista */
.rows .row-p { display: grid; grid-template-columns: 44px minmax(0, 1.6fr) 90px 150px auto; gap: 16px; align-items: center; padding: 12px 20px; border-bottom: 1.5px solid var(--g-soft); transition: background .2s; }
.rows .row-p:last-child { border-bottom: 0; }
@media (hover: hover) { .rows .row-p:hover { background: var(--y-soft); } }
.row-p .art { width: 44px; height: 64px; object-fit: contain; }
.row-p b { display: block; line-height: 1.25; }
.row-p small { color: var(--g-mute); }
.row-p .tag { justify-self: start; background: var(--y-soft); border-radius: 999px; padding: 3px 12px; font-size: .85rem; font-weight: 600; }
@media (hover: hover) { .row-p:hover .tag { background: var(--w); } }
.row-p .cost s { color: var(--g-mute); font-size: .88rem; margin-right: 6px; }
.row-p .cost em { font-style: normal; background: var(--g); color: var(--y); border-radius: 999px; padding: 1px 8px; font-size: .75rem; font-weight: 700; margin-left: 6px; }
.row-p .actions { display: flex; gap: 6px; }
.btn-danger { background: var(--w); color: #b3261e; border-color: rgba(179, 38, 30, .3); }
.btn-danger:focus-visible { background: #b3261e; border-color: #b3261e; color: var(--w); }
@media (hover: hover) { .btn-danger:hover { background: #b3261e; border-color: #b3261e; color: var(--w); } }
.sale-input { width: 120px; border: 2px solid var(--g-soft); border-radius: 12px; padding: 8px 10px; outline: none; background: var(--w); }
.sale-input:focus { border-color: var(--g); box-shadow: 0 0 0 4px var(--y-soft); }
.rows.sale .row-p { grid-template-columns: 44px minmax(0, 1.6fr) 110px auto; }

/* Redigeraren */
.editor { border: 0; padding: 0; border-radius: 28px; width: min(860px, calc(100% - 28px)); max-height: calc(100vh - 28px); color: var(--g); }
.editor::backdrop { background: rgba(1, 83, 40, .5); backdrop-filter: blur(4px); }
.editor[open] { animation: modal .45s var(--bounce); }
.editor form { padding: clamp(20px, 4vw, 34px); }
.editor-grid { display: grid; grid-template-columns: 200px 1fr; gap: 28px; }
.preview { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; justify-items: center; align-content: start; text-align: center; min-width: 0; }
.preview .check { font-size: .93rem; }
/* Rutan är alltid kvadratisk; bilden läggs ovanpå så att dess storlek aldrig kan tänja ut den. */
.preview-art { position: relative; width: 100%; aspect-ratio: 1; overflow: hidden; background: var(--y-soft); border-radius: 22px; }
.preview-art .art { position: absolute; inset: 11%; width: 78%; height: 78%; max-width: none; object-fit: contain; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fields .wide { grid-column: 1 / -1; }
.rows.sale .row-p { grid-template-columns: 44px minmax(0, 1.6fr) 130px auto; }
.editor-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* Meddelanden */
.msg { border-bottom: 1.5px solid var(--g-soft); }
.msg:last-child { border-bottom: 0; }
.msg summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 12px 170px minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 16px 20px; transition: background .2s; }
.msg summary::-webkit-details-marker { display: none; }
@media (hover: hover) { .msg summary:hover { background: var(--y-soft); } }
.msg .dot { width: 10px; height: 10px; border-radius: 50%; }
.msg.unread .dot { background: var(--y); box-shadow: 0 0 0 2px var(--g); }
.msg.unread summary { font-weight: 600; }
.msg .snip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--g-mute); }
.msg time { font-size: .85rem; color: var(--g-mute); white-space: nowrap; }
.msg .state { font-size: .78rem; font-weight: 700; border-radius: 999px; padding: 2px 10px; background: var(--y-soft); }
.msg .state.done { background: var(--g); color: var(--w); }
.msg-body { padding: 4px 20px 22px 46px; display: grid; gap: 14px; animation: rise .35s var(--ease); }
.msg-body .q { background: var(--y-soft); border-radius: 4px 18px 18px 18px; padding: 14px 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-body .from { font-size: .9rem; color: var(--g-mute); }
.msg-body .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

@media (max-width: 760px) {
  .rows .row-p, .rows.sale .row-p { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .row-p .tag { display: none; }
  .row-p .cost { grid-column: 2; }
  .row-p .actions { grid-column: 3; grid-row: 1 / span 2; flex-direction: column; }
  .editor-grid { grid-template-columns: 1fr; }
  .preview-art { width: 160px; }
  .fields { grid-template-columns: 1fr; }
  .msg summary { grid-template-columns: 12px minmax(0, 1fr) auto; }
  .msg .snip, .msg time { display: none; }
  .msg-body { padding-left: 20px; }
}
