:root {
  --ink: #1f2933;
  --muted: #64748b;
  --line: #d7dde4;
  --line-strong: #b9c4d0;
  --page: #f4f6f8;
  --panel: #ffffff;
  --input: #eef8f3;
  --sales-tint: #e9f8f2;
  --unweighted-tint: #fff5df;
  --weighted-tint: #eaf3ff;
  --reward-tint: #f3ecff;
  --accent: #0f766e;
  --accent-soft: #dff5f0;
  --blue: #2563eb;
  --amber: #b45309;
  --business-accent: #0f766e;
  --business-soft: #ecfdf5;
  --performance-accent: #4f46e5;
  --performance-soft: #eef2ff;
  --commission-accent: #d97706;
  --commission-soft: #fff7ed;
  --order-accent: #7c2d12;
  --order-soft: #fff7ed;
  --labor-accent: #0e7490;
  --labor-soft: #ecfeff;
  --shadow: none;
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("https://www.seagm.com/skin/fonts/manrope/v15/manrope-8951283ba1.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
  font-size: 12px;
  line-height: 1.4;
  font-family: "Manrope", "PingFang SC", "Microsoft YaHei", "Arial", system-ui, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 184px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 12px 10px;
  border-right: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.brand {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  padding: 0 4px 10px;
  border-bottom: 1px solid #edf1f4;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #111827;
  color: #facc15;
  font-size: 13px;
  font-weight: 800;
}

.brand h1,
.topbar h2,
.module-head h3 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
}

.eyebrow {
  margin: 0 0 4px;
  color: #8a97a8;
  font-size: 12px;
  text-transform: uppercase;
}

.module-list {
  display: grid;
  gap: 4px;
}

.module-group {
  display: grid;
  gap: 3px;
}

.module-parent {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 30px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 8px;
  background: transparent;
  color: #111827;
  font-size: 12px;
  font-weight: 900;
  text-align: left;
}

.module-parent::after {
  content: "▸";
  margin-left: auto;
  color: #94a3b8;
  font-size: 10px;
}

.module-group.open > .module-parent::after {
  content: "▾";
}

.module-parent span {
  color: #94a3b8;
  font-size: 12px;
}

.module-sublist {
  display: none;
  gap: 3px;
}

.module-group.open > .module-sublist {
  display: grid;
}

.module-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 8px;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  background: transparent;
  text-decoration: none;
}

.module-root {
  color: #111827;
  font-weight: 900;
}

.module-subitem {
  margin-left: 26px;
  min-height: 28px;
  padding-left: 10px;
  border-left: 2px solid #dbe3ea;
  border-radius: 0 6px 6px 0;
}

.module-item span {
  color: #94a3b8;
  font-size: 12px;
}

.module-item.active {
  border-color: #b7e4db;
  background: #eaf8f5;
  color: #0f766e;
}

.admin-only {
  display: none;
}

body.is-admin .module-list .module-group.admin-only {
  display: grid;
}

body.is-admin .module-list .module-item.admin-only {
  display: flex;
}

body.is-admin .module-card.admin-only.active-module {
  display: block;
}

