:root {
  color-scheme: light;
  --bg: #f3f6f7;
  --panel: #ffffff;
  --panel-soft: #f8fbfb;
  --line: #dbe5e8;
  --text: #172126;
  --muted: #667985;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --accent-soft: #e8f7f4;
  --warn: #b45309;
  --warn-soft: #fff7ed;
  --bad: #b91c1c;
  --bad-soft: #fff1f2;
  --good: #15803d;
  --good-soft: #ecfdf3;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --shadow: 0 16px 42px rgba(15, 39, 46, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

body.locked {
  overflow: hidden;
}

body.locked .appShell {
  display: none;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button.ghost,
.mainNav button,
.reportTabs button {
  border-color: var(--line);
  background: #fff;
  color: var(--text);
}

button.ghost:hover,
.reportTabs button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

button.dangerText {
  border-color: #fecaca;
  background: #fff7f7;
  color: #b91c1c;
}

button.dangerText:hover {
  border-color: #fca5a5;
  color: #991b1b;
}

button.warnText {
  border-color: #f6c86b;
  background: #fff9e8;
  color: #8a5600;
}

button.warnText:hover {
  border-color: #e7ad37;
  color: #6f4500;
}

button.activeSoft {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 10px;
}

textarea {
  min-height: 92px;
  padding: 10px;
  resize: vertical;
}

.checkGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.checkGrid.wide {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.checkItem {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.checkItem input {
  width: auto;
  min-height: auto;
}

.checkItem small {
  margin-left: auto;
  color: var(--muted);
}

.loginScreen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: url("./assets/factory-panorama.jpg") center / cover no-repeat;
}

body:not(.locked) .loginScreen {
  display: none;
}

.loginShade {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(8, 33, 34, 0.76), rgba(8, 33, 34, 0.38));
}

.loginCard {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  width: min(420px, calc(100vw - 40px));
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.24);
}

.loginCard img {
  width: 148px;
  max-height: 72px;
  object-fit: contain;
}

.loginCard h1 {
  font-size: 26px;
}

.loginCard p,
.loginCard label {
  color: var(--muted);
}

.rememberLogin {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  min-height: 24px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.rememberLogin input {
  width: auto;
  min-height: auto;
}

#loginError {
  min-height: 18px;
  color: var(--bad);
}

.appShell {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #fdfefe;
}

.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
}

.brand img {
  width: 34px;
  height: 28px;
  object-fit: contain;
}

.brand strong {
  display: block;
  font-size: 13px;
  line-height: 1.2;
}

.brand span {
  color: var(--muted);
  font-size: 10px;
}

.mainNav {
  display: grid;
  gap: 5px;
  padding: 8px;
}

.mainNav button {
  justify-content: flex-start;
  width: 100%;
  min-height: 34px;
  padding: 0 8px;
  font-size: 13px;
  text-align: left;
}

.mainNav button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.mainNav button[hidden] {
  display: none;
}

