:root {
  --ink: #17221f;
  --ink-soft: #52605b;
  --paper: #f4f6f3;
  --panel: #ffffff;
  --line: #e2e8e4;
  --brand: #087c68;
  --brand-dark: #075f52;
  --brand-soft: #dff3ed;
  --accent: #e9b85e;
  --danger: #b9473f;
  --warning: #a76b15;
  --shadow: 0 18px 55px rgba(29, 53, 45, 0.10);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--ink-soft); line-height: 1.7; }
.eyebrow {
  margin: 0 0 12px;
  color: #c6e7de;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
}
.eyebrow.dark { color: var(--brand); }

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(380px, 0.8fr);
  background: #f8faf7;
}
.login-art {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: clamp(40px, 7vw, 110px);
  color: #f4fffb;
  background:
    radial-gradient(circle at 17% 20%, rgba(69, 187, 157, 0.42), transparent 32%),
    linear-gradient(145deg, #123c35 0%, #075f52 52%, #087c68 100%);
}
.login-art::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .09;
  background-image: linear-gradient(rgba(255,255,255,.7) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.7) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, transparent, #000);
}
.orb { position: absolute; border-radius: 50%; border: 1px solid rgba(255,255,255,.22); }
.orb-a { width: 430px; height: 430px; top: -130px; right: -120px; box-shadow: inset 0 0 80px rgba(255,255,255,.06); }
.orb-b { width: 230px; height: 230px; top: 18%; right: 12%; background: rgba(255,255,255,.035); }
.login-copy { position: relative; z-index: 1; max-width: 620px; }
.login-copy h1 { margin: 0 0 26px; font-family: "Songti SC", "STSong", serif; font-size: clamp(48px, 6vw, 88px); line-height: .98; font-weight: 600; letter-spacing: -0.05em; }
.login-copy h1 span { color: #b8eadc; }
.login-copy > p:last-child { max-width: 520px; color: rgba(240,255,250,.72); font-size: 16px; line-height: 1.8; }
.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin-bottom: 48px;
  border-radius: 16px 4px 16px 4px;
  color: #173b33;
  background: #d7f2e9;
  font-family: "Songti SC", serif;
  font-size: 28px;
  font-weight: 700;
}
.brand-mark.small { width: 40px; height: 40px; margin: 0; border-radius: 12px 4px 12px 4px; font-size: 21px; }
.login-card {
  align-self: center;
  padding: clamp(36px, 6vw, 80px);
}
.login-card h2 { margin: 0 0 35px; font-family: "Songti SC", serif; font-size: 34px; }
.login-card form, .form-stack { display: grid; gap: 20px; }
.login-card label, .form-stack label { color: var(--ink-soft); font-size: 13px; }
input, textarea, select {
  width: 100%;
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid #d7dfda;
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(8,124,104,.10); }
textarea { resize: vertical; line-height: 1.65; }
.field-hint { display: block; margin-top: 7px; color: #8d9994; font-size: 11px; line-height: 1.5; }
.image-preview { display: grid; gap: 8px; padding: 12px; border: 1px dashed #cbd8d2; border-radius: 12px; background: #fbfcfb; }
.image-preview img { width: 100%; max-height: 240px; object-fit: contain; border-radius: 8px; background: #fff; }
.image-preview .text-btn { justify-self: start; }
.form-error { min-height: 20px; margin: 0; color: var(--danger); font-size: 13px; }
.login-foot { margin-top: 28px; color: #87928d; font-size: 12px; text-align: center; }
.login-foot a, .icp-link { color: inherit; text-decoration: none; }

.btn {
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid #d5ddd8;
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  font-weight: 600;
  transition: transform .14s, background .14s, border-color .14s;
}
.btn:hover { transform: translateY(-1px); border-color: #b7c4bd; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.primary { color: white; border-color: var(--brand); background: var(--brand); }
.btn.primary:hover { background: var(--brand-dark); }
.btn.wide { width: 100%; min-height: 48px; }
.btn.login-wecom { display: grid; place-items: center; margin-top: 15px; color: var(--brand); text-decoration: none; }
.btn.tiny { min-height: 32px; padding: 6px 11px; font-size: 12px; }
.text-btn { padding: 0; border: 0; color: var(--brand); background: none; font-size: 12px; font-weight: 600; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 222px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  color: #ecf8f4;
  background: #102d28;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; }
.brand strong { display: block; font-family: "Songti SC", serif; font-size: 19px; }
.brand span { display: block; margin-top: 3px; color: #8caea5; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.main-nav { display: grid; gap: 5px; }
.nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 12px 13px;
  border: 0;
  border-radius: 10px;
  color: #a9c2bb;
  background: transparent;
  text-align: left;
}
.nav-item:hover { color: white; background: rgba(255,255,255,.05); }
.nav-item.active { color: white; background: rgba(86,171,149,.16); }
.nav-item.active::before { content: ""; position: absolute; left: 0; width: 3px; height: 20px; border-radius: 3px; background: #70cfb7; }
.nav-icon { color: #6ebaa7; font-size: 18px; text-align: center; }
.nav-item b { min-width: 18px; padding: 2px 5px; border-radius: 20px; background: #df5b50; color: white; font-size: 10px; text-align: center; }
.nav-item b:empty, .nav-item b[data-zero="1"] { display: none; }
.sidebar-foot { margin-top: auto; padding: 16px 9px 0; border-top: 1px solid rgba(255,255,255,.08); }
.health { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; color: #9fb9b2; font-size: 11px; }
.health i { width: 7px; height: 7px; border-radius: 50%; background: #e2ac42; box-shadow: 0 0 0 4px rgba(226,172,66,.1); }
.health i.ok { background: #5ed8b9; box-shadow: 0 0 0 4px rgba(94,216,185,.1); }
.health i.bad { background: #e1685f; }
.sidebar .text-btn { color: #8caea5; }
.icp-link { display: block; margin-top: 12px; color: #6f9087; font-size: 9px; text-decoration: none; }

.workspace { min-width: 0; padding: 0 clamp(20px, 3vw, 46px) 40px; }
.topbar { min-height: 110px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.topbar.compact { min-height: 62px; justify-content: flex-end; }
.topbar h1 { margin: 0; font-family: "Songti SC", serif; font-size: 31px; font-weight: 600; }
.topbar .eyebrow { margin-bottom: 5px; }
.top-actions { display: flex; align-items: center; gap: 16px; }
.shop-picker { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 12px; }
.shop-picker select { width: auto; min-width: 140px; margin: 0; padding: 8px 31px 8px 11px; }
.refresh-label { color: #8a9691; font-size: 11px; white-space: nowrap; }
.view { display: none; animation: view-in .22s ease; }
.view.active { display: block; }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } }

.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-strip article { display: flex; align-items: center; justify-content: space-between; min-height: 76px; padding: 17px 20px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.72); }
.stat-strip span { color: var(--ink-soft); font-size: 12px; }
.stat-strip strong { font-family: "Songti SC", serif; font-size: 26px; font-weight: 600; }
.waiting-stat strong { display: inline-flex; align-items: center; gap: 7px; }
.waiting-stat strong span { color: inherit; font: inherit; }
.status-dot { width: 9px; height: 9px; display: inline-block; border-radius: 50%; background: #45a67a; box-shadow: 0 0 0 4px rgba(69,166,122,.12); }
.status-dot.alert { background: #df5b50; box-shadow: 0 0 0 4px rgba(223,91,80,.12); }
.inbox-grid { height: calc(100vh - 220px); min-height: 560px; display: grid; grid-template-columns: minmax(270px, 340px) minmax(0, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.conversation-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; border-right: 1px solid var(--line); background: #fbfcfb; }
.panel-toolbar { flex: none; display: grid; gap: 10px; padding: 15px; border-bottom: 1px solid var(--line); }
.panel-toolbar input { margin: 0; padding: 9px 12px; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); padding: 3px; border-radius: 8px; background: #eef2ef; }
.segmented button { padding: 6px; border: 0; border-radius: 6px; color: var(--ink-soft); background: transparent; font-size: 11px; }
.segmented button.active { color: var(--ink); background: white; box-shadow: 0 2px 8px rgba(28,52,44,.08); }
.conversation-list { flex: 1; min-height: 0; overflow-y: auto; }
.conversation-item { width: 100%; display: grid; grid-template-columns: 50px minmax(0, 1fr) auto; gap: 13px; padding: 15px 17px; border: 0; border-bottom: 1px solid #edf0ee; background: transparent; text-align: left; }
.conversation-item:hover { background: #f4f8f6; }
.conversation-item.active { background: var(--brand-soft); }
.list-avatar { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 11px; color: var(--brand-dark); background: #dcebe5; font-family: "Songti SC", serif; font-size: 18px; }
.list-avatar img, .customer-avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.conversation-copy { min-width: 0; }
.conversation-top { display: flex; align-items: center; gap: 7px; }
.conversation-copy strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.conversation-copy p { overflow: hidden; margin: 7px 0 0; color: #67746e; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.unread-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #e0574d; box-shadow: 0 0 0 3px rgba(224,87,77,.12); }
.conversation-side { text-align: right; }
.conversation-side time { color: #9aa39f; font-size: 11px; }
.mini-mode { display: inline-block; margin-top: 7px; padding: 2px 6px; border-radius: 10px; color: var(--brand); background: #dff3ed; font-size: 9px; }
.mini-mode.human { color: #8f5e14; background: #f8ead0; }
.empty-state { padding: 48px 20px; color: #8b9691; font-size: 12px; text-align: center; }

.chat-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.chat-empty { margin: auto; color: #8b9691; text-align: center; }
.chat-empty-icon { width: 66px; height: 66px; display: grid; place-items: center; margin: 0 auto 18px; border: 1px solid #dce5e0; border-radius: 50%; color: var(--brand); font-size: 30px; }
.chat-empty h2 { margin: 0 0 7px; color: var(--ink); font-family: "Songti SC", serif; font-size: 23px; }
.chat-empty p { margin: 0; font-size: 12px; }
.chat-content { height: 100%; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.chat-header { min-height: 60px; display: flex; align-items: center; gap: 9px; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.customer-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; color: #fff; background: var(--brand); font-family: "Songti SC", serif; }
.chat-customer { flex: 1; min-width: 0; }
.chat-customer h2 { overflow: hidden; margin: 0; font-family: "Songti SC", serif; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.chat-customer p { overflow: hidden; margin: 3px 0 0; color: #8b9691; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.chat-customer #chat-openid, .chat-customer .dot-sep { display: none; }
.dot-sep { padding: 0 6px; }
.chat-actions { display: flex; align-items: center; gap: 3px; margin-left: auto; }
.header-link { padding: 4px 5px; border: 0; color: var(--brand); background: transparent; font-size: 10px; white-space: nowrap; }
.chat-back-btn { display: none; width: 34px; height: 34px; margin-right: -4px; border: 0; border-radius: 50%; color: var(--brand-dark); background: #edf5f1; font-size: 27px; line-height: 1; }
.mode-badge { padding: 4px 7px; border: 0; border-radius: 20px; color: var(--brand); background: var(--brand-soft); font-size: 9px; font-weight: 700; white-space: nowrap; }
.mode-badge.human { color: #8c5b11; background: #f8ead0; }
.messages { flex: 1; min-height: 0; overflow: auto; padding: 25px 22px; background: linear-gradient(180deg, #fbfcfb, #f7f9f7); }
.message { display: flex; gap: 8px; margin-bottom: 17px; }
.message.out { justify-content: flex-end; }
.message .bubble { max-width: min(76%, 630px); padding: 10px 13px; border-radius: 5px 14px 14px 14px; color: var(--ink); background: white; box-shadow: 0 3px 12px rgba(29,53,45,.06); font-size: 13px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.message.out .bubble { border-radius: 14px 5px 14px 14px; color: white; background: var(--brand); }
.message.system .bubble { color: #75511d; background: #f8eedb; }
.message-image { display: block; max-width: min(72%, 380px); max-height: 360px; margin-bottom: 7px; border: 1px solid rgba(15,64,54,.12); border-radius: 13px; object-fit: contain; background: #fff; box-shadow: 0 4px 16px rgba(29,53,45,.10); }
.message.out .message-image { margin-left: auto; }
.message-product-card { display: flex; align-items: center; gap: 11px; width: min(82%, 380px); padding: 10px; border: 1px solid #dfe8e3; border-radius: 13px; background: #fff; box-shadow: 0 4px 16px rgba(29,53,45,.08); }
.message-product-card img, .product-card-placeholder { width: 68px; height: 68px; flex: 0 0 auto; border-radius: 9px; object-fit: cover; background: #edf4f0; }
.product-card-placeholder { display: grid; place-items: center; color: #77908a; font-size: 12px; }
.message-product-card > span:last-child { min-width: 0; display: grid; gap: 7px; }
.message-product-card strong { color: var(--ink); font-size: 13px; line-height: 1.45; }
.message-product-card small { color: #8e9b96; font-size: 10px; }
.message-meta { margin-top: 5px; color: #98a39e; font-size: 9px; }
.message.out .message-meta { text-align: right; }
.composer { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: end; gap: 8px; padding: 8px 12px 10px; border-top: 1px solid var(--line); background: white; }
.composer-hint { display: none; margin: 0; color: #8d9893; font-size: 9px; }
.composer-plus { width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 1px solid #d8e2dd; border-radius: 50%; color: var(--brand-dark); background: #f4f8f6; font-size: 24px; line-height: 1; }
.composer-input { min-width: 0; }
.composer textarea { min-height: 38px; max-height: 96px; height: 38px; margin: 0; padding: 9px 11px; border-color: #dce3df; line-height: 1.4; resize: none; }
.composer-actions { display: flex; align-items: center; gap: 7px; }
.composer-actions span { color: #98a19d; font-size: 10px; }
.composer-actions .btn { min-height: 38px; padding: 8px 12px; white-space: nowrap; }

.content-grid { display: grid; gap: 18px; }
.content-grid.two-one { grid-template-columns: minmax(0, 1.35fr) minmax(320px, .8fr); }
.content-grid.one-two { grid-template-columns: minmax(300px, .78fr) minmax(0, 1.35fr); }
.stack { display: grid; align-content: start; gap: 18px; }
.card { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: 0 8px 30px rgba(29,53,45,.045); }
.card h2 { margin: 0 0 20px; font-family: "Songti SC", serif; font-size: 23px; font-weight: 600; }
.card h3 { margin: 0; font-size: 15px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 19px; }
.card-head h2 { margin: 0; }
.card-head .eyebrow { margin-bottom: 4px; }
.card-head input { width: min(250px, 45%); margin: 0; padding: 9px 12px; }
.form-stack { gap: 15px; }
.form-stack label, .form-grid label { color: var(--ink-soft); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; }
.check-row { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.check-row input { width: auto; margin: 0; accent-color: var(--brand); }
.key-field { position: relative; display: block; }
.key-field input { padding-right: 78px; font-family: ui-monospace, monospace; font-size: 11px; }
.key-field .text-btn { position: absolute; right: 12px; top: 18px; }
.notice { margin-bottom: 18px; padding: 16px 19px; border: 1px solid #eed7ad; border-radius: 12px; color: #6d4b15; background: #fff9ed; }
.notice strong { font-size: 13px; }
.notice p { margin: 6px 0 0; font-size: 12px; line-height: 1.6; }
.knowledge-list { display: grid; max-height: calc(100vh - 250px); overflow-y: auto; }
.knowledge-item { padding: 16px 2px; border-bottom: 1px solid #edf0ee; }
.knowledge-item:first-child { padding-top: 0; }
.knowledge-item header { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.knowledge-item h3 { margin: 0 0 8px; font-size: 13px; }
.knowledge-item p { display: -webkit-box; overflow: hidden; margin: 0; color: var(--ink-soft); font-size: 11px; line-height: 1.65; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.knowledge-meta { display: flex; gap: 8px; margin-top: 9px; color: #9aa39f; font-size: 9px; }
.knowledge-body { display: flex; gap: 13px; align-items: flex-start; margin-top: 9px; }
.knowledge-body p { flex: 1; min-width: 0; }
.knowledge-thumb { width: 72px; height: 72px; flex: 0 0 auto; object-fit: cover; border: 1px solid #e2e9e5; border-radius: 9px; background: #fff; }
.image-send-badge { padding: 2px 7px; border-radius: 20px; color: #82611f; background: #fff3d7; }
.experience-category { padding: 2px 7px; border-radius: 20px; color: var(--brand-dark); background: var(--brand-soft); }
.row-actions { display: flex; gap: 10px; }
.learning-list { display: grid; gap: 14px; }
.learning-item { padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfb; }
.learning-item header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.learning-item h3 { margin: 0; font-size: 14px; }
.learning-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.learning-grid label { color: var(--ink-soft); font-size: 11px; }
.learning-grid textarea { margin-top: 6px; min-height: 90px; }
.learning-reason { margin: 10px 0 0; color: var(--danger); font-size: 11px; }
.shop-list { display: grid; gap: 10px; }
.shop-card { padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfb; }
.shop-card.selected { border-color: #9dd3c5; box-shadow: inset 0 0 0 1px #9dd3c5; }
.shop-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.shop-card strong { font-size: 13px; }
.status-pill { padding: 3px 7px; border-radius: 10px; color: var(--brand); background: var(--brand-soft); font-size: 9px; }
.status-pill.off { color: #8a8f8c; background: #edf0ee; }
.shop-card p { overflow: hidden; margin: 8px 0 0; color: #8a9691; font-family: ui-monospace, monospace; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.shop-card-actions { display: flex; gap: 10px; margin-top: 10px; }
.callback-box { margin-top: 22px; padding: 18px; border-radius: 12px; background: #f2f7f4; }
.callback-box dl { display: grid; grid-template-columns: 110px 1fr; gap: 9px; font-size: 11px; }
.callback-box dt { color: var(--ink-soft); }
.callback-box dd { overflow-wrap: anywhere; margin: 0; color: var(--ink); font-family: ui-monospace, monospace; }
.wecom-card { margin-top: 18px; }
.wecom-card > .card-head .muted { max-width: 680px; margin: 7px 0 0; }
.info-card { align-self: start; color: #ecf8f4; background: #123c35; }
.info-card h2 { margin-top: 15px; }
.info-card p { color: #b5cec7; font-size: 12px; line-height: 1.75; }
.info-card .muted { color: #8daaa2; }
.spark { width: 45px; height: 45px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.13); border-radius: 50%; color: #bcebdd; font-size: 21px; }
.metric-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 22px 0; }
.metric-row div { padding: 12px; border-radius: 9px; background: rgba(255,255,255,.05); }
.metric-row span { display: block; color: #88aba2; font-size: 9px; }
.metric-row strong { display: block; margin-top: 4px; color: #fff; font-family: "Songti SC", serif; font-size: 17px; }
.guide-steps { display: grid; gap: 15px; margin: 0; padding: 0; list-style: none; }
.guide-steps li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; }
.guide-steps li > span { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 8px; color: var(--brand-dark); background: var(--brand-soft); font-size: 11px; font-weight: 700; }
.guide-steps p { margin: 3px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.65; }
.guide-steps a { color: var(--brand); font-weight: 600; }
.guide-steps code, .guide-note code { padding: 2px 5px; border-radius: 4px; color: #225d51; background: #edf5f1; font-family: ui-monospace, monospace; font-size: 10px; }
.guide-note { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 11px; line-height: 1.7; }
.provider-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 5px; }
.provider-option { display: grid; gap: 4px; padding: 11px 9px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fbfcfb; text-align: left; }
.provider-option:hover { border-color: #a8d7ca; background: #f1f8f5; }
.provider-option.active { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: var(--brand-soft); }
.provider-option strong { font-size: 11px; }
.provider-option span { color: #82908a; font-size: 9px; }
.narrow-card { max-width: 620px; }

.customer-drawer { position: fixed; inset: 0; z-index: 60; }
.drawer-backdrop { position: absolute; inset: 0; border: 0; background: rgba(18,45,38,.32); backdrop-filter: blur(2px); }
.customer-drawer-panel { position: absolute; top: 0; right: 0; width: min(460px, 92vw); height: 100%; display: flex; flex-direction: column; padding: 22px; background: #fff; box-shadow: -16px 0 50px rgba(19,48,40,.18); }
.customer-drawer-panel > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.customer-drawer-panel h2 { margin: 3px 0 0; font-family: "Songti SC", serif; font-size: 23px; }
.drawer-close { width: 32px; height: 32px; border: 0; border-radius: 50%; color: #6e7c76; background: #f1f5f3; font-size: 23px; line-height: 1; }
.drawer-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 17px 0 14px; padding: 4px; border-radius: 11px; background: #edf2ef; }
.drawer-tabs button { padding: 8px 6px; border: 0; border-radius: 8px; color: #69766f; background: transparent; font-size: 12px; }
.drawer-tabs button.active { color: var(--brand-dark); background: white; box-shadow: 0 2px 8px rgba(26,58,49,.08); }
.customer-drawer-content { flex: 1; min-height: 0; overflow-y: auto; padding-right: 2px; }
.drawer-list { display: grid; gap: 10px; }
.drawer-card { display: flex; align-items: center; gap: 11px; padding: 11px; border: 1px solid #e5ebe8; border-radius: 11px; background: #fbfcfb; }
.drawer-card img, .drawer-card-placeholder { width: 58px; height: 58px; flex: 0 0 auto; border-radius: 8px; object-fit: cover; background: #eaf1ed; }
.drawer-card-placeholder { display: grid; place-items: center; color: #87958f; font-size: 11px; }
.drawer-card-copy { min-width: 0; display: grid; gap: 5px; }
.drawer-card-copy strong { overflow: hidden; color: var(--ink); font-size: 12px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.drawer-card-copy small { color: #8a9691; font-size: 10px; line-height: 1.45; }
.drawer-order-products { display: grid; gap: 4px; }
.drawer-section-title { margin: 0 0 8px; color: #7f8c86; font-size: 11px; }
.drawer-empty { padding: 38px 14px; color: #8b9691; font-size: 12px; text-align: center; }
.drawer-profile { display: grid; gap: 12px; }
.drawer-profile-row { display: flex; justify-content: space-between; gap: 14px; padding-bottom: 10px; border-bottom: 1px solid #edf1ef; font-size: 12px; }
.drawer-profile-row span:first-child { color: #7d8984; }
.drawer-profile-row span:last-child { max-width: 70%; overflow-wrap: anywhere; text-align: right; }

.toast-stack { position: fixed; right: 22px; bottom: 22px; z-index: 50; display: grid; gap: 8px; }
.toast { min-width: 240px; max-width: 400px; padding: 12px 15px; border-radius: 10px; color: white; background: #173c34; box-shadow: var(--shadow); font-size: 12px; animation: toast-in .2s ease; }
.toast.error { background: #8f342f; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 78px minmax(0, 1fr); }
  .sidebar { padding: 19px 10px; }
  .brand { justify-content: center; padding: 0 0 25px; }
  .brand > div:last-child, .nav-item span:not(.nav-icon), .nav-item b, .health span { display: none; }
  .nav-item { grid-template-columns: 1fr; justify-items: center; }
  .health { justify-content: center; }
  .sidebar .text-btn { width: 100%; font-size: 10px; }
  .content-grid.two-one, .content-grid.one-two { grid-template-columns: 1fr; }
  .stat-strip { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-art { min-height: 42vh; padding: 34px 25px; align-items: center; }
  .login-art .brand-mark { margin-bottom: 24px; }
  .login-copy h1 { font-size: 48px; margin-bottom: 16px; }
  .login-copy > p:last-child { display: none; }
  .login-card { padding: 36px 25px 50px; }
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 20; inset: auto 0 0; height: 82px; padding: 8px 12px 10px; background: transparent; flex-direction: row; pointer-events: none; }
  .sidebar .brand, .sidebar-foot { display: none; }
  .main-nav { width: min(100%, 430px); margin: 0 auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; padding: 6px; border: 1px solid rgba(31,70,60,.08); border-radius: 30px; background: rgba(255,255,255,.97); box-shadow: 0 10px 35px rgba(20,52,44,.18); pointer-events: auto; }
  .nav-item { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 14px; border-radius: 24px; color: #66756f; }
  .nav-item span:not(.nav-icon) { display: inline; }
  .nav-item b { display: inline-block; }
  .nav-item.active { color: var(--brand-dark); background: var(--brand-soft); }
  .nav-item.active::before { display: none; }
  .nav-item:not([data-view="inbox"]):not([data-view="messages"]) { display: none; }
  .workspace { padding: 0 14px 98px; }
  .topbar { min-height: 88px; }
  .topbar.compact { min-height: 54px; }
  .topbar h1 { font-size: 26px; }
  .refresh-label { display: none; }
  .shop-picker { font-size: 0; }
  .shop-picker select { min-width: 120px; font-size: 11px; }
  .stat-strip article { min-height: 64px; padding: 12px; }
  .inbox-grid { height: calc(100vh - 250px); min-height: 510px; grid-template-columns: 1fr; }
  .conversation-panel { border: 0; }
  .conversation-side .mini-mode { display: none; }
  .chat-panel { display: none; }
  .inbox-grid.show-chat .conversation-panel { display: none; }
  .inbox-grid.show-chat .chat-panel { display: flex; }
  .chat-header { padding: 8px 10px; gap: 7px; }
  .chat-back-btn { display: block; }
  .chat-actions { gap: 0; }
  .header-link { padding: 4px 3px; font-size: 9px; }
  .mode-badge { padding: 4px 5px; font-size: 8px; }
  .messages { padding: 18px 12px; }
  .message .bubble { max-width: 88%; }
  .composer { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 6px; padding: 7px 9px 9px; }
  .composer-actions span { display: none; }
  .customer-drawer-panel { top: auto; bottom: 0; width: 100%; height: min(76vh, 680px); padding: 18px 16px 25px; border-radius: 20px 20px 0 0; box-shadow: 0 -16px 50px rgba(19,48,40,.2); }
  .card { padding: 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: 1; }
  .learning-grid { grid-template-columns: 1fr; }
  .provider-presets { grid-template-columns: 1fr 1fr; }
  .card-head { align-items: flex-start; }
  .card-head input { width: 48%; }
}
