/* ============================================================
   The Choice Collection — admin panel + checkout extras
   Loaded after hark-hero.css. Extends the .x-* admin styles
   that live inline in index.html.
   ============================================================ */

/* ---------- login gate ---------- */
.x-login form { gap: 12px; }
.x-login__mark { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; margin: 0 auto; box-shadow: 0 6px 20px rgba(0, 0, 255, .18); }
.x-login__mark img { width: 100%; height: 100%; display: block; object-fit: cover; }
.x-login__sub { margin: -6px 0 6px; font-size: 13px; color: var(--muted); }
.x-login__fine { font-size: 11px; line-height: 1.5; margin-top: 4px; }
.x-field { display: grid; gap: 6px; text-align: left; }
.x-field > span:first-child { font: 500 11px var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.x-pw { position: relative; display: block; }
.x-pw input { width: 100%; min-width: 0; border-radius: 12px; padding-right: 54px; }
.x-pw button {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  min-height: 36px; padding: 0 10px; border: 0; border-radius: 8px; background: none;
  color: var(--muted); font: 600 11px var(--body); letter-spacing: .08em; text-transform: uppercase; cursor: pointer;
}
.x-pw button:hover { background: var(--ice); color: var(--navy); }
.x-lock { display: flex; align-items: center; gap: 8px; justify-content: center; font-size: 12px; color: #b42318; }
.x-lock b { font-variant-numeric: tabular-nums; }

/* ---------- shell ---------- */
.x-topbar {
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  margin: -32px calc(-1 * clamp(18px, 3vw, 40px)) 22px;
  padding: 14px clamp(18px, 3vw, 40px);
  background: rgba(255, 255, 255, .82); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.x-topbar__l { display: flex; align-items: center; gap: 10px; min-width: 0; }
.x-topbar__l strong { font: 600 14px var(--body); color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.x-topbar__r { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.x-chip-time {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: #eef2ff; color: #23368f; font: 500 12px var(--body); font-variant-numeric: tabular-nums;
}
.x-chip-time.is-warn { background: #fff4e5; color: #8a4b00; }

/* ---------- toolbar / filters ---------- */
.x-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.x-toolbar .x-search { flex: 1 1 220px; min-width: 160px; }
.x-toolbar .x-select { width: auto; min-width: 150px; }
.x-count { font: 500 12px var(--body); color: var(--muted); margin-left: auto; }

/* ---------- status pills ---------- */
.x-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font: 500 11px var(--body); letter-spacing: .04em; white-space: nowrap;
}
.x-pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.x-pill--in { background: #e8f6ee; color: #13723c; }
.x-pill--out { background: #fdeaea; color: #b42318; }
.x-pill--low { background: #fff4e5; color: #8a4b00; }
.x-pill--mute { background: var(--ice); color: var(--muted); }

/* ---------- dashboard cards ---------- */
.x-health { display: grid; gap: 10px; }
.x-health li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--navy); line-height: 1.45; }
.x-health li .x-dot { flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; margin-top: 1px; }
.x-health .ok .x-dot { background: #e8f6ee; color: #13723c; }
.x-health .warn .x-dot { background: #fff4e5; color: #8a4b00; }
.x-health .bad .x-dot { background: #fdeaea; color: #b42318; }
.x-health small { display: block; color: var(--muted); font-size: 12.5px; }

.x-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.x-log li { display: flex; gap: 10px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; color: var(--navy); }
.x-log li:last-child { border-bottom: 0; }
.x-log time { margin-left: auto; color: var(--muted); font-size: 11.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.x-log__empty { color: var(--muted); font-size: 13.5px; margin: 0; }

/* ---------- order cards (admin) ---------- */
.x-orders { display: grid; gap: 12px; }
.x-ord { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.x-ord__top { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.x-ord__top b { font: 600 15px var(--body); color: var(--navy); }
.x-ord__top time { color: var(--muted); font-size: 12px; }
.x-ord p { margin: 0 0 4px; font-size: 13.5px; color: var(--navy); }
.x-ord small { color: var(--muted); font-size: 12.5px; }
.x-ord__acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- security tab ---------- */
.x-sec { display: grid; gap: 16px; }
.x-code {
  display: block; width: 100%; margin: 8px 0 0; padding: 12px 14px; border-radius: 12px;
  background: #0b1230; color: #d8e1ff; font: 400 11.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-x: auto; white-space: pre; -webkit-user-select: all; user-select: all;
}
.x-steps { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.x-steps b { color: var(--navy); }

/* ---------- checkout summary ---------- */
.x-sum { display: grid; gap: 6px; margin: 10px 0 4px; font-size: 13.5px; }
.x-sum > div { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }
.x-sum > div.is-total { padding-top: 8px; margin-top: 2px; border-top: 1px solid var(--line); color: var(--navy); font-weight: 600; font-size: 15px; }
.x-sum > div.is-total b { font-variant-numeric: tabular-nums; }
.x-co__wrap { display: grid; gap: 14px; }
.x-co__note { font-size: 12px; color: var(--muted); margin: 0; line-height: 1.5; }
.x-opt { font: 500 11px var(--body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.x-wa-sent { display: grid; gap: 10px; text-align: left; }
.x-wa-sent h2 { font-size: 26px; }
.x-wa-sent p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.x-wa-sent .x-ordno { font: 600 13px var(--body); letter-spacing: .12em; color: var(--royal); text-transform: uppercase; }

/* ---------- WhatsApp order confirmation modal ---------- */
.x-modal__box.x-ordbox {
  display: flex; flex-direction: column;
  width: 100%; max-width: 540px;
  max-height: min(92vh, 720px);
  overflow: hidden;               /* the textarea scrolls, not the card */
  color-scheme: light;
}
.x-ordbox .x-modal__x { background: #fff; }
.x-ordbox .x-wa-sent {
  padding: 30px 26px 22px;        /* was 0 — that clipped the ORDER label */
  display: flex; flex-direction: column; gap: 12px;
  min-height: 0; overflow: hidden;
}
.x-wa-sent .x-ordno { margin: 0; line-height: 1.2; }
.x-wa-sent h2 { margin: 0; line-height: 1.12; letter-spacing: -.02em; }
.x-wa-sent #orderMsg { margin: 0; }
.x-wa-sent #orderMsg b { color: var(--navy); }
#orderText.x-ordtext {
  width: 100%; min-width: 0; flex: 1 1 auto;
  height: clamp(150px, 34vh, 260px); min-height: 120px; max-height: 44vh;
  margin: 2px 0 0; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 14px !important;
  background: var(--ice); color: var(--navy);
  font: 400 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap; overflow-wrap: anywhere; overflow-y: auto; overflow-x: hidden;
  resize: none; box-sizing: border-box; color-scheme: light;
  scrollbar-width: thin; scrollbar-color: #b6c1da transparent;
}
#orderText.x-ordtext:focus { outline: 2px solid var(--royal); outline-offset: 1px; }
#orderText.x-ordtext::-webkit-scrollbar { width: 10px; }
#orderText.x-ordtext::-webkit-scrollbar-track { background: transparent; }
#orderText.x-ordtext::-webkit-scrollbar-thumb { background: #c3cbe0; border: 3px solid var(--ice); border-radius: 999px; }
#orderText.x-ordtext::-webkit-scrollbar-thumb:hover { background: #9faac4; }
.x-ordbox .x-formbtns { margin-top: 2px; }

@media (max-width: 520px) {
  .x-ordbox { max-height: 94vh; }
  .x-ordbox .x-wa-sent { padding: 26px 18px 18px; }
  .x-wa-sent h2 { font-size: 22px; }
  .x-ordbox .x-formbtns .x-btn { flex: 1 1 100%; }
}

@media (max-width: 760px) {
  .x-topbar { margin-top: -24px; position: static; }
  .x-log li { flex-wrap: wrap; }
  .x-log time { margin-left: 0; width: 100%; }
  .x-toolbar .x-select { min-width: 0; flex: 1 1 130px; }
}

/* ---------- phone: one row of menu pills, status bar on its own ---------- */
@media (max-width: 760px) {
  .x-admin .x-side {
    flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
    padding: 9px 12px; gap: 4px; scrollbar-width: none;
  }
  .x-admin .x-side::-webkit-scrollbar { display: none; }
  .x-admin .x-side button { flex: 0 0 auto; padding: 0 12px; font-size: 13px; }
  .x-admin .x-side__end { margin-left: auto; padding-left: 6px; }

  .x-admin .x-topbar { flex-wrap: wrap; padding: 9px 16px; margin-top: -18px; }
  .x-admin .x-topbar__l { display: none; }
  .x-admin .x-topbar__r { width: 100%; justify-content: space-between; gap: 6px; }
  .x-admin .x-topbar__r .x-btn { display: none; }
}
