/* ==========================================================================
   Protein पूरा — admin panel
   Loaded only by /admin, so none of this weight reaches the storefront.
   Same tokens as the shop, but denser: this is a tool, not a shop window.
   ========================================================================== */

:root {
  --pending: #C8791C;
  --confirmed: #2F63C9;
  --shipped: #2E8B6F;
  --cancelled: #8A8FA3;
}

body {
  min-height: 100vh;
  background: var(--tile);
  color: var(--navy-ink);
  font-family: var(--font-body);
}

/* --- Top bar ------------------------------------------------------------- */
.abar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem clamp(1rem, 4vw, 2rem);
  background: var(--navy);
  color: var(--cream);
}

.abar__brand {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  color: var(--cream);
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  text-decoration: none;
}

.abar__brand img {
  width: 32px;
  height: 32px;
}

.abar__tag {
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--cream-45);
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.abar__right {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.875rem;
}

.abar__who {
  color: var(--cream-70);
}

/* --- Shell --------------------------------------------------------------- */
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(1.25rem, 3vw, 2rem) clamp(1rem, 4vw, 2rem) 4rem;
}

.card {
  padding: clamp(1rem, 3vw, 1.5rem);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 0 1px 2px rgba(8, 14, 46, 0.06), 0 8px 24px rgba(8, 14, 46, 0.06);
}

.card + .card {
  margin-top: 1.25rem;
}

.h {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 700;
}

.sub {
  margin: 0 0 1.25rem;
  color: var(--text);
  font-size: 0.9375rem;
}

/* --- Sign in ------------------------------------------------------------- */
.login {
  max-width: 400px;
  margin: clamp(2rem, 10vh, 6rem) auto 0;
}

.login .field + .field {
  margin-top: 1rem;
}

/* --- Tabs ---------------------------------------------------------------- */
.tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  padding: 0.3rem;
  border-radius: var(--radius-pill);
  background: #E6E8F0;
}

.tab {
  padding: 0.55rem 1.1rem;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--navy-ink);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--t-fast) var(--ease);
}

.tab:hover {
  background: rgba(255, 255, 255, 0.6);
}

.tab[aria-selected="true"] {
  background: var(--paper);
  box-shadow: 0 1px 3px rgba(8, 14, 46, 0.14);
}

/* --- Stat row ------------------------------------------------------------ */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat {
  padding: 0.9rem 1rem;
  border-left: 4px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 1px 2px rgba(8, 14, 46, 0.06);
}

.stat[data-key="pending"]   { border-left-color: var(--pending); }
.stat[data-key="confirmed"] { border-left-color: var(--confirmed); }
.stat[data-key="shipped"]   { border-left-color: var(--shipped); }
.stat[data-key="cancelled"] { border-left-color: var(--cancelled); }

