/* ==========================================================================
   Bollnäs Bilverkstad AB – Adminpanel
   ========================================================================== */

:root {
  --bg:          #070809;
  --bg-2:        #0B0D11;
  --panel:       #101319;
  --panel-2:     #151923;
  --line:        rgba(255,255,255,.08);
  --line-2:      rgba(255,255,255,.15);
  --text:        #E9ECF3;
  --text-soft:   #AEB6C6;
  --muted:       #767F92;
  --gold:        #C9A24A;
  --gold-light:  #F0DCA4;
  --gold-grad:   linear-gradient(135deg,#6E5320,#C9A24A 30%,#F2E0AC 52%,#C9A24A 74%,#6E5320);
  --blue:        #1B6BFF;
  --blue-light:  #5C9BFF;
  --blue-grad:   linear-gradient(135deg,#0A3AA8,#1B6BFF 50%,#0A3AA8);
  --green:       #2ED573;
  --red:         #FF4757;
  --amber:       #FFA502;
  --radius:      12px;
  --ease:        cubic-bezier(.16,1,.3,1);
  --sidebar:     264px;
  --font-display:'Saira Condensed','Barlow Condensed',sans-serif;
  --font:        'Barlow','Segoe UI',system-ui,sans-serif;
}

*,*::before,*::after { box-sizing: border-box; }
html,body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 15.5px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button,input,select,textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
h1,h2,h3,h4 { font-family: var(--font-display); font-weight: 700; font-style: italic; text-transform: uppercase; margin: 0; letter-spacing: .01em; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #262C38; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #38404F; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; }

/* ------------------------------------------------------------- Inloggning */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(760px circle at 22% 18%, rgba(27,107,255,.16), transparent 60%),
    radial-gradient(620px circle at 82% 84%, rgba(201,162,74,.12), transparent 60%),
    var(--bg);
}
.login__box {
  width: min(430px,100%);
  background: linear-gradient(165deg,#141821,#0A0C11);
  border-radius: 18px; padding: 44px 38px;
  box-shadow: 0 40px 90px -40px #000, inset 0 0 0 1px var(--line);
  position: relative; overflow: hidden;
}
.login__box::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--gold-grad);
}
.login__logo { width: 210px; margin: 0 auto 30px; filter: drop-shadow(0 6px 26px rgba(27,107,255,.35)); }
.login h1 { font-size: 1.5rem; text-align: center; margin-bottom: 6px; }
.login__sub { text-align: center; color: var(--muted); font-size: .93rem; margin: 0 0 28px; }
.login__err {
  display: none; margin-bottom: 18px; padding: 12px 16px; border-radius: 10px;
  background: rgba(255,71,87,.12); box-shadow: inset 0 0 0 1px rgba(255,71,87,.35);
  color: #FFB3BA; font-size: .92rem;
}
.login__err.show { display: block; }
.login__hint {
  margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line);
  font-size: .85rem; color: var(--muted); text-align: center;
}
.login__hint code { background: rgba(255,255,255,.06); padding: 2px 7px; border-radius: 5px; color: var(--gold-light); }

/* ------------------------------------------------------------------ Layout */
.app { display: none; min-height: 100vh; }
.app.show { display: grid; grid-template-columns: var(--sidebar) 1fr; }