.mainNav [data-thermal-menu-toggle] {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.thermalMenuChevron {
  font-size: 18px;
  line-height: 1;
  transition: transform 160ms ease;
}

[data-thermal-menu-toggle][aria-expanded="true"] .thermalMenuChevron {
  transform: rotate(90deg);
}

.thermalSubNav {
  display: grid;
  gap: 4px;
  padding: 0 0 2px 10px;
}

.thermalSubNav[hidden] {
  display: none;
}

.mainNav .thermalSubNav button {
  min-height: 30px;
  padding-left: 10px;
  border-color: transparent;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
}

.mainNav .thermalSubNav button:hover {
  border-color: var(--line);
  color: var(--text);
  background: #f3f8f8;
}

.mainNav .thermalSubNav button.active {
  border-color: #add9d3;
  color: #0c6f65;
  background: #eaf7f5;
}

.mainArea {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.topbar h1 {
  font-size: 24px;
}

.topbar p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.leadTopSummary {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
}

.leadTopPill {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  box-shadow: 0 5px 16px rgba(15, 39, 46, 0.04);
}

.leadTopPill b {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.leadTopPill strong {
  color: var(--text);
  font-size: 15px;
  line-height: 1;
}

.topbarRight {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar > div:first-child {
  min-width: 0;
}

.accountBadge {
  min-height: 32px;
  display: inline-flex;
  flex: 0 1 auto;
  align-items: center;
  max-width: 104px;
  padding: 0 10px;
  border: 1px solid #b7dfd9;
  border-radius: 999px;
  background: #f4fbfa;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.accountBadge[hidden] {
  display: none;
}

#roleView {
  width: 238px;
  border-color: #b7dfd9;
  background: #f4fbfa;
  color: var(--accent-dark);
}

#roleView[hidden] {
  display: none;
}

.saveStatus {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.iconText span {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--bad);
  color: #fff;
  font-size: 12px;
}

main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 16px 16px 36px;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

.metricGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metricGrid article,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metricGrid article {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.metricGrid span {
  color: var(--muted);
}

.metricGrid strong {
  font-size: 32px;
  line-height: 1;
}

.metricGrid small {
  color: var(--muted);
}

.warnCard {
  background: var(--warn-soft) !important;
  border-color: #fed7aa !important;
}

.contentGrid {
  display: grid;
  gap: 16px;
  width: 100%;
  min-width: 0;
}

.twoCol {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.fulfillmentPinned .panel {
  border-color: rgba(17, 92, 88, 0.28);
  box-shadow: 0 16px 40px rgba(17, 92, 88, 0.08);
}

.fulfillmentItem {
  background: #fff;
}

.adminGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.widePanel {
  grid-column: 1 / -1;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panelHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.panelHead h2 {
  font-size: 17px;
}

.panelHead span {
  color: var(--muted);
  font-size: 13px;
}

.adminHint,
.mutedText {
  color: var(--muted);
  font-size: 13px;
}

.permissionAuditControls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.permissionAuditControls select {
  min-width: 220px;
}

.permissionAuditResult {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.auditSummaryGrid,
.auditPolicyGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.auditSummaryGrid article,
.auditPolicyGrid article {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.auditSummaryGrid strong {
  display: block;
  font-size: 22px;
}

.auditPolicyGrid strong {
  display: block;
  font-size: 14px;
}

.auditSummaryGrid span,
.auditPolicyGrid span {
  color: var(--muted);
  font-size: 12px;
}

.auditCheckList {
  display: grid;
  gap: 8px;
}

.auditCheck {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  background: #fff;
}

.auditCheck.good {
  border-left-color: #0f766e;
}

.auditCheck.warn {
  border-left-color: #d97706;
}

.auditCheck.bad {
  border-left-color: #dc2626;
}

.auditCheck strong,
.auditCheck span {
  display: block;
}

.auditCheck span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.quickActions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px;
}

.processBoard {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  padding: 16px;
}

.processStep {
  position: relative;
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 156px;
  padding: 14px;
  border-color: rgba(15, 118, 110, 0.28);
  background: linear-gradient(180deg, #ffffff, #f3fbfa);
  color: var(--text);
  text-align: left;
}

.processStep:hover {
  border-color: var(--accent);
  background: #fff;
  color: var(--text);
}

.processStep:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -10px;
  z-index: 1;
  width: 10px;
  height: 1px;
  background: var(--line);
}

.processStep span {
  color: var(--muted);
  font-size: 12px;
}

.processStep strong {
  font-size: 16px;
}

.processStep b {
  width: fit-content;
  min-width: 34px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  line-height: 1;
}

.processStep small {
  color: var(--muted);
  line-height: 1.55;
}

.lockedStep {
  border-color: var(--line);
  background: #f7fafb;
  opacity: 0.68;
}

.lockedStep b {
  background: #94a3ad;
}

.noticeList,
.todoBoard,
.queueList,
.costList,
.cardList,
.adminList,
.permissionGrid,
.scopeList,
.handoffRules {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.noticeTools {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px 0;
}

.segmented {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.segmented.tiny button {
  padding: 6px 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-weight: 700;
}

.segmented.tiny button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.segmented.tiny button:not(.active):hover {
  border-color: rgba(15, 118, 110, 0.28);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.noticeTools > .ghost {
  border-color: var(--line);
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

.noticeTools > .ghost:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.readonlyMini {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  color: var(--text);
}

.noticeItem,
.todoItem,
.queueItem,
.cardItem,
.adminItem,
.permissionItem,
.scopeItem,
.ruleItem,
.costItem {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.noticeButton {
  width: 100%;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.noticeButton:hover {
  border-color: rgba(17, 92, 88, 0.38);
  background: #f4fbfa;
  color: var(--text);
}

.noticeButton.read {
  background: #fff;
  opacity: 0.72;
}

.todoActionItem {
  border-color: rgba(17, 92, 88, 0.18);
  background: #fff;
  box-shadow: inset 4px 0 0 rgba(17, 92, 88, 0.72);
}

.todoActionItem .rowActions {
  justify-content: space-between;
}

.todoActionItem .rowActions button {
  min-height: 36px;
}

.noticeButton small {
  color: var(--muted);
}

.noticeItem strong,
.todoItem strong,
.queueItem strong,
.cardItem strong,
.adminItem strong {
  font-size: 15px;
}

.noticeItem span,
.todoItem span,
.queueItem span,
.cardItem span,
.adminItem span,
.permissionItem span,
.scopeItem span,
.ruleItem span,
.costItem span {
  color: var(--muted);
  font-size: 13px;
}

.financeOrderItem {
  gap: 10px;
  background: #fff;
}

.financeTaskCards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 16px 0;
}

.financeTaskCards button {
  display: grid;
  gap: 4px;
  justify-items: start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.financeTaskCards button.active {
  border-color: rgba(17, 92, 88, 0.45);
  background: #f1fbfa;
  color: var(--accent);
}

.financeTaskCards span {
  color: var(--muted);
  font-size: 12px;
}

.financeTaskCards strong {
  font-size: 22px;
}

.financeFilters {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) repeat(4, minmax(120px, 1fr)) auto;
  gap: 10px;
  padding: 12px 16px 0;
}

.financeFilters input,
.financeFilters select {
  min-height: 40px;
}

.financeOrderHead,
.financeMeta,
.financeMetrics {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.financeMetrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.financeMetrics span {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
}

.financeRecordPreview {
  display: grid;
  gap: 4px;
}

.financeRecordPreview span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.adminItemHead,
.permissionLine {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.roleTags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.roleTags span,
.switchPill {
  width: fit-content;
  padding: 4px 8px;
  border: 1px solid rgba(16, 94, 89, 0.18);
  border-radius: 999px;
  background: rgba(16, 94, 89, 0.08);
  color: var(--accent) !important;
  font-size: 12px !important;
}

.adminItem small,
.permissionItem small,
.scopeItem small {
  color: var(--muted);
  font-size: 12px;
}

.permissionTree {
  display: grid;
  gap: 10px;
  max-height: 58vh;
  overflow: auto;
  padding: 4px 2px 8px;
}

.permissionTreeNode {
  display: grid;
  gap: 8px;
}

.permissionTree > .permissionTreeNode {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.permissionTreeChildren {
  display: grid;
  gap: 6px;
  margin-left: 24px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.permissionTreeLabel {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  margin: 0;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.permissionTreeLabel input {
  margin-top: 3px;
}

.permissionTreeNode.is-locked > .permissionTreeLabel,
.checkItem.is-locked {
  background: rgba(241, 245, 249, 0.82);
  color: var(--muted);
}

.permissionTreeNode.is-locked > .permissionTreeLabel input,
.checkItem.is-locked input {
  cursor: not-allowed;
}

.permissionTreeLabel strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

.permissionTreeLabel small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.permissionLockTag {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #64748b;
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
}

.permissionLockReason {
  color: #8a6d3b !important;
}

.permissionTreeNode.depth-0 > .permissionTreeLabel {
  background: rgba(16, 94, 89, 0.08);
}

.permissionTreeNode.depth-0 > .permissionTreeLabel strong {
  color: var(--accent);
}

.templateTools {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(220px, 1.2fr) auto;
  gap: 10px;
  align-items: end;
  margin: 10px 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.templateTools label {
  margin: 0;
}

.templateTools button {
  min-height: 42px;
  white-space: nowrap;
}

.scopeList {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.todoBoard {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.toolbar {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

#view-leads.view.active {
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  height: calc(100vh - 128px);
  min-height: 560px;
  overflow: hidden;
}

#view-leads .toolbar {
  position: relative;
  z-index: 7;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 7px 10px;
  padding: 9px 12px;
  box-shadow: 0 8px 24px rgba(15, 39, 46, 0.05);
}

.leadSummaryGrid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

#view-leads .leadSummaryGrid {
  display: none;
}

.leadSummaryCard {
  display: grid;
  gap: 6px;
  min-height: 92px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

#view-leads .leadSummaryCard {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title value"
    "hint value";
  align-items: center;
  min-height: 50px;
  padding: 7px 12px;
  gap: 2px 10px;
  box-shadow: 0 8px 24px rgba(15, 39, 46, 0.05);
}

.leadSummaryCard span,
.leadSummaryCard small {
  color: var(--muted);
}

#view-leads .leadSummaryCard span {
  grid-area: title;
  font-size: 12px;
  font-weight: 700;
}

#view-leads .leadSummaryCard small {
  grid-area: hint;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leadSummaryCard strong {
  font-size: 28px;
}

#view-leads .leadSummaryCard strong {
  grid-area: value;
  font-size: 24px;
  line-height: 1;
}

.leadQuickFilters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

#view-leads .leadQuickFilters {
  grid-column: 1;
  gap: 6px;
}

.recordQuickFilters {
  grid-column: 1;
  gap: 6px;
}

.leadQuickFilters button {
  border-color: var(--line);
  background: #fff;
  color: var(--text);
}

#view-leads .leadQuickFilters button {
  min-height: 32px;
  padding: 0 10px;
}

.leadQuickFilters button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.leadBulkBar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  flex-wrap: wrap;
}

#view-leads .leadBulkBar {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.leadBulkBar span {
  margin-right: auto;
}

.leadBulkBar button {
  min-height: 30px;
}

.leadPanelTools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  margin-left: auto;
}

.leadPanelTitle {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: wrap;
}

.leadPanelTitle h2 {
  margin: 0;
  white-space: nowrap;
}

.leadPanelActions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.leadPanelActions button {
  min-height: 30px;
  padding: 0 10px;
}

.leadPanelActions .leadBulkBar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  color: var(--muted);
  white-space: normal;
  flex-wrap: wrap;
}

.leadPanelActions .leadBulkBar[hidden] {
  display: none;
}

.leadPanelActions .leadBulkBar span {
  margin-right: 0;
}

.leadPanelActions .leadBulkBar button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

.leadPanelActions .leadBulkBar button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.leadBulkCount {
  color: var(--muted);
  font-weight: 700;
}

.leadBulkHint {
  color: var(--muted);
  font-size: 12px;
}

.leadPanelTools .leadBulkBar {
  display: inline-flex;
  min-height: 30px;
  color: var(--muted);
  white-space: nowrap;
}

.leadPanelTools .leadBulkBar[hidden] {
  display: none;
}

.leadPanelTools .leadBulkBar span {
  margin-right: 0;
}

.leadPanelTools .leadBulkBar button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

.leadPager {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px 14px;
  color: var(--muted);
}

.leadPager label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.leadPager select {
  width: 82px;
  min-height: 32px;
}

.leadPager button {
  min-height: 32px;
}

.leadPager button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.filterLine,
.buttonLine {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

#view-leads .filterLine {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(660px, auto);
  gap: 8px;
  justify-content: stretch;
  align-items: center;
}

#view-leads .buttonLine {
  grid-column: 2;
  grid-row: 1;
  gap: 7px;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

#view-leads .buttonLine button,
#view-leads .filterLine > input,
#view-leads .searchField,
#view-leads .searchField input,
#view-leads .filterLine > select,
#view-leads .leadFilterSelect,
#view-leads .excelFilterButton {
  min-height: 32px;
}

#view-leads .buttonLine button {
  padding: 0 10px;
}

#view-samples .filterLine,
#view-orders .filterLine {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  justify-content: stretch;
}

#view-samples .filterLine {
  grid-template-columns: minmax(360px, 1fr) minmax(760px, auto);
  align-items: center;
}

#view-orders .filterLine {
  grid-template-columns: minmax(380px, 1fr) minmax(660px, auto);
  align-items: center;
}

#view-samples .buttonLine,
#view-orders .buttonLine {
  grid-column: 2;
  grid-row: 1;
  gap: 7px;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

#view-samples .filterLine > input,
#view-samples .searchField,
#view-samples .searchField input,
#view-orders .filterLine > input,
#view-orders .searchField,
#view-orders .searchField input,
#view-samples .recordFilterSelect,
#view-orders .recordFilterSelect,
#view-samples .excelFilterButton,
#view-orders .excelFilterButton,
#view-samples .buttonLine button,
#view-orders .buttonLine button {
  min-height: 32px;
}

#view-samples .buttonLine button,
#view-orders .buttonLine button {
  padding: 0 10px;
  white-space: nowrap;
}

.searchField {
  position: relative;
  display: block;
  width: 100%;
}

.searchField::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 50%;
  width: 12px;
  height: 12px;
  border: 2px solid var(--muted);
  border-radius: 50%;
  transform: translateY(-58%);
  pointer-events: none;
}

.searchField::after {
  content: "";
  position: absolute;
  left: 25px;
  top: 50%;
  width: 8px;
  height: 2px;
  border-radius: 999px;
  background: var(--muted);
  transform: translateY(5px) rotate(45deg);
  pointer-events: none;
}

.searchField input {
  width: 100%;
  padding-left: 42px;
}

#view-samples .filterCluster,
#view-orders .filterCluster,
#view-leads .filterCluster {
  display: grid;
  grid-template-columns: repeat(6, minmax(100px, 1fr)) auto;
  gap: 8px;
  justify-self: end;
  align-items: center;
  min-width: 0;
}

