/* The admin panel's Manager (S7, rebuilt in A3). Phone first, the menu
   page's tokens (styles/base.css) and the same ink state pieces. Big and
   plain: text 18px, buttons and boxes at least 56px tall. Desktop just gets
   a wider column. */

.admin {
  min-height: 100dvh;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1.125rem;
  padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}

/* ── Header ── */

.admin-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--header-h);
  padding: 8px var(--gutter);
  background: var(--brand-teal);
  color: #fff;
}

.admin-head__title {
  font-weight: 700;
  font-size: 1rem;
}

.admin-head__brand {
  font-family: var(--font-sign);
  font-weight: 400;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.admin-head .btn--quiet {
  border-color: rgb(255 255 255 / 70%);
  background: transparent;
  box-shadow: none;
  color: #fff;
}

.admin-head__back {
  flex: none;
}

.btn:focus-visible,
.mg-tile:focus-visible,
.mg-price:focus-visible,
.mg-price-big:focus-visible,
.mg-art-choice:focus-visible,
.mg-item__name:focus-visible,
.pad__key:focus-visible,
.choice-field__radio:focus-visible + span,
.day-picker__check:focus-visible + span,
.field__input:focus-visible,
.check:focus-visible,
.field__switch:focus-visible {
  outline: 3px solid var(--brand-rule);
  outline-offset: 2px;
}

/* ── The notice line ── */

.admin-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 12px var(--gutter) 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--brand-tint);
  color: var(--brand-teal);
  font-weight: 600;
  line-height: 1.4;
}

/* No red: the words carry the meaning; a stronger edge marks a problem. */
.admin-notice--bad {
  background: var(--card);
  border: 2px solid var(--ink);
  color: var(--ink);
}

/* ── Screens ── */

.admin-main {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 16px var(--gutter) 24px;
}

.admin-main:focus {
  outline: none;
}

.admin-main--gate {
  display: grid;
  place-items: center;
  min-height: calc(100dvh - var(--header-h));
}

.screen-title {
  margin-bottom: 12px;
  font-family: var(--font-sign);
  font-weight: 400;
  font-size: 1.9rem;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--brand-teal);
}

.screen {
  display: grid;
  gap: 16px;
}

.screen-note {
  color: var(--ink-2);
  line-height: 1.5;
}

.screen-errors {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--card);
}

.screen-errors__title {
  font-weight: 800;
}

.screen-errors__list {
  margin-top: 6px;
  padding-left: 1.2em;
  list-style: disc;
  line-height: 1.5;
}

.panel-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.panel-card__title {
  font-size: 1.3rem;
  font-weight: 800;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--brand-rule);
}

/* ── Fields ── */

.field {
  display: grid;
  gap: 6px;
}

.field--inline {
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 10px;
}

.field--inline .field__hint,
.field--inline .field__error {
  grid-column: 2;
}

.field__label {
  font-weight: 700;
  font-size: 1.125rem;
}

.field__input {
  width: 100%;
  min-height: 56px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 1.125rem; /* 16px or more keeps phones from zooming in */
}

textarea.field__input {
  resize: vertical;
}

.field__hint {
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.4;
}

.field__error {
  color: var(--ink);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.4;
}

.field__error::before {
  content: "! ";
  color: var(--brand-teal);
}

.field--error > .field__input,
.field-group.field--error {
  border-color: var(--ink);
  border-width: 2px;
}

.field-group {
  display: grid;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}

.field-group > legend {
  padding: 0 4px;
}

/* A checkbox drawn as a switch. */
.field__switch {
  appearance: none;
  position: relative;
  flex: none;
  width: 60px;
  height: 36px;
  margin: 0;
  border-radius: 999px;
  background: var(--line);
  cursor: pointer;
  transition: background 0.15s ease;
}

.field__switch::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 25%);
  transition: transform 0.15s ease;
}

.field__switch:checked {
  background: var(--brand-teal);
}

.field__switch:checked::after {
  transform: translateX(24px);
}