.side {
  background: linear-gradient(180deg,#0C0F14,#08090C);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  z-index: 50;
}
.side__brand { padding: 18px 22px 15px; border-bottom: 1px solid var(--line); }
.side__brand img { width: 155px; }
.side__brand span { display: block; margin-top: 10px; font-size: .68rem; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }
.side__nav { flex: 1; overflow-y: auto; padding: 12px 12px 16px; }
.side__group { margin-bottom: 10px; }
.side__group > b {
  display: block; padding: 6px 12px; font-size: .68rem; letter-spacing: .24em;
  text-transform: uppercase; color: #5C6478; font-weight: 600;
}
.side__link {
  display: flex; align-items: center; gap: 13px;
  width: 100%; text-align: left;
  padding: 9px 13px; border-radius: 9px;
  color: var(--text-soft); font-size: .96rem; font-weight: 500;
  transition: .25s var(--ease); position: relative;
}
.side__link svg { width: 19px; height: 19px; opacity: .8; }
.side__link:hover { background: rgba(255,255,255,.05); color: #fff; }
.side__link.active { background: rgba(27,107,255,.14); color: #fff; }
.side__link.active::before {
  content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 0 3px 3px 0; background: var(--gold-grad);
}
.side__link .pill[hidden] { display: none; }
.side__link .pill {
  margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: 20px; background: var(--red); color: #fff;
  font-size: .74rem; font-weight: 700; display: grid; place-items: center;
}
.side__foot { padding: 14px; border-top: 1px solid var(--line); display: grid; gap: 9px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  padding: 18px 30px; min-height: 78px;
  background: rgba(7,8,9,.9); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 1.55rem; }
.topbar__sub { color: var(--muted); font-size: .88rem; margin-top: -2px; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.content { padding: 30px; flex: 1; }
.view { display: none; animation: fade .4s var(--ease); }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.burger { display: none; width: 42px; height: 42px; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--line-2); }

/* ------------------------------------------------------------ Komponenter */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 11px 20px; border-radius: 9px;
  font-weight: 600; font-size: .93rem; letter-spacing: .01em;
  transition: .25s var(--ease); white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; }
.btn:hover { transform: translateY(-2px); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn--primary { background: var(--blue-grad); color: #fff; box-shadow: 0 12px 26px -12px rgba(27,107,255,.8); }
.btn--gold { background: var(--gold-grad); color: #141009; box-shadow: 0 12px 26px -12px rgba(201,162,74,.75); }
.btn--ghost { box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text-soft); }
.btn--ghost:hover { box-shadow: inset 0 0 0 1px var(--gold); color: var(--gold-light); }
.btn--danger { background: rgba(255,71,87,.14); color: #FF8892; box-shadow: inset 0 0 0 1px rgba(255,71,87,.3); }
.btn--danger:hover { background: var(--red); color: #fff; }
.btn--sm { padding: 8px 14px; font-size: .86rem; border-radius: 8px; }
.btn--block { width: 100%; }
.btn--icon { padding: 8px; width: 36px; height: 36px; border-radius: 8px; }
.btn--icon svg { width: 16px; height: 16px; }

.card {
  background: linear-gradient(168deg,var(--panel),#0B0E13);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px var(--line);
}
.card__head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 20px 24px; border-bottom: 1px solid var(--line);
}
.card__head h2 { font-size: 1.18rem; }
.card__head .right { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.card__body { padding: 24px; }

.grid { display: grid; gap: 18px; }
.grid--4 { grid-template-columns: repeat(4,1fr); }
.grid--3 { grid-template-columns: repeat(3,1fr); }
.grid--2 { grid-template-columns: repeat(2,1fr); }

.kpi { padding: 22px 24px; position: relative; overflow: hidden; }
.kpi::after {
  content: ''; position: absolute; right: -18px; top: -18px; width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(circle,rgba(27,107,255,.2),transparent 70%);
}
.kpi__top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.kpi__ico {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(201,162,74,.13); color: var(--gold);
}
.kpi__ico svg { width: 20px; height: 20px; }
.kpi__ico.blue { background: rgba(27,107,255,.15); color: var(--blue-light); }
.kpi__ico.green { background: rgba(46,213,115,.14); color: var(--green); }
.kpi__ico.red { background: rgba(255,71,87,.14); color: #FF8892; }
.kpi__label { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.kpi b { font-family: var(--font-display); font-style: italic; font-size: 2.4rem; line-height: 1; display: block; }

/* Tabeller */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 13px 18px;
  font-size: .74rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--line); white-space: nowrap; font-weight: 600;
}
td { padding: 15px 18px; border-bottom: 1px solid rgba(255,255,255,.05); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .22s var(--ease); }
tbody tr:hover { background: rgba(255,255,255,.028); }
td .sub { display: block; color: var(--muted); font-size: .85rem; }
td .actions { display: flex; gap: 7px; justify-content: flex-end; }
.nowrap { white-space: nowrap; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 20px;
  font-size: .78rem; font-weight: 600; letter-spacing: .04em;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ny { background: rgba(27,107,255,.15); color: var(--blue-light); }
.badge.bekraftad { background: rgba(255,165,2,.15); color: var(--amber); }
.badge.klar { background: rgba(46,213,115,.15); color: var(--green); }
.badge.avbokad { background: rgba(255,71,87,.14); color: #FF8892; }
.badge.gray { background: rgba(255,255,255,.07); color: var(--muted); }

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty svg { width: 42px; height: 42px; margin: 0 auto 14px; opacity: .4; }

/* Formulär */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
.field--row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field label { font-size: .76rem; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea {
  background: rgba(255,255,255,.04); border: 1px solid var(--line);
  border-radius: 9px; padding: 12px 14px; font-size: .96rem; width: 100%;
  transition: .22s var(--ease);
}
.field textarea { resize: vertical; min-height: 110px; font-family: inherit; }
.field select { appearance: none; cursor: pointer; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23C9A24A' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 16px; }
.field select option { background: #12161E; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: rgba(27,107,255,.6); background: rgba(27,107,255,.06);
  box-shadow: 0 0 0 3px rgba(27,107,255,.12);
}
.field small { color: var(--muted); font-size: .82rem; }
.field input[type="date"], .field input[type="time"] { color-scheme: dark; }

.switch { display: inline-flex; align-items: center; gap: 11px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i {
  width: 44px; height: 25px; border-radius: 20px; background: rgba(255,255,255,.11);
  position: relative; transition: .3s var(--ease); flex: none;
}
.switch i::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%;
  background: #8E97A8; transition: .3s var(--ease);
}
.switch input:checked + i { background: rgba(46,213,115,.28); }
.switch input:checked + i::after { left: 22px; background: var(--green); }
.switch span { font-size: .92rem; }

/* Modal */
.modal {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(4,5,7,.8); backdrop-filter: blur(8px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 20px; overflow-y: auto;
  opacity: 0; visibility: hidden; transition: .3s var(--ease);
}
.modal.open { opacity: 1; visibility: visible; }
.modal__box {
  width: min(680px,100%);
  background: linear-gradient(168deg,#141821,#0A0D12);
  border-radius: 16px;
  box-shadow: 0 44px 100px -40px #000, inset 0 0 0 1px var(--line-2);
  transform: translateY(20px) scale(.98); transition: .35s var(--ease);
}
.modal.open .modal__box { transform: none; }
.modal__head { display: flex; align-items: center; gap: 14px; padding: 22px 26px; border-bottom: 1px solid var(--line); }
.modal__head h2 { font-size: 1.24rem; }
.modal__head button { margin-left: auto; }
.modal__body { padding: 26px; }
.modal__foot { display: flex; gap: 12px; justify-content: flex-end; padding: 20px 26px; border-top: 1px solid var(--line); }

/* Ikonväljare */
.iconpick { display: grid; grid-template-columns: repeat(auto-fill,minmax(56px,1fr)); gap: 8px; max-height: 180px; overflow-y: auto; padding: 4px; }
.iconpick button {
  aspect-ratio: 1; border-radius: 9px; display: grid; place-items: center;
  box-shadow: inset 0 0 0 1px var(--line); color: var(--text-soft); transition: .2s var(--ease);
}
.iconpick button svg { width: 21px; height: 21px; }
.iconpick button:hover { box-shadow: inset 0 0 0 1px var(--line-2); color: #fff; }
.iconpick button.sel { background: rgba(201,162,74,.16); box-shadow: inset 0 0 0 1.5px var(--gold); color: var(--gold-light); }

/* Galleri i admin */
.gal { display: grid; grid-template-columns: repeat(auto-fill,minmax(190px,1fr)); gap: 16px; }
.gal__item { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); background: var(--panel); }
.gal__item img { width: 100%; height: 145px; object-fit: cover; }
.gal__cap { padding: 12px 14px; font-size: .88rem; color: var(--text-soft); }
.gal__acts { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; }
.gal__acts button { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: rgba(6,7,10,.78); backdrop-filter: blur(6px); box-shadow: inset 0 0 0 1px var(--line-2); }
.gal__acts button svg { width: 15px; height: 15px; }
.gal__acts button:hover { background: var(--red); }
.gal__hidden { position: absolute; inset: 0; background: rgba(6,7,10,.62); display: grid; place-items: center; font-size: .8rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); pointer-events: none; }

.drop {
  border: 1.5px dashed var(--line-2); border-radius: var(--radius);
  padding: 34px; text-align: center; color: var(--muted);
  transition: .25s var(--ease); cursor: pointer;
}
.drop:hover, .drop.over { border-color: var(--gold); background: rgba(201,162,74,.05); color: var(--gold-light); }
.drop svg { width: 30px; height: 30px; margin: 0 auto 12px; }

/* Öppettider */
.hourrow { display: grid; grid-template-columns: 130px 1fr 1fr 1.4fr 130px; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.hourrow:last-child { border-bottom: 0; }
.hourrow b { font-family: var(--font-display); font-style: italic; font-size: 1.05rem; }
.hourrow input { background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; width: 100%; color-scheme: dark; }
.hourrow input:focus { outline: none; border-color: rgba(27,107,255,.6); }

/* Toast */
.toasts { position: fixed; right: 24px; bottom: 24px; z-index: 900; display: grid; gap: 10px; width: min(360px,90vw); }
.toast {
  display: flex; gap: 12px; padding: 14px 18px; border-radius: 11px;
  background: rgba(18,22,30,.97); backdrop-filter: blur(12px);
  box-shadow: 0 26px 60px -26px #000, inset 0 0 0 1px var(--line-2);
  font-size: .93rem; animation: tin .4s var(--ease);
}
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--green); }
.toast.err { box-shadow: 0 26px 60px -26px #000, inset 0 0 0 1px rgba(255,71,87,.45); }
.toast.err svg { color: #FF8892; }
@keyframes tin { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

.filterbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filterbar .chip {
  padding: 8px 16px; border-radius: 20px; font-size: .87rem; font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); transition: .22s var(--ease);
}
.filterbar .chip:hover { color: var(--text); }
.filterbar .chip.active { background: var(--gold-grad); color: #141009; box-shadow: none; }
.search {
  display: flex; align-items: center; gap: 9px; padding: 9px 14px; border-radius: 9px;
  background: rgba(255,255,255,.04); box-shadow: inset 0 0 0 1px var(--line); min-width: 220px;
}
.search svg { width: 16px; height: 16px; color: var(--muted); }
.search input { background: none; border: 0; outline: none; width: 100%; font-size: .92rem; }

.detail { display: grid; gap: 14px; }
.detail__row { display: grid; grid-template-columns: 150px 1fr; gap: 14px; padding-bottom: 12px; border-bottom: 1px solid rgba(255,255,255,.05); }
.detail__row:last-child { border-bottom: 0; }
.detail__row b { font-size: .76rem; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); font-weight: 600; font-family: var(--font); font-style: normal; }

.helpbox {
  display: flex; gap: 14px; padding: 16px 20px; border-radius: var(--radius);
  background: rgba(27,107,255,.07); box-shadow: inset 0 0 0 1px rgba(27,107,255,.2);
  font-size: .91rem; color: var(--text-soft); margin-bottom: 20px;
}
.helpbox svg { width: 19px; height: 19px; color: var(--blue-light); flex: none; margin-top: 2px; }

.sectiontitle { font-size: 1.05rem; margin: 30px 0 16px; color: var(--gold-light); }
.sectiontitle:first-child { margin-top: 0; }

/* Responsiv */
@media (max-width: 1100px) {
  .grid--4 { grid-template-columns: repeat(2,1fr); }
  .grid--3 { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 900px) {
  .app.show { grid-template-columns: 1fr; }
  .side {
    position: fixed; left: 0; top: 0; bottom: 0; width: 280px; height: 100vh;
    transform: translateX(-100%); transition: transform .35s var(--ease);
    box-shadow: 30px 0 80px -40px #000;
  }
  .side.open { transform: none; }
  .burger { display: grid; place-items: center; }
  .content { padding: 20px 16px; }
  .topbar { padding: 14px 16px; }
  .field--row { grid-template-columns: 1fr; }
  .grid--4, .grid--3, .grid--2 { grid-template-columns: 1fr; }
  .hourrow { grid-template-columns: 1fr 1fr; }
  .hourrow b { grid-column: 1 / -1; }
  .backdrop { position: fixed; inset: 0; background: rgba(4,5,7,.7); z-index: 45; }
}