#view-orders .filterCluster {
  grid-template-columns: repeat(5, minmax(112px, 1fr)) auto;
}

#view-leads .filterCluster {
  grid-template-columns: repeat(5, minmax(104px, 1fr)) auto;
}

#view-samples .resetFilterButton,
#view-orders .resetFilterButton,
#view-leads .resetFilterButton {
  white-space: nowrap;
  min-height: 32px;
  padding: 0 10px;
}

#view-samples table {
  min-width: 1180px;
}

#view-samples th,
#view-samples td {
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

#view-samples td {
  padding: 10px 10px;
}

#view-samples .rowActions {
  justify-content: center;
  white-space: nowrap;
}

#view-orders table {
  min-width: 1240px;
}

#view-orders th,
#view-orders td {
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

#view-orders td {
  padding: 10px 10px;
}

#view-orders .rowActions {
  justify-content: center;
  white-space: nowrap;
}

.filterLine > input {
  flex: 1 1 300px;
}

.filterLine > select {
  width: 160px;
}

#view-leads .filterLine > input,
#view-leads .filterLine > .searchField,
#view-leads .filterLine > select,
#view-leads .leadFilterSelect,
#view-samples .filterLine > input,
#view-samples .filterLine > .searchField,
#view-orders .filterLine > input,
#view-orders .filterLine > .searchField,
.recordFilterSelect {
  width: 100%;
}

.leadFilterSelect,
.recordFilterSelect {
  position: relative;
  min-width: 0;
}

.excelFilter {
  position: relative;
  width: 100%;
  font-size: 13px;
}

.excelFilterButton {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.excelFilterButton span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.excelFilterButton small {
  color: var(--muted);
  font-size: 11px;
}

.excelFilterButton b {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.excelFilter.open .excelFilterButton {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(16, 128, 119, 0.12);
}

.excelFilterMenu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  width: min(260px, 86vw);
  max-height: 320px;
  overflow: hidden;
  display: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 38px rgba(20, 45, 55, 0.16);
}

.excelFilter.open .excelFilterMenu {
  display: block;
}

.excelFilterOption {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 10px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.excelFilterOption:hover {
  background: #f5faf9;
}

.excelFilterOption input {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  min-height: 0;
  accent-color: var(--brand);
}

#view-leads .excelFilterOption input[type="checkbox"] {
  width: 14px;
  height: 14px;
  min-height: 0;
  flex: 0 0 14px;
}

.excelFilterOption span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.excelFilterAll {
  border-bottom: 1px solid var(--line);
  font-weight: 800;
}

.excelFilterAll.partial input {
  opacity: 0.55;
}

.excelFilterList {
  max-height: 268px;
  overflow: auto;
  padding: 4px 0;
}

.excelFilterEmpty {
  padding: 12px 10px;
  color: var(--muted);
}

.tableWrap {
  width: 100%;
  overflow: auto;
}

.productCatalogBody {
  display: grid;
  gap: 14px;
  padding: 18px 20px 22px;
}

.productCategoryBlock {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 39, 46, 0.04);
}

