/*
 * KOrder styles · public/css/06-admin.css
 * Admin + office portal: login, shell, section nav, store switcher, panels, backup, printers, range.
 *
 * public/css/*.css used to be one public/styles.css. The files are cut from it in order
 * and index.html loads them in that same order, which is the CSS cascade order: do not
 * reorder the <link> tags, and add a rule to the file that owns its screen.
 * Map: public/css/README.md
 */
.admin-login-screen {
  display: grid;
  min-height: calc(100vh - 150px);
  place-items: center;
}

.admin-login-card {
  display: grid;
  width: min(420px, 100%);
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.96);
  box-shadow: var(--shadow);
}

.admin-login-card h2 {
  margin: 0;
  font-size: 26px;
}

.admin-login-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.admin-login-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.admin-page {
  display: grid;
  gap: 16px;
  max-width: 1440px;
  margin: 0 auto;
}

.admin-shell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(247, 246, 241, 0.95));
  box-shadow: var(--soft-shadow);
}

.admin-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.admin-back-button {
  flex: 0 0 auto;
}

.admin-title-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-shell-head h2 {
  margin: 0;
  font-size: 24px;
}

.admin-shell-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.admin-section-nav {
  position: sticky;
  top: 75px;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 6px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(12px);
}

.office-store-switcher {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(4, minmax(110px, 0.5fr)) auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--soft-shadow);
}

.office-store-switcher label,
.office-store-switcher div {
  display: grid;
  gap: 4px;
}

.office-store-switcher span,
.office-store-switcher label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.office-store-switcher strong {
  color: var(--ink);
  font-size: 20px;
}

.admin-section-tab {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.admin-section-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--graphite), #111317);
  box-shadow: 0 8px 16px rgba(32, 36, 42, 0.2);
}

.admin-section-body {
  display: grid;
  gap: 16px;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(330px, 0.9fr) minmax(0, 1.5fr);
  gap: 16px;
  max-width: 1380px;
  margin: 0 auto;
}

/* The panel sets the space between its blocks (gap), not each block (2026-11-17):
   blocks added later line up without their own margin. A section heading in the
   middle of a panel gets one extra step above it. Do not put margin-top/bottom on
   a direct child of .admin-panel — it is reset here (doubled class = wins over
   single-class block rules in later files). */
.admin-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 249, 245, 0.98));
}

.admin-panel.admin-panel > * {
  margin-top: 0;
  margin-bottom: 0;
}

.admin-panel.admin-panel > .admin-head:not(:first-child) {
  margin-top: 12px;
}

/* Form fields in admin panels: label text + input stay at the top of their cell.
   A taller neighbour (one with a hint line under its input) stretches the row, and
   without this the stretched cell pushed its input down (Store Name vs Store Code). */
.admin-panel .form-grid > label {
  align-content: start;
}

/* One control height in the ops screens: inputs are 42px (.field), so selects (46px)
   and small buttons (38px) match them; a row of input + select + button now lines up.
   Admin panels only — the guest tablet / crm keep their own sizes (02e, 04-hub). */
.admin-panel.admin-panel select {
  height: 42px;
  min-height: 42px;
  line-height: 40px;
}

.admin-panel.admin-panel .button.compact {
  min-height: 42px;
  white-space: nowrap;
}

/* Store hub table cards: a card next to a taller one stretched its Detail / Settle
   buttons to 46px; keep them 42px at the bottom of the card. */
.admin-panel.admin-panel .local-table-actions {
  align-items: end;
}

.admin-panel.admin-panel .category-order-input {
  height: 42px;
  min-height: 42px;
}

/* "No printers found yet" spans the printer grid instead of one 300px card slot. */
.local-printer-grid > .empty-state {
  grid-column: 1 / -1;
  min-height: 96px;
}

.admin-wide {
  grid-column: 1 / -1;
}

.admin-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.admin-head-actions {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-head h2 {
  margin: 0;
  font-size: 21px;
}

.admin-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.admin-backup-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.admin-backup-stats div,
.admin-backup-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
}

.admin-backup-stats div {
  display: grid;
  gap: 6px;
  padding: 14px;
}

.admin-backup-stats span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-backup-stats strong {
  font-size: 22px;
}

.admin-backup-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
}

.admin-backup-card strong {
  font-size: 17px;
}

.admin-backup-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* Top-aligned (was end): the title sat at the bottom-left under a tall blank and the
   test buttons bunched at the bottom-right of the long settings column. */
.manual-printer-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(280px, 1fr) auto;
  align-items: start;
  gap: 14px;
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf8;
}

.manual-printer-card strong {
  font-size: 17px;
}

.manual-printer-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.manual-printer-field {
  display: grid;
  gap: 6px;
}

.manual-printer-controls {
  display: grid;
  gap: 10px;
}

.manual-printer-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.manual-printer-field textarea {
  min-height: 76px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.manual-printer-actions {
  display: grid;
  gap: 8px;
}

.range-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 56px;
  align-items: center;
  gap: 10px;
}

.range {
  width: 100%;
  accent-color: var(--primary);
}

.range-row output {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  text-align: right;
}
