/* RISE Operations console.
   Same palette and structure as before; reformatted to one rule per line so the
   fulfilment additions below stay maintainable. Tokens are shared with the
   storefront's own admin surface only — the customer-facing site has its own. */
:root {
  --ink: #202622;
  --muted: #6f7974;
  --line: #dde3df;
  --lime: #c9f45b;
  font-family: Arial, sans-serif;
  color: var(--ink);
  background: #f6f8f7;
  font-size: 14px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  outline-offset: 4px;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  border: 0;
  background: none;
  color: inherit;
}
h1,
h2,
p {
  margin: 0;
}
h1 {
  font-size: 30px;
  font-weight: 600;
}
h2 {
  font-size: 18px;
}
svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 23px;
  font-weight: 700;
}
.brand span {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
  border-left: 1px solid var(--line);
  padding-left: 14px;
  margin-left: 5px;
}
.admin-header {
  height: 74px;
  border-bottom: 1px solid var(--line);
  padding: 0 4%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
}
.header-tools {
  display: flex;
  align-items: center;
  gap: 18px;
}
.icon {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 4px;
}
.icon:hover {
  background: #edf1ee;
}
.admin-main {
  max-width: 1500px;
  padding: 34px 4%;
  margin: auto;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 26px;
}
.eyebrow {
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 9px;
}
.primary,
.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 40px;
  padding: 0 15px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}
.primary {
  background: var(--lime);
}
.primary:hover {
  background: #bbed42;
}
.secondary {
  background: #fff;
  border: 1px solid var(--line);
}
.secondary:hover {
  background: #f4f7f4;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 22px 0;
  margin-bottom: 30px;
}
.metrics > div {
  padding: 0 24px;
  border-left: 1px solid var(--line);
}
.metrics > div:first-child {
  padding-left: 0;
  border: 0;
}
.metrics span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}
.metrics b {
  font-size: 28px;
  font-weight: 500;
}
.work-area {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 28px;
}
.order-list {
  min-width: 0;
}
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
}
.tabs button {
  font-size: 11px;
  padding: 12px 10px;
  border-bottom: 2px solid transparent;
}
.tabs .active {
  border-color: #73913b;
  font-weight: 600;
}
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: white;
  padding: 0 10px;
  height: 36px;
  border-radius: 4px;
}
.search svg {
  width: 14px;
  color: var(--muted);
}
.search input {
  border: 0;
  width: 145px;
  background: none;
  font-size: 12px;
  padding: 6px;
  min-width: 0;
  height: auto;
}
.table-wrap {
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
  white-space: nowrap;
}
th {
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 17px 13px;
  font-size: 12px;
  border-bottom: 1px solid var(--line);
}
tbody tr {
  cursor: pointer;
}
tbody tr:hover,
tbody tr.selected {
  background: #edf3e8;
}
td small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 5px;
}
.order-button {
  font-size: 12px;
  font-weight: 600;
  padding: 0;
}
.badge {
  display: inline-block;
  padding: 5px 7px;
  font-size: 10px;
  border-radius: 3px;
  background: #edf0ee;
  color: #65716a;
}
.badge.unfulfilled {
  background: #fff0d0;
  color: #8b6517;
}
.badge.packed {
  background: #e3eef9;
  color: #3b668b;
}
.badge.dispatched {
  background: #e0f0e7;
  color: #2c7551;
}
.badge.unpaid {
  background: #edf0ee;
  color: #65716a;
}
.badge.expired {
  background: #f0ecec;
  color: #7d6a6a;
}
.express {
  color: #8a5c35;
  font-weight: 600;
}
/* On a wide screen the Shipping column already says this. */
.express-hint {
  display: none;
}
.list-footnote,
#empty {
  font-size: 11px;
  color: var(--muted);
  padding: 18px 0;
  line-height: 1.6;
}
.order-detail {
  border-left: 1px solid var(--line);
  padding-left: 26px;
  min-width: 0;
}
/* The close bar only exists for the small-screen sheet. */
.detail-bar {
  display: none;
}
.detail-empty {
  padding: 40px 5px;
  text-align: center;
  color: var(--muted);
}
.detail-empty svg {
  width: 30px;
  height: 30px;
  margin-bottom: 16px;
}
.detail-empty h2 {
  color: var(--ink);
  margin-bottom: 10px;
}
.detail-empty p {
  font-size: 12px;
  line-height: 1.6;
}
.detail-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 18px;
  gap: 12px;
}
.detail-heading h2 {
  font-size: 17px;
  margin-bottom: 8px;
}
.detail-section {
  border-top: 1px solid var(--line);
  padding: 20px 0;
}
.detail-section h3 {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
  margin: 0 0 12px;
}
.detail-section p {
  font-size: 12px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}
