:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-soft: #f9fbff;
  --line: #dce4f0;
  --line-strong: #c7d2e3;
  --text: #111b31;
  --muted: #66748d;
  --blue: #3648f5;
  --green: #169b57;
  --red: #e53d4a;
  --amber: #d88710;
  --cyan: #0989a8;
  --shadow: 0 12px 34px rgba(20, 32, 59, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

[hidden] {
  display: none !important;
}

.client-cockpit-shell {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  min-height: 100vh;
}

.client-cockpit-page {
  display: grid;
  align-content: start;
  gap: 18px;
  width: min(100%, 1840px);
  margin: 0 auto;
  padding: 20px 24px 28px;
}

.client-cockpit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.client-title-group {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.client-home-link {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: #efe8ff;
  color: #4f1bb3;
  font-size: 23px;
  font-weight: 900;
  text-decoration: none;
}

.client-cockpit-header h1 {
  margin: 0;
  color: #061027;
  font-size: 30px;
  line-height: 1.1;
}

.client-cockpit-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
}

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

.client-table-panel {
  overflow: auto;
}

.client-table {
  min-width: 1180px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.client-table thead th {
  padding: 12px 14px;
  border: 0;
  background: #f0f0f3;
  color: #222b3f;
  font-size: 12px;
  font-weight: 900;
}

.client-table thead th:first-child {
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}

.client-table thead th:last-child {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}

.client-table td {
  padding: 17px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: #13203a;
  font-size: 13px;
  vertical-align: middle;
}

.client-name {
  color: #4f1bb3;
  font-weight: 750;
}

.client-status {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.client-status.active {
  background: #d9f6e5;
  color: #14804a;
}

.client-status.inactive {
  background: #eef1f6;
  color: #64748b;
}

.decision-state {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
}

.decision-state.tone-empty {
  background: #eef2f7;
  color: #64748b;
}

.decision-state.tone-success {
  background: #dff8ea;
  color: #10733f;
}

.decision-state.tone-warning {
  background: #fff2d8;
  color: #9a5b05;
}

.decision-state.tone-danger {
  background: #ffe5e8;
  color: #b4232d;
}

.client-decision-progress {
  display: grid;
  grid-template-columns: 42px minmax(72px, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 120px;
}

.client-decision-progress span {
  color: #25314a;
  font-size: 12px;
  font-weight: 900;
}

.client-decision-progress b {
  display: block;
  overflow: hidden;
  height: 7px;
  border-radius: 999px;
  background: #edf1f7;
}

.client-decision-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4f1bb3, #169b57);
}

.client-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 7px 10px;
  border-color: #d7deeb;
  color: #66748d;
  background: #f8faff;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.client-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.client-json-action {
  color: #ffffff;
  border-color: #5614a9;
  background: #5614a9;
}

.client-json-modal .modal-body {
  padding: 0;
}

.client-json-pre {
  min-height: 520px;
  max-height: min(70vh, 720px);
  margin: 0;
  border: 0;
  border-radius: 0;
  white-space: pre;
}

.client-detail-page {
  display: grid;
  align-content: start;
  gap: 22px;
  padding: 28px 24px;
}

.client-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.detail-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #8a94a8;
  font-size: 14px;
}

.detail-breadcrumb a {
  color: #8a94a8;
  text-decoration: none;
}

.detail-breadcrumb strong {
  color: #111b31;
  font-weight: 750;
}

.client-detail-title h1 {
  margin: 0 0 8px;
  font-size: 20px;
}

.client-detail-title p {
  margin: 0;
  color: #334560;
  font-size: 14px;
}

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

.summary-progress-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(20, 32, 59, 0.05);
}

.summary-progress-card span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.summary-progress-card strong {
  display: block;
  color: #111b31;
  font-size: 24px;
  line-height: 1;
}

.summary-progress-card b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
}

.summary-progress-card.tone-danger {
  border-left-color: #e53d4a;
}

.summary-progress-card.tone-danger b {
  background: #ffe5e8;
  color: #b4232d;
}

.summary-progress-card.tone-warning {
  border-left-color: #d88710;
}

.summary-progress-card.tone-warning b {
  background: #fff2d8;
  color: #9a5b05;
}

.summary-progress-card.tone-success {
  border-left-color: #169b57;
}

.summary-progress-card.tone-success b {
  background: #dff8ea;
  color: #10733f;
}

.summary-progress-card.tone-empty {
  border-left-color: #94a3b8;
}

.summary-progress-card.tone-empty b {
  background: #eef2f7;
  color: #64748b;
}

.client-tabs {
  display: inline-flex;
  width: fit-content;
  overflow: hidden;
  border-radius: 8px;
  background: #f0f0f3;
}

