/* =========================================================================
   Administration — desktop and tablet first.
   Dense tables, hairline rules, a dark rail. Reads as a back office, not a
   second copy of the customer POS.
   ========================================================================= */

.admin {
  display: flex;
  min-height: 100dvh;
  background: var(--shelf);
}

/* ------------------------------------------------------------------- rail */
.rail {
  position: fixed;
  z-index: 60;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--admin-rail);
  display: flex;
  flex-direction: column;
  background: var(--ink);
  color: rgba(255, 255, 255, 0.78);
  transform: translateX(-100%);
  transition: transform var(--t-med);
}
.rail.is-open {
  transform: none;
}
@media (min-width: 960px) {
  .rail {
    transform: none;
  }
}
.rail__brand {
  padding: var(--s5) var(--s5) var(--s5);
}
.rail__name {
  display: block;
  margin-bottom: 3px;
  line-height: 1.15;
  color: #fff;
  font-variation-settings: "wdth" 112, "wght" 800;
  font-size: var(--text-md);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}
.rail__sub {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.62);
}
.rail__nav {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--s3) var(--s5);
}
.rail__group {
  margin-top: var(--s5);
  padding: 0 var(--s2) var(--s2);
  font-size: var(--text-2xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.52);
}
.rail__link {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 38px;
  padding: 0 var(--s3);
  border-radius: var(--r-md);
  font-size: var(--text-md);
  font-weight: 550;
}
.rail__link:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}
.rail__link.is-on {
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--ticket);
}
.rail__foot {
  padding: var(--s4) var(--s5);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: var(--text-sm);
}
.rail__user {
  color: #fff;
  font-weight: 600;
}
.rail__role {
  color: rgba(255, 255, 255, 0.5);
  font-size: var(--text-xs);
  text-transform: capitalize;
}
.rail__scrim {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(14, 31, 25, 0.45);
}
@media (min-width: 960px) {
  .rail__scrim {
    display: none;
  }
}

/* ------------------------------------------------------------------- main */
.admin__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
@media (min-width: 960px) {
  .admin__main {
    margin-left: var(--admin-rail);
  }
}

.admin-top {
  position: sticky;
  top: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 68px;
  padding: var(--s4) var(--s5);
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}
.admin-top__title {
  font-variation-settings: "wdth" 106, "wght" 750;
  font-size: var(--text-xl);
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.admin-top__sub {
  display: block;
  margin-top: 3px;
  font-size: var(--text-xs);
  font-weight: 400;
  line-height: 1.35;
  color: var(--ink-60);
  letter-spacing: 0;
}
.admin-burger {
  display: inline-flex;
}
@media (min-width: 960px) {
  .admin-burger {
    display: none;
  }
}

.admin-body {
  flex: 1;
  padding: var(--s5);
  max-width: var(--shell-max);
  width: 100%;
  /* Without this, a wide table sets the column's minimum size and the whole
     page scrolls sideways on a phone instead of the table scrolling. */
  min-width: 0;
}
.admin-body .table-wrap {
  max-width: 100%;
  /* Keeps a wide table's overflow inside its own scroller instead of letting
     it reach the root and scroll the whole page sideways on a phone. */
  contain: paint;
}
@media (min-width: 1180px) {
  .admin-body {
    padding: var(--s6);
  }
}

/* ------------------------------------------------------------- stat tiles */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: var(--s3);
  margin-bottom: var(--s5);
}
.tile {
  padding: var(--s4);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
}
.tile__k {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-2xs);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-60);
}
.tile__v {
  margin-top: var(--s2);
  font-variation-settings: "wdth" 110, "wght" 800;
  font-size: var(--text-2xl);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.tile__note {
  margin-top: 2px;
  font-size: var(--text-xs);
  color: var(--ink-60);
}
.tile--action {
  border-left: 3px solid var(--ticket);
}
.tile--alert {
  border-left: 3px solid var(--alert);
}
.tile--good {
  border-left: 3px solid var(--bottle);
}

/* -------------------------------------------------------------- bar chart */
.chart {
  display: flex;
  align-items: flex-end;
  gap: var(--s3);
  height: 180px;
  padding-top: var(--s4);
}
.chart__col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s2);
  height: 100%;
  justify-content: flex-end;
}
.chart__bar {
  width: 100%;
  max-width: 46px;
  background: var(--ink);
  border-radius: 2px 2px 0 0;
  transition: height var(--t-med);
}
.chart__bar--today {
  background: var(--ticket);
}
.chart__label {
  font-size: var(--text-xs);
  color: var(--ink-60);
}
.chart__value {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
}