.workspace {
  min-width: 0;
  padding: 10px 12px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 40px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.is-home .topbar,
.is-home .workbench-bar,
.is-sales-stats .workbench-bar,
.is-static-module .workbench-bar {
  display: none;
}

.topbar h2 {
  font-size: 14px;
  font-weight: 800;
}

.toolbar {
  display: flex;
  gap: 6px;
  align-items: center;
}

.icon-button,
.text-button,
.add-row-button,
.secondary-button {
  min-height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
}

.icon-button {
  width: 30px;
  font-size: 12px;
}

.text-button,
.add-row-button {
  padding: 0 10px;
}

.text-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.workbench-bar {
  display: block;
  margin-bottom: 6px;
}

.period-panel {
  display: flex;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 6px 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.period-field {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 0 0 auto;
}

.period-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.period-field input {
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 8px;
  background: #fbfdfe;
  color: var(--ink);
  font-weight: 800;
}

.history-selector {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-weight: 800;
}

.history-selector[hidden] {
  display: none;
}

.history-selector select {
  min-width: 140px;
  height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 0 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.secondary-button {
  padding: 0 10px;
  background: #f8fafc;
  color: var(--ink);
}

.period-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.data-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

/* ── Compact table layout ── */
.compact-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
}

.compact-table th,
.compact-table td {
  height: 28px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 2px 6px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 800;
}

.compact-table th:last-child,
.compact-table td:last-child {
  border-right: 0;
}

.compact-table th {
  color: var(--muted);
  font-weight: 800;
  background: #eef3f8;
}

.compact-table th.ct-name { width: 64px; text-align: left; }
.compact-table td.ct-name {
  text-align: left;
  font-weight: 900;
  color: #334155;
  background: #f8fafc;
}

.is-editing .compact-table th.ct-name,
.is-editing .compact-table td.ct-name {
  width: 126px;
}

.is-editing .enterprise-commission-table th.ct-name,
.is-editing .enterprise-commission-table td.ct-name {
  width: 126px;
}

.compact-table td.ct-name input,
.table-name-input {
  width: 56px;
  height: 20px;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 0 4px;
  background: transparent;
  color: #2563eb;
  font-weight: 800;
  font-size: 12px;
  text-align: left;
}

/* 可录入字段 — 湛蓝色 */
.compact-table th.ct-entry { background: #e8f4fa; }
.compact-table td.ct-entry {
  background: #f0f8ff;
  color: #2563eb;
  font-weight: 800;
}
.compact-table td.ct-entry input,
.compact-table td.ct-reward input,
.table-input {
  width: 72px;
  height: 20px;
  border: 1px solid transparent;
  border-bottom: 1.5px dashed #2563eb;
  border-radius: 3px;
  padding: 0 3px;
  background: transparent;
  color: #2563eb;
  font-weight: 800;
  font-size: 12px;
  text-align: left;
}
.compact-table td.ct-entry input:focus,
.compact-table td.ct-reward input:focus,
.table-name-input:focus,
.table-input:focus {
  outline: 2px solid rgba(26, 109, 181, 0.25);
  border-color: #2563eb;
}

/* 自动计算字段 — 普通色 */
.compact-table td.ct-calc {
  background: #f8fafc;
  color: var(--ink);
}
.compact-table td.ct-calc strong { font-weight: 800; }

.compact-table th.ct-final { background: #eefaf7; }
.compact-table td.ct-final { background: #f0faf7; }
.compact-table td.ct-final strong { color: var(--accent); font-weight: 900; }

.compact-table th.ct-total { background: #f0f3f7; }
.compact-table td.ct-total { background: #f4f7fa; }
.compact-table td.ct-total strong { color: var(--accent); font-weight: 900; }

.compact-table th.ct-unweighted { background: #fff8e8; }
.compact-table td.ct-unweighted { background: #fffcf2; color: var(--ink); }

.compact-table th.ct-weighted { background: #edf4ff; }
.compact-table td.ct-weighted { background: #f4f8ff; color: var(--ink); }

/* 奖励字段 — 可录入，湛蓝色 */
.compact-table th.ct-reward { background: #e8f4fa; }
.compact-table td.ct-reward {
  background: #f0f8ff;
  color: #2563eb;
  font-weight: 800;
}
.compact-table thead tr:first-child th { border-bottom-color: var(--line-strong); }

/* 提成比 / 加权因子行 */
.compact-table th.ct-rate {
  height: 20px;
  padding: 1px 4px;
  font-size: 11px;
  font-weight: 900;
  color: #6b7280;
  background: #f1f5f9;
  border-bottom: 2px solid var(--line-strong);
}

/* 分组表头色带 */
.compact-table .ct-group-row th {
  height: 26px;
  padding: 2px 4px;
  text-align: center;
}

.compact-table .ct-field-row th {
  height: 36px;
  padding: 3px 5px;
}
.compact-table th.ct-group-start {
  border-left: 2px solid #cbd5e1;
}
.compact-table th.ct-section-entry {
  background: #e8f4fa;
  color: #1a5276;
  font-size: 12px;
  font-weight: 900;
  border-bottom: 2px solid #7fb3d3;
}
.compact-table th.ct-section-unweighted {
  background: #fef9e7;
  color: #7d6608;
  font-size: 12px;
  font-weight: 900;
  border-bottom: 2px solid #f0d27a;
}
.compact-table th.ct-section-weighted {
  background: #eaf2fb;
  color: #1a4a7a;
  font-size: 12px;
  font-weight: 900;
  border-bottom: 2px solid #8bb4d9;
}
.compact-table th.ct-section-reward {
  background: #f5eef8;
  color: #6c3483;
  font-size: 12px;
  font-weight: 900;
  border-bottom: 2px solid #c39bd3;
}
.compact-table th.ct-section-final {
  background: #e8f6f3;
  color: #0e6655;
  font-size: 12px;
  font-weight: 900;
  border-bottom: 2px solid #73c6b6;
}

.compact-table th small {
  display: block;
  font-size: 10px;
  font-weight: 900;
  color: #9ca3af;
  margin-top: 1px;
}

.compact-table tfoot td {
  border-top: 2px solid var(--line-strong);
  border-bottom: 0;
  background: #f4f7fa;
  font-weight: 900;
  height: 30px;
}

.compact-table tfoot td strong { color: var(--accent); font-weight: 900; }

.compact-table .ct-group-label {
  text-align: center;
  font-size: 11px;
  color: #5f6f82;
  letter-spacing: 0;
  background: #eef3f8;
}

.is-viewing .compact-table td.ct-entry {
  background: #f0f8ff;
}

.data-workspace {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #e9eef4;
  box-shadow: var(--shadow);
}

.module-card {
  margin-bottom: 0;
  padding: 8px;
  display: none;
  border: 0;
  border-radius: 0 0 5px 5px;
  box-shadow: none;
}

.module-card.active-module {
  display: block;
}

.module-card > .module-head {
  --page-accent: var(--accent);
  --page-soft: #f8fafc;
  margin-bottom: 8px;
  border: 1px solid color-mix(in srgb, var(--page-accent) 24%, var(--line));
  border-left: 5px solid var(--page-accent);
  background: linear-gradient(90deg, var(--page-soft), #ffffff 70%);
}

#home > .module-head {
  --page-accent: var(--business-accent);
  --page-soft: var(--business-soft);
}

#employee-history > .module-head {
  --page-accent: #2563eb;
  --page-soft: #eff6ff;
}

#sales-stats > .module-head {
  --page-accent: var(--performance-accent);
  --page-soft: var(--performance-soft);
}

#government-orders > .module-head {
  --page-accent: var(--order-accent);
  --page-soft: var(--order-soft);
}

#commission-rules > .module-head {
  --page-accent: var(--commission-accent);
  --page-soft: var(--commission-soft);
}

#visitor-management > .module-head {
  --page-accent: #7c3aed;
  --page-soft: #f5f3ff;
}

.record-layout {
  display: grid;
  gap: 6px;
}

.record-section {
  display: grid;
  gap: 4px;
  --section-accent: var(--accent);
  --section-soft: #f8fafc;
  --section-head: #f1f5f9;
  border: 1px solid color-mix(in srgb, var(--section-accent) 26%, var(--line));
  border-left: 5px solid var(--section-accent);
  border-radius: 6px;
  padding: 6px;
  background: linear-gradient(90deg, var(--section-soft), #ffffff 42%);
}

.commission-section {
  --section-accent: var(--commission-accent);
  --section-soft: var(--commission-soft);
  --section-head: #ffedd5;
}

.labor-section {
  --section-accent: var(--labor-accent);
  --section-soft: var(--labor-soft);
  --section-head: #cffafe;
}

.record-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 28px;
  border-bottom: 1px solid var(--line);
  margin: -6px -6px 4px;
  padding: 6px 8px;
  background: var(--section-head);
}

.record-section-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 900;
}

.section-total {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.enterprise-crm-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: start;
}

.module-column {
  min-width: 0;
  --module-accent: var(--accent);
  --module-soft: #fbfcfd;
  border: 1px solid color-mix(in srgb, var(--module-accent) 24%, var(--line));
  border-left: 4px solid var(--module-accent);
  border-radius: 5px;
  padding: 5px;
  background: linear-gradient(90deg, var(--module-soft), #ffffff 55%);
}

.person-list {
  max-width: 100%;
  overflow-x: auto;
}

.enterprise-module {
  --module-accent: #0f766e;
  --module-soft: #ecfdf5;
}

.crm-module {
  --module-accent: #7c3aed;
  --module-soft: #f5f3ff;
}

.government-module {
  --module-accent: #2563eb;
  --module-soft: #eff6ff;
}

.sampling-module {
  --module-accent: #0891b2;
  --module-soft: #ecfeff;
}

.browser-tabs {
  display: flex;
  gap: 0;
  align-items: flex-end;
  border-bottom: 1px solid var(--line);
  background: #f4f6f8;
  overflow-x: auto;
}

.browser-tab {
  min-height: 30px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  padding: 0 12px;
  background: transparent;
  color: #475467;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.browser-tab.active {
  position: relative;
  z-index: 2;
  background: var(--panel);
  color: var(--accent);
  box-shadow: inset 0 2px 0 var(--accent), inset 1px 0 0 #fff, inset -1px 0 0 #fff;
}

.module-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 4px;
  padding: 5px 6px;
  border-bottom: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.72);
}

.submodule-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 10px 0 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.module-head h3 {
  font-size: 13px;
  font-weight: 800;
}

.submodule-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

.add-row-button {
  background: var(--accent-soft);
  color: #115e59;
}

.name-input {
  width: 88px;
  height: 20px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 8px;
  background: #f8fafc;
  color: var(--blue);
  font-weight: 800;
}

.name-input:focus,
.data-table input:focus,
.entry-board input:focus {
  outline: 3px solid rgba(37, 99, 235, 0.18);
  border-color: var(--blue);
}

.entry-board,
.result-board {
  display: grid;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}

.enterprise-flow-board {
  display: flex;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  align-items: flex-start;
}

.enterprise-unified-board {
  display: grid;
  gap: 4px;
}

.enterprise-unified-person {
  display: grid;
  grid-template-columns: 88px max-content;
  gap: 5px;
  align-items: stretch;
  width: fit-content;
  border: 1px solid #e1e7ee;
  border-radius: 4px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.9);
}

.enterprise-unified-groups {
  flex-wrap: nowrap;
}

.enterprise-type-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  align-items: stretch;
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  overflow: hidden;
}

.entry-type-row {
  background: #f8fffb;
}

.unweighted-type-row {
  background: #fffaf0;
}

.weighted-type-row {
  background: #f4f8ff;
}

.enterprise-type-items {
  display: grid;
  gap: 4px;
  align-items: stretch;
  padding: 5px;
}

.enterprise-type-person {
  display: grid;
  grid-template-columns: 88px max-content;
  gap: 5px;
  align-items: stretch;
  width: fit-content;
  border: 1px solid #e1e7ee;
  border-radius: 4px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.86);
}

.enterprise-entry-person {
  background: #fafffc;
}

.type-person-name {
  display: flex;
  align-items: center;
  height: 60px;
  border-right: 1px solid var(--line);
  padding: 0 4px 0 2px;
  color: #334155;
  font-weight: 900;
  overflow: hidden;
  white-space: nowrap;
}

.flow-line-label {
  display: flex;
  align-items: center;
  height: 26px;
  border-bottom: 1px solid var(--line-strong);
  padding: 0 8px;
  color: #1f2937;
  background: #e8edf3;
  font-weight: 900;
  overflow: hidden;
  white-space: nowrap;
}

.entry-type-row > .flow-line-label {
  background: #dff4ec;
  border-bottom-color: #a7d9ca;
}

.unweighted-type-row > .flow-line-label {
  background: #ffedc2;
  border-bottom-color: #e7bc5f;
}

.weighted-type-row > .flow-line-label {
  background: #dcecff;
  border-bottom-color: #9fc2ed;
}

.entry-row,
.result-row {
  display: grid;
  grid-template-columns: 88px max-content;
  gap: 5px;
  align-items: stretch;
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.entry-row {
  background: #f8fffb;
}

.entry-name,
.result-name {
  display: flex;
  align-items: center;
  height: 60px;
  border-right: 1px solid var(--line-strong);
  padding: 4px;
  font-weight: 900;
  overflow: hidden;
  white-space: nowrap;
}

.result-name {
  background: #f8fafc;
  color: #334155;
}

.entry-fields,
.result-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: stretch;
  padding: 4px;
}

.entry-field {
  display: grid;
  grid-template-rows: minmax(36px, auto) minmax(24px, auto);
  width: max-content;
  min-width: 92px;
  min-height: 60px;
  border-left: 3px solid #9bd8cd;
  border-radius: 3px;
  background: var(--input);
  padding: 0;
  overflow: visible;
}

.entry-field span,
.metric span,
.result-group-title {
  color: #5f6f82;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.15;
}

.entry-field span,
.metric span {
  display: flex;
  align-items: center;
  min-height: 0;
  min-height: 36px;
  border-bottom: 1px solid rgba(100, 116, 139, 0.22);
  padding: 1px 3px;
  background: rgba(226, 232, 240, 0.62);
  overflow-wrap: anywhere;
  white-space: normal;
}

.entry-field input {
  width: max-content;
  min-width: 84px;
  min-height: 24px;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 0 3px;
  background: transparent;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  text-align: left;
}

.readonly-name,
.readonly-value {
  display: flex;
  align-items: center;
  min-height: 24px;
  color: var(--ink);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.readonly-value {
  padding: 2px 3px;
  font-variant-numeric: tabular-nums;
  min-width: max-content;
  white-space: nowrap;
  overflow-wrap: normal;
}

.is-viewing .entry-group {
  border-left-color: #9fb5c8;
  background: #f7fafc;
}

.is-viewing .entry-field {
  background: #ffffff;
}

.result-group {
  display: grid;
  grid-template-rows: 36px 1fr;
  gap: 2px;
  border-left: 3px solid #cbd5e1;
  border-radius: 3px;
  padding: 3px 4px;
  background: #f8fafc;
}

.result-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.metric {
  display: grid;
  grid-template-rows: minmax(36px, auto) minmax(24px, auto);
  width: max-content;
  min-width: 60px;
  min-height: 60px;
  padding: 0;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.68);
  overflow: visible;
}

.metric.has-submetric {
  grid-template-rows: minmax(36px, auto) minmax(18px, auto) minmax(24px, auto);
  min-height: 78px;
}

.metric strong {
  display: flex;
  align-items: center;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  overflow-wrap: normal;
  white-space: nowrap;
  padding: 2px 3px;
  min-width: max-content;
}

.metric em {
  display: flex;
  align-items: center;
  min-height: 18px;
  border-bottom: 1px solid rgba(100, 116, 139, 0.18);
  padding: 1px 3px;
  color: #7c2d12;
  background: rgba(255, 247, 237, 0.8);
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.sum-group {
  border-left-color: #aeb8c5;
  background: #f4f7fa;
}

.entry-group {
  border-left-color: #54b995;
  background: var(--input);
}

.unweighted-group {
  border-left-color: #f0b94b;
  background: var(--unweighted-tint);
}

.weighted-group {
  border-left-color: #73a8e8;
  background: var(--weighted-tint);
}

.reward-group {
  border-left-color: #b99ce6;
  background: var(--reward-tint);
}

.final-group {
  border-left-color: #0f766e;
  background: #eefaf7;
}

.sum-metric strong {
  font-weight: 900;
}

.total-metric strong {
  color: var(--accent);
  font-weight: 900;
}

.dashboard-module {
  display: grid;
  gap: 8px;
  --module-accent: var(--accent);
  --module-soft: #f8fafc;
  border: 1px solid color-mix(in srgb, var(--module-accent) 26%, var(--line));
  border-left: 5px solid var(--module-accent);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

.home-business-module {
  --module-accent: var(--business-accent);
  --module-soft: var(--business-soft);
}

.home-sales-module {
  --module-accent: var(--performance-accent);
  --module-soft: var(--performance-soft);
}

.dashboard-module-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  background: linear-gradient(90deg, var(--module-soft), #f8fafc 68%);
}

.dashboard-module-head h4 {
  margin: 0;
  color: #1f2937;
  font-size: 13px;
  font-weight: 900;
}

.dashboard-module-head h4 small {
  margin-left: 8px;
  color: #64748b;
  font-size: 12px;
  font-weight: 850;
}

.dashboard-module-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.home-inline-head,
.home-sales-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.home-sales-head {
  align-items: flex-end;
  padding-bottom: 0;
}

.home-inline-head p,
.home-sales-head p {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin: 0;
  white-space: nowrap;
}

.home-inline-head p span,
.home-sales-head p span {
  color: #cbd5e1;
  font-weight: 900;
}

.home-business-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 8px 8px 0;
}

.home-business-summary div {
  display: grid;
  gap: 3px;
  min-width: 0;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 7px 9px;
  background: linear-gradient(180deg, #ffffff, var(--business-soft));
}

.home-business-summary span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 950;
  line-height: 1.2;
}

.home-business-summary strong {
  color: #0f766e;
  font-size: 18px;
  line-height: 1.15;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.14);
}

.summary-value-line {
  display: flex;
  gap: 8px;
  align-items: baseline;
  min-width: 0;
  margin: 0;
  white-space: nowrap;
}

.summary-card-subvalue {
  color: #64748b;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-business-summary .summary-tone-sales strong {
  color: #7c3aed;
}

.home-business-summary .summary-tone-total strong {
  color: #005eff;
}

.home-business-summary .summary-tone-enterprise strong {
  color: #2563eb;
}

.home-business-summary .summary-tone-government strong {
  color: #c2410c;
}

.home-business-summary .summary-tone-commission strong {
  color: #db2777;
}

.home-business-summary .summary-tone-labor strong {
  color: #16a34a;
}

.home-business-summary .summary-tone-progress strong {
  color: #ea580c;
}

.home-business-summary .summary-tone-achievement strong {
  color: #dc2626;
}

.home-overview-layout {
  display: grid;
  grid-template-columns: minmax(430px, 0.95fr) minmax(500px, 1.05fr);
  gap: 8px;
  align-items: start;
  padding: 8px;
}

.home-data-panel,
.home-chart-panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}

.home-data-panel,
.home-chart-panel {
  align-self: start;
  height: fit-content;
}

.home-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 36px;
  border-bottom: 1px solid var(--line);
  padding: 7px 9px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
}

