:root {
  --bg: #f3f4f7;
  --panel: #ffffff;
  --ink: #132033;
  --muted: #64748b;
  --line: #d7dbea;
  --soft: #f1f5f9;
  --accent: #0f766e;
  --accent-weak: #dcf7f2;
  --red: #b42318;
  --shadow: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  min-width: 1320px;
  letter-spacing: 0;
}

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

button { cursor: pointer; }

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 330px;
}

.brand > span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #062e2a;
  background: #7ddbd0;
  border-radius: 8px;
  font-weight: 900;
}

.brand strong,
.brand small { display: block; }

.brand small {
  margin-top: 3px;
  color: var(--muted);
}

nav {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: var(--soft);
  border-radius: 8px;
}

.nav,
.plain,
.primary,
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 30px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-weight: 850;
}

.nav {
  padding: 0 14px;
  color: #475569;
  background: transparent;
}

.nav.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.plain {
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.primary {
  padding: 0 12px;
  color: #fff;
  background: var(--accent);
}

.icon {
  width: 36px;
  padding: 0;
  background: #fff;
  border-color: var(--line);
}

.plain svg,
.primary svg,
.icon svg {
  width: 17px;
  height: 17px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  justify-content: flex-end;
  border-left: 1px solid var(--line);
}

.user-chip span {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 900;
}

main {
  max-width: none;
  margin: 0 auto;
  padding: 8px 8px 22px;
}

.view { display: none; }
.view.active { display: block; }

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(246, 248, 251, 0.96);
}

.auth-screen.hidden-field { display: none; }

.auth-card {
  display: grid;
  gap: 14px;
  width: min(430px, 100%);
  margin: 0;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.18);
}

.auth-card p,
.auth-card h1,
.auth-card span { margin: 0; }

.auth-card p,
.auth-card span {
  color: var(--muted);
}

.auth-card h1 {
  margin: 6px 0;
  font-size: 26px;
  line-height: 1.2;
}

.auth-error,
.form-error {
  min-height: 20px;
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
}

.page-title,
.detail-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.detail-head {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
}

.page-title p,
.page-title h1,
.page-title span,
.detail-head p,
.detail-head h1 {
  margin: 0;
}

.page-title p,
.page-title span,
.detail-head p {
  color: var(--muted);
}

.page-title h1,
.detail-head h1 {
  margin-top: 2px;
  font-size: 22px;
  line-height: 1.16;
}

.head-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.boss-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 8px;
  min-width: 430px;
}

.boss-stats.one-stat {
  grid-template-columns: minmax(110px, 1fr);
  min-width: 138px;
}

.boss-stats div {
  display: grid;
  gap: 4px;
  min-height: 46px;
  padding: 7px 9px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.boss-stats strong {
  font-size: 18px;
  line-height: 1.1;
}

.report-grid {
  display: grid;
  gap: 10px;
}

.report-card {
  align-content: start;
}

.report-card h2 {
  margin: 2px 4px 6px;
  font-size: 16px;
}

.report-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 6px;
}

.report-metric {
  display: grid;
  gap: 5px;
  min-height: 54px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.report-metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.report-metric strong {
  font-size: 22px;
  line-height: 1.05;
}

.report-table th,
.report-table td {
  white-space: nowrap;
}

#reportsView .classic-table tbody tr[data-row-deal],
#reportsView .classic-table tbody tr[data-row-execution] {
  cursor: pointer;
}

#reportsView .classic-table tbody tr[data-row-deal]:hover,
#reportsView .classic-table tbody tr[data-row-execution]:hover {
  background: #eef8f6;
}

.table-panel,
.detail-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: var(--shadow);
}

.table-panel {
  display: grid;
  gap: 4px;
  padding: 6px;
}

.table-toolbar,
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.table-toolbar {
  flex-wrap: wrap;
}

.bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 4px 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
}

.table-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(460px, 100%);
  min-height: 30px;
  padding: 0 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 2px;
}

.table-search svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.table-search input {
  width: 100%;
  min-width: 0;
  min-height: 28px;
  padding: 0;
  background: transparent;
  border: 0;
  outline: none;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 22px;
  min-width: 22px;
  height: 22px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
}

.icon-button svg {
  width: 14px;
  height: 14px;
}

.table-filters {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 6px;
  min-width: 280px;
}

.table-filter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.table-filter select {
  width: 116px;
  min-height: 28px;
  padding: 0 24px 0 8px;
}

.page-size {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.page-size select,
label input,
label select,
label textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
}

.page-size select {
  min-height: 28px;
  padding: 0 28px 0 10px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
}

table {
  width: 100%;
  min-width: 1360px;
  border-collapse: collapse;
  table-layout: auto;
}

th,
td {
  padding: 5px 8px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  line-height: 1.25;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 6px 8px;
  color: #001653;
  background: #f4f5fa;
  font-size: 12px;
  font-weight: 900;
  text-align: left;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid #cbd2e6;
  white-space: nowrap;
}

tr:last-child td { border-bottom: 0; }
th:last-child,
td:last-child {
  position: sticky;
  right: 0;
  z-index: 1;
  border-right: 0;
  background: inherit;
  box-shadow: -1px 0 0 var(--line);
}

