/* Yunying Backend Bridge · Auth, Status Pill, Devices/Slots, Cloud Approvals & Chat AI */

/* Mandatory full-screen Login Gate styling */
.yy-login-backdrop[data-gate="required"] {
  background: radial-gradient(circle at 20% 20%, #1c473b 0%, #0f2922 55%, #091a16 100%) !important;
  backdrop-filter: none !important;
}
.yy-login-backdrop[data-gate="required"] .yy-login-close,
.yy-login-backdrop[data-gate="required"] [data-yy-login="close"] {
  display: none !important;
}
body.yy-auth-locked #app {
  visibility: hidden;
  pointer-events: none;
}

/* Mandatory 48x48 crisp product thumbnail */
.yy-thumb {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #dbe4db;
  background: #eff4ee;
  color: #6b8173;
}
.yy-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.yy-thumb-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 11px;
  font-weight: 600;
  color: #5b7264;
  background: linear-gradient(135deg, #edf3ec, #e0eae0);
  text-align: center;
  line-height: 1.1;
  padding: 2px;
}

/* Product ID + OuterId / StyleCode identity tags */
.yy-id-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
}
.yy-code-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 5px;
  background: #e5f2e8;
  color: #1a543c;
  font-size: 11.5px;
  font-weight: 650;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.yy-code-pill.missing {
  background: #f5efe2;
  color: #846024;
}
.yy-itemid-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 5px;
  background: #f1f4f1;
  color: #56685e;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Sidebar live cloud status pill */
.yy-sidebar-status {
  margin: 0 4px 10px;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(194, 237, 149, 0.16);
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #dbe8de;
  font-size: 11.5px;
}
.yy-status-top {
  display: flex;
  align-items: center;
  gap: 7px;
  justify-content: space-between;
}
.yy-status-user {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-weight: 600;
  color: #f0f6ec;
}
.yy-status-user span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.yy-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
  background: #8ea396;
}
.yy-dot.online {
  background: #9ce676;
  box-shadow: 0 0 0 3px rgba(156, 230, 118, 0.22);
}
.yy-dot.warn {
  background: #f5b95b;
  box-shadow: 0 0 0 3px rgba(245, 185, 91, 0.25);
}
.yy-dot.danger {
  background: #f36c60;
  box-shadow: 0 0 0 3px rgba(243, 108, 96, 0.28);
}
.yy-status-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 10.5px;
  color: #b4cab9;
}
.yy-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  color: #dcebe0;
}
.yy-status-chip.quota {
  background: rgba(194, 237, 149, 0.16);
  color: #d6f4b4;
}
.yy-risk-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 5px 8px;
  border-radius: 7px;
  background: rgba(217, 74, 56, 0.26);
  border: 1px solid rgba(255, 152, 138, 0.45);
  color: #ffdcd7;
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.yy-risk-pill:hover {
  background: rgba(217, 74, 56, 0.38);
}
.yy-status-actions {
  display: flex;
  gap: 6px;
}
.yy-mini-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(194, 237, 149, 0.18);
  color: #e6f7d2;
  font-size: 11px;
  font-weight: 600;
}
.yy-mini-btn:hover {
  background: rgba(194, 237, 149, 0.3);
}
.yy-mini-btn.ghost {
  background: rgba(255, 255, 255, 0.08);
  color: #c5d7ca;
}
.yy-mini-btn.ghost:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* Login Modal */
.yy-login-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(16, 36, 29, 0.56);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 16px;
}
.yy-login-backdrop[hidden] {
  display: none;
}
.yy-login-card {
  width: min(430px, 100%);
  background: #fff;
  border-radius: 16px;
  border: 1px solid #d7e2d7;
  box-shadow: 0 24px 60px rgba(15, 42, 33, 0.28);
  overflow: hidden;
}
.yy-login-head {
  padding: 20px 22px 14px;
  background: linear-gradient(135deg, #17382f, #215241);
  color: #eef5ee;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.yy-login-head h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}
.yy-login-head p {
  margin-top: 4px;
  font-size: 0.82rem;
  color: #c1d8c8;
}
.yy-login-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #d0e2d5;
}
.yy-login-close:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}
.yy-login-body {
  padding: 20px 22px 22px;
  display: grid;
  gap: 14px;
}
.yy-field {
  display: grid;
  gap: 6px;
  font-size: 0.84rem;
  font-weight: 550;
  color: #31443a;
}
.yy-field input,
.yy-field select,
.yy-field textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  border-radius: 8px;
  border: 1px solid #cfdcd0;
  background: #fbfdfb;
  font-size: 0.9rem;
}
.yy-field input:focus,
.yy-field select:focus,
.yy-field textarea:focus {
  border-color: var(--pine);
  background: #fff;
}
.yy-demo-presets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.yy-preset-btn {
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid #d5e1d4;
  background: #f4f8f2;
  text-align: left;
  display: grid;
  gap: 2px;
  transition: border-color 0.15s, background 0.15s;
}
.yy-preset-btn:hover {
  border-color: #3f7e58;
  background: #e9f3e7;
}
.yy-preset-btn strong {
  font-size: 0.8rem;
  color: #1e4b37;
}
.yy-preset-btn small {
  font-size: 0.72rem;
  color: #5b7163;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.yy-error-box {
  padding: 9px 12px;
  border-radius: 8px;
  background: #fdf0ee;
  border: 1px solid #f0c2ba;
  color: #a62d20;
  font-size: 0.82rem;
  line-height: 1.5;
}
.yy-error-box[hidden] {
  display: none;
}