.chart-series-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.chart-series-controls label {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  height: 24px;
  border: 1px solid #d8e1eb;
  border-radius: 999px;
  padding: 0 8px;
  background: #fff;
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  user-select: none;
}

.chart-series-controls label.active {
  border-color: #b7c6d7;
  background: #f4f8fb;
  color: #334155;
}

.chart-series-controls label:not(.active) {
  opacity: 0.58;
  border-style: dashed;
}

.chart-series-controls input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chart-series-controls i {
  width: 14px;
  height: 7px;
  border-radius: 999px;
}

.home-table-wrap {
  overflow-x: auto;
}

.home-receipts-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  table-layout: auto;
  font-variant-numeric: tabular-nums;
}

.home-person-month-table {
  table-layout: fixed;
}

.home-person-month-col {
  width: 22%;
}

.home-person-target-col,
.home-person-sales-col {
  width: 27%;
}

.home-person-achievement-col {
  width: 24%;
}

.home-receipts-table th,
.home-receipts-table td {
  border-bottom: 1px solid var(--line);
  padding: 4px 10px;
  text-align: left;
  white-space: nowrap;
}

.home-receipts-table th {
  height: 28px;
  background: #eef3f8;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
}

.home-receipts-table td {
  height: 28px;
  color: var(--ink);
  font-weight: 800;
}

