/* =====================================================================
   Fast Gadget — admin.css
   Business owner panel. Same tokens and same tactile language as the
   shop: leather sidebar, engraved plates, metal table headers.
   ===================================================================== */

.admin-body { min-height: 100dvh; }

/* ---------- Login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem; }
.login__panel { width: min(400px, 100%); text-align: center; }
.login__bolt {
  display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 1rem;
  border-radius: 16px; background: linear-gradient(180deg, #3b3128, #221a13);
  box-shadow: var(--lift-2), inset 0 1px 0 rgba(255,255,255,.18);
}
.login__bolt svg { filter: drop-shadow(0 0 6px rgba(255,176,32,.8)); }
.login h1 { font-size: 1.5rem; letter-spacing: .05em; margin-bottom: .1rem; }
.login h1 strong { color: var(--ink-900); }
.login h1 em { font-style: normal; color: var(--amber-600); }
.login__sub {
  font-size: .7rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-300); margin-bottom: 1.6rem;
}
.login .field { text-align: left; }
.login__back { display: inline-block; margin-top: 1rem; font-size: .84rem; color: var(--ink-500); text-decoration: none; }
.login__back:hover { color: var(--amber-600); }

/* ---------- Shell ---------- */
.admin { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100dvh; }

.sidebar {
  display: flex; flex-direction: column; gap: 1.2rem;
  padding: 1.2rem 1rem;
  position: sticky; top: 0; height: 100dvh;
  background-image: var(--noise), linear-gradient(180deg, #33261e, #16110d);
  background-blend-mode: soft-light, normal;
  border-right: 3px solid #4d3b2d;
  box-shadow: 6px 0 24px rgba(0,0,0,.35);
}
.sidebar__brand {
  display: flex; align-items: center; gap: .6rem; text-decoration: none; color: #f3ece1;
  padding-bottom: 1rem; border-bottom: 1px solid rgba(255,255,255,.10);
}
.sidebar__brand strong, .sidebar__brand em {
  font-size: 1.05rem; font-weight: 800; font-style: normal; letter-spacing: .04em;
}
.sidebar__brand em { color: var(--amber-400); }
.sidebar__brand small {
  display: block; font-size: .58rem; letter-spacing: .24em; text-transform: uppercase; color: #8b7f72;
}
.sidebar__brand .brand__bolt { width: 34px; height: 34px; border-radius: 10px; }

.sidenav { display: grid; gap: .35rem; }
.sidenav__item {
  display: flex; align-items: center; gap: .6rem; width: 100%; cursor: pointer;
  padding: .6rem .8rem; border-radius: 10px; text-align: left;
  font-size: .9rem; font-weight: 600; color: #c3b6a7;
  border: 1px solid transparent; background: transparent;
  transition: all .14s var(--ease);
}
.sidenav__item svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linejoin: round; flex: none; }
.sidenav__item:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidenav__item.is-active {
  color: #3d2500;
  background: linear-gradient(180deg, #ffd76a, #e78a00);
  border-color: #a35f00;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), inset 0 -2px 4px rgba(0,0,0,.2), var(--lift-1);
}
.sidenav__badge {
  margin-left: auto; padding: .05rem .45rem; border-radius: 999px;
  font-size: .72rem; font-weight: 800;
  background: rgba(0,0,0,.28); color: inherit;
}
.sidenav__item.is-active .sidenav__badge { background: rgba(0,0,0,.16); }

.sidebar__foot { margin-top: auto; display: grid; gap: .5rem; }

.admin__main { padding: clamp(1.2rem, 3vw, 2.2rem); min-width: 0; }

.tab { display: none; }
.tab.is-active { display: block; animation: fade .2s var(--ease); }

.tabhead {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; justify-content: space-between;
  margin-bottom: 1.4rem;
}
.tabhead h1 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin: 0 0 .2rem; }
.tabhead p { margin: 0; color: var(--ink-500); font-size: .9rem; }
.tabhead__tools { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }

.searchinput {
  padding: .55rem 1rem; border-radius: 999px; min-width: 220px;
  border: 1px solid #b6aa95; color: var(--ink-900);
  background: linear-gradient(180deg, #e7e0d1, #fffdf8);
  box-shadow: var(--deboss);
}
.searchinput:focus { outline: none; border-color: var(--teal-500); box-shadow: var(--deboss), 0 0 0 3px rgba(47,208,197,.28); }

/* ---------- Panels reused from checkout ---------- */
.panel {
  padding: clamp(1.1rem, 2.4vw, 1.6rem);
  border-radius: var(--radius-m);
  background: linear-gradient(180deg, #fffefb 0%, #f5efe3 68%, #e9e0cf 100%);
  border: 1px solid #cfc3ad;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.95), var(--lift-2);
  margin-bottom: 1.4rem;
}
.panel__title { font-size: 1.05rem; margin: 0 0 1rem; }
.panel__title--rule {
  margin-top: 1.8rem; padding-top: 1.2rem; border-top: 1px solid #d9cdb7;
}
.hint-inline { font-weight: 400; color: var(--ink-300); font-size: .76rem; }

/* ---------- Stat tiles ---------- */
.stats {
  display: grid; gap: 1rem; margin-bottom: 1.4rem;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.stat {
  position: relative; overflow: hidden; padding: 1.1rem 1.2rem;
  border-radius: var(--radius-m);
  background: linear-gradient(180deg, #fffefb, #ece3d2);
  border: 1px solid #cfc3ad;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.95), var(--lift-1);
}
.stat::before {
  content: ""; position: absolute; inset: 1px 1px auto 1px; height: 44%;
  border-radius: 14px 14px 60% 60% / 14px 14px 20% 20%;
  background: linear-gradient(180deg, rgba(255,255,255,.6), rgba(255,255,255,0));
}
.stat__label {
  margin: 0 0 .4rem; font-size: .68rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-300);
}
.stat__value { margin: 0; font-size: 1.65rem; font-weight: 800; color: var(--ink-900); line-height: 1.1; }
.stat__note { margin: .3rem 0 0; font-size: .78rem; color: var(--ink-500); }
.stat--money .stat__value { color: var(--amber-600); }
.stat--alert .stat__value { color: #c0392b; }
.stat--good .stat__value { color: #14804a; }

.dash-grid { display: grid; gap: 1.4rem; grid-template-columns: minmax(0, 1.35fr) minmax(0, .65fr); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: 10px; }
.table { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 560px; }
.table thead th {
  text-align: left; padding: .6rem .75rem; white-space: nowrap;
  font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: #4b545d;
  background: linear-gradient(180deg, #fdfdfe, #dbe0e6 55%, #c8cfd6);
  border-bottom: 1px solid #aeb7c0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}
.table thead th:first-child { border-radius: 8px 0 0 0; }
.table thead th:last-child { border-radius: 0 8px 0 0; }
.table tbody td { padding: .6rem .75rem; border-bottom: 1px solid #ded2bc; vertical-align: middle; }
.table tbody tr:nth-child(odd) { background: rgba(255,255,255,.55); }
.table tbody tr:hover { background: rgba(255,215,106,.16); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .strong { font-weight: 700; color: var(--ink-900); }
.table .muted { color: var(--ink-500); font-size: .8rem; }
.table__actions { display: flex; gap: .35rem; justify-content: flex-end; }

.thumb {
  width: 40px; height: 40px; display: grid; place-items: center; padding: 4px;
  border-radius: 8px; background: linear-gradient(180deg, #f4f7fa, #d3dae1);
  box-shadow: inset 0 2px 4px rgba(0,0,0,.22);
}
.cellflex { display: flex; align-items: center; gap: .6rem; }

.emptyline { text-align: center; color: var(--ink-300); padding: 1.5rem 0 .5rem; margin: 0; }

/* ---------- Small buttons and pills ---------- */
.btn--sm { padding: .35rem .75rem; font-size: .8rem; }
.btn--danger { --btn-face-1: #ff9a86; --btn-face-2: #d63b2a; --btn-edge: #8f2115; --btn-ink: #3d0a04; }
.btn--danger { color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.25); }

.pillstat {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .18rem .6rem; border-radius: 999px;
  font-size: .74rem; font-weight: 700; white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}
.pillstat i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pillstat--Pending   { background: linear-gradient(180deg,#fff0c2,#ffd77a); color: #8a5b00; border: 1px solid #d9a520; }
.pillstat--Confirmed { background: linear-gradient(180deg,#dceeff,#b6d9ff); color: #17558f; border: 1px solid #7bacdf; }
.pillstat--Packed    { background: linear-gradient(180deg,#efe3ff,#d8c2ff); color: #4a2a8f; border: 1px solid #a98ada; }
.pillstat--Shipped   { background: linear-gradient(180deg,#d9f6f3,#b3ebe5); color: #0b6d67; border: 1px solid #6fc9c1; }
.pillstat--Delivered { background: linear-gradient(180deg,#dcf7e6,#b5eecb); color: #14804a; border: 1px solid #78ce9d; }
.pillstat--Cancelled { background: linear-gradient(180deg,#ffe0dc,#ffbdb5); color: #a3392c; border: 1px solid #e08b80; }

.paytag {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .78rem; color: var(--ink-700);
}
.paytag b {
  display: grid; place-items: center; min-width: 30px; height: 18px; padding: 0 4px;
  border-radius: 4px; font-size: .62rem; color: #fff; background: var(--pay, #5d666f);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}

.statusselect {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  padding: .3rem 1.6rem .3rem .7rem; border-radius: 999px;
  font-size: .78rem; font-weight: 700; color: var(--ink-900);
  border: 1px solid #b6aa95;
  background: linear-gradient(180deg, #e7e0d1, #fffdf8) no-repeat;
  box-shadow: var(--deboss);
}

/* ---------- Toggle switch ---------- */
.toggle { display: flex; align-items: center; gap: .7rem; margin-bottom: .9rem; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle__track {
  position: relative; width: 52px; height: 28px; flex: none; border-radius: 999px;
  background: linear-gradient(180deg, #cfc6b4, #e9e2d4);
  border: 1px solid #b6aa95;
  box-shadow: var(--deboss);
  transition: background .16s var(--ease);
}
.toggle__knob {
  position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #dfe4ea 60%, #b9c1c9);
  box-shadow: 0 1px 3px rgba(0,0,0,.35), inset 0 1px 0 #fff;
  transition: transform .16s var(--ease);
}
.toggle input:checked + .toggle__track {
  background: linear-gradient(180deg, #46e28a, #14804a);
  border-color: #0d6238;
}
.toggle input:checked + .toggle__track .toggle__knob { transform: translateX(24px); }
.toggle input:focus-visible + .toggle__track { outline: 3px solid var(--teal-500); outline-offset: 2px; }
.toggle__label { font-size: .9rem; font-weight: 600; color: var(--ink-700); }

.formbar {
  display: flex; flex-wrap: wrap; gap: .7rem; align-items: center;
  margin-top: 1.6rem; padding-top: 1.2rem; border-top: 1px solid #d9cdb7;
}

/* ---------- Order detail modal ---------- */
.odetail__head {
  display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; justify-content: space-between;
  margin-bottom: 1.2rem; padding-bottom: 1rem; border-bottom: 1px solid #d9cdb7;
}
.odetail__head h2 { margin: 0; font-size: 1.3rem; }
.odetail__head p { margin: .2rem 0 0; font-size: .82rem; color: var(--ink-500); }
.odetail__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin-bottom: 1.2rem; }
.odetail__block h3 {
  font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-300);
  margin: 0 0 .4rem;
}
.odetail__block p { margin: 0 0 .2rem; font-size: .87rem; }
.odetail__block .muted { color: var(--ink-500); }
.odetail__items { width: 100%; border-collapse: collapse; font-size: .87rem; margin-bottom: 1rem; }
.odetail__items td { padding: .45rem 0; border-bottom: 1px dashed #d9cdb7; }
.odetail__items td:last-child { text-align: right; font-weight: 700; }
.odetail__foot { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; }

@media (max-width: 1000px) {
  .dash-grid { grid-template-columns: 1fr; }
  .odetail__grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .admin { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row; flex-wrap: wrap;
    align-items: center; gap: .8rem; border-right: 0; border-bottom: 3px solid #4d3b2d;
  }
  .sidebar__brand { border: 0; padding: 0; }
  .sidenav { grid-auto-flow: column; grid-template-columns: none; overflow-x: auto; flex: 1; }
  .sidebar__foot { margin: 0; grid-auto-flow: column; }
  .sidenav__item { white-space: nowrap; }
}