.productCategoryBlock.collapsed {
  overflow: visible;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

#view-products .productCategoryHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  background: #fff !important;
  color: var(--text) !important;
  text-align: left;
  box-shadow: 0 6px 18px rgba(15, 39, 46, 0.04) !important;
  appearance: none;
  -webkit-appearance: none;
}

#view-products .productCategoryHead span {
  font-weight: 800;
}

#view-products .productCategoryHead small {
  color: var(--muted);
  font-size: 12px;
}

#view-products .productCategoryHead:hover {
  border-color: rgba(12, 127, 116, 0.35) !important;
  background: #f6fbfa !important;
  color: var(--text) !important;
}

#view-products .productCategoryBlock:not(.collapsed) .productCategoryHead {
  border-color: var(--accent) !important;
  border-radius: 8px 8px 0 0 !important;
  background: var(--accent) !important;
  color: #fff !important;
}

#view-products .productCategoryBlock:not(.collapsed) .productCategoryHead small,
#view-products .productCategoryBlock:not(.collapsed) .productCategoryHead span {
  color: #fff !important;
}

.productCategoryContent {
  border-top: 1px solid var(--line);
}

.productCategoryNote {
  padding: 12px 16px 4px;
  color: var(--muted);
  font-size: 13px;
}

.productSubGroup {
  margin: 12px 16px 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.productSubHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfdfd;
}

.productSubHead strong {
  font-size: 15px;
}

.productSubHead span {
  color: var(--muted);
  font-size: 12px;
}

.productDetailTable th,
.productDetailTable td {
  padding: 10px 12px;
  vertical-align: middle;
}

.priceEyeButton {
  min-width: 38px;
  padding: 6px 8px;
}

.productPriceText {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 8px;
  font-weight: 800;
}

.productPriceText small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.productMaterialHint {
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfdfd;
}

.productMaterialRow {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.productMaterialRow:last-child {
  border-bottom: 0;
}

.productMaterialEntrances {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

#view-products .productMaterialEntrance {
  display: grid;
  gap: 8px;
  min-height: 92px;
  padding: 16px;
  border-radius: 8px !important;
  text-align: left;
}

.productMaterialEntrance strong {
  font-size: 18px;
}

.productMaterialEntrance span {
  color: var(--muted);
  font-size: 13px;
}

.materialChipLine {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.materialChip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: #fff;
  font-size: 13px;
}

.materialChip small {
  color: var(--muted);
  font-size: 11px;
}

#view-leads .tableWrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: normal;
}

th {
  color: var(--muted);
  font-weight: 600;
  background: #fbfdfd;
}

td p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.leadCustomerCell {
  min-width: 74px;
}

.leadDataRow {
  cursor: pointer;
}

.selectCell {
  width: 46px;
  min-width: 46px;
  padding-left: 8px;
  padding-right: 8px;
  text-align: center;
  vertical-align: middle;
}

.selectCell input,
#leadSelectAll {
  width: auto;
  min-height: auto;
  cursor: pointer;
}

.leadContactCell {
  min-width: 150px;
}

.leadContactCell span {
  display: block;
  line-height: 1.7;
}

.leadContactCell strong {
  display: block;
  white-space: nowrap;
}

#view-leads td {
  padding: 7px 6px;
}

#view-leads table {
  min-width: 1260px;
  font-size: 11px;
}

#view-leads th,
#view-leads td {
  text-align: center;
  vertical-align: middle;
}

#view-leads > .panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#view-leads .panelHead {
  min-height: 40px;
  padding: 8px 12px;
}

#view-leads .panelHead h2 {
  font-size: 16px;
}

#view-leads thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #fbfdfd;
  box-shadow: inset 0 -1px 0 var(--line);
}

#view-leads th:last-child,
#view-leads td:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  min-width: 168px;
  background: #fff;
  box-shadow: -10px 0 16px rgba(15, 39, 46, 0.06);
}

#view-leads th:last-child {
  z-index: 6;
  background: #fbfdfd;
}

#view-leads th,
#view-leads .leadIndexCell,
#view-leads .leadCustomerCell,
#view-leads .leadPhoneCell,
#view-leads .leadOperatorCell,
#view-leads .leadSalesCell,
#view-leads .leadBusinessCell,
#view-leads .leadStatusCell,
#view-leads .leadLevelCell,
#view-leads .leadCreatedCell,
#view-leads .rowActions {
  white-space: nowrap;
}

#view-leads td p,
#view-leads td small {
  margin-left: 0;
}

.leadCompanyCell {
  min-width: 108px;
  max-width: 128px;
}

.leadIndexCell {
  width: 38px;
  min-width: 38px;
  color: var(--muted);
}

.leadPhoneCell {
  min-width: 118px;
}

.leadSalesCell {
  min-width: 82px;
}

.leadOperatorCell {
  min-width: 82px;
}

.leadBusinessCell {
  min-width: 104px;
}

.leadBusinessLinks {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: nowrap;
}

.leadBusinessBadge {
  position: relative;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid #cfe0e5;
  border-radius: 999px;
  background: #f7fbfb;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: none;
}

.leadBusinessBadge:hover {
  border-color: var(--brand);
  background: #eefaf7;
}

.businessHoverCard {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 30;
  display: none;
  width: 260px;
  max-width: 70vw;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--ink);
  text-align: left;
  transform: translateX(-50%);
  white-space: normal;
}

.leadBusinessBadge:hover .businessHoverCard,
.leadBusinessBadge:focus-visible .businessHoverCard {
  display: block;
}

.businessHoverTitle {
  display: block;
  margin-bottom: 6px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
}

.businessHoverLine {
  display: grid;
  gap: 2px;
  padding: 6px 0;
  border-top: 1px solid #eef3f5;
}

.businessHoverLine:first-of-type {
  border-top: 0;
}

.businessHoverLine strong,
.businessHoverLine span,
.businessHoverLine small,
.businessHoverMore,
.businessHoverNote {
  display: block;
  font-size: 11px;
  line-height: 1.45;
}

.businessHoverLine span,
.businessHoverLine small,
.businessHoverMore,
.businessHoverNote {
  color: var(--muted);
}

.businessHoverNote {
  margin: 0 0 4px;
}

.linkedFilterChip {
  margin-left: 8px;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid #b9d8df;
  border-radius: 999px;
  background: #f1fbfd;
  color: #17606c;
  font-size: 12px;
  font-weight: 800;
  box-shadow: none;
}

.leadDemandCell {
  min-width: 82px;
  max-width: 96px;
}

.leadUsageCell {
  min-width: 82px;
  max-width: 96px;
}

.leadLevelCell {
  width: 64px;
  min-width: 64px;
}

.leadLatestCell {
  min-width: 176px;
  max-width: 210px;
}

.leadCreatedCell {
  min-width: 116px;
  color: var(--muted);
}

.cellClamp {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  white-space: normal;
  line-height: 1.45;
}

.cellClamp.twoLine {
  -webkit-line-clamp: 2;
}