.home-receipts-table td:first-child {
  color: #475569;
}

.home-receipts-table tr {
  cursor: pointer;
}

.home-receipts-table tbody tr:hover {
  background: #f6fafc;
}

.home-receipts-table tbody tr:last-child td {
  border-bottom: 0;
}

.home-sales-module {
  margin-top: 8px;
}

.home-sales-titlebar {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  min-width: 0;
}

.home-sales-titlebar h4 {
  display: flex;
  align-items: center;
  min-height: 34px;
  transform: none;
}

.home-sales-tabs {
  display: flex;
  gap: 2px;
  align-items: flex-end;
  min-width: 0;
  max-width: min(680px, 58vw);
  overflow-x: auto;
  min-height: 34px;
  border-radius: 12px 12px 0 0;
  padding: 4px 5px 0;
  background: #dbeafe;
  margin-bottom: -1px;
  scrollbar-width: thin;
}

.home-sales-tabs button {
  position: relative;
  flex: 0 0 auto;
  min-height: 30px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  padding: 0 14px;
  background: transparent;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.home-sales-tabs button:hover {
  background: rgba(255, 255, 255, 0.46);
  color: #1e293b;
}

.home-sales-tabs button.active {
  border-color: #ffffff;
  background: #ffffff;
  color: var(--performance-accent);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.16);
  transform: none;
}

.home-sales-tabs button.active::before,
.home-sales-tabs button.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 12px;
  height: 12px;
  pointer-events: none;
}

.home-sales-tabs button.active::before {
  left: -12px;
  border-bottom-right-radius: 12px;
  box-shadow: 6px 6px 0 #ffffff;
}

.home-sales-tabs button.active::after {
  right: -12px;
  border-bottom-left-radius: 12px;
  box-shadow: -6px 6px 0 #ffffff;
}

.home-sales-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 8px 8px 0;
}

.home-sales-summary div {
  display: grid;
  gap: 3px;
  min-width: 0;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 7px 9px;
  background: linear-gradient(180deg, #ffffff, var(--performance-soft));
}

.home-sales-summary span {
  color: var(--muted);
  font-weight: 900;
}

.home-sales-summary strong {
  color: var(--accent);
  font-size: 14px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.home-hit-text {
  color: #005eff !important;
  font-weight: 950 !important;
}

.home-warning-text {
  color: #dc2626 !important;
}

.home-receipts-table td.sales-achievement-hit {
  background: #e0f2fe;
  color: #005eff;
  font-weight: 950 !important;
}

.home-receipts-table td.sales-achievement-warning {
  background: #fee2e2;
  color: #dc2626;
  font-weight: 950;
}

.home-person-chart {
  min-height: 280px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-weight: 900;
}

.chart-legend span {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  height: 24px;
  border: 1px solid #d8e1eb;
  border-radius: 999px;
  padding: 0 8px;
  background: #fff;
}

.chart-legend i {
  width: 16px;
  height: 8px;
  border-radius: 2px;
}

.chart-legend i.line-legend {
  height: 0;
  border-top: 2px solid #e11d48;
  background: transparent;
}

.home-chart-scroll {
  position: relative;
  max-width: 100%;
  overflow: visible;
  padding: 10px 12px 4px;
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.88), rgba(255, 255, 255, 0.96)),
    radial-gradient(circle at 16% 12%, rgba(14, 116, 144, 0.08), transparent 28%);
}

.home-receipts-chart {
  display: block;
  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 300px;
}