/* ------------------------------------------------------------------ grids */
.admin-grid {
  display: grid;
  gap: var(--s4);
}
@media (min-width: 1100px) {
  .admin-grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-grid--side {
    grid-template-columns: minmax(0, 1fr) 340px;
    align-items: start;
  }
  .admin-grid--form {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    align-items: start;
  }
}

/* ---------------------------------------------------------------- toolbar */
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s3);
  margin-bottom: var(--s4);
}
.toolbar__search {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 340px;
}
.toolbar__search svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-40);
  pointer-events: none;
}
.toolbar__search input {
  width: 100%;
  min-height: 40px;
  padding: 0 var(--s3) 0 36px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-md);
  background: var(--surface);
}
.toolbar select {
  min-height: 40px;
  padding: 0 var(--s8) 0 var(--s3);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-md);
  background-color: var(--surface);
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-60) 50%),
    linear-gradient(135deg, var(--ink-60) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  font-size: var(--text-md);
}

/* ----------------------------------------------------------- table extras */
.tcell {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-width: 0;
}
.tcell__art {
  flex: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 34px;
  height: 42px;
  background: var(--surface-sunk);
  border-radius: var(--r-sm);
}
/* Both are spans inside one flex child — they have to be blocks, or the sub
   line runs on from the end of the name. */
.tcell__name {
  display: block;
  font-weight: 650;
  line-height: var(--lh-tight);
}
.tcell__sub {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--lh-tight);
  color: var(--ink-60);
}
.linkish {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--rule-strong);
}
.linkish:hover {
  text-decoration-color: var(--ink);
}

/* --------------------------------------------------------- promotion rows */
.promo-row {
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr) auto;
  gap: var(--s4);
  align-items: center;
  padding: var(--s4);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
}
/* tickets vary in width — pin the column so every title starts in line */
.promo-row > .ticket {
  justify-self: start;
}
@media (max-width: 720px) {
  .promo-row {
    grid-template-columns: minmax(0, 1fr);
  }
}
.promo-row + .promo-row {
  margin-top: var(--s3);
}
.promo-row__when {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-60);
}
.promo-row__name {
  font-variation-settings: "wdth" 104, "wght" 700;
  font-size: var(--text-lg);
}
.promo-row__actions {
  display: flex;
  gap: var(--s2);
  align-items: center;
}

/* schedule strip: shows where a promotion sits in the trading weeks */
.sched {
  display: flex;
  height: 8px;
  margin-top: var(--s2);
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface-sunk);
  border: 1px solid var(--rule);
}
.sched__fill {
  background: var(--ticket);
}
.sched__fill--scheduled {
  background: var(--info);
}
.sched__fill--past {
  background: var(--rule-strong);
}

/* ------------------------------------------------------------- form pages */
.form-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: var(--s5);
}
.form-card + .form-card {
  margin-top: var(--s4);
}
.form-card__title {
  font-variation-settings: "wdth" 104, "wght" 700;
  font-size: var(--text-lg);
  margin-bottom: var(--s4);
}
.form-foot {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: var(--s3);
  align-items: center;
  margin-top: var(--s5);
  padding: var(--s4) var(--s5);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-raise);
}

.picker-list {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
}
.picker-item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) var(--s3);
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
}
.picker-item:last-child {
  border-bottom: 0;
}
.picker-item:hover {
  background: var(--surface-sunk);
}
.picker-item input {
  width: 18px;
  height: 18px;
  accent-color: var(--ink);
}

/* preview of how a promotion will look to a customer */
.promo-preview {
  padding: var(--s4);
  background: var(--ink);
  border-radius: var(--r-md);
  color: #fff;
}
.promo-preview__label {
  font-size: var(--text-2xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: var(--s3);
}

/* ------------------------------------------------------------- report kpi */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--s3);
  margin-bottom: var(--s4);
}

/* settings navigation */
.set-nav {
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
  margin-bottom: var(--s5);
}

@media print {
  .rail,
  .admin-top,
  .staff-bar,
  .cart-bar,
  .pos-head,
  .toolbar,
  .form-foot {
    display: none !important;
  }
  .admin__main {
    margin-left: 0;
  }
  body {
    background: #fff;
  }
}