.cellClamp.threeLine {
  -webkit-line-clamp: 3;
}

#view-leads .textPreview {
  position: relative;
  display: inline-block;
  max-width: 100%;
  vertical-align: middle;
}

#view-leads .textPreview.clipped {
  cursor: help;
}

#view-leads .textPreview.clipped:hover::after {
  content: attr(data-preview);
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 40;
  width: max-content;
  max-width: 360px;
  max-height: 220px;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
  white-space: pre-wrap;
}

#view-leads .leadCustomerCell .textPreview {
  color: var(--text);
  font-weight: 700;
}

.leadStatusCell {
  min-width: 82px;
}

.leadStatusCell .badge {
  margin: 0 4px 6px 0;
}

.statusButton {
  min-height: 26px;
  padding: 3px 7px;
  border: 0;
  border-radius: 999px;
  background: #e9f7f4;
  color: #0f766e;
  font-size: 11px;
  font-weight: 700;
}

.statusButton.warn {
  background: #fff4d8;
  color: #96640f;
}

.statusButton.bad {
  background: #fde7e7;
  color: #a53a3a;
}

.statusButton.good {
  background: #e9f7f4;
  color: #0f766e;
}

.leadFlowSteps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.leadFlowSteps span {
  min-height: 34px;
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.leadFlowSteps span.done {
  border-color: #b7dfd9;
  background: #eefaf7;
  color: var(--accent-dark);
}

.leadFlowSteps span.current {
  background: var(--accent);
  color: #fff;
}

.drawerActions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.leadPendingRow {
  background: #fff9e8;
}

.leadPendingRow td,
.leadPendingRow td:last-child {
  background: #fff9e8;
}

.leadDuplicateRow {
  box-shadow: inset 3px 0 0 rgba(185, 28, 28, 0.82);
}

.leadDuplicateRow td,
.leadDuplicateRow td:last-child {
  background: #fff5f5;
}

.leadDuplicateRow td:first-child {
  box-shadow: inset 3px 0 0 rgba(185, 28, 28, 0.82);
}

.leadPendingRow.leadDuplicateRow td,
.leadPendingRow.leadDuplicateRow td:last-child {
  background: #fff9e8;
}

.emptyCell,
.emptyState {
  color: var(--muted);
  text-align: center;
}

.emptyCell {
  padding: 28px 12px;
}

.emptyState {
  padding: 26px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge.bad {
  background: var(--bad-soft);
  color: var(--bad);
}

.badge.good {
  background: var(--good-soft);
  color: var(--good);
}

.badge.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.rowActions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 210px;
}

#view-leads .rowActions {
  justify-content: center;
  flex-wrap: nowrap;
  gap: 5px;
  min-width: 154px;
}

#view-leads .rowActions button {
  min-height: 26px;
  padding: 0 7px;
  font-size: 11px;
}

#view-samples .rowActions,
#view-orders .rowActions {
  justify-content: center;
  flex-wrap: nowrap;
  gap: 5px;
  min-width: 130px;
}

#view-samples .rowActions button,
#view-orders .rowActions button {
  min-height: 26px;
  padding: 0 7px;
  font-size: 11px;
}

.rowActions button {
  min-height: 30px;
  padding: 0 10px;
}

.reportTabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.reportTabs button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.reportPanel {
  min-height: 460px;
}

.reportGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
}