.chart-grid line,
line.chart-grid {
  stroke: #dfe7ef;
  stroke-width: 1;
  stroke-dasharray: 3 5;
}

.chart-grid text,
.chart-axis-label,
.chart-axis-title,
.chart-month text {
  fill: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.chart-grid text {
  text-anchor: end;
}

.chart-axis {
  stroke: #a7b4c3;
  stroke-width: 1.4;
}

.chart-bar {
  rx: 4px;
  shape-rendering: geometricPrecision;
  filter: drop-shadow(0 2px 3px rgba(15, 23, 42, 0.12));
  transition: opacity 0.12s ease, filter 0.12s ease;
}

.chart-bar:hover {
  filter: brightness(0.96) drop-shadow(0 3px 5px rgba(15, 23, 42, 0.16));
  opacity: 0.92;
}

.chart-month {
  cursor: pointer;
}

.chart-hitbox {
  fill: transparent;
}

.chart-month:hover .chart-hitbox {
  fill: rgba(15, 118, 110, 0.045);
}

.chart-month text {
  text-anchor: middle;
}

.chart-trend-line {
  fill: none;
  stroke: #e11d48;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(225, 29, 72, 0.18));
  pointer-events: visibleStroke;
}

.chart-axis-title {
  text-anchor: end;
}

.chart-y-title {
  text-anchor: end;
}

.chart-tooltip {
  position: fixed;
  z-index: 20;
  display: grid;
  gap: 3px;
  min-width: 122px;
  max-width: 200px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  padding: 7px 8px;
  background: rgba(255, 255, 255, 0.98);
  color: #1f2933;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
  pointer-events: none;
  white-space: nowrap;
}

.chart-tooltip[hidden] {
  display: none;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(244, 246, 248, 0.96)),
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.12), transparent 32%),
    var(--page);
}

.login-shell {
  width: min(360px, calc(100vw - 32px));
}

.login-panel {
  display: grid;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: #fff;
}

.login-brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.login-brand h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-form label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-weight: 900;
}

.login-form input {
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 10px;
  background: #fbfdfe;
  color: var(--ink);
  font-weight: 800;
}

.login-form input:focus {
  outline: 3px solid rgba(15, 118, 110, 0.16);
  border-color: var(--accent);
}

.login-error {
  min-height: 18px;
  margin: 0;
  color: #b91c1c;
  font-weight: 800;
}

.login-button {
  width: 100%;
  height: 36px;
}

@media (max-width: 1120px) {
  .home-overview-layout {
    grid-template-columns: 1fr;
  }
}

.history-kpi-grid,
.history-overview {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.history-kpi-grid {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
}

.history-section + .history-section {
  margin-top: 12px;
}

.history-section h4 {
  margin: 0 0 8px;
  color: #1f2937;
  font-size: 13px;
  font-weight: 950;
}

.history-section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

.history-section-head h4 {
  margin: 0;
}

.history-kpi-grid div,
.history-overview div {
  display: grid;
  gap: 2px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 6px 8px;
  background: #f8fafc;
}

.history-kpi-grid span,
.history-overview span,
.history-time span,
.history-main-top span,
.history-detail-row span,
.history-amount span {
  color: var(--muted);
  font-weight: 800;
}

.history-kpi-grid strong,
.history-overview strong,
.history-time strong,
.history-main-top strong,
.history-detail-row strong,
.history-amount strong {
  color: var(--ink);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.history-kpi-grid div:first-child strong,
.history-overview div:nth-child(2) strong,
.history-amount strong {
  color: var(--accent);
}

.history-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}

.history-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.history-table th,
.history-table td {
  height: 34px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 4px 8px;
  text-align: left;
  white-space: nowrap;
}

.history-table th:last-child,
.history-table td:last-child {
  border-right: 0;
}

.history-table th {
  background: #eef3f8;
  color: #334155;
  font-weight: 900;
}

.history-table td {
  font-weight: 800;
}

.history-transposed-table {
  min-width: 680px;
}

.history-transposed-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 96px;
}

.history-transposed-table tbody th {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #f8fafc;
  color: #334155;
  font-weight: 950;
}

.history-table tbody tr {
  cursor: pointer;
}

.history-table tbody tr:hover td {
  background: #f6fafc;
}

.history-table tbody tr:last-child td {
  border-bottom: 0;
}

.history-person-stats-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.82fr) minmax(420px, 1.18fr);
  gap: 8px;
  align-items: stretch;
}

.history-person-month-table {
  min-width: 260px;
}

.history-person-chart {
  min-height: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 5px;
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.88), rgba(255, 255, 255, 0.96)),
    radial-gradient(circle at 16% 12%, rgba(14, 116, 144, 0.08), transparent 28%);
}

.history-person-chart svg {
  display: block;
  width: 100%;
  min-width: 0;
  height: auto;
}

.history-person-svg {
  min-height: 260px;
}

.history-person-bar {
  fill: #7c3aed;
}

.history-person-bar:hover {
  fill: #6d28d9;
}

.history-person-enterprise-bar {
  fill: #2563eb;
}

.history-person-enterprise-bar:hover {
  fill: #1d4ed8;
}

.history-person-government-bar {
  fill: #b45309;
}

.history-person-government-bar:hover {
  fill: #92400e;
}

.history-person-chart-legend {
  justify-content: flex-end;
  margin-bottom: 2px;
}

.history-person-bar-value {
  fill: #1f2937;
  font-size: 11px;
  font-weight: 900;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 3px;
  stroke-linejoin: round;
}

.history-person-segment-value {
  font-size: 9px;
  font-weight: 900;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: none;
}

.history-person-segment-value-in {
  fill: #ffffff;
  stroke: rgba(15, 23, 42, 0.22);
  stroke-width: 2px;
}

.history-person-enterprise-value {
  fill: #1d4ed8;
}

.history-person-government-value {
  fill: #92400e;
}

.history-timeline {
  display: grid;
  gap: 6px;
}

.history-timeline-item {
  display: grid;
  grid-template-columns: 120px minmax(360px, 1fr) 120px;
  gap: 8px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 6px;
  background: #fff;
}

.history-time {
  display: grid;
  align-content: center;
  gap: 4px;
  border-right: 1px solid var(--line);
  padding-right: 8px;
}

.history-main {
  display: grid;
  gap: 5px;
}

.history-main-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 28px;
  border-radius: 4px;
  padding: 4px 8px;
  background: #f4f7fa;
}

.history-detail-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 5px;
}

.history-detail-row div {
  display: grid;
  gap: 2px;
  border-left: 3px solid #cbd5e1;
  border-radius: 4px;
  padding: 4px 6px;
  background: #f8fafc;
}

.history-amount {
  display: grid;
  align-content: center;
  justify-items: end;
  gap: 4px;
  border-left: 1px solid var(--line);
  padding-left: 8px;
  text-align: right;
}

.empty-state {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 10px;
  color: var(--muted);
  background: #f8fafc;
}