.detail-product {
  display: flex;
  gap: 13px;
  align-items: center;
}
.detail-product img {
  width: 54px;
  height: 64px;
  object-fit: cover;
  border-radius: 3px;
}
.detail-product b {
  font-size: 12px;
}
.detail-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.detail-note {
  font-size: 11px;
  color: var(--muted);
  margin-top: 14px;
  line-height: 1.6;
}

/* ── login ── */
.login-page {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: #f6f8f7;
}
.login {
  width: 100%;
  max-width: 380px;
}
.login .brand {
  margin-bottom: 52px;
}
.login-heading > svg {
  width: 30px;
  height: 30px;
  color: #73913b;
  margin-bottom: 20px;
}
.login h1 {
  font-size: 26px;
  margin-bottom: 10px;
}
.login-heading p {
  color: var(--muted);
  margin-bottom: 28px;
  font-size: 13px;
  line-height: 1.6;
}
label {
  display: block;
  font-size: 12px;
  margin: 16px 0 8px;
}
input,
select,
textarea {
  height: 43px;
  border: 1px solid #cbd4ce;
  border-radius: 4px;
  background: white;
  width: 100%;
  padding: 0 12px;
}
.login .primary {
  width: 100%;
  margin-top: 20px;
}
.return {
  display: block;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  margin-top: 24px;
}
#loginError,
#adminError {
  color: #a74039;
  font-size: 12px;
  line-height: 1.6;
  margin-top: 14px;
}
#loginHint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  margin-top: 14px;
}

/* Passkey sign-in: one button, no shared secret to type. */
.passkey {
  width: 100%;
  margin-top: 4px;
  min-height: 52px;
  font-size: 14px;
}
.passkey svg {
  width: 20px;
  height: 20px;
}
.origin-note {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.origin-note b {
  color: var(--ink);
  font-weight: 600;
}

/* ── banners ── */
.banner {
  display: flex;
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  border-radius: 5px;
  font-size: 12px;
  line-height: 1.6;
  margin-bottom: 22px;
  border: 1px solid;
}
.banner svg {
  margin-top: 1px;
}
.banner.warn {
  background: #fff8e8;
  border-color: #f0dfb8;
  color: #7a5a1e;
}
.banner.info {
  background: #eef4fa;
  border-color: #d5e3f0;
  color: #33546f;
}

/* ── detail additions ── */
.detail-contact a {
  color: #3a5c14;
  border-bottom: 1px solid #c3d6a4;
}
.detail-contact a:hover {
  border-bottom-color: #3a5c14;
}
.money-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  line-height: 2;
}
.money-row.total {
  font-weight: 600;
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding-top: 8px;
}
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.timeline li {
  display: flex;
  gap: 12px;
  font-size: 12px;
  line-height: 1.6;
  padding: 5px 0;
}
.timeline .when {
  color: var(--muted);
  font-size: 11px;
  flex-shrink: 0;
  min-width: 92px;
}
.notes {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}
.notes li {
  font-size: 12px;
  line-height: 1.7;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.notes li:last-child {
  border-bottom: 0;
}
.notes .when {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 4px;
}
.email-log {
  list-style: none;
  margin: 0;
  padding: 0;
}
.email-log li {
  font-size: 12px;
  line-height: 1.6;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.email-log li:last-child {
  border-bottom: 0;
}
.email-log .meta {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 4px;
}
.email-log .failed {
  color: #a74039;
}

/* ── compose ── */
textarea {
  height: auto;
  min-height: 110px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.6;
}
.compose-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.compose-actions > * {
  flex: 1;
}
.preview {
  border: 1px solid var(--line);
  border-radius: 5px;
  margin-top: 12px;
  overflow: hidden;
}
.preview header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
  background: #fbfcfb;
}
.preview iframe {
  width: 100%;
  height: 260px;
  border: 0;
  background: #fff;
}

/* ── devices ── */
.devices {
  list-style: none;
  margin: 0;
  padding: 0;
}
.devices li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.devices li:last-child {
  border-bottom: 0;
}
.devices b {
  display: block;
  margin-bottom: 3px;
}
.devices small {
  color: var(--muted);
  font-size: 10px;
}
.device-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.link-button {
  font-size: 11px;
  color: #a74039;
  border-bottom: 1px solid currentColor;
}
.enroll-url {
  display: block;
  margin-top: 12px;
  padding: 12px;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 5px;
  font-size: 11px;
  overflow-wrap: anywhere;
  line-height: 1.6;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 25px;
  width: calc(100% - 36px);
  max-width: 390px;
}
dialog::backdrop {
  background: #18241e66;
}
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
dialog p {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
  margin: 18px 0;
}
dialog .primary {
  width: 100%;
}
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #202c24;
  color: white;
  padding: 13px 18px;
  font-size: 12px;
  border-radius: 4px;
  max-width: 90%;
  z-index: 10;
}