.stat__n {
  display: block;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.stat__k {
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* --- Toolbar ------------------------------------------------------------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.toolbar__group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.toolbar .select,
.toolbar .input {
  min-height: 40px;
  width: auto;
  min-width: 180px;
}

/* --- Tables -------------------------------------------------------------- */
.tablewrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  white-space: nowrap;
}

table.data th,
table.data td {
  padding: 0.7rem 0.85rem;
  text-align: left;
}

table.data thead th {
  position: sticky;
  top: 0;
  background: #EEF0F6;
  color: var(--navy-ink);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

table.data tbody tr + tr {
  border-top: 1px solid var(--line);
}

table.data tbody tr:hover {
  background: #FAFBFD;
}

table.data td.num {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.ref {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.muted {
  color: var(--text);
}

.wrapcell {
  max-width: 260px;
  white-space: normal;
}

/* --- Status pills -------------------------------------------------------- */
.pill {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: capitalize;
}

.pill[data-s="pending"]   { background: var(--pending); }
.pill[data-s="confirmed"] { background: var(--confirmed); }
.pill[data-s="shipped"]   { background: var(--shipped); }
.pill[data-s="cancelled"] { background: var(--cancelled); }
.pill[data-s="available"] { background: var(--shipped); }
.pill[data-s="sold_out"]  { background: var(--pending); }
.pill[data-s="hidden"]    { background: var(--cancelled); }

/* --- Small controls inside rows ------------------------------------------ */
.mini {
  min-height: 36px;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--navy-ink);
  font: inherit;
  font-size: 0.8125rem;
}

.mini--num {
  width: 90px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.mini--w {
  width: 150px;
}

.mini:focus-visible {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(240, 138, 42, 0.25);
}

.btn--tiny {
  min-height: 36px;
  padding: 0 0.85rem;
  font-size: 0.8125rem;
}

.linkbtn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--confirmed);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

/* --- Order detail -------------------------------------------------------- */
tr.detail > td {
  padding: 0;
  background: #F7F8FC;
}

.detail__inner {
  display: grid;
  gap: 1.25rem;
  padding: 1.1rem 0.85rem;
  white-space: normal;
}

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

.detail__h {
  margin: 0 0 0.4rem;
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.detail__body {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.detail__items {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
}

.detail__items li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.2rem 0;
}

/* --- Messages ------------------------------------------------------------ */
.msg {
  margin: 0 0 1rem;
  padding: 0.8rem 1rem;
  border-radius: 10px;
  font-size: 0.9375rem;
}

.msg[data-tone="error"] {
  background: #FCEAE7;
  color: #8E2617;
}

.msg[data-tone="ok"] {
  background: #E6F4EE;
  color: #1F5E4A;
}

.msg[data-tone="warn"] {
  background: #FDF3E2;
  color: #7A5312;
}

.msg:empty {
  display: none;
}

.empty {
  padding: 2.5rem 1rem;
  color: var(--text);
  text-align: center;
}

.row-status {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

[hidden] {
  display: none !important;
}

/* .btn--outline is cream-on-navy for the storefront hero. Inside the white
   panels it needs the inverse; the sign-out button in the navy bar is outside
   .wrap and keeps the original. */
.wrap .btn--outline {
  border-color: var(--navy);
  color: var(--navy);
}

.wrap .btn--outline:hover {
  background: var(--navy);
  color: var(--cream);
}

.btn--danger {
  border: 1px solid #D9BDB7;
  background: transparent;
  color: #8E2617;
}

.btn--danger:hover {
  background: #8E2617;
  color: #fff;
}

.rowactions {
  display: flex;
  gap: 0.4rem;
}

/* On a narrow screen the brand, the "signed in as" line and the button fight
   for the same row. The username is the least useful of the three. */
@media (max-width: 560px) {
  .abar {
    padding: 0.6rem 0.9rem;
  }

  .abar__who {
    display: none;
  }

  .abar__brand {
    font-size: 1rem;
  }
}

/* --- Banners: what is left to do, without blocking the panel ------------- */
.banner {
  border-left: 4px solid var(--pending);
}

.banner--stop {
  border-left-color: var(--confirmed);
}

.banner__title {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
}

.banner__body {
  margin: 0 0 0.6rem;
  color: var(--text);
  font-size: 0.9375rem;
}

.banner__body:last-child {
  margin-bottom: 0;
}

.banner code {
  padding: 0.1rem 0.35rem;
  border-radius: 5px;
  background: var(--tile);
  color: var(--navy-ink);
  font-size: 0.8125rem;
}

.step__path {
  margin: 0 0 0.6rem;
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  background: var(--tile);
  color: var(--navy-ink);
  font-size: 0.9375rem;
}

/* --- Sign-in hint, shown only while the built-in password is in use ------- */
.hint {
  margin: 0 0 1.25rem;
  padding: 0.9rem 1rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--cream-soft);
}

.hint__title {
  margin: 0 0 0.5rem;
  color: var(--navy-ink);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hint__creds {
  margin: 0 0 0.6rem;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.hint__creds td {
  padding: 0.15rem 0.75rem 0.15rem 0;
  color: var(--text);
}

.hint__creds td:last-child {
  padding-right: 0;
}

.hint__creds code,
.hint__note code {
  padding: 0.1rem 0.4rem;
  border-radius: 5px;
  background: var(--paper);
  color: var(--navy-ink);
  font-size: 0.9375rem;
  font-weight: 600;
  user-select: all;
}

.hint__note {
  margin: 0;
  color: var(--text);
  font-size: 0.8125rem;
}

.hint__note code {
  font-size: 0.75rem;
  font-weight: 400;
}

/* --- Slim advisory bar --------------------------------------------------- */
.slimbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.55rem 0.75rem 0.55rem 1rem;
  border-radius: 10px;
  background: #FDF3E2;
  color: #7A5312;
  font-size: 0.875rem;
}

.slimbar p {
  flex: 1;
  margin: 0;
}

.slimbar code {
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  background: rgba(122, 83, 18, 0.12);
  font-size: 0.8125rem;
}

.slimbar__x {
  flex: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
}

.slimbar__x:hover {
  background: rgba(122, 83, 18, 0.12);
}

/* --- Connection diagnosis ------------------------------------------------ */
.diag {
  margin: 0 0 0.9rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: var(--tile);
  color: var(--text);
  font-size: 0.875rem;
}

.diag p {
  margin: 0 0 0.5rem;
}

.diag p:last-child {
  margin-bottom: 0;
}

.diag__h {
  color: var(--navy-ink);
  font-weight: 700;
}

.diag__msg {
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  background: #FCEAE7;
  color: #8E2617;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

.diag__list {
  margin: 0 0 0.5rem;
  padding-left: 1.1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8125rem;
}

/* The actionable half of a diagnosis, set apart from the driver's own words. */
.diag__fix {
  padding: 0.5rem 0.7rem;
  border-left: 3px solid var(--confirmed);
  background: var(--paper);
  color: var(--navy-ink);
}