.sales-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 8px;
  margin: 8px 0;
}

.sales-stat {
  display: grid;
  gap: 4px;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 8px 10px;
  background: #f8fafc;
}

.sales-stat span {
  color: var(--muted);
  font-weight: 900;
}

.sales-stat strong {
  color: var(--accent);
  font-size: 16px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.settings-panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--performance-accent);
  border-radius: 6px;
  padding: 12px;
  background: linear-gradient(90deg, var(--performance-soft), #ffffff 64%);
}

.settings-panel h4 {
  margin: 0;
  color: #1f2937;
  font-size: 13px;
  font-weight: 900;
}

.settings-panel p {
  margin: 3px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.visitor-password-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}

.visitor-password-form label {
  display: grid;
  gap: 5px;
  min-width: 220px;
  color: var(--muted);
  font-weight: 900;
}

.visitor-password-form input {
  height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 0 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.visitor-account-list {
  overflow-x: auto;
}

.visitor-account-table {
  min-width: 420px;
}

.visitor-account-table th,
.visitor-account-table td {
  height: 30px;
  text-align: left;
}

.mini-action {
  min-height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 0 8px;
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
}

.mini-action.danger {
  border-color: #fecaca;
  color: #dc2626;
  background: #fff7f7;
}

.person-name-editor {
  display: flex;
  gap: 4px;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.person-name-editor .table-name-input {
  flex: 1 1 auto;
  width: auto;
  min-width: 42px;
}

.row-delete-action {
  flex: 0 0 auto;
  width: 34px;
  height: 22px;
  padding: 0 5px;
  font-size: 10px;
  line-height: 20px;
  white-space: nowrap;
}

.government-orders-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.sales-expense-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.sales-expense-toolbar {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 6px;
}

.sales-expense-table {
  min-width: 1140px;
  table-layout: fixed;
}

.sales-expense-table th,
.sales-expense-table td {
  width: 82px;
  text-align: left;
}

.sales-expense-table th:first-child,
.sales-expense-table td:first-child {
  width: 72px;
}

.is-editing .sales-expense-table th:first-child,
.is-editing .sales-expense-table td:first-child {
  width: 126px;
}

.sales-expense-table th:last-child,
.sales-expense-table td:last-child {
  width: 96px;
  background: #f8fafc;
}

.sales-expense-total-cell {
  width: 96px;
  background: #f8fafc;
}

.sales-expense-table input {
  width: 34px;
  height: 22px;
  border: 1px solid transparent;
  border-bottom: 1.5px dashed #2563eb;
  border-radius: 3px;
  padding: 0 3px;
  background: transparent;
  color: #2563eb;
  font-weight: 850;
}

.sales-expense-table .sales-expense-name-input {
  width: 100%;
  min-width: 42px;
}

.sales-expense-cell-editor {
  display: inline-flex;
  gap: 2px;
  align-items: center;
}

.sales-expense-cell-editor span {
  color: #94a3b8;
  font-weight: 900;
}

.expense-person-name,
.sales-expense-row-total strong,
.sales-expense-total-row td:first-child {
  color: #334155;
  font-weight: 950;
}

.sales-expense-total-row td {
  background: #f8fafc;
}

.government-orders-table {
  min-width: 980px;
}

.government-orders-table th,
.government-orders-table td {
  text-align: left;
}

.government-orders-table input,
.government-orders-table select {
  width: 100%;
  min-width: 82px;
  height: 24px;
  border: 1px solid #fed7aa;
  border-radius: 4px;
  padding: 0 6px;
  background: #fff;
  color: #075985;
  font-weight: 850;
}

.government-orders-table .order-date {
  min-width: 118px;
}

.government-orders-table .order-number {
  min-width: 92px;
}

.government-orders-table .order-status {
  min-width: 84px;
}

.order-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 8px;
  font-weight: 950;
}

.order-status-pill.won {
  background: #dcfce7;
  color: #15803d;
}

.order-status-pill.lost {
  background: #fee2e2;
  color: #b91c1c;
}

.form-message {
  flex-basis: 100%;
  min-height: 18px;
  margin: 0;
  color: var(--accent);
  font-weight: 900;
}

.policy-panel {
  display: grid;
  gap: 10px;
  border: 1px solid color-mix(in srgb, var(--commission-accent) 22%, var(--line));
  border-left: 5px solid var(--commission-accent);
  border-radius: 6px;
  padding: 12px;
  background: linear-gradient(90deg, var(--commission-soft), #ffffff 60%);
}

.policy-section {
  border: 1px solid rgba(217, 119, 6, 0.16);
  border-radius: 5px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.72);
}

.policy-section h4 {
  margin: 0 0 6px;
  color: #7c2d12;
  font-size: 13px;
  font-weight: 950;
}

.policy-section ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
  color: #334155;
  font-weight: 800;
  line-height: 1.55;
}

.policy-section-editing {
  display: grid;
  gap: 8px;
}

.policy-toolbar {
  display: flex;
  justify-content: flex-start;
}

.policy-section-edit-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  min-height: 24px;
  color: #92400e;
  font-size: 12px;
  font-weight: 950;
}

.policy-edit-label {
  display: grid;
  gap: 4px;
}

.policy-edit-label span {
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
}

.policy-title-input,
.policy-items-input {
  width: 100%;
  border: 1px solid #bfdbfe;
  border-radius: 5px;
  padding: 7px 8px;
  background: #ffffff;
  color: #075985;
  font: inherit;
  font-size: 13px;
  font-weight: 850;
}

.policy-items-input {
  min-height: 96px;
  resize: vertical;
  line-height: 1.55;
}

.sales-stats-section {
  --sales-section-accent: var(--performance-accent);
  --sales-section-soft: var(--performance-soft);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--sales-section-accent) 24%, var(--line));
  border-left: 5px solid var(--sales-section-accent);
  border-radius: 5px;
  background: #fff;
}

.sales-entry-section {
  --sales-section-accent: #7c3aed;
  --sales-section-soft: #f5f3ff;
}

.sales-summary-section {
  --sales-section-accent: #0f766e;
  --sales-section-soft: #ecfdf5;
}

.sales-stats-section + .sales-stats-section {
  margin-top: 8px;
}

.sales-stats-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 36px;
  border-bottom: 1px solid var(--line);
  padding: 7px 9px;
  background: linear-gradient(90deg, var(--sales-section-soft), #f8fafc 70%);
}

.sales-stats-head h4 {
  margin: 0;
  color: #1f2937;
  font-size: 13px;
  font-weight: 900;
}

.sales-stats-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
  overflow-wrap: anywhere;
}

.sales-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sales-table-wrap {
  overflow-x: auto;
}

.sales-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  table-layout: auto;
  font-variant-numeric: tabular-nums;
}

.sales-table th,
.sales-table td {
  height: 34px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 4px 8px;
  text-align: left;
  white-space: nowrap;
  font-weight: 800;
}