.check {
  flex: none;
  width: 28px;
  height: 28px;
  margin: 0;
  accent-color: var(--brand-teal);
}

.check-groups {
  gap: 10px;
}

.check-group {
  display: grid;
  gap: 6px;
}

.check-group__title {
  color: var(--brand-teal-2);
  font-weight: 700;
  font-size: 0.9rem;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
}

.day-picker {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.day-picker__day {
  position: relative;
  display: block;
}

/* The box is hidden under its day; the day itself is the big button. */
.day-picker__check,
.choice-field__radio {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.day-picker__day > span {
  display: grid;
  place-items: center;
  min-height: 56px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--card);
  font-weight: 800;
}

.day-picker__check:checked + span {
  background: var(--brand-teal);
  border-color: var(--brand-teal);
  color: #fff;
}

.choice-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.choice-field > legend {
  margin-bottom: 6px;
}

.choice-field__options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.choice-field__option {
  position: relative;
  display: block;
}

.choice-field__option > span {
  display: grid;
  place-items: center;
  min-height: 56px;
  padding: 8px 12px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--card);
  font-weight: 800;
  text-align: center;
}

.choice-field__radio:checked + span {
  background: var(--brand-teal);
  border-color: var(--brand-teal);
  color: #fff;
}

.choice-field.field--error .choice-field__options {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
  border-radius: 12px;
}

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  padding: 10px 20px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--brand-teal);
  box-shadow: 0 4px 0 var(--ink);
  color: #fff;
  font: inherit;
  font-size: 1.125rem;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}

.btn:disabled {
  opacity: 0.45;
  box-shadow: none;
  cursor: default;
}

.btn--quiet {
  background: var(--card);
  color: var(--ink);
}

.btn--small {
  min-height: 48px;
  padding: 6px 16px;
  font-size: 1rem;
}

.btn--armed {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

/* ── Lists ── */

.option-list,
.hours-list,
.change-list,
.backup-list {
  display: grid;
  gap: 12px;
}

.option-row,
.backup-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}

.backup-row__title {
  font-weight: 800;
}

.hours-row__times {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  gap: 8px;
}

.adder {
  display: grid;
  gap: 6px;
}

.adder__row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.period-card {
  display: grid;
  gap: 12px;
}

.period-card + .period-card {
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

/* ── Manager home: big tiles, each saying what's set now ── */

.mg-tiles {
  display: grid;
  gap: 12px;
}

.mg-tile {
  display: grid;
  gap: 4px;
  min-height: 72px;
  padding: 14px 18px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 4px 0 var(--ink);
  color: var(--ink);
  text-decoration: none;
}

.mg-tile:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}

.mg-tile__label {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--brand-teal);
}

.mg-tile__now {
  color: var(--ink-2);
  line-height: 1.35;
}

.mg-tiles--small .mg-tile {
  min-height: 56px;
  padding: 10px 16px;
  box-shadow: none;
  border-style: dashed;
}

.mg-tiles--small .mg-tile__label {
  font-size: 1.125rem;
}

.mg-more {
  margin-top: 8px;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--ink-2);
}

.mg-summary {
  font-weight: 700;
  line-height: 1.4;
}

.mg-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}

.mg-filter__count {
  font-weight: 700;
}

/* ── Items and prices ── */

.mg-group {
  display: grid;
  gap: 12px;
}

.mg-group__title {
  font-family: var(--font-sign);
  font-weight: 400;
  font-size: 1.5rem;
  text-transform: uppercase;
  color: var(--brand-teal);
}

.mg-section {
  display: grid;
  gap: 8px;
}

.mg-section__title {
  font-size: 1.1rem;
  font-weight: 800;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--brand-rule);
}

.mg-list {
  display: grid;
  gap: 10px;
}

.mg-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: start;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.mg-item__art {
  display: block;
  width: 56px;
  height: 56px;
}

