/* Admin panel: the catalog's fonts and colours (styles.css), plain tables and forms.
   Admin tokens (documented in DESIGN.md, "Admin panel"): the catalog palette plus two message
   tints and a danger red, all on a 15px base so long forms and tables stay readable. */
.adm {
  --ink: #16232e; --text: #1D2A38; --paper: #F4F5EF; --lime: #C2E23A; --muted: #5f6e79;
  --line: rgba(29,42,56,.12); --danger: #a3241b;
  --alert-bg: #fdecea; --alert-line: rgba(163,36,27,.35); --alert-text: #7d1a13;
  --ok-bg: #f1f8d2; --ok-line: rgba(110,135,20,.35); --ok-text: #33400b;
  --admin-base: 15px;
  background: var(--paper); color: var(--text); min-height: 100vh; font-size: var(--admin-base);
}
.adm [hidden] { display: none !important; }
.adm { accent-color: var(--ink); caret-color: var(--ink); }
.adm ::selection { background: rgba(194,226,58,.55); color: var(--ink); }
.adm-table td, .adm-counter, .adm-history-row { font-variant-numeric: tabular-nums; }
.adm select:focus-visible, .adm textarea:focus-visible {
  outline: 2px solid #16232e; outline-offset: 2px; box-shadow: 0 0 0 4px rgba(194,226,58,.6);
}
.adm-skip { position: absolute; left: 16px; top: -60px; z-index: 50; padding: 10px 16px; border-radius: 10px; background: var(--lime); color: var(--ink); font-weight: 700; text-decoration: none; }
.adm-skip:focus { top: 12px; }
.adm-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header */
.adm-header { background: var(--ink); color: #fff; }
.adm-header-inner { max-width: 1240px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px 22px; }
.adm-logo img { height: 46px; width: auto; display: block; }
.adm-nav { display: flex; gap: 6px; flex: 1; flex-wrap: wrap; }
.adm-nav a {
  color: rgba(255,255,255,.78); text-decoration: none; font-family: var(--font-display); font-weight: 600; font-size: 14px;
  padding: 9px 16px; border-radius: 20px;
}
.adm-nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.adm-nav a[aria-current="page"] { background: var(--lime); color: var(--ink); }
.adm-who { display: flex; align-items: center; gap: 14px; font-size: 13px; color: rgba(255,255,255,.75); flex-wrap: wrap; }
.adm-who a { color: #fff; font-weight: 600; }
.adm-who .adm-btn.ghost { color: #fff; border-color: rgba(255,255,255,.3); }
/* phones: name, Catalog and Sign out fold into this menu so the header is one row */
.adm-account { display: none; position: relative; flex: none; }
.adm-account summary {
  list-style: none; cursor: pointer; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; border: 1px solid rgba(255,255,255,.3);
}
.adm-account summary::-webkit-details-marker { display: none; }
.adm-account summary:focus-visible { outline: 2px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 4px rgba(194,226,58,.6); }
.adm-account[open] summary { background: rgba(255,255,255,.12); }
.adm-account-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; min-width: 220px; padding: 14px; border-radius: 14px;
  background: #fff; color: var(--text); border: 1px solid var(--line); box-shadow: 0 12px 32px rgba(22,35,46,.14);
  display: grid; gap: 10px; justify-items: start;
}
.adm-account-who { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.adm-account-menu a { color: var(--ink); font-weight: 700; }

/* layout */
.adm-main { max-width: 1240px; margin: 0 auto; padding: 8px 24px 80px; }
.adm-msgs { position: sticky; top: 0; z-index: 5; padding-top: 12px; }
.adm-alert:not(:empty), .adm-status:not(:empty) { padding: 10px 14px; border-radius: 12px; font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.adm-alert:not(:empty) { background: var(--alert-bg); border: 1px solid var(--alert-line); color: var(--alert-text); }
.adm-status:not(:empty) { background: var(--ok-bg); border: 1px solid var(--ok-line); color: var(--ok-text); }
.adm-h1 { font-family: var(--font-display); font-size: clamp(26px, 4vw, 36px); font-weight: 700; letter-spacing: -.02em; color: var(--ink); margin: 10px 0 8px; }
.adm-h1:focus { outline: none; }
.adm-meta { margin: 0 0 14px; color: var(--muted); }
.adm-section { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 20px 22px; margin-top: 18px; }
.adm-section h2 { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--ink); margin: 0 0 12px; }
.adm h3 { font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--ink); margin: 16px 0 8px; }
.adm-card h3, .adm-secret h3 { margin-top: 0; }
.adm-muted { color: var(--muted); }
.adm-note { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0 0 12px; }
.adm-count { font-family: var(--font-display); font-weight: 600; color: var(--ink); margin: 0 0 12px; }
.adm-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 10px 0; }
.adm-row > .adm-field { flex: 1 1 200px; margin: 0; }
.adm-end { justify-content: flex-end; }
.adm-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; }
.adm-toolbar .adm-field { flex: 0 1 360px; margin: 0; }
.adm-filters { justify-content: flex-start; }
.adm-filters .adm-field { flex: 0 1 190px; }
.adm-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.adm-card { border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.adm-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* fields and buttons */
.adm-field { margin: 0 0 12px; }
.adm-field label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin: 0 0 5px; letter-spacing: .02em; }
.adm-hint { font-size: 12px; color: var(--muted); margin: 5px 0 0; }
.adm-input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid rgba(29,42,56,.24);
  background: #fff; color: var(--ink); font-family: var(--font-body); font-size: 14px;
}
textarea.adm-input { height: auto; padding: 10px 12px; resize: vertical; }
.adm-input.adm-short { max-width: 8em; }
/* the file picker's own button, drawn like a small ghost button instead of the browser default */
input[type="file"].adm-input { height: auto; padding: 5px; font-size: 13px; color: var(--muted); }
input[type="file"].adm-input::file-selector-button {
  height: 32px; padding: 0 13px; margin-right: 10px; border-radius: 20px; border: 1px solid rgba(29,42,56,.25);
  background: transparent; color: var(--text); font-family: var(--font-display); font-size: 13px; font-weight: 700; cursor: pointer;
}
@media (hover: hover) and (pointer: fine) { input[type="file"].adm-input::file-selector-button:hover { background: rgba(29,42,56,.06); } }
.adm-input:focus { border-color: rgba(29,42,56,.5); }
.adm-input[readonly] { background: #f7f8f3; }
.adm-mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.adm-num { width: 120px; }
.adm-unit-in { width: 90px; }
/* Team page phone: the box over its Save button, so the column is only as wide as "+91 98200 00000"
   and the name and email columns keep their room */
.adm-phone-cell { display: grid; gap: 6px; justify-items: start; }
.adm-small.adm-phone { width: 9.5rem; }
.adm-small { width: auto; height: 34px; font-size: 13px; }
.adm-unit { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.adm-btn {
  display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 18px;
  border-radius: 20px; border: 1px solid transparent; background: var(--lime); color: var(--ink);
  font-family: var(--font-display); font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.adm-btn.ghost { background: transparent; border-color: rgba(29,42,56,.25); color: var(--text); }
.adm-btn.danger { background: transparent; border-color: rgba(163,36,27,.4); color: var(--danger); }
.adm-btn.small { height: 34px; padding: 0 13px; font-size: 13px; }
.adm-btn:active { transform: scale(.97); }
.adm-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
@media (hover: hover) and (pointer: fine) {
  .adm-btn:not(:disabled):hover { filter: brightness(.96); }
  .adm-btn.ghost:not(:disabled):hover { background: rgba(29,42,56,.06); }
}

/* contacts, product picker, one-time secret */
.adm-contact { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 10px; align-items: end; padding: 10px 0; border-top: 1px solid var(--line); }
.adm-contact .adm-field { margin: 0; }
.adm-cat { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.adm-cat summary { cursor: pointer; padding: 12px 14px; font-family: var(--font-display); font-weight: 600; color: var(--ink); }
.adm-cat[open] summary { border-bottom: 1px solid var(--line); }
.adm-whole { margin: 10px 14px; font-weight: 700; }
.adm-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 16px; padding: 0 14px 12px; }
.adm-checks-flush { padding: 0; }
.adm-linked { margin: 4px 0 0; padding-left: 18px; font-size: 14px; }
.adm-linked li { margin: 4px 0; }
.adm-check { display: flex; align-items: center; gap: 8px; min-height: 36px; font-size: 14px; cursor: pointer; }
.adm-check input { width: 18px; height: 18px; flex: none; accent-color: var(--ink); }
.adm-dim { opacity: .5; }
.adm-secret { border: 2px solid var(--lime); background: #fbfde9; border-radius: 14px; padding: 14px 16px; margin: 0 0 14px; }
.adm-copy { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 8px; align-items: center; }
.adm-copy label { grid-column: 1 / -1; }
.adm-secret .adm-note { margin: 4px 0 10px; color: var(--text); font-weight: 600; }

/* tables */
.adm-table-wrap { overflow-x: auto; }
.adm-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.adm-table th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 10px; border-bottom: 1px solid var(--line); }
.adm-table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
.adm-table a { color: var(--ink); font-weight: 700; }
.adm > .adm-main .adm-table-wrap { background: #fff; border-radius: 14px; }

/* content editor: form on the left, sticky preview on the right */
.adm-editor { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.adm-editor-main > .adm-section:first-child { margin-top: 0; }
.adm-sticky { position: sticky; top: 64px; }
.adm-pv-title { font-family: var(--font-display); font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.adm-preview { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 16px; font-size: 13px; line-height: 1.45; max-height: calc(100vh - 220px); overflow: auto; }
.adm-pv-stage { aspect-ratio: 4 / 3; border-radius: 12px; background: #eef0e8; display: grid; place-items: center; overflow: hidden; margin-bottom: 12px; }
.adm-pv-img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.adm-pv-feats { margin: 0 0 12px; padding-left: 18px; color: var(--text); }
.adm-pv-feats li { margin: 0 0 4px; }
.adm-pv-name { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); margin: 0; }
.adm-pv-namerow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 4px; }
.adm-pv-ul { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px 0 4px; border-radius: 999px; background: #fff; border: 1px solid rgba(29,42,56,.1);
  font-family: var(--font-display); font-size: 14px; font-weight: 700; line-height: 1; color: #C00000; font-variant-numeric: tabular-nums; }
.adm-pv-ul .ul-mark { display: block; width: 20px; height: 20px; color: #C8102E; }
.adm-pv-tag { color: #2f6b57; font-weight: 600; margin: 0 0 10px; }
.adm-pv-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.adm-pv-specs { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 10px; }
.adm-pv-specs dt { color: var(--muted); }
.adm-pv-specs dd { margin: 0; text-align: right; color: var(--ink); font-weight: 600; }
.adm-pv-steps { padding-left: 18px; margin: 0 0 10px; }
.adm-pv-swatches { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.adm-pv-swatch { width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 1px solid rgba(22,35,46,.2); cursor: pointer; position: relative; }
.adm-pv-swatch::before { content: ""; position: absolute; inset: -8px; } /* 38px touch area */
.adm-pv-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.adm-pv-swatch:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.adm-savebar { margin-top: 12px; }
.adm-add { display: flex; align-items: flex-end; gap: 8px; }
.adm-add .adm-field { margin: 0; }
.adm-add select { min-width: 190px; }
.adm-pill { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; background: rgba(194,226,58,.35); color: var(--ink); font-size: 12px; font-weight: 700; margin-left: 8px; }
.adm-pv-chips .adm-pill { margin-left: 0; }
.adm-pill.draft { background: rgba(29,42,56,.07); color: var(--text); }
.adm-pill.eco { background: rgba(47,107,87,.12); color: #2f6b57; }
.adm-counted { position: relative; }
.adm-counter { position: absolute; top: 0; right: 0; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.adm-counter.near { color: var(--danger); font-weight: 700; }
.adm-list { list-style: none; margin: 0; padding: 0; counter-reset: row; }
.adm-list-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); }
.adm-list-row:first-child { border-top: 0; padding-top: 0; }
.adm-list-row .adm-field { margin-bottom: 8px; }
.adm-list-tools { display: flex; gap: 6px; padding-top: 22px; }
.adm-btn.adm-icon { width: 34px; padding: 0; }
.adm-ico { display: inline-flex; }
.adm-pair { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 12px; }
.adm-colour-row { grid-template-columns: 64px minmax(0, 1fr); }
.adm-color { width: 52px; height: 40px; padding: 2px; border-radius: 12px; border: 1px solid rgba(29,42,56,.24); background: #fff; cursor: pointer; }
.adm-color:disabled { cursor: not-allowed; opacity: .7; }
.adm-small-text { font-size: 13px; }
.adm-invalid { border-color: rgba(163,36,27,.55); box-shadow: 0 0 0 3px rgba(163,36,27,.12); }
.adm-history { list-style: none; margin: 0; padding: 0; }
.adm-history-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.adm-history-row:first-child { border-top: 0; }
/* Products: one block per category, its Add product next to the heading */
.adm-group-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin: 0 0 12px; }
.adm-group-head h2 { margin: 0; }
.adm-group-count { color: var(--muted); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.adm-group-head .adm-btn { margin-left: auto; }
.adm-group .adm-table-wrap { background: transparent; }
.adm-meta a { color: var(--ink); font-weight: 700; }
/* sales loop: below-MOQ marker, a conversation's messages */
.adm-warn { color: var(--danger); font-weight: 700; }
.adm-review:not(:empty) { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.adm-pre { white-space: pre-line; }
.adm-thread:not(:empty) { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.adm-msg { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 0 0 10px; }
.adm-msg.staff { border-color: rgba(194,226,58,.9); }
.adm-msg-head { margin: 0 0 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.adm-msg-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 1024px) {
  .adm-editor { grid-template-columns: 1fr; padding-bottom: 72px; }
  .adm-sticky { position: static; }
  .adm-preview { max-height: none; }
  /* the form is long on one column: Save stays on screen as a bar at the bottom */
  .adm-savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; margin: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.96); border-top: 1px solid var(--line); justify-content: flex-end; }
  .adm-moq-form { padding-bottom: 72px; }
}

@media (max-width: 768px) {
  .adm-header-inner, .adm-main { padding-left: 16px; padding-right: 16px; }
  .adm-logo img { height: 34px; }
  /* one header row: logo, nav pills that scroll sideways, the account menu */
  .adm-header-inner { flex-wrap: nowrap; gap: 10px; padding-top: 8px; padding-bottom: 8px; }
  .adm-nav { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .adm-nav::-webkit-scrollbar { display: none; }
  .adm-nav::after { content: ""; flex: none; width: 40px; } /* scroll room so the last pill clears the fade */
  .adm-nav a { flex: none; padding: 8px 14px; }
  .adm-who { display: none; }
  .adm-account { display: block; }
  .adm-add { flex: 1 1 100%; }
  .adm-add .adm-field { flex: 1; }
  .adm-add select { min-width: 0; }
  .adm-section { padding: 16px; }
  .adm-grid2 { grid-template-columns: 1fr; }
  .adm-contact { grid-template-columns: 1fr 1fr; }
  .adm-pair, .adm-list-row { grid-template-columns: 1fr; }
  .adm-list-tools { padding-top: 0; }
  .adm-toolbar .adm-field { flex: 1 1 100%; }
  /* tables become stacked cards: each cell shows its column title */
  .adm-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .adm-table, .adm-table tbody, .adm-table tr, .adm-table td { display: block; width: 100%; }
  .adm-table tr { border: 1px solid var(--line); border-radius: 14px; padding: 6px 12px; margin-bottom: 10px; background: #fff; }
  .adm-table td { display: grid; grid-template-columns: 34% minmax(0, 1fr); gap: 10px; align-items: center; border: 0; padding: 6px 0; }
  .adm-table td::before { content: attr(data-label); font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
  .adm > .adm-main .adm-table-wrap { background: transparent; }
  /* Products on a phone: each product is two short lines (name and Edit; MOQ and unit), not a stacked card */
  .adm-compact .adm-table tr, .adm-compact-ro .adm-table tr { display: grid; gap: 6px 10px; align-items: center; padding: 10px 12px; }
  .adm-compact .adm-table tr { grid-template-columns: auto auto minmax(0, 1fr) auto; }
  .adm-compact-ro .adm-table tr { grid-template-columns: minmax(0, 1fr) auto; }
  .adm-compact .adm-table td, .adm-compact-ro .adm-table td { display: block; width: auto; padding: 0; }
  .adm-compact .adm-table td::before, .adm-compact-ro .adm-table td::before { content: none; }
  .adm-compact .adm-table td:nth-child(1) { grid-column: 1 / 4; grid-row: 1; font-weight: 600; color: var(--ink); }
  .adm-compact .adm-table td:nth-child(4) { grid-column: 4; grid-row: 1; justify-self: end; }
  .adm-compact .adm-table td:nth-child(2) { grid-column: 1; grid-row: 2; }
  .adm-compact .adm-table td:nth-child(3) { grid-column: 2; grid-row: 2; }
  .adm-compact-ro .adm-table td:nth-child(1) { font-weight: 600; color: var(--ink); }
  /* Disable / Enable / Delete: their own line under the product */
  .adm-compact .adm-table td:nth-child(5) { grid-column: 1 / -1; grid-row: 3; }
  .adm-compact-ro .adm-table td:nth-child(3) { grid-column: 1 / -1; }
  .adm-compact-ro .adm-table td:nth-child(2) { justify-self: end; color: var(--muted); }
  .adm-group-head .adm-btn { margin-left: 0; }
}
/* product actions in the Products table */
.adm-acts { gap: 6px; flex-wrap: wrap; }
/* Support cases: done ones fade back */
.adm-case.done { opacity: .7; }