.sales-table th:last-child,
.sales-table td:last-child {
  border-right: 0;
}

.sales-table th {
  background: #eef3f8;
  color: #334155;
  font-weight: 900;
}

.sales-table tbody tr:hover td {
  background: #f6fafc;
}

.sales-table tbody tr:last-child td {
  border-bottom: 0;
}

.sales-entry-table {
  min-width: 1120px;
}

.sales-entry-table th,
.sales-entry-table td {
  height: 24px;
  padding: 2px 8px;
  line-height: 1.15;
}

.sales-entry-table th:first-child,
.sales-entry-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #f8fafc;
}

.sales-entry-table th:nth-child(2),
.sales-entry-table td:nth-child(2) {
  position: sticky;
  left: 86px;
  z-index: 2;
  background: #f8fafc;
}

.sales-entry-table th {
  z-index: 3;
}

.sales-entry-table th:first-child {
  width: 86px;
}

.sales-entry-table th:nth-child(2) {
  width: 82px;
}

.sales-entry-table tr.sales-person-band-1 td {
  background: #eef6ff;
}

.sales-entry-table tr.sales-person-band-2 td {
  background: #edf8ef;
}

.sales-entry-table tr.sales-person-band-3 td {
  background: #fff2da;
}

.sales-entry-table tr.sales-person-band-4 td {
  background: #f4edff;
}

.sales-entry-table th.sales-completed-month {
  background: #dce5ee;
}

.sales-entry-table tr.sales-person-band-1 td.sales-completed-month {
  background: #dcecff;
}

.sales-entry-table tr.sales-person-band-2 td.sales-completed-month {
  background: #d9f0dd;
}

.sales-entry-table tr.sales-person-band-3 td.sales-completed-month {
  background: #ffe4b8;
}

.sales-entry-table tr.sales-person-band-4 td.sales-completed-month {
  background: #e8dcff;
}

.sales-entry-table tr.sales-government-row td.sales-completed-month {
  background: #e7f3ef;
}

.sales-person-name {
  color: #334155;
  font-weight: 900;
  vertical-align: middle;
}

.sales-name-input,
.sales-number-input {
  height: 18px;
  border: 1px solid transparent;
  border-bottom: 1.5px dashed #2563eb;
  border-radius: 3px;
  padding: 0 3px;
  background: transparent;
  color: #2563eb;
  font-weight: 900;
  text-align: left;
}

.sales-name-input {
  width: 74px;
}

.sales-number-input {
  width: 70px;
  min-width: 70px;
}

.sales-name-input:focus,
.sales-number-input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.2);
  border-color: #2563eb;
}

.sales-government-row td {
  background: #f7fbfa;
}

.sales-entry-table tr td.sales-auto-cell {
  color: #334155;
  font-weight: 900;
}

.sales-entry-table tr td.sales-muted-cell {
  color: #94a3b8;
  font-weight: 900;
  text-align: center;
}

.sales-entry-table td.sales-achievement-hit {
  color: #005eff;
  font-weight: 950 !important;
}

.sales-entry-table td.sales-achievement-warning {
  background: #fee2e2 !important;
  color: #dc2626;
  font-weight: 950;
}

.data-table-wrap {
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.table-hint {
  margin: 0 0 6px;
  padding: 5px 7px;
  border-left: 3px solid #9bd8cd;
  background: #f7fbfa;
  color: #475467;
  font-size: 12px;
  line-height: 1.45;
}

.split-module {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.split-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  align-items: start;
  margin-top: 8px;
}

.calculation-module {
  width: 100%;
}

.split-layout + .split-layout {
  margin-top: 10px;
}

.split-module-title {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-bottom: 4px;
  border-radius: 4px;
  padding: 0 7px;
  color: #344054;
  background: #f1f5f9;
  font-size: 13px;
  font-weight: 900;
}

.manual-module .split-module-title {
  color: #075e54;
  background: var(--sales-tint);
}

.calculation-module .split-module-title {
  color: #344054;
  background: #eef2f7;
}

.data-table {
  width: max-content;
  min-width: 0;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.enterprise-table {
  min-width: 804px;
}

.enterprise-table .col-name {
  width: 84px;
}

.enterprise-table .col-sales {
  width: 60px;
}

.enterprise-table .col-total {
  width: 60px;
}

.enterprise-table .col-unweighted {
  width: 60px;
}

.enterprise-table .col-weighted {
  width: 60px;
}

.enterprise-table .col-reward {
  width: 60px;
}

.enterprise-table .col-final {
  width: 60px;
}

.data-table th,
.data-table td {
  width: 104px;
  min-width: 104px;
  max-width: 104px;
  height: 28px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line-strong);
  padding: 3px 5px;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.25;
}

.data-table th:last-child,
.data-table td:last-child {
  border-right: 0;
}

.data-table th:first-child,
.data-table td:first-child {
  width: 88px;
  min-width: 88px;
  max-width: 88px;
}

.data-table.enterprise-table th,
.data-table.enterprise-table td {
  width: 60px;
  min-width: 60px;
  max-width: 60px;
}

.data-table.enterprise-table th:first-child,
.data-table.enterprise-table td:first-child {
  width: 84px;
  min-width: 84px;
  max-width: 84px;
}

.data-table th {
  background: #eef2f6;
  color: #3d4b5c;
  font-size: 12px;
  font-weight: 800;
  overflow: visible;
}

.data-table tbody tr:nth-child(even) td {
  background: #fafbfc;
}

.data-table tbody tr:hover td {
  background: #eef7f6;
}

.data-table tbody tr:nth-child(even) .entry-cell,
.data-table tbody tr:hover .entry-cell,
.entry-cell {
  background: var(--input);
}

.data-table .group-header {
  text-align: left;
  color: #344054;
}

.data-table th.sales-header {
  background: var(--sales-tint);
}

.data-table th.unweighted-header {
  background: var(--unweighted-tint);
}

.data-table th.weighted-header {
  background: var(--weighted-tint);
}

.data-table th.reward-header {
  background: var(--reward-tint);
}

.data-table th.total-header {
  background: #eef2f7;
}

.data-table td:first-child,
.data-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
}

.data-table th:first-child {
  background: #f8fafc;
  z-index: 2;
}

.data-table th.sales-header:first-child {
  background: var(--sales-tint);
}

.data-table th.unweighted-header:first-child {
  background: var(--unweighted-tint);
}

.data-table th.weighted-header:first-child {
  background: var(--weighted-tint);
}

.data-table th.reward-header:first-child {
  background: var(--reward-tint);
}

.data-table th.total-header:first-child {
  background: #eef2f7;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table input {
  width: 100%;
  min-width: 58px;
  height: 20px;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 0 5px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-align: left;
}

.entry-cell input {
  border-bottom-color: rgba(15, 118, 110, 0.35);
}

.data-table tbody tr:nth-child(even) .sum-cell,
.data-table tbody tr:hover .sum-cell,
.sum-cell {
  background: #f8fafc;
  font-weight: 900;
}