@media (max-width: 1000px) {
  .work-area {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 20px;
  }
  .order-detail {
    padding-left: 20px;
  }
}
@media (max-width: 760px) {
  .admin-header {
    padding: 0 5%;
    height: 66px;
  }
  .brand span {
    display: none;
  }
  .admin-main {
    padding: 26px 5%;
  }
  .metrics {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }
  .metrics > div:nth-child(3) {
    padding-left: 0;
    border: 0;
  }
  .metrics span {
    font-size: 11px;
  }
  .work-area {
    display: block;
  }

  /* The order detail becomes a sheet that slides up over the list. Without this
     you tap a row and then have to scroll past the entire table to read it. */
  .order-detail {
    position: fixed;
    inset: 0;
    z-index: 20;
    margin: 0;
    padding: 0;
    border: 0;
    background: #f6f8f7;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    transform: translateY(100%);
    visibility: hidden;
    transition:
      transform 0.22s ease,
      visibility 0.22s;
  }
  .order-detail.open {
    transform: none;
    visibility: visible;
  }
  /* Stop the list scrolling behind the sheet. */
  body.sheet-open {
    overflow: hidden;
  }
  @media (prefers-reduced-motion: reduce) {
    .order-detail {
      transition: none;
    }
  }

  .detail-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    position: sticky;
    top: 0;
    z-index: 1;
    height: 56px;
    padding: 0 10px;
    background: #fff;
    border-bottom: 1px solid var(--line);
  }
  .detail-bar #detailBarTitle {
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .detail-bar-spacer {
    flex: 1;
  }
  .detail-bar .icon {
    width: 40px;
    height: 40px;
  }
  .detail-body {
    padding: 20px 5% 48px;
  }
  /* The bar already shows the reference and status; repeating them in the
     heading directly underneath just looks like a mistake. */
  .detail-heading {
    display: none;
  }
  .detail-bar #detailBarBadge .badge {
    padding: 3px 6px;
  }
  .toolbar {
    gap: 12px;
  }
  .tabs {
    width: 100%;
    overflow: auto;
  }
  .tabs button {
    flex-shrink: 0;
  }
  .search {
    width: 100%;
  }
  .search input {
    width: 100%;
  }
  .header-tools {
    gap: 8px;
  }
  h1 {
    font-size: 26px;
  }
  td,
  th {
    padding-left: 9px;
    padding-right: 9px;
  }

  /* Five columns cannot fit a phone, and a table that scrolls sideways hides
     the two that matter most — status and total. Shipping and total both live
     one tap away in the sheet, so they come out here and express orders are
     marked in the order cell instead. */
  .order-list th:nth-child(3),
  .order-list td:nth-child(3),
  .order-list th:nth-child(5),
  .order-list td:nth-child(5) {
    display: none;
  }
  .express-hint {
    display: inline;
    color: #8a5c35;
    font-weight: 600;
  }
  .detail-empty {
    padding: 15px;
  }
  .detail-actions {
    flex-direction: row;
  }
  .detail-actions > * {
    flex: 1;
  }
}
[hidden] {
  display: none !important;
}
