/* ===== Theme ===== */
:root {
  --bg: #eeece9;
  --panel: #ffffff;
  --panel-2: #f0f2f5;
  --hover: #f5f6f6;
  --active: #f0f2f5;
  --border: #e9edef;
  --text: #191919;
  --muted: #667781;
  --icon: #54656f;
  /* MichoCart brand: main #191919, highlight = the logo's orange */
  --brand: #191919;
  --brand-orange: #ff6a00;
  --accent: #191919;          /* primary buttons, selected states */
  --accent-dark: #191919;     /* headers */
  --accent-text: #191919;     /* text in the accent colour */
  --accent-soft: #fff0e4;     /* soft highlight background */
  --price: #c2410c;
  --unread: #ea580c;
  --link: #c2410c;
  --chat-bg: #efecea;
  --doodle: rgba(0, 0, 0, .045);
  --in: #ffffff;
  --out: #ffe9d9;
  --notice-bg: #ffeecd;
  --notice-text: #54656f;
  --day-bg: #ffffff;
  --danger: #ea0038;
  --warn: #b26a00;
  --warn-bg: #fff4e0;
  --ok: #008069;
  --ok-bg: #e7fce3;
  --info: #027eb5;
  --info-bg: #e6f4fb;
  --bad-bg: #fde7ec;
  --shadow: 0 1px .5px rgba(11, 20, 26, .13);
  --input: #ffffff;
  --drawer-bg: #f0f2f5;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b0b; --panel: #141414; --panel-2: #1f1f1f; --hover: #1f1f1f; --active: #2a2a2a;
    --border: #262626; --text: #ededed; --muted: #9b9b9b; --icon: #b8b8b8;
    --accent: #ea580c; --accent-dark: #191919; --accent-text: #ff8a3d; --accent-soft: #363333; --link: #ff8a3d;
    --price: #ff8a3d; --unread: #ff7a1a;
    --chat-bg: #0e0e0e; --doodle: rgba(255, 255, 255, .03); --in: #1f1f1f; --out: #363333;
    --notice-bg: #1c1c1c; --notice-text: #ffd279; --day-bg: #1c1c1c;
    --warn: #ffb74d; --warn-bg: #3a2c12; --ok: #4cd5a7; --ok-bg: #0f3a2f; --info: #53bdeb; --info-bg: #10303f; --bad-bg: #3c1622;
    --shadow: 0 1px .5px rgba(0, 0, 0, .25); --input: #262626; --drawer-bg: #0b0b0b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0b0b; --panel: #141414; --panel-2: #1f1f1f; --hover: #1f1f1f; --active: #2a2a2a;
  --border: #262626; --text: #ededed; --muted: #9b9b9b; --icon: #b8b8b8;
  --accent: #ea580c; --accent-dark: #191919; --accent-text: #ff8a3d; --accent-soft: #363333; --link: #ff8a3d;
  --price: #ff8a3d; --unread: #ff7a1a;
  --chat-bg: #0e0e0e; --doodle: rgba(255, 255, 255, .03); --in: #1f1f1f; --out: #363333;
  --notice-bg: #1c1c1c; --notice-text: #ffd279; --day-bg: #1c1c1c;
  --warn: #ffb74d; --warn-bg: #3a2c12; --ok: #4cd5a7; --ok-bg: #0f3a2f; --info: #53bdeb; --info-bg: #10303f; --bad-bg: #3c1622;
  --shadow: 0 1px .5px rgba(0, 0, 0, .25); --input: #262626; --drawer-bg: #0b0b0b;
  color-scheme: dark;
}

/* ===== Base ===== */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14.2px/1.4 "Segoe UI", "Helvetica Neue", Helvetica, "Lucida Grande", Arial, Ubuntu, Cantarell, "Fira Sans", sans-serif;
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
svg.i { width: 24px; height: 24px; fill: currentColor; display: block; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ===== Layout ===== */
.app {
  display: grid; grid-template-columns: minmax(320px, 30%) 1fr 0; height: 100vh; height: 100dvh;
  max-width: 1700px; margin: 0 auto; background: var(--panel); box-shadow: 0 6px 18px rgba(11, 20, 26, .05);
  position: relative;
}
.app.has-drawer { grid-template-columns: minmax(320px, 30%) 1fr 400px; }
@media (min-width: 1441px) {
  body::before { content: ""; position: fixed; inset: 0 0 auto 0; height: 127px; background: var(--accent-dark); z-index: -1; }
  .app { height: calc(100vh - 38px); margin: 19px auto; }
}
.sidebar, .chat, .drawer { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.sidebar { border-right: 1px solid var(--border); background: var(--panel); }
.drawer { border-left: 1px solid var(--border); background: var(--drawer-bg); overflow: hidden; }
.app:not(.has-drawer) .drawer { display: none; }

.pane-head {
  height: 59px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--panel-2);
}
.head-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--icon);
  position: relative; flex: none;
}
.icon-btn:hover { background: rgba(0, 0, 0, .06); }
:root[data-theme="dark"] .icon-btn:hover { background: rgba(255, 255, 255, .08); }
.icon-btn.on { background: rgba(0, 0, 0, .1); }
.icon-btn .badge, .count-badge {
  position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 20px; color: #fff; font-weight: 600; overflow: hidden;
}
.avatar.lg { width: 49px; height: 49px; font-size: 24px; }
.avatar.xl { width: 120px; height: 120px; font-size: 56px; margin: 0 auto; }