.client-tabs a,
.client-tabs button {
  min-width: 120px;
  padding: 14px 20px;
  border: 0;
  color: #667085;
  background: transparent;
  font-size: 14px;
  font-weight: 750;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.client-tabs a.active,
.client-tabs button.active {
  border-radius: 7px;
  background: #5614a9;
  color: #ffffff;
}

.client-tab-panel {
  min-width: 0;
}

.client-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.client-section-title h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.client-section-title p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.client-title-actions,
.row-actions,
.client-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.client-form-actions {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.client-form-actions .primary {
  min-width: 180px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 9px;
  box-shadow: 0 10px 22px rgba(54, 72, 245, 0.18);
}

.client-form-actions span {
  color: #4f1bb3;
  font-size: 13px;
  font-weight: 800;
}

.secondary-action {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid #ccd5e4;
  border-radius: 8px;
  background: #ffffff;
  color: #4f1bb3;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.secondary-action:hover {
  border-color: #9c83e8;
  background: #f7f3ff;
}

.client-form-panel {
  display: grid;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

.client-about-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 16px;
}

.client-about-form .form-field {
  margin: 0;
}

.form-section-label {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: #111b31;
  font-size: 13px;
  font-weight: 900;
}

.form-section-label:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.client-about-form .form-field input {
  min-height: 42px;
  background: #f8f8fa;
}

.client-about-form .form-field select {
  min-height: 42px;
  background: #f8f8fa;
}

.client-checkbox-group {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.client-check-card {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 11px;
  align-items: start;
  min-height: 78px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcff;
  cursor: pointer;
}

.client-check-card input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: #5614a9;
}

.client-check-card strong {
  display: block;
  color: #111b31;
  font-size: 13px;
}

.client-check-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.client-check-card:has(input:checked) {
  border-color: #8b5cf6;
  background: #f5f1ff;
  box-shadow: inset 3px 0 0 #5614a9;
}

.client-about-form .form-field input:focus {
  border-color: #a78bfa;
  box-shadow: 0 0 0 3px rgba(86, 20, 169, 0.1);
  outline: 0;
}

.client-about-form .form-field input[readonly] {
  color: #606b7f;
}

.muted-panel {
  background: #fbfcff;
}

.client-evaluation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  align-items: start;
}

.client-workspace {
  display: grid;
  gap: 22px;
  min-width: 0;
}

.evaluation-panel {
  position: sticky;
  top: 22px;
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.evaluation-eyebrow {
  margin: 0 0 5px;
  color: #4f1bb3;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.evaluation-panel h2 {
  margin: 0 0 5px;
  font-size: 18px;
}

.evaluation-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.evaluation-choice-group {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  border: 0;
}

.evaluation-choice-group legend {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.evaluation-choice-group label,
.evaluation-block-toggle {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  cursor: pointer;
}

.evaluation-choice-group input,
.evaluation-block-toggle input {
  margin-top: 2px;
  accent-color: #5614a9;
}

.evaluation-choice-group strong,
.evaluation-block-toggle strong {
  display: block;
  color: #111b31;
  font-size: 13px;
}

.evaluation-choice-group small,
.evaluation-block-toggle small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.evaluation-choice-group label:has(input:checked) {
  border-color: #8b5cf6;
  background: #f5f1ff;
  box-shadow: inset 3px 0 0 #5614a9;
}

.evaluation-block-toggle:has(input:checked) {
  border-color: #f59e0b;
  background: #fff7ed;
  box-shadow: inset 3px 0 0 #d88710;
}

.evaluation-panel textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
}

.evaluation-panel .primary {
  width: 100%;
  min-height: 42px;
}

.evaluation-feedback {
  min-height: 18px;
  color: #4f1bb3 !important;
  font-weight: 800;
}

.client-edit-modal .modal-body {
  gap: 18px;
}

.modal-edit-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcff;
}

.modal-evaluation-section {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

.modal-evaluation-section h4 {
  margin: 0;
  font-size: 16px;
}

.modal-check-field {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #111b31;
  font-size: 13px;
  font-weight: 750;
}

.modal-check-field input {
  accent-color: #5614a9;
}

.price-model-note {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f7f3ff;
}

.price-model-note span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.price-model-note strong {
  color: #4f1bb3;
  font-size: 14px;
}

.price-editor {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
}

.price-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.price-editor-header span {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.price-editor-header strong {
  color: #111b31;
  font-size: 14px;
}

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

.price-edit-table {
  min-width: 620px;
  border: 0;
  box-shadow: none;
}

.price-edit-table th {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: #f3f5f9;
  color: #344054;
  font-size: 11px;
  font-weight: 900;
}

.price-edit-table td {
  padding: 9px;
  border-bottom: 1px solid var(--line);
}

.price-edit-table tbody tr:last-child td {
  border-bottom: 0;
}

.price-edit-table input {
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcff;
  color: var(--text);
}

.mini-action {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid #ccd5e4;
  border-radius: 7px;
  background: #ffffff;
  color: #66748d;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.price-origin-debug {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0f172a;
  color: #dbe7ff;
}

.price-origin-debug summary {
  padding: 10px 12px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.price-origin-debug pre {
  max-height: 240px;
  margin: 0;
  padding: 0 12px 12px;
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #dbe7ff;
  font-size: 12px;
}

.modal-footer .evaluation-feedback {
  margin-right: auto;
}

.client-contract-toolbar {
  display: grid;
  gap: 28px;
  justify-items: start;
}

.toggle-line {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #13203a;
  font-size: 14px;
}

.toggle-fake {
  display: inline-block;
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: #dfe2e8;
  position: relative;
}

.toggle-fake::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
}

.contract-list {
  display: grid;
  gap: 18px;
}

.contract-card {
  overflow: hidden;
  border: 1px solid #cfd8ea;
  border-left: 4px solid #5614a9;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(20, 32, 59, 0.07);
}

.contract-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #fbfcff);
}

.contract-card-header > div > span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.contract-card-header h3 {
  margin: 0;
  color: #111b31;
  font-size: 16px;
  font-weight: 850;
}

.contract-meta-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.contract-meta-grid div {
  min-height: 74px;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.contract-meta-grid div:last-child {
  border-right: 0;
}

.contract-meta-grid dt {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.contract-meta-grid dd {
  margin: 0;
  color: #13203a;
  font-size: 13px;
}

.franchise-panel {
  position: relative;
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 18px 18px 18px 42px;
  border-top: 1px solid #e7edf6;
  background: #f7faff;
}

.franchise-panel::before {
  content: "";
  position: absolute;
  top: 22px;
  bottom: 22px;
  left: 22px;
  width: 2px;
  border-radius: 999px;
  background: #d7c8ff;
}

.franchise-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.franchise-panel-title h4 {
  margin: 0;
  color: #111b31;
  font-size: 14px;
  font-weight: 900;
}

.franchise-panel-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.franchise-panel table {
  min-width: 1120px;
  overflow: hidden;
  border: 1px solid #d5deec;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: none;
}

.franchise-panel th {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  background: #eef2f8;
  color: #344054;
  font-size: 11px;
  font-weight: 900;
}

.franchise-panel td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  color: #13203a;
  font-size: 13px;
  font-weight: 500;
}

.franchise-panel tbody tr:hover td {
  background: #fbfcff;
}

.franchise-panel tbody tr:last-child td {
  border-bottom: 0;
}

.franchise-panel td:first-child {
  font-weight: 650;
}

.client-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: #334560;
  font-size: 14px;
}

body.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(244, 247, 251, 0.95)),
    var(--bg);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.login-shell {
  width: min(420px, calc(100vw - 32px));
}

.login-panel {
  display: grid;
  gap: 22px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.login-brand {
  display: grid;
  gap: 6px;
}

.login-brand span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-brand h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
}

.login-brand p {
  margin: 0;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-form label {
  display: grid;
  gap: 6px;
  color: #2c3850;
  font-size: 13px;
  font-weight: 800;
}

.login-form input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

.login-form input:focus {
  border-color: #8ea0ff;
  box-shadow: 0 0 0 3px rgba(54, 72, 245, 0.1);
}

.login-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #ffcbd2;
  border-radius: 8px;
  background: #fff2f4;
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
}

.user-menu {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.user-menu span {
  color: #334560;
  font-size: 12px;
  font-weight: 900;
}

.user-menu button {
  min-height: 28px;
  padding: 5px 8px;
  border-color: #d3dcec;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.app-shell {
  display: grid;
  grid-template-columns: 58px 340px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 18px 8px;
  border-right: 1px solid var(--line);
  background: #ffffff;
}

.rail-logo {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #13233f;
  color: #fff;
  font-weight: 800;
}

.rail a {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.rail a.active {
  color: var(--blue);
  border-color: #bcc6ff;
  background: #eef1ff;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100vh;
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  background: #fbfcff;
}

.sidebar-title {
  display: grid;
  gap: 4px;
}

.sidebar-title span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.sidebar-title strong {
  font-size: 16px;
  letter-spacing: 0;
}

.client-box,
.comparison-box,
.decision-panel,
.main-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.client-box {
  display: grid;
  gap: 4px;
  padding: 12px;
  background: #ffffff;
}

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

.client-box span,
.client-box small {
  font-size: 12px;
}

.client-box strong {
  font-size: 14px;
}

.mini-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.mini-progress span,
.table-progress span,
.batch-progress-main b {
  display: block;
  overflow: hidden;
  height: 7px;
  border-radius: 999px;
  background: #edf1f7;
}

.mini-progress i,
.table-progress i,
.batch-progress-main i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3648f5, #169b57);
}

.mini-progress b {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.flow-tabs {
  display: grid;
  gap: 5px;
}

.flow-tabs a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 38px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  background: #ffffff;
}

.flow-tabs a span {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
  font-weight: 750;
}

.flow-tabs a i {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: #f1f4f9;
  color: #475569;
  font-style: normal;
  font-size: 12px;
}

.flow-tabs a.active {
  border-color: #d7ddff;
  background: #f6f7ff;
  color: #263654;
}

.search-box {
  display: block;
}

.search-box input {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: #ffffff;
  font-size: 13px;
}

.search-box input:focus {
  border-color: #8ea0ff;
  box-shadow: 0 0 0 3px rgba(54, 72, 245, 0.1);
}

.tree-panel {
  overflow: auto;
  max-height: calc(100vh - 246px);
  padding: 2px 2px 10px 0;
}

.tree-panel ul {
  margin: 0;
  padding-left: 14px;
  list-style: none;
}

.tree-panel > ul {
  padding-left: 0;
}

.tree-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  min-height: 34px;
  margin: 2px 0;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  text-align: left;
  color: #263654;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
}

.tree-panel details > summary {
  list-style: none;
}

.tree-panel details > summary::-webkit-details-marker {
  display: none;
}

.tree-panel details > summary::before {
  content: "›";
  flex: 0 0 auto;
  margin-right: 7px;
  color: #64748b;
  font-size: 14px;
  transition: transform 0.15s ease;
}

.tree-panel details[open] > summary::before {
  transform: rotate(90deg);
}

.tree-item span {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
}

.tree-item.status-reviewing,
.tree-item.status-pending,
.tree-item.status-approved,
.tree-item.status-migrated,
.tree-item.status-edit_required,
.tree-item.status-rejected,
.tree-item.status-failed,
.tree-item.status-blocked {
  background: transparent;
  color: #263654;
}

.tree-item:hover {
  background: #f5f7fb;
  color: #172033;
}

.tree-item.selected {
  border-color: #d7ddff;
  background: #f6f7ff;
  color: #172033;
  box-shadow: inset 3px 0 0 var(--blue);
}

.tree-item em {
  flex: 0 0 auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #ffe9ec;
  color: var(--red);
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.tree-item b {
  flex: 0 0 auto;
  min-width: 28px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #eef2f8;
  color: #64748b;
  font-size: 11px;
  font-weight: 750;
  text-align: center;
}

.workspace {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 16px;
}

.topbar h1 {
  margin: 0 0 4px;
  font-size: 23px;
}

.topbar p {
  margin: 0;
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-actions > span,
.top-actions > button {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
}

.top-actions .plain-action {
  display: grid;
  gap: 3px;
  color: var(--muted);
}

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

.batch-progress-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(94px, 1fr)) minmax(220px, 1.5fr);
  gap: 10px;
  margin-bottom: 16px;
}

.batch-progress-strip article,
.batch-progress-main {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(20, 32, 59, 0.05);
}

.batch-progress-strip article span,
.batch-progress-main span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.batch-progress-strip article strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  line-height: 1;
}