.reportCard {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.reportCard strong {
  font-size: 24px;
}

.salesList,
.historyPeople {
  margin: 0;
  padding: 16px 28px;
}

.historyPeople {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.historyPeople span {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 30;
  width: min(560px, 100vw);
  height: 100vh;
  display: none;
  grid-template-rows: auto 1fr;
  border-left: 1px solid var(--line);
  background: #fff;
  box-shadow: -20px 0 60px rgba(14, 36, 44, 0.16);
}

.drawer.aboveModal {
  z-index: 55;
}

.drawer.open {
  display: grid;
}

.drawerHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.drawerHead p {
  margin-top: 4px;
  color: var(--muted);
}

.drawerBody {
  overflow-y: auto;
  padding: 18px;
}

.detailSection {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.detailSection h3 {
  font-size: 15px;
}

.detailGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detailBox {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.detailBox span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.leadBulkConfirm {
  display: grid;
  gap: 12px;
}

.leadBulkConfirmGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.leadBulkConfirmCard,
.leadBulkReason {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.leadBulkConfirmCard span,
.leadBulkConfirmCard small {
  display: block;
  color: var(--muted);
}

.leadBulkConfirmCard strong {
  display: block;
  margin: 4px 0;
  font-size: 28px;
}

.leadBulkConfirmCard.mutedCard {
  background: #fff7f7;
  border-color: #fecaca;
}

.leadBulkReason {
  display: grid;
  gap: 6px;
}

.leadBulkReason.good {
  background: var(--good-soft);
  border-color: #bbf7d0;
}

.leadBulkReason ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.attentionPulse {
  animation: attentionPulse 1.2s ease;
}

@keyframes attentionPulse {
  0%,
  100% {
    box-shadow: var(--shadow);
  }
  35% {
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.18), var(--shadow);
  }
}

.leadImportGuide,
.leadImportSummary,
.leadImportPreview {
  display: grid;
  gap: 8px;
}

.leadImportGuide {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.leadImportGuide p {
  color: var(--muted);
  line-height: 1.6;
}

.leadImportText {
  min-height: 180px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.leadImportSummary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.leadImportSummary div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.leadImportSummary span,
.leadImportSummary strong {
  display: block;
}

.leadImportSummary span {
  color: var(--muted);
  font-size: 12px;
}

.leadImportSummary strong {
  margin-top: 2px;
  font-size: 22px;
}

.leadImportPreview {
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.leadImportRow {
  display: grid;
  grid-template-columns: 42px 1fr 2fr 110px;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.leadImportRow:last-child {
  border-bottom: 0;
}

.leadImportRow small {
  color: var(--muted);
}

.leadImportRow em {
  color: var(--accent);
  font-style: normal;
  font-weight: 700;
}

.leadImportRow.invalid {
  background: var(--bad-soft);
}

.leadImportRow.invalid em {
  color: var(--bad);
}

.leadImportEmpty {
  padding: 12px;
  color: var(--muted);
}

.duplicateLeadNotice {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: var(--warn-soft);
}

.duplicateLeadNotice div {
  display: grid;
  gap: 2px;
}

.duplicateLeadNotice strong {
  color: #9a3412;
  font-size: 13px;
}

.duplicateLeadNotice span {
  color: #7c4a03;
  font-size: 12px;
}

.miniTable {
  display: grid;
  gap: 8px;
}

.miniTableRow {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr);
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.miniTableRow small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.timeline {
  display: grid;
  gap: 10px;
}

.miniList {
  display: grid;
  gap: 8px;
}

.miniList span,
.miniList button {
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.miniList span {
  color: var(--muted);
}

.timelineItem {
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: var(--panel-soft);
}

.timelineItem span {
  color: var(--muted);
  font-size: 12px;
}

.importSourceList {
  display: grid;
  gap: 10px;
}

.importSourceItem {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.importSourceItem span,
.importSourceItem small {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.modalLayer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(8, 20, 24, 0.42);
}

.modalLayer.open {
  display: grid;
}

.confirmLayer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(8, 20, 24, 0.34);
}

.confirmLayer.open {
  display: grid;
}

.confirmDialog {
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.22);
}

.confirmHead,
.confirmFoot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.confirmHead h2 {
  font-size: 20px;
}

.confirmFoot {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: none;
}

.confirmBody {
  display: grid;
  gap: 12px;
  overflow-y: auto;
  padding: 16px;
  color: var(--text);
}

.confirmTarget {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.confirmTarget strong {
  font-size: 18px;
}

.confirmWarning {
  color: #b91c1c;
  font-weight: 700;
}

.testDataRow td,
.testDataRow td:last-child {
  background: #fff9e8;
}

.testDataNotice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  padding: 11px 12px;
  border: 1px solid #f6c86b;
  border-radius: 8px;
  background: #fff9e8;
  color: #6f4500;
}

.testDataNotice strong {
  flex: 0 0 auto;
}

.confirmField {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.confirmField input,
.confirmField textarea {
  width: 100%;
  color: var(--text);
  font-weight: 500;
}

.recycleBinHead > div:first-child {
  display: grid;
  gap: 4px;
}

.recycleBinHead p {
  color: var(--muted);
  font-size: 13px;
}

.panelHeadActions,
.recycleFilterBar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.recycleFilterBar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8fbfc;
}

.recycleFilterBar button {
  min-height: 34px;
  background: #fff;
  color: var(--text);
}

.recycleFilterBar button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.recycleFilterBar button span {
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}

.recycleTable {
  min-width: 1180px;
}

.confirmTextPreview {
  max-height: 132px;
  overflow-y: auto;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  white-space: pre-wrap;
}

.confirmDialog.is-danger #confirmSubmit {
  border-color: #fecaca;
  background: #fff1f2;
  color: #dc2626;
}

.modal {
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.24);
}

.modalHead,
.modalFoot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.modalFoot {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: none;
}

.modalBody {
  overflow-y: auto;
  display: grid;
  gap: 12px;
  padding: 16px;
}

.modal[data-kind="account"],
.modal[data-kind="role"],
.modal[data-kind="rolePermissions"],
.modal[data-kind="permissionTemplate"] {
  width: min(96vw, 1560px);
  height: min(92vh, 980px);
  max-height: calc(100vh - 24px);
}

.modal[data-kind="sample"] {
  width: min(980px, calc(100vw - 32px));
}

.modal[data-kind="contractGenerate"] {
  width: min(980px, calc(100vw - 32px));
}

.modal[data-kind="leadQuick"] {
  width: min(1080px, calc(100vw - 32px));
}

.modal[data-kind="leadQuick"] .modalBody {
  padding: 18px 20px;
}

.modal[data-kind="account"] .modalHead,
.modal[data-kind="role"] .modalHead,
.modal[data-kind="rolePermissions"] .modalHead,
.modal[data-kind="permissionTemplate"] .modalHead {
  padding: 18px 22px;
}

.modal[data-kind="account"] .modalFoot,
.modal[data-kind="role"] .modalFoot,
.modal[data-kind="rolePermissions"] .modalFoot,
.modal[data-kind="permissionTemplate"] .modalFoot {
  padding: 14px 22px;
  background: rgba(255, 255, 255, 0.96);
}

.modal[data-kind="account"] .modalBody,
.modal[data-kind="role"] .modalBody,
.modal[data-kind="rolePermissions"] .modalBody,
.modal[data-kind="permissionTemplate"] .modalBody {
  gap: 14px;
  padding: 18px 22px;
}

.modal[data-kind="account"] .formGrid,
.modal[data-kind="role"] .formGrid,
.modal[data-kind="permissionTemplate"] .formGrid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-content: start;
}

.modal[data-kind="account"] .checkGrid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.assistantSalesBox {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 8px;
  background: #f4fbfa;
}

.assistantSalesBox[hidden] {
  display: none;
}

.compactCheckGrid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.modal[data-kind="account"] .templateTools,
.modal[data-kind="rolePermissions"] .templateTools {
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) minmax(280px, 1.25fr) auto;
}

.modal[data-kind="account"] .permissionTree,
.modal[data-kind="role"] .permissionTree,
.modal[data-kind="rolePermissions"] .permissionTree,
.modal[data-kind="permissionTemplate"] .permissionTree {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  align-items: start;
  gap: 14px;
  max-height: none;
  padding: 2px 2px 10px;
  overflow: visible;
}

.modal[data-kind="account"] .permissionTree > .permissionTreeNode,
.modal[data-kind="role"] .permissionTree > .permissionTreeNode,
.modal[data-kind="rolePermissions"] .permissionTree > .permissionTreeNode,
.modal[data-kind="permissionTemplate"] .permissionTree > .permissionTreeNode {
  align-self: start;
  padding: 14px;
  background: #fbfcfd;
}

.modal[data-kind="account"] .permissionTreeChildren,
.modal[data-kind="role"] .permissionTreeChildren,
.modal[data-kind="rolePermissions"] .permissionTreeChildren,
.modal[data-kind="permissionTemplate"] .permissionTreeChildren {
  margin-left: 12px;
  padding-left: 12px;
}

.modal[data-kind="account"] .permissionTreeLabel,
.modal[data-kind="role"] .permissionTreeLabel,
.modal[data-kind="rolePermissions"] .permissionTreeLabel,
.modal[data-kind="permissionTemplate"] .permissionTreeLabel {
  min-height: 38px;
}

.formGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.formGrid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.formGrid .full {
  grid-column: 1 / -1;
}

.plainPreview {
  margin: 6px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ink);
}

.warnBox {
  padding: 10px 12px;
  border: 1px solid #f5c2c7;
  border-radius: 8px;
  background: #fff1f2;
  color: #9f1239;
  font-size: 12px;
  line-height: 1.6;
}

.linkedBusinessConfirm {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px !important;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
  color: var(--text) !important;
}

.linkedBusinessConfirm input {
  width: 16px;
  height: 16px;
}

.formSectionTitle {
  grid-column: 1 / -1;
  padding-top: 4px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.inlineInputAction {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
  align-items: center;
}

.squareBtn {
  width: 38px;
  min-width: 38px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.leadQuickPanel {
  display: grid;
  gap: 14px;
}

.leadQuickSection {
  display: grid;
  gap: 10px;
}

.leadQuickSection h3 {
  margin: 0;
  font-size: 15px;
}

.leadQuickHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  background: #fff;
}

.leadQuickHead > div {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.leadQuickHead strong {
  font-size: 18px;
}

.leadQuickHead small {
  color: var(--muted);
}

.leadDisabledReason {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: min(460px, 42vw);
  overflow: hidden;
  padding: 0 8px;
  border: 1px solid #fecaca;
  border-radius: 999px;
  background: #fff1f2;
  color: #b91c1c;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leadQuickInfoGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 8px 8px;
}

.leadQuickInfoGrid .detailBox {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
}

.leadQuickInfoGrid .detailBox:nth-child(1),
.leadQuickInfoGrid .detailBox:nth-child(2) {
  border-top: 0;
}

.leadQuickInfoGrid .detailBox:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.leadQuickOpsPanel {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(17, 92, 88, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.leadQuickControls {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(180px, 240px);
  gap: 10px;
  align-items: end;
  padding: 0;
}

.leadQuickAssignInline {
  display: grid;
  grid-template-columns: auto minmax(180px, 240px) auto;
  gap: 10px;
  align-items: center;
  width: fit-content;
  max-width: 100%;
}

.leadQuickAssignInline span {
  color: var(--muted);
  font-size: 13px;
}

.leadQuickPendingButton {
  min-height: 42px;
  cursor: default;
}

.leadQuickActionBar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.leadQuickActionBar .is-disabled {
  color: #94a3b8;
  background: #f8fafc;
  cursor: not-allowed;
}

.leadQuickHint {
  padding: 8px 10px;
  border: 1px dashed #d8e2ea;
  border-radius: 8px;
  color: var(--muted);
  background: #fbfdfe;
  font-size: 12px;
}

.leadQuickControls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.leadQuickNote {
  min-height: 66px;
  resize: vertical;
  font-size: 13px;
  line-height: 1.55;
}

.leadQuickBusinessSummary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.leadQuickBusinessGroup {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.leadQuickBusinessHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.leadQuickBusinessHead strong {
  font-size: 13px;
}

.leadQuickBusinessHead span {
  color: var(--accent);
}

.leadQuickBusinessList {
  display: grid;
  gap: 6px;
}

.leadQuickBusinessItem {
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid #e1e8ee;
  border-radius: 7px;
  color: var(--text);
  text-align: left;
  background: #fbfdfe;
}

.leadQuickBusinessItem:hover {
  border-color: rgba(17, 92, 88, 0.34);
  background: #f7fbfa;
}

.leadQuickBusinessItem strong,
.leadQuickBusinessItem span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leadQuickBusinessItem strong {
  font-size: 12px;
}

.leadQuickBusinessItem span,
.leadQuickBusinessEmpty {
  color: var(--muted);
  font-size: 12px;
}

.leadQuickBusinessItem.extra {
  display: none;
}

.leadQuickBusinessGroup.expanded .leadQuickBusinessItem.extra {
  display: grid;
}

.leadQuickTimelineShell {
  display: grid;
  gap: 8px;
}

.leadQuickTimeline {
  position: relative;
  display: grid;
  gap: 8px;
  max-height: 310px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
}

.leadQuickTimeline.is-loading {
  display: flex;
  min-height: 120px;
  align-items: center;
  justify-content: center;
  color: #7f8b97;
  font-size: 13px;
}

.leadTimelineLoading {
  padding: 18px 14px;
  border: 1px dashed #d3dbe3;
  border-radius: 8px;
  background: #f8fbfd;
}

.leadTimelineTextItem {
  display: grid;
  gap: 3px;
  padding: 8px 10px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  line-height: 1.42;
}

.leadTimelineToggle {
  justify-self: center;
}

.leadTimelineMeta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.leadTimelineTextItem time {
  color: #758494;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10.5px;
  line-height: 1.2;
  white-space: nowrap;
}

.leadTimelineDeleteBtn {
  min-height: 0;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.3;
  opacity: 0.68;
}

.leadTimelineDeleteBtn:hover {
  opacity: 1;
}

.leadTimelineTextItem p {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
  word-break: break-word;
}

.leadTimelineTextItem strong {
  font-size: 12px;
  margin-right: 4px;
}

.leadTimelineTextItem span {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.42;
  word-break: break-word;
}

.leadTimelineEmpty {
  padding: 16px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.sampleLeadPicker {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  position: relative;
  overflow: visible;
}

.sampleLeadSearchRow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: end;
}

.sampleLeadSelected {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(17, 92, 88, 0.18);
  border-radius: 8px;
  background: #eefaf8;
}

.sampleLeadSelected.empty {
  border-style: dashed;
  background: #fff;
}

.sampleLeadSelected span,
.sampleLeadSelected small,
.sampleLeadOption span,
.sampleLeadOption small {
  color: var(--muted);
}

.sampleLeadSelected strong {
  color: var(--text);
}

.sampleLeadResults {
  display: grid;
  gap: 8px;
  position: absolute;
  z-index: 80;
  top: 78px;
  left: 12px;
  right: 12px;
  max-height: 332px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid rgba(17, 92, 88, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(10px);
  animation: leadPickerDrop 0.14s ease-out;
}

.sampleLeadResults[hidden] {
  display: none;
}

.sampleLeadOption {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(180px, 1fr) minmax(220px, 1.4fr);
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.sampleLeadOption:hover,
.sampleLeadOption.active {
  border-color: rgba(17, 92, 88, 0.42);
  background: #f4fbfa;
}

.sampleLeadOption.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.sampleLeadOption strong,
.sampleLeadOption span,
.sampleLeadOption small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sampleLeadEmpty {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: #fff;
}

.quickOrderLeadTools {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
}

.quickOrderLeadTools small,
.quickOrderSourceEmpty {
  color: var(--muted);
  font-size: 12px;
}

.orderQuickLeadPanel {
  display: grid;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.orderQuickLeadPanel[hidden] {
  display: none;
}

.orderQuickLeadHead,
.quickOrderSourceSelected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.quickOrderLeadGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.quickOrderLeadGrid .full {
  grid-column: 1 / -1;
}

.quickOrderSourcePicker {
  position: relative;
  display: grid;
  gap: 8px;
}

.quickOrderSourceResults {
  top: 62px;
  left: 0;
  right: 0;
}

.quickOrderSourceSelected {
  justify-content: flex-start;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
}

.quickOrderSourceSelected span {
  color: var(--muted);
  font-size: 12px;
}

.quickOrderSourceSelected button {
  margin-left: auto;
}

@media (max-width: 760px) {
  .quickOrderLeadGrid {
    grid-template-columns: 1fr;
  }

  .quickOrderLeadGrid .full {
    grid-column: auto;
  }

  .quickOrderLeadTools,
  .orderQuickLeadHead,
  .quickOrderSourceSelected {
    align-items: stretch;
    flex-direction: column;
  }

  .quickOrderSourceSelected button {
    margin-left: 0;
  }
}

@keyframes leadPickerDrop {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sampleItemTable {
  display: grid;
  gap: 8px;
}

.orderItemTable {
  display: grid;
  gap: 8px;
}

.sampleItemRow {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) minmax(130px, 1fr) minmax(110px, .8fr) minmax(100px, .7fr) minmax(160px, 1fr) 38px;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.orderItemRow {
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) minmax(120px, .9fr) minmax(95px, .7fr) minmax(90px, .65fr) minmax(90px, .65fr) minmax(100px, .75fr) minmax(140px, 1fr) 38px;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.sampleItemTable:not(.hasMultipleRows) .sampleItemRow {
  grid-template-columns: minmax(160px, 1.2fr) minmax(130px, 1fr) minmax(110px, .8fr) minmax(100px, .7fr) minmax(160px, 1fr);
}

.orderItemTable:not(.hasMultipleRows) .orderItemRow {
  grid-template-columns: minmax(150px, 1.2fr) minmax(120px, .9fr) minmax(95px, .7fr) minmax(90px, .65fr) minmax(90px, .65fr) minmax(100px, .75fr) minmax(140px, 1fr);
}

.sampleItemRow label,
.orderItemRow label {
  min-width: 0;
}

.sampleItemRow[data-custom-product="false"] .sampleCustomField,
.sampleItemRow[data-custom-product="true"] [data-sample-spec],
.sampleItemRow[data-custom-product="true"] [data-sample-unit],
.orderItemRow[data-custom-product="false"] .sampleCustomField,
.orderItemRow[data-custom-product="true"] [data-order-spec],
.orderItemRow[data-custom-product="true"] [data-order-unit] {
  display: none;
}

.sampleCustomField {
  margin-top: 8px;
}

.sampleLineActions {
  justify-content: flex-start;
}

.orderTotalBox {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 8px;
  background: #f4fbfa;
}

.orderTotalBox span {
  color: var(--muted);
  font-size: 12px;
}

.orderTotalBox strong {
  color: var(--text);
  font-size: 20px;
}

.extraContactField[hidden] {
  display: none;
}

.modalTimelineBlock {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.modalTimelineBlock h3 {
  font-size: 14px;
  color: var(--text);
}

.compactTimeline .timelineItem {
  background: #fff;
}

.financeAnalysisPanel {
  min-height: calc(100vh - 130px);
}

.financeAnalysisFrame {
  width: 100%;
  min-height: calc(100vh - 210px);
  border: 0;
  border-radius: 8px;
  background: #f7fafb;
}

.embeddedModulePanel,
.thermalModulePanel {
  min-height: calc(100vh - 120px);
  padding: 0;
  overflow: hidden;
}

.embeddedModuleFrame,
.thermalModuleFrame {
  display: block;
  width: 100%;
  min-height: calc(100vh - 120px);
  border: 0;
  background: #fff;
}

.thermalModuleFrame[hidden] {
  display: none;
}

.thermalServiceState {
  display: flex;
  min-height: 180px;
  padding: 24px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  text-align: center;
  background: #f7fafb;
}

.thermalServiceState[hidden] {
  display: none;
}

.thermalServiceState strong {
  color: var(--text);
  font-size: 17px;
}

.thermalServiceActions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: none;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #12262a;
  color: #fff;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
}

.toast.show {
  display: block;
}

@media (max-width: 1100px) {
  .appShell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .mainNav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  main {
    width: 100%;
  }

  #view-leads.view.active {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  #view-leads .toolbar {
    grid-template-columns: 1fr;
  }

  #view-leads .leadQuickFilters,
  #view-leads .buttonLine,
  #view-leads .filterLine,
  #view-leads .leadBulkBar {
    grid-column: 1;
    grid-row: auto;
  }

  #view-leads .buttonLine {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  #view-leads .filterLine {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #view-leads > .panel {
    max-height: 72vh;
  }

  .metricGrid,
  .leadSummaryGrid,
  .todoBoard,
  .twoCol,
  .adminGrid,
  .processBoard,
  .scopeList,
  .reportGrid {
    grid-template-columns: 1fr;
  }

  .processStep:not(:last-child)::after {
    display: none;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .filterLine > input,
  .filterLine > select {
    flex: 1 1 180px;
    width: auto;
  }

  .modal[data-kind="account"],
  .modal[data-kind="role"],
  .modal[data-kind="rolePermissions"],
  .modal[data-kind="permissionTemplate"] {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
  }

  .modal[data-kind="account"] .formGrid,
  .modal[data-kind="role"] .formGrid,
  .modal[data-kind="account"] .templateTools,
  .modal[data-kind="rolePermissions"] .templateTools {
    grid-template-columns: 1fr;
  }

  .modal[data-kind="account"] .permissionTree,
  .modal[data-kind="role"] .permissionTree,
  .modal[data-kind="rolePermissions"] .permissionTree,
  .modal[data-kind="permissionTemplate"] .permissionTree {
    grid-template-columns: 1fr;
  }

  .sampleLeadSearchRow,
  .sampleLeadOption {
    grid-template-columns: 1fr;
  }

  .leadQuickInfoGrid,
  .leadQuickControls {
    grid-template-columns: 1fr;
  }

  .leadQuickInfoGrid .detailBox,
  .leadQuickInfoGrid .detailBox:nth-child(odd) {
    border-right: 0;
  }

  .leadQuickInfoGrid .detailBox:nth-child(2) {
    border-top: 1px solid var(--line);
  }

  .financeTaskCards,
  .financeFilters,
  .financeMetrics {
    grid-template-columns: 1fr;
  }

  .sampleItemRow {
    grid-template-columns: 1fr;
  }

  .orderItemRow,
  .orderItemTable:not(.hasMultipleRows) .orderItemRow {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 14px;
  }

  .appShell {
    gap: 0;
  }

  .sidebar {
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    margin-bottom: 10px;
  }

  .brand h1 {
    font-size: 18px;
  }

  .mainNav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .mainNav button {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 8px 12px;
    white-space: nowrap;
  }

  .topbar {
    padding: 14px;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .topbarRight,
  .noticeTools,
  .drawerActions,
  .rowActions {
    width: 100%;
  }

  .topbarRight,
  .drawerActions,
  .rowActions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .topbarRight > *,
  .drawerActions > *,
  .rowActions > * {
    width: 100%;
  }

  main {
    padding: 12px;
  }

  .metricGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .metricGrid article,
  .panel,
  .todoItem,
  .noticeItem {
    border-radius: 8px;
  }

  .metricGrid strong {
    font-size: 24px;
  }

  .quickActions {
    grid-template-columns: 1fr 1fr;
  }

  .noticeTools {
    display: grid;
    grid-template-columns: 1fr;
  }

  .noticeTools .segmented {
    width: 100%;
  }

  .noticeTools .segmented button {
    flex: 1;
  }

  .todoItem strong,
  .noticeItem strong {
    font-size: 16px;
  }

  .todoItem span,
  .noticeItem span {
    font-size: 14px;
    line-height: 1.55;
  }

  .drawer {
    width: 100vw;
    border-left: 0;
  }

  .drawerHead {
    padding: 14px;
  }

  .drawerBody {
    padding: 14px;
    padding-bottom: 92px;
  }

  .detailGrid {
    grid-template-columns: 1fr;
  }

  .modal {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .modalHead,
  .modalFoot {
    padding: 12px;
  }

  .modalBody {
    padding: 12px;
  }

  .modalFoot {
    grid-template-columns: 1fr 1fr;
  }

  .formGrid,
  .financeTaskCards,
  .financeFilters,
  .financeMetrics,
  .leadQuickBusinessSummary {
    grid-template-columns: 1fr;
  }
}