/* Engine / Fallback / Ad-Law Badges in Chat & Approvals */
.yy-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.yy-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 620;
  line-height: 1.4;
}
.yy-tag.l1 {
  background: #e3f2e8;
  color: #1b5c3e;
}
.yy-tag.l2 {
  background: #e8ecfa;
  color: #2d438c;
}
.yy-tag.fallback {
  background: #fef3dc;
  color: #8f5409;
  border: 1px solid #f2d396;
}
.yy-tag.danger {
  background: #fdeae8;
  color: #a92b20;
  border: 1px solid #f2bbb4;
}
.yy-tag.ok {
  background: #e5f3e7;
  color: #1f5d3e;
}
.yy-tag.neutral {
  background: #eef2ee;
  color: #4f6257;
}

.yy-adlaw-alert {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff4ef;
  border: 1px solid #f2b7a5;
  color: #8e2d1a;
  font-size: 0.83rem;
  line-height: 1.55;
}
.yy-adlaw-alert strong {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  color: #a12512;
}
.yy-adlaw-words {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}
.yy-adlaw-words code {
  padding: 1px 6px;
  border-radius: 4px;
  background: #fde0d8;
  color: #8b1e0f;
  font-size: 0.78rem;
  font-weight: 650;
}

/* Cloud Approval Cards (Tasks & Inline Chat) */
.yy-cloud-section {
  margin-bottom: 18px;
}
.yy-cloud-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.yy-cloud-head h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.98rem;
  font-weight: 650;
}
.yy-approval-list {
  display: grid;
  gap: 12px;
  padding: 14px 18px;
}
.yy-approval-card {
  border: 1px solid #d9e3d8;
  border-radius: 12px;
  background: #fcfdfb;
  padding: 14px;
  display: grid;
  gap: 10px;
}
.yy-approval-card.inline {
  margin-top: 8px;
  max-width: 560px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(20, 52, 41, 0.06);
}
.yy-approval-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.yy-approval-info {
  flex: 1;
  min-width: 0;
}
.yy-approval-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-weight: 650;
  color: var(--ink);
  font-size: 0.92rem;
}
.yy-approval-sub {
  margin-top: 3px;
  font-size: 0.78rem;
  color: var(--secondary);
}
.yy-diff-box {
  border-radius: 8px;
  background: #f4f7f3;
  border: 1px solid #e2eae0;
  padding: 9px 11px;
  font-size: 0.8rem;
  display: grid;
  gap: 5px;
}
.yy-diff-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
}
.yy-diff-key {
  min-width: 72px;
  color: #53685b;
  font-weight: 600;
}
.yy-diff-before {
  color: #9e3b2e;
  text-decoration: line-through;
  background: #fcebe8;
  padding: 1px 5px;
  border-radius: 4px;
}
.yy-diff-after {
  color: #1b5c3e;
  font-weight: 650;
  background: #e3f2e7;
  padding: 1px 5px;
  border-radius: 4px;
}
.yy-approval-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* Settings: Devices & Shop Slots & Operating Profile */
.yy-devices-wrap {
  padding: 16px 18px 20px;
  display: grid;
  gap: 18px;
}
.yy-quota-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f0f6ec, #e5f1e4);
  border: 1px solid #cfe0cd;
}
.yy-quota-banner h3 {
  font-size: 1rem;
  color: #1b4433;
}
.yy-quota-banner p {
  margin-top: 3px;
  font-size: 0.82rem;
  color: #4f6758;
}
.yy-subpanel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.yy-subpanel-head {
  padding: 12px 15px;
  border-bottom: 1px solid #e9eee8;
  background: #f8faf7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.yy-subpanel-head h4 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #20372c;
}
.yy-subpanel-body {
  padding: 14px 15px;
  display: grid;
  gap: 12px;
}
.yy-device-row,
.yy-slot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid #e3eae2;
  background: #fcfdfc;
}
.yy-device-meta,
.yy-slot-meta {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.yy-device-meta strong,
.yy-slot-meta strong {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.9rem;
}
.yy-device-meta small,
.yy-slot-meta small {
  font-size: 0.78rem;
  color: #5b6f62;
}
.yy-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 10px;
}
.yy-guard-note {
  padding: 10px 12px;
  border-radius: 9px;
  background: #f5f9f2;
  border: 1px dashed #b9d0ba;
  color: #365742;
  font-size: 0.8rem;
  line-height: 1.55;
}

/* Source pill used across Products / Inventory / Aftersales / Restock */
.yy-source-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 560;
  background: #e9f3e7;
  color: #21573c;
  border: 1px solid #cde0cb;
}
.yy-source-pill.offline {
  background: #f4f3ee;
  color: #6a6657;
  border-color: #dedad0;
}
.yy-btn-danger {
  background: #fdf0ee;
  border: 1px solid #ecc0b8;
  color: #a42c1f;
}
.yy-btn-danger:hover {
  background: #f9ded9;
}