.batch-progress-main {
  display: grid;
  gap: 9px;
}

.batch-progress-main div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.batch-progress-main strong {
  font-size: 19px;
}

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

.main-panel {
  min-width: 0;
  padding: 14px;
}

.item-header,
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.item-header {
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

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

.item-header h2 {
  margin: 5px 0 0;
  font-size: 18px;
  line-height: 1.2;
}

.item-header p {
  margin: 0;
  color: var(--muted);
}

.item-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.item-meta > span:not(.status-chip) {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

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

.review-shell {
  display: grid;
  gap: 12px;
}

.mapping-explanation {
  display: grid;
  grid-template-columns: minmax(180px, 0.26fr) minmax(0, 1fr);
  gap: 16px;
  padding: 14px;
  border: 1px solid #d8e0f2;
  border-radius: 8px;
  background: #f8faff;
}

.mapping-explanation strong {
  display: block;
  margin-bottom: 6px;
  color: #172033;
  font-size: 15px;
  line-height: 1.2;
}

.mapping-explanation p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.mapping-content {
  display: grid;
  gap: 10px;
}

.mapping-suggestions {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #cad6ee;
  border-radius: 8px;
  background: #ffffff;
}

.mapping-suggestions h4 {
  margin: 0;
  color: #172033;
  font-size: 12px;
  font-weight: 900;
}

.mapping-suggestions > div:not(.suggestion-group),
.suggestion-group > div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
  width: 100%;
}

.suggestion-group {
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.suggestion-group + .suggestion-group {
  padding-top: 10px;
  border-top: 1px solid #e2e8f4;
}

.suggestion-group h5 {
  margin: 0;
  color: #263654;
  font-size: 12px;
  font-weight: 900;
}

.mapping-suggestions article {
  min-width: 0;
  padding: 8px;
  border-radius: 7px;
  background: #f8faff;
}

.mapping-suggestions > div:not(.suggestion-group) > article:only-child,
.suggestion-group > div > article:only-child {
  max-width: none;
}

.mapping-suggestions code {
  display: inline-block;
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.mapping-suggestions article p:first-child {
  color: #334560;
}

.mapping-suggestions p {
  color: #4c5b72;
}

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

.mapping-notes article {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #e2e8f4;
  border-radius: 8px;
  background: #ffffff;
}

.mapping-notes span {
  display: block;
  margin-bottom: 4px;
  color: #263654;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.mapping-notes p {
  color: #4c5b72;
}

.mapping-explanation[hidden] {
  display: none;
}

.json-review-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
}

.json-review-grid[hidden] {
  display: none;
}

.json-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.json-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  margin-bottom: 10px;
}

.json-card-header h3,
.decision-panel h3 {
  margin: 0;
  font-size: 15px;
}

.json-card-header span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.json-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.section-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.json-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid #d9e1ef;
  border-radius: 999px;
  background: #f7f9fc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.json-status.valid {
  border-color: #c7ecd6;
  background: #eaf8f0;
  color: var(--green);
}

