:root {
  --primary: #5377e8;
  --primary-dark: #3e5fc8;
  --ink: #182230;
  --muted: #667085;
  --line: #e4e7ec;
  --soft: #f4f6fb;
  --success: #17956b;
  --warning: #d97706;
  --danger: #c73b4b;
  --white: #fff;
  --shadow: 0 14px 40px rgba(35, 48, 74, .09);
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: #f6f7fb;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(228, 231, 236, .9);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 14px; font-weight: 700; }
.brand img { display: block; flex: 0 0 100px; width: 100px; height: 50px; object-fit: contain; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 500; }
.top-actions { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.account-menu { position: relative; }
.account-menu summary { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: #fff; color: #475467; list-style: none; }
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu summary i { color: #98a2b3; font-style: normal; transition: transform .18s; }
.account-menu[open] summary i { transform: rotate(180deg); }
.account-menu-panel { position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; display: grid; width: 155px; padding: 7px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.account-menu-panel a, .account-menu-panel button { display: block; width: 100%; min-height: 38px; padding: 8px 10px; border: 0; border-radius: 8px; cursor: pointer; background: transparent; color: #475467; font-size: 13px; text-align: left; }
.account-menu-panel a:hover, .account-menu-panel button:hover { background: var(--soft); color: var(--primary); }

.page { width: min(1180px, calc(100% - 40px)); margin: 34px auto 80px; }
.page-narrow { width: min(960px, calc(100% - 40px)); }
.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 7px; color: var(--primary); font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(28px, 4vw, 42px); line-height: 1.14; letter-spacing: -.04em; }
h2 { font-size: 24px; letter-spacing: -.02em; }
h3 { font-size: 18px; }
.subtitle { max-width: 680px; margin-bottom: 0; color: var(--muted); line-height: 1.75; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.card {
  border: 1px solid rgba(228, 231, 236, .85);
  border-radius: 18px;
  background: var(--white);
  box-shadow: 0 3px 16px rgba(35, 48, 74, .035);
}
.card-body { padding: 24px; }
.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(380px, .7fr);
  gap: 40px;
  align-items: center;
  min-height: calc(100vh - 180px);
}
.login-intro { padding: 32px; }
.login-intro h1 { max-width: 700px; }
.login-points { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 34px; }
.login-point { padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.75); }
.login-point strong { display: block; margin-bottom: 4px; }
.login-card { padding: 34px; box-shadow: var(--shadow); }
.login-card h2 { margin-bottom: 8px; }
.login-card .subtitle { margin-bottom: 26px; }

.field { margin-bottom: 18px; }
.field label, .field-label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 650; }
.required::after { content: " *"; color: var(--danger); }
.input, .select, .textarea {
  width: 100%;
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  outline: none;
  background: #fff;
  color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
}
.input, .select { height: 45px; padding: 0 13px; }
.textarea { min-height: 108px; padding: 12px 13px; line-height: 1.6; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(83, 119, 232, .12); }
.input::placeholder, .textarea::placeholder { color: #98a2b3; }
.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.code-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.help { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.notice { padding: 13px 15px; border-radius: 10px; background: #fff7ed; color: #9a5611; font-size: 13px; line-height: 1.6; }
.checkline { display: flex; align-items: flex-start; gap: 10px; color: #475467; font-size: 13px; line-height: 1.6; }
.checkline input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--primary); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  background: #fff;
  color: var(--ink);
  font-weight: 650;
  transition: transform .16s, background .16s, border-color .16s;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { border-color: var(--line); background: #fff; }
.btn-secondary:hover { border-color: #b8c0cc; }
.btn-danger { border-color: #f0b9bf; color: var(--danger); }
.btn-small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.link-btn { padding: 6px; border: 0; cursor: pointer; background: none; color: var(--primary); font-weight: 650; }

.tabs { display: flex; gap: 8px; margin-bottom: 22px; padding: 5px; border-radius: 12px; background: #e9ecf3; width: fit-content; }
.tab { padding: 9px 18px; border: 0; border-radius: 9px; cursor: pointer; background: transparent; color: var(--muted); font-weight: 650; }
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 2px 7px rgba(35,48,74,.08); }

.workspace-shell { display: grid; grid-template-columns: 210px minmax(0,1fr); gap: 18px; align-items: start; transition: grid-template-columns .24s ease; }
.workspace-shell.sidebar-collapsed { grid-template-columns: 72px minmax(0,1fr); }
.workspace-navigation { position: sticky; top: 86px; width: 100%; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 3px 16px rgba(35,48,74,.035); transition: width .24s ease; }
.workspace-navigation-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 66px; padding: 11px 10px 11px 15px; border-bottom: 1px solid var(--line); }
.workspace-nav-heading { min-width: 0; }
.workspace-nav-heading span, .workspace-nav-heading strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-nav-heading span { margin-bottom: 3px; color: var(--muted); font-size: 11px; }
.workspace-nav-heading strong { color: #344054; font-size: 14px; }
.workspace-sidebar-toggle { display: grid; flex: 0 0 auto; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; background: #fff; color: #667085; }
.workspace-sidebar-toggle:hover { border-color: #bdc7db; background: #f5f7fb; color: var(--primary); }
.workspace-sidebar-toggle i { font-size: 22px; font-style: normal; line-height: 1; transition: transform .24s ease; }
.workspace-navigation nav { display: grid; gap: 5px; padding: 9px; }
.workspace-nav-item { display: grid; grid-template-columns: 32px minmax(0,1fr); gap: 10px; align-items: center; min-height: 48px; padding: 7px 9px; border: 0; border-radius: 10px; cursor: pointer; background: transparent; color: var(--muted); text-align: left; }
.workspace-nav-item > span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--soft); color: #667085; font-size: 12px; font-weight: 800; }
.workspace-nav-item > b { font-size: 13px; }
.workspace-nav-item:hover, .workspace-nav-item.active { background: #eef2ff; color: #344fa9; }
.workspace-nav-item.active > span { background: var(--primary); color: #fff; }
.workspace-shell.sidebar-collapsed .workspace-navigation-header { justify-content: center; padding: 11px; }
.workspace-shell.sidebar-collapsed .workspace-nav-heading { display: none; }
.workspace-shell.sidebar-collapsed .workspace-sidebar-toggle i { transform: rotate(180deg); }
.workspace-shell.sidebar-collapsed .workspace-navigation nav { padding: 9px; }
.workspace-shell.sidebar-collapsed .workspace-nav-item { grid-template-columns: 1fr; gap: 0; justify-items: center; padding: 7px; }
.workspace-shell.sidebar-collapsed .workspace-nav-item > b { display: none; }
.workspace-content { min-width: 0; }

.service-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.service-card { position: relative; overflow: hidden; min-height: 235px; padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.service-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; background: var(--service-color); }
.service-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 34px; border-radius: 13px; background: color-mix(in srgb, var(--service-color) 12%, white); color: var(--service-color); font-size: 21px; font-weight: 800; }
.service-card h3 { margin-bottom: 9px; }
.service-card p { min-height: 66px; margin-bottom: 20px; color: var(--muted); font-size: 13px; line-height: 1.65; }

.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.panel-header h2, .panel-header p { margin-bottom: 0; }
.filters { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.filters .input, .filters .select { width: auto; min-width: 150px; }
.search-input { min-width: 260px !important; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 16px; border-bottom: 1px solid #edf0f4; text-align: left; white-space: nowrap; }
th { background: #f8f9fb; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .03em; }
td { font-size: 14px; }
tbody tr { cursor: pointer; transition: background .15s; }
tbody tr:hover { background: #f8faff; }
tbody tr:last-child td { border-bottom: 0; }
.lead-message { min-width: 220px; max-width: 360px; white-space: normal; line-height: 1.55; }
.lead-phone { display: inline-flex; align-items: center; gap: 8px; }
.ticket-id { color: var(--primary); font-weight: 700; }
.badge { display: inline-flex; align-items: center; min-height: 26px; padding: 0 9px; border-radius: 999px; background: #eef2ff; color: #4259a9; font-size: 12px; font-weight: 700; }
.badge.pending { background: #fff3d6; color: #9b6412; }
.badge.accepted, .badge.processing { background: #e9f1ff; color: #2f63a8; }
.badge.waiting_feedback { background: #f2ecff; color: #6843a5; }
.badge.completed { background: #e7f7f0; color: #137552; }
.badge.failed, .badge.cancelled { background: #fbeaec; color: #a22f3c; }
.badge.contacted { background: #e9f1ff; color: #2f63a8; }
.badge.interested { background: #e8f8ee; color: #147146; }
.badge.converted { background: #e7f7f0; color: #137552; }
.badge.not_interested, .badge.closed { background: #f1f2f5; color: #697386; }
.urgent { color: var(--danger); font-weight: 700; }

.empty { padding: 70px 24px; text-align: center; color: var(--muted); }
.empty-icon { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 15px; border-radius: 50%; background: var(--soft); font-size: 24px; }

dialog {
  width: min(760px, calc(100% - 28px));
  max-height: calc(100vh - 40px);
  padding: 0;
  border: 0;
  border-radius: 20px;
  outline: 0;
  box-shadow: 0 30px 90px rgba(20, 28, 45, .26);
}
.dialog-wide { width: min(1040px, calc(100% - 28px)); }
dialog::backdrop { background: rgba(21, 29, 43, .54); backdrop-filter: blur(2px); }
.dialog-header { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 24px 28px 18px; border-bottom: 1px solid var(--line); background: #fff; }
.dialog-header h2 { margin-bottom: 4px; }
.dialog-body { padding: 26px 28px 32px; }
.close-btn { display: grid; place-items: center; flex: 0 0 auto; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; cursor: pointer; background: #fff; color: var(--muted); font-size: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; }
.form-grid .full { grid-column: 1 / -1; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; overflow: hidden; margin-bottom: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--line); }
.detail-item { min-height: 76px; padding: 14px 16px; background: #fff; }
.detail-item.full { grid-column: 1 / -1; }
.detail-item dt { margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.detail-item dd { margin: 0; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.detail-link { color: var(--primary); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }
.section-title { margin: 28px 0 14px; font-size: 16px; }

.timeline { position: relative; margin: 0; padding: 0; list-style: none; }
.timeline::before { content: ""; position: absolute; top: 8px; bottom: 16px; left: 7px; width: 2px; background: #e2e7f2; }
.timeline li { position: relative; padding: 0 0 22px 30px; }
.timeline li::before { content: ""; position: absolute; top: 5px; left: 1px; width: 14px; height: 14px; border: 3px solid #dbe4ff; border-radius: 50%; background: var(--primary); }
.timeline p { margin: 3px 0 5px; line-height: 1.6; white-space: pre-wrap; }
.timeline time { color: var(--muted); font-size: 12px; }

.staff-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 18px; }
.action-box { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: #fafbfc; }
.action-box + .action-box { margin-top: 14px; }
.action-box h3 { margin-bottom: 16px; }
.phone-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 12px; border-radius: 9px; background: #f6f7fa; }
.phone-line + .phone-line { margin-top: 8px; }
.action-box > .muted + .phone-line, .phone-line + .muted { display: block; margin-top: 10px; }
.lead-saving-card { padding: 23px; border-radius: 14px; background: linear-gradient(135deg, #ecfaf5, #e4f6ef); }
.lead-saving-card span { display: block; color: #477667; font-size: 13px; }
.lead-saving-card strong { display: block; margin: 4px 0; color: var(--success); font-size: 40px; letter-spacing: -.04em; }
.lead-saving-card small { color: #5f7d73; line-height: 1.6; }
.lead-review-card { padding: 22px; border-radius: 14px; background: #fff5ef; }
.lead-review-card > span, .lead-review-card > small { display: block; color: #93644b; font-size: 12px; }
.lead-review-card > strong { display: block; margin: 5px 0; color: #c45e2c; font-size: 19px; }
.lead-review-card > p { margin: 15px 0 0; padding-top: 14px; border-top: 1px solid #f0d8cb; color: #5c4a40; line-height: 1.75; white-space: pre-wrap; }
.lead-dsr-card { margin-bottom: 22px; padding: 21px; border: 1px solid #d9e2f1; border-radius: 15px; background: linear-gradient(135deg, #f2f6fd, #fff); }
.lead-dsr-card > span, .lead-dsr-card > strong, .lead-dsr-card > small { display: block; }
.lead-dsr-card > span { color: #6b7890; font-size: 12px; font-weight: 700; }
.lead-dsr-card > strong { margin: 7px 0 5px; color: #315a9d; font-size: 22px; }
.lead-dsr-card > small { color: #7b8493; }
.lead-dsr-card p { margin: 12px 0 0; color: #4b5565; line-height: 1.7; }
.lead-dsr-card b { color: #d56532; }
.lead-promo-card { margin-bottom: 22px; padding: 21px; border: 1px solid #d9e8e2; border-radius: 15px; background: linear-gradient(135deg, #eef9f5, #fff); }
.lead-promo-card > span, .lead-promo-card > strong, .lead-promo-card > small { display: block; }
.lead-promo-card > span { color: #587a6f; font-size: 12px; font-weight: 700; }
.lead-promo-card > strong { margin: 7px 0 5px; color: #21775f; font-size: 22px; }
.lead-promo-card > small { color: #71847d; }
.lead-promo-card > p { margin: 12px 0 0; color: #4c625b; line-height: 1.7; }
.lead-ai-demo-card { margin-bottom: 22px; padding: 21px; border: 1px solid #d7e3f5; border-radius: 15px; background: linear-gradient(135deg, #edf4ff, #fff); }
.lead-ai-demo-card > span, .lead-ai-demo-card > strong, .lead-ai-demo-card > small { display: block; }
.lead-ai-demo-card > span { color: #64799a; font-size: 12px; font-weight: 700; }
.lead-ai-demo-card > strong { margin: 7px 0 5px; color: #315fa8; font-size: 20px; }
.lead-ai-demo-card > small { color: #748299; }
.lead-ai-demo-card > div { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.lead-ai-demo-card > div b { padding: 6px 8px; border-radius: 7px; background: #fff; color: #456895; font-size: 11px; }
.lead-ai-demo-card > p { margin: 12px 0 0; color: #52647e; line-height: 1.7; }

/* Platform rule radar admin */
.rule-admin-header-actions { display: flex; gap: 9px; align-items: center; }
.rule-browser-auth-section { margin: 18px 0 4px; padding: 17px; border: 1px solid #d9e2ef; border-radius: 14px; background: linear-gradient(135deg,#f7faff,#fff); }
.rule-browser-auth-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.rule-browser-auth-heading h3 { margin: 0 0 5px; color: #273b5d; font-size: 15px; }
.rule-browser-auth-heading p { margin: 0; color: #718096; font-size: 11px; line-height: 1.65; }
.rule-browser-auth-heading > span { flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; color: #3768b2; background: #eaf2ff; font-size: 10px; font-weight: 700; }
.rule-browser-authorizations { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin-top: 14px; }
.rule-browser-auth-card { min-width: 0; padding: 13px; border: 1px solid #dfe6ef; border-radius: 11px; background: rgba(255,255,255,.9); }
.rule-browser-auth-card > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rule-browser-auth-card > div:first-child strong { color: #2f405d; font-size: 13px; }
.rule-browser-auth-card > div:first-child span { padding: 4px 7px; border-radius: 999px; background: #edf1f5; color: #687587; font-size: 9px; font-weight: 750; }
.rule-browser-auth-card.ready > div:first-child span { background: #e7f7ef; color: #217b59; }
.rule-browser-auth-card.needs-auth > div:first-child span, .rule-browser-auth-card.expiring > div:first-child span { background: #fff0d9; color: #a66716; }
.rule-browser-auth-card.error > div:first-child span { background: #fdebed; color: #ae3847; }
.rule-browser-auth-card.authorizing > div:first-child span { background: #eaf2ff; color: #3768b2; }
.rule-browser-auth-card p { overflow: hidden; margin: 9px 0 4px; color: #69778b; font-size: 10px; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.rule-browser-auth-card > small { display: block; color: #8a96a8; font-size: 9px; }
.rule-browser-auth-card.expiring > small { color: #a66716; font-weight: 650; }
.rule-browser-auth-card-actions { display: flex; gap: 6px; margin-top: 10px; }
.rule-browser-auth-card-actions button { flex: 1; min-height: 30px; border: 1px solid #cdd9ea; border-radius: 7px; background: #fff; color: #315f9f; cursor: pointer; font-size: 10px; font-weight: 650; }
.rule-browser-auth-card-actions button:hover { border-color: #9bb5db; background: #f1f6ff; }
.rule-browser-auth-card-actions button:last-child:not(:first-child) { flex: 0 0 auto; padding-inline: 10px; color: #7a8798; }
.rule-discovery-feeds { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin: 18px 0 4px; }
.rule-discovery-card { min-width: 0; padding: 14px 15px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfe; }
.rule-discovery-card > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rule-discovery-card > div span { color: var(--muted); font-size: 11px; }.rule-discovery-card > div b { padding: 4px 7px; border-radius: 999px; background: #edf1f5; color: #64748b; font-size: 10px; }
.rule-discovery-card.ok > div b { background: #e8f7f0; color: #217b59; }.rule-discovery-card.error > div b { background: #fdebed; color: #ae3847; }
.rule-discovery-card > strong { display: block; margin-top: 9px; font-size: 13px; }.rule-discovery-card p { overflow: hidden; margin: 6px 0; color: var(--muted); font-size: 10px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }.rule-discovery-card > small { color: #687587; font-size: 10px; }
.rule-discovery-empty { padding: 16px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); text-align: center; }
.rule-admin-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 11px; margin: 18px 0; }
.rule-admin-stats button { padding: 15px 17px; border: 1px solid var(--line); border-radius: 11px; background: #f8fafc; color: var(--text); cursor: pointer; text-align: left; }
.rule-admin-stats button:hover { border-color: #b9c9e9; background: #f1f5fd; }
.rule-admin-stats span, .rule-admin-stats strong { display: block; }
.rule-admin-stats span { color: var(--muted); font-size: 11px; }.rule-admin-stats strong { margin-top: 5px; font-size: 23px; }
.rule-admin-filters { margin-bottom: 17px; }
.rule-admin-table td > strong, .rule-admin-table td > small { display: block; }
.rule-admin-table td > strong { max-width: 310px; line-height: 1.5; }.rule-admin-table td > small { max-width: 270px; margin-top: 5px; overflow: hidden; color: var(--muted); font-size: 10px; line-height: 1.4; text-overflow: ellipsis; }
.rule-admin-status { display: inline-block; padding: 5px 7px; border-radius: 6px; font-size: 10px; font-weight: 750; }
.rule-admin-status.published { background: #e8f7f0; color: #217b59; }.rule-admin-status.pending { background: #fff3db; color: #a56817; }.rule-admin-status.error { background: #fdebed; color: #ae3847; }.rule-admin-status.draft { background: #edf1f5; color: #687587; }
.rule-row-actions { display: flex; gap: 6px; }.rule-row-actions button { padding: 6px 9px; border: 1px solid #d7dfeb; border-radius: 6px; background: #fff; color: var(--primary); cursor: pointer; font-size: 10px; }.rule-row-actions button:hover { background: #edf3ff; }
.rule-source-dialog { width: min(1080px,calc(100% - 30px)); }
.rule-form-layout { display: grid; grid-template-columns: minmax(0,1fr) 250px; gap: 22px; }
.rule-form-main { min-width: 0; }.rule-form-main .field + .field { margin-top: 17px; }
.rule-original-editor { min-height: 260px; font-family: ui-monospace,SFMono-Regular,Menlo,monospace; font-size: 12px; line-height: 1.65; }
.rule-check { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfc; font-size: 12px; }.rule-check input { accent-color: var(--primary); }
.rule-form-aside { min-width: 0; }
.rule-monitor-card { padding: 19px; border: 1px solid #d8e2f1; border-radius: 12px; background: linear-gradient(135deg,#f2f6fd,#fff); }
.rule-monitor-card span, .rule-monitor-card strong, .rule-monitor-card small { display: block; }.rule-monitor-card span { color: #71809a; font-size: 10px; font-weight: 700; }.rule-monitor-card strong { margin: 7px 0; color: #315a9d; font-size: 18px; }.rule-monitor-card p { margin: 0; color: #687489; font-size: 11px; line-height: 1.6; }.rule-monitor-card small { margin-top: 10px; color: #8691a3; font-size: 10px; }
.rule-form-aside > .btn { margin-top: 10px; }
.rule-publish-check { margin-top: 15px; padding: 17px; border: 1px solid var(--line); border-radius: 11px; background: #fafbfc; }.rule-publish-check strong { font-size: 12px; }.rule-publish-check ul { margin: 11px 0 0; padding-left: 17px; color: var(--muted); font-size: 10px; line-height: 1.9; }
.rule-ai-label { display: inline-flex; margin-left: 6px; padding: 2px 7px; border-radius: 999px; color: #2c64c8; background: #eef5ff; font-size: 11px; font-weight: 600; vertical-align: middle; }
.rule-ai-notice { margin: 2px 0 0; padding: 10px 12px; border: 1px solid #dce8fb; border-radius: 10px; color: #60708b; background: #f7faff; font-size: 12px; line-height: 1.65; }
.rule-version-history { margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--line); }.rule-version-history > strong { font-size: 12px; }.rule-version-history ol { margin: 10px 0 0; padding: 0; list-style: none; }.rule-version-history li { display: flex; justify-content: space-between; gap: 7px; padding: 8px 0; border-bottom: 1px solid #edf0f4; font-size: 10px; }.rule-version-history li small { color: var(--muted); }
.form-alert { margin-top: 18px; padding: 13px 15px; border-radius: 9px; background: #fdecef; color: #a63747; font-size: 12px; line-height: 1.55; }.form-alert ul { margin: 7px 0 0; padding-left: 18px; }
.rule-form-actions { position: sticky; bottom: -25px; display: flex; justify-content: flex-end; gap: 10px; margin: 22px -24px -25px; padding: 14px 24px; border-top: 1px solid var(--line); background: rgba(255,255,255,.96); }
.rule-browser-auth-dialog { width: min(1000px,calc(100% - 28px)); }
.rule-browser-auth-controls { position: sticky; top: 95px; z-index: 2; padding: 11px; border: 1px solid #d7e2f2; border-radius: 12px; background: rgba(247,250,255,.97); box-shadow: 0 8px 20px rgba(48,79,125,.08); }
.rule-browser-auth-controls.busy { opacity: .68; }
.rule-browser-auth-toolbar { display: flex; flex-wrap: wrap; gap: 7px; }
.rule-browser-auth-toolbar button { min-height: 32px; padding: 0 11px; border: 1px solid #ccd8e8; border-radius: 7px; background: #fff; color: #52647d; cursor: pointer; font-size: 11px; font-weight: 650; }
.rule-browser-auth-toolbar button:hover { border-color: #9eb6da; color: #315f9f; }
.rule-browser-auth-toolbar button.active { border-color: #4e7bea; background: #4e7bea; color: #fff; }
.rule-browser-auth-input-form { display: grid; grid-template-columns: minmax(190px,1fr) auto auto auto; gap: 7px; margin-top: 9px; }
.rule-browser-auth-input-form .input { min-height: 36px; }
.rule-browser-auth-input-form .btn { min-height: 36px; padding: 0 13px; font-size: 11px; }
.rule-browser-auth-controls > p { margin: 8px 2px 0; color: #66758b; font-size: 10px; line-height: 1.5; }
.rule-browser-auth-stage { display: grid; place-items: center; min-height: min(410px,48vh); overflow: hidden; margin-top: 12px; border: 1px solid #dbe3ee; border-radius: 13px; background: #f4f6f9; }
.rule-browser-auth-stage img { display: block; width: 100%; height: auto; }
.rule-browser-auth-remote-image { cursor: crosshair; user-select: none; -webkit-user-drag: none; touch-action: none; }
.rule-browser-auth-stage.drag-mode .rule-browser-auth-remote-image { cursor: grab; }
.rule-browser-auth-stage.drag-mode .rule-browser-auth-remote-image.dragging { cursor: grabbing; filter: brightness(.96); }
.rule-browser-auth-loading, .rule-browser-auth-failure { padding: 30px; color: #718096; text-align: center; }
.rule-browser-auth-failure { color: #ae3847; }
.rule-browser-auth-success { display: flex; align-items: center; flex-direction: column; gap: 7px; padding: 42px; color: #217b59; }
.rule-browser-auth-success i { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: #def5e9; font-size: 28px; font-style: normal; }
.rule-browser-auth-success strong { font-size: 20px; }.rule-browser-auth-success span { color: #718096; font-size: 12px; }
.rule-browser-auth-message { margin-top: 14px; padding: 11px 13px; border-radius: 9px; background: #eef4fd; color: #486482; font-size: 12px; line-height: 1.6; }
.rule-browser-auth-safety { margin: 10px 0 0; color: #7b8798; font-size: 11px; line-height: 1.65; }
.rule-browser-auth-actions { display: flex; justify-content: flex-end; margin-top: 16px; }

/* Internal AI customer-service copilot */
.ai-copilot-panel { min-width: 0; }
.ai-copilot-header { align-items: center; }
.ai-copilot-tabs { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid #dbe4f1; border-radius: 10px; background: #f7f9fc; }
.ai-copilot-tabs button { min-height: 34px; padding: 0 14px; border: 0; border-radius: 7px; background: transparent; color: #64748b; cursor: pointer; font-size: 12px; font-weight: 700; }
.ai-copilot-tabs button.active { background: #fff; color: var(--primary); box-shadow: 0 2px 8px rgba(40,72,130,.1); }
.ai-copilot-status { margin: 15px 0; padding: 11px 14px; border: 1px solid #d7e5f8; border-radius: 9px; background: #f4f8ff; color: #45668f; font-size: 12px; line-height: 1.6; }
.ai-copilot-status.error { border-color: #f1cdd2; background: #fff2f3; color: #a63b49; }
.ai-copilot-input-card { padding: 20px; border: 1px solid #dce4ee; border-radius: 14px; background: linear-gradient(145deg,#fbfdff,#f7f9fc); }
.ai-copilot-current-message { border-color: #bfcff0; background: #fff; font-size: 14px; line-height: 1.7; }
.ai-copilot-generate-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 18px; padding-top: 16px; border-top: 1px solid #e4e9f1; }
.ai-copilot-generate-row p { margin: 0; color: #7a8798; font-size: 11px; line-height: 1.6; }
.ai-copilot-generate-row p span { margin-right: 7px; color: #218461; font-weight: 750; }
.ai-copilot-generate-row .btn { min-width: 190px; }
.ai-copilot-result { margin-top: 18px; }
.ai-copilot-notices { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.ai-copilot-notices span { padding: 7px 9px; border-radius: 7px; background: #fff3dd; color: #93611a; font-size: 10px; font-weight: 650; }
.ai-copilot-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 12px; color: #6f7f94; font-size: 10px; }
.ai-copilot-sources span { padding: 5px 8px; border-radius: 999px; background: #edf4ff; color: #42689e; }
.ai-copilot-reply-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.ai-copilot-reply-card { min-width: 0; padding: 16px; border: 1px solid #dce3ee; border-radius: 13px; background: #fff; box-shadow: 0 5px 18px rgba(37,56,91,.04); }
.ai-copilot-reply-card > div { display: grid; grid-template-columns: auto 1fr; gap: 3px 8px; align-items: center; margin-bottom: 12px; }
.ai-copilot-reply-card > div span { grid-row: 1 / 3; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: #eaf1ff; color: #3e6bd1; font-size: 9px; font-weight: 800; }
.ai-copilot-reply-card > div b { font-size: 14px; }
.ai-copilot-reply-card > div em { color: #7d8a9e; font-size: 10px; font-style: normal; }
.ai-copilot-reply-card textarea { min-height: 155px; resize: vertical; font-size: 13px; line-height: 1.7; }
.ai-copilot-reply-card > p { min-height: 34px; margin: 9px 0; color: #7a8798; font-size: 10px; line-height: 1.55; }
.ai-copilot-result-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 12px; padding: 12px 14px; border-radius: 9px; background: #f7f8fa; }
.ai-copilot-result-footer p { margin: 0; color: #7e8998; font-size: 10px; }
.ai-copilot-history-section { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 14px; }
.section-heading h3 { margin: 0 0 4px; font-size: 16px; }
.section-heading p { margin: 0; }
#ai-copilot-history td strong, #ai-copilot-history td small { display: block; }
#ai-copilot-history td small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.ai-copilot-feedback { display: inline-block; padding: 5px 8px; border-radius: 999px; background: #edf1f5; color: #637083; font-size: 10px; font-weight: 700; }
.ai-copilot-feedback.adopted, .ai-copilot-feedback.edited { background: #e7f7ef; color: #217b59; }
.ai-copilot-feedback.rejected { background: #fdebed; color: #ae3847; }
.ai-copilot-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin: 4px 0 22px; }
.ai-copilot-stats > div { padding: 16px 17px; border: 1px solid var(--line); border-radius: 11px; background: #f8fafc; }
.ai-copilot-stats span, .ai-copilot-stats strong { display: block; }
.ai-copilot-stats span { color: var(--muted); font-size: 10px; }
.ai-copilot-stats strong { margin-top: 5px; font-size: 23px; }
.ai-copilot-shop-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.ai-copilot-shop-card { min-width: 0; padding: 18px; border: 1px solid #dce3ee; border-radius: 13px; background: #fff; }
.ai-copilot-shop-card.disabled { background: #f8f9fb; opacity: .78; }
.ai-copilot-shop-card > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ai-copilot-shop-card > div:first-child span { color: #6e7c90; font-size: 10px; }
.ai-copilot-shop-card > div:first-child b { padding: 4px 7px; border-radius: 999px; background: #e7f7ef; color: #217b59; font-size: 9px; }
.ai-copilot-shop-card.disabled > div:first-child b { background: #edf0f4; color: #758091; }
.ai-copilot-shop-card h4 { margin: 10px 0 6px; font-size: 16px; }
.ai-copilot-shop-card > p { margin: 0; color: #65758a; font-size: 11px; }
.ai-copilot-shop-card > small { display: block; overflow: hidden; margin-top: 7px; color: #8490a0; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.ai-copilot-shop-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.ai-copilot-shop-actions button { min-height: 30px; padding: 0 9px; border: 1px solid #d4deed; border-radius: 7px; background: #fff; color: #3c67a8; cursor: pointer; font-size: 10px; font-weight: 650; }
.ai-copilot-shop-actions button:hover { background: #f1f6ff; }
.ai-copilot-shop-assets { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.ai-copilot-assets-group { min-width: 0; }
.ai-copilot-assets-group > div { display: flex; justify-content: space-between; margin-bottom: 7px; font-size: 10px; }
.ai-copilot-assets-group > button { display: block; width: 100%; margin-top: 5px; padding: 8px 9px; border: 1px solid #e1e6ee; border-radius: 7px; background: #fafbfc; cursor: pointer; text-align: left; }
.ai-copilot-assets-group > button b, .ai-copilot-assets-group > button small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-copilot-assets-group > button b { color: #34455f; font-size: 10px; }.ai-copilot-assets-group > button small { margin-top: 3px; color: #8490a0; font-size: 9px; }
.ai-copilot-assets-group > p { color: var(--muted); font-size: 10px; }
.ai-copilot-dialog { width: min(900px,calc(100% - 30px)); }
.ai-copilot-assignment { margin: 0; padding: 13px; border: 1px solid var(--line); border-radius: 10px; }
.ai-copilot-assignment legend { padding: 0 6px; font-size: 12px; font-weight: 700; }
.ai-copilot-check-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.ai-copilot-check-grid label { display: flex; align-items: center; gap: 8px; padding: 9px; border: 1px solid #e0e6ef; border-radius: 8px; background: #fafbfc; cursor: pointer; }
.ai-copilot-check-grid input { accent-color: var(--primary); }
.ai-copilot-check-grid span b, .ai-copilot-check-grid span small { display: block; }
.ai-copilot-check-grid span b { font-size: 11px; }.ai-copilot-check-grid span small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.ai-copilot-knowledge-editor { font-size: 12px; line-height: 1.7; }
.ai-copilot-file-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.ai-copilot-launch-card { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px; border: 1px solid #d9e4f6; border-radius: 14px; background: linear-gradient(135deg,#f3f7ff,#fff); }
.ai-copilot-launch-card > div { display: flex; align-items: center; gap: 14px; }
.ai-copilot-launch-card h3 { margin: 0 0 5px; font-size: 17px; }
.ai-copilot-launch-card p { margin: 0; color: #69788e; font-size: 12px; line-height: 1.6; }
.ai-copilot-launch-icon { display: grid; flex: 0 0 auto; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(135deg,#5377e8,#6d8df1); color: #fff; font-size: 12px; font-weight: 850; box-shadow: 0 8px 18px rgba(83,119,232,.22); }
.copilot-conversation-list { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.copilot-conversation-list > button { display: grid; grid-template-columns: auto minmax(0,1fr) auto auto; gap: 12px; align-items: center; width: 100%; min-height: 62px; padding: 10px 14px; border: 0; border-bottom: 1px solid #edf0f4; cursor: pointer; background: #fff; text-align: left; }
.copilot-conversation-list > button:last-child { border-bottom: 0; }
.copilot-conversation-list > button:hover { background: #f8faff; }
.copilot-conversation-list > button > span { padding: 5px 8px; border-radius: 999px; background: #e7f7ef; color: #217b59; font-size: 9px; font-weight: 750; }
.copilot-conversation-list > button > span.closed { background: #edf0f4; color: #778294; }
.copilot-conversation-list strong, .copilot-conversation-list small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copilot-conversation-list strong { font-size: 13px; }.copilot-conversation-list small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.copilot-conversation-list time { color: #8792a2; font-size: 10px; }.copilot-conversation-list i { color: var(--primary); font-size: 11px; font-style: normal; font-weight: 700; }

.copilot-conversation-dialog { width: min(1140px,calc(100% - 28px)); height: min(82vh,760px); max-height: calc(100vh - 28px); overflow: hidden; border-radius: 18px; }
.copilot-conversation-dialog[open] { display: grid; grid-template-rows: auto auto minmax(0,1fr); }
.copilot-conversation-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: #fff; }
.copilot-conversation-header > div { display: flex; align-items: center; gap: 11px; min-width: 0; }
.copilot-conversation-header h2 { margin: 0 0 3px; font-size: 17px; }.copilot-conversation-header p { overflow: hidden; margin: 0; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.copilot-conversation-header .ai-copilot-launch-icon { width: 36px; height: 36px; border-radius: 10px; font-size: 10px; }
.copilot-conversation-header .close-btn { width: 32px; height: 32px; font-size: 18px; }
.copilot-conversation-toolbar { display: grid; grid-template-columns: minmax(160px,1fr) minmax(160px,1fr) auto auto auto; gap: 8px; align-items: end; padding: 9px 14px; border-bottom: 1px solid var(--line); background: #f8fafc; }
.copilot-conversation-toolbar label > span { display: block; margin: 0 0 3px 2px; color: #748196; font-size: 9px; font-weight: 700; }
.copilot-conversation-toolbar .select { height: 34px; padding: 0 9px; border-radius: 8px; font-size: 11px; }
.copilot-conversation-state { align-self: center; padding: 5px 8px; border-radius: 999px; background: #edf1f5; color: #687587; font-size: 9px; font-weight: 750; white-space: nowrap; }
.copilot-conversation-state.active { background: #e7f7ef; color: #217b59; }.copilot-conversation-state.closed { background: #edf0f4; color: #778294; }
.copilot-conversation-toolbar .btn { min-height: 34px; white-space: nowrap; }
.copilot-conversation-shell { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(360px,.9fr); min-height: 0; background: #f4f6fa; }
.copilot-thread-panel { display: grid; grid-template-rows:minmax(0,1fr) auto; min-width: 0; min-height: 0; border-right: 1px solid var(--line); background: #f7f8fb; }
.copilot-thread { min-height: 0; overflow-y: auto; padding: 18px; scroll-behavior: smooth; }
.copilot-thread-empty, .copilot-suggestion-empty { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 6px; height: 100%; min-height: 150px; padding: 24px; color: #8994a4; text-align: center; }
.copilot-thread-empty strong, .copilot-suggestion-empty strong { color: #59687d; font-size: 13px; }.copilot-thread-empty span, .copilot-suggestion-empty span { max-width: 360px; font-size: 10px; line-height: 1.6; }
.copilot-message { display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 4px 9px; max-width: 88%; margin-bottom: 13px; }
.copilot-message.staff { margin-left: auto; grid-template-columns:minmax(0,1fr) 34px; }
.copilot-message > span { grid-row: 1 / 3; display: grid; place-items: center; align-self: start; width: 34px; height: 34px; border-radius: 50%; background: #e4e8ef; color: #647186; font-size: 9px; font-weight: 750; }
.copilot-message.staff > span { grid-column: 2; background: #dfe8ff; color: #3d64bc; }
.copilot-message > div { padding: 10px 12px; border: 1px solid #e0e5ed; border-radius: 4px 12px 12px; background: #fff; font-size: 12px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.copilot-message.staff > div { grid-row: 1; border-color: #cfdcfa; border-radius: 12px 4px 12px 12px; background: #eef3ff; }
.copilot-message time { grid-column: 2; color: #98a2b1; font-size: 8px; }.copilot-message.staff time { grid-column: 1; text-align: right; }
.copilot-composer { padding: 10px 13px; border-top: 1px solid var(--line); background: #fff; }
.copilot-composer > label { display: block; margin-bottom: 5px; color: #56657a; font-size: 10px; font-weight: 750; }
.copilot-composer textarea { display: block; width: 100%; min-height: 66px; max-height: 120px; padding: 9px 10px; border: 1px solid #cdd5e0; border-radius: 9px; outline: 0; resize: vertical; font-size: 12px; line-height: 1.55; }
.copilot-composer textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(83,119,232,.1); }
.copilot-composer > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 7px; }
.copilot-composer > div span { color: #8a95a5; font-size: 9px; }.copilot-composer .btn { min-height: 34px; padding: 0 15px; font-size: 11px; }
.copilot-assistant-panel { display: grid; grid-template-rows:auto auto auto auto minmax(0,1fr); min-width: 0; min-height: 0; overflow: hidden; background: #fff; }
.copilot-goal-section { padding: 12px 14px 9px; border-bottom: 1px solid var(--line); }
.copilot-goal-section > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }.copilot-goal-section > div:first-child strong { font-size: 11px; }.copilot-goal-section > div:first-child span { color: #8190a3; font-size: 9px; }
.copilot-goal-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.copilot-goal-tags button { min-height: 26px; padding: 0 8px; border: 1px solid #dce3ec; border-radius: 999px; background: #fff; color: #637186; cursor: pointer; font-size: 9px; }
.copilot-goal-tags button:hover { border-color: #aec1e9; color: #3d65ba; }.copilot-goal-tags button.active { border-color: #6f8fec; background: #edf3ff; color: #315eb9; font-weight: 750; }
.copilot-goal-section > .input { height: 32px; margin-top: 7px; border-radius: 8px; font-size: 10px; }
.copilot-dialog-status { margin: 9px 12px 0; padding: 7px 9px; border-radius: 7px; background: #eef4fd; color: #486482; font-size: 10px; line-height: 1.5; }.copilot-dialog-status.error { background: #fdebed; color: #ae3847; }
.copilot-assistant-panel > .ai-copilot-notices { margin: 7px 12px 0; max-height: 56px; overflow-y: auto; }.copilot-assistant-panel > .ai-copilot-sources { margin: 7px 12px 0; max-height: 40px; overflow-y: auto; }
.copilot-suggestion-area { min-height: 0; overflow-y: auto; padding: 10px 12px 12px; }
.copilot-suggestion-tabs { display: grid; grid-template-columns:repeat(3,1fr); gap: 4px; padding: 4px; border-radius: 9px; background: #eef1f6; }
.copilot-suggestion-tabs button { min-height: 30px; padding: 0 6px; border: 0; border-radius: 6px; background: transparent; color: #6f7c8f; cursor: pointer; font-size: 9px; font-weight: 700; }.copilot-suggestion-tabs button.active { background: #fff; color: #315fbd; box-shadow: 0 2px 7px rgba(37,54,85,.08); }
.copilot-suggestion-editor { margin-top: 9px; padding: 12px; border: 1px solid #dce3ed; border-radius: 11px; background: #fff; }
.copilot-suggestion-editor > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 8px; }.copilot-suggestion-editor > div:first-child strong { font-size: 12px; }.copilot-suggestion-editor > div:first-child span { color: #8090a4; font-size: 9px; }
.copilot-suggestion-editor textarea { display: block; width: 100%; min-height: 120px; margin-top: 8px; padding: 10px; border: 1px solid #cfd7e2; border-radius: 8px; outline: 0; resize: vertical; font-size: 12px; line-height: 1.65; }.copilot-suggestion-editor textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(83,119,232,.1); }
.copilot-suggestion-editor > p { margin: 7px 0; color: #78869a; font-size: 9px; line-height: 1.5; }.copilot-suggestion-editor > div:nth-of-type(2) { display: flex; justify-content: flex-end; gap: 7px; }.copilot-suggestion-editor .btn { min-height: 34px; padding: 0 12px; font-size: 10px; }.copilot-suggestion-editor > small { display: block; margin-top: 7px; color: #919baa; font-size: 8px; line-height: 1.5; }

.toast {
  position: fixed;
  z-index: 100;
  top: auto;
  left: auto;
  right: 24px;
  bottom: 24px;
  margin: 0;
  max-width: min(390px, calc(100% - 40px));
  padding: 14px 18px;
  border: 0;
  border-radius: 11px;
  background: #202938;
  color: #fff;
  box-shadow: var(--shadow);
  line-height: 1.5;
  pointer-events: none;
  animation: toast-in .2s ease-out;
}
.toast.error { background: #a63340; }
.image-admin-service { margin-bottom: 14px; padding: 11px 14px; border-radius: 9px; background: #f1f4f8; color: #66758a; font-size: 12px; }
.image-admin-service.ready { background: #e8f7f0; color: #187d5b; }
.image-admin-service.warning { background: #fff2e7; color: #a85c22; }
.image-admin-stats { display: grid; grid-template-columns: repeat(6,1fr); gap: 10px; margin-bottom: 16px; }
.image-admin-stats article { padding: 15px; border: 1px solid var(--line); border-radius: 11px; background: #f8faff; }
.image-admin-stats span, .image-admin-stats strong { display: block; }
.image-admin-stats span { color: #8290a4; font-size: 10px; }
.image-admin-stats strong { margin-top: 7px; color: #243852; font-size: 23px; }
.image-admin-filters { margin-bottom: 13px; }
.image-admin-actions,.image-admin-payment-head{display:flex;align-items:center;gap:10px}.image-admin-tabs{display:flex;gap:6px;margin-bottom:16px;padding:5px;border-radius:11px;background:#f2f5f9}.image-admin-tabs button{flex:0 0 auto;padding:9px 16px;border:0;border-radius:8px;background:transparent;color:#657389;font-size:12px;font-weight:800;cursor:pointer}.image-admin-tabs button.active{background:#fff;color:#315fa8;box-shadow:0 4px 15px rgba(36,61,95,.09)}.image-admin-payment-head{justify-content:space-between}.image-admin-payment-head .image-admin-service{flex:1}.payment-stats{grid-template-columns:repeat(5,1fr)}.badge.payment-paid{background:#e4f6ed;color:#167b58}.badge.payment-pending{background:#fff2db;color:#9d641f}.badge.payment-closed,.badge.payment-failed{background:#feecef;color:#b53d4b}.image-payment-products{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}.image-payment-product{display:flex;min-height:230px;flex-direction:column;padding:16px;border:1px solid var(--line);border-radius:12px;background:#fafcff}.image-payment-product.inactive{opacity:.64}.image-payment-product header,.product-point-row{display:flex;align-items:center;justify-content:space-between;gap:10px}.image-payment-product header strong,.image-payment-product header span{display:block}.image-payment-product header strong{font-size:14px}.image-payment-product header div>span{margin-top:3px;color:#8b98aa;font-size:9px}.image-payment-product>p{min-height:37px;margin:13px 0;color:#758398;font-size:10px;line-height:1.7}.product-point-row strong{color:#254f93;font-size:27px}.product-point-row strong small{margin-left:3px;font-size:10px}.product-point-row b{font-size:18px}.image-payment-product>small{margin:8px 0 13px;color:#7e8b9e;font-size:9px}.image-payment-product .btn{margin-top:auto}.checkbox-row{display:flex;align-items:center;gap:8px;margin-bottom:13px;color:#55647a;font-size:12px}
.badge.image-succeeded { background: #e5f7ef; color: #16815b; }
.badge.image-failed, .badge.image-uncertain { background: #feecef; color: #bd4050; }
.badge.image-queued, .badge.image-processing, .badge.image-saving { background: #eaf1ff; color: #315fa8; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

.loading { opacity: .55; pointer-events: none; }
.portal-footer { flex: 0 0 auto; margin-top: auto; border-top: 1px solid var(--line); background: rgba(255,255,255,.78); color: #98a2b3; }
.portal-footer-inner { display: grid; grid-template-columns: 1fr auto; gap: 7px 24px; align-items: center; width: min(1180px,calc(100% - 40px)); min-height: 72px; margin: 0 auto; padding: 13px 0; }
.portal-footer-main { color: #667085; font-size: 12px; }
.portal-footer-links { display: flex; align-items: center; gap: 16px; font-size: 12px; }
.portal-footer-links a:hover { color: var(--primary); }
.portal-footer-note { grid-column: 1 / -1; margin: 0; font-size: 11px; line-height: 1.5; }

@media (max-width: 940px) {
  .image-admin-stats { grid-template-columns: repeat(3,1fr); }
  .service-grid { grid-template-columns: repeat(2, 1fr); }
  .login-layout { grid-template-columns: 1fr; min-height: auto; }
  .login-intro { padding: 30px 0 0; }
  .login-card { width: min(500px, 100%); margin: 0 auto; }
  .staff-layout { grid-template-columns: 1fr; }
  .workspace-shell, .workspace-shell.sidebar-collapsed { grid-template-columns: 1fr; }
  .workspace-navigation { position: static; }
  .workspace-navigation nav { grid-template-columns: repeat(auto-fit,minmax(130px,1fr)); }
  .workspace-shell.sidebar-collapsed .workspace-navigation-header { justify-content: space-between; padding: 11px 10px 11px 15px; }
  .workspace-shell.sidebar-collapsed .workspace-nav-heading { display: block; }
  .workspace-shell.sidebar-collapsed .workspace-navigation nav { display: none; }
  .workspace-shell.sidebar-collapsed .workspace-sidebar-toggle i { transform: rotate(180deg); }
  .rule-form-layout { grid-template-columns: 1fr; }
  .rule-browser-authorizations { grid-template-columns: 1fr 1fr; }
  .rule-form-aside { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .rule-form-aside > .btn, .rule-publish-check, .rule-version-history { margin-top: 0; }
  .ai-copilot-reply-grid { grid-template-columns: 1fr; }
  .ai-copilot-shop-grid { grid-template-columns: 1fr; }
  .copilot-conversation-dialog { height: calc(100vh - 24px); }
  .copilot-conversation-shell { grid-template-columns: 1fr; grid-template-rows:minmax(0,1fr) minmax(0,1fr); }
  .copilot-thread-panel { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 640px) {
  .image-admin-stats { grid-template-columns: repeat(2,1fr); }
  .topbar { height: 62px; padding: 0 16px; }
  .brand span { display: none; }
  .brand small { display: none; }
  .brand img { flex-basis: 84px; width: 84px; height: 42px; }
  .top-actions .hide-mobile { display: none; }
  .page, .page-narrow { width: min(100% - 28px, 1180px); margin-top: 24px; }
  .hero-row, .panel-header { align-items: flex-start; flex-direction: column; }
  .login-intro { padding-top: 15px; }
  .login-points { grid-template-columns: 1fr; }
  .login-card { padding: 25px 20px; }
  .service-grid { grid-template-columns: 1fr; }
  .service-card { min-height: 0; }
  .service-card p { min-height: 0; }
  .tabs { width: 100%; }
  .tab { flex: 1; padding-inline: 8px; }
  #dashboard-view > .tabs { position: sticky; bottom: 12px; z-index: 12; margin-right: auto; margin-left: auto; box-shadow: 0 10px 30px rgba(35,48,74,.16); }
  .workspace-navigation nav { grid-template-columns: 1fr 1fr; }
  .workspace-nav-item { min-height: 44px; }
  .form-grid, .detail-grid, .input-row { grid-template-columns: 1fr; }
  .detail-item.full, .form-grid .full { grid-column: auto; }
  .dialog-header { padding: 20px 18px 15px; }
  .dialog-body { padding: 20px 18px 25px; }
  .filters { width: 100%; }
  .filters .input, .filters .select { width: 100%; }
  .search-input { min-width: 0 !important; }
  th, td { padding: 13px 12px; }
  .toast { right: 14px; bottom: 14px; }
  .portal-footer-inner { grid-template-columns: 1fr; width: min(100% - 28px,1180px); min-height: 96px; }
  .portal-footer-links { gap: 14px; }
  .portal-footer-note { grid-column: auto; }
  .rule-admin-stats { grid-template-columns: 1fr 1fr; }
  .rule-discovery-feeds { grid-template-columns: 1fr 1fr; }
  .rule-browser-authorizations { grid-template-columns: 1fr; }
  .rule-admin-header-actions { width: 100%; flex-wrap: wrap; }
  .rule-browser-auth-heading { flex-direction: column; gap: 10px; }
  .rule-browser-auth-heading > span { align-self: flex-start; }
  .rule-browser-auth-stage { min-height: 280px; }
  .rule-browser-auth-controls { top: 78px; }
  .rule-browser-auth-input-form { grid-template-columns: 1fr 1fr; }
  .rule-browser-auth-input-form .input { grid-column: 1 / -1; }
  .rule-form-aside { display: block; }
  .rule-form-aside > .btn, .rule-publish-check, .rule-version-history { margin-top: 12px; }
  .rule-form-actions { align-items: stretch; flex-direction: column; }
  .ai-copilot-tabs { width: 100%; }
  .ai-copilot-tabs button { flex: 1; }
  .ai-copilot-generate-row, .ai-copilot-result-footer, .section-heading { align-items: stretch; flex-direction: column; }
  .ai-copilot-generate-row .btn { width: 100%; }
  .ai-copilot-stats { grid-template-columns: 1fr 1fr; }
  .ai-copilot-shop-assets { grid-template-columns: 1fr; }
  .ai-copilot-check-grid { grid-template-columns: 1fr; }
  .ai-copilot-launch-card { align-items: stretch; flex-direction: column; }
  .ai-copilot-launch-card .btn { width: 100%; }
  .copilot-conversation-dialog { width: calc(100% - 10px); height: calc(100vh - 10px); max-height: calc(100vh - 10px); border-radius: 12px; }
  .copilot-conversation-toolbar { grid-template-columns:1fr 1fr; }
  .copilot-conversation-state { justify-self: start; }
  .copilot-conversation-list > button { grid-template-columns:auto minmax(0,1fr) auto; }.copilot-conversation-list time { display: none; }
  .copilot-message { max-width: 96%; }
  .copilot-goal-section > div:first-child { align-items: flex-start; flex-direction: column; }
}