/* ===== Sidebar ===== */
.sb-title { font-size: 19px; font-weight: 600; }
.me-avatar { background: #dfe5e7; color: #fff; }
.role-strip {
  background: var(--accent-dark); color: #fff; font-size: 13px; padding: 9px 16px; display: flex; gap: 8px; align-items: center;
}
.role-strip button { margin-left: auto; text-decoration: underline; font-weight: 600; white-space: nowrap; }
.sb-search { padding: 7px 12px; background: var(--panel); border-bottom: 1px solid var(--border); }
.search-box { display: flex; align-items: center; gap: 14px; background: var(--panel-2); border-radius: 8px; height: 35px; padding: 0 12px; color: var(--muted); }
.search-box svg { width: 20px; height: 20px; }
.search-box input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; color: var(--text); }
.filters { display: flex; gap: 8px; padding: 8px 12px 6px; }
.fchip { padding: 6px 12px; border-radius: 16px; background: var(--panel-2); color: var(--muted); font-size: 14px; }
.fchip.on { background: var(--accent-soft); color: var(--accent-text); font-weight: 500; }
:root[data-theme="dark"] .fchip.on { color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .fchip.on { color: #fff; } }
.chat-list { flex: 1; overflow-y: auto; }
.chat-item { display: flex; align-items: center; width: 100%; text-align: left; padding: 0 0 0 13px; height: 72px; gap: 13px; }
.chat-item:hover { background: var(--hover); }
.chat-item.on { background: var(--active); }
.ci-body { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: center; border-bottom: 1px solid var(--border); padding-right: 15px; }
.ci-top, .ci-bot { display: flex; align-items: center; gap: 6px; }
.ci-name { flex: 1; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-time { font-size: 12px; color: var(--muted); }
.ci-time.unread { color: var(--unread); }
.ci-prev { flex: 1; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.ci-badge { background: var(--unread); color: #fff; font-size: 12px; font-weight: 600; min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 6px; }
.ci-tag { font-size: 11px; color: var(--accent-text); background: var(--accent-soft); border-radius: 4px; padding: 1px 5px; }
:root[data-theme="dark"] .ci-tag { color: #fff; }
.empty-list { padding: 40px 24px; text-align: center; color: var(--muted); }

.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: 44px; z-index: 30; background: var(--panel); min-width: 230px; padding: 9px 0;
  border-radius: 3px; box-shadow: 0 2px 5px rgba(11, 20, 26, .26), 0 2px 10px rgba(11, 20, 26, .16);
}
.menu button { display: block; width: 100%; text-align: left; padding: 12px 24px; font-size: 14.5px; }
.menu button:hover { background: var(--hover); }

/* ===== Chat ===== */
.chat { background: var(--chat-bg); position: relative; }
.chat-head { border-left: 1px solid var(--border); }
.chat-head .back { display: none; margin-left: -8px; }
.ch-meta { flex: 1; min-width: 0; cursor: pointer; text-align: left; }
.ch-name { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-sub.typing { color: var(--accent); }
.cart-pill {
  display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px 0 10px; border-radius: 18px;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 13.5px;
}
.cart-pill svg { width: 20px; height: 20px; }
.cart-pill.empty { background: transparent; color: var(--icon); padding: 0 8px; }
.cart-pill.empty:hover { background: rgba(0, 0, 0, .06); }

.messages {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 0 8px; position: relative;
  background-color: var(--chat-bg);
  background-image:
    radial-gradient(circle at 20px 20px, var(--doodle) 0 5px, transparent 6px),
    radial-gradient(circle at 70px 60px, var(--doodle) 0 3px, transparent 4px),
    linear-gradient(45deg, transparent 46%, var(--doodle) 47% 53%, transparent 54%);
  background-size: 90px 90px, 90px 90px, 45px 45px;
}
.msgs-inner { padding: 0 7%; display: flex; flex-direction: column; }
@media (max-width: 1100px) { .msgs-inner { padding: 0 4%; } }
.notice {
  align-self: center; max-width: 520px; text-align: center; margin: 6px auto 12px; padding: 6px 12px 8px;
  background: var(--notice-bg); color: var(--notice-text); border-radius: 7.5px; font-size: 12.5px; box-shadow: var(--shadow);
}
.day { align-self: center; margin: 12px 0 10px; padding: 5px 12px 6px; background: var(--day-bg); border-radius: 7.5px; font-size: 12.5px; color: var(--muted); box-shadow: var(--shadow); text-transform: uppercase; }
.row { display: flex; margin-bottom: 2px; }
.row.out { justify-content: flex-end; }
.row.first { margin-top: 10px; }
.bubble {
  position: relative; max-width: 65%; padding: 6px 7px 8px 9px; border-radius: 7.5px; background: var(--in);
  box-shadow: var(--shadow); word-wrap: break-word; overflow-wrap: anywhere;
}
.row.out .bubble { background: var(--out); }
.row.first.in .bubble { border-top-left-radius: 0; }
.row.first.out .bubble { border-top-right-radius: 0; }
.row.first.in .bubble::before, .row.first.out .bubble::before {
  content: ""; position: absolute; top: 0; width: 8px; height: 13px; background: inherit;
}
.row.first.in .bubble::before { left: -8px; clip-path: polygon(0 0, 100% 0, 100% 100%); }
.row.first.out .bubble::before { right: -8px; clip-path: polygon(0 0, 100% 0, 0 100%); }
.sender { font-size: 12.8px; font-weight: 500; margin-bottom: 2px; }
.txt { white-space: pre-wrap; font-size: 14.2px; }
.meta { float: right; margin: 8px 0 -6px 10px; font-size: 11px; color: var(--muted); display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; position: relative; top: 2px; }
.ticks { width: 16px; height: 11px; fill: #53bdeb; }
.quote {
  display: flex; gap: 8px; align-items: stretch; background: rgba(0, 0, 0, .05); border-radius: 6px; overflow: hidden;
  border-left: 4px solid var(--accent); margin: 0 0 4px; min-width: 220px; text-align: left; width: 100%;
}
:root[data-theme="dark"] .quote { background: rgba(0, 0, 0, .2); }
.quote .q-body { padding: 6px 4px 6px 6px; flex: 1; min-width: 0; }
.quote .q-name { font-size: 12.8px; font-weight: 600; color: var(--accent-text); }
.quote .q-text { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quote .q-thumb { width: 56px; flex: none; }
.quote .q-thumb svg, .quote .q-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Product post */
.product-bubble { width: 340px; max-width: 85%; padding: 3px 3px 0; }
.p-media { display: block; width: 100%; aspect-ratio: 1 / 1; border-radius: 6px; overflow: hidden; position: relative; background: #ddd; }
.p-media svg, .p-media img, .sh-main svg, .sh-main img, .thumb svg, .thumb img, .cat-card .cc-img svg, .cat-card .cc-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.p-media .sold, .cc-img .sold {
  position: absolute; inset: 0; display: grid; place-items: center; background: rgba(17, 27, 33, .55);
  color: #fff; font-weight: 700; letter-spacing: 2px; font-size: 18px;
}
.disc { position: absolute; top: 10px; left: 10px; background: var(--danger); color: #fff; font-weight: 700; font-size: 12px; padding: 3px 8px; border-radius: 12px; }
.img-count { position: absolute; bottom: 8px; right: 8px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 10px; }
.p-cap { padding: 7px 7px 8px; }
.p-name { font-weight: 600; font-size: 15px; }
.p-price { font-size: 15px; font-weight: 600; color: var(--price); margin-top: 1px; }
:root[data-theme="dark"] .p-price { color: #4cd5a7; }
.p-price s, .sh-price s { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 6px; }
.p-text { margin-top: 4px; white-space: pre-wrap; }
.p-opts { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; font-size: 13px; color: var(--muted); }
.p-opts .dots { display: inline-flex; gap: 4px; vertical-align: middle; margin-left: 4px; }
.dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .18); display: inline-block; }
.p-stock { margin-top: 6px; font-size: 12.5px; font-weight: 600; }
.p-stock.low { color: var(--warn); }
.p-stock.out { color: var(--danger); }
.p-stock.ok { color: var(--muted); font-weight: 400; }
.p-actions { display: flex; border-top: 1px solid rgba(0, 0, 0, .08); margin: 0 -3px; }
:root[data-theme="dark"] .p-actions { border-color: rgba(255, 255, 255, .08); }
.p-actions button { flex: 1; padding: 10px 6px; color: var(--link); font-weight: 500; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.p-actions button + button { border-left: 1px solid rgba(0, 0, 0, .08); }
:root[data-theme="dark"] .p-actions button + button { border-color: rgba(255, 255, 255, .08); }
.p-actions button:hover { background: rgba(0, 0, 0, .03); }
.p-actions button:disabled { color: var(--muted); cursor: not-allowed; }
.p-actions svg { width: 18px; height: 18px; }
.p-actions button.p-import { flex: 0 0 auto; padding: 10px 14px; }

/* Receipt */
.receipt-bubble { width: 340px; max-width: 88%; padding: 3px 3px 0; }
.rc-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 6px; }
.rc-head b { font-size: 15px; }
.status { font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 10px; white-space: nowrap; }
.status.warn { background: var(--warn-bg); color: var(--warn); }
.status.ok { background: var(--ok-bg); color: var(--ok); }
.status.info { background: var(--info-bg); color: var(--info); }
.status.bad { background: var(--bad-bg); color: var(--danger); }
.rc-items { background: rgba(255, 255, 255, .55); border-radius: 6px; padding: 4px 8px; }
:root[data-theme="dark"] .rc-items { background: rgba(0, 0, 0, .18); }
.rc-item { display: flex; gap: 10px; align-items: center; padding: 6px 0; }
.rc-item + .rc-item { border-top: 1px dashed rgba(0, 0, 0, .12); }
.rc-thumb { width: 42px; height: 42px; border-radius: 6px; overflow: hidden; flex: none; }
.rc-thumb svg, .rc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rc-info { flex: 1; min-width: 0; font-size: 13px; }
.rc-info .n { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-info .v { color: var(--muted); }
.rc-amt { font-weight: 600; font-size: 13px; }
.rc-sum { padding: 8px 8px 0; font-size: 13px; }
.rc-sum div { display: flex; justify-content: space-between; padding: 1px 0; }
.rc-sum .tot { font-weight: 700; font-size: 15px; padding-top: 4px; }
.rc-det { padding: 6px 8px 8px; font-size: 12.5px; color: var(--muted); }

/* Composer */
.composer { flex: none; display: flex; align-items: flex-end; gap: 8px; padding: 5px 16px; background: var(--panel-2); min-height: 62px; position: relative; }
.composer .field-wrap { flex: 1; min-width: 0; background: var(--input); border-radius: 8px; display: flex; flex-direction: column; margin: 5px 0; }
.composer input { border: 0; outline: 0; background: transparent; height: 42px; padding: 0 12px; font-size: 15px; width: 100%; }
.composer .icon-btn { margin-bottom: 6px; }
.send-btn { color: var(--icon); }
.locked { flex: 1; text-align: center; color: var(--muted); padding: 14px; font-size: 14px; }
.locked button { color: var(--link); font-weight: 600; margin-left: 6px; }
.reply-bar { display: flex; gap: 8px; padding: 6px 6px 0; }
.reply-bar .quote { margin: 0; }
.emoji-pop {
  position: absolute; bottom: 64px; left: 16px; background: var(--panel); border-radius: 12px; padding: 8px;
  box-shadow: 0 2px 10px rgba(11, 20, 26, .2); display: grid; grid-template-columns: repeat(8, 38px); gap: 2px; z-index: 5;
}
.emoji-pop button { font-size: 24px; height: 38px; border-radius: 8px; }
.emoji-pop button:hover { background: var(--hover); }

.intro { flex: 1; display: grid; place-items: center; text-align: center; padding: 40px; background: var(--panel-2); border-left: 1px solid var(--border); border-bottom: 6px solid var(--brand-orange); }
.intro h1 { font-weight: 300; font-size: 32px; margin: 26px 0 10px; color: var(--text); }
.intro p { color: var(--muted); max-width: 520px; margin: 0 auto 8px; font-size: 14px; }
.intro .steps { display: flex; gap: 12px; justify-content: center; margin-top: 26px; flex-wrap: wrap; }
.intro .step { background: var(--panel); border-radius: 12px; padding: 14px; width: 150px; font-size: 13px; color: var(--muted); }
.intro .step b { display: block; font-size: 22px; margin-bottom: 4px; }
.intro-logo { width: 96px; height: 96px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; margin: 0 auto; color: #fff; }
.intro-logo svg { width: 52px; height: 52px; }

/* ===== Drawer ===== */
.dr-head { gap: 20px; background: var(--panel); border-bottom: 1px solid var(--border); }
.dr-title { font-size: 16px; font-weight: 500; flex: 1; min-width: 0; }
.dr-title small { display: block; font-size: 12.5px; color: var(--muted); font-weight: 400; }
.dr-body { flex: 1; overflow-y: auto; padding-bottom: 16px; }
.dr-foot { flex: none; background: var(--panel); border-top: 1px solid var(--border); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
.card { background: var(--panel); padding: 14px 18px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(11, 20, 26, .05); }
.card h3 { margin: 0 0 10px; font-size: 14px; color: var(--accent-text); font-weight: 500; }
:root[data-theme="dark"] .card h3 { color: #4cd5a7; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 14px; }
.kv span:first-child { color: var(--muted); }
.kv.big { font-size: 16px; font-weight: 700; }
.kv.big span:first-child { color: var(--text); }

.cart-item { display: flex; gap: 12px; padding: 12px 0; }
.cart-item + .cart-item { border-top: 1px solid var(--border); }
.ci-img { width: 64px; height: 64px; border-radius: 8px; overflow: hidden; flex: none; cursor: pointer; }
.ci-img svg, .ci-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ci-info { flex: 1; min-width: 0; }
.ci-info .n { font-weight: 600; }
.ci-info .v { color: var(--muted); font-size: 13px; }
.ci-info .pr { font-weight: 600; margin-top: 2px; }
.ci-ctrl { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.link-btn { color: var(--danger); font-size: 13px; display: inline-flex; gap: 4px; align-items: center; }
.link-btn svg { width: 18px; height: 18px; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 20px; overflow: hidden; background: var(--panel); }
.stepper button { width: 34px; height: 32px; font-size: 18px; font-weight: 600; color: var(--accent-text); }
.stepper button:disabled { color: var(--muted); opacity: .5; cursor: not-allowed; }
.stepper span { min-width: 32px; text-align: center; font-weight: 600; }
.stepper.lg button { width: 44px; height: 40px; }
.stepper.lg span { min-width: 40px; font-size: 16px; }

.btn { height: 44px; padding: 0 20px; border-radius: 24px; font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.ghost { border: 1.5px solid var(--accent); color: var(--accent-text); background: transparent; }
:root[data-theme="dark"] .btn.ghost { color: #4cd5a7; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { height: 34px; font-size: 13.5px; padding: 0 14px; }

.empty { text-align: center; padding: 50px 30px; color: var(--muted); }
.empty .big { font-size: 56px; }
.empty p { margin: 8px 0 18px; }

/* Forms */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field input:not([type=radio]):not([type=checkbox]):not([type=color]):not([type=file]), .field textarea, .field select {
  width: 100%; border: 1px solid var(--border); background: var(--input); border-radius: 8px; padding: 10px 12px; outline: 0;
}
.field textarea { resize: vertical; min-height: 70px; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.field.err input, .field.err textarea { border-color: var(--danger); }
.err-msg { color: var(--danger); font-size: 12.5px; margin-top: 4px; }
.hint { font-size: 12.5px; color: var(--muted); }
.radio {
  display: flex; gap: 12px; align-items: center; padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; cursor: pointer; background: var(--panel);
}
.radio.on { border-color: var(--accent); background: var(--accent-soft); }
:root[data-theme="dark"] .radio.on { background: rgba(0, 168, 132, .12); }
.radio.dis { opacity: .5; cursor: not-allowed; }
.radio input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
.radio .r-main { flex: 1; min-width: 0; }
.radio .r-sub { font-size: 12.5px; color: var(--muted); }
.radio .r-amt { font-weight: 600; }
.bank-box { border: 1px dashed var(--accent); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; background: var(--panel); margin-top: 4px; }
.bank-box b { font-size: 17px; letter-spacing: .5px; }

/* Catalog */
.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 12px; }
.cat-card { background: var(--panel); border-radius: 10px; overflow: hidden; text-align: left; box-shadow: 0 1px 3px rgba(11, 20, 26, .08); }
.cat-card .cc-img { aspect-ratio: 1 / 1; position: relative; }
.cat-card .cc-b { padding: 8px 10px 10px; }
.cat-card .n { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-card .pr { font-size: 13.5px; color: var(--price); font-weight: 600; }
:root[data-theme="dark"] .cat-card .pr { color: #4cd5a7; }
.cat-search { padding: 12px 12px 0; }

/* Orders */
.order-card { background: var(--panel); margin: 10px 12px; border-radius: 10px; padding: 12px 14px; box-shadow: 0 1px 3px rgba(11, 20, 26, .06); }
.oc-top { display: flex; align-items: center; gap: 8px; }
.oc-top b { flex: 1; }
.oc-sub { color: var(--muted); font-size: 12.5px; margin: 2px 0 6px; }
.oc-items { font-size: 13px; }
.oc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.oc-foot select { border: 1px solid var(--border); background: var(--input); border-radius: 8px; padding: 7px 8px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px 12px 0; }
.kpi { background: var(--panel); border-radius: 10px; padding: 10px 12px; }
.kpi .l { font-size: 12px; color: var(--muted); }
.kpi .v { font-size: 17px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* Post form */
.swatch-row { display: flex; flex-wrap: wrap; gap: 8px; }
.cchip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 6px; border-radius: 16px; border: 1px solid var(--border); font-size: 13px; background: var(--panel); }
.cchip.on { border-color: var(--accent); background: var(--accent-soft); }
:root[data-theme="dark"] .cchip.on { background: rgba(0, 168, 132, .15); }
.preset-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.preset-row button { font-size: 12.5px; padding: 4px 10px; border-radius: 12px; background: var(--panel-2); color: var(--muted); }
.img-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.img-grid .im { aspect-ratio: 1; border-radius: 8px; overflow: hidden; position: relative; background: var(--panel-2); }
.img-grid .im img, .img-grid .im svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-grid .im button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0, 0, 0, .6); color: #fff; font-size: 14px; line-height: 22px; }
.img-add { aspect-ratio: 1; border-radius: 8px; border: 1.5px dashed var(--muted); display: grid; place-items: center; color: var(--muted); cursor: pointer; font-size: 12px; text-align: center; }
.img-add input { display: none; }
.art-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.art-row button { aspect-ratio: 1; border-radius: 8px; overflow: hidden; border: 2px solid transparent; }
.art-row button.on { border-color: var(--accent); }
.art-row svg { width: 100%; height: 100%; display: block; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.custom-color { display: flex; gap: 6px; margin-top: 8px; }
.custom-color input[type=text] { flex: 1; border: 1px solid var(--border); background: var(--input); border-radius: 8px; padding: 6px 10px; min-width: 0; }
.custom-color input[type=color] { width: 40px; height: 34px; border: 0; padding: 0; background: none; }

/* Info */
.info-hero { text-align: center; padding: 28px 18px 18px; }
.info-hero h2 { margin: 14px 0 2px; font-weight: 400; font-size: 22px; }
.info-hero p { margin: 0; color: var(--muted); }

/* ===== Product sheet ===== */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(11, 20, 26, .6); z-index: 60; display: grid; place-items: center; padding: 20px; }
.sheet-backdrop.anim { animation: fade .15s ease; }
.sheet-backdrop.anim .sheet { animation: pop .18s ease; }
.sheet {
  background: var(--panel); width: min(900px, 100%); max-height: calc(100dvh - 40px); border-radius: 14px; overflow: hidden;
  display: grid; grid-template-columns: 1fr 1fr; position: relative;
}
.sheet-close { position: absolute; top: 10px; right: 10px; z-index: 2; background: var(--panel); box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }
.sh-gallery { background: var(--panel-2); display: flex; flex-direction: column; min-height: 0; }
.sh-main { aspect-ratio: 1 / 1; position: relative; }
.thumbs { display: flex; gap: 6px; padding: 8px; overflow-x: auto; }
.thumb { width: 56px; height: 56px; border-radius: 6px; overflow: hidden; border: 2px solid transparent; flex: none; }
.thumb.on { border-color: var(--accent); }
.sh-info { padding: 22px 24px; overflow-y: auto; display: flex; flex-direction: column; }
.sh-shop { font-size: 13px; color: var(--accent-text); font-weight: 600; }
:root[data-theme="dark"] .sh-shop { color: #4cd5a7; }
.sh-info h2 { margin: 4px 40px 6px 0; font-size: 22px; font-weight: 600; line-height: 1.25; }
.sh-price { font-size: 22px; font-weight: 700; }
.sh-desc { color: var(--muted); margin: 10px 0 4px; }
.opt { margin-top: 16px; }
.opt-label { font-size: 13.5px; margin-bottom: 8px; color: var(--muted); }
.opt-label b { color: var(--text); font-weight: 600; }
.opt-label.need { color: var(--danger); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .2); position: relative; }
.swatch.on { box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--accent); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-width: 46px; padding: 8px 14px; border-radius: 20px; border: 1px solid var(--border); background: var(--panel); font-weight: 500; }
.chip:hover { border-color: var(--muted); }
.chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
:root[data-theme="dark"] .chip.on { background: rgba(0, 168, 132, .15); color: #4cd5a7; }
.chip small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.sh-qty { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.sh-total { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: baseline; }
.sh-total b { font-size: 20px; }
.sh-err { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 0; }
.sh-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px); background: #191919; color: #fff; padding: 10px 18px;
  border-radius: 22px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 80; max-width: calc(100vw - 32px); text-align: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { color: #ff8a3d; font-weight: 700; margin-left: 10px; }

/* ===== Mobile ===== */
@media (max-width: 900px) {
  .app, .app.has-drawer { grid-template-columns: 1fr; }
  .app .chat { display: none; }
  .app.has-chat .sidebar { display: none; }
  .app.has-chat .chat { display: flex; }
  .pane-head { background: var(--accent-dark); color: #fff; }
  .pane-head .icon-btn, .pane-head .ch-sub { color: #fff; }
  .pane-head .ch-sub { opacity: .85; }
  .cart-pill { background: #fff; color: var(--accent-text); }
  .cart-pill.empty { background: transparent; color: #fff; }
  .chat-head .back { display: grid; }
  .chat-head { gap: 6px; padding: 0 6px 0 8px; }
  .chat-head .icon-btn { width: 38px; }
  .dr-head { background: var(--accent-dark); color: #fff; border: 0; }
  .dr-head .dr-title small { color: rgba(255, 255, 255, .8); }
  .drawer { position: fixed; inset: 0; z-index: 50; border: 0; animation: up .18s ease; }
  .msgs-inner { padding: 0 3%; }
  .bubble { max-width: 85%; }
  .product-bubble, .receipt-bubble { max-width: 88%; }
  .sheet-backdrop { padding: 0; place-items: end stretch; }
  .sheet { grid-template-columns: 1fr; border-radius: 16px 16px 0 0; max-height: 94dvh; overflow-y: auto; width: 100%; }
  .sheet-backdrop.anim .sheet { animation: up .2s ease; }
  .sh-gallery { flex-direction: row; justify-content: center; }
  .sh-main { aspect-ratio: 1 / 1; width: min(72vw, 300px); flex: none; }
  .thumbs { flex-direction: column; }
  .sh-info { overflow: visible; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
  .sh-actions { position: sticky; bottom: 0; background: var(--panel); padding-top: 10px; margin-bottom: -6px; }
  .role-strip { font-size: 12.5px; }
  .kpis .kpi .v { font-size: 15px; }
  .emoji-pop { grid-template-columns: repeat(7, 38px); left: 8px; }
  .toast { bottom: 80px; }
}
@media (max-width: 380px) { .cat-grid { gap: 8px; padding: 8px; } }

/* ===== Product videos ===== */
.p-media video, .sh-main video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.sh-main video.sh-video { object-fit: contain; }
.play {
  position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%;
  background: rgba(11, 20, 26, .62); display: grid; place-items: center; pointer-events: none; backdrop-filter: blur(2px);
}
.play svg { width: 28px; height: 28px; fill: #fff; margin-left: 3px; }
.play.sm { width: 26px; height: 26px; margin: -13px 0 0 -13px; }
.play.sm svg { width: 15px; height: 15px; margin-left: 2px; }
.thumb { position: relative; }
.thumb svg.art { width: 100%; height: 100%; }
.vid-prev { border-radius: 10px; overflow: hidden; background: #000; }
.vid-prev video { width: 100%; max-height: 260px; display: block; }
.vid-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; background: var(--panel-2); font-size: 13px; color: var(--muted); }
.vid-add { aspect-ratio: auto; padding: 18px; display: flex; gap: 12px; justify-content: flex-start; text-align: left; font-size: 14px; }
.vid-add small { color: var(--muted); }

/* ---------- group members & moderators ---------- */
.day.evt { text-transform: none; max-width: 85%; text-align: center; }
.member-list { display: grid; }
.member { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.member:first-child { border-top: 0; }
.member .avatar.sm { width: 36px; height: 36px; font-size: 15px; }
.m-body { flex: 1; min-width: 0; }
.m-name { font-weight: 600; font-size: 14.5px; overflow-wrap: anywhere; }
.m-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.m-actions .btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.btn.ghost.danger { border-color: var(--danger); color: var(--danger); }
.role-tag { display: inline-block; font-size: 11px; font-weight: 600; border-radius: 4px; padding: 1px 6px; margin-left: 4px; vertical-align: 1px; }
.role-tag.owner { color: var(--accent-text); background: var(--accent-soft); }
.role-tag.mod { color: #7a4b00; background: #fff1d6; }
:root[data-theme="dark"] .role-tag.owner, :root[data-theme="dark"] .role-tag.mod { color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .role-tag.owner, :root:not([data-theme="light"]) .role-tag.mod { color: #fff; } :root:not([data-theme="light"]) .role-tag.mod { background: #6b4a12; } }
:root[data-theme="dark"] .role-tag.mod { background: #6b4a12; }
@media (max-width: 480px) { .member { flex-wrap: wrap; } .m-actions { width: 100%; justify-content: flex-start; padding-left: 46px; } }

/* ---------- guest preview (invite link, not logged in / not a member) ---------- */
.guest-side { margin: 10px 12px 4px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--text); font-size: 13.5px; line-height: 1.45; }
.guest-bar { justify-content: center; gap: 10px; flex-wrap: wrap; }
.guest-prompt-wrap { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; }
.guest-backdrop { position: absolute; inset: 0; background: rgba(11, 20, 26, .55); }
.guest-prompt { position: relative; width: min(380px, 100%); background: var(--panel); color: var(--text); border-radius: 16px; padding: 24px 22px 18px; box-shadow: 0 18px 50px rgba(0,0,0,.28); text-align: center; display: grid; gap: 10px; animation: gp-in .18s ease-out; }
.guest-prompt h2 { margin: 0; font-size: 20px; }
.guest-prompt p { margin: 0 0 6px; color: var(--muted); line-height: 1.5; }
.gp-emoji { font-size: 34px; line-height: 1; }
@keyframes gp-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .guest-prompt { animation: none; } }

/* ---------- share a product ---------- */
.share-hero { display: flex; gap: 12px; align-items: center; }
.share-hero .sh-th { width: 64px; height: 64px; border-radius: 8px; overflow: hidden; flex: none; background: var(--panel-2); }
.share-hero .sh-th img, .share-hero .sh-th svg, .share-hero .sh-th video { width: 100%; height: 100%; object-fit: cover; display: block; }
.share-hero .price { color: var(--price); font-weight: 700; }
.share-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.share-btns .btn { height: 40px; padding: 0 16px; font-size: 14px; }
.share-btns svg { width: 18px; height: 18px; fill: currentColor; }
.share-url { width: 100%; margin-top: 10px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.share-list { display: grid; max-height: 46vh; overflow: auto; }
.share-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-top: 1px solid var(--border); cursor: pointer; }
.share-row:first-child { border-top: 0; }
.share-row input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.share-row .avatar.sm { width: 36px; height: 36px; font-size: 15px; }
.sh-actions .btn svg { width: 18px; height: 18px; fill: currentColor; }
.share-btns a.btn { text-decoration: none; }

/* ---------- wholesale ---------- */
.p-wholesale { font-size: 13px; color: #7a4b00; background: #fff1d6; border-radius: 6px; padding: 3px 7px; margin: 4px 0 2px; display: inline-block; }
.ws-tag { display: inline-block; font-size: 11px; font-weight: 700; color: #7a4b00; background: #fff1d6; border-radius: 4px; padding: 1px 6px; margin-left: 6px; vertical-align: 3px; letter-spacing: .2px; }
.ws-hint { font-size: 13.5px; line-height: 1.45; padding: 9px 11px; border-radius: 9px; background: #fff7e8; color: #5c3a00; margin: 8px 0; border: 1px solid #f6ddb0; }
.ws-hint.on { background: var(--accent-soft); color: var(--text); border-color: transparent; }
.ws-small { font-size: 11.5px; color: #7a4b00; margin-top: 2px; }
:root[data-theme="dark"] .p-wholesale, :root[data-theme="dark"] .ws-tag { background: #6b4a12; color: #fff; }
:root[data-theme="dark"] .ws-hint { background: #3b2c12; color: #f3e2c2; border-color: #5c4519; }
:root[data-theme="dark"] .ws-small { color: #f0c27a; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .p-wholesale, :root:not([data-theme="light"]) .ws-tag { background: #6b4a12; color: #fff; }
  :root:not([data-theme="light"]) .ws-hint { background: #3b2c12; color: #f3e2c2; border-color: #5c4519; }
  :root:not([data-theme="light"]) .ws-small { color: #f0c27a; }
}


/* ---------- MichoCart brand: #191919 bars on every screen size ---------- */
.pane-head { background: var(--brand); color: #fff; }
.pane-head .icon-btn, .pane-head .ch-sub, .pane-head .ch-name, .pane-head .sb-title { color: #fff; }
.pane-head .ch-sub { opacity: .8; }
.pane-head .icon-btn:hover, :root[data-theme="dark"] .pane-head .icon-btn:hover { background: rgba(255, 255, 255, .1); }
.pane-head .icon-btn.on { background: rgba(255, 255, 255, .16); }
.pane-head .cart-pill { background: #fff; color: var(--brand); }
.pane-head .cart-pill.empty { background: transparent; color: #fff; }
.pane-head .menu { color: var(--text); } /* dropdown sits on a light panel, not the dark bar */
.dr-head { background: var(--brand); color: #fff; border: 0; }
.dr-head .dr-title small { color: rgba(255, 255, 255, .75); }
.dr-head .icon-btn { color: #fff; }
.chat-head { border-left-color: #2a2a2a; }
.sb-brand { height: 26px; width: auto; display: block; }
.btn.primary:hover { background: #000; }
:root[data-theme="dark"] .btn.primary:hover { background: #f97316; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary:hover { background: #f97316; } }
.icon-btn .badge, .count-badge { background: var(--unread); }
.intro-brand { width: min(320px, 70vw); height: auto; display: block; margin: 0 auto; }
.intro-brand.on-dark { display: none; }
:root[data-theme="dark"] .intro-brand.on-light { display: none; }
:root[data-theme="dark"] .intro-brand.on-dark { display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .intro-brand.on-light { display: none; } :root:not([data-theme="light"]) .intro-brand.on-dark { display: block; } }

/* Plans: locked features, low-stock alerts, CSV export */
.plan-up { display: flex; gap: 10px; align-items: flex-start; background: var(--accent-soft, #fff4ec); border-radius: 10px; padding: 12px 14px; margin: 12px 12px 0; }
.card .plan-up { margin: 0; }
.plan-up .lock { font-size: 18px; line-height: 1.2; }
.plan-up p { margin: 0 0 8px; font-size: 14px; }
.plan-up .hint { font-size: 13px; color: var(--muted); }
.low-stock { margin: 12px 12px 0; border: 1px solid #f0b37e; background: rgba(234, 88, 12, .08); border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.low-stock ul { list-style: none; margin: 6px 0 0; padding: 0; }
.low-stock li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.low-stock li small { color: var(--muted); }
.low-stock li b { color: #c2410c; white-space: nowrap; }
.export-row { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 10px 12px 0; }
.export-row .link-btn { font-size: 14px; color: var(--link, #c2410c); font-weight: 600; text-decoration: none; }

/* Shop photo + business banner */
.avatar.has-img { overflow: hidden; padding: 0; }
.avatar.has-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.info-hero.has-banner { padding-top: 0; overflow: hidden; }
.info-banner { aspect-ratio: 3 / 1; margin: 0 -18px; background: var(--panel-2) center / cover no-repeat; }
.info-hero.has-banner .avatar.xl { margin-top: -60px; border: 4px solid var(--panel); position: relative; }

/* MichoCart verified-vendor badge */
.vbadge { display: inline-block; vertical-align: -2px; margin-left: 4px; flex: none; }
.ci-name .vbadge { vertical-align: -3px; }
.info-hero h2 .vbadge { vertical-align: -3px; margin-left: 6px; }
.vb-label { color: #ea580c; font-weight: 600; }

/* ---------- notifications (bell drawer) ---------- */
.note-tools { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px 4px; }
.note-list { display: flex; flex-direction: column; }
.note {
  display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; padding: 12px 16px;
  border-bottom: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer;
}
.note:hover { background: var(--hover); }
.note.unread { background: color-mix(in srgb, var(--unread) 7%, var(--panel)); }
.note.unread:hover { background: color-mix(in srgb, var(--unread) 12%, var(--panel)); }
.note-ic { width: 38px; height: 38px; flex: none; border-radius: 50%; background: var(--panel-2); display: grid; place-items: center; font-size: 19px; }
.note-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.note-t { font-weight: 600; font-size: 14.5px; line-height: 1.3; }
.note.unread .note-t { font-weight: 700; }
.note-n { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--unread); color: #fff; font-size: 11px; text-align: center; vertical-align: 1px; }
.note-b { color: var(--muted); font-size: 13.5px; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.note-at { color: var(--muted); font-size: 12px; margin-top: 2px; }
.note-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--unread); flex: none; margin-top: 6px; }
.note-pref { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--border); cursor: pointer; }
.note-pref:last-child { border-bottom: 0; }
.note-pref small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.switch { appearance: none; -webkit-appearance: none; width: 42px; height: 24px; border-radius: 12px; background: #c4cbd0; position: relative; flex: none; cursor: pointer; transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch:checked { background: var(--unread); }
.switch:checked::after { transform: translateX(18px); }
.switch:focus-visible { outline: 2px solid var(--unread); outline-offset: 2px; }

/* ---------- ratings & reviews (group info) ---------- */
.stars { color: #f5a623; letter-spacing: 1px; font-size: 15px; white-space: nowrap; }
.stars .off { color: #c9ced2; }
:root[data-theme="dark"] .stars .off { color: #4a4a4a; }
.rv-hero { margin: 6px 0 0; display: flex; align-items: center; justify-content: center; gap: 6px; }
.rv-sum { display: flex; gap: 18px; align-items: center; margin-bottom: 12px; }
.rv-avg { display: flex; flex-direction: column; align-items: center; min-width: 92px; }
.rv-avg > b { font-size: 34px; line-height: 1.1; font-weight: 700; }
.rv-bars { flex: 1; display: grid; gap: 4px; }
.rv-bar { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.rv-bar i { flex: 1; height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.rv-bar b { display: block; height: 100%; background: #f5a623; border-radius: 3px; }
.rv-mine { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--panel-2); }
.rv-form { display: grid; gap: 8px; padding: 10px; border-radius: 10px; background: var(--panel-2); }
.rv-form textarea { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: var(--panel); color: var(--text); font: inherit; resize: vertical; }
.rv-pick { display: flex; gap: 4px; }
.rv-pick button { font-size: 30px; line-height: 1; color: #c9ced2; padding: 0 2px; background: none; border: 0; cursor: pointer; }
.rv-pick button.on { color: #f5a623; }
.rv-actions { display: flex; justify-content: space-between; align-items: center; }
.rv-list { margin-top: 10px; }
.rv { padding: 10px 0; border-top: 1px solid var(--border); }
.rv-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; }
.rv-body { margin-top: 4px; font-size: 14px; white-space: pre-line; }
.rv.is-hidden { opacity: .6; }
.rv-tag { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--panel-2); color: var(--muted); }
.rv-card .link-btn { color: var(--link, #c2410c); font-weight: 500; }
.rv .link-btn { margin-top: 4px; font-size: 12.5px; }
.rv-card .link-btn.danger { color: var(--danger); }

/* ---------- order details & payment proof ---------- */
.od-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.od-alert { margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--unread) 10%, var(--panel)); font-size: 13.5px; }
.od-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.od .kv span:last-child { text-align: right; overflow-wrap: anywhere; }
.od .kv a { color: var(--link, #c2410c); }
.od-note { white-space: pre-line; padding: 8px 10px; border-left: 3px solid var(--unread); background: var(--panel-2); border-radius: 0 8px 8px 0; }
.proof { display: grid; gap: 6px; }
.proof img { width: 100%; max-height: 420px; object-fit: contain; background: var(--panel-2); border-radius: 10px; border: 1px solid var(--border); cursor: zoom-in; }
.proof-pdf { display: block; padding: 12px; border-radius: 10px; background: var(--panel-2); color: var(--link, #c2410c); font-weight: 600; }
.proof-form { display: grid; gap: 8px; margin-top: 10px; padding: 10px; border-radius: 10px; background: var(--panel-2); }
.proof-form input[type=text] { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: var(--panel); color: var(--text); font: inherit; }
.proof-pick { display: grid; place-items: center; min-height: 110px; border: 2px dashed var(--border); border-radius: 10px; cursor: pointer; color: var(--muted); text-align: center; padding: 8px; background: var(--panel); }
.proof-pick.has { border-style: solid; }
.proof-pick input { display: none; }
.proof-pick img { max-width: 100%; max-height: 240px; border-radius: 8px; }

/* ---------- store (catalog): rating & latest reviews ---------- */
.store-rv { margin: 12px 12px 0; padding: 12px; border-radius: 12px; background: var(--panel); }
.store-rv-head { display: flex; align-items: center; gap: 8px; }
.store-rv-head .link-btn { margin-left: auto; color: var(--link, #c2410c); font-weight: 600; }
.store-rv-avg { font-size: 22px; line-height: 1; }
.store-rv-list { display: flex; gap: 10px; overflow-x: auto; margin-top: 10px; padding-bottom: 4px; scroll-snap-type: x mandatory; }
.store-rv-item { flex: 0 0 230px; scroll-snap-align: start; padding: 10px; border-radius: 10px; background: var(--panel-2); display: grid; gap: 4px; align-content: start; }
.store-rv-body { font-size: 13.5px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }

/* ---------- group chat: pinned rating & rotating latest review ---------- */
.rv-pin {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 14px; text-align: left; cursor: pointer;
  background: var(--panel); border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); color: var(--text); font-size: 13px; min-height: 38px;
}
.rv-pin:hover { background: var(--hover); }
.rv-pin-score { flex: none; white-space: nowrap; }
.rv-pin-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity .25s; }
.rv-pin-text.fade { opacity: 0; }
.rv-pin-text .stars { font-size: 12px; margin-right: 4px; }
.rv-pin-q { font-style: italic; }
.rv-pin-go { flex: none; color: var(--muted); font-size: 20px; line-height: 1; }

/* ---------- Get the app (web) ---------- */
.app-banner { display: flex; align-items: center; gap: 10px; margin: 8px 12px 4px; padding: 10px 6px 10px 10px; border-radius: 12px; background: var(--accent-soft); border: 1px solid var(--border); }
.app-banner img { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.app-banner .ab-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; line-height: 1.3; }
.app-banner .ab-text span { color: var(--muted); font-size: 12px; }
.app-banner .btn { flex: none; text-decoration: none; }
.app-banner .icon-btn.sm { width: 30px; height: 30px; }
.app-banner .icon-btn.sm svg { width: 18px; height: 18px; }
.app-banner.in-chat { margin: 0; border-radius: 0; border-width: 0 0 1px; background: var(--panel); }
.gp-app { display: block; margin-top: 12px; text-align: center; font-size: 13.5px; color: var(--link, #c2410c); font-weight: 600; text-decoration: none; }

/* ---------- vendor payment methods (peer-to-peer) ---------- */
.pay-box { border: 1px dashed var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: var(--panel); }
.pay-h { margin-bottom: 4px; }
.pay-l { display: flex; align-items: baseline; gap: 8px; font-size: 13.5px; padding: 3px 0; }
.pay-l span { color: var(--muted); min-width: 110px; }
.pay-l b { flex: 1; overflow-wrap: anywhere; font-weight: 600; }
.pay-l .link-btn { color: var(--link, #c2410c); font-size: 12.5px; }
.pay-go { margin-top: 8px; text-decoration: none; display: inline-flex; }
.pay-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.pay-chip { font-size: 12.5px; padding: 3px 9px; border-radius: 12px; background: var(--panel-2); }

/* ---------- point of sale ---------- */
body.pos-open { overflow: hidden; }
.pos { position: fixed; inset: 0; z-index: 60; background: var(--panel-2); display: flex; flex-direction: column; }
.pos-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--border); min-height: 58px; }
.pos-title { flex: 1; display: flex; flex-direction: column; line-height: 1.2; }
.pos-title small { color: var(--muted); }
.pos-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr minmax(340px, 400px); }
.pos-products { min-height: 0; display: flex; flex-direction: column; padding: 12px 14px 0; }
.pos-products .search-box { margin-bottom: 10px; background: var(--panel); }
.pos-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; align-content: start; padding-bottom: 16px; }
.pos-item { display: flex; flex-direction: column; text-align: left; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; cursor: pointer; transition: transform .08s, box-shadow .08s; }
.pos-item:hover:not(:disabled) { box-shadow: 0 2px 10px rgba(0, 0, 0, .1); }
.pos-item:active:not(:disabled) { transform: scale(.98); }
.pos-item.out { opacity: .5; cursor: not-allowed; }
.pi-img { aspect-ratio: 1 / 1; background: var(--panel-2); overflow: hidden; }
.pi-img > * { width: 100%; height: 100%; object-fit: cover; display: block; }
.pi-name { padding: 8px 10px 0; font-size: 14px; font-weight: 500; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pi-meta { padding: 4px 10px 10px; display: flex; justify-content: space-between; align-items: baseline; gap: 6px; font-size: 13px; }
.pi-meta span { color: var(--muted); font-size: 12px; }
.pos-cart { min-height: 0; display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--border); }
.pos-cart-head { flex: none; display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 8px; }
.pos-lines { flex: 1; overflow-y: auto; padding: 0 16px; }
.pos-line { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.pl-main { flex: 1; min-width: 0; font-size: 14px; }
.pl-main .hint { font-size: 12px; }
.pl-amt { min-width: 76px; text-align: right; font-weight: 600; font-size: 14px; }
.pos-sum { flex: none; padding: 12px 16px 16px; border-top: 1px solid var(--border); }
.pos-disc input { width: 96px; text-align: right; border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px; background: var(--input); color: inherit; font: inherit; }
.pos-cart-acts { display: grid; grid-template-columns: auto 1fr; gap: 8px; margin-top: 10px; }
.pos-cart-acts .btn.primary { font-size: 16px; padding: 12px; }
.pos-empty { flex: 1; }
.pos-pay { flex: 1; overflow-y: auto; padding: 0 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.pos-pay .link-btn { color: var(--link); align-self: flex-start; }
.pos-due { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px; background: var(--panel-2); border-radius: 12px; }
.pos-due b { font-size: 26px; }
.pos-prow { border: 1px solid var(--border); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.pos-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pos-methods button { padding: 9px 4px; border: 1px solid var(--border); border-radius: 10px; font-size: 13px; background: var(--panel); color: inherit; }
.pos-methods button.on { border-color: var(--brand-orange); background: rgba(255, 106, 0, .1); font-weight: 600; }
.pos-amt { display: flex; align-items: center; gap: 6px; }
.pos-amt input { flex: 1; font-size: 18px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--input); color: inherit; }
.pos-change { font-size: 16px; }
.pos-check { font-size: 13px; padding: 8px 10px; border-radius: 8px; }
.pos-check.ok { background: rgba(6, 167, 125, .1); color: var(--ok); }
.pos-check.bad { background: rgba(229, 57, 53, .08); color: var(--danger); }
.pos-cust summary { cursor: pointer; color: var(--link); font-size: 14px; padding: 4px 0; }
.btn.lg { padding: 14px; font-size: 17px; }
.pos-done { flex: 1; overflow-y: auto; padding: 24px 16px; text-align: center; }
.pos-done .big { font-size: 48px; }
.pos-done h2 { margin: 6px 0; }
.pos-done .pos-change { margin: 10px 0; padding: 12px; background: rgba(255, 106, 0, .1); border-radius: 12px; font-size: 18px; }
.pos-done-acts { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.pos-done-acts .btn { justify-content: center; }
.pos-locked { padding: 30px 18px; max-width: 520px; margin: 0 auto; }
.pos-modal-wrap { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; }
.pos-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.pos-modal { position: relative; width: min(440px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--panel); border-radius: 16px; padding: 14px 16px 16px; box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
.pos-modal.wide { width: min(620px, 100%); }
.pm-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pm-head > div:nth-child(2) { flex: 1; }
.pm-thumb { width: 52px; height: 52px; border-radius: 10px; overflow: hidden; flex: none; }
.pm-thumb > * { width: 100%; height: 100%; object-fit: cover; }
.pm-opt { margin-bottom: 10px; }
.pm-vals { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.pm-vals button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px; font-size: 14px; background: var(--panel); color: inherit; }
.pm-vals button.on { border-color: var(--brand-orange); background: rgba(255, 106, 0, .1); font-weight: 600; }
.pm-vals .dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .2); }
.pm-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; }
.pos-takings { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 12px; }
.pos-takings > div { background: var(--panel-2); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.pos-takings .tot { background: rgba(255, 106, 0, .1); }
.pr-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 14px; }
.pr-row > div { flex: 1; min-width: 0; }
.pr-row.void { opacity: .55; }
.pos-mobile-bar { display: none; }
@media (max-width: 760px) {
  .pos-body { grid-template-columns: 1fr; }
  .pos-body.view-products .pos-cart { display: none; }
  .pos-body.view-cart .pos-products { display: none; }
  .pos-cart { border-left: 0; }
  .pos-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .pos-mobile-bar { display: block; flex: none; margin: 0; padding: 14px; background: var(--text, #191919); color: var(--panel, #fff); font-weight: 600; font-size: 15px; border: 0; }
  .pos-head .btn.sm { font-size: 12px; padding: 6px 10px; }
}
.pos a.btn { text-decoration: none; }
.od-history { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.od-history > div { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.od-history .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-orange); flex: none; }
.od-history .hint { margin-left: auto; font-size: 12px; }
.pos-people { margin-bottom: 12px; display: flex; flex-direction: column; gap: 4px; }
.pp-row { display: flex; gap: 10px; align-items: baseline; padding: 6px 10px; background: var(--panel-2); border-radius: 8px; font-size: 14px; }
.pp-row span:first-child { flex: 1; }

/* Product pictures: the product's colour shows while each one loads, then it fades in on its own. */
img.mimg.ok:not(.done) { animation: mimg-in .3s ease-out; }
@keyframes mimg-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { img.mimg.ok:not(.done) { animation: none; } }