th:last-child {
  z-index: 3;
  background: #f4f5fa;
}
tbody tr:hover { background: #eef6ff; }
tbody tr:nth-child(even) { background: #fbfbfd; }
tbody tr:nth-child(even):hover { background: #eef6ff; }

td {
  color: #001653;
  font-size: 12px;
  white-space: nowrap;
}

.id-cell {
  min-width: 58px;
  color: #001653;
  font-family: Consolas, "Liberation Mono", monospace;
  font-weight: 900;
  text-align: center;
}

.copy-id {
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  font: inherit;
  font-weight: inherit;
  cursor: copy;
}

.copy-id:hover {
  text-decoration: underline;
}

.check-col {
  width: 34px;
  min-width: 34px;
  max-width: 34px;
  text-align: center;
}

.check-col input {
  width: 14px;
  height: 14px;
  min-height: 0;
  margin: 0;
}

.row-no-col {
  width: 48px;
  min-width: 48px;
  max-width: 48px;
  text-align: center;
  color: #001653;
}

td strong,
td small {
  display: block;
}

td small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
}

.strong-cell {
  color: var(--ink);
  font-weight: 900;
}

.summary-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-actions,
.pager-buttons {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.row-actions .plain,
.row-actions .primary,
.pager-buttons .plain {
  min-width: 34px;
  min-height: 26px;
  padding: 0 8px;
}

.pager-buttons .plain:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.table-pagination > span,
.pager-buttons strong {
  color: var(--muted);
  font-size: 13px;
}

.empty-state,
.empty-table {
  min-height: 96px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.empty-table {
  text-align: center !important;
  border: 0;
}

.deal-detail-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 14px;
}

.detail-panel {
  padding: 14px;
}

.main-panel {
  min-height: 620px;
}

.panel-title {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.panel-title strong {
  font-size: 17px;
}

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

.info-list,
.deal-idea-list,
.idea-card,
.case-grid {
  display: grid;
  gap: 10px;
}

.info-item,
.idea-card,
.case-card {
  padding: 11px 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.info-item span,
.idea-card span,
.case-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.info-item strong,
.idea-card strong,
.case-card strong {
  display: block;
  margin-top: 5px;
  line-height: 1.45;
}

.idea-card {
  background: #fff;
}

.idea-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.idea-card-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.7fr);
  gap: 12px;
  margin-top: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 0 6px;
  min-height: 18px;
  color: #075852;
  background: var(--accent-weak);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.badge.gray {
  color: #475569;
  background: #e2e8f0;
}

.badge.red {
  color: #9f1239;
  background: #ffe4e6;
}

.step-dialog {
  width: min(840px, calc(100vw - 48px));
  padding: 0;
  border: 0;
  border-radius: 10px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
}

.compact-dialog {
  width: min(620px, calc(100vw - 48px));
}

.step-dialog::backdrop {
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(2px);
}

.step-dialog form {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.dialog-head p,
.dialog-head h2,
.dialog-head span { margin: 0; }

.dialog-head p,
.dialog-head span {
  color: var(--muted);
}

.dialog-head h2 {
  margin-top: 5px;
  font-size: 24px;
}

label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 13px;
  font-weight: 900;
}

label input,
label select {
  min-height: 38px;
  padding: 0 10px;
}

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

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

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

.customer-picker {
  position: relative;
  display: grid;
  gap: 7px;
}

.customer-display {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0;
}

.customer-display > strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.customer-display > span {
  display: inline-flex;
  gap: 6px;
}

.customer-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 95;
  max-height: 260px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.16);
}

.customer-results.static-results {
  position: static;
  min-height: 120px;
  box-shadow: none;
}

.customer-result {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-weight: 850;
}

.customer-result:last-child {
  border-bottom: 0;
}

.customer-result:hover,
.customer-result.active {
  background: #e8f5f3;
}

.customer-result span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

.danger-action {
  color: var(--red);
}

.hidden-field {
  display: none !important;
}

.screenshot-preview {
  display: grid;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--muted);
  background: #f8fafc;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.shot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.shot-item {
  display: grid;
  gap: 7px;
  margin: 0;
}

.shot-item img {
  width: 100%;
  max-height: 230px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: zoom-in;
}

.shot-item figcaption {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

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

.table-link {
  color: var(--primary);
  font-weight: 900;
  text-decoration: none;
}

.table-link:hover {
  text-decoration: underline;
}

.image-dialog {
  width: min(1180px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  padding: 0;
}

.image-dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.image-dialog-head p,
.image-dialog-head h2,
.image-dialog-head span {
  margin: 0;
}

.image-dialog-head p,
.image-dialog-head span {
  color: var(--muted);
}

.image-dialog-body {
  max-height: calc(100vh - 150px);
  padding: 12px;
  overflow: auto;
  background: #f8fafc;
}

.image-dialog-body img {
  display: block;
  max-width: none;
  min-width: 100%;
  margin: 0 auto;
  background: #fff;
}

.selector-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.check-list {
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow: auto;
}

.check-list.large-list {
  max-height: 500px;
}

.category-checks {
  display: grid;
  gap: 12px;
}

.category-checks.compact-checks {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

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

.category-group > strong {
  color: #0f172a;
  font-size: 13px;
}

.category-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.category-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 9px;
  color: #334155;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 850;
}

.category-check input {
  width: auto;
  min-height: 0;
}

.category-check.muted-check {
  color: var(--muted);
  background: #f8fafc;
}

.category-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.check-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.check-item input {
  margin-top: 3px;
}

.check-item strong,
.check-item span {
  display: block;
}

.check-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.switch-line {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
}

.switch-line input {
  width: auto;
  min-height: 0;
}

.report-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin-bottom: 10px;
}

.report-controls label {
  display: grid;
  gap: 4px;
  min-width: 150px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.report-text {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  font-size: 13px;
  line-height: 1.6;
}