.json-status.invalid {
  border-color: #ffd0d6;
  background: #fff0f2;
  color: var(--red);
}

.json-status.saved {
  border-color: #c9d3ff;
  background: #eef1ff;
  color: var(--blue);
}

.json-status.dirty {
  border-color: #ffe1a8;
  background: #fff8eb;
  color: #8a5a00;
}

.json-actions button {
  min-height: 30px;
  padding: 6px 9px;
  border-color: #cfd8ea;
  color: #334560;
  background: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.json-actions button:hover {
  border-color: #aebcf5;
  color: var(--blue);
  background: #f7f8ff;
}

.json-actions .primary-action {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.primary-action {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
  font-weight: 800;
}

.json-actions .primary-action:hover {
  color: #ffffff;
  background: #2838dc;
}

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

.billing-info-panel[hidden] {
  display: none;
}

.count-chip {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  background: #eef2f8;
  color: #475569;
  font-size: 12px;
}

.billing-info-list {
  overflow: auto;
}

.billing-drafts {
  display: grid;
  gap: 10px;
  padding-top: 6px;
}

.billing-draft-list {
  display: grid;
  gap: 8px;
}

.billing-draft-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.billing-draft-row > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.billing-draft-row strong {
  font-size: 14px;
}

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

.billing-draft-row dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.billing-draft-row dt {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.billing-draft-row dd {
  margin: 0;
  font-size: 12px;
  font-weight: 750;
  word-break: break-word;
}

.billing-info-table {
  table-layout: fixed;
  min-width: 920px;
  border-radius: 8px;
}

.billing-info-table th:nth-child(1),
.billing-info-table td:nth-child(1) {
  width: 115px;
}

.billing-info-table th:nth-child(2),
.billing-info-table td:nth-child(2) {
  width: 220px;
}

.billing-info-table th:nth-child(3),
.billing-info-table td:nth-child(3) {
  width: 220px;
}

.billing-info-table th:nth-child(4),
.billing-info-table td:nth-child(4),
.billing-info-table th:nth-child(5),
.billing-info-table td:nth-child(5) {
  width: 150px;
}

.billing-info-table th:nth-child(6),
.billing-info-table td:nth-child(6) {
  width: 150px;
}

.scope-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2f8;
  color: #475569;
  font-size: 11px;
  font-weight: 900;
}

.scope-deductible {
  background: #eaf8f0;
  color: var(--green);
}

.scope-contract {
  background: #edf7ff;
  color: #0369a1;
}

table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.mapping-table {
  table-layout: fixed;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  vertical-align: middle;
}

td {
  word-break: break-word;
}

th {
  background: #fbfcff;
  color: #263654;
  font-size: 11px;
  text-transform: uppercase;
}

.mapping-table th:nth-child(1),
.mapping-table td:nth-child(1) {
  width: 32%;
}

.mapping-table th:nth-child(4),
.mapping-table td:nth-child(4) {
  width: 120px;
}

.pill {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 8px;
  background: #eef1f6;
  color: var(--muted);
  font-size: 12px;
}

.pill.ok {
  background: #e7f8ef;
  color: var(--green);
}

.pill.warning {
  background: #fff3df;
  color: var(--amber);
}

.pill.status {
  background: #eef1ff;
  color: var(--blue);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 8px;
  background: #eef1f6;
  color: #4c5b72;
  font-size: 12px;
  font-weight: 800;
}

.status-approved,
.status-migrated {
  background: #e8f7ef;
  color: var(--green);
}

.status-reviewing,
.status-pending {
  background: #eef1ff;
  color: var(--blue);
}

.status-edit_required {
  background: #fff3df;
  color: var(--amber);
}

.status-rejected,
.status-failed,
.status-blocked {
  background: #ffecef;
  color: var(--red);
}

.ghost-button {
  font-weight: 800;
  color: var(--blue);
  background: #ffffff;
}

.decision-panel {
  position: sticky;
  top: 20px;
  display: grid;
  align-self: start;
  gap: 10px;
  padding: 14px;
}

.decision-panel label {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 34px;
  gap: 8px;
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfdff;
  font-size: 13px;
  font-weight: 700;
}

.decision-panel label input {
  margin-top: 3px;
}

.decision-panel label > span {
  align-self: center;
  font-weight: 800;
}

.decision-panel label:has(input:checked) {
  border-color: #9aa8ff;
  background: #f1f3ff;
}

.decision-panel small {
  grid-column: 2;
  color: var(--muted);
  font-weight: 400;
}

.decision-mark {
  display: grid;
  grid-column: 3;
  grid-row: 1 / span 2;
  place-items: center;
  align-self: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-style: normal;
  font-size: 14px;
}

.decision-mark.ok {
  background: #e6f8ee;
  color: var(--green);
}

.decision-mark.warn {
  background: #fff4dd;
  color: var(--amber);
}

.decision-mark.danger {
  background: #ffecef;
  color: var(--red);
}

.decision-mark.lock {
  background: #e8f7fb;
  color: var(--cyan);
}

.decision-mark.wait {
  background: #eaf1ff;
  color: var(--blue);
}

textarea {
  width: 100%;
  min-height: 96px;
  padding: 12px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.decision-panel .primary {
  min-height: 40px;
  padding: 10px;
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  font-weight: 800;
}

.decision-panel > button:not(.primary) {
  min-height: 38px;
  padding: 10px;
  color: var(--blue);
}

#decisionFeedback {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

pre,
.editor-card textarea {
  min-height: 610px;
  max-height: calc(100vh - 175px);
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101829;
  color: #d8e4f7;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
}

pre {
  min-height: 610px;
  max-height: calc(100vh - 175px);
  margin: 0;
}

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

.list article {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fcfdff;
  font-size: 13px;
}

.list article p {
  margin: 6px 0;
  color: var(--muted);
}

.compact-list article {
  padding: 10px;
}

.issue-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.issue-row button {
  min-height: 34px;
  padding: 6px 10px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.empty {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.empty-state {
  display: grid;
  gap: 10px;
  width: min(560px, calc(100vw - 40px));
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.setup-warning {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid #ffd28a;
  border-radius: 8px;
  background: #fff8eb;
  color: #7b4b00;
}

.setup-warning p {
  max-height: 160px;
  margin: 0;
  overflow: auto;
  color: #7b4b00;
  font-size: 13px;
}

.home-actions {
  display: grid;
  gap: 10px;
}

.home-actions a {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue);
  text-decoration: none;
  background: #fbfcff;
  font-weight: 700;
}

.cockpit-list-page {
  display: grid;
  gap: 18px;
  width: min(1320px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 28px 0;
}

.cockpit-list-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.cockpit-list-header > div {
  display: grid;
  gap: 4px;
}

.cockpit-list-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.cockpit-list-header h1,
.empty-list h2 {
  margin: 8px 0 4px;
  font-size: 26px;
}

.cockpit-list-header p,
.empty-list p {
  margin: 0;
  max-width: 720px;
  color: var(--muted);
}

.cockpit-list-header nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cockpit-list-header nav a,
.table-action {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue);
  background: #fbfcff;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.cockpit-list-header nav .primary-link,
.table-action {
  border-color: var(--blue);
  color: #ffffff;
  background: var(--blue);
}

.table-action.secondary {
  min-height: 32px;
  padding: 7px 10px;
  border-color: #cfd8ea;
  color: #334560;
  background: #ffffff;
  font-size: 12px;
}

.table-action.secondary:hover {
  border-color: #aebcf5;
  color: var(--blue);
  background: #f7f8ff;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.38);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(680px, calc(100vw - 40px));
  max-height: calc(100vh - 64px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.26);
}

.modal-panel-wide {
  width: min(880px, calc(100vw - 40px));
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

.modal-header {
  border-bottom: 1px solid var(--line);
}

.modal-header span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.modal-header h3 {
  margin: 3px 0 0;
  font-size: 17px;
}

.modal-header button {
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.modal-body {
  display: grid;
  gap: 14px;
  min-height: 220px;
  overflow: auto;
  padding: 16px;
}

.modal-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}

.modal-footer button {
  min-height: 36px;
  padding: 8px 12px;
  font-weight: 800;
}

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

.modal-context div,
.modal-placeholder {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.modal-context dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.modal-context dd {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  word-break: break-word;
}

.modal-placeholder {
  min-height: 120px;
}

.modal-placeholder strong {
  display: block;
  margin-bottom: 6px;
}

.modal-placeholder p {
  margin: 0;
  color: var(--muted);
}

.billing-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.choice-fieldset,
.form-field {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

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

.choice-fieldset legend,
.form-field span {
  grid-column: 1 / -1;
  padding: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.choice-fieldset label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #334560;
  font-size: 13px;
  font-weight: 750;
}

.choice-fieldset label:has(input:checked) {
  border-color: #9aa8ff;
  background: #f1f3ff;
  color: var(--blue);
}

.form-field select,
.form-field input {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
}

.billing-target-box,
.billing-date-box,
.billing-payment-box,
.billing-nfe-box {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid #d8e0f2;
  border-radius: 8px;
  background: #f8faff;
}

.billing-target-box {
  background: #ffffff;
}

.billing-payment-box > .choice-fieldset {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.billing-nfe-box .form-field {
  grid-column: 1 / -1;
}

.date-box-title {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.date-box-title strong {
  font-size: 14px;
}

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

.conditional-field[hidden] {
  display: none;
}

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

.billing-workspace {
  display: grid;
  gap: 16px;
}

.billing-card {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(20, 32, 59, 0.05);
}

.billing-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.billing-card-header h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.billing-card-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.billing-table-wrap {
  overflow: auto;
}

.billing-workspace .billing-info-table {
  min-width: 1080px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.billing-workspace .billing-source-table {
  min-width: 1220px;
}

.billing-workspace .billing-info-table th {
  padding: 12px 14px;
  background: #f3f5f9;
}

.billing-workspace .billing-info-table td {
  padding: 14px;
  background: #ffffff;
  font-size: 13px;
}

.billing-workspace .billing-info-table td:nth-child(4),
.billing-workspace .billing-info-table td:nth-child(5) {
  line-height: 1.25;
}

.billing-workspace .billing-info-table th:last-child,
.billing-workspace .billing-info-table td:last-child {
  width: 170px;
  text-align: right;
}

.billing-feedback {
  min-height: 0;
  padding: 0 18px;
  color: #4f1bb3;
  font-size: 13px;
  font-weight: 800;
}

.scope-client {
  background: #f4edff;
  color: #5614a9;
}

.billing-modal-panel {
  width: min(980px, calc(100vw - 40px));
}

.billing-modal-panel .modal-body {
  background: #fbfcff;
}

.billing-modal-panel .billing-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.billing-modal-panel .choice-fieldset,
.billing-modal-panel .form-field {
  background: #ffffff;
}

.billing-scope-fieldset {
  grid-column: 1 / -1;
}

.billing-rule-note {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.billing-line-evaluation {
  grid-column: 1 / -1;
}

.billing-modal-panel .billing-target-box,
.billing-modal-panel .billing-date-box,
.billing-modal-panel .billing-payment-box,
.billing-modal-panel .billing-nfe-box {
  border-radius: 10px;
  background: #ffffff;
}

.billing-nfe-box {
  grid-column: 1 / -1;
}

.billing-checkbox-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.billing-origin-debug {
  grid-column: 1 / -1;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faff;
}

.billing-origin-debug summary {
  cursor: pointer;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.billing-origin-debug pre {
  max-height: 220px;
  margin: 10px 0 0;
  overflow: auto;
  white-space: pre-wrap;
  color: #dce7ff;
}

.billing-modal-panel .choice-fieldset {
  align-content: start;
}

.billing-modal-panel .form-field input,
.billing-modal-panel .form-field select,
.billing-modal-panel .form-field textarea {
  min-height: 40px;
}

.billing-modal-panel .primary {
  min-width: 180px;
  border-color: #5614a9;
  background: #5614a9;
  color: #ffffff;
}

.cockpit-list-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.cockpit-list-summary article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.cockpit-list-summary strong {
  display: block;
  font-size: 26px;
  line-height: 1;
}

.cockpit-list-summary span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.cockpit-table-panel,
.empty-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.cockpit-table-panel {
  overflow: auto;
}

.cockpit-table-panel .section-title {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.cockpit-table-panel h2 {
  margin: 0;
  font-size: 17px;
}

.cockpit-table {
  min-width: 1160px;
  border: 0;
  border-radius: 0;
}

.cockpit-table th {
  background: #f7f8fc;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.cockpit-table td {
  vertical-align: middle;
}

.cockpit-table td:nth-child(n+3):nth-child(-n+10),
.cockpit-table th:nth-child(n+3):nth-child(-n+10) {
  text-align: right;
}

.cockpit-table th:last-child,
.cockpit-table td:last-child {
  width: 92px;
  min-width: 92px;
  text-align: right;
}

.cockpit-table td:last-child {
  padding-right: 12px;
}

.table-progress {
  display: grid;
  grid-template-columns: 74px 42px;
  align-items: center;
  justify-content: end;
  gap: 8px;
}

.table-progress strong {
  color: #25314a;
  font-size: 12px;
}

.batch-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
}

.batch-name-cell strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attention-row td:first-child {
  box-shadow: inset 3px 0 0 #f59e0b;
}

.attention-row .batch-name-cell strong {
  color: #7b4b00;
}

.empty-list {
  padding: 32px;
  display: grid;
  gap: 8px;
}

.source-page {
  display: grid;
  gap: 18px;
  width: min(1180px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 28px 0;
}

.source-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.source-header h1 {
  margin: 8px 0 4px;
  font-size: 24px;
}

.source-header p {
  margin: 0;
  color: var(--muted);
}

.back-link {
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.source-filters {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.source-filters label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.source-filters input {
  width: 150px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
}

.source-filters button {
  min-height: 40px;
  padding: 8px 12px;
}

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

.source-summary article,
.source-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.source-summary article {
  padding: 16px;
}

.source-summary strong {
  display: block;
  font-size: 26px;
  line-height: 1;
}

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

.source-table {
  overflow: auto;
}

.source-table table {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 56px minmax(260px, 320px) minmax(0, 1fr);
  }

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

  .client-checkbox-group {
    grid-template-columns: 1fr;
  }

  .client-level-summary {
    grid-template-columns: 1fr;
  }

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

  .contract-meta-grid div:nth-child(3n) {
    border-right: 0;
  }

  .client-evaluation-layout {
    grid-template-columns: 1fr;
  }

  .evaluation-panel {
    position: static;
    order: -1;
  }

  .content-grid,
  .json-review-grid,
  .mapping-explanation,
  .mapping-suggestions > div:not(.suggestion-group),
  .suggestion-group > div,
  .mapping-notes {
    grid-template-columns: 1fr;
  }

  .decision-panel {
    position: static;
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .client-cockpit-shell {
    grid-template-columns: 1fr;
  }

  .rail {
    display: none;
  }

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

  .topbar,
  .item-header,
  .section-title,
  .json-card-header {
    align-items: stretch;
    flex-direction: column;
  }

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

  .batch-progress-main {
    grid-column: 1 / -1;
  }

  .source-header {
    align-items: stretch;
    flex-direction: column;
  }

  .cockpit-list-header {
    align-items: stretch;
    flex-direction: column;
  }

  .cockpit-list-header nav {
    width: 100%;
  }

  .cockpit-list-header nav a {
    flex: 1;
  }

  .client-detail-page,
  .client-cockpit-page {
    padding: 18px 14px 24px;
  }

  .client-detail-header,
  .client-cockpit-header,
  .client-section-title,
  .client-table-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .client-tabs,
  .client-tabs a,
  .client-tabs button {
    width: 100%;
  }

  .client-about-form {
    grid-template-columns: 1fr;
  }

  .contract-card-header {
    align-items: stretch;
    flex-direction: column;
  }

  .contract-meta-grid {
    grid-template-columns: 1fr;
  }

  .contract-meta-grid div,
  .contract-meta-grid div:nth-child(3n) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .contract-meta-grid div:last-child {
    border-bottom: 0;
  }

  .modal-edit-form {
    grid-template-columns: 1fr;
  }

  .source-summary,
  .cockpit-list-summary {
    grid-template-columns: 1fr;
  }
}