.data-table tbody tr:nth-child(even) .unweighted-cell,
.data-table tbody tr:hover .unweighted-cell,
.unweighted-cell {
  background: var(--unweighted-tint);
}

.data-table tbody tr:nth-child(even) .weighted-cell,
.data-table tbody tr:hover .weighted-cell,
.weighted-cell {
  background: var(--weighted-tint);
}

.data-table tbody tr:nth-child(even) .reward-cell,
.data-table tbody tr:hover .reward-cell,
.reward-cell {
  background: var(--reward-tint);
}

.total-cell {
  color: var(--accent);
  font-weight: 900;
}

.module-total {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  align-items: center;
  margin-top: 6px;
  padding: 5px 8px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.module-total strong {
  color: var(--accent);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    margin-bottom: 8px;
  }

  .module-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: start;
  }

  .module-group {
    min-width: 0;
  }

  .module-parent,
  .module-item {
    min-width: 0;
  }

  .module-subitem {
    margin-left: 0;
  }

  .history-kpi-grid,
  .history-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-timeline-item {
    grid-template-columns: 110px minmax(320px, 1fr);
  }

  .history-amount {
    grid-column: 2;
    justify-items: start;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 6px 0 0;
    text-align: left;
  }
}

@media (max-width: 960px) {
  .home-business-summary,
  .home-sales-summary,
  .sales-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-inline-head,
  .home-sales-head,
  .home-panel-head,
  .sales-stats-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .home-inline-head p,
  .home-sales-head p {
    white-space: normal;
  }

  .home-sales-titlebar {
    width: 100%;
    flex-wrap: wrap;
  }

  .home-sales-tabs {
    max-width: 100%;
  }

  .chart-series-controls,
  .chart-legend {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .workspace,
  .sidebar {
    padding: 8px;
  }

  body {
    font-size: 11px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    max-height: 42vh;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.98);
  }

  .brand {
    padding-bottom: 8px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .brand h1 {
    font-size: 12px;
  }

  .module-list {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .module-group {
    flex: 0 0 auto;
    min-width: 132px;
  }

  .module-parent,
  .module-item {
    flex: 0 0 auto;
    min-height: 28px;
    white-space: nowrap;
  }

  .module-parent {
    background: #f8fafc;
    border-radius: 6px;
  }

  .module-subitem {
    border-left: 0;
    border-radius: 6px;
  }

  .module-group.open > .module-sublist {
    display: grid;
  }

  .topbar,
  .module-head,
  .submodule-head {
    align-items: start;
    flex-direction: column;
  }

  .toolbar,
  .text-button,
  .add-row-button,
  .secondary-button {
    width: auto;
  }

  .toolbar {
    width: 100%;
    flex-wrap: wrap;
  }

  .toolbar .secondary-button,
  .toolbar .text-button {
    flex: 1 1 96px;
  }

  .icon-button {
    flex: 0 0 34px;
  }

  .period-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .period-panel p {
    margin: 0;
  }

  .module-list,
  .history-kpi-grid,
  .history-overview,
  .history-detail-row,
  .history-timeline-item,
  .enterprise-crm-grid,
  .split-layout {
    grid-template-columns: 1fr;
  }

  .history-time,
  .history-amount {
    border: 0;
    border-bottom: 1px solid var(--line);
    padding: 0 0 6px;
  }

  .data-workspace {
    border-radius: 4px;
  }

  .module-card {
    padding: 6px;
  }

  .record-section,
  .module-column,
  .dashboard-module,
  .sales-stats-section {
    border-left-width: 4px;
  }

  .home-business-summary,
  .home-sales-summary,
  .sales-stats-grid {
    grid-template-columns: 1fr;
  }

  .home-business-summary div,
  .home-sales-summary div,
  .sales-stat {
    min-height: 46px;
    padding: 6px 8px;
  }

  .home-overview-layout {
    padding: 6px;
  }

  .home-receipts-table {
    min-width: 480px;
  }

  .home-receipts-chart {
    min-width: 620px;
    min-height: 240px;
  }

  .home-chart-scroll {
    overflow-x: auto;
  }

  .data-table-wrap,
  .entry-board,
  .result-board,
  .enterprise-flow-board,
  .person-list,
  .sales-table-wrap,
  .home-table-wrap {
    -webkit-overflow-scrolling: touch;
  }

  .person-list {
    border-radius: 4px;
    overscroll-behavior-x: contain;
  }

  .compact-table {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
  }

  .compact-table th,
  .compact-table td {
    min-width: 96px;
    height: 34px;
    padding: 4px 8px;
    overflow: visible;
    white-space: nowrap;
    font-size: 13px;
  }

  .compact-table th.ct-name,
  .compact-table td.ct-name {
    position: sticky;
    left: 0;
    z-index: 3;
    width: 112px;
    min-width: 112px;
    max-width: none;
  }

  .is-editing .compact-table th.ct-name,
  .is-editing .compact-table td.ct-name,
  .is-editing .enterprise-commission-table th.ct-name,
  .is-editing .enterprise-commission-table td.ct-name {
    width: 136px;
    min-width: 136px;
  }

  .compact-table th.ct-name {
    background: #eef3f8;
  }

  .compact-table td.ct-name {
    background: #f8fafc;
  }

  .compact-table .ct-group-row th {
    height: 32px;
  }

  .compact-table .ct-field-row th {
    height: 44px;
  }

  .compact-table td.ct-entry input,
  .compact-table td.ct-reward input,
  .table-input {
    width: 92px;
    min-width: 92px;
    height: 26px;
    font-size: 13px;
  }

  .compact-table td.ct-name input,
  .table-name-input {
    width: 82px;
    min-width: 82px;
    height: 26px;
    font-size: 13px;
  }

  .enterprise-commission-table th,
  .enterprise-commission-table td {
    min-width: 88px;
  }

  .enterprise-commission-table th.ct-name,
  .enterprise-commission-table td.ct-name {
    width: 112px;
    min-width: 112px;
  }

  .data-table th,
  .data-table td {
    height: 30px;
  }

  .data-table input,
  .name-input,
  .sales-table input {
    min-height: 24px;
    font-size: 12px;
  }

  .sales-table {
    min-width: 860px;
  }

  .history-selector {
    width: 100%;
  }

  .history-selector select {
    flex: 1;
    min-width: 0;
  }
}

@media (max-width: 420px) {
  .workspace,
  .sidebar {
    padding: 6px;
  }

  .home-inline-head,
  .home-sales-head,
  .dashboard-module-head,
  .record-section-head,
  .sales-stats-head {
    padding-left: 7px;
    padding-right: 7px;
  }

  .home-business-summary,
  .home-sales-summary {
    padding: 6px 6px 0;
  }

  .period-field {
    align-items: stretch;
    flex-direction: column;
    gap: 4px;
  }
}