.mg-item__art svg,
.mg-drawing__art svg,
.mg-art-choice__art svg {
  display: block;
  width: 100%;
  height: 100%;
}

.mg-item__main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.mg-item__name {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: var(--brand-rule);
  text-underline-offset: 4px;
}

.mg-badge {
  justify-self: start;
  padding: 2px 10px;
  border: 1.5px dashed var(--ink);
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 700;
}

.mg-prices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mg-price,
.mg-price-big {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 8px 16px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 3px 0 var(--ink);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.mg-price:active,
.mg-price-big:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}

.mg-price__label,
.mg-price-big__label {
  color: var(--ink-2);
  font-weight: 600;
}

.mg-price__amount,
.mg-price-big__amount {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* No price yet: dashed, so the gaps stand out. */
.mg-price--none,
.mg-price-big--none {
  border-style: dashed;
  box-shadow: none;
}

.mg-price--none .mg-price__amount,
.mg-price-big--none .mg-price-big__amount {
  color: var(--ink-2);
}

.mg-price-big {
  justify-self: start;
  min-height: 64px;
  font-size: 1.4rem;
}

.mg-drawing {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mg-drawing__art {
  display: block;
  flex: none;
  width: 96px;
  height: 96px;
}

.mg-drawing__name {
  font-weight: 700;
  text-transform: capitalize;
}

.mg-danger {
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.field--error.item-whole {
  padding: 12px 14px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
}

/* The drawing picker and the case picks. */
.mg-art-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.mg-art-choice {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 6px;
  min-height: 56px;
  padding: 8px 6px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-transform: capitalize;
  cursor: pointer;
}

.mg-art-choice[aria-pressed="true"] {
  border-color: var(--brand-teal);
  background: var(--brand-tint);
}

.mg-art-choice__art {
  display: block;
  width: 64px;
  height: 64px;
}

.mg-art-choice--none {
  align-content: center;
  border-style: dashed;
}

.case-picks {
  margin-bottom: 0;
}

.case-picks .mg-art-choice {
  text-transform: none;
}

/* ── The price pad ── */

.td-sheet--pad {
  width: min(100%, 400px);
}

.pad {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.pad__display {
  display: block;
  padding: 12px 16px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--page);
  font-size: 2.4rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.pad__display--none {
  color: var(--ink-2);
  font-size: 1.6rem;
}

.pad__hint {
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.4;
}

.pad__keys {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.pad__key {
  min-height: 64px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 3px 0 var(--ink);
  color: var(--ink);
  font: inherit;
  font-size: 1.6rem;
  font-weight: 800;
  cursor: pointer;
}

.pad__key:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}

.pad__key[data-key="clear"] {
  font-size: 1.1rem;
}

/* ── Spanish ── */

.es-list {
  display: grid;
  gap: 16px;
}

.es-line {
  display: grid;
  gap: 8px;
}

.es-line + .es-line {
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.es-line__en {
  line-height: 1.45;
}

.es-line__tag {
  display: inline-block;
  margin-right: 8px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--brand-tint);
  color: var(--brand-teal);
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
}

/* ── Donut case spots ── */

.case-list {
  display: grid;
  gap: 10px;
}

.case-spot {
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}

.case-spot__name {
  font-weight: 800;
}

.case-spot__where {
  color: var(--ink-2);
  font-size: 1rem;
}

.case-spot__tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1 / -1;
}

@media (prefers-reduced-motion: reduce) {
  .btn:active,
  .mg-tile:active,
  .mg-price:active,
  .mg-price-big:active,
  .pad__key:active {
    transform: none;
  }
}

/* ── The save bar ── */

.save-bar {
  position: fixed;
  inset: auto 0 0;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--card);
  border-top: 2px solid var(--brand-rule);
  box-shadow: 0 -4px 16px rgb(0 0 0 / 8%);
}

.save-bar[hidden],
[hidden] {
  display: none !important;
}

.save-bar__note {
  font-weight: 700;
}

.save-bar__actions {
  display: flex;
  gap: 8px;
}

/* ── The gate ── */

.gate {
  display: grid;
  gap: 14px;
  width: min(100%, 420px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}

.gate__title {
  font-family: var(--font-sign);
  font-weight: 400;
  font-size: 1.8rem;
  text-transform: uppercase;
  color: var(--brand-teal);
}

.gate__lead {
  color: var(--ink-2);
  line-height: 1.5;
}

.gate__message {
  font-weight: 700;
  line-height: 1.4;
}

.gate__message--ok {
  color: var(--brand-teal);
}

.admin-noscript {
  padding: 24px var(--gutter);
}

/* ── State pieces (the same drawings as the menu page) ── */

.state-piece {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 16px 8px;
  text-align: center;
}

.state-piece__art {
  width: min(100%, 320px);
}

.state-piece--empty .state-piece__art {
  width: min(100%, 240px);
}

.state-piece__words {
  display: grid;
  gap: 6px;
  justify-items: center;
  max-width: 30rem;
}

.state-piece__title {
  font-size: 1.1rem;
  font-weight: 800;
}

.state-piece__body {
  color: var(--ink-2);
  line-height: 1.5;
}

.state-piece .btn {
  margin-top: 6px;
}

.down-art {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

/* Server down: the cord drops and the plug swings once, then rests (as on the page). */
.down-art__cord {
  transform-box: view-box;
  transform-origin: 228px 114px;
  animation: admin-cord-drop 1.5s cubic-bezier(0.3, 0.7, 0.4, 1) both;
}

@keyframes admin-cord-drop {
  0% { transform: translateY(-10px) rotate(-30deg); }
  38% { transform: translateY(0) rotate(11deg); }
  62% { transform: rotate(-5deg); }
  82% { transform: rotate(2deg); }
  100% { transform: rotate(0deg); }
}

/* Offline: the Wi-Fi waves fade once, outer last, and rest faint. */
.down-art__wave {
  opacity: 0.28;
  animation: admin-wave-fade 1.4s ease-out both;
}

.down-art__wave--2 { animation-delay: 0.25s; }
.down-art__wave--3 { animation-delay: 0.5s; }

@keyframes admin-wave-fade {
  0%, 30% { opacity: 1; }
  100% { opacity: 0.28; }
}

/* Empty: the blank card settles onto the counter once (about 0.9 s), then rests. */
.down-art__card {
  transform-box: view-box;
  transform-origin: 226px 172px;
  animation: admin-card-settle 0.9s cubic-bezier(0.3, 0.7, 0.4, 1) both;
}

@keyframes admin-card-settle {
  0% { transform: translateY(-14px) rotate(-7deg); opacity: 0; }
  45% { transform: translateY(0) rotate(3deg); opacity: 1; }
  72% { transform: rotate(-1.2deg); }
  100% { transform: rotate(0deg); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .down-art__cord,
  .down-art__wave,
  .down-art__card {
    animation: none;
  }

  .field__switch,
  .field__switch::after {
    transition: none;
  }
}

@media (min-width: 720px) {
  .option-row {
    grid-template-columns: 1fr 1fr;
  }

  .option-row > :nth-child(n + 3) {
    grid-column: 1 / -1;
  }
}

/* ── A4: picture choices (the sign's picture), the hold card ── */

.pic-choice .choice-field__options {
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
}

.pic-choice .choice-field__option > span {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 120px;
  padding: 10px 8px;
  text-align: center;
}

.pic-choice__art {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
}

.pic-choice__art svg {
  width: 100%;
  height: 100%;
}

.pic-choice__art--none {
  font-size: 2.25rem;
  line-height: 1;
}

.pic-choice__text {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
}

.sign-hold__status {
  margin-bottom: 12px;
}

.sign-hold__how-long {
  display: grid;
  gap: 8px;
}

.sign-hold__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sign-hold > .btn {
  margin-top: 12px;
}

.backup-list + .btn {
  margin-top: 8px;
}
