:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --panel: #ffffff;
  --panel-soft: #faf8f2;
  --ink: #202225;
  --muted: #6d7377;
  --line: #ded8cc;
  --teal: #0f766e;
  --teal-dark: #0b5d57;
  --gold: #b7791f;
  --red: #b3403c;
  --green: #2f7d4a;
  --blue: #346e8a;
  --shadow: 0 16px 36px rgba(45, 38, 26, 0.08);
  --login-primary: #087a6a;
  --login-primary-dark: #066b5d;
  --login-bg: #f6faf8;
  --login-text: #111827;
  --login-muted: #6b7280;
  --login-border: #d8ded9;
  --login-card: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 22px 16px;
  background: #202225;
  color: #fff;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 8px 24px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 42px;
  border-radius: 8px;
  background: #eef3f8;
  border: 1px solid rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

.brand-mark img {
  display: block;
  width: 46px;
  height: 28px;
  object-fit: contain;
}

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

.brand strong {
  font-size: 17px;
  letter-spacing: 0;
}

.brand span {
  margin-top: 3px;
  color: #c8d0cc;
  font-size: 13px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  margin: 4px 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #d7ddda;
  text-align: left;
}

.nav-item span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #f6f4ef;
  font-size: 12px;
  font-weight: 800;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.sidebar nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.sidebar-user {
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-user strong,
.sidebar-user span {
  display: block;
}

.sidebar-user strong {
  font-size: 14px;
}

.sidebar-user span {
  margin-top: 4px;
  color: #c8d0cc;
  font-size: 12px;
  line-height: 1.35;
}

.sidebar-user button {
  width: 100%;
  margin-top: 10px;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font-weight: 800;
}

.sidebar-attendance-card {
  display: grid;
  gap: 5px;
  margin-top: 9px;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 7px;
  background: rgba(4, 94, 83, 0.3);
}

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

.sidebar-attendance-head strong {
  color: #d8f3eb;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.sidebar-attendance-head span,
.sidebar-attendance-card small {
  margin: 0;
  color: #bdd4cd;
  font-size: 10px;
  line-height: 1.35;
}

.sidebar-attendance-status {
  overflow: hidden;
  color: #fff;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-attendance-message {
  color: #d9f4eb !important;
}

.sidebar-user .sidebar-attendance-button {
  width: 100%;
  min-height: 30px;
  margin-top: 2px;
  padding: 5px 8px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
}

.sidebar-user .sidebar-attendance-button.punch-in {
  background: #128477;
}

.sidebar-user .sidebar-attendance-button.punch-out {
  background: #bd7a24;
}

.sidebar-user .sidebar-attendance-button:hover:not(:disabled) {
  filter: brightness(1.08);
}

.sidebar-user .sidebar-attendance-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.sidebar-attendance-backdrop {
  z-index: 90;
}

.sidebar-attendance-dialog {
  width: min(520px, calc(100vw - 32px));
}

.sidebar-attendance-dialog-body {
  display: grid;
  gap: 14px;
  padding: 20px 22px 22px;
}

.sidebar-attendance-dialog-body > p {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
}

.sidebar-attendance-dialog-body > p span {
  color: var(--muted);
  font-size: 13px;
}

.sidebar-attendance-dialog-body > p strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.sidebar-logout-actions {
  display: grid;
  gap: 9px;
}

.main {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 30px;
}

h2 {
  margin-bottom: 14px;
  font-size: 18px;
}

.content {
  padding: 0 32px 36px;
}

.page-stack {
  display: grid;
  gap: 18px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
}

.top-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(78px, 1fr));
  gap: 7px;
  width: min(410px, 100%);
  min-width: 0;
  flex: 0 1 410px;
  overflow-x: auto;
  padding: 1px 1px 3px;
  scrollbar-width: thin;
}

.stat,
.panel,
.table-wrap,
.detail-hero {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stat {
  padding: 16px;
}

.top-stats .stat {
  position: relative;
  display: flex;
  min-height: 56px;
  padding: 8px 9px;
  flex-direction: column;
  justify-content: space-between;
  border-color: #e6edf4;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 5px 13px rgba(16, 24, 40, 0.08);
}

.top-stats .stat::before {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 10px 10px 0 0;
  background: #2563eb;
  content: '';
}

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

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.top-stats .stat span {
  color: #5b6776;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
}

.top-stats .stat strong {
  margin-top: 7px;
  color: #172033;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.top-stats .stat.green::before {
  background: #16a34a;
}

.top-stats .stat.warn::before {
  background: #f59e0b;
}

.top-stats .stat.danger::before {
  background: #ef4444;
}

.stat.green strong {
  color: var(--green);
}

.stat.blue strong {
  color: var(--blue);
}

.stat.warn strong {
  color: var(--gold);
}

.stat.danger strong {
  color: #b42318;
}

.stat.gray strong {
  color: #6b7280;
}

.today-kpi-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf6;
  box-shadow: 0 10px 24px rgba(23, 31, 38, 0.05);
  scrollbar-width: thin;
}

.today-kpi-title {
  flex: 0 0 auto;
  color: var(--ink);
  font-size: 15px;
  white-space: nowrap;
}

.today-kpi-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 760;
  line-height: 1;
  white-space: nowrap;
}

.today-kpi-badge strong {
  font-size: 16px;
}

.today-kpi-badge.blue {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.today-kpi-badge.orange {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #c2410c;
}

.today-kpi-badge.purple {
  border-color: #ddd6fe;
  background: #f5f3ff;
  color: #6d28d9;
}

.today-kpi-badge.green {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.today-kpi-badge.red {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(4, minmax(130px, 170px)) repeat(2, auto);
  gap: 10px;
  align-items: center;
}

.analytics-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.analytics-toolbar > select,
.analytics-toolbar > input {
  min-width: 150px;
  max-width: 190px;
}

.analytics-scope-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 280px;
}

.analytics-scope-tab {
  border: 1px solid #d8d0c2;
  background: #fffdf8;
  color: var(--ink);
  border-radius: 8px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.analytics-scope-tab.active {
  border-color: #8fc9c1;
  background: #eaf8f5;
  color: var(--green);
}

.analytics-scope-note {
  color: var(--muted);
  font-weight: 750;
  margin-top: -6px;
}

.analytics-report-hero,
.analytics-report-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.analytics-report-hero h2,
.analytics-report-section-head h2 { margin: 4px 0 6px; }
.analytics-report-hero p,
.analytics-report-section-head p { margin: 0; color: var(--muted); }

.analytics-report-admin-badge {
  padding: 7px 11px;
  border-radius: 999px;
  background: #fff1e7;
  color: #b45309;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.analytics-report-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.analytics-report-summary-card { display: grid; gap: 5px; padding: 18px; }
.analytics-report-summary-card span { color: var(--muted); font-weight: 800; }
.analytics-report-summary-card strong { color: var(--ink); font-size: 30px; }
.analytics-report-summary-card small { color: var(--muted); }
.analytics-report-employee-panel { padding: 0; overflow: hidden; }
.analytics-report-section-head { padding: 18px 20px; border-bottom: 1px solid #e7e4dc; }
.analytics-report-table-wrap { overflow-x: auto; }
.analytics-report-table { width: 100%; border-collapse: collapse; }
.analytics-report-table th,
.analytics-report-table td { padding: 12px 16px; border-bottom: 1px solid #eeeae2; text-align: center; white-space: nowrap; }
.analytics-report-table th { background: #faf9f6; color: var(--muted); font-size: 12px; }
.analytics-report-table th:first-child,
.analytics-report-table td:first-child { text-align: left; }
.analytics-report-table tbody tr:last-child td { border-bottom: 0; }
.analytics-report-empty { padding: 28px !important; color: var(--muted); text-align: center !important; }

.analytics-report-employee-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
}

.analytics-report-employee-link:hover,
.analytics-report-employee-link:focus-visible { text-decoration-color: currentColor; }
.analytics-employee-report-backdrop { z-index: 70; }
.analytics-employee-report-modal { width: min(1120px, calc(100vw - 48px)); }
.analytics-employee-report-body { display: grid; gap: 16px; padding: 18px; }
.analytics-employee-report-body .dashboard-report-records-panel { margin: 0; }
.analytics-employee-report-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.analytics-employee-report-stats article {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid #e3e0d8;
  border-radius: 8px;
  background: #fafbf9;
}

.analytics-employee-report-stats span { color: var(--muted); font-size: 12px; font-weight: 800; }
.analytics-employee-report-stats strong { color: var(--ink); font-size: 24px; }

@media (max-width: 900px) {
  .analytics-report-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .analytics-report-hero { flex-direction: column; }
  .analytics-report-summary-grid { grid-template-columns: 1fr; }
  .analytics-employee-report-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.dashboard-report-records-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.dashboard-report-records-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.dashboard-report-records-head h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.dashboard-report-title-block {
  min-width: 0;
}

.dashboard-report-title-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.dashboard-submit-status-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.dashboard-submit-status-badge {
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid #d7dedc;
  border-radius: 999px;
  background: #f7fbfa;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.dashboard-submit-status-badge:hover {
  transform: translateY(-1px);
}

.dashboard-submit-status-badge.submitted {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}

.dashboard-submit-status-badge.missing {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #c2410c;
}

.dashboard-submit-status-badge.missing.has-missing {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.dashboard-submit-status-badge.required {
  border-color: #e2e8f0;
  background: #f8fafc;
  color: #475569;
}

.dashboard-submit-status-loading,
.dashboard-submit-status-error {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.dashboard-submit-status-loading {
  border: 1px solid #d7dedc;
  background: #f7fbfa;
  color: var(--muted);
}

.dashboard-submit-status-error {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

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

.dashboard-unread-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid #d7dedc;
  border-radius: 999px;
  background: #f7fbfa;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.dashboard-unread-badge.has-unread {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #c2410c;
}

.dashboard-report-record-list {
  display: grid;
  gap: 8px;
}

.dashboard-report-record-list.full {
  gap: 10px;
}

.dashboard-report-record-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 10px 11px;
  border: 1px solid #e5ded1;
  border-radius: 8px;
  background: #fff;
}

.dashboard-report-record-row.unread {
  border-color: #fed7aa;
  background: #fffaf3;
}

.dashboard-report-read-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #cbd5e1;
}

.dashboard-report-read-dot.unread {
  background: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.14);
}

.dashboard-report-record-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.dashboard-report-record-title {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 9px;
  align-items: center;
  min-width: 0;
}

.dashboard-report-record-title strong {
  color: var(--ink);
}

.dashboard-report-record-title span,
.dashboard-report-record-title time {
  color: #475569;
  font-size: 13px;
  font-weight: 850;
}

.dashboard-report-record-title small {
  color: var(--muted);
  font-weight: 750;
}

.dashboard-report-record-row p {
  margin: 0;
  overflow: hidden;
  color: #4b5563;
  font-size: 13px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-report-all-drawer {
  width: min(86vw, 1180px);
}

.dashboard-submit-status-modal {
  width: min(560px, 92vw);
}

.dashboard-submit-status-modal .modal-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.dashboard-submit-status-list {
  display: grid;
  gap: 8px;
  max-height: 430px;
  overflow: auto;
  padding: 2px;
}

.dashboard-submit-status-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.2fr) minmax(76px, 0.8fr) minmax(76px, 0.8fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid #e5ded1;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
}

.dashboard-submit-status-row strong,
.dashboard-submit-status-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-report-all-body {
  align-content: start;
}

.dashboard-report-filter-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr)) repeat(2, minmax(130px, 0.8fr)) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid #e5ded1;
  border-radius: 8px;
  background: #fff;
}

.dashboard-report-filter-bar select,
.dashboard-report-filter-bar input[type="date"] {
  width: 100%;
}

.dashboard-report-unread-filter {
  justify-content: center;
  white-space: nowrap;
}

.dashboard-report-readonly-actions {
  justify-content: flex-end;
}

.dashboard-report-readonly-actions > span {
  margin-right: auto;
}

.orders-toolbar {
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(140px, 180px)) auto;
}

.customer-io-panel {
  display: grid;
  gap: 14px;
}

.customer-io-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.customer-io-head h2 {
  margin: 4px 0 2px;
}

.customer-io-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.customer-io-card {
  display: grid;
  gap: 10px;
  align-content: start;
}

.customer-io-modal {
  width: min(1120px, calc(100vw - 48px));
}

.customer-io-modal-body {
  padding: 22px;
}

.compact-actions {
  margin-top: 0;
}

.approval-review-card {
  max-height: 260px;
  overflow: auto;
}

.approval-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto;
  gap: 4px 10px;
  padding: 10px 0;
  border-top: 1px solid #e6dfd2;
}

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

.approval-row .row-actions {
  grid-column: 1 / -1;
}

.analytics-export-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #d7d0c2;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.input[readonly] {
  background: #f6f8f7;
  color: #4b5563;
  cursor: default;
}

.textarea {
  min-height: 120px;
  max-height: 600px;
  overflow-y: auto;
  resize: vertical;
  line-height: 1.6;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.textarea:focus {
  background: #fff;
}

.smart-textarea-field {
  position: relative;
  width: 100%;
  overflow: visible;
}

.smart-textarea-shell {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: rgba(250, 248, 242, 0.72);
  overflow: visible;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.smart-textarea-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.smart-draft-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #f5d58b;
  border-radius: 12px;
  background: #fff8e5;
  color: #684b13;
}

.smart-draft-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.smart-draft-copy strong {
  color: #7a4b00;
  font-size: 14px;
}

.smart-draft-copy span {
  color: #7f6a3d;
  font-size: 12px;
  line-height: 1.4;
}

.smart-draft-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.smart-draft-action {
  min-height: 32px;
  padding: 6px 12px;
  border: 1px solid #e5d8bd;
  border-radius: 999px;
  background: #fff;
  color: #6b4e16;
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
  cursor: pointer;
}

.smart-draft-action.restore {
  border-color: #0f766e;
  background: #0f766e;
  color: #fff;
}

.smart-draft-action.discard {
  border-color: #ffc7c7;
  color: #a31f1f;
}

.smart-ai-button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid #b8dfd3;
  border-radius: 999px;
  border-color: #b8dfd3;
  background: #0f766e;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.smart-ai-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.smart-inline-message {
  padding: 8px 10px;
  border: 1px solid #b8dfd3;
  border-radius: 10px;
  background: #eefbf6;
  color: #315f58;
  font-size: 13px;
  font-weight: 700;
}

.smart-inline-message.error {
  border-color: #ffc7c7;
  background: #fff2f2;
  color: var(--red);
}

.smart-textarea-footer {
  display: flex;
  gap: 8px 14px;
  flex-wrap: wrap;
  color: #6b7884;
  font-size: 12px;
  line-height: 1.4;
}

.file {
  padding-top: 8px;
}

.btn {
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 750;
  transition: 0.15s ease;
}

.btn.primary {
  background: var(--teal);
  color: #fff;
}

.btn.primary:hover {
  background: var(--teal-dark);
}

.btn.secondary {
  border-color: var(--line);
  background: var(--panel-soft);
  color: var(--ink);
}

.btn.ghost {
  min-height: 34px;
  padding: 7px 10px;
  border-color: var(--line);
  background: transparent;
  color: var(--teal);
}

.btn.danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.btn.danger:hover:not(:disabled) {
  border-color: #fca5a5;
  background: #fee2e2;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #ebe6dc;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: var(--panel-soft);
  color: #4b5257;
  font-size: 13px;
  text-align: center;
  vertical-align: middle;
}

.data-table small,
.mini-card span,
.timeline-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
}

.customer-table th,
.customer-table td {
  text-align: center;
  vertical-align: middle;
}

/*
CUSTOMER_TABLE_COMPACT_ROW_RULE:
- Customer rows must stay compact for continuous scanning
- Action buttons remain on one line and never increase row height
- Narrow windows use the table's internal horizontal scroller
- Long product text is truncated visually without changing stored data
*/
.customer-table {
  min-width: 1560px;
  table-layout: fixed;
}

.customer-table th {
  padding: 9px 10px;
}

.customer-table td {
  padding: 7px 10px;
  line-height: 1.25;
  white-space: nowrap;
}

.customer-table .link-button {
  display: inline-block;
  max-width: 100%;
  line-height: 1.2;
  text-align: center;
}

.customer-table small {
  margin-top: 2px;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-table .grade,
.customer-table .status-pill,
.customer-table .customer-star-rating,
.customer-table .customer-tag-list {
  justify-content: center;
}

.customer-table .follow-date {
  margin: 0 auto;
  min-width: 90px;
  padding: 5px 7px;
  justify-items: center;
  text-align: center;
}

.customer-table .follow-date strong {
  font-size: 13px;
}

.customer-table .grade,
.customer-table .status-pill,
.customer-table .customer-tag-chip {
  min-height: 22px;
  padding: 3px 7px;
  font-size: 11px;
}

.customer-table .customer-tag-list.compact {
  flex-wrap: nowrap;
  gap: 3px;
  max-height: 22px;
}

.customer-table .customer-star-rating {
  min-height: 22px;
}

.customer-company-cell {
  width: 220px;
  max-width: 220px;
}

.customer-company-cell .link-button {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.customer-company-cell:has(.duplicate-customer-badge) .link-button {
  max-width: calc(100% - 94px);
}

.customer-company-cell .duplicate-customer-badge {
  display: inline-flex;
  margin-left: 4px;
  vertical-align: middle;
}

.customer-company-cell small {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-owner-cell {
  min-width: 110px;
}

.customer-tags-cell {
  width: 230px;
  min-width: 230px;
}

.customer-products-cell {
  width: 190px;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-table th:last-child,
.customer-actions-cell {
  width: 125px;
  min-width: 125px;
}

.customer-table .row-actions {
  position: relative;
  flex-wrap: nowrap;
  gap: 4px;
  justify-content: center;
}

.customer-table .row-actions .btn {
  min-height: 28px;
  padding: 4px 7px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.customer-more-actions {
  position: relative;
}

.customer-more-toggle.btn {
  min-width: 48px;
  color: var(--muted);
}

.customer-more-actions.is-open .customer-more-toggle.btn {
  border-color: rgba(15, 118, 110, 0.3);
  background: #eef8f6;
  color: var(--teal);
}

.customer-more-menu {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  z-index: 30;
  display: grid;
  min-width: 112px;
  padding: 5px;
  border: 1px solid #ded8cf;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(61, 52, 42, 0.16);
}

.customer-table tbody tr:nth-last-child(-n + 4) .customer-more-menu {
  top: auto;
  bottom: calc(100% + 5px);
}

.customer-table .customer-more-menu .btn {
  width: 100%;
  justify-content: flex-start;
  border-color: transparent;
  text-align: left;
}

.customer-table .customer-more-menu .btn:hover {
  background: #f4f8f7;
}

.customer-table .customer-more-menu .customer-delete-button.btn {
  border-top: 1px solid #f1dada;
  border-radius: 3px;
}

.customer-delete-button.btn {
  border-color: rgba(185, 28, 28, 0.28);
  color: #b91c1c;
}

.customer-delete-button.btn:hover {
  background: #fff1f2;
}

.trade-ledger-intro {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

/* Keep the wide ledger table inside its own scroller instead of widening the page. */
.trade-ledger-page,
.trade-ledger-page > *,
.trade-ledger-controls,
.trade-ledger-list-panel,
.trade-ledger-table-wrap {
  width: 100%;
  min-width: 0;
}

.trade-ledger-list-panel {
  gap: 14px;
}

.trade-ledger-controls {
  display: grid;
  gap: 12px;
}

.trade-ledger-view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/*
TRADE_LEDGER_ORDER_COMMISSION_UI_RULE:
- Monthly settlement remains a compact in-page view, not a second ledger page
- One order owns one table row; recipient detail expands below that row
- All monetary summaries remain separated by their stored currency
- Mobile uses labeled rows and never forces the page itself to scroll sideways
*/
.order-commission-settlement {
  display: grid;
  gap: 16px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.order-commission-settlement > .panel,
.order-commission-list,
.order-commission-table-wrap {
  min-width: 0;
  max-width: 100%;
}

.order-commission-list {
  overflow: hidden;
}

.order-commission-summary .card-head {
  align-items: center;
  margin-bottom: 14px;
}

.order-commission-summary .card-head p {
  margin: 4px 0 0;
}

.order-commission-stat-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(112px, 1fr));
  gap: 8px;
}

.order-commission-stat {
  min-height: 78px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft, #f8faf9);
  text-align: center;
}

.order-commission-stat span {
  color: var(--text-muted);
  font-size: 12px;
}

.order-commission-stat strong {
  font-size: 18px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.order-commission-controls {
  display: grid;
  gap: 14px;
}

.order-commission-month-controls {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.order-commission-month-stepper {
  display: grid;
  grid-template-columns: 42px minmax(240px, 300px) 42px;
  align-items: end;
  gap: 8px;
  min-width: 0;
}

.order-commission-month-stepper .field {
  width: 100%;
  margin: 0;
}

.order-commission-month-stepper > .btn {
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}

.order-commission-month-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-commission-month-actions .btn,
.order-commission-status-tabs .btn {
  min-height: 42px;
  white-space: nowrap;
}

.order-commission-filter-grid {
  display: grid;
  grid-template-columns: auto minmax(170px, 1fr) minmax(170px, 1fr) minmax(260px, 1.4fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.order-commission-status-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(104px, 1fr));
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.order-commission-filter-grid > .input {
  width: 100%;
  min-width: 0;
}

.order-commission-filter-grid > .input,
.order-commission-status-tabs .btn {
  min-height: 42px;
}

.order-commission-column-settings {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 10px 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.order-commission-column-settings label {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.order-commission-table-wrap {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.order-commission-table {
  width: 100%;
  min-width: 1480px;
  table-layout: fixed;
}

.order-commission-table th,
.order-commission-table td {
  height: 62px;
  padding: 9px 10px;
  text-align: center;
  vertical-align: middle;
}

.order-commission-table th:nth-child(2),
.order-commission-table td:nth-child(2),
.order-commission-table th:nth-child(3),
.order-commission-table td:nth-child(3) {
  width: 155px;
}

.order-commission-table .trade-ledger-cell-text {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-commission-status.partial,
.order-commission-exception {
  color: #9a5b00;
  background: #fff6df;
}

.order-commission-status.issued {
  color: #0f6c5f;
  background: #e8f6f2;
}

.order-commission-status.unissued,
.order-commission-status.not_configured {
  color: #59636b;
  background: #f0f2f3;
}

.order-commission-exception {
  display: inline-block;
  max-width: 150px;
  padding: 5px 8px;
  border-radius: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.order-commission-actions {
  flex-wrap: nowrap;
  justify-content: center;
}

.order-commission-actions .btn {
  min-height: 34px;
  padding: 6px 9px;
  white-space: nowrap;
}

.order-commission-detail-row td {
  height: auto;
  padding: 14px;
  background: #f8fbfa;
}

.order-commission-recipient-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.order-commission-recipient {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  text-align: left;
}

.order-commission-recipient small {
  color: var(--text-muted);
}

.order-commission-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
}

.order-commission-action-dialog {
  width: min(620px, calc(100vw - 32px));
}

.order-commission-action-order,
.order-commission-action-recipients {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.order-commission-action-order span {
  color: var(--text-muted);
}

.order-commission-action-recipients label {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

@media (max-width: 1180px) {
  .order-commission-stat-grid {
    grid-template-columns: repeat(4, minmax(130px, 1fr));
  }

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

  .order-commission-column-settings {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }
}

.trade-ledger-filter-row {
  display: grid;
  gap: 10px;
  align-items: center;
}

.trade-ledger-filter-row.primary {
  grid-template-columns: minmax(220px, 320px) repeat(4, minmax(120px, 160px)) auto;
  justify-content: start;
}

.trade-ledger-filter-row.advanced {
  grid-template-columns: repeat(4, minmax(150px, 220px));
  justify-content: start;
}

.trade-ledger-column-settings {
  display: grid;
  gap: 10px;
  padding: 6px 10px;
  border: 1px solid #eee7da;
  border-radius: 8px;
  background: #fffdf9;
}

.trade-ledger-column-settings-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 34px;
}

.trade-ledger-column-settings-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.trade-ledger-column-settings-copy strong {
  color: #26323a;
  font-size: 14px;
  line-height: 1.2;
}

.trade-ledger-column-settings-copy span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-ledger-column-settings-actions {
  display: inline-flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.trade-ledger-column-settings-actions .btn {
  min-height: 34px;
  padding: 7px 10px;
}

.trade-ledger-column-save-state {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.trade-ledger-column-save-state.saved {
  color: var(--green);
}

.trade-ledger-column-save-state.dirty {
  color: var(--gold);
}

.trade-ledger-column-save-state.error {
  color: var(--red);
}

.trade-ledger-column-groups {
  display: grid;
  gap: 12px;
}

.trade-ledger-column-group {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.trade-ledger-column-group + .trade-ledger-column-group {
  padding-top: 12px;
  border-top: 1px solid #eee7da;
}

.trade-ledger-column-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.trade-ledger-column-group-head h4 {
  margin: 0;
  color: #31433f;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

.trade-ledger-column-group-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.trade-ledger-column-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 8px 12px;
}

.trade-ledger-column-option {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
  color: #3b454d;
  font-size: 13px;
  font-weight: 800;
}

.trade-ledger-column-option span {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-ledger-column-option small {
  flex: 0 0 auto;
  padding: 1px 5px;
  border: 1px solid #dfd8ca;
  border-radius: 4px;
  color: #7a746c;
  font-size: 10px;
  font-weight: 850;
  line-height: 1.4;
}

.trade-ledger-compact-notice {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
}

.trade-ledger-table-wrap {
  max-width: 100%;
  max-height: calc(100vh - 320px);
  overflow: auto;
}

.trade-ledger-table {
  width: 100%;
  min-width: 1180px;
  table-layout: fixed;
}

/*
LEDGER_TABLE_DISPLAY_RULE:
- PI合同号必须完整显示，不允许省略号截断
- 表头和数据默认居中
- 长文本可换行
*/
.trade-ledger-table th,
.trade-ledger-table td {
  height: 48px;
  max-width: 180px;
  padding: 8px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.35;
  text-align: center;
  vertical-align: middle;
}

.trade-ledger-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #fbf8f1;
}

.trade-ledger-table tbody tr {
  cursor: pointer;
}

.trade-ledger-table tbody tr:hover td {
  background: #f5fbf8;
}

.trade-ledger-cell-text {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-ledger-table .sticky-pi {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 160px;
  min-width: 140px;
  max-width: 180px;
  overflow: visible;
  text-overflow: unset;
  white-space: normal;
  word-break: break-word;
  background: #fff;
  box-shadow: 1px 0 0 #ebe6dc;
}

.trade-ledger-table thead .sticky-pi {
  z-index: 4;
  background: #fbf8f1;
}

.trade-ledger-table tbody tr:hover .sticky-pi {
  background: #f5fbf8;
}

.trade-ledger-table .trade-ledger-pi-link {
  display: block;
  max-width: 100%;
  overflow: visible;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
  text-overflow: unset;
  white-space: normal;
  word-break: break-word;
}

.trade-ledger-table .ledger-wrap-cell {
  overflow: visible;
  text-overflow: unset;
  white-space: normal;
  word-break: break-word;
}

.trade-ledger-table .ledger-wrap-cell .trade-ledger-cell-text {
  overflow: visible;
  text-overflow: unset;
  white-space: normal;
  word-break: break-word;
}

.trade-ledger-table .align-left,
.trade-ledger-table .align-left .trade-ledger-cell-text {
  text-align: left;
}

.trade-ledger-table .ledger-order-sequence-cell {
  width: 86px;
  min-width: 86px;
  max-width: 86px;
  overflow: visible;
  color: #24443f;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-overflow: unset;
  white-space: nowrap;
}

.trade-ledger-actions-head,
.trade-ledger-actions-cell {
  width: 112px;
  min-width: 112px;
  text-align: center;
}

.trade-ledger-actions-cell .row-actions {
  align-items: center;
  gap: 6px;
  justify-content: center;
  flex-wrap: nowrap;
}

.amount-cell {
  text-align: right;
}

.rate-cell {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.profit-danger {
  color: #b91c1c;
  font-weight: 900;
}

.profit-warn {
  color: #b45309;
  font-weight: 900;
}

.profit-success {
  color: var(--teal-dark);
  font-weight: 900;
}

.profit-muted {
  color: var(--muted);
}

.alert-summary-cell .status-pill {
  display: inline-flex;
  width: auto;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-ledger-import-backdrop {
  align-items: stretch;
  justify-items: center;
  padding: 24px;
}

.trade-ledger-import-panel {
  width: min(1320px, 100%);
  max-height: calc(100vh - 48px);
}

.trade-ledger-import-body {
  display: grid;
  gap: 14px;
  padding: 18px 22px 24px;
  overflow: auto;
}

.trade-ledger-import-upload {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(260px, 360px) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
}

.trade-ledger-manual-backdrop {
  align-items: stretch;
  justify-items: center;
  padding: 24px;
}

.trade-ledger-manual-panel {
  width: min(1180px, 100%);
  max-height: calc(100vh - 48px);
}

.trade-ledger-create-head-copy {
  min-width: 0;
}

.trade-ledger-create-title-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.trade-ledger-create-title-line h2 {
  margin: 4px 0 0;
}

.trade-ledger-order-sequence-badge {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 6px;
  background: #edf8f4;
  color: #205f57;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
}

.trade-ledger-order-sequence-badge.is-pending {
  margin-top: 4px;
  background: #f5f7f6;
  color: #53615f;
}

.trade-ledger-order-sequence-badge.is-pending span {
  color: #2f4945;
}

.trade-ledger-order-sequence-badge.is-pending strong {
  color: #687572;
  font-size: 11px;
}

.trade-ledger-manual-body {
  display: grid;
  gap: 14px;
  padding: 18px 22px 24px;
  overflow: auto;
}

.trade-ledger-manual-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
}

.trade-ledger-manual-section h3 {
  margin: 0;
  color: var(--teal);
  font-size: 16px;
}

.trade-ledger-manual-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.trade-ledger-manual-section .textarea {
  min-height: 96px;
}

.trade-ledger-import-errors,
.trade-ledger-import-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.trade-ledger-import-stat {
  min-width: 130px;
  padding: 10px 12px;
  border: 1px solid #eee7da;
  border-radius: 8px;
  background: #fff;
}

.trade-ledger-import-stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.trade-ledger-import-stat strong {
  display: block;
  margin-top: 3px;
  font-size: 20px;
}

.trade-ledger-import-note {
  display: flex;
  align-items: center;
  min-height: 44px;
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.trade-ledger-import-note.warn {
  border: 1px solid rgba(217, 119, 6, 0.24);
  background: #fff7e6;
  color: #925305;
}

.trade-ledger-import-note.danger {
  border: 1px solid rgba(185, 28, 28, 0.22);
  background: #fff1f2;
  color: #b91c1c;
}

.trade-ledger-import-table {
  min-width: 1580px;
}

.trade-ledger-import-table td:first-child,
.trade-ledger-import-table th:first-child {
  text-align: center;
}

.trade-ledger-import-table tr.row-importable td {
  background: #f4fbf7;
}

.trade-ledger-import-table tr.row-warn td {
  background: #fffaf0;
}

.trade-ledger-import-table tr.row-skipped td {
  background: #f6f5f2;
  color: #626b72;
}

.trade-ledger-import-table tr.row-danger td {
  background: #fff5f5;
}

.trade-ledger-import-table th,
.trade-ledger-import-table td,
.trade-ledger-subtable th,
.trade-ledger-subtable td {
  white-space: nowrap;
}

.numeric-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.trade-ledger-detail-backdrop {
  place-items: center;
  padding: 16px 32px;
  overflow: hidden;
}

.modal-panel.trade-ledger-detail-panel {
  width: min(1280px, calc(100vw - 64px));
  max-width: none;
  height: min(900px, 92vh, calc(100vh - 32px));
  height: min(900px, 92dvh, calc(100dvh - 32px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 14px;
  outline: none;
  isolation: isolate;
}

/*
TRADE_LEDGER_DELETE_UI_RULE:
- The destructive action uses a dedicated confirmation dialog above the ledger detail
- Risk, order identity and transient password entry must remain easy to scan
- The delete password is never persisted or rendered outside the password control
*/
.trade-ledger-delete-confirm-backdrop {
  z-index: 90;
  padding: 20px;
}

.modal-panel.trade-ledger-delete-confirm-panel {
  width: min(620px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.trade-ledger-delete-confirm-head {
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
}

.trade-ledger-delete-confirm-head h2 {
  margin: 3px 0 0;
  font-size: 24px;
}

.danger-text {
  color: #b42318;
}

.trade-ledger-delete-confirm-body {
  display: grid;
  gap: 16px;
  padding: 20px 24px 24px;
}

.trade-ledger-delete-risk {
  padding: 14px 16px;
  border: 1px solid #f4b4ae;
  border-radius: 8px;
  background: #fff5f4;
  color: #7a271a;
}

.trade-ledger-delete-risk strong {
  display: block;
  margin-bottom: 5px;
}

.trade-ledger-delete-risk p {
  margin: 0;
  line-height: 1.65;
}

.trade-ledger-delete-order-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 20px;
  margin: 0;
  padding: 0 2px;
}

.trade-ledger-delete-order-summary > div {
  min-width: 0;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.trade-ledger-delete-order-summary dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.trade-ledger-delete-order-summary dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.trade-ledger-delete-unsaved-warning {
  padding: 11px 13px;
  border-left: 3px solid #d97706;
  background: #fff9eb;
  color: #7c4a03;
  line-height: 1.5;
}

.trade-ledger-delete-password-field {
  gap: 7px;
}

.trade-ledger-delete-error {
  margin: 0;
}

.trade-ledger-delete-confirm-actions {
  justify-content: flex-end;
  margin-top: 2px;
}

.trade-ledger-delete-order-button,
.trade-ledger-delete-confirm-actions .btn.danger {
  border-color: #b42318;
  background: #b42318;
  color: #fff;
}

.trade-ledger-delete-order-button:hover:not(:disabled),
.trade-ledger-delete-confirm-actions .btn.danger:hover:not(:disabled) {
  border-color: #912018;
  background: #912018;
}

/*
TRADE_LEDGER_FINAL_COMPLETION_UI_RULE:
- Final completion and unlock use one compact, explicit confirmation dialog
- The locked state must be visible in the header without overpowering the PI identity
- The dialog never displays, stores or hints at the server password
*/
.trade-ledger-completion-confirm-backdrop {
  z-index: 92;
  padding: 20px;
}

.modal-panel.trade-ledger-completion-confirm-panel {
  width: min(600px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.trade-ledger-completion-confirm-head {
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
}

.trade-ledger-completion-confirm-head h2 {
  margin: 3px 0 0;
  font-size: 24px;
}

.trade-ledger-completion-confirm-body {
  display: grid;
  gap: 16px;
  padding: 20px 24px 24px;
}

.trade-ledger-completion-warning {
  padding: 14px 16px;
  border: 1px solid #f2c27b;
  border-radius: 8px;
  background: #fff9eb;
  color: #7c4a03;
}

.trade-ledger-completion-warning.is-unlock {
  border-color: #b9dcd4;
  background: #f2faf7;
  color: #125f55;
}

.trade-ledger-completion-warning strong {
  display: block;
  margin-bottom: 5px;
}

.trade-ledger-completion-warning p {
  margin: 0;
  line-height: 1.65;
}

.trade-ledger-completion-order-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 20px;
  margin: 0;
}

.trade-ledger-completion-order-summary > div {
  min-width: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.trade-ledger-completion-order-summary dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.trade-ledger-completion-order-summary dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.trade-ledger-completion-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
  cursor: pointer;
}

.trade-ledger-completion-check input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--teal);
}

.trade-ledger-completion-confirm-actions {
  justify-content: flex-end;
}

.trade-ledger-completion-button.is-lock {
  white-space: nowrap;
}

.trade-ledger-completion-lock-badge {
  white-space: nowrap;
}

.trade-ledger-tabbar {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  padding: 10px 22px;
  border-bottom: 1px solid var(--line);
  background: #fffdf9;
}

.trade-ledger-tabbar button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #3b454d;
  font-weight: 850;
}

.trade-ledger-tabbar button.active {
  border-color: rgba(15, 118, 110, 0.28);
  background: #e8f7f2;
  color: var(--teal-dark);
}

.trade-ledger-detail-body {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 18px 22px max(64px, calc(32px + env(safe-area-inset-bottom)));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.trade-ledger-detail-header {
  position: relative;
  top: auto;
  z-index: 2;
  flex: 0 0 auto;
  flex-wrap: wrap;
  min-width: 0;
  background: rgba(255, 255, 255, 0.98);
}

.trade-ledger-detail-tabs {
  position: relative;
  z-index: 1;
}

.trade-ledger-detail-header > div:first-child {
  flex: 1 1 420px;
  min-width: 0;
}

.trade-ledger-detail-header > .form-actions {
  flex: 0 0 auto;
  max-width: 100%;
  justify-content: flex-end;
}

.trade-ledger-detail-body > *,
.trade-ledger-detail-section,
.trade-ledger-amount-group,
.trade-ledger-edit-grid,
.trade-ledger-detail-grid {
  min-width: 0;
  max-width: 100%;
}

.trade-ledger-detail-panel .input,
.trade-ledger-detail-panel .select,
.trade-ledger-detail-panel textarea,
.trade-ledger-detail-panel .field {
  min-width: 0;
  max-width: 100%;
}

.trade-ledger-detail-panel.is-readonly > .modal-head {
  min-height: 68px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.trade-ledger-detail-panel.is-readonly .trade-ledger-tabbar {
  gap: 6px;
  padding: 8px 14px;
}

.trade-ledger-detail-panel.is-readonly .trade-ledger-detail-body {
  align-content: start;
  gap: 10px;
  padding: 10px 14px max(64px, calc(32px + env(safe-area-inset-bottom)));
}

.trade-ledger-detail-panel.is-readonly .trade-ledger-detail-section {
  align-content: start;
  gap: 8px;
  padding: 10px;
}

/*
TRADE_LEDGER_READONLY_COMPACT_SPACING_RULE:
- Readonly detail sections keep content at natural height instead of stretching blank space
- Section titles have no default heading margins
- Editing layouts and all business content remain unchanged
*/
.trade-ledger-detail-panel.is-readonly .trade-ledger-detail-section > h3 {
  margin: 0;
  line-height: 1.35;
}

.trade-ledger-detail-title-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.trade-ledger-detail-title-line h2 {
  min-width: 0;
  max-width: 100%;
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.trade-ledger-detail-input {
  min-height: 36px;
  margin-top: 6px;
  padding: 7px 9px;
  font-weight: 850;
  text-align: inherit;
}

.trade-ledger-report-panel {
  width: min(720px, calc(100vw - 48px));
}

.trade-ledger-report-body {
  display: grid;
  gap: 12px;
  padding: 18px 22px 22px;
}

.trade-ledger-report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.trade-ledger-edit-grid,
.trade-ledger-note-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.trade-ledger-edit-grid.trade-ledger-basic-info-grid,
.trade-ledger-manual-grid.trade-ledger-basic-info-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
}

.trade-ledger-basic-info-grid .field {
  min-width: 0;
  align-content: start;
}

.trade-ledger-basic-info-grid .field > span:first-child {
  width: 100%;
  text-align: left;
  line-height: 1.35;
}

.trade-ledger-basic-info-grid .trade-ledger-required-star {
  color: #dc2626;
  font-weight: 850;
}

.trade-ledger-pi-control {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.input.trade-ledger-pi-input.is-invalid {
  border-color: #dc2626;
  background: #fff7f7;
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.08);
}

.input.trade-ledger-pi-input.is-invalid:focus {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14);
}

.trade-ledger-pi-message {
  min-height: 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.trade-ledger-pi-message.error {
  color: #b91c1c;
}

.trade-ledger-customer-source-control,
.trade-ledger-salesperson-control,
.trade-ledger-export-country-control,
.trade-ledger-payment-method-control,
.trade-ledger-payment-method-custom {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.trade-ledger-export-country-control {
  position: relative;
}

.trade-ledger-export-country-control .trade-ledger-country-combobox {
  width: 100%;
  min-width: 0;
}

.trade-ledger-country-options {
  position: absolute;
  z-index: 120;
  top: calc(100% + 5px);
  right: 0;
  left: 0;
  max-height: 218px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid #d9d2c5;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(31, 41, 55, 0.16);
}

.trade-ledger-country-option {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #273238;
  text-align: left;
  cursor: pointer;
}

.trade-ledger-country-option:hover,
.trade-ledger-country-option.active {
  background: #e8f7f2;
  color: var(--teal-dark);
}

.trade-ledger-country-option[aria-selected="true"] {
  font-weight: 850;
}

.trade-ledger-country-option small {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.trade-ledger-country-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.field .trade-ledger-payment-method-custom-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.trade-ledger-edit-field.wide,
.trade-ledger-note-grid .field {
  grid-column: span 1;
}

.trade-ledger-edit-grid .textarea,
.trade-ledger-note-grid .textarea {
  min-height: 86px;
}

.trade-ledger-note-readonly {
  min-height: 86px;
  padding: 10px 12px;
  border: 1px solid #eee7da;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  line-height: 1.55;
  white-space: pre-wrap;
}

.trade-ledger-amount-v2 {
  background: #fffefb;
}

.trade-ledger-amount-v2 .input {
  width: 100%;
  height: 38px;
  min-height: 38px;
  padding: 7px 9px;
}

.trade-ledger-amount-group {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #eee7da;
  border-radius: 8px;
  background: #fff;
}

.trade-ledger-amount-group h4 {
  margin: 0;
  color: #26323a;
  font-size: 14px;
  font-weight: 900;
}

.trade-ledger-amount-group.trade-ledger-profit-summary {
  gap: 14px;
  width: 100%;
  padding: 16px;
  border-color: #d9e2de;
  background: #fbfcfb;
  box-shadow: 0 8px 22px rgba(34, 49, 44, 0.06);
}

.trade-ledger-profit-head {
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
}

.trade-ledger-profit-head h4 {
  color: #243139;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0;
}

.trade-ledger-profit-state {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  white-space: nowrap;
}

.trade-ledger-profit-state.is-positive {
  border-color: #b8ddce;
  background: #eaf6f0;
  color: #166b50;
}

.trade-ledger-profit-state.is-negative {
  border-color: #f1c3bc;
  background: #fff1ef;
  color: #b42318;
}

.trade-ledger-profit-state.is-neutral {
  border-color: #d9dde1;
  background: #f1f3f4;
  color: #5f6870;
}

.trade-ledger-profit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.trade-ledger-profit-metric {
  min-width: 0;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 14px;
  border: 1px solid #e1e6e3;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(38, 50, 46, 0.04);
  text-align: center;
}

.trade-ledger-profit-metric span {
  display: block;
  width: 100%;
  color: #69737a;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.35;
  text-align: center;
}

.trade-ledger-profit-metric strong {
  display: block;
  width: 100%;
  color: #252b2f;
  font-size: 28px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  line-height: 1.1;
  overflow-wrap: anywhere;
  text-align: center;
}

.trade-ledger-profit-metric.is-primary {
  border-color: #c7ddd4;
  background: #f3f9f6;
  box-shadow: 0 3px 10px rgba(28, 105, 81, 0.08);
}

.trade-ledger-profit-metric.is-primary strong {
  font-size: 30px;
}

.trade-ledger-profit-summary.is-positive .trade-ledger-profit-metric.is-primary strong {
  color: #146b54;
}

.trade-ledger-profit-summary.is-positive .trade-ledger-profit-metric.is-income strong {
  color: #285f50;
}

.trade-ledger-profit-summary.is-negative .trade-ledger-profit-metric.is-primary {
  border-color: #efc8c2;
  background: #fff6f4;
  box-shadow: 0 3px 10px rgba(180, 35, 24, 0.07);
}

.trade-ledger-profit-summary.is-negative .trade-ledger-profit-metric.is-primary strong,
.trade-ledger-profit-summary.is-negative .trade-ledger-profit-metric.is-income strong {
  color: #b42318;
}

.trade-ledger-profit-summary.is-neutral .trade-ledger-profit-metric.is-primary {
  border-color: #dce0e2;
  background: #f5f6f6;
  box-shadow: 0 2px 8px rgba(60, 68, 73, 0.04);
}

.trade-ledger-profit-summary.is-neutral .trade-ledger-profit-metric.is-primary strong,
.trade-ledger-profit-summary.is-neutral .trade-ledger-profit-metric.is-income strong {
  color: #59636a;
}

@media (max-width: 760px) {
  .trade-ledger-profit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trade-ledger-profit-metric {
    min-height: 104px;
  }
}

@media (max-width: 480px) {
  .trade-ledger-amount-group.trade-ledger-profit-summary {
    gap: 12px;
    padding: 12px;
  }

  .trade-ledger-profit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .trade-ledger-profit-metric {
    min-height: 98px;
    gap: 8px;
    padding: 14px 8px;
  }

  .trade-ledger-profit-metric strong,
  .trade-ledger-profit-metric.is-primary strong {
    font-size: 23px;
  }
}

.trade-ledger-order-amount-grid {
  display: grid;
  grid-template-columns: minmax(400px, 1.7fr) repeat(2, minmax(190px, 0.75fr)) minmax(104px, auto);
  gap: 14px;
  align-items: start;
}

.trade-ledger-order-amount-grid .trade-ledger-money-row {
  grid-template-columns: minmax(240px, 1fr) minmax(96px, 112px) minmax(108px, 128px);
}

.trade-ledger-auto-amount-input[readonly] {
  border-color: #dbe4df;
  background: #f2f6f4;
  color: #24342f;
  cursor: default;
  font-weight: 850;
}

.trade-ledger-amount-confirm {
  display: grid;
  gap: 0;
  align-content: start;
  justify-items: stretch;
  padding-top: 25px;
}

.trade-ledger-amount-confirm .btn {
  min-width: 104px;
}

.trade-ledger-amount-confirm .trade-ledger-money-helper {
  text-align: center;
}

.trade-ledger-money-field {
  min-width: 0;
}

.trade-ledger-money-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(92px, 112px) minmax(94px, 120px);
  gap: 8px;
  align-items: center;
}

.trade-ledger-money-row .input,
.trade-ledger-money-row .select {
  width: 100%;
}

.trade-ledger-cost-grid,
.trade-ledger-cost-readonly-grid {
  display: grid;
  gap: 12px;
  align-items: start;
}

.trade-ledger-cost-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.trade-ledger-cost-readonly-grid {
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 8px;
}

.trade-ledger-cost-grid .field,
.trade-ledger-cost-readonly-grid .trade-ledger-detail-item {
  min-width: 0;
}

/*
TRADE_LEDGER_COST_READONLY_ALIGNMENT_RULE:
- Cost and expense readonly cards align labels and amounts to the left
- Desktop readonly layout keeps all nine cost metrics in one row
- The section and cards use a restrained tinted background for scanning
- Match the basic information readonly cards
- Do not change global numeric alignment or profit summary alignment
*/
.trade-ledger-cost-readonly-group {
  border-color: #d8e5df;
  background: #f6faf8;
}

.trade-ledger-cost-readonly-grid .trade-ledger-money-readonly {
  min-height: 68px;
  padding: 9px 8px;
  border-color: #d9e6e0;
  background: #edf5f1;
  text-align: left;
}

.trade-ledger-cost-readonly-grid .trade-ledger-money-readonly > span:first-child {
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 11px;
  line-height: 1.35;
}

.trade-ledger-cost-readonly-grid .trade-ledger-money-readonly > strong {
  font-size: 15px;
  line-height: 1.2;
}

.trade-ledger-cost-grid .field > span:first-child {
  min-height: 18px;
  line-height: 1.35;
}

.trade-ledger-cost-grid input[type="number"] {
  text-align: center;
}

.trade-ledger-tax-refund-field {
  min-width: 0;
}

/*
TRADE_LEDGER_NO_TAX_REFUND_UI_RULE:
- The action stays beside the actual tax rebate input in edit mode
- It changes the current draft only and uses the existing page Save flow
- Warning styling is restrained and distinct from destructive order deletion
- Narrow screens stack the button without creating horizontal overflow
*/
.trade-ledger-amount-input-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.trade-ledger-amount-input-action > .input {
  min-width: 0;
  width: 100%;
}

.trade-ledger-no-tax-refund-btn.btn {
  min-height: 42px;
  padding: 8px 11px;
  border-color: #d9a14f;
  background: #fff8eb;
  color: #8a5205;
  font-size: 12px;
  white-space: nowrap;
}

.trade-ledger-no-tax-refund-btn.btn:hover:not(:disabled) {
  border-color: #c4872f;
  background: #fff1d6;
  color: #754300;
}

.trade-ledger-help-text {
  display: block;
  margin-top: 6px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.4;
}

.trade-ledger-help-text.warn {
  color: #a15c05;
}

.trade-ledger-fee-refund-readonly .trade-ledger-detail-item {
  height: 100%;
}

.trade-ledger-money-helper {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.trade-ledger-money-helper.warn {
  color: #a15c05;
}

.trade-ledger-money-readonly small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 750;
  overflow-wrap: anywhere;
}

.trade-ledger-edit-subtable .input {
  min-width: 128px;
  min-height: 34px;
  padding: 7px 8px;
}

.trade-ledger-detail-section.trade-ledger-compact-detail-section {
  gap: 0;
  height: max-content;
  min-height: 60px;
  padding: 0;
  overflow: visible;
}

.trade-ledger-compact-detail-head {
  display: grid;
  grid-template-columns: minmax(190px, auto) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 10px 12px;
}

.trade-ledger-compact-detail-title,
.trade-ledger-compact-detail-actions,
.trade-ledger-compact-detail-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.trade-ledger-compact-detail-title h3 {
  margin: 0;
  font-size: 16px;
}

.trade-ledger-compact-detail-metrics {
  justify-content: flex-end;
  gap: 8px 14px;
}

.trade-ledger-compact-detail-metric {
  display: inline-flex;
  gap: 5px;
  align-items: baseline;
  white-space: nowrap;
}

.trade-ledger-compact-detail-metric > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.trade-ledger-compact-detail-metric > strong {
  color: var(--ink);
  font-size: 14px;
}

.trade-ledger-compact-detail-actions {
  justify-content: flex-end;
}

.trade-ledger-compact-detail-toggle.btn {
  min-height: 30px;
  padding: 4px 9px;
  font-size: 12px;
}

.trade-ledger-compact-detail-body {
  display: grid;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.trade-ledger-compact-table-content {
  display: grid;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}

@media (max-width: 900px) {
  .trade-ledger-compact-detail-head {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .trade-ledger-compact-detail-metrics {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
  }

  .trade-ledger-compact-detail-actions {
    grid-column: 2;
    grid-row: 1;
  }
}

.trade-ledger-receipt-account-warning {
  padding: 7px 10px;
  border: 1px solid #f2cf8f;
  border-radius: 8px;
  background: #fff8e8;
  color: #925305;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.trade-ledger-receipt-row-feedback {
  padding: 7px 10px;
  border: 1px solid;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.trade-ledger-receipt-row-feedback.success {
  border-color: #b9dfd8;
  background: #eefbf8;
  color: var(--teal-dark);
}

.trade-ledger-receipt-row-feedback.error {
  border-color: #f0b6b2;
  background: #fff3f2;
  color: var(--red);
}

.trade-ledger-subtable.trade-ledger-receipt-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.trade-ledger-receipt-table th,
.trade-ledger-receipt-table td {
  height: 36px;
  padding: 4px;
  text-align: center;
  vertical-align: middle;
}

.trade-ledger-receipt-table th {
  height: 36px;
}

.trade-ledger-receipt-table th:nth-child(1),
.trade-ledger-receipt-table td:nth-child(1) { width: 10%; }
.trade-ledger-receipt-table th:nth-child(2),
.trade-ledger-receipt-table td:nth-child(2) { width: 9%; }
.trade-ledger-receipt-table th:nth-child(3),
.trade-ledger-receipt-table td:nth-child(3) { width: 7%; }
.trade-ledger-receipt-table th:nth-child(4),
.trade-ledger-receipt-table td:nth-child(4) { width: 8%; }
.trade-ledger-receipt-table th:nth-child(5),
.trade-ledger-receipt-table td:nth-child(5) { width: 10%; }
.trade-ledger-receipt-table th:nth-child(6),
.trade-ledger-receipt-table td:nth-child(6) { width: 13%; }
.trade-ledger-receipt-table th:nth-child(7),
.trade-ledger-receipt-table td:nth-child(7) { width: 18%; }
.trade-ledger-receipt-table th:nth-child(8),
.trade-ledger-receipt-table td:nth-child(8) { width: 15%; }
.trade-ledger-receipt-table th:nth-child(9),
.trade-ledger-receipt-table td:nth-child(9) { width: 10%; }

.trade-ledger-receipt-table .trade-ledger-receipt-control {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 36px;
  min-height: 36px;
  padding: 6px 4px;
  font-size: 13px;
  text-align: center;
}

.trade-ledger-receipt-table .trade-ledger-receipt-control.is-mismatch {
  border-color: #d99a32;
  background: #fffaf0;
  box-shadow: 0 0 0 2px rgba(217, 154, 50, 0.14);
}

.trade-ledger-receipt-table .btn,
.trade-ledger-purchase-table .btn {
  min-height: 32px;
  padding: 4px 6px;
  font-size: 12px;
}

.trade-ledger-receipt-table .trade-ledger-receipt-cny-input {
  background: #f2f6f4;
  color: #24343a;
  font-weight: 850;
  cursor: default;
}

.trade-ledger-receipt-table .row-actions {
  flex-wrap: nowrap;
  gap: 4px;
  justify-content: center;
}

.trade-ledger-subtable.trade-ledger-purchase-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
}

/*
TRADE_LEDGER_PURCHASE_PRODUCT_CELL_RULE:
- Purchase product text must wrap inside its own cell
- Long product descriptions must never overlap adjacent columns
- Rows must grow automatically with multiline content
- Header, readonly rows and edit rows must share the same column layout
- Do not use nowrap or visible overflow for purchase product cells
*/
.trade-ledger-purchase-table th,
.trade-ledger-purchase-table td {
  height: auto;
  min-width: 0;
  max-width: 100%;
  padding: 4px;
  overflow: hidden;
  white-space: normal;
  text-align: center;
  vertical-align: middle;
}

.trade-ledger-purchase-payment-table.is-editing col.trade-ledger-purchase-supplier-column { width: 9%; }
.trade-ledger-purchase-payment-table.is-editing col.trade-ledger-purchase-product-column { width: 26%; }
.trade-ledger-purchase-payment-table.is-editing col.trade-ledger-purchase-type-column { width: 12%; }
.trade-ledger-purchase-payment-table.is-editing col.trade-ledger-purchase-amount-column { width: 9%; }
.trade-ledger-purchase-payment-table.is-editing col.trade-ledger-purchase-date-column { width: 12%; }
.trade-ledger-purchase-payment-table.is-editing col.trade-ledger-purchase-method-column { width: 10%; }
.trade-ledger-purchase-payment-table.is-editing col.trade-ledger-purchase-note-column { width: 14%; }
.trade-ledger-purchase-payment-table.is-editing col.trade-ledger-purchase-action-column { width: 8%; }

.trade-ledger-purchase-payment-table.is-readonly col.trade-ledger-purchase-supplier-column { width: 10%; }
.trade-ledger-purchase-payment-table.is-readonly col.trade-ledger-purchase-product-column { width: 30%; }
.trade-ledger-purchase-payment-table.is-readonly col.trade-ledger-purchase-type-column { width: 13%; }
.trade-ledger-purchase-payment-table.is-readonly col.trade-ledger-purchase-amount-column { width: 10%; }
.trade-ledger-purchase-payment-table.is-readonly col.trade-ledger-purchase-date-column { width: 13%; }
.trade-ledger-purchase-payment-table.is-readonly col.trade-ledger-purchase-method-column { width: 11%; }
.trade-ledger-purchase-payment-table.is-readonly col.trade-ledger-purchase-note-column { width: 13%; }

.trade-ledger-purchase-payment-row {
  height: auto;
}

.trade-ledger-purchase-product-cell,
.trade-ledger-purchase-product-text,
.trade-ledger-purchase-product-linked-preview {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.45;
}

.trade-ledger-purchase-product-text,
.trade-ledger-purchase-product-linked-preview {
  display: block;
  width: 100%;
  text-align: left;
}

.trade-ledger-purchase-table .trade-ledger-purchase-control {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 36px;
  min-height: 36px;
  padding: 6px 4px;
  font-size: 13px;
  text-align: center;
}

.trade-ledger-purchase-product-control {
  display: grid;
  gap: 4px;
  width: 100%;
  min-width: 0;
}

.trade-ledger-purchase-product-control .trade-ledger-purchase-control {
  height: 32px;
  min-height: 32px;
}

.trade-ledger-purchase-product-control .trade-ledger-purchase-product-mode-select {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.trade-ledger-purchase-product-control .trade-ledger-purchase-product-input {
  width: 100%;
  min-height: 44px;
  max-height: 120px;
  height: auto;
  padding: 7px 8px;
  overflow-x: hidden;
  overflow-y: auto;
  resize: vertical;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.4;
  text-align: left;
}

.trade-ledger-purchase-product-linked-preview {
  max-height: 120px;
  padding: 6px 8px;
  overflow-y: auto;
  border: 1px solid #e5dfd4;
  border-radius: 6px;
  background: #f8faf9;
  color: #374047;
  font-size: 12px;
}

.trade-ledger-purchase-payment-table th > span,
.trade-ledger-purchase-payment-table td > * {
  min-width: 0;
  max-width: 100%;
}

.trade-ledger-purchase-payment-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

@media (max-width: 900px) {
  .trade-ledger-subtable.trade-ledger-purchase-payment-table {
    min-width: 920px;
  }
}

.trade-ledger-purchase-table .trade-ledger-purchase-amount-input.is-legacy-foreign {
  background: #f2f6f4;
  color: #24343a;
  font-weight: 850;
  cursor: default;
}

.trade-ledger-purchase-cny-note,
.trade-ledger-purchase-legacy-note {
  padding: 7px 10px;
  border: 1px solid #d7e6e2;
  border-radius: 8px;
  background: #f4faf8;
  color: #49615f;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.4;
}

.trade-ledger-purchase-legacy-note {
  border-color: #f2cf8f;
  background: #fff8e8;
  color: #925305;
}

.trade-ledger-purchase-cny-label {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
}

.trade-ledger-purchase-table .row-actions {
  flex-wrap: nowrap;
  gap: 4px;
  justify-content: center;
}

.trade-ledger-new-row td {
  background: #f8fbfa;
}

.trade-ledger-document-list {
  display: grid;
  gap: 10px;
}

.trade-ledger-document-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.trade-ledger-document-head-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.trade-ledger-document-add-form {
  display: grid;
  grid-template-columns: auto minmax(220px, 360px) auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #d8ebe7;
  border-radius: 8px;
  background: #f7fcfa;
}

.trade-ledger-document-add-form label {
  color: #405259;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.trade-ledger-document-summary-card {
  padding: 10px 12px;
  border: 1px solid #eee7da;
  border-radius: 8px;
  background: #fffdfa;
}

.trade-ledger-document-summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.trade-ledger-document-summary-card strong {
  display: block;
  margin-top: 4px;
  color: #26323a;
  font-size: 24px;
  line-height: 1;
}

.trade-ledger-document-summary-card strong.success {
  color: #0f766e;
}

.trade-ledger-document-summary-card strong.warn {
  color: #b7791f;
}

.trade-ledger-document-summary-card strong.danger {
  color: #b42318;
}

.trade-ledger-document-table-wrap {
  max-height: 58vh;
  overflow: auto;
  border: 1px solid #eee7da;
  border-radius: 8px;
}

.trade-ledger-document-table th,
.trade-ledger-document-table td {
  vertical-align: middle;
}

.trade-ledger-document-row {
  cursor: pointer;
}

.trade-ledger-document-row.open td,
.trade-ledger-document-row:hover td {
  background: #f5fbf8;
}

.trade-ledger-document-detail-row td {
  padding: 0;
  background: #fffdfa;
}

.trade-ledger-document-note-preview {
  display: block;
  max-width: 320px;
  overflow: hidden;
  color: #5f6f74;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-ledger-document-files-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.trade-ledger-document-files-head strong,
.trade-ledger-document-files-head span {
  display: block;
}

.trade-ledger-document-card {
  border: 1px solid #eee7da;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.trade-ledger-document-head {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(160px, 1fr) auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 0;
  background: #fff;
  color: #26323a;
  text-align: left;
}

.trade-ledger-document-head:hover,
.trade-ledger-document-card.open .trade-ledger-document-head {
  background: #f5fbf8;
}

.trade-ledger-document-body,
.trade-ledger-document-edit {
  display: grid;
  gap: 12px;
}

.trade-ledger-document-body {
  padding: 12px;
  border-top: 1px solid #eee7da;
}

.trade-ledger-document-edit {
  grid-template-columns: minmax(150px, 220px) minmax(0, 1fr);
  align-items: end;
}

.trade-ledger-document-edit .form-actions {
  grid-column: 1 / -1;
}

.trade-ledger-document-readonly {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #edf2ef;
  border-radius: 8px;
  background: #fff;
}

.trade-ledger-document-readonly div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
}

.trade-ledger-document-readonly strong {
  color: #5f6f74;
}

.trade-ledger-document-readonly span {
  overflow-wrap: anywhere;
}

.trade-ledger-dropzone {
  display: grid;
  gap: 4px;
  place-items: center;
  min-height: 108px;
  padding: 18px;
  border: 1px dashed rgba(15, 118, 110, 0.38);
  border-radius: 8px;
  background: #f5fbf8;
  color: #37535a;
  cursor: pointer;
}

.trade-ledger-dropzone.compact {
  min-height: 78px;
  padding: 12px;
}

.trade-ledger-dropzone.dragging {
  border-color: rgba(15, 118, 110, 0.72);
  background: #e8f7f2;
}

.trade-ledger-dropzone input,
.file-button input {
  display: none;
}

.trade-ledger-dropzone.disabled,
.file-button.disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.trade-ledger-file-list {
  margin-top: 8px;
}

.trade-ledger-file-item {
  align-items: center;
}

.trade-ledger-alerts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.trade-ledger-alert {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.trade-ledger-alert.danger {
  border-color: rgba(185, 28, 28, 0.24);
  background: #fff1f2;
  color: #b91c1c;
}

.trade-ledger-alert.warn {
  border-color: rgba(217, 119, 6, 0.26);
  background: #fff7e6;
  color: #a15c05;
}

.trade-ledger-alert.ok {
  border-color: rgba(15, 118, 110, 0.22);
  background: #e8f7f2;
  color: var(--teal);
}

.trade-ledger-alert-body {
  gap: 12px;
  align-content: start;
  padding-top: 14px;
}

.trade-ledger-alert-section {
  min-height: 0;
  align-content: start;
  gap: 14px;
  padding: 18px;
}

.trade-ledger-alert-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.trade-ledger-alert-summary-copy {
  min-width: 0;
}

.trade-ledger-alert-summary-copy h3 {
  margin: 0;
}

.trade-ledger-alert-summary-copy p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.trade-ledger-alert-summary-badges {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.trade-ledger-alert-count-badge,
.trade-ledger-alert-breakdown {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 5px 9px;
  border: 1px solid #dfe4e2;
  border-radius: 999px;
  background: #f5f7f6;
  color: #53615d;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.trade-ledger-alert-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.trade-ledger-alert-card {
  min-width: 0;
  min-height: 112px;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
  border: 1px solid #e3ded5;
  border-left-width: 3px;
  border-radius: 8px;
  background: #fff;
}

.trade-ledger-alert-card.danger {
  border-color: #efc6c1;
  border-left-color: #c44336;
  background: #fffafa;
}

.trade-ledger-alert-card.warn {
  border-color: #efd9aa;
  border-left-color: #c47a10;
  background: #fffdf7;
}

.trade-ledger-alert-card.info {
  border-color: #cfdae3;
  border-left-color: #537993;
  background: #fbfdff;
}

.trade-ledger-alert-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.trade-ledger-alert-card-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.trade-ledger-alert-card-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}

.trade-ledger-alert-card-icon.danger {
  background: #fff0ee;
  color: #b42318;
}

.trade-ledger-alert-card-icon.warn {
  background: #fff5dc;
  color: #9a5b00;
}

.trade-ledger-alert-card-icon.info {
  background: #edf4f8;
  color: #456b84;
}

.trade-ledger-alert-card-title {
  margin: 2px 0 0;
  color: #273238;
  font-size: 15px;
  font-weight: 850;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.trade-ledger-alert-severity {
  display: inline-flex;
  min-height: 24px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.2;
  white-space: nowrap;
}

.trade-ledger-alert-severity.danger {
  border-color: #edbbb5;
  background: #fff0ee;
  color: #b42318;
}

.trade-ledger-alert-severity.warn {
  border-color: #ebd095;
  background: #fff5dc;
  color: #925305;
}

.trade-ledger-alert-severity.info {
  border-color: #c8d7e1;
  background: #edf4f8;
  color: #456b84;
}

.trade-ledger-alert-card-desc {
  margin: 0;
  color: #5f6970;
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.trade-ledger-alert-card-meta {
  display: grid;
  gap: 6px;
  padding-top: 9px;
  border-top: 1px solid #ece8e0;
}

.trade-ledger-alert-card-meta > div {
  min-width: 0;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  font-size: 12px;
  line-height: 1.45;
}

.trade-ledger-alert-card-meta strong {
  color: #687279;
  font-weight: 850;
}

.trade-ledger-alert-card-meta span {
  color: #46535b;
  overflow-wrap: anywhere;
}

.trade-ledger-alert-empty {
  min-height: 132px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 18px;
  border: 1px dashed #cfe1da;
  border-radius: 8px;
  background: #f7fbf9;
  text-align: center;
}

.trade-ledger-alert-empty-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #e3f4ed;
  color: #17684f;
  font-size: 20px;
  font-weight: 900;
}

.trade-ledger-alert-empty strong {
  color: #27433a;
  font-size: 15px;
}

.trade-ledger-alert-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .trade-ledger-alert-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .trade-ledger-alert-section {
    padding: 14px;
  }

  .trade-ledger-alert-summary {
    flex-direction: column;
    gap: 10px;
  }

  .trade-ledger-alert-summary-badges {
    justify-content: flex-start;
  }

  .trade-ledger-alert-card-meta > div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

/* Employee records module: intentionally isolated from the work-report form layout. */
.admin-management-shell {
  min-width: 0;
}

/* Keep the administrative report header compact so the form stays in the first viewport. */
.admin-management-shell > .work-report-page {
  gap: 10px;
}

.admin-management-shell .report-intro {
  min-height: 0;
  padding: 12px 16px;
}

.admin-management-shell .report-intro .eyebrow {
  margin-bottom: 3px;
  font-size: 11px;
}

.admin-management-shell .report-intro h2 {
  font-size: 16px;
}

.admin-management-shell .report-intro .muted {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.4;
}

.admin-management-shell .report-period-tabs {
  gap: 6px;
}

.admin-management-shell .report-period {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 13px;
}

.admin-management-shell .report-layout.aside-collapsed .report-main-column {
  position: relative;
  gap: 0;
}

.admin-management-shell .report-layout.aside-collapsed .report-aside-restore {
  position: absolute;
  top: 12px;
  right: 116px;
  z-index: 2;
}

.admin-management-shell .report-layout.aside-collapsed .report-aside-toggle-btn.btn {
  min-height: 30px;
  padding: 5px 9px;
}

.admin-management-navigation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 14px;
  overflow: hidden;
  border-radius: 8px;
  background: #f7faf8;
}

.admin-management-context {
  display: flex;
  flex: 0 0 auto;
  align-items: baseline;
  gap: 4px;
  color: #244a43;
  font-size: 13px;
}

.admin-management-context strong {
  font-size: 15px;
}

.admin-management-context span {
  color: var(--muted);
}

.admin-management-tabs {
  display: flex;
  min-width: 0;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.admin-management-tab {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fffdf9;
  color: #46545a;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.admin-management-tab:hover {
  border-color: #92beb6;
  background: #eef7f4;
  color: var(--teal);
}

.admin-management-tab.active {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.admin-management-tab:focus-visible {
  outline: 3px solid rgba(31, 111, 104, 0.24);
  outline-offset: 2px;
}

@media (max-width: 760px) {
  .admin-management-navigation {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .admin-management-tabs {
    width: 100%;
  }

  .admin-management-shell .report-intro {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-management-shell .report-layout.aside-collapsed .report-main-column {
    gap: 6px;
  }

  .admin-management-shell .report-layout.aside-collapsed .report-aside-restore {
    position: static;
  }
}

.employee-records-report-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 84px;
  padding: 14px 18px;
  border-color: #bcd9d4;
  background: linear-gradient(105deg, #f2fbf8 0%, #fff 72%);
  cursor: pointer;
}

.employee-records-report-entry:focus-visible {
  outline: 3px solid rgba(31, 111, 104, 0.28);
  outline-offset: 2px;
}

.employee-records-report-entry-copy {
  display: flex;
  min-width: 0;
  gap: 13px;
  align-items: center;
}

.employee-records-report-entry-icon {
  display: grid;
  flex: 0 0 44px;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--teal);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.employee-records-report-entry-copy strong,
.employee-records-report-entry-copy span {
  display: block;
}

.employee-records-report-entry-copy strong {
  margin-bottom: 4px;
  font-size: 17px;
}

.employee-records-report-entry-copy span {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-records-report-entry-copy .employee-records-report-entry-error {
  color: #9a5d08;
}

.employee-records-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 22px 24px;
  background: linear-gradient(118deg, #f3fbf9, #fff 56%, #fbf7ed);
}

.employee-records-hero h2 {
  margin: 5px 0 7px;
  color: #183f3b;
  font-size: 25px;
}

.employee-records-hero p:last-child {
  max-width: 760px;
  margin-bottom: 0;
}

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

.employee-records-summary-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  min-height: 92px;
  align-content: center;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 9px 22px rgba(45, 38, 26, 0.045);
}

.employee-records-summary-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.employee-records-summary-card strong {
  color: #334155;
  font-size: 28px;
  line-height: 1;
}

.employee-records-summary-card.green {
  border-color: #b9dec8;
  background: #f4fbf7;
}

.employee-records-summary-card.green strong {
  color: var(--green);
}

.employee-records-summary-card.warn {
  border-color: #ead3a2;
  background: #fffbef;
}

.employee-records-summary-card.warn strong {
  color: #9a6209;
}

.employee-records-summary-card.danger {
  border-color: #efc0bd;
  background: #fff6f5;
}

.employee-records-summary-card.danger strong {
  color: var(--red);
}

.employee-records-filters {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.employee-records-filter-main,
.employee-records-filter-secondary {
  display: grid;
  gap: 12px;
  align-items: end;
}

.employee-records-filter-main {
  grid-template-columns: minmax(250px, 2fr) repeat(3, minmax(145px, 1fr));
}

.employee-records-filter-secondary {
  grid-template-columns: repeat(2, minmax(138px, 0.8fr)) repeat(3, minmax(150px, 1fr)) auto;
  padding-top: 13px;
  border-top: 1px solid #ece6dc;
}

.employee-records-filter-main .field,
.employee-records-filter-secondary .field {
  min-width: 0;
}

.employee-records-filter-secondary > .btn {
  min-height: 42px;
}

.employee-records-notice {
  margin: 0;
}

.employee-records-result-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  min-height: 28px;
}

.employee-records-result-head span {
  font-size: 12px;
  text-align: right;
}

.employee-records-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.employee-record-card {
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  gap: 15px;
  width: 100%;
  min-width: 0;
  min-height: 308px;
  height: 100%;
  padding: 18px;
  overflow: hidden;
  border: 1px solid #ddd6c9;
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 10px 24px rgba(45, 38, 26, 0.055);
  text-align: left;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.employee-record-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--teal), #4aa39a 65%, #d2b06b);
  content: "";
}

.employee-record-card:hover {
  transform: translateY(-2px);
  border-color: #8ebfb8;
  box-shadow: 0 16px 32px rgba(27, 83, 75, 0.12);
}

.employee-record-card:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.23);
  outline-offset: 2px;
}

.employee-record-card-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.employee-record-avatar {
  display: grid;
  place-items: center;
  flex: none;
  overflow: hidden;
  border: 1px solid #b9d8d2;
  border-radius: 10px;
  background: #e7f4f1;
  color: var(--teal-dark);
  font-weight: 900;
}

.employee-record-avatar-card {
  width: 52px;
  height: 52px;
  font-size: 16px;
}

.employee-record-avatar-detail {
  width: 88px;
  height: 88px;
  border-radius: 14px;
  font-size: 24px;
}

.employee-record-avatar-header {
  width: 52px;
  height: 52px;
  border-radius: 11px;
  font-size: 15px;
}

.employee-record-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.employee-record-card-identity {
  min-width: 0;
}

.employee-record-card-identity strong,
.employee-record-card-identity span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-record-card-identity strong {
  margin-bottom: 4px;
  font-size: 18px;
}

.employee-record-card-identity span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.employee-record-status,
.employee-record-flag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 25px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.employee-record-status {
  background: #e8edf0;
  color: #475569;
}

.employee-record-status-active {
  background: #dff3e7;
  color: #237141;
}

.employee-record-status-probation {
  background: #fff0d7;
  color: #915d09;
}

.employee-record-status-leave {
  background: #e3f0fb;
  color: #27628c;
}

.employee-record-status-resigned,
.employee-record-status-terminated {
  background: #eeeae4;
  color: #756b5d;
}

.employee-record-status-disabled {
  background: #f1dedd;
  color: #8b3732;
}

.employee-record-card-role {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  border-radius: 8px;
  background: #f8f7f3;
}

.employee-record-card-role strong,
.employee-record-card-role span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-record-card-role span {
  color: var(--muted);
  font-size: 13px;
}

.employee-record-card-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.employee-record-card-meta > div {
  min-width: 0;
  padding: 9px;
  border: 1px solid #ece6dc;
  border-radius: 7px;
  background: #fffefa;
}

.employee-record-card-meta dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.employee-record-card-meta dd {
  margin: 0;
  overflow: hidden;
  color: #34414e;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-record-card-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 25px;
}

.employee-record-flag.warn {
  background: #fff0d2;
  color: #8c5907;
}

.employee-record-flag.danger {
  background: #fde4e2;
  color: #a23834;
}

.employee-record-flag.neutral {
  background: #edf3f2;
  color: #506864;
}

.employee-record-card-open {
  justify-self: end;
  color: var(--teal);
  font-size: 12px;
  font-weight: 850;
}

.employee-records-loading {
  display: grid;
  min-height: 150px;
  place-items: center;
  color: var(--muted);
  font-weight: 750;
}

.employee-records-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
}

.employee-records-pagination > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.employee-records-pagination > div {
  display: flex;
  gap: 8px;
  align-items: center;
}

.employee-records-pagination .input {
  width: auto;
  min-width: 120px;
}

.report-drawer.employee-record-drawer {
  grid-template-rows: auto 48px minmax(0, 1fr) auto;
  width: min(88vw, 1240px);
  min-width: min(780px, 100vw);
}

.report-drawer-head.employee-record-drawer-head {
  align-items: center;
  padding: 17px 20px;
}

.employee-record-drawer-head-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
}

.employee-record-drawer-title {
  display: flex;
  min-width: 0;
  gap: 13px;
  align-items: center;
}

.employee-record-drawer-title > div:last-child {
  min-width: 0;
}

.employee-record-drawer-title h2 {
  overflow: hidden;
  margin: 3px 0 4px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-record-tabs {
  display: flex;
  height: 48px;
  min-height: 48px;
  min-width: 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: #fff;
  scrollbar-width: thin;
}

.employee-record-tabs button {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 11px 16px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: #5e6871;
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.employee-record-tabs button:hover {
  background: #f5f8f7;
  color: var(--teal);
}

.employee-record-tabs button.active {
  border-bottom-color: var(--teal);
  background: #f0f8f6;
  color: var(--teal-dark);
}

.report-drawer-body.employee-record-drawer-body {
  align-content: start;
  background: #f8f7f3;
}

.employee-record-detail-section {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid #e2dbcf;
  border-radius: 10px;
  background: #fff;
}

.employee-record-detail-section-head h3 {
  margin: 0;
  color: #245c55;
  font-size: 17px;
}

.employee-record-detail-section-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.employee-record-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.employee-record-bank-section .employee-record-detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.employee-record-detail-field {
  display: grid;
  min-width: 0;
  min-height: 70px;
  gap: 6px;
  align-content: start;
  padding: 11px 12px;
  border: 1px solid #ece5da;
  border-radius: 8px;
  background: #fffdf9;
}

.employee-record-detail-field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.employee-record-detail-field > strong {
  overflow-wrap: anywhere;
  color: #334155;
  font-size: 14px;
  line-height: 1.48;
  white-space: pre-wrap;
}

.employee-record-detail-field > small {
  color: #94610e;
}

.employee-record-detail-field.is-sensitive,
.employee-record-sensitive-field {
  border-color: #ead7ae;
  background: #fffdf6;
}

.employee-record-textarea {
  min-height: 96px;
  resize: vertical;
}

.employee-record-change-reason {
  grid-column: 1 / -1;
}

.employee-record-incomplete-banner,
.employee-record-boundary-note {
  padding: 13px 15px;
  border: 1px solid #e7c98d;
  border-radius: 9px;
  background: #fffaed;
  color: #6d4a12;
}

.employee-record-boundary-note {
  border-color: #bdd9d5;
  background: #f2f9f7;
  color: #28564f;
}

.employee-record-incomplete-banner strong,
.employee-record-boundary-note strong {
  display: block;
  margin-bottom: 4px;
}

.employee-record-incomplete-banner p,
.employee-record-boundary-note p {
  margin: 0;
  color: inherit;
  font-size: 13px;
  line-height: 1.55;
}

.employee-record-complete-toggle {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 14px 15px;
  border: 1px solid #a9d2c9;
  border-radius: 9px;
  background: #f1faf7;
  cursor: pointer;
}

.employee-record-complete-toggle input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.employee-record-complete-toggle strong,
.employee-record-complete-toggle small {
  display: block;
}

.employee-record-complete-toggle small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
}

.employee-record-avatar-manager {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 15px;
  border: 1px solid #d8e4e1;
  border-radius: 10px;
  background: #f7fbfa;
}

.employee-record-avatar-manager > div:last-child {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.employee-record-avatar-manager span {
  color: var(--muted);
  font-size: 12px;
}

.employee-record-inline-actions,
.employee-record-drawer-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.employee-record-file-label {
  position: relative;
  cursor: pointer;
}

.employee-record-file-label input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.employee-record-file-label.disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.employee-record-inline-error {
  color: var(--red);
  font-weight: 750;
}

.employee-record-documents-panel {
  display: grid;
  gap: 15px;
}

.employee-record-document-list {
  display: grid;
  gap: 12px;
}

.employee-record-documents-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.employee-record-documents-toolbar > div {
  display: grid;
  gap: 3px;
}

.employee-record-documents-toolbar span {
  color: var(--muted);
  font-size: 13px;
}

.employee-record-document-card {
  display: grid;
  gap: 12px;
  padding: 15px;
  border: 1px solid #e1d9cd;
  border-radius: 10px;
  background: #fff;
}

.employee-record-document-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.employee-record-document-card-head > div:first-child {
  min-width: 0;
}

.employee-record-document-card-head strong,
.employee-record-document-card-head span {
  display: block;
}

.employee-record-document-card-head strong {
  overflow: hidden;
  margin-bottom: 4px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.employee-record-document-card-head span {
  color: var(--muted);
  font-size: 12px;
}

.employee-record-document-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.employee-record-document-meta > div {
  min-width: 0;
  padding: 9px 10px;
  border-radius: 7px;
  background: #f8f7f3;
}

.employee-record-document-meta dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
}

.employee-record-document-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: #3d4852;
  font-size: 12px;
}

.employee-record-document-edit-grid,
.employee-record-document-upload-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  padding: 12px;
  border-radius: 8px;
  background: #f6f7f5;
}

.employee-record-document-edit-grid .employee-record-inline-actions {
  grid-column: 1 / -1;
}

.employee-record-document-upload {
  display: grid;
  gap: 12px;
  padding: 15px;
  border: 1px dashed #9cc4bd;
  border-radius: 10px;
  background: #f4faf8;
}

.employee-record-document-upload-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.employee-record-document-upload-head span {
  color: var(--muted);
  font-size: 12px;
}

.employee-record-document-upload-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.employee-record-document-upload > .btn {
  justify-self: start;
}

.employee-record-crm-panel {
  display: grid;
  gap: 15px;
}

.employee-record-crm-panel > .btn {
  justify-self: start;
}

.employee-record-crm-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
  margin: 0;
}

.employee-record-crm-grid > div {
  min-width: 0;
  padding: 13px;
  border: 1px solid #e5ded3;
  border-radius: 8px;
  background: #fff;
}

.employee-record-crm-grid dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.employee-record-crm-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: #334155;
  font-weight: 800;
}

.employee-record-audit-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.employee-record-audit-list li {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  padding: 0 0 18px;
}

.employee-record-audit-list li:not(:last-child)::before {
  position: absolute;
  top: 14px;
  bottom: 0;
  left: 6px;
  width: 2px;
  background: #cbded9;
  content: "";
}

.employee-record-audit-dot {
  z-index: 1;
  width: 14px;
  height: 14px;
  margin-top: 3px;
  border: 3px solid #dff0ec;
  border-radius: 50%;
  background: var(--teal);
}

.employee-record-audit-list li > div {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid #e4ddd2;
  border-radius: 9px;
  background: #fff;
}

.employee-record-audit-list p {
  margin: 6px 0;
  color: #3e4852;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.employee-record-audit-list li > div > span {
  color: var(--muted);
  font-size: 11px;
}

.employee-record-drawer-alert {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 0;
}

.report-drawer-actions.employee-record-drawer-actions {
  flex-wrap: wrap;
}

.employee-record-delete-button.btn {
  border-color: #efc4c1;
  background: #fff5f4;
  color: #a33631;
}

@media (max-width: 1280px) {
  .employee-records-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .employee-records-filter-main {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .employee-records-filter-main .field:first-child {
    grid-column: 1 / -1;
  }

  .employee-records-filter-secondary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 980px) {
  .report-drawer.employee-record-drawer {
    width: 100vw;
    min-width: 0;
  }

  .employee-record-detail-grid,
  .employee-record-crm-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .employee-record-document-upload-grid,
  .employee-record-document-edit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .employee-records-report-entry,
  .employee-records-hero,
  .employee-records-result-head,
  .employee-records-pagination,
  .employee-record-document-card-head,
  .employee-record-documents-toolbar,
  .employee-record-document-upload-head,
  .employee-record-drawer-alert {
    align-items: stretch;
    flex-direction: column;
  }

  .employee-records-report-entry-copy span {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .employee-records-hero .btn,
  .employee-records-report-entry > .btn {
    width: 100%;
  }

  .employee-records-summary-grid,
  .employee-records-filter-main,
  .employee-records-filter-secondary,
  .employee-records-grid,
  .employee-record-detail-grid,
  .employee-record-document-meta,
  .employee-record-document-upload-grid,
  .employee-record-document-edit-grid,
  .employee-record-crm-grid {
    grid-template-columns: 1fr;
  }

  .employee-record-bank-section .employee-record-detail-grid {
    grid-template-columns: 1fr;
  }

  .employee-record-document-upload-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .employee-records-filter-main .field:first-child {
    grid-column: auto;
  }

  .employee-records-result-head span {
    text-align: left;
  }

  .employee-records-pagination > div {
    width: 100%;
    flex-wrap: wrap;
  }

  .employee-records-pagination > div .btn {
    flex: 1;
  }

  .employee-records-pagination .input {
    width: 100%;
  }

  .employee-record-card {
    min-height: 0;
  }

  .employee-record-card-meta {
    grid-template-columns: 1fr;
  }

  .report-drawer-head.employee-record-drawer-head,
  .report-drawer-actions.employee-record-drawer-actions {
    display: flex;
    align-items: stretch;
    flex-direction: column;
  }

  .employee-record-drawer-title {
    align-items: flex-start;
  }

  .employee-record-drawer-head-actions,
  .employee-record-drawer-head-actions .btn {
    width: 100%;
  }

  .employee-record-avatar-header {
    width: 44px;
    height: 44px;
  }

  .employee-record-tabs button {
    min-height: 44px;
    padding: 10px 13px;
  }

  .report-drawer-body.employee-record-drawer-body {
    padding: 14px;
  }

  .employee-record-avatar-manager {
    align-items: flex-start;
  }

  .employee-record-drawer-action-buttons,
  .employee-record-drawer-action-buttons .btn {
    width: 100%;
  }

  .employee-record-document-edit-grid .employee-record-inline-actions {
    grid-column: auto;
  }
}

@media (max-width: 460px) {
  .employee-record-card-head {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .employee-record-card-head .employee-record-status {
    grid-column: 1 / -1;
  }

  .employee-record-avatar-manager {
    flex-direction: column;
  }
}

.status-pill.success {
  background: #e8f7f2;
  color: var(--teal-dark);
}

.status-pill.warn {
  background: #fff7e6;
  color: #925305;
}

.status-pill.muted {
  background: #f1f2f3;
  color: #5f6870;
}

.status-pill.danger {
  background: #fff1f2;
  color: #b91c1c;
}

.trade-ledger-detail-section {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
}

.trade-ledger-detail-section h3 {
  color: var(--teal);
  font-size: 17px;
}

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

.trade-ledger-detail-item {
  min-width: 0;
  padding: 10px;
  border: 1px solid #eee7da;
  border-radius: 8px;
  background: #fff;
}

.trade-ledger-detail-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.trade-ledger-detail-item strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.trade-ledger-submission-section {
  align-content: start;
  gap: 8px;
  padding: 12px;
}

.trade-ledger-submission-head,
.trade-ledger-submission-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.trade-ledger-submission-head h3,
.trade-ledger-submission-head p {
  margin: 0;
}

.trade-ledger-submission-head p,
.trade-ledger-submission-block-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.trade-ledger-submission-warning {
  padding: 8px 10px;
  border-left: 3px solid #dc2626;
  background: #fff5f5;
  color: #991b1b;
  font-size: 13px;
  font-weight: 750;
}

.trade-ledger-submission-completion {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #d9dee3;
  border-left-width: 4px;
  border-radius: 8px;
  background: #f8fafb;
}

.trade-ledger-submission-completion.is-success {
  border-color: #9ed5c7;
  background: #f0faf7;
}

.trade-ledger-submission-completion.is-warn {
  border-color: #efc885;
  background: #fff9ed;
}

.trade-ledger-submission-completion.is-danger {
  border-color: #efb4b4;
  background: #fff5f5;
}

.trade-ledger-submission-completion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.trade-ledger-submission-completion > p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.trade-ledger-submission-completion dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.trade-ledger-submission-completion dl > div {
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(82, 96, 109, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
}

.trade-ledger-submission-completion dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.trade-ledger-submission-completion dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 800;
}

.trade-ledger-submission-block-head {
  margin-top: 3px;
}

.trade-ledger-submission-compare-grid,
.trade-ledger-submission-meta-grid {
  display: grid;
  overflow: hidden;
  border: 1px solid #e4ded3;
  background: #fff;
  gap: 0;
}

.trade-ledger-submission-compare-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.trade-ledger-submission-compare-item {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 8px 9px;
  border-right: 1px solid #e4ded3;
  border-bottom: 1px solid #e4ded3;
  background: #fff;
}

.trade-ledger-submission-compare-item.is-mismatch {
  background: #fff8f7;
  box-shadow: inset 3px 0 #dc2626;
}

.trade-ledger-submission-compare-title {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.trade-ledger-submission-compare-title strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.trade-ledger-submission-compare-title .status-pill {
  flex: 0 0 auto;
  padding: 3px 6px;
  font-size: 10px;
}

.trade-ledger-submission-value-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 6px;
  align-items: baseline;
  font-size: 12px;
}

.trade-ledger-submission-value-row span {
  color: var(--muted);
  font-weight: 700;
}

.trade-ledger-submission-value-row b {
  min-width: 0;
  overflow-wrap: anywhere;
}

.trade-ledger-submission-compare-item.is-mismatch .trade-ledger-submission-value-row b {
  color: #991b1b;
}

.trade-ledger-submission-meta-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.trade-ledger-submission-meta-item {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 7px 9px;
  border-right: 1px solid #e4ded3;
  border-bottom: 1px solid #e4ded3;
  background: #fff;
}

.trade-ledger-submission-meta-item.is-wide {
  grid-column: span 2;
}

.trade-ledger-submission-meta-item span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.trade-ledger-submission-meta-item strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.35;
}

.trade-ledger-submission-empty {
  min-height: 150px;
  display: grid;
  place-items: center;
  border: 1px dashed #d8d2c7;
  color: var(--muted);
  font-weight: 750;
}

@media (max-width: 1280px) {
  .trade-ledger-submission-compare-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .trade-ledger-submission-meta-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .trade-ledger-submission-compare-grid,
  .trade-ledger-submission-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .trade-ledger-submission-head,
  .trade-ledger-submission-block-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .trade-ledger-submission-compare-grid,
  .trade-ledger-submission-meta-grid {
    grid-template-columns: 1fr;
  }

  .trade-ledger-submission-meta-item.is-wide {
    grid-column: auto;
  }
}

/*
TRADE_LEDGER_COMPACT_READONLY_RULE:
- Existing ledgers open in a compact read-only overview
- Read-only fields never render form controls
- Basic information uses four equal desktop columns, then three, two and one responsive columns
- Recorder displays the immutable first-creator account rather than the latest editor
- Amount summary reads persisted server results and never recalculates business values
- Editing keeps the existing full form layout
*/
.trade-ledger-readonly-overview {
  background: #fffefb;
}

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

.ledger-readonly-field {
  min-width: 0;
  min-height: 58px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid #e8e2d7;
  border-radius: 8px;
  background: #fff;
}

.ledger-readonly-field.is-primary {
  border-color: #c9ded6;
  background: #f4faf7;
}

.ledger-readonly-label {
  color: #6b747a;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
}

.ledger-readonly-value {
  min-width: 0;
  color: #26323a;
  font-size: 14px;
  font-weight: 850;
  line-height: 1.4;
  overflow-wrap: anywhere;
  white-space: normal;
}

.ledger-readonly-field.is-primary .ledger-readonly-value {
  color: var(--teal-dark);
  font-size: 15px;
}

.ledger-readonly-field.is-empty .ledger-readonly-value {
  color: #9aa1a5;
  font-weight: 700;
}

.trade-ledger-core-amount-summary {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #dbe6e1;
  border-radius: 8px;
  background: #f8fbf9;
}

.trade-ledger-core-amount-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 12px;
}

.trade-ledger-core-amount-head h4 {
  margin: 0;
  color: #26323a;
  font-size: 14px;
  font-weight: 900;
}

.trade-ledger-core-amount-head > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.trade-ledger-core-amount-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.trade-ledger-core-amount-item {
  min-width: 0;
  min-height: 86px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  border: 1px solid #e3e8e5;
  border-radius: 8px;
  background: #fff;
  text-align: center;
}

.trade-ledger-core-amount-item > span,
.trade-ledger-core-amount-item > strong,
.trade-ledger-core-amount-item > small {
  display: block;
  width: 100%;
  text-align: center;
  overflow-wrap: anywhere;
}

.trade-ledger-core-amount-item > span {
  color: #6b747a;
  font-size: 11px;
  font-weight: 800;
}

.trade-ledger-core-amount-item > strong {
  color: #26323a;
  font-size: 18px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.trade-ledger-core-amount-item > small {
  min-height: 14px;
  color: #7b8489;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.35;
}

.trade-ledger-core-amount-item.warn {
  border-color: #ead8a7;
  background: #fffaf0;
}

.trade-ledger-core-amount-item.profit-success {
  border-color: #bedfd2;
  background: #f2faf6;
}

.trade-ledger-core-amount-item.profit-success > strong {
  color: #146b54;
}

.trade-ledger-core-amount-item.profit-danger {
  border-color: #efc8c2;
  background: #fff6f4;
}

.trade-ledger-core-amount-item.profit-danger > strong {
  color: #b42318;
}

.trade-ledger-core-amount-item.profit-warn > strong {
  color: #9a6508;
}

.trade-ledger-core-amount-item.profit-muted > strong {
  color: #59636a;
}

.trade-ledger-detail-panel.is-readonly .trade-ledger-amount-v2 {
  gap: 8px;
}

.trade-ledger-detail-panel.is-readonly .trade-ledger-amount-group {
  gap: 6px;
  padding: 8px;
}

.trade-ledger-detail-panel.is-readonly .trade-ledger-detail-item {
  min-height: 54px;
  padding: 8px 10px;
}

.trade-ledger-detail-panel.is-readonly .ledger-readonly-field {
  min-height: 54px;
  gap: 4px;
  padding: 8px 10px;
}

.trade-ledger-detail-panel.is-readonly .trade-ledger-core-amount-summary {
  gap: 8px;
  padding: 10px;
}

.trade-ledger-detail-panel.is-readonly .trade-ledger-core-amount-item {
  min-height: 80px;
  gap: 5px;
  padding: 8px;
}

.trade-ledger-detail-panel.is-readonly .trade-ledger-profit-summary {
  gap: 8px;
  padding: 10px;
  box-shadow: none;
}

.trade-ledger-detail-panel.is-readonly .trade-ledger-profit-metric {
  min-height: 76px;
  gap: 6px;
  padding: 10px;
}

.trade-ledger-detail-panel.is-readonly .trade-ledger-profit-metric strong,
.trade-ledger-detail-panel.is-readonly .trade-ledger-profit-metric.is-primary strong {
  font-size: 23px;
}

@media (max-width: 1180px) {
  .ledger-readonly-grid,
  .trade-ledger-core-amount-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .ledger-readonly-grid,
  .trade-ledger-core-amount-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .trade-ledger-detail-panel.is-readonly > .modal-head {
    align-items: flex-start;
    gap: 10px;
  }

  .trade-ledger-detail-panel.is-readonly > .modal-head .form-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .trade-ledger-detail-panel.is-readonly .trade-ledger-detail-body {
    padding: 12px;
  }

  .ledger-readonly-grid,
  .trade-ledger-core-amount-grid {
    grid-template-columns: 1fr;
  }

}

.trade-ledger-commission-body {
  gap: 12px;
  align-content: start;
  padding-top: 14px;
}

.trade-ledger-commission-form-alert {
  min-height: 0;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  line-height: 1.35;
}

.trade-ledger-commission-summary {
  gap: 12px;
  padding: 16px 18px;
}

.trade-ledger-commission-summary-header {
  min-height: 30px;
}

.trade-ledger-commission-summary .trade-ledger-commission-summary-header,
.trade-ledger-commission-list-section .trade-ledger-commission-list-header {
  margin-bottom: 0;
}

.trade-ledger-commission-summary-header h3,
.trade-ledger-commission-list-header h3 {
  margin: 0;
}

.trade-ledger-commission-status-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px 8px;
}

.trade-ledger-commission-status-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
  white-space: nowrap;
}

.trade-ledger-commission-anomaly {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
  white-space: nowrap;
}

.trade-ledger-commission-anomaly.ok {
  border-color: rgba(15, 118, 110, 0.2);
  background: #e8f7f2;
  color: var(--teal-dark);
}

.trade-ledger-commission-anomaly.warn {
  border-color: rgba(217, 119, 6, 0.24);
  background: #fff7e6;
  color: #925305;
}

.trade-ledger-commission-anomaly.danger {
  border-color: rgba(185, 28, 28, 0.22);
  background: #fff1f2;
  color: #b91c1c;
}

.trade-ledger-commission-summary-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.trade-ledger-commission-stat {
  min-height: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  text-align: center;
}

.trade-ledger-commission-stat .trade-ledger-commission-stat-label {
  width: 100%;
  margin: 0 0 5px;
  font-size: 12px;
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
}

.trade-ledger-commission-stat .trade-ledger-commission-stat-value {
  width: 100%;
  margin: 0;
  font-size: 22px;
  font-weight: 850;
  line-height: 1.1;
  text-align: center;
}

.trade-ledger-commission-summary .trade-ledger-compact-notice {
  min-height: 40px;
  padding: 7px 10px;
}

.trade-ledger-subtable {
  min-width: 960px;
}

.trade-ledger-commission-list-section {
  min-height: 0;
  gap: 12px;
  padding: 16px 18px;
}

.trade-ledger-commission-list-header {
  min-height: 30px;
  margin-bottom: 0;
}

/*
TRADE_LEDGER_COMMISSION_PERSONNEL_UI_RULE:
- Currency stays fixed to CNY and has no visible column
- Personnel labels show employee names only and share one control height
- Header, saved rows and create row use the same desktop grid template
- Desktop rows never rely on horizontal scrolling
- Smaller screens wrap into grouped rows or cards
*/
.trade-ledger-commission-table-wrap {
  max-width: 100%;
  overflow: hidden;
  border: 1px solid #eee7da;
  border-radius: 8px;
  background: #fff;
}

.trade-ledger-commission-table {
  --commission-grid-template:
    104px
    minmax(128px, 1.2fr)
    72px
    100px
    146px
    92px
    116px
    62px
    minmax(84px, 0.8fr)
    68px;
  width: 100%;
  min-width: 0;
  font-size: 13px;
}

.trade-ledger-commission-header,
.trade-ledger-commission-row {
  display: grid;
  grid-template-columns: var(--commission-grid-template);
  gap: 8px;
  width: 100%;
  min-width: 0;
  align-items: center;
  padding: 8px;
  box-sizing: border-box;
}

.trade-ledger-commission-header {
  min-height: 44px;
  border-bottom: 1px solid #eee7da;
  background: #faf8f3;
  color: #4c565d;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.25;
  text-align: center;
}

.trade-ledger-commission-row {
  min-height: 54px;
  border-bottom: 1px solid #f0ebe2;
  background: #fff;
}

.trade-ledger-commission-row:last-child {
  border-bottom: 0;
}

.trade-ledger-commission-row.trade-ledger-new-row {
  background: #f8fbfa;
}

.trade-ledger-commission-row.has-foreign-currency {
  box-shadow: inset 3px 0 0 #d97706;
  background: #fffaf0;
}

.trade-ledger-commission-cell {
  position: relative;
  min-width: 0;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  text-align: center;
  overflow-wrap: anywhere;
}

.trade-ledger-commission-table .input,
.trade-ledger-commission-table .select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 38px;
  min-height: 38px;
  padding: 0 9px;
  font-size: 13px;
  box-sizing: border-box;
}

.trade-ledger-commission-table input[type='date'] {
  padding-right: 5px;
  font-size: 12px;
}

.trade-ledger-commission-readonly-amount {
  color: #24312f;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.trade-ledger-commission-user-cell {
  min-width: 0;
}

.trade-ledger-commission-manual-person {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 4px;
  align-items: center;
}

.trade-ledger-commission-person-return,
.trade-ledger-commission-icon-action,
.trade-ledger-commission-add-action {
  height: 38px;
  min-width: 0;
  border: 1px solid #d9d2c5;
  border-radius: 7px;
  background: #fff;
  color: #44504e;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.trade-ledger-commission-person-return {
  padding: 0 4px;
  font-size: 11px;
}

.trade-ledger-commission-row-actions {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.trade-ledger-commission-icon-action {
  width: 100%;
  padding: 0;
  font-size: 16px;
}

.trade-ledger-commission-icon-action.save,
.trade-ledger-commission-add-action {
  border-color: rgba(15, 118, 110, 0.3);
  background: var(--teal);
  color: #fff;
}

.trade-ledger-commission-icon-action.delete {
  border-color: #f0c8c8;
  background: #fff7f7;
  color: #b91c1c;
}

.trade-ledger-commission-add-action {
  width: 100%;
  padding: 0 5px;
  font-size: 12px;
}

.trade-ledger-commission-person-return:hover,
.trade-ledger-commission-icon-action:hover,
.trade-ledger-commission-add-action:hover {
  filter: brightness(0.97);
}

.trade-ledger-commission-person-return:disabled,
.trade-ledger-commission-icon-action:disabled,
.trade-ledger-commission-add-action:disabled {
  cursor: wait;
  opacity: 0.6;
}

.trade-ledger-commission-cell-actual .input.has-warning {
  border-color: #d97706;
  padding-right: 24px;
}

.trade-ledger-commission-actual-control {
  position: relative;
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 4px;
  align-items: center;
}

.trade-ledger-commission-actual-control .select,
.trade-ledger-commission-actual-control .input {
  height: 34px;
  min-height: 34px;
  padding-right: 5px;
  padding-left: 6px;
  font-size: 11px;
}

.trade-ledger-commission-actual-control .input.is-auto {
  border-color: #d7e6e1;
  background: #f2f7f5;
  color: #24413a;
  font-weight: 800;
  cursor: default;
}

.trade-ledger-commission-warning-dot {
  position: absolute;
  top: 3px;
  right: 4px;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff7e6;
  color: #925305;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.trade-ledger-commission-inline-alert {
  min-height: 0;
  margin: 0;
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1.35;
}

.trade-ledger-commission-empty {
  min-height: 64px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 12px;
  border: 1px dashed #ded7ca;
  border-radius: 8px;
  background: #fff;
  text-align: center;
}

@media (max-width: 1139px) {
  .trade-ledger-commission-table {
    --commission-grid-template: repeat(5, minmax(0, 1fr));
  }

  .trade-ledger-commission-header,
  .trade-ledger-commission-row {
    row-gap: 8px;
  }

  .trade-ledger-commission-header .trade-ledger-commission-cell:nth-child(n + 6),
  .trade-ledger-commission-row .trade-ledger-commission-cell:nth-child(n + 6) {
    padding-top: 8px;
    border-top: 1px solid #eee7da;
  }
}

@media (max-width: 760px) {
  .trade-ledger-commission-header {
    display: none;
  }

  .trade-ledger-commission-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    padding: 10px;
  }

  .trade-ledger-commission-row .trade-ledger-commission-cell {
    min-height: 60px;
    display: grid;
    align-content: start;
    gap: 5px;
    padding: 0;
    border-top: 0;
    text-align: left;
  }

  .trade-ledger-commission-row .trade-ledger-commission-cell::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
    line-height: 1.2;
  }

  .trade-ledger-commission-row .trade-ledger-commission-cell-lock,
  .trade-ledger-commission-row .trade-ledger-commission-cell-actions {
    align-content: center;
  }
}

@media (max-width: 480px) {
  .trade-ledger-commission-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 980px) {
  .trade-ledger-commission-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .trade-ledger-commission-summary,
  .trade-ledger-commission-list-section {
    padding: 14px;
  }

  .trade-ledger-commission-summary-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .trade-ledger-commission-status-group {
    justify-content: flex-start;
  }

  .trade-ledger-commission-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .trade-ledger-commission-stat {
    min-height: 72px;
    padding: 8px 10px;
  }
}

.trade-ledger-commission-warning {
  display: block;
  margin-top: 4px;
  color: #a15c05;
  font-size: 12px;
  line-height: 1.35;
  white-space: normal;
}

.trade-ledger-commission-lock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  color: #53615d;
  font-weight: 850;
}

.trade-ledger-legacy-commission {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #f2d6a2;
  border-radius: 8px;
  background: #fffaf0;
  color: #5f4520;
}

.trade-ledger-legacy-commission small {
  color: #a15c05;
  font-weight: 850;
}

.trade-ledger-audit-list {
  display: grid;
  gap: 10px;
}

.trade-ledger-audit-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #eee7da;
  border-radius: 8px;
  background: #fff;
}

.trade-ledger-audit-item span,
.trade-ledger-audit-item small {
  color: var(--muted);
}

.trade-ledger-version-history-section {
  gap: 16px;
  background: #fff;
}

.trade-ledger-version-history-head {
  align-items: flex-start;
  gap: 18px;
}

.trade-ledger-version-history-head h3 {
  margin: 0;
}

.trade-ledger-version-history-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.trade-ledger-version-history-actions,
.trade-ledger-version-badges,
.trade-ledger-version-card-actions,
.trade-ledger-version-modal-actions,
.trade-ledger-version-preview-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.trade-ledger-version-history-actions {
  justify-content: flex-end;
}

.trade-ledger-version-timeline {
  position: relative;
  display: grid;
  gap: 12px;
}

.trade-ledger-version-timeline::before {
  content: '';
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 9px;
  width: 2px;
  background: #dce6e2;
}

.trade-ledger-version-item {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}

.trade-ledger-version-marker {
  position: relative;
  z-index: 1;
  width: 12px;
  height: 12px;
  margin: 18px 0 0 4px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #8b9692;
  box-shadow: 0 0 0 1px #bcc9c5;
}

.trade-ledger-version-item.is-current .trade-ledger-version-marker {
  background: var(--teal);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.2);
}

.trade-ledger-version-item.is-legacy .trade-ledger-version-marker {
  background: #c2c7ca;
}

.trade-ledger-version-card {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid #e7e2d8;
  border-radius: 8px;
  background: #fffdf9;
}

.trade-ledger-version-item.is-current .trade-ledger-version-card {
  border-color: rgba(15, 118, 110, 0.28);
  background: #f7fcfa;
}

.trade-ledger-version-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.trade-ledger-version-card-head > div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.trade-ledger-version-card-head strong {
  color: var(--ink);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.trade-ledger-version-card-head span,
.trade-ledger-version-card-body span,
.trade-ledger-version-card-body small {
  color: var(--muted);
  font-size: 12px;
}

.trade-ledger-version-card-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px 12px;
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid #eee9df;
}

.trade-ledger-version-card-body > span {
  padding: 3px 7px;
  border-radius: 999px;
  background: #f0f2f1;
  color: #52605b;
  font-weight: 800;
  white-space: nowrap;
}

.trade-ledger-version-card-body p {
  min-width: 0;
  margin: 0;
  color: #3e4945;
  overflow-wrap: anywhere;
}

.trade-ledger-version-card-body small {
  grid-column: 1 / -1;
  line-height: 1.5;
}

.trade-ledger-version-card-actions {
  justify-content: flex-end;
  margin-top: 12px;
}

.trade-ledger-version-card-actions .btn {
  min-height: 34px;
  padding: 7px 10px;
}

.trade-ledger-version-modal-backdrop {
  z-index: 90;
}

.trade-ledger-version-modal {
  width: min(920px, calc(100vw - 48px));
  max-height: min(820px, calc(100vh - 48px));
  overflow: hidden;
}

.trade-ledger-version-modal-head {
  position: relative;
}

.trade-ledger-version-modal-body {
  display: grid;
  gap: 14px;
  max-height: calc(100vh - 230px);
  padding: 18px 22px;
  overflow: auto;
}

.trade-ledger-version-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.trade-ledger-version-meta-grid > div,
.trade-ledger-version-summary-box {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #ebe6dc;
  border-radius: 8px;
  background: #fffdf9;
}

.trade-ledger-version-meta-grid span,
.trade-ledger-version-summary-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.trade-ledger-version-meta-grid strong,
.trade-ledger-version-summary-box strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.trade-ledger-version-diff {
  overflow: hidden;
  border: 1px solid #e5e1d8;
  border-radius: 8px;
  background: #fff;
}

.trade-ledger-version-diff-head,
.trade-ledger-version-diff-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.trade-ledger-version-diff-head {
  background: #f4f5f3;
  color: #53605b;
  font-size: 12px;
  font-weight: 850;
}

.trade-ledger-version-diff-head span,
.trade-ledger-version-diff-row > * {
  min-width: 0;
  padding: 10px 12px;
  border-right: 1px solid #e8e5de;
}

.trade-ledger-version-diff-head span:last-child,
.trade-ledger-version-diff-row > *:last-child {
  border-right: 0;
}

.trade-ledger-version-diff-row + .trade-ledger-version-diff-row {
  border-top: 1px solid #ece8df;
}

.trade-ledger-version-diff-row strong {
  display: flex;
  align-items: center;
  color: #34413c;
  font-size: 13px;
}

.trade-ledger-version-diff-row span {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: #39443f;
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.trade-ledger-version-before {
  background: #fff8f7;
}

.trade-ledger-version-after {
  background: #f5fbf8;
  color: #135f55;
  font-weight: 800;
}

.trade-ledger-version-before::before,
.trade-ledger-version-after::before {
  display: none;
}

.trade-ledger-version-empty-change {
  margin: 0;
  padding: 16px;
  border: 1px dashed #d9d6ce;
  border-radius: 8px;
  text-align: center;
}

.trade-ledger-version-preview-title {
  justify-content: space-between;
}

.trade-ledger-version-scope-warning,
.trade-ledger-version-confirm-note {
  line-height: 1.55;
}

.trade-ledger-version-reason-field {
  margin-top: 2px;
}

.trade-ledger-version-reason-field textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
}

.trade-ledger-version-confirm-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.trade-ledger-version-confirm-check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  padding: 11px 12px;
  border: 1px solid #d8e2de;
  border-radius: 8px;
  background: #f7fbf9;
  color: #34413c;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.5;
}

.trade-ledger-version-confirm-check input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--teal);
}

.trade-ledger-version-modal-actions {
  justify-content: flex-end;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: #fffdf9;
}

.duplicate-customer-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  margin: 6px auto 0;
  padding: 3px 8px;
  border: 1px solid #f1c27d;
  border-radius: 999px;
  background: #fff6df;
  color: #9a4d0a;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

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

.duplicate-customer-panel.has-duplicates {
  border-color: #f1c27d;
  background: #fffaf0;
}

.duplicate-customer-summary,
.duplicate-customer-phone,
.duplicate-customer-owners,
.duplicate-customer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.duplicate-customer-summary {
  justify-content: space-between;
}

.duplicate-customer-summary strong {
  display: block;
  font-size: 16px;
}

.duplicate-customer-summary small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 650;
}

.duplicate-count-pill {
  background: #fff0d5;
  color: #8a5a0b;
}

.duplicate-customer-list {
  display: grid;
  gap: 8px;
}

.duplicate-customer-item {
  display: grid;
  grid-template-columns: minmax(210px, 0.8fr) minmax(180px, 0.7fr) minmax(280px, 1.5fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #efe4d2;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.duplicate-customer-phone span,
.duplicate-customer-owners span,
.duplicate-customer-links small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.duplicate-customer-owners {
  min-width: 0;
}

.duplicate-customer-owners strong {
  color: var(--teal-dark);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.duplicate-customer-links {
  justify-content: flex-end;
}

@media (max-width: 1100px) {
  .duplicate-customer-item {
    grid-template-columns: minmax(180px, 1fr) minmax(160px, 1fr);
  }

  .duplicate-customer-links {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 700px) {
  .duplicate-customer-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .duplicate-customer-links {
    grid-column: auto;
  }
}

.orders-table {
  min-width: 1180px;
}

.orders-table th,
.orders-table td {
  text-align: center;
  vertical-align: middle;
}

.orders-table strong {
  display: block;
  line-height: 1.35;
}

.orders-table .link-button {
  max-width: 230px;
  text-align: center;
}

.order-status-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.order-status {
  min-height: 26px;
  border: 1px solid transparent;
  text-transform: none;
}

.status-pill.order-status.order-confirmed {
  border-color: #b7ddd4;
  background: #e4f5f1;
  color: #0f766e;
}

.status-pill.order-status.order-processing,
.status-pill.order-status.payment-partial_paid,
.status-pill.order-status.production-in_production {
  border-color: #c9dcf7;
  background: #eaf2ff;
  color: #245ea8;
}

.status-pill.order-status.order-purchased {
  border-color: #d7ccef;
  background: #f1edfb;
  color: #674b9d;
}

.status-pill.order-status.order-completed,
.status-pill.order-status.payment-paid,
.status-pill.order-status.shipping-delivered {
  border-color: #bfe1c9;
  background: #e6f6ea;
  color: #216e3a;
}

.status-pill.order-status.order-paused,
.status-pill.order-status.payment-pending {
  border-color: #efd6a4;
  background: #fff4dc;
  color: #8a5700;
}

.status-pill.order-status.payment-deposit_paid,
.status-pill.order-status.order-shipped,
.status-pill.order-status.shipping-booking,
.status-pill.order-status.shipping-shipped {
  border-color: #bddce8;
  background: #e8f6fb;
  color: #1b6b84;
}

.status-pill.order-status.order-ready_to_ship {
  border-color: #efd6a4;
  background: #fff4dc;
  color: #8a5700;
}

.status-pill.order-status.production-pending,
.status-pill.order-status.shipping-pending,
.status-pill.order-status.order-empty,
.status-pill.order-status.payment-empty,
.status-pill.order-status.production-empty,
.status-pill.order-status.shipping-empty {
  border-color: #d9dee3;
  background: #eef1f4;
  color: #58636d;
}

.status-pill.order-status.production-inspection {
  border-color: #d8d0ec;
  background: #f0edfa;
  color: #69519a;
}

.status-pill.order-status.production-ready {
  border-color: #cbd3ed;
  background: #eef0fb;
  color: #4c5d99;
}

.status-pill.order-status.order-cancelled,
.status-pill.order-status.order-exception,
.status-pill.order-status.payment-overdue,
.status-pill.order-status.production-delayed,
.status-pill.order-status.shipping-delayed {
  border-color: #f0bcbc;
  background: #ffe8e8;
  color: #a92525;
}

.order-modal {
  width: min(1180px, calc(100vw - 48px));
}

.order-modal-head-actions {
  align-items: center;
  justify-content: flex-end;
}

.order-form {
  padding: 22px;
}

.order-form-fieldset {
  min-width: 0;
  display: grid;
  gap: 18px;
  margin: 0;
  padding: 0;
  border: 0;
}

.order-form-fieldset:disabled {
  opacity: 1;
}

.order-form.is-readonly .input,
.order-form.is-readonly .textarea,
.order-form.is-readonly select {
  color: var(--ink);
  opacity: 1;
  -webkit-text-fill-color: var(--ink);
}

.order-readonly-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid #b7ddd4;
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  background: #eef9f6;
  color: var(--teal-dark);
}

.order-readonly-notice span {
  color: #48645e;
  font-size: 12px;
  font-weight: 700;
}

.orders-table tbody tr.is-completion-locked > td {
  background: #f7faf9;
}

.sales-order-completion-backdrop {
  z-index: 80;
}

.modal-panel.sales-order-completion-modal {
  width: min(560px, calc(100vw - 32px));
}

.sales-order-completion-form {
  display: grid;
  gap: 16px;
  padding: 20px 22px 22px;
}

.sales-order-completion-warning {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  border: 1px solid #efc885;
  border-left: 4px solid #c7770b;
  border-radius: 8px;
  background: #fff9ed;
  color: #74450b;
}

.sales-order-completion-warning.is-unlock {
  border-color: #b7ddd4;
  border-left-color: var(--teal);
  background: #eef9f6;
  color: var(--teal-dark);
}

.sales-order-completion-warning p {
  margin: 0;
  color: inherit;
  font-size: 13px;
  line-height: 1.55;
}

.sales-order-completion-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin: 0;
}

.sales-order-completion-summary > div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.sales-order-completion-summary dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.sales-order-completion-summary dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.sales-order-completion-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 12px;
  border: 1px solid #b7ddd4;
  border-radius: 8px;
  background: #f2faf8;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.sales-order-completion-check input {
  flex: 0 0 auto;
  margin-top: 2px;
}

.orders-missing-pi-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 14px;
  border: 1px solid #efc885;
  border-radius: 6px;
  background: #fff9ed;
  color: #74450b;
}

.orders-missing-pi-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.orders-missing-pi-copy strong {
  color: #8a4b08;
  font-size: 14px;
}

.orders-missing-pi-copy span {
  color: #765526;
  font-size: 12px;
  line-height: 1.45;
}

.orders-missing-pi-filter.btn {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 12px;
}

.orders-table tbody tr.is-missing-pi > td {
  background: #fffcf5;
}

.order-customer-hint {
  margin-bottom: 0;
}

.order-attachment-section {
  padding-top: 2px;
}

.order-attachment-panel {
  background: #f9fbfb;
}

.analytics-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1.2fr) minmax(260px, 0.8fr);
  gap: 16px;
}

.analytics-bars,
.field-total-list {
  display: grid;
  gap: 10px;
}

.analytics-row,
.field-total-item {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(120px, 2fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.field-total-item {
  grid-template-columns: minmax(180px, 1fr) auto;
}

.analytics-row strong,
.field-total-item strong {
  color: var(--ink);
}

.analytics-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.analytics-meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5edf1;
}

.analytics-meter span {
  display: block;
  min-width: 8px;
  max-width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.analytics-table th,
.analytics-table td {
  text-align: center;
  vertical-align: middle;
}

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

.chart-panel {
  display: grid;
  align-content: start;
  gap: 12px;
}

.bar-list {
  display: grid;
  gap: 13px;
}

.bar-row {
  display: grid;
  gap: 6px;
}

.bar-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #34404a;
}

.bar-row-head span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 750;
}

.bar-row-head strong {
  color: var(--ink);
}

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

.bar-track {
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6edf0;
}

.bar-fill {
  display: block;
  min-width: 9px;
  max-width: 100%;
  height: 100%;
  border-radius: inherit;
}

.bar-fill.teal {
  background: var(--teal);
}

.bar-fill.blue {
  background: var(--blue);
}

.bar-fill.gold {
  background: var(--gold);
}

.bar-fill.green {
  background: var(--green);
}

.analytics-employee-panel {
  display: grid;
  gap: 14px;
}

/*
ANALYTICS_DEPARTMENT_COMMAND_CENTER_RULE:
- The dashboard is organized as global overview, four department boards and one alert center
- Only sales, operations, purchase and admin receive department cards
- Management information belongs in the global overview or alert center
- Dashboard styles stay under analytics-command classes and must not change global cards or tables
- Department cards use stable existing CRM and work-report fields; unavailable metrics use labeled equivalents
*/
.analytics-page {
  --analytics-command-ink: #20312f;
  --analytics-command-muted: #697774;
  --analytics-command-line: #e7e4dc;
}

.analytics-command-overview-section,
.analytics-command-departments-section {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.analytics-command-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
}

.analytics-command-section-head > div {
  min-width: 0;
}

.analytics-command-section-head h2 {
  margin: 2px 0 4px;
  color: var(--analytics-command-ink);
  font-size: clamp(20px, 2vw, 27px);
  letter-spacing: -0.03em;
}

.analytics-command-section-head p {
  margin: 0;
  color: var(--analytics-command-muted);
  font-size: 13px;
  line-height: 1.5;
}

.analytics-command-section-kicker {
  color: #168477;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.analytics-command-live-badge,
.analytics-command-section-count,
.analytics-command-alert-summary {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid #dce7e3;
  border-radius: 999px;
  background: #f7fbf9;
  color: #53706a;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.analytics-command-live-badge i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2eaa78;
  box-shadow: 0 0 0 4px rgb(46 170 120 / 12%);
}

.analytics-command-overview-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 11px;
  min-width: 0;
}

.analytics-command-overview-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  min-height: 152px;
  padding: 15px;
  overflow: hidden;
  border: 1px solid #e6e2d9;
  border-radius: 15px;
  background:
    radial-gradient(circle at 100% 0, rgb(26 135 122 / 9%), transparent 44%),
    linear-gradient(145deg, #fff 0%, #fffdf8 100%);
  box-shadow: 0 8px 22px rgb(43 59 55 / 6%);
  color: inherit;
  text-align: left;
}

button.analytics-command-overview-card {
  width: 100%;
  font: inherit;
  cursor: pointer;
}

.analytics-command-overview-card.is-action:hover {
  border-color: #badbd4;
  box-shadow: 0 12px 28px rgb(24 112 101 / 11%);
  transform: translateY(-2px);
}

.analytics-command-overview-card.is-action:focus-visible {
  outline: 3px solid rgb(22 132 119 / 20%);
  outline-offset: 2px;
}

.analytics-command-overview-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #5c6967;
  font-size: 12px;
  font-weight: 850;
}

.analytics-command-overview-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  border-radius: 9px;
  background: #e7f5f1;
  color: #13796e;
  font-size: 15px;
  font-weight: 950;
}

.analytics-command-overview-icon.blue { background: #eaf2ff; color: #2d66c3; }
.analytics-command-overview-icon.green { background: #e9f7ee; color: #25804a; }
.analytics-command-overview-icon.purple { background: #f1edff; color: #7050bd; }
.analytics-command-overview-icon.orange { background: #fff1e2; color: #c56e18; }
.analytics-command-overview-icon.violet { background: #f5edfb; color: #8651a8; }

.analytics-command-overview-value {
  color: #1d2927;
  font-size: clamp(27px, 2.2vw, 36px);
  line-height: 1;
  letter-spacing: -0.05em;
}

.analytics-command-overview-card p {
  min-height: 32px;
  margin: 0;
  color: #7a8582;
  font-size: 11px;
  line-height: 1.45;
}

.analytics-command-trend {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 999px;
  background: #f1f4f3;
  color: #67716f;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.25;
}

.analytics-command-trend.up { background: #eaf7ef; color: #27794a; }
.analytics-command-trend.down { background: #fff0ec; color: #b5543d; }

.analytics-command-department-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
  min-width: 0;
}

.analytics-command-department-card {
  --department-color: #168477;
  --department-soft: #eaf7f3;
  --department-soft-strong: #d6efe9;
  position: relative;
  display: grid;
  align-content: start;
  gap: 15px;
  min-width: 0;
  padding: 17px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--department-color) 20%, #e4e1da);
  border-radius: 18px;
  background:
    radial-gradient(circle at 100% 0, color-mix(in srgb, var(--department-color) 10%, transparent), transparent 38%),
    #fff;
  box-shadow: 0 12px 28px rgb(39 52 49 / 7%);
}

.analytics-command-department-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--department-color), color-mix(in srgb, var(--department-color) 28%, white));
}

.analytics-command-department-card.tone-operations {
  --department-color: #3477c7;
  --department-soft: #edf5ff;
  --department-soft-strong: #dbeaff;
}

.analytics-command-department-card.tone-purchase {
  --department-color: #d17a24;
  --department-soft: #fff5e9;
  --department-soft-strong: #ffe7c9;
}

.analytics-command-department-card.tone-admin {
  --department-color: #8657ad;
  --department-soft: #f7f0fb;
  --department-soft-strong: #eadcf4;
}

.analytics-command-department-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.analytics-command-department-head:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--department-color) 24%, transparent);
  outline-offset: 5px;
  border-radius: 10px;
}

.analytics-command-department-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--department-soft);
  color: var(--department-color);
  font-size: 22px;
  font-weight: 950;
}

.analytics-command-department-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.analytics-command-department-title strong {
  color: var(--analytics-command-ink);
  font-size: 18px;
}

.analytics-command-department-title small {
  overflow: hidden;
  color: var(--analytics-command-muted);
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-command-status {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #eef4f2;
  color: #537069;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.analytics-command-status.attention { background: #fff0e7; color: #b75a23; }
.analytics-command-status.excellent { background: #e8f7ed; color: #247848; }

.analytics-command-open-hint {
  color: var(--department-color);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.analytics-command-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.analytics-command-kpi {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
  min-height: 89px;
  padding: 11px;
  border: 1px solid color-mix(in srgb, var(--department-color) 13%, #e8e5df);
  border-radius: 13px;
  background: linear-gradient(145deg, var(--department-soft), #fff 82%);
}

.analytics-command-kpi > span {
  overflow: hidden;
  color: #687572;
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-command-kpi strong {
  overflow: hidden;
  color: var(--department-color);
  font-size: clamp(21px, 2vw, 29px);
  line-height: 1.12;
  letter-spacing: -0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-command-kpi small {
  overflow: hidden;
  color: #87918f;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-command-process-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 14px;
  padding: 13px;
  border-radius: 14px;
  background: #fbfcfb;
}

.analytics-command-process-row {
  display: grid;
  align-content: center;
  gap: 6px;
  min-width: 0;
}

.analytics-command-process-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  color: #66716f;
  font-size: 11px;
}

.analytics-command-process-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-command-process-label strong {
  flex: 0 0 auto;
  color: #2d3a38;
  font-size: 11px;
}

.analytics-command-progress,
.analytics-command-process-divider {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eceb;
}

.analytics-command-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--department-color), color-mix(in srgb, var(--department-color) 52%, white));
}

.analytics-command-process-divider {
  height: 1px;
  margin-top: 2px;
}

.analytics-command-reminders {
  display: grid;
  gap: 7px;
}

.analytics-command-reminders-title {
  color: #53615e;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.analytics-command-reminder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid #ece7de;
  border-radius: 10px;
  background: #fffdf9;
  color: #596460;
  font: inherit;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
}

.analytics-command-reminder:hover {
  border-color: color-mix(in srgb, var(--department-color) 35%, #e5e1da);
  background: var(--department-soft);
}

.analytics-command-reminder span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-command-reminder strong { color: #303d3a; font-size: 12px; }
.analytics-command-reminder.danger strong { color: #b44c3d; }
.analytics-command-reminder.warn strong { color: #b36a24; }
.analytics-command-reminder.focus strong { color: var(--department-color); }

.analytics-command-calm {
  margin: 0;
  padding: 10px;
  border: 1px dashed color-mix(in srgb, var(--department-color) 28%, #e5e1da);
  border-radius: 10px;
  background: var(--department-soft);
  color: var(--department-color);
  font-size: 11px;
  font-weight: 750;
}

.analytics-command-alert-center {
  display: grid;
  gap: 15px;
  padding: 18px;
  overflow: hidden;
  border-radius: 18px;
  background:
    radial-gradient(circle at 100% 0, rgb(220 152 52 / 9%), transparent 37%),
    #fff;
}

.analytics-command-alert-summary {
  border-color: #f0dcc1;
  background: #fff9ef;
  color: #9b641f;
}

.analytics-command-alert-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.analytics-command-alert-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid #eee7dc;
  border-radius: 12px;
  background: #fffdf9;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.analytics-command-alert-item:hover {
  border-color: #d5cab9;
  box-shadow: 0 6px 16px rgb(68 54 34 / 7%);
}

.analytics-command-alert-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #d67b2e;
  box-shadow: 0 0 0 4px rgb(214 123 46 / 11%);
}

.analytics-command-alert-item.danger .analytics-command-alert-dot { background: #c65345; box-shadow: 0 0 0 4px rgb(198 83 69 / 11%); }
.analytics-command-alert-item.focus .analytics-command-alert-dot { background: #7c62b1; box-shadow: 0 0 0 4px rgb(124 98 177 / 11%); }
.analytics-command-alert-item.calm .analytics-command-alert-dot { background: #4d9c76; box-shadow: 0 0 0 4px rgb(77 156 118 / 10%); }

.analytics-command-alert-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.analytics-command-alert-copy strong {
  overflow: hidden;
  color: #33413e;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-command-alert-copy small {
  overflow: hidden;
  color: #7f8986;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-command-alert-value {
  color: #9c5d23;
  font-size: 17px;
}

.analytics-command-alert-item.danger .analytics-command-alert-value { color: #b3493c; }
.analytics-command-alert-item.focus .analytics-command-alert-value { color: #7456a2; }
.analytics-command-alert-item.calm .analytics-command-alert-value { color: #3b815f; }
.analytics-command-alert-arrow { color: #a9afad; font-weight: 900; }

@media (max-width: 1500px) {
  .analytics-command-overview-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .analytics-command-overview-card {
    min-height: 140px;
  }
}

@media (max-width: 900px) {
  .analytics-command-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analytics-command-section-head {
    align-items: flex-start;
  }

  .analytics-command-department-card {
    padding: 14px;
  }

  .analytics-command-department-head {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .analytics-command-open-hint {
    display: none;
  }
}

@media (max-width: 680px) {
  .analytics-command-section-head {
    display: grid;
  }

  .analytics-command-live-badge,
  .analytics-command-section-count,
  .analytics-command-alert-summary {
    width: fit-content;
  }

  .analytics-command-department-grid,
  .analytics-command-alert-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .analytics-command-process-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 430px) {
  .analytics-page {
    gap: 14px;
  }

  .analytics-command-overview-grid {
    gap: 8px;
  }

  .analytics-command-overview-card {
    min-height: 137px;
    padding: 12px;
    border-radius: 13px;
  }

  .analytics-command-overview-head {
    align-items: flex-start;
    font-size: 11px;
  }

  .analytics-command-overview-icon {
    width: 24px;
    height: 24px;
  }

  .analytics-command-overview-value {
    font-size: 26px;
  }

  .analytics-command-overview-card p {
    min-height: 42px;
    font-size: 9px;
  }

  .analytics-command-trend {
    max-width: 100%;
    overflow: hidden;
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .analytics-command-department-card,
  .analytics-command-alert-center {
    padding: 13px;
    border-radius: 15px;
  }

  .analytics-command-department-icon {
    width: 38px;
    height: 38px;
  }

  .analytics-command-kpi-grid {
    gap: 6px;
  }

  .analytics-command-kpi {
    min-height: 82px;
    padding: 8px;
  }

  .analytics-command-kpi > span,
  .analytics-command-kpi small {
    font-size: 9px;
  }

  .analytics-command-kpi strong {
    font-size: 20px;
  }

  .analytics-command-alert-item {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .analytics-command-alert-arrow {
    display: none;
  }
}

.employee-performance-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
}

.employee-performance-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #e3ddd0;
  border-radius: 8px;
  background: #fffdf8;
}

.employee-performance-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.employee-performance-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.employee-performance-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.employee-performance-stats span {
  display: grid;
  gap: 2px;
  padding: 8px 6px;
  border-radius: 8px;
  background: #f4f7f7;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.employee-performance-stats strong {
  color: var(--ink);
  font-size: 18px;
}

.audit-page {
  max-width: 1480px;
}

.audit-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 12px;
  padding: 18px;
}

.audit-filter-grid .field:last-child {
  grid-column: span 2;
}

.audit-employee-filter .select {
  border-color: #9fc8c2;
  background: #f5fbf9;
}

.audit-summary-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.audit-log-panel {
  display: grid;
  gap: 14px;
}

.audit-log-list {
  display: grid;
  gap: 10px;
}

.audit-log-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border: 1px solid #e4ddd0;
  border-radius: 8px;
  background: #fffdf9;
}

.audit-time {
  display: grid;
  align-content: start;
  gap: 4px;
}

.audit-time strong {
  color: var(--ink);
}

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

.audit-main {
  min-width: 0;
}

/*
AUDIT_LOG_UNDO_UI_RULE:
- Audit labels and details are presented in Chinese while raw codes remain unchanged
- Only server-confirmed reversible records display the undo action
- Undo always requires a transient password and a conflict-aware server check
- The original immutable audit record is never edited or removed
*/
.audit-main-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.audit-title-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.audit-row-actions {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.audit-undo-button.btn {
  min-height: 34px;
  padding: 6px 10px;
  border-color: #d5a4a0;
  color: #963c34;
  font-size: 12px;
}

.audit-undo-button.btn:hover:not(:disabled) {
  border-color: #b96d66;
  background: #fff5f3;
}

.audit-undone-badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: #edf1f0;
  color: #5d6866;
  font-size: 12px;
  font-weight: 800;
}

.audit-action {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
}

.audit-action.info {
  background: #e9f5fb;
  color: #1f5f7a;
}

.audit-action.warn {
  background: #fff4dc;
  color: #8a5a08;
}

.audit-action.danger {
  background: #ffe8e8;
  color: #a92525;
}

.audit-action.neutral {
  background: #eff4f2;
  color: #31524f;
}

.audit-main p {
  margin: 7px 0 0;
  color: var(--muted);
}

.audit-details {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.audit-details span {
  max-width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  background: #eef7f5;
  color: #3f5855;
  font-size: 12px;
  line-height: 1.35;
}

.audit-undo-backdrop {
  z-index: 95;
  padding: 20px;
}

.modal-panel.audit-undo-modal {
  width: min(620px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.audit-undo-head {
  padding: 20px 22px 15px;
  border-bottom: 1px solid var(--line);
}

.audit-undo-head h2 {
  margin: 3px 0 0;
  font-size: 23px;
}

.audit-undo-body {
  display: grid;
  gap: 15px;
  padding: 18px 22px 22px;
}

.audit-undo-warning {
  padding: 13px 14px;
  border: 1px solid #edc2bc;
  border-radius: 8px;
  background: #fff6f4;
  color: #742c26;
}

.audit-undo-warning strong {
  display: block;
  margin-bottom: 5px;
}

.audit-undo-warning p {
  margin: 0;
  color: #7d4843;
  line-height: 1.55;
}

.audit-undo-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
  margin: 0;
}

.audit-undo-summary > div {
  min-width: 0;
  padding: 10px 0;
  border-bottom: 1px solid #ebe5da;
}

.audit-undo-summary dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.audit-undo-summary dd {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.audit-undo-error {
  margin: 0;
}

.audit-undo-actions {
  justify-content: flex-end;
}

.link-button,
.back-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--teal);
  font-weight: 800;
  text-align: left;
}

.row-actions,
.detail-actions,
.form-actions,
.card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.grade,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.grade-A {
  background: #dcf6e5;
  color: #1f6b3d;
}

.grade-B {
  background: #dff1f7;
  color: #285f78;
}

.grade-C {
  background: #fff0d5;
  color: #8a5a0b;
}

.grade-D {
  background: #ece7df;
  color: #6b6258;
}

.customer-tag-manager {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 78px;
  max-height: 118px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #d6e5df;
  border-radius: 8px;
  background: #fbfdfc;
  overflow: visible;
}

.customer-tag-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.customer-tag-head strong {
  font-size: 15px;
}

.customer-tag-add-button {
  min-height: 30px;
  padding: 5px 10px;
}

.customer-tag-head small,
.customer-tag-empty {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.customer-tag-list,
.customer-tag-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.customer-tag-list {
  max-height: 58px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.customer-tag-list.compact {
  justify-content: center;
  gap: 5px;
  max-height: 52px;
  overflow-y: hidden;
}

.customer-tag-chip {
  --tag-color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid color-mix(in srgb, var(--tag-color) 42%, white);
  border-radius: 999px;
  background: color-mix(in srgb, var(--tag-color) 10%, white);
  color: var(--tag-color);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.1;
  white-space: nowrap;
}

button.customer-tag-chip {
  cursor: pointer;
}

button.customer-tag-chip:hover,
.customer-tag-chip.active {
  background: var(--tag-color);
  color: #fff;
}

.customer-tag-chip.removable {
  gap: 6px;
  padding-right: 5px;
}

.customer-tag-name {
  min-width: 0;
}

.customer-tag-remove {
  display: inline-grid;
  width: 18px;
  height: 18px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tag-color) 18%, white);
  color: var(--tag-color);
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.customer-tag-remove:hover {
  background: var(--tag-color);
  color: #fff;
}

.customer-tag-chip.compact {
  min-height: 24px;
  padding: 4px 7px;
  font-size: 11px;
}

.customer-tag-picker {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 40;
  display: grid;
  width: min(640px, calc(100vw - 360px));
  min-width: min(520px, 100%);
  max-height: 430px;
  gap: 12px;
  overflow: auto;
  padding: 12px;
  border: 1px solid #d4e3dc;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(16, 24, 40, 0.18);
}

.customer-tag-picker-head {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.customer-tag-picker-groups,
.customer-tag-picker-group {
  display: grid;
  gap: 9px;
}

.customer-tag-picker-group strong {
  color: var(--text);
  font-size: 13px;
}

.customer-tag-picker-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.customer-tag-create {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.customer-star-rating {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  min-height: 28px;
  color: #c8bfb0;
  font-size: 19px;
  line-height: 1;
  white-space: nowrap;
}

.customer-star-rating button,
.customer-star-rating span {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1;
}

.customer-star-rating button {
  cursor: pointer;
}

.customer-star-rating button:hover,
.customer-star-rating .active {
  color: #d99018;
}

.customer-star-rating.compact {
  justify-content: center;
  width: 100%;
  font-size: 15px;
}

.customer-star-rating.compact span {
  width: 15px;
  height: 18px;
}

.customer-star-rating.readonly {
  pointer-events: none;
}

.customer-star-rating small {
  margin-left: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.status-pill {
  background: #f0eee8;
  color: #4b5257;
  text-transform: capitalize;
}

.follow-date {
  display: inline-grid;
  gap: 2px;
  min-width: 104px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  line-height: 1.15;
}

.follow-date strong {
  font-size: 15px;
  line-height: 1.15;
}

.follow-date small {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
}

.follow-date-overdue {
  border-color: #ffb4ae;
  background: #fff0ef;
  color: #b42318;
  box-shadow: inset 4px 0 0 #ef4444;
}

.follow-date-today {
  border-color: #f7c36d;
  background: #fff7e6;
  color: #9a5b00;
  box-shadow: inset 4px 0 0 #f59e0b;
}

.follow-date-future {
  background: transparent;
  color: var(--ink);
}

.follow-date-empty {
  border-color: #ebe6dc;
  background: #faf8f2;
  color: var(--muted);
}

.row-overdue td {
  background: #fffafa;
}

.timeline-follow-date {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.timeline-follow-date > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.panel {
  padding: 20px;
}

.form-grid {
  display: grid;
  gap: 18px;
}

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

.report-tabs,
.report-period-tabs,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(32, 34, 37, 0.42);
}

.modal-panel {
  width: min(980px, calc(100vw - 48px));
  max-height: min(860px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(32, 34, 37, 0.24);
}

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

.modal-head h2 {
  margin: 4px 0 0;
  font-size: 24px;
}

.customer-detail-modal-backdrop {
  padding: 18px;
}

.customer-detail-modal-backdrop.is-fullscreen {
  padding: 0;
  background: #f8f6f1;
}

.modal-panel.customer-detail-modal {
  width: min(1180px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  padding: 14px;
  background: #f8f6f1;
}

.modal-panel.customer-detail-modal.is-fullscreen {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  padding: 14px 18px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.customer-detail-window-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.customer-detail-fullscreen-button {
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid #d9d2c6;
  border-radius: 6px;
  background: #fff;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
}

.customer-detail-fullscreen-button:hover {
  border-color: rgba(15, 118, 110, 0.38);
  background: #eef8f6;
}

.customer-detail-embedded {
  gap: 10px;
}

.customer-detail-embedded .detail-hero {
  position: sticky;
  top: -14px;
  z-index: 12;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(10px);
}

.customer-detail-embedded .detail-hero h2 {
  margin: 5px 0 3px;
  font-size: 21px;
}

.customer-detail-embedded .detail-hero p {
  font-size: 12px;
}

.customer-detail-embedded .detail-ai-summary {
  margin-top: 6px;
}

.customer-detail-embedded .detail-actions {
  gap: 5px;
  justify-content: flex-end;
}

.customer-detail-embedded .detail-actions .btn {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

.customer-detail-embedded .panel {
  padding: 13px;
}

.customer-detail-embedded .form-grid,
.customer-detail-embedded .form-section {
  gap: 10px;
}

.customer-detail-embedded .customer-basic-info-grid,
.customer-detail-embedded .customer-development-info-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  gap: 9px;
}

.customer-detail-embedded .customer-basic-info-grid .input,
.customer-detail-embedded .customer-development-info-grid .input {
  min-height: 48px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.customer-detail-embedded .customer-development-info-grid .customer-star-rating {
  min-height: 48px;
  align-content: center;
}

.customer-detail-embedded .grid-2,
.customer-detail-embedded .grid-3,
.customer-detail-embedded .grid-4,
.customer-detail-embedded .info-grid {
  gap: 8px;
}

.customer-detail-embedded .info-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.customer-detail-embedded .info-item {
  min-height: 58px;
  padding: 8px 10px;
}

.customer-detail-embedded .info-item span {
  margin-bottom: 3px;
  font-size: 11px;
}

.customer-detail-embedded .two-column {
  gap: 10px;
}

.customer-detail-embedded .timeline-panel {
  min-height: 260px;
}

.customer-detail-embedded .timeline {
  gap: 7px;
}

.customer-detail-embedded .timeline-item {
  padding: 9px 10px;
}

.customer-detail-embedded textarea.input {
  min-height: 64px;
}

@media (max-width: 900px) {
  .customer-detail-embedded .customer-basic-info-grid,
  .customer-detail-embedded .customer-development-info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.customer-create-modal {
  padding: 0;
}

.customer-form-inline {
  padding: 22px;
}

.report-tab,
.report-period {
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
  color: var(--ink);
  font-weight: 850;
}

.report-tab.active,
.report-period.active {
  border-color: rgba(15, 118, 110, 0.35);
  background: #e8f7f2;
  color: var(--teal);
}

.report-intro {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

.report-intro h2,
.report-section h3,
.report-suggestions h2,
.report-history h2 {
  margin: 0;
}

.report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
  gap: 18px;
  align-items: start;
}

.report-layout.aside-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.report-main-column,
.report-aside {
  min-width: 0;
}

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

.report-aside {
  display: grid;
  gap: 12px;
  align-self: start;
}

.report-aside-toolbar,
.report-aside-restore {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.report-aside-toolbar {
  min-height: 32px;
}

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

.report-aside-toggle-btn.btn {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.report-section {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid #ebe4d7;
  border-radius: 8px;
  background: #fffdf8;
}

.report-section h3 {
  color: var(--teal);
  font-size: 17px;
}

/*
 REPORT_LAYOUT_CONTRACT:
 - metric fields: 5 columns
 - long text fields: 2 columns on desktop
 - do not regress to single-column layout
*/
.report-field-grid {
  display: grid;
  gap: 14px;
}

.report-metric-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px 20px;
  align-items: start;
  justify-items: stretch;
}

.report-text-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

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

.report-form {
  gap: 12px;
}

.report-form .grid-3 {
  gap: 12px;
}

.report-form .report-section {
  gap: 10px;
  padding: 14px;
}

.report-form .report-section h3 {
  font-size: 16px;
}

.report-metric-field,
.report-text-field,
.report-table-field {
  min-width: 0;
}

.report-metric-field {
  display: flex;
  width: 100%;
  max-width: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.report-form .report-metric-field {
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.report-form .input {
  min-height: 40px;
  padding: 8px 10px;
}

.report-metric-field .input {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  font-size: 17px;
  text-align: center;
}

.report-form .field {
  gap: 5px;
}

.report-form .field span {
  color: #4f5d63;
  font-size: 12px;
}

.report-metric-field > span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 34px;
  margin: 0;
  line-height: 1.35;
  text-align: center;
  overflow-wrap: anywhere;
}

.report-metric-field .input[type="number"] {
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}

.report-metric-field .input[type="number"]::-webkit-outer-spin-button,
.report-metric-field .input[type="number"]::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.report-text-field,
.report-text-field .smart-textarea-field,
.report-text-field .textarea {
  width: 100%;
}

.report-text-field textarea,
.report-text-field .textarea {
  min-height: 120px;
  overflow-y: auto;
  resize: vertical;
}

.report-form .smart-textarea-shell {
  padding: 8px;
}

.report-form .smart-textarea-actions {
  gap: 6px;
}

.report-form-draft-banner {
  width: 100%;
}

.report-draft-status {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.report-form .smart-ai-button {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 12px;
}

.report-table-field {
  grid-column: 1 / -1;
}

.report-table-wrap {
  display: grid;
  gap: 10px;
  overflow-x: auto;
}

.report-entry-table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #d8d1c4;
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
}

.report-entry-table th,
.report-entry-table td {
  border-right: 1px solid #d8d1c4;
  border-bottom: 1px solid #d8d1c4;
  padding: 8px;
  text-align: left;
  vertical-align: middle;
}

.report-entry-table th {
  background: #f3f2f0;
  color: var(--ink);
  font-weight: 900;
  white-space: nowrap;
}

.report-entry-table th:last-child,
.report-entry-table td:last-child {
  width: 90px;
  border-right: 0;
  text-align: center;
}

.report-entry-table tr:last-child td {
  border-bottom: 0;
}

.report-entry-table .input {
  min-height: 42px;
  padding: 8px 10px;
}

.required-star {
  color: #ef4444;
  margin-right: 2px;
}

.report-table-add,
.report-table-delete {
  width: fit-content;
  min-height: 40px;
}

.report-form .textarea {
  min-height: 120px;
}

.report-form .input,
.report-form .textarea,
.report-entry-table .input {
  color: #334155;
  caret-color: var(--teal);
}

.report-form .input::placeholder,
.report-form .textarea::placeholder,
.report-entry-table .input::placeholder {
  color: #8a97a3;
}

.report-suggestions {
  background: #effaf7;
}

.report-suggestions p {
  margin: 10px 0 0;
  color: #4a5f5c;
  line-height: 1.55;
}

.report-history {
  display: grid;
  gap: 0;
}

.report-history-head.card-head {
  margin-bottom: 0;
}

.report-history-expanded .report-history-head.card-head {
  margin-bottom: 10px;
}

.report-history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

.report-history-actions .btn {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.report-history-refresh-btn.btn {
  color: #64748b;
}

.report-history-toggle-btn.btn {
  color: var(--teal);
}

.report-history-list {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 2px;
}

.report-history-more {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.report-history-more-btn.btn {
  min-height: 34px;
  padding: 7px 12px;
  font-size: 12px;
}

.report-history-row {
  display: grid;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #e4ddd0;
  border-radius: 8px;
  background: #fffdf9;
}

.report-history-row.active {
  border-color: rgba(15, 118, 110, 0.45);
  background: #edf8f5;
}

.report-timeline-list {
  position: relative;
}

.report-timeline-item {
  position: relative;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  width: 100%;
  min-height: 70px;
  color: var(--ink);
  text-align: left;
}

.report-timeline-item:hover {
  border-color: rgba(15, 118, 110, 0.32);
  background: #f4fbf8;
}

.report-timeline-dot {
  position: relative;
  z-index: 1;
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-top: 7px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--teal);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.24);
}

.report-timeline-content {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.report-timeline-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.report-timeline-head strong,
.report-timeline-head span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-timeline-head strong {
  color: #1f2933;
  font-size: 14px;
}

.report-timeline-head span,
.report-timeline-content small {
  color: #69737a;
  font-size: 12px;
}

.report-timeline-content p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #52606d;
  font-size: 12px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.report-history-view-btn.btn {
  align-self: center;
  justify-self: end;
  min-height: 34px;
  padding: 7px 12px;
  white-space: nowrap;
}

.report-history-lines {
  display: grid;
  gap: 4px;
  margin-top: 2px;
}

.report-history-line {
  display: flex;
  gap: 8px;
  align-items: baseline;
  color: #52606d;
  line-height: 1.45;
}

.report-history-label {
  flex: 0 0 auto;
  max-width: min(58%, 260px);
  color: #475569;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.report-history-value {
  flex: 1 1 auto;
  min-width: 0;
  color: #52606d;
  overflow-wrap: break-word;
  word-break: break-word;
}

.report-delete-btn {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff1f2;
  color: #b91c1c;
  font-weight: 850;
  white-space: nowrap;
}

.report-delete-btn.disabled,
.report-delete-btn:disabled {
  border-color: #e5dfd4;
  background: #f4f1eb;
  color: var(--muted);
  cursor: not-allowed;
}

.report-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  justify-content: flex-end;
  background: rgba(32, 34, 37, 0.42);
}

.report-drawer {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(78vw, 1120px);
  min-width: min(720px, 100vw);
  height: 100vh;
  border-left: 1px solid var(--line);
  background: var(--panel);
  box-shadow: -22px 0 70px rgba(32, 34, 37, 0.24);
}

.report-drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.report-drawer-head h2 {
  margin: 8px 0 6px;
  font-size: 22px;
  line-height: 1.25;
}

.report-drawer-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.report-drawer-body {
  display: grid;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px 22px;
  background: #fbfaf6;
}

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

.report-detail-meta div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #e5ded1;
  border-radius: 8px;
  background: #fff;
}

.report-detail-meta span,
.report-detail-field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.report-detail-meta strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-detail-section {
  display: grid;
  gap: 12px;
  padding: 15px;
  border: 1px solid #e5ded1;
  border-radius: 8px;
  background: #fff;
}

.report-detail-section h3 {
  margin: 0;
  color: var(--teal);
  font-size: 17px;
}

.report-detail-fields {
  display: grid;
  gap: 9px;
}

.report-detail-fields.report-section-numeric {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.report-detail-field {
  display: grid;
  grid-template-columns: minmax(150px, 0.32fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #eee7dc;
  border-radius: 8px;
  background: #fffdf9;
}

.report-detail-fields.report-section-numeric .report-detail-field,
.report-detail-field-number {
  grid-template-columns: 1fr;
}

.report-detail-text,
.report-detail-number {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.report-detail-text {
  color: #28323d;
  line-height: 1.58;
  white-space: pre-wrap;
}

.report-detail-number {
  color: var(--teal);
  font-size: 22px;
  font-weight: 900;
  line-height: 1.2;
}

.report-detail-empty {
  color: var(--muted);
}

.report-detail-table-wrap {
  min-width: 0;
  overflow-x: auto;
}

.report-detail-table {
  width: 100%;
  min-width: 620px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid #d8d1c4;
  border-radius: 7px;
  background: #fff;
}

.report-detail-table th,
.report-detail-table td {
  padding: 9px 10px;
  border-right: 1px solid #d8d1c4;
  border-bottom: 1px solid #d8d1c4;
  color: #334155;
  text-align: left;
  vertical-align: top;
}

.report-detail-table th {
  background: #f3f2f0;
  font-weight: 900;
  white-space: nowrap;
}

.report-detail-table th:last-child,
.report-detail-table td:last-child {
  border-right: 0;
}

.report-detail-table tr:last-child td {
  border-bottom: 0;
}

.report-drawer-actions {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.report-drawer-actions > span {
  color: var(--muted);
  font-size: 13px;
}

.report-detail-delete.btn {
  border-color: #fecaca;
  background: #fff1f2;
  color: #b91c1c;
}

.report-detail-delete.disabled,
.report-detail-delete:disabled {
  border-color: #e5dfd4;
  background: #f4f1eb;
  color: var(--muted);
}

@media (max-width: 980px) {
  .dashboard-report-records-head,
  .dashboard-report-record-row {
    grid-template-columns: 12px minmax(0, 1fr);
  }

  .dashboard-report-records-head {
    display: grid;
  }

  .dashboard-report-records-actions {
    justify-content: flex-start;
  }

  .dashboard-submit-status-row {
    grid-template-columns: minmax(0, 1fr) minmax(70px, auto);
  }

  .dashboard-report-record-row .btn {
    grid-column: 2;
    justify-self: start;
  }

  .dashboard-report-filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-drawer {
    width: 100vw;
    min-width: 0;
  }

  .report-detail-meta,
  .report-detail-fields.report-section-numeric {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-detail-field {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .report-drawer-head,
  .report-drawer-actions,
  .report-timeline-head {
    display: grid;
  }

  .report-timeline-item {
    grid-template-columns: 18px minmax(0, 1fr);
  }

  .report-history-view-btn.btn {
    grid-column: 2;
    justify-self: start;
  }

  .report-detail-meta,
  .report-detail-fields.report-section-numeric {
    grid-template-columns: 1fr;
  }
}

.grid-2,
.grid-3,
.grid-4,
.info-grid {
  display: grid;
  gap: 14px;
}

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

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

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

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: #555f64;
  font-size: 13px;
  font-weight: 750;
}

.field-hint {
  color: #6b7280;
  font-size: 12px;
  line-height: 1.4;
}

.field-hint.warning {
  color: #b45309;
}

.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.quick-tags button {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid #d9d1c4;
  border-radius: 999px;
  background: #fffaf0;
  color: #66533a;
}

.quick-tags button.selected,
.quick-tags button[aria-pressed="true"] {
  border-color: rgba(15, 118, 110, 0.42);
  background: #e7f5f1;
  color: var(--teal);
  font-weight: 800;
}

.product-match-groups {
  display: grid;
  gap: 12px;
}

.product-match-group {
  display: grid;
  gap: 6px;
}

.product-match-title {
  color: #667085;
  font-size: 12px;
  font-weight: 800;
}

.product-match-tags {
  gap: 6px;
}

.detail-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
}

.detail-hero > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.detail-hero h2 {
  margin: 10px 0 8px;
  font-size: 28px;
}

.detail-hero p {
  margin-bottom: 0;
  color: var(--muted);
}

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

.info-item {
  min-height: 74px;
  padding: 12px;
  border-radius: 8px;
  background: var(--panel-soft);
}

.info-item span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.info-item strong {
  font-weight: 750;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.compact {
  gap: 14px;
}

.timeline-panel {
  min-height: 360px;
}

.timeline-title-row {
  align-items: center;
}

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

.timeline-item {
  padding: 14px;
  border: 1px solid #ebe6dc;
  border-radius: 8px;
  background: #fffdf9;
}

.timeline-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.timeline-item p {
  margin-bottom: 8px;
  line-height: 1.5;
}

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

.history-grid h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.history-grid .mini-card {
  margin-bottom: 10px;
}

.version-card summary {
  display: grid;
  gap: 6px;
  cursor: pointer;
  list-style-position: inside;
}

.version-card summary strong {
  color: #1f2a35;
}

.version-card summary small,
.document-snapshot-list small {
  color: #69737a;
}

.version-diff-list,
.document-snapshot-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5ded2;
}

.version-diff-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  font-size: 14px;
  line-height: 1.45;
}

.version-diff-row span {
  color: #69737a;
  font-weight: 700;
}

.version-diff-row del {
  display: inline-block;
  margin-right: 6px;
  color: #a15757;
  text-decoration-thickness: 2px;
  word-break: break-word;
}

.version-diff-row b {
  margin-right: 6px;
  color: var(--muted);
}

.version-diff-row strong {
  color: #146b60;
  word-break: break-word;
}

.document-snapshot-list p {
  margin: 0;
  color: #3e4b52;
  line-height: 1.45;
  word-break: break-word;
}

.card-head {
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-head h2 {
  margin: 0;
}

.compact-head {
  align-items: flex-start;
  margin-bottom: 10px;
}

.compact-head > div {
  display: grid;
  gap: 4px;
}

.document-header-contact-card {
  display: grid;
  gap: 12px;
}

.document-header-contact-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.mini-card,
.notice,
.empty {
  padding: 14px;
  border: 1px solid #ebe6dc;
  border-radius: 8px;
  background: var(--panel-soft);
}

.empty {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.empty strong {
  color: var(--ink);
}

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

.alert {
  padding: 12px 14px;
  border: 1px solid #e5dfd4;
  border-radius: 8px;
  background: var(--panel-soft);
  font-weight: 750;
}

.alert.success {
  border-color: #b9dfd8;
  background: #eefbf8;
  color: var(--teal-dark);
}

.alert.error {
  border-color: #f0b6b2;
  background: #fff3f2;
  color: var(--red);
}

.error {
  margin: 0;
  color: var(--red);
  font-weight: 750;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #4b5257;
  font-weight: 750;
}

.score {
  position: relative;
  width: 120px;
  height: 28px;
  overflow: hidden;
  border-radius: 999px;
  background: #eee9df;
}

.score span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.score b {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #1f2528;
  font-size: 12px;
}

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

.whatsapp-layout {
  --whatsapp-chat-shell-height: clamp(580px, calc(100vh - 215px), 780px);
  --whatsapp-log-head-height: 89px;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: stretch;
}

.email-layout {
  grid-template-columns: minmax(430px, 0.95fr) minmax(460px, 1.05fr);
}

.whatsapp-log {
  min-height: 0;
  width: min(100%, 1280px);
  align-self: stretch;
}

.whatsapp-chat-app {
  overflow: hidden;
  padding: 0;
}

.whatsapp-chat-app > .card-head {
  margin: 0;
  padding: 18px 20px;
  border-bottom: 1px solid #d8d0c4;
  background: #f7f5ef;
}

.whatsapp-web-panel {
  display: grid;
  gap: 12px;
  border-color: #cfe5e1;
  background: #f7fffc;
}

.whatsapp-layout > .form-grid {
  gap: 14px;
  width: clamp(320px, 28vw, 480px);
  min-width: 300px;
  max-width: min(520px, 46vw);
  height: calc(var(--whatsapp-chat-shell-height) + var(--whatsapp-log-head-height));
  min-height: calc(var(--whatsapp-chat-shell-height) + var(--whatsapp-log-head-height));
  max-height: calc(var(--whatsapp-chat-shell-height) + var(--whatsapp-log-head-height));
  overflow: auto;
  resize: horizontal;
  align-self: stretch;
  position: relative;
  z-index: 1;
}

.whatsapp-layout > .form-grid .input,
.whatsapp-layout > .form-grid .btn,
.whatsapp-layout > .form-grid .mini-card {
  max-width: 100%;
}

.whatsapp-layout > .form-grid .field {
  min-width: 0;
}

.whatsapp-layout > .form-grid .textarea {
  min-height: 132px;
  max-height: 600px;
  overflow-y: auto;
  resize: vertical;
}

.whatsapp-layout > .form-grid .config-card {
  font-size: 13px;
}

.wa-follow-grid {
  align-items: end;
}

.wa-customer-picker {
  position: relative;
  display: grid;
  gap: 8px;
  min-width: 0;
}

.wa-customer-results {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  z-index: 8;
  display: grid;
  max-height: 260px;
  overflow: auto;
  border: 1px solid #ded5c8;
  border-radius: 10px;
  background: #fffdf8;
  box-shadow: 0 10px 24px rgba(35, 31, 25, 0.14);
}

.wa-customer-results-portal {
  position: fixed;
  right: auto;
  z-index: 120;
}

.wa-customer-results button {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid #f0ece5;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.wa-customer-results button:hover {
  background: #edf7f3;
}

.wa-customer-results button:last-child {
  border-bottom: 0;
}

.wa-customer-results strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wa-customer-results span,
.wa-customer-results small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.wa-customer-results small {
  padding: 10px 12px;
}

.wa-workbench-head {
  align-items: flex-start;
  margin-bottom: 2px;
}

.wa-workbench-head .btn {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.wa-workbench-timeline {
  width: clamp(320px, 28vw, 480px);
  min-width: 300px;
  max-width: min(520px, 46vw);
  height: calc(var(--whatsapp-chat-shell-height) + var(--whatsapp-log-head-height));
  min-height: calc(var(--whatsapp-chat-shell-height) + var(--whatsapp-log-head-height));
  max-height: calc(var(--whatsapp-chat-shell-height) + var(--whatsapp-log-head-height));
  overflow: auto;
  resize: horizontal;
}

.wa-workbench-timeline .timeline {
  padding-right: 2px;
}

.whatsapp-web-panel .card-head {
  margin-bottom: 0;
}

.whatsapp-web-panel > span,
.whatsapp-web-empty span {
  color: var(--muted);
  line-height: 1.5;
}

.whatsapp-conversation-list {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #e0d8c8;
  border-radius: 8px;
  background: var(--panel-soft);
}

.whatsapp-conversation-list .timeline-head {
  margin-bottom: 2px;
}

.whatsapp-conversation {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #e4ded1;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.whatsapp-conversation:hover,
.whatsapp-conversation.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.whatsapp-conversation span,
.whatsapp-conversation strong,
.whatsapp-conversation small {
  display: block;
  min-width: 0;
}

.whatsapp-conversation strong {
  overflow-wrap: anywhere;
}

.whatsapp-conversation small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.whatsapp-chat-shell {
  display: grid;
  grid-template-columns: clamp(280px, 27%, 335px) minmax(0, 1fr);
  height: var(--whatsapp-chat-shell-height);
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #f0ebe2;
}

.whatsapp-chat-shell.is-collapsed {
  grid-template-columns: 72px minmax(0, 1fr);
}

.wa-account-mini {
  border-color: #cfe5e1;
  background: #f5fffb;
}

.wa-account-mini.warn {
  border-color: rgba(217, 119, 6, 0.28);
  background: #fff8eb;
}

.wa-account-mini.warn strong {
  color: #925305;
}

.wa-account-list {
  display: grid;
  gap: 10px;
}

.wa-account-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #e1ded6;
  border-radius: 8px;
  background: #fff;
}

.wa-account-row.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.wa-account-main {
  display: grid;
  gap: 3px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.wa-account-main strong,
.wa-account-main span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.wa-account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.wa-account-actions .btn {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}

.wa-account-chip,
.wa-account-route {
  color: #0f766e !important;
  font-weight: 800;
}

.wa-account-chip {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.whatsapp-chat-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  max-height: none;
  overflow: auto;
  border-right: 1px solid #d8d0c4;
  background: #fffaf2;
}

.whatsapp-sidebar-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 46px;
  padding: 10px 12px;
  border-bottom: 1px solid #ebe6dc;
  background: #fbf8f2;
}

.wa-sidebar-toggle {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid #ded5c8;
  border-radius: 999px;
  background: #fffaf2;
  color: var(--teal);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.wa-sidebar-toggle:hover {
  border-color: var(--teal);
  background: #edf7f3;
}

.whatsapp-sidebar-head strong,
.whatsapp-sidebar-head span {
  display: block;
}

.whatsapp-sidebar-head span {
  min-width: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e5f4ee;
  color: var(--teal);
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}

.wa-sidebar-search {
  position: sticky;
  top: 46px;
  z-index: 1;
  padding: 8px 10px;
  border-bottom: 1px solid #ebe6dc;
  background: #fffaf2;
}

.wa-sidebar-search input {
  width: 100%;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid #ded5c8;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  outline: none;
}

.wa-sidebar-search input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(17, 124, 113, 0.12);
}

.whatsapp-chat-sidebar .whatsapp-conversation {
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 86px;
  gap: 10px;
  padding: 10px 11px;
  border: 0;
  border-bottom: 1px solid #f0ece5;
  border-radius: 0;
  box-shadow: none;
}

.whatsapp-chat-sidebar .whatsapp-conversation:hover,
.whatsapp-chat-sidebar .whatsapp-conversation.active {
  background: #edf7f3;
  box-shadow: inset 4px 0 0 var(--teal);
}

.wa-list-avatar-wrap {
  position: relative;
  display: grid !important;
  place-items: center;
}

.wa-list-avatar {
  display: grid !important;
  place-items: center;
  width: 44px;
  height: 44px;
  font-size: 13px;
  border-radius: 50%;
  background: #d4e6df;
  color: #214d44;
  font-weight: 900;
}

.wa-list-avatar img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.wa-list-main,
.wa-list-meta {
  min-width: 0;
}

.wa-list-meta {
  display: grid;
  gap: 3px;
  justify-items: end;
  text-align: right;
}

.wa-list-main strong {
  display: -webkit-box;
  font-size: 16px;
  line-height: 1.12;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.wa-list-main .wa-title-sm {
  font-size: 14.5px;
}

.wa-list-main .wa-title-xs {
  font-size: 13.5px;
}

.wa-list-main .wa-title-xxs {
  font-size: 12.5px;
  line-height: 1.18;
}

.wa-list-main small {
  display: block;
  margin-top: 2px;
  font-size: 12.2px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.wa-list-subtitle {
  display: -webkit-box !important;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: #667176;
}

.wa-list-preview {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  color: #6f767a;
}

.wa-list-labels,
.wa-chat-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.wa-list-labels {
  margin-top: 4px;
}

.wa-list-labels em,
.wa-chat-labels em {
  max-width: 92px;
  padding: 2px 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.1);
  color: #0f766e;
  font-size: 10px;
  font-style: normal;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wa-list-meta small {
  font-size: 11px;
  line-height: 1.2;
}

.wa-match-ok {
  color: var(--teal) !important;
  font-weight: 800;
}

.wa-match-warn {
  color: var(--gold) !important;
  font-weight: 800;
}

.wa-unread-badge {
  display: inline-grid !important;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff !important;
  font-size: 11px !important;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 2px 5px rgba(220, 38, 38, 0.22);
}

.wa-unread-floating {
  position: absolute;
  right: -6px;
  top: -7px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 10px !important;
}

.whatsapp-chat-sidebar.collapsed {
  overflow-x: hidden;
}

.whatsapp-chat-sidebar.collapsed .whatsapp-sidebar-head {
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 6px;
  padding: 8px 5px;
}

.whatsapp-chat-sidebar.collapsed .whatsapp-sidebar-head span {
  min-width: 22px;
  padding: 2px 6px;
  font-size: 11px;
}

.whatsapp-chat-sidebar.collapsed .wa-sidebar-search {
  display: none;
}

.whatsapp-chat-sidebar.collapsed .whatsapp-conversation {
  position: relative;
  grid-template-columns: 1fr;
  justify-items: center;
  min-height: 62px;
  padding: 9px 5px;
}

.whatsapp-chat-sidebar.collapsed .wa-list-main,
.whatsapp-chat-sidebar.collapsed .wa-list-meta {
  display: none;
}

.whatsapp-chat-sidebar.collapsed .wa-list-avatar {
  width: 43px;
  height: 43px;
}

.whatsapp-chat-window {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.whatsapp-chat-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 62px;
  padding: 9px 14px;
  border-bottom: 1px solid #d8d0c4;
  background: #fbf8f2;
}

.whatsapp-chat-header.is-collapsed {
  min-height: 52px;
  padding-top: 7px;
  padding-bottom: 7px;
}

.wa-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #c7d8d2;
  color: #31514b;
  font-weight: 900;
}

.wa-chat-title-block {
  min-width: 0;
}

.whatsapp-chat-header strong,
.whatsapp-chat-header span {
  display: block;
  min-width: 0;
}

.whatsapp-chat-header strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.whatsapp-chat-header span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.whatsapp-chat-header .wa-contact-meta {
  color: #31514b;
  font-weight: 750;
}

.whatsapp-chat-header .wa-account-route {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.3;
}

.wa-customer-rating {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin-top: 5px;
}

.wa-customer-rating > span:first-child {
  margin-top: 0;
  color: #31514b;
  font-size: 12px;
  font-weight: 800;
}

.wa-customer-rating .customer-star-rating {
  display: inline-flex;
  min-height: 24px;
  margin-top: 0;
}

.wa-customer-rating .customer-star-rating button {
  width: 21px;
  height: 22px;
}

.whatsapp-chat-header .customer-star-rating span {
  display: inline-grid;
  margin-top: 0;
  color: inherit;
  font-size: inherit;
}

.wa-chat-labels {
  margin-top: 5px;
}

.wa-meta-editor {
  display: grid;
  grid-template-columns: minmax(96px, 0.8fr) minmax(130px, 1fr) auto;
  gap: 6px;
  margin-top: 7px;
}

.wa-meta-editor input {
  min-width: 0;
  height: 30px;
  padding: 5px 8px;
  border: 1px solid #d8d0c4;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
}

.wa-meta-editor button {
  min-height: 30px;
  padding: 4px 9px;
  border: 0;
  border-radius: 7px;
  background: #0f766e;
  color: #fff;
  font-size: 12px;
  font-weight: 850;
}

.wa-meta-editor button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.wa-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  min-width: max-content;
}

.wa-header-toggle {
  min-height: 30px;
  padding: 5px 9px;
  white-space: nowrap;
}

.wa-sync-dot {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 999px;
  background: #efece5;
  color: #5f676b !important;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.wa-sync-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a8a29a;
}

.wa-sync-dot.active::before {
  background: #16a34a;
}

.whatsapp-chat-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding: 14px 20px;
  background:
    linear-gradient(rgba(239, 234, 226, 0.92), rgba(239, 234, 226, 0.92)),
    radial-gradient(circle at 20px 20px, rgba(255, 255, 255, 0.42) 0 1px, transparent 1px 18px);
}

.wa-bubble-row {
  display: flex;
  width: 100%;
}

.wa-bubble-row.inbound {
  justify-content: flex-start;
}

.wa-bubble-row.outbound {
  justify-content: flex-end;
}

.wa-bubble {
  max-width: min(68%, 620px);
  padding: 6px 9px 5px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 1px 1px rgba(70, 60, 40, 0.14);
}

.wa-bubble-row.inbound .wa-bubble {
  background: #fff;
  border-top-left-radius: 2px;
}

.wa-bubble-row.outbound .wa-bubble {
  background: #d9fdd3;
  border-top-right-radius: 2px;
}

.wa-bubble p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.wa-message-link {
  color: #0f766e;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.wa-media-card {
  display: grid;
  gap: 6px;
  width: min(320px, 100%);
  margin-bottom: 6px;
}

.wa-media-card.unavailable {
  padding: 8px 10px;
  border: 1px dashed #b7c8c3;
  border-radius: 7px;
  background: rgba(15, 118, 110, 0.07);
  color: #31514b;
}

.wa-media-card.unavailable strong,
.wa-media-card.unavailable small {
  display: block;
}

.wa-media-card img,
.wa-media-video {
  display: block;
  max-width: 100%;
  max-height: 360px;
  border-radius: 7px;
  background: #e8e3da;
  object-fit: contain;
}

.wa-media-audio {
  width: min(300px, 100%);
}

.wa-media-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  color: #42504d;
}

.wa-media-meta strong,
.wa-file-body strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wa-media-action {
  flex: 0 0 auto;
  color: #0f766e;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.wa-media-card.file {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  padding: 8px;
  border-radius: 7px;
  background: rgba(15, 118, 110, 0.08);
}

.wa-file-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: rgba(15, 118, 110, 0.15);
  color: #0f766e;
  font-size: 10px;
  font-weight: 900;
}

.wa-file-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.wa-file-body small {
  overflow: hidden;
  color: #667176;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wa-message-translation {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px;
  align-items: start;
  max-height: 48px;
  margin-top: 6px;
  padding: 5px 7px;
  overflow: auto;
  border-radius: 7px;
  background: rgba(15, 118, 110, 0.08);
  color: #31514b;
  font-size: 11px;
  line-height: 1.35;
}

.wa-message-translation b {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(15, 118, 110, 0.13);
  color: var(--teal);
  font-size: 11px;
}

.wa-message-translation em {
  min-width: 0;
  font-style: normal;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.wa-bubble-time {
  display: block;
  margin-top: 3px;
  color: #667176;
  font-size: 10px;
  text-align: right;
}

.whatsapp-chat-footer {
  display: grid;
  gap: 6px;
  min-height: 64px;
  padding: 8px 12px;
  border-top: 1px solid #d8d0c4;
  background: #f0ebe2;
}

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

.wa-compose-tools,
.wa-translate-control {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.wa-compose-tools {
  padding-left: 52px;
}

.wa-context-hint {
  color: #60746f !important;
  font-weight: 700;
}

.wa-language-select {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: #60746f;
  font-size: 12px;
  font-weight: 800;
}

.wa-language-select select {
  min-height: 30px;
  padding: 4px 24px 4px 9px;
  border: 1px solid #c7d8d2;
  border-radius: 999px;
  background: #fff;
  color: #20332f;
  font-size: 12px;
  font-weight: 850;
}

.wa-language-select select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.wa-inline-link {
  border: 0;
  background: transparent;
  color: var(--teal);
  font-weight: 850;
}

.wa-inline-link:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.whatsapp-chat-footer span,
.wa-chat-empty span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.wa-footer-icon,
.wa-send-button {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  font-weight: 900;
}

.wa-footer-icon {
  display: inline-grid;
  place-items: center;
  width: 42px;
  background: #fff;
  color: var(--teal);
  box-shadow: 0 1px 2px rgba(70, 60, 40, 0.12);
}

.wa-attach-button {
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.wa-attach-button input {
  display: none;
}

.wa-attachment-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  margin-left: 52px;
  padding: 7px 9px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.wa-attachment-preview strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wa-attachment-preview button {
  border: 0;
  background: transparent;
  color: #0f766e;
  font-size: 12px;
  font-weight: 850;
}

.wa-reply-input {
  width: 100%;
  min-height: 42px;
  max-height: 120px;
  padding: 10px 14px;
  border: 0;
  border-radius: 22px;
  background: #fff;
  color: var(--ink);
  outline: none;
  resize: vertical;
  box-shadow: 0 1px 2px rgba(70, 60, 40, 0.12);
}

.wa-reply-input:focus {
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.wa-send-button {
  min-width: 58px;
  padding: 0 16px;
  background: var(--teal);
  color: #fff;
}

.wa-send-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.wa-chat-empty {
  align-self: center;
  display: grid;
  gap: 6px;
  max-width: 360px;
  margin: auto;
  padding: 18px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.wa-send-preview {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid #cfe5e1;
  border-radius: 8px;
  background: #f1fffb;
  color: #31514b;
}

.wa-send-preview.chat-preview {
  margin-left: 52px;
}

.wa-send-preview strong {
  color: var(--teal);
  font-size: 12px;
}

.wa-send-preview p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.whatsapp-chat-sidebar.whatsapp-web-empty {
  gap: 12px;
  padding-bottom: 16px;
}

.whatsapp-chat-sidebar.whatsapp-web-empty > strong,
.whatsapp-chat-sidebar.whatsapp-web-empty > span {
  margin: 0 14px;
}

.email-log {
  min-height: 620px;
}

.email-config-collapsed,
.email-thread-banner {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.email-config-collapsed > div,
.email-thread-banner > div {
  min-width: 0;
}

.message-list {
  display: grid;
  gap: 12px;
}

.message-card {
  padding: 14px;
  border: 1px solid #ebe6dc;
  border-radius: 8px;
  background: #fffdf9;
}

.message-card.outbound {
  border-color: #cfe5e1;
  background: #f2fbf8;
}

.message-card.inbound {
  border-color: #f0dfbf;
  background: #fffbf2;
}

.message-card.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.message-card p {
  margin-bottom: 8px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.email-message-list {
  margin-top: 12px;
}

.starred-mail-view {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid #e8d8b4;
  border-radius: 8px;
  background: #fffaf0;
}

.starred-mail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.starred-mail-head h3 {
  margin-bottom: 4px;
}

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

.starred-mail-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #ead9b7;
  border-radius: 8px;
  background: #fffdf8;
}

.starred-mail-card .card-head {
  align-items: flex-start;
}

.starred-mail-card strong {
  overflow-wrap: anywhere;
}

.starred-mail-info {
  display: grid;
  gap: 4px;
}

.starred-mail-info span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.starred-mail-address {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #d9d1c4;
  border-radius: 8px;
  background: #fff;
  color: var(--teal);
  font-weight: 850;
  text-align: left;
  overflow-wrap: anywhere;
}

.starred-mail-address.disabled {
  color: var(--muted);
}

.starred-mail-actions {
  align-items: stretch;
}

.attachment-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #ebe6dc;
  border-radius: 8px;
  background: #fffdf9;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-button.disabled {
  opacity: 0.55;
  pointer-events: none;
}

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

.customer-ai-summary {
  display: grid;
  gap: 5px;
  min-width: 0;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #b7ded7;
  border-radius: 8px;
  background: #eefaf7;
}

.customer-ai-summary span {
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
}

.customer-ai-summary strong {
  color: #1f3f3b;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.structured-card-panel .customer-ai-summary {
  margin-top: 0;
}

.attachment-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #e4ded1;
  border-radius: 8px;
  background: #fff;
}

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

.attachment-item strong,
.attachment-item span {
  display: block;
  overflow-wrap: anywhere;
}

.attachment-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.email-card-actions {
  margin-top: 10px;
}

.email-translation-snippet,
.email-translation-box {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #d7ece8;
  border-radius: 8px;
  background: #f3fbf8;
}

.email-translation-snippet strong,
.email-translation-box strong {
  color: var(--teal);
  font-size: 13px;
}

.email-translation-snippet span {
  color: #36524f;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.email-translation-box pre {
  max-height: 420px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #243c39;
  line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.email-detail {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid #bdded8;
  border-radius: 8px;
  background: #f7fffc;
}

.email-detail .card-head {
  margin-bottom: 0;
}

.email-detail h2 {
  margin: 8px 0 0;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.email-attachments {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d9eee9;
  border-radius: 8px;
  background: #fff;
}

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

.email-meta-grid div {
  padding: 9px 10px;
  border: 1px solid #d9eee9;
  border-radius: 8px;
  background: #fff;
}

.email-meta-grid span,
.email-meta-grid strong {
  display: block;
}

.email-meta-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.email-meta-grid strong {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.email-full-body,
.email-headers pre {
  width: 100%;
  max-height: 520px;
  margin: 0;
  overflow: auto;
  padding: 14px;
  border: 1px solid #d9eee9;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.email-headers summary {
  color: var(--teal);
  cursor: pointer;
  font-weight: 800;
}

.config-card {
  display: grid;
  gap: 10px;
}

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

.config-grid div {
  min-height: 52px;
  padding: 8px;
  border-radius: 8px;
  background: #fff;
}

.config-grid span,
.config-grid b {
  display: block;
}

.config-grid span {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.config-grid b {
  margin-top: 5px;
  color: var(--ink);
  font-size: 13px;
}

.research-layout {
  grid-template-columns: minmax(380px, 0.95fr) minmax(440px, 1.05fr);
}

.research-history {
  min-height: 0;
}

.research-history[open] {
  min-height: 360px;
}

.research-history-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  list-style: none;
}

.research-history-summary::-webkit-details-marker {
  display: none;
}

.research-history-summary h2 {
  margin: 0;
}

.research-history-summary span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.research-history-summary > strong {
  color: var(--teal);
  font-size: 13px;
  white-space: nowrap;
}

.research-history[open] .research-history-summary > strong {
  font-size: 0;
}

.research-history[open] .research-history-summary > strong::after {
  content: '收起';
  font-size: 13px;
}

.research-history-content {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.rich-card-input {
  display: grid;
  gap: 10px;
  width: 100%;
}

.rich-card-input.drag-active .rich-card-editor {
  border-color: var(--teal);
  background: #f2fbf8;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.rich-card-editor {
  min-height: 160px;
  white-space: pre-wrap;
  word-break: break-word;
}

.rich-card-editor:empty::before,
.rich-card-editor[data-empty="true"]::before {
  content: attr(data-placeholder);
  color: #8a8172;
  pointer-events: none;
}

.rich-card-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.rich-card-media-item {
  position: relative;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 8px;
  border: 1px solid #d7ebe7;
  border-radius: 8px;
  background: #fffdf9;
}

.rich-card-media-item.error {
  border-color: #f0c4b8;
  background: #fff7f4;
}

.rich-card-media-item img {
  width: 100%;
  height: 116px;
  object-fit: contain;
  border-radius: 6px;
  background: #f7f7f4;
}

.rich-card-media-item figcaption {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.rich-card-media-item figcaption strong,
.rich-card-media-item figcaption span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rich-card-media-item figcaption strong {
  font-size: 13px;
}

.rich-card-media-item figcaption span,
.rich-card-message {
  color: var(--muted);
  font-size: 12px;
}

.rich-card-remove {
  justify-self: start;
  border: 0;
  background: transparent;
  color: #7f1d1d;
  font-weight: 800;
  cursor: pointer;
}

.structured-card-panel {
  display: grid;
  gap: 14px;
}

.structured-card-panel .card-head small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.structured-card-grid {
  display: grid;
  gap: 8px;
}

.structured-card-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 9px 10px;
  border: 1px solid #ebe6dc;
  border-radius: 8px;
  background: #fffdf9;
}

.structured-card-row > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.structured-card-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.35;
}

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

.structured-card-website strong {
  flex: 1 1 260px;
}

.structured-card-open-link.btn {
  min-height: 30px;
  padding: 5px 9px;
  white-space: nowrap;
}

.structured-card-summary-row {
  border-color: #b7ded7;
  background: #eefaf7;
}

.structured-card-summary-text {
  color: #1f3f3b;
}

.structured-card-list {
  display: grid;
  gap: 4px;
}

.research-report {
  display: grid;
  gap: 14px;
}

.research-report.featured {
  border-color: #bdded8;
}

.research-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.research-head h2 {
  margin-bottom: 5px;
}

.research-head p,
.research-summary {
  color: var(--muted);
  line-height: 1.55;
}

.research-score {
  display: grid;
  place-items: center;
  min-width: 96px;
  min-height: 76px;
  padding: 10px;
  border-radius: 8px;
  background: #f2fbf8;
  border: 1px solid #cfe5e1;
}

.research-score strong {
  font-size: 30px;
  color: var(--teal);
}

.research-score span {
  color: #2e5f59;
  font-size: 12px;
  font-weight: 800;
}

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

.research-primary-signal {
  margin: 0;
}

.research-detail-fold {
  display: grid;
  gap: 10px;
}

.research-detail-fold summary {
  width: fit-content;
  color: var(--teal);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}

.research-detail-fold[open] summary {
  margin-bottom: 10px;
}

.signal {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #ebe6dc;
  background: #fffdf9;
}

.signal.positive {
  border-color: #cfe5d7;
  background: #f4fbf6;
}

.signal.warning {
  border-color: #f0d6c8;
  background: #fff7f2;
}

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

.signal strong {
  margin-bottom: 4px;
  font-size: 13px;
}

.signal span {
  color: var(--muted);
  line-height: 1.45;
  font-size: 13px;
}

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

.link-grid a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid #cfe5e1;
  border-radius: 999px;
  color: var(--teal);
  background: #f2fbf8;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.web-layout {
  grid-template-columns: minmax(360px, 0.85fr) minmax(520px, 1.15fr);
}

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

.shortcut-card {
  display: grid;
  gap: 5px;
  min-height: 82px;
  padding: 12px;
  border: 1px solid #ebe6dc;
  border-radius: 8px;
  background: #fffdf9;
  color: var(--ink);
  text-align: left;
}

.shortcut-card:hover {
  border-color: #bdded8;
  background: #f6fffc;
}

.shortcut-card:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.shortcut-card strong,
.shortcut-card span {
  display: block;
}

.shortcut-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.web-preview-panel {
  min-height: 640px;
}

.web-frame {
  width: 100%;
  min-height: 560px;
  border: 1px solid #ebe6dc;
  border-radius: 8px;
  background: #fff;
}

.gpt-layout {
  grid-template-columns: minmax(420px, 1fr) minmax(420px, 1fr);
}

.ai-assistant-page {
  max-width: 1480px;
}

.ai-assistant-layout {
  display: grid;
  grid-template-columns: minmax(540px, 1.2fr) minmax(420px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.ai-chat-panel,
.ai-translate-panel {
  gap: 16px;
}

.muted-text {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.ai-chat-thread {
  min-height: 460px;
  max-height: 620px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 16px;
  border: 1px solid #e7dfd3;
  border-radius: 8px;
  background: #fbf8f2;
}

.ai-message {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.ai-message-label {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #d9eee9;
  color: var(--teal);
  font-weight: 900;
}

.ai-message-user .ai-message-label {
  background: #e7f0fb;
  color: #21476e;
}

.ai-message-body {
  min-width: 0;
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid #e3dacd;
  border-radius: 8px;
  background: #fffdf9;
  box-shadow: 0 10px 24px rgba(30, 40, 55, 0.06);
}

.ai-message-user .ai-message-body {
  background: #eef7ff;
  border-color: #d7e6f2;
}

.ai-message-body pre {
  margin: 0;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.42;
  font-family: inherit;
  font-size: 15px;
}

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

.ai-chat-input,
.ai-translate-input {
  line-height: 1.42;
  font-size: 15px;
}

.ai-chat-input {
  min-height: 72px;
  max-height: 180px;
}

.ai-chat-input:focus {
  transform: none;
}

.ai-translate-input {
  min-height: 260px;
}

.ai-translate-input:focus {
  transform: none;
}

.ai-translate-direction {
  margin: -8px 0 0;
  color: #8b929a;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
}

.visually-hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.ai-attachment-dropzone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px dashed #b7d8d2;
  border-radius: 8px;
  background: #f3fbf8;
}

.ai-attachment-dropzone div {
  display: grid;
  gap: 3px;
}

.ai-attachment-dropzone strong {
  color: var(--ink);
  font-size: 14px;
}

.ai-attachment-dropzone span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.ai-attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-attachment-list-compact {
  margin-top: 2px;
}

.ai-attachment-chip {
  max-width: min(100%, 360px);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border: 1px solid #d5e7e3;
  border-radius: 8px;
  background: #f6fffc;
  color: var(--ink);
  font-size: 12px;
}

.ai-attachment-chip img {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #dbe8e5;
}

.ai-attachment-chip b {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 24px;
  border-radius: 6px;
  background: #e3f2ef;
  color: var(--teal);
  font-size: 10px;
  letter-spacing: 0;
}

.ai-attachment-chip em {
  min-width: 0;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: normal;
  font-weight: 750;
}

.ai-attachment-chip small {
  color: var(--muted);
  white-space: nowrap;
}

.ai-attachment-chip button {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #fff1f0;
  color: #b42318;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.ai-action-row {
  align-items: center;
}

.ai-translation-result {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid #cde7e2;
  border-radius: 8px;
  background: #f0fbf8;
}

.ai-translation-result pre {
  min-height: 240px;
  max-height: 420px;
  margin: 0;
  overflow: auto;
  padding: 14px;
  border: 1px solid #d9eee9;
  border-radius: 8px;
  background: #fffdf9;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.62;
  font-family: inherit;
}

.ai-result-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid #cde7e2;
  border-radius: 8px;
  background: #f0fbf8;
}

.ai-result-card pre {
  min-height: 140px;
  max-height: 420px;
  margin: 0;
  overflow: auto;
  padding: 14px;
  border: 1px solid #d9eee9;
  border-radius: 8px;
  background: #fffdf9;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.62;
  font-family: inherit;
}

.ai-config-details {
  gap: 12px;
}

.ai-config-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.ai-config-details summary::-webkit-details-marker {
  display: none;
}

.ai-config-details[open] summary {
  margin-bottom: 10px;
}

.gpt-secret-note {
  align-self: end;
  gap: 6px;
  padding: 12px 14px;
}

.gpt-secret-note span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 1120px) {
  .ai-assistant-layout {
    grid-template-columns: 1fr;
  }
}

.qa-layout {
  grid-template-columns: minmax(390px, 0.9fr) minmax(480px, 1.1fr);
}

.qa-results {
  align-content: start;
}

.qa-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #ebe6dc;
  border-radius: 8px;
  background: #fffdf9;
}

.qa-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.qa-card-head strong {
  line-height: 1.4;
}

.qa-card-head span {
  flex: 0 0 auto;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f2fbf8;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
}

.qa-card p {
  margin: 0;
  color: #34383c;
  line-height: 1.55;
}

.qa-card small {
  color: var(--muted);
  line-height: 1.45;
}

.qa-detail-modal {
  width: min(860px, calc(100vw - 48px));
  padding: 0;
}

.qa-detail-body {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.qa-detail-summary {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(15, 118, 110, 0.12);
  border-radius: 8px;
  background: #f2fbf8;
  color: var(--teal);
  text-align: left;
  cursor: pointer;
}

.qa-detail-summary:hover {
  border-color: rgba(15, 118, 110, 0.28);
  background: #e8f7f2;
}

.qa-detail-summary-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.qa-detail-summary-head strong,
.qa-detail-summary-head span {
  font-size: 12px;
  font-weight: 850;
}

.qa-detail-summary p {
  display: -webkit-box;
  margin: 0;
  color: #175f58;
  line-height: 1.55;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.qa-detail-expanded {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid #ebe6dc;
  border-radius: 8px;
  background: #fffdf9;
}

.qa-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.qa-detail-meta span {
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #f2fbf8;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
}

.qa-detail-section {
  display: grid;
  gap: 8px;
}

.qa-detail-section h3 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0;
}

.qa-detail-question {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 850;
  line-height: 1.55;
}

.qa-detail-answer {
  padding: 14px;
  border: 1px solid #ebe6dc;
  border-radius: 8px;
  background: #fffdf9;
  color: #34383c;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.qa-detail-text {
  color: #34383c;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.qa-detail-warning {
  margin: 0;
  color: var(--gold);
  font-size: 13px;
  font-weight: 750;
}

.qa-detail-reference .qa-detail-answer {
  background: #faf8f2;
}

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

.small-line {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

.load-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  color: var(--muted);
  font-size: 14px;
}

.document-product-dropzone {
  display: grid;
  gap: 4px;
  min-height: 58px;
  padding: 12px 14px;
  border: 1.5px dashed #c9d8d2;
  border-radius: 8px;
  background: #f7fbf9;
  color: #53615d;
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.document-product-dropzone strong {
  color: var(--teal);
  font-size: 14px;
  font-weight: 850;
}

.document-product-dropzone span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.document-product-dropzone.is-dragging {
  border-color: var(--teal);
  background: #eefbf8;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.10);
}

.document-product-dropzone.is-importing {
  border-color: #94a3b8;
  background: #f8fafc;
}

.document-product-dropzone.is-success {
  border-color: #a7d8cf;
  background: #f2fbf8;
}

.document-product-dropzone.is-error {
  border-color: #fecaca;
  background: #fff7f7;
}

.document-product-dropzone.is-error strong {
  color: var(--red);
}

.document-items-wrap {
  overflow-x: auto;
}

.document-items {
  min-width: 1800px;
  table-layout: fixed;
}

.document-items th:nth-child(1),
.document-items td:nth-child(1) {
  width: 72px;
}

.document-items th:nth-child(2),
.document-items td:nth-child(2) {
  width: 150px;
}

.document-items th:nth-child(3),
.document-items td:nth-child(3) {
  width: 250px;
}

.document-items th:nth-child(4),
.document-items td:nth-child(4),
.document-items th:nth-child(5),
.document-items td:nth-child(5),
.document-items th:nth-child(6),
.document-items td:nth-child(6),
.document-items th:nth-child(9),
.document-items td:nth-child(9),
.document-items th:nth-child(10),
.document-items td:nth-child(10) {
  width: 150px;
}

.document-items th:nth-child(8),
.document-items td:nth-child(8) {
  width: 220px;
}

.document-items th:nth-child(11),
.document-items td:nth-child(11) {
  width: 130px;
}

.document-items th:nth-child(12),
.document-items td:nth-child(12) {
  width: 96px;
}

.document-items th,
.document-items td {
  text-align: center;
}

.document-items .input {
  min-height: 38px;
  padding: 8px 9px;
  text-align: center;
}

.document-row-index {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
}

.document-items thead .document-row-index,
.document-items thead .document-row-action {
  z-index: 3;
  background: var(--panel-soft);
  color: var(--text);
}

.document-row-action {
  position: sticky;
  right: 0;
  z-index: 2;
  background: #fff;
}

.document-delete-button {
  width: 72px;
}

.document-items th.document-column-category,
.document-items td.document-column-category {
  width: 150px;
}

.document-items th.document-column-product,
.document-items td.document-column-product {
  width: 250px;
}

.document-items th.document-column-remark,
.document-items td.document-column-remark {
  width: 220px;
}

.document-items th.document-column-total-price,
.document-items td.document-column-total-price {
  width: 130px;
}

.document-items th.document-column-size,
.document-items td.document-column-size,
.document-items th.document-column-finish,
.document-items td.document-column-finish,
.document-items th.document-column-material,
.document-items td.document-column-material,
.document-items th.document-column-grade,
.document-items td.document-column-grade,
.document-items th.document-column-quantity,
.document-items td.document-column-quantity,
.document-items th.document-column-unit-price,
.document-items td.document-column-unit-price {
  width: 150px;
}

.document-column-header {
  display: grid;
  min-height: 62px;
  align-content: center;
  justify-items: center;
  gap: 6px;
}

.document-column-title {
  display: block;
  font-weight: 900;
  line-height: 1.25;
}

.document-column-remove,
.document-restore-column {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  line-height: 1;
}

.document-column-remove {
  padding: 5px 9px;
  font-size: 12px;
}

.document-column-remove:hover,
.document-restore-column:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.document-column-remove:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.document-hidden-columns {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  font-weight: 800;
}

.document-restore-column {
  min-height: 30px;
  padding: 6px 11px;
  font-size: 13px;
}

.document-restore-column.strong {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.document-cell-field {
  display: grid;
  gap: 5px;
  min-height: 68px;
  align-content: start;
}

.document-header-field {
  display: grid;
  min-height: 38px;
  align-items: center;
}

.document-header-field .input {
  min-height: 34px;
  border-color: var(--border);
  background: #fff;
  color: var(--text);
  font-weight: 800;
  text-align: center;
}

.document-header-field .input::placeholder {
  color: var(--muted);
}

.document-cell-field .input {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-cn-ref {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
}

.document-total-cell {
  vertical-align: top;
}

.document-total-cell strong {
  display: grid;
  min-height: 38px;
  place-items: center;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #f8faf9;
  color: var(--text);
  font-size: 15px;
}

.document-total-cell span {
  display: block;
  min-height: 18px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.document-parser-panel {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(260px, 0.55fr);
  gap: 14px;
  align-items: stretch;
}

.document-parser-input {
  display: grid;
  gap: 12px;
}

.document-parser-preview {
  align-content: start;
}

.parser-preview-list {
  display: grid;
  gap: 8px;
}

.parser-preview-list span {
  display: block;
  padding: 8px 10px;
  border: 1px solid #d7ebe7;
  border-radius: 8px;
  background: #f2fbf8;
  color: #245550;
  font-size: 13px;
  line-height: 1.35;
}

.document-product-parse-modal {
  width: min(1180px, calc(100vw - 48px));
}

.document-product-parse-body {
  display: grid;
  gap: 14px;
  padding: 18px 22px 22px;
}

.document-product-parse-summary {
  align-content: start;
}

.document-product-parse-table-wrap {
  max-height: min(560px, calc(100vh - 260px));
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.document-product-parse-table {
  min-width: 980px;
  table-layout: fixed;
}

.document-product-parse-table th,
.document-product-parse-table td {
  text-align: center;
  vertical-align: middle;
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
}

.document-product-parse-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-soft);
}

.document-product-parse-table td:nth-child(1),
.document-product-parse-table td:nth-child(3) {
  text-align: left;
}

.document-preview-panel {
  display: grid;
  gap: 14px;
}

.document-preview-scroll {
  overflow-x: auto;
  padding: 14px;
  border: 1px solid #e6edf5;
  border-radius: 8px;
  background: #eef3f7;
}

.document-preview-sheet {
  display: grid;
  gap: 14px;
  width: 1120px;
  min-height: 720px;
  padding: 22px 24px 18px;
  border: 1px solid #dbe5ef;
  border-radius: 12px;
  background: #f4f7fa;
  color: #1f2937;
  box-shadow: 0 14px 34px rgba(31, 66, 104, 0.08);
}

.document-preview-header {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 150px;
  overflow: hidden;
  border: 0;
  background: transparent;
}

.document-preview-logo {
  display: grid;
  place-items: center;
  min-height: 82px;
  color: #1f4268;
  font-size: 36px;
  font-weight: 900;
  font-style: italic;
}

.document-preview-logo img {
  display: block;
  max-width: 124px;
  max-height: 66px;
  object-fit: contain;
}

.document-preview-header-spacer {
  min-height: 82px;
}

.document-preview-company {
  display: grid;
  gap: 6px;
  align-content: center;
  min-height: 82px;
  padding: 10px 18px;
  text-align: center;
}

.document-preview-company strong {
  font-size: 24px;
  line-height: 1.15;
}

.document-preview-company span {
  color: #4b5563;
  font-size: 12px;
  line-height: 1.35;
}

.document-preview-title {
  margin: 0;
  color: #1f4268;
  font-size: 24px;
  line-height: 1.2;
  text-align: center;
  text-decoration: underline;
}

.document-preview-meta,
.document-preview-parties,
.document-preview-notes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border: 1px solid #dbe5ef;
}

.document-preview-meta > div,
.document-preview-parties > div,
.document-preview-notes > div {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 8px;
  min-height: 36px;
  padding: 8px 10px;
  border-right: 1px solid #e5edf5;
  border-bottom: 1px solid #e5edf5;
  background: #fbfcfe;
  align-items: center;
}

.document-preview-meta strong,
.document-preview-parties strong,
.document-preview-notes strong {
  color: #1f4268;
  font-size: 12px;
  text-align: right;
}

.document-preview-meta span,
.document-preview-parties span,
.document-preview-notes span {
  min-width: 0;
  color: #1f2937;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

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

.document-preview-parties > div {
  display: block;
  min-height: 86px;
}

.document-preview-parties span {
  display: block;
}

.document-preview-parties strong {
  display: block;
  margin-bottom: 4px;
  text-align: left;
}

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

.document-preview-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.document-preview-table th,
.document-preview-table td {
  padding: 8px 8px;
  border: 1px solid #dbe5ef;
  line-height: 1.35;
  text-align: center;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.document-preview-table td {
  background: #fcfdfe;
}

.document-preview-table th {
  background: #1f4268;
  color: #fff;
  font-weight: 800;
}

.document-preview-table.factory-preview td:nth-child(8) {
  text-align: left;
}

.document-preview-table.factory-preview td:nth-child(10) {
  background: #fbfcfe;
}

.document-preview-table tbody tr:nth-child(odd) td {
  background: #f8fafc;
}

.document-preview-total-row td {
  background: #eaf1f7 !important;
  color: #1f4268;
  font-weight: 850;
}

.document-preview-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #dbe5ef;
  color: #6b7280;
  font-size: 11px;
}

.document-preview-footer strong {
  color: #6b7280;
}

.reply-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #ebe6dc;
  border-radius: 8px 8px 0 0;
  background: #fffdf9;
}

.reply-tab-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reply-tab {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
}

.reply-tab.active {
  border-color: #bdded8;
  background: #f2fbf8;
  color: var(--teal);
}

.reply-output {
  padding: 12px;
  border: 1px solid #ebe6dc;
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: #fffdf9;
}

.prompt-box,
.reply-box {
  min-height: 320px;
  line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.reply-output .reply-box {
  min-height: 0;
}

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

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

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

  .toolbar,
  .topbar,
  .two-column,
  .report-layout,
  .document-parser-panel,
  .modal-head,
  .customer-io-grid,
  .info-grid,
  .analytics-chart-grid,
  .audit-filter-grid,
  .employee-performance-grid {
    grid-template-columns: 1fr;
  }

  .audit-filter-grid .field:last-child {
    grid-column: auto;
  }

  .customer-io-head {
    display: grid;
  }

  .modal-backdrop {
    align-items: stretch;
    padding: 12px;
  }

  .modal-panel {
    width: 100%;
    max-height: calc(100vh - 24px);
  }

  .modal-head {
    display: grid;
  }

  .whatsapp-layout > .form-grid,
  .wa-workbench-timeline {
    width: auto;
    min-width: 0;
    max-width: none;
    height: auto;
    min-height: 0;
    max-height: none;
    resize: none;
  }

  .whatsapp-layout {
    --whatsapp-chat-shell-height: clamp(580px, calc(100vh - 190px), 740px);
  }

  .whatsapp-chat-shell {
    grid-template-columns: minmax(255px, 30%) minmax(0, 1fr);
    height: var(--whatsapp-chat-shell-height);
  }

  .whatsapp-chat-shell.is-collapsed {
    grid-template-columns: 70px minmax(0, 1fr);
  }

  .topbar {
    display: grid;
  }
}

@media (max-width: 900px) {
  .report-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-text-grid {
    grid-template-columns: 1fr;
  }

  .trade-ledger-version-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .orders-missing-pi-alert {
    align-items: stretch;
    flex-direction: column;
  }

  .orders-missing-pi-filter.btn {
    width: 100%;
  }

  .content,
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .grid-2,
  .grid-3,
  .grid-4,
  .email-meta-grid,
  .shortcut-grid,
  .starred-mail-grid,
  .stat-grid,
  .audit-summary-grid,
  .employee-performance-grid {
    grid-template-columns: 1fr;
  }

  .top-stats {
    grid-template-columns: repeat(4, minmax(78px, 1fr));
  }

  .audit-log-row {
    grid-template-columns: 1fr;
  }

  .audit-main-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .audit-row-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .audit-undo-backdrop {
    padding: 12px;
  }

  .modal-panel.audit-undo-modal {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }

  .audit-undo-summary {
    grid-template-columns: 1fr;
  }

  .employee-performance-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .customer-tag-create {
    grid-template-columns: 1fr;
  }

  .customer-tag-picker {
    width: min(520px, calc(100vw - 32px));
    min-width: 0;
  }

  .customer-tag-picker-head {
    grid-template-columns: 1fr;
  }

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

  .whatsapp-layout {
    --whatsapp-chat-shell-height: 620px;
  }

  .whatsapp-chat-shell {
    grid-template-columns: minmax(220px, 42%) minmax(0, 1fr);
    height: var(--whatsapp-chat-shell-height);
  }

  .whatsapp-chat-shell.is-collapsed {
    grid-template-columns: 66px minmax(0, 1fr);
  }

  .whatsapp-chat-sidebar {
    overflow-x: hidden;
  }

  .whatsapp-chat-sidebar .whatsapp-conversation {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 8px;
  }

  .detail-hero {
    display: grid;
  }
}

@media (max-width: 600px) {
  .report-metric-grid {
    grid-template-columns: 1fr;
  }

  .trade-ledger-column-settings-head {
    align-items: stretch;
    flex-direction: column;
  }

  .trade-ledger-column-settings-actions {
    justify-content: flex-end;
  }

  .trade-ledger-filter-row.primary,
  .trade-ledger-filter-row.advanced,
  .trade-ledger-column-grid,
  .trade-ledger-edit-grid,
  .trade-ledger-note-grid,
  .trade-ledger-document-edit,
  .trade-ledger-report-grid {
    grid-template-columns: 1fr;
  }

  .trade-ledger-manual-grid {
    grid-template-columns: 1fr;
  }

  .trade-ledger-version-history-head,
  .trade-ledger-version-card-head {
    display: grid;
  }

  .trade-ledger-version-history-actions,
  .trade-ledger-version-badges,
  .trade-ledger-version-card-actions {
    justify-content: flex-start;
  }

  .trade-ledger-version-meta-grid {
    grid-template-columns: 1fr;
  }

  .trade-ledger-version-modal-backdrop {
    padding: 10px;
  }

  .trade-ledger-version-modal {
    width: 100%;
    max-height: calc(100vh - 20px);
  }

  .trade-ledger-version-modal-body {
    max-height: calc(100vh - 220px);
    padding: 14px;
  }

  .trade-ledger-version-diff-head {
    display: none;
  }

  .trade-ledger-version-diff-row {
    grid-template-columns: 1fr;
  }

  .trade-ledger-version-diff-row + .trade-ledger-version-diff-row {
    border-top-width: 4px;
  }

  .trade-ledger-version-diff-row > * {
    border-right: 0;
    border-bottom: 1px solid #ece8df;
  }

  .trade-ledger-version-diff-row > *:last-child {
    border-bottom: 0;
  }

  .trade-ledger-version-before,
  .trade-ledger-version-after {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 8px;
  }

  .trade-ledger-version-before::before,
  .trade-ledger-version-after::before {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
  }

  .trade-ledger-version-before::before {
    content: '修改前';
  }

  .trade-ledger-version-after::before {
    content: '修改后';
  }

  .trade-ledger-version-diff.is-preview .trade-ledger-version-before::before {
    content: '当前值';
  }

  .trade-ledger-version-diff.is-preview .trade-ledger-version-after::before {
    content: '恢复后';
  }
}

.fatal-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--surface);
}

.fatal-panel {
  width: min(560px, 100%);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.fatal-panel h1 {
  margin: 4px 0 12px;
}

.fatal-panel pre {
  max-height: 160px;
  overflow: auto;
  padding: 12px;
  border-radius: 8px;
  background: #f4f1ea;
  color: var(--muted);
  white-space: pre-wrap;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 48%) minmax(0, 52%);
  background: var(--login-bg);
  color: var(--login-text);
  overflow: hidden;
}

.login-panel {
  width: min(460px, 100%);
  display: grid;
  gap: 16px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-panel h1 {
  font-size: 28px;
}

.login-screen-loading {
  grid-template-columns: 1fr;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 25% 18%, rgba(15, 118, 110, 0.09), transparent 28%),
    var(--bg);
}

.login-brand-panel {
  position: relative;
  display: grid;
  align-items: center;
  min-height: 100vh;
  padding: clamp(44px, 6vw, 84px);
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 30%, rgba(10, 128, 110, 0.10), transparent 36%),
    linear-gradient(135deg, #f5fbf8 0%, #eef7f3 48%, #f8faf9 100%);
}

.login-brand-panel::before,
.login-brand-panel::after {
  content: '';
  position: absolute;
  pointer-events: none;
}

.login-brand-panel::before {
  inset: 8% 5% auto auto;
  width: 64%;
  height: 44%;
  border: 1px solid rgba(8, 122, 106, 0.08);
  border-radius: 50%;
  transform: rotate(-12deg);
}

.login-brand-panel::after {
  left: -12%;
  bottom: -18%;
  width: 62%;
  height: 42%;
  border-radius: 50%;
  background: rgba(8, 122, 106, 0.05);
}

.login-brand-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.06;
  background:
    linear-gradient(115deg, transparent 0 18%, #087a6a 18.2% 18.5%, transparent 18.7% 100%),
    linear-gradient(35deg, transparent 0 32%, #087a6a 32.2% 32.5%, transparent 32.7% 100%),
    radial-gradient(circle at 72% 24%, #087a6a 0 2px, transparent 3px),
    radial-gradient(circle at 54% 52%, #087a6a 0 2px, transparent 3px),
    radial-gradient(circle at 30% 64%, #087a6a 0 2px, transparent 3px);
}

.login-brand-inner {
  position: relative;
  z-index: 1;
  max-width: 620px;
}

.login-brand-logo {
  display: block;
  width: clamp(88px, 8vw, 120px);
  height: auto;
  margin-bottom: 30px;
}

.login-brand-kicker {
  margin: 0 0 12px;
  color: var(--login-primary);
  font-size: 22px;
  font-weight: 700;
}

.login-brand-inner h1 {
  margin: 0;
  color: #17212b;
  font-size: clamp(40px, 4vw, 52px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: 0;
}

.login-brand-subtitle {
  max-width: 560px;
  margin: 22px 0 0;
  color: #4b5563;
  font-size: 17px;
  line-height: 1.8;
}

.login-brand-caption {
  margin: 12px 0 0;
  color: #71807b;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0;
}

.login-form-panel {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 48px;
  background: #fbfcfb;
}

.login-card {
  width: min(460px, 100%);
  padding: 40px 42px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 20px;
  background: var(--login-card);
  box-shadow:
    0 24px 60px rgba(15, 23, 42, 0.10),
    0 4px 14px rgba(15, 23, 42, 0.06);
}

.login-card-header {
  margin-bottom: 30px;
  text-align: center;
}

.login-card-header h2 {
  margin: 0;
  color: var(--login-text);
  font-size: 34px;
  font-weight: 800;
  line-height: 1.2;
}

.login-card-header p {
  margin: 8px 0 0;
  color: var(--login-muted);
  font-size: 15px;
}

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

.login-field {
  display: grid;
  gap: 8px;
  color: #374151;
  font-size: 14px;
  font-weight: 700;
}

.login-field .input {
  width: 100%;
  height: 48px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--login-border);
  border-radius: 12px;
  background: #fff;
  color: var(--login-text);
  font-size: 15px;
  box-shadow: none;
}

.login-field .input:hover {
  border-color: #b8c7c0;
}

.login-field .input:focus {
  border-color: #0b7d6b;
  outline: none;
  box-shadow: 0 0 0 3px rgba(11, 125, 107, 0.12);
}

.login-field .input::placeholder {
  color: #9ca3af;
}

.login-password-wrap {
  position: relative;
}

.login-password-wrap .input {
  padding-right: 62px;
}

.login-password-toggle {
  position: absolute;
  top: 50%;
  right: 12px;
  padding: 3px 4px;
  border: 0;
  background: transparent;
  color: var(--login-primary);
  font-size: 13px;
  font-weight: 800;
  transform: translateY(-50%);
}

.login-password-toggle:hover {
  color: var(--login-primary-dark);
}

.login-error {
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 10px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}

.login-submit.btn {
  width: 100%;
  height: 48px;
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--login-primary);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease, opacity 0.16s ease;
}

.login-submit.btn:hover:not(:disabled) {
  background: var(--login-primary-dark);
  box-shadow: 0 10px 22px rgba(8, 122, 106, 0.22);
  transform: translateY(-1px);
}

.login-submit.btn:active:not(:disabled) {
  transform: translateY(0);
}

.login-submit.btn:disabled {
  opacity: 0.8;
  cursor: not-allowed;
}

.login-version {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  color: #9ca3af;
  font-size: 13px;
  font-weight: 650;
  text-align: center;
}

.login-copyright {
  position: absolute;
  left: 50%;
  bottom: 24px;
  margin: 0;
  color: #9ca3af;
  font-size: 12px;
  transform: translateX(-50%);
  white-space: nowrap;
}

@media (max-width: 900px) {
  .login-screen {
    grid-template-columns: 1fr;
    min-height: 100vh;
    overflow-y: auto;
  }

  .login-brand-panel {
    min-height: auto;
    padding: 34px 28px 26px;
  }

  .login-brand-panel::before,
  .login-brand-panel::after,
  .login-brand-pattern {
    display: none;
  }

  .login-brand-logo {
    width: 76px;
    margin-bottom: 18px;
  }

  .login-brand-kicker {
    margin-bottom: 8px;
    font-size: 18px;
  }

  .login-brand-inner h1 {
    font-size: 32px;
  }

  .login-brand-subtitle {
    margin-top: 12px;
    font-size: 15px;
    line-height: 1.65;
  }

  .login-brand-caption {
    display: none;
  }

  .login-form-panel {
    min-height: auto;
    padding: 28px 16px 54px;
  }

  .login-card {
    width: min(480px, calc(100vw - 32px));
    padding: 28px;
  }

  .login-card-header h2 {
    font-size: 30px;
  }

  .login-copyright {
    bottom: 18px;
  }
}

@media (max-width: 560px) {
  .login-screen {
    background: #fbfcfb;
  }

  .login-brand-panel {
    padding: 24px 16px 18px;
  }

  .login-brand-logo {
    width: 68px;
    margin-bottom: 14px;
  }

  .login-brand-kicker {
    font-size: 16px;
  }

  .login-brand-inner h1 {
    font-size: 30px;
  }

  .login-brand-subtitle {
    font-size: 14px;
  }

  .login-form-panel {
    padding: 18px 16px 52px;
  }

  .login-card {
    width: 100%;
    padding: 24px;
    border-radius: 16px;
  }

  .login-field .input,
  .login-submit.btn {
    height: 46px;
    min-height: 46px;
  }
}

.permission-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.permission-side {
  display: grid;
  gap: 16px;
}

.employee-list {
  display: grid;
  gap: 10px;
}

.employee-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
  text-align: left;
}

.employee-row.active,
.employee-row:hover {
  border-color: #93c5c0;
  background: #edf9f6;
}

.employee-row > div,
.team-row > div {
  min-width: 0;
}

.employee-row strong,
.employee-row span,
.employee-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.employee-row span,
.employee-row small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.team-admin-card {
  display: grid;
  gap: 14px;
}

.team-edit-form {
  display: grid;
  gap: 14px;
}

.collapsed-editor {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px dashed #c9ded9;
  border-radius: 8px;
  background: #f3fbf8;
  color: #33524d;
}

.collapsed-editor strong {
  color: var(--ink);
}

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

.team-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.team-row.active,
.team-row:hover {
  border-color: #93c5c0;
  background: #edf9f6;
}

.team-row strong,
.team-row span,
.team-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-row span,
.team-row small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.compact-grid {
  gap: 10px;
}

.team-member-box {
  display: grid;
  gap: 10px;
}

.team-member-box h3 {
  margin: 0;
  font-size: 15px;
}

.team-member-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 2px;
}

.team-member-check {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid #e5dfd4;
  border-radius: 8px;
  background: var(--panel-soft);
  color: #3f484d;
  font-size: 13px;
  font-weight: 750;
}

.team-member-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--teal);
}

.permission-form {
  gap: 14px;
  align-content: start;
}

.permission-template-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #cfdedb;
  border-radius: 8px;
  background: #f3f7f6;
}

.permission-step-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 3px;
  border: 1px solid #d9e2df;
  border-radius: 7px;
  background: #e9efed;
}

.permission-step-strip span {
  min-width: 0;
  padding: 6px 8px;
  border-radius: 5px;
  color: #687278;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.permission-step-strip span.active {
  background: #fff;
  color: var(--teal-dark);
  box-shadow: 0 1px 3px rgba(31, 41, 55, 0.08);
}

.permission-template-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) auto minmax(240px, 1.1fr);
  gap: 10px;
  align-items: end;
}

.permission-template-row .btn {
  min-height: 42px;
}

.permission-template-status {
  min-width: 0;
  min-height: 42px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-left: 3px solid #78aaa3;
  background: #fff;
  color: #4c565c;
}

.permission-template-status strong {
  color: #233035;
  font-size: 13px;
  white-space: nowrap;
}

.permission-template-status span,
.permission-template-status small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.permission-template-status small {
  color: #a15c14;
}

.permission-editor,
.permission-advanced {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

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

.permission-editor-head > div {
  display: grid;
  gap: 1px;
}

.permission-editor-head h3 {
  margin: 0;
  font-size: 15px;
}

.permission-editor-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.permission-password-control {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
}

.permission-password-control > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.permission-password-control > .button {
  justify-self: stretch;
  min-height: 42px;
}

.permission-search {
  width: min(280px, 44%);
  min-height: 36px;
  height: 36px;
  font-size: 13px;
}

.permission-shared {
  display: grid;
  gap: 7px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  background: #eef8f6;
}

.permission-shared-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.permission-shared-head > div {
  display: grid;
  gap: 2px;
}

.permission-shared-head strong {
  color: var(--teal-dark);
  font-size: 13px;
}

.permission-shared-head span,
.permission-shared-item > small {
  color: #66756f;
  font-size: 11px;
}

.permission-shared-count {
  min-width: 44px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #d9eee9;
  color: var(--teal-dark) !important;
  font-weight: 800;
  text-align: center;
}

.permission-shared-list {
  display: grid;
  gap: 6px;
}

.permission-shared-item {
  display: grid;
  grid-template-columns: minmax(220px, 340px) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.permission-shared-item > small {
  line-height: 1.4;
}

.permission-modules {
  display: grid;
  gap: 6px;
  padding: 8px;
  background: #f6f7f5;
}

.permission-module {
  min-width: 0;
  border: 1px solid #dfe3df;
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
}

.permission-module.is-open {
  border-color: #9fc4bf;
}

.permission-module-head {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
}

.permission-module-disclosure,
.permission-module-bulk,
.permission-advanced-head {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.permission-module-disclosure {
  min-width: 0;
  flex: 1;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 3px 4px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.permission-module-chevron {
  width: 20px;
  color: var(--teal-dark);
  font-size: 22px;
  line-height: 1;
  text-align: center;
}

.permission-module-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.permission-module-copy strong {
  font-size: 13px;
}

.permission-module-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.permission-module-count {
  min-width: 48px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #eef2f1;
  color: #526067;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.permission-module-bulk {
  min-width: 48px;
  padding: 6px 7px;
  border-radius: 6px;
  background: #edf5f3;
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 800;
}

.permission-module-bulk:hover,
.permission-module-bulk:focus-visible {
  background: #dceeea;
}

.permission-operation-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  border-top: 1px solid #e6e8e5;
  background: #fbfbfa;
}

.permission-operation-group {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 5px;
}

.permission-operation-label {
  padding: 0 2px;
  color: #677278;
  font-size: 11px;
  font-weight: 850;
  text-align: center;
}

.permission-operation-items {
  display: grid;
  gap: 4px;
}

.permission-check {
  min-width: 0;
  min-height: 34px;
  display: grid;
  grid-template-columns: 15px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 6px 7px;
  border: 1px solid #e1e4e0;
  border-radius: 6px;
  background: #fff;
  color: #3f484d;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.25;
}

.permission-check span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.permission-check small {
  color: #7d878c;
  font-size: 9px;
}

.permission-check input,
.permission-advanced-item input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--teal);
}

.permission-check.is-locked {
  background: #f1f4f3;
  color: #687278;
}

.permission-advanced-head {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f5f7f6;
  color: var(--ink);
  text-align: left;
}

.permission-advanced-head > span:last-child {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.permission-advanced-head strong {
  font-size: 14px;
}

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

.permission-advanced-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.permission-advanced-item {
  min-width: 0;
  min-height: 52px;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid #dfe4e0;
  border-radius: 7px;
  background: #f8faf9;
}

.permission-advanced-item > span {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.permission-advanced-item strong {
  color: #344046;
  font-size: 12px;
}

.permission-advanced-item small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
}

.permission-empty {
  padding: 20px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.access-denied {
  max-width: 720px;
}

.feedback-layout {
  display: grid;
  grid-template-columns: minmax(320px, 36%) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  transition: grid-template-columns 0.2s ease;
}

.feedback-layout.submit-collapsed {
  grid-template-columns: 52px minmax(0, 1fr);
}

.feedback-layout > * {
  min-width: 0;
}

.feedback-intro {
  padding-top: 16px;
  padding-bottom: 16px;
}

.feedback-page-alert {
  margin: 0;
}

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

.feedback-form .textarea {
  min-height: 150px;
}

.feedback-form {
  gap: 14px;
  overflow: hidden;
}

.feedback-submit-head > div {
  display: grid;
  gap: 3px;
}

.feedback-submit-head h2,
.feedback-list-head h2 {
  margin: 0;
  font-size: 18px;
}

.feedback-submit-head .muted,
.feedback-list-head .muted {
  font-size: 12px;
  font-weight: 700;
}

.feedback-collapse-button,
.feedback-submit-rail,
.feedback-status-tabs button,
.feedback-thread-toggle,
.feedback-text-action {
  border: 0;
  font: inherit;
  cursor: pointer;
}

.feedback-collapse-button {
  min-height: 32px;
  padding: 5px 8px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.feedback-collapse-button:hover,
.feedback-collapse-button:focus-visible {
  background: #edf5f3;
  color: var(--teal-dark);
}

.feedback-submit-rail {
  width: 52px;
  min-height: 210px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 8px;
  border: 1px solid #d9d1c3;
  border-radius: 8px;
  background: #fffdfa;
  color: var(--teal-dark);
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.05);
  transition: background 0.18s ease, border-color 0.18s ease;
}

.feedback-submit-rail span {
  writing-mode: vertical-rl;
  letter-spacing: 0;
  font-size: 14px;
  font-weight: 850;
}

.feedback-submit-rail b {
  font-size: 22px;
  line-height: 1;
}

.feedback-submit-rail:hover,
.feedback-submit-rail:focus-visible {
  border-color: #8dbeb8;
  background: #f2fbf8;
  outline: 2px solid rgba(15, 118, 110, 0.15);
  outline-offset: 2px;
}

.feedback-meta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.feedback-list-panel {
  min-height: 430px;
  display: grid;
  gap: 14px;
  padding: 18px;
}

.feedback-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.feedback-list-head > div:first-child {
  display: grid;
  gap: 3px;
}

.feedback-status-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, auto);
  gap: 4px;
  padding: 3px;
  border: 1px solid #e0d9ce;
  border-radius: 7px;
  background: #f5f3ef;
}

.feedback-status-tabs button {
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 5px;
  background: transparent;
  color: #5d666d;
  font-size: 13px;
  font-weight: 800;
}

.feedback-status-tabs button.active {
  background: #fff;
  color: var(--teal-dark);
  box-shadow: 0 1px 4px rgba(17, 24, 39, 0.09);
}

.feedback-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.feedback-filter-bar .input,
.feedback-filter-bar .select,
.feedback-filter-bar .btn {
  min-width: 0;
  min-height: 38px;
  height: 38px;
  font-size: 13px;
}

.feedback-filter-bar .input {
  flex: 1 1 200px;
}

.feedback-filter-bar .select {
  flex: 1 1 128px;
  max-width: 180px;
}

.feedback-filter-bar .btn,
.feedback-waiting-filter {
  flex: 0 0 auto;
}

.feedback-waiting-filter {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border: 1px solid #e2dbd0;
  border-radius: 7px;
  color: #596269;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.feedback-waiting-filter input {
  width: 15px;
  height: 15px;
  accent-color: var(--teal);
}

.feedback-list {
  display: grid;
  gap: 9px;
}

/*
FEEDBACK_TICKET_SURFACE_RULE:
- Keep the feedback workspace and ticket cards visually distinct from white inputs
- Use restrained cool neutral surfaces with dark, high-contrast text
- Alternate ticket backgrounds for scanability without changing status colors
*/
.feedback-ticket-card {
  --feedback-person: #526b8b;
  --feedback-person-soft: #eef3f8;
  display: grid;
  gap: 8px;
  padding: 12px 13px 12px 15px;
  border: 1px solid #cbdad6;
  border-left: 4px solid var(--feedback-person);
  border-radius: 8px;
  background: #f7fbfa;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.feedback-ticket-card:nth-child(even) {
  border-color: #ced9e3;
  border-left-color: var(--feedback-person);
  background: #f2f6fa;
}

.feedback-ticket-card:hover,
.feedback-ticket-card.expanded {
  border-color: #b8ccc8;
  border-left-color: var(--feedback-person);
  background: #eaf5f2;
  box-shadow: 0 7px 18px rgba(17, 24, 39, 0.06);
}

.feedback-ticket-card:nth-child(even):hover,
.feedback-ticket-card:nth-child(even).expanded {
  background: #eaf1f7;
}

.feedback-ticket-card.person-tone-0,
.feedback-message.person-tone-0 { --feedback-person: #476788; --feedback-person-soft: #edf3f8; }
.feedback-ticket-card.person-tone-1,
.feedback-message.person-tone-1 { --feedback-person: #76608f; --feedback-person-soft: #f3eff7; }
.feedback-ticket-card.person-tone-2,
.feedback-message.person-tone-2 { --feedback-person: #4e7472; --feedback-person-soft: #edf5f4; }
.feedback-ticket-card.person-tone-3,
.feedback-message.person-tone-3 { --feedback-person: #765f50; --feedback-person-soft: #f5f1ee; }
.feedback-ticket-card.person-tone-4,
.feedback-message.person-tone-4 { --feedback-person: #596f4c; --feedback-person-soft: #f0f5ed; }
.feedback-ticket-card.person-tone-5,
.feedback-message.person-tone-5 { --feedback-person: #7d5969; --feedback-person-soft: #f7eff3; }
.feedback-ticket-card.person-tone-6,
.feedback-message.person-tone-6 { --feedback-person: #4e6574; --feedback-person-soft: #eef3f5; }
.feedback-ticket-card.person-tone-7,
.feedback-message.person-tone-7 { --feedback-person: #6d6a4f; --feedback-person-soft: #f5f4ed; }

.feedback-ticket-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.feedback-ticket-identity,
.feedback-ticket-badges,
.feedback-ticket-context,
.feedback-ticket-state,
.feedback-ticket-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
}

.feedback-ticket-identity strong {
  min-width: 120px;
  color: #1f2b31;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.feedback-person-badge {
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--feedback-person-soft);
  color: var(--feedback-person);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.feedback-role,
.feedback-ticket-context,
.feedback-ticket-state,
.feedback-thread-empty,
.feedback-thread-loading {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.feedback-priority {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 999px;
  background: #eef3f8;
  color: var(--blue);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.feedback-priority.urgent,
.feedback-priority.bug {
  background: #fff3f2;
  color: var(--red);
}

.feedback-priority.suggestion {
  background: #eefbf8;
  color: var(--teal-dark);
}

.feedback-workflow,
.feedback-reply-status {
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.feedback-workflow.open {
  background: #fff5dc;
  color: #8a5a11;
}

.feedback-workflow.completed {
  background: #eaf7f0;
  color: #276246;
}

.feedback-reply-status.waiting_admin {
  background: #fff1ef;
  color: #9a4239;
}

.feedback-reply-status.replied {
  background: #eef3f6;
  color: #50616e;
}

.feedback-ticket-context {
  gap: 6px 14px;
}

.feedback-ticket-content {
  margin: 0;
  color: #324148;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feedback-ticket-content.expanded {
  display: block;
  overflow: visible;
}

.feedback-ticket-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 7px;
  border-top: 1px solid #d8e2df;
}

.feedback-ticket-actions .btn {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 13px;
}

.feedback-thread-toggle,
.feedback-text-action {
  padding: 0;
  background: transparent;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 850;
}

.feedback-thread-toggle:hover,
.feedback-text-action:hover {
  text-decoration: underline;
}

.feedback-text-action.danger {
  color: #9a4239;
}

.feedback-inline-thread {
  display: grid;
  gap: 10px;
  margin: 2px -1px -1px;
  padding: 11px;
  border: 1px solid #cfddda;
  border-radius: 7px;
  background: #e8f1ef;
}

.feedback-message-list {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 3px;
}

.feedback-message {
  --feedback-person: #526b8b;
  --feedback-person-soft: #eef3f8;
  display: grid;
  gap: 5px;
  width: min(88%, 720px);
  padding: 9px 11px;
  border: 1px solid #e8e1d6;
  border-radius: 7px;
  background: #fffdfa;
}

.feedback-message.admin {
  justify-self: end;
  border-color: #bfd9d4;
  background: #eef8f5;
}

.feedback-message.user {
  justify-self: start;
  border-left: 3px solid var(--feedback-person);
  background: var(--feedback-person-soft);
}

.feedback-message-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.feedback-message-meta strong {
  color: #25313a;
}

.feedback-message p {
  margin: 0;
  color: #27313a;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.feedback-system-event {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #edf0ef;
  color: #5d666d;
  font-size: 12px;
  font-weight: 750;
  text-align: center;
}

.feedback-system-event time {
  color: #7b848a;
}

.feedback-inline-editor {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid #dfe7e4;
}

.feedback-inline-editor-head,
.feedback-inline-editor-actions,
.feedback-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.feedback-inline-editor-head strong {
  color: #2f3b42;
  font-size: 13px;
}

.feedback-inline-editor-head span {
  color: var(--muted);
  font-size: 12px;
}

.feedback-inline-editor .textarea {
  min-height: 86px;
  resize: vertical;
}

.feedback-inline-editor-actions {
  justify-content: flex-end;
}

.feedback-inline-editor-actions .btn {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 13px;
}

.feedback-pagination {
  justify-content: center;
  padding-top: 2px;
  color: #5d666d;
  font-size: 13px;
  font-weight: 800;
}

.feedback-pagination .btn {
  min-height: 34px;
  padding: 6px 11px;
  font-size: 13px;
}

.notifications-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(520px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.notification-compose .textarea {
  min-height: 180px;
}

.notification-user-picker {
  max-height: 280px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
  border: 1px solid #e5dfd4;
  border-radius: 8px;
  background: var(--panel-soft);
}

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

.notification-user-option {
  display: flex;
  gap: 9px;
  align-items: center;
  min-width: 0;
  padding: 8px;
  border: 1px solid #e5dfd4;
  border-radius: 8px;
  background: #fff;
}

.notification-user-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
}

.notification-user-option span,
.notification-user-option strong,
.notification-user-option small {
  display: block;
  min-width: 0;
}

.notification-user-option strong {
  color: var(--ink);
}

.notification-user-option small {
  color: var(--muted);
  font-size: 12px;
}

.notification-list {
  display: grid;
  gap: 12px;
}

.notification-row {
  display: grid;
  gap: 12px;
  padding: 15px;
  border: 1px solid #e5dfd4;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.notification-row:hover {
  border-color: #8dbeb8;
  background: #f5fbf8;
}

.notification-row.urgent {
  border-color: #f3b2a7;
}

.notification-row.important {
  border-color: #e8cf89;
}

.notification-row-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.notification-row-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
  text-align: right;
}

.notification-delete-button.btn {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 12px;
}

.notification-row-main strong,
.notification-row-main span,
.notification-row-main small {
  display: block;
}

.notification-row-main p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.notification-priority {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #eefbf8;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.notification-priority.important {
  background: #fff7dd;
  color: #9a5b00;
}

.notification-priority.urgent {
  background: #fff0ee;
  color: #b91c1c;
}

.notification-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.notification-stats span,
.notification-stats .link-button {
  padding: 5px 8px;
  border-radius: 999px;
  background: #f4efe6;
  color: #4a5257;
  font-size: 12px;
  font-weight: 850;
}

.notification-stats .success {
  background: #eefbf8;
  color: var(--teal-dark);
}

.notification-my-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.notification-my-actions .btn {
  min-height: 34px;
  padding: 7px 12px;
  font-size: 13px;
}

.notification-delete-modal {
  max-width: 520px;
}

.notification-delete-warning {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff7f7;
  color: #9f1239;
  font-weight: 850;
  line-height: 1.6;
}

.notification-detail-panel {
  display: grid;
  gap: 16px;
}

.notification-detail-content {
  margin: 0;
  padding: 14px;
  border: 1px solid #e5dfd4;
  border-radius: 8px;
  background: var(--panel-soft);
  white-space: pre-wrap;
  line-height: 1.65;
}

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

.notification-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.notification-recipient-table th,
.notification-recipient-table td {
  text-align: center;
  vertical-align: middle;
}

.status-pill.acknowledged {
  background: #eefbf8;
  color: var(--teal-dark);
}

.status-pill.snoozed {
  background: #fff7dd;
  color: #9a5b00;
}

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

.notification-reply-list {
  display: grid;
  gap: 10px;
}

.notification-reply-list h3 {
  margin: 0;
}

.notification-reply-list .mini-card p {
  white-space: pre-wrap;
}

.notification-popup-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
}

.notification-popup-layer.inline {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 22px;
}

.notification-popup-layer.urgent {
  display: grid;
  place-items: center;
}

.notification-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 25, 28, 0.32);
  pointer-events: auto;
}

.notification-popup {
  position: relative;
  z-index: 1;
  width: min(520px, calc(100vw - 32px));
  max-height: min(680px, calc(100vh - 32px));
  overflow: auto;
  display: grid;
  gap: 12px;
  padding: 20px;
  border: 1px solid #d9d1c3;
  border-radius: 10px;
  background: #fffdfa;
  box-shadow: 0 24px 70px rgba(17, 24, 39, 0.24);
  pointer-events: auto;
}

.notification-popup.important {
  border-color: #e8cf89;
}

.notification-popup.urgent {
  border-color: #ef968a;
  box-shadow: 0 30px 80px rgba(127, 29, 29, 0.24);
}

.notification-popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.notification-popup h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
}

.notification-popup-content {
  margin: 0;
  color: #374047;
  line-height: 1.65;
  white-space: pre-wrap;
}

.notification-reply-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #e5dfd4;
  border-radius: 8px;
  background: var(--panel-soft);
}

.notification-reply-box .textarea {
  min-height: 110px;
}

.notification-popup-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 980px) {
  .trade-ledger-filter-row.primary,
  .trade-ledger-filter-row.advanced {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .trade-ledger-edit-grid,
  .trade-ledger-note-grid,
  .trade-ledger-document-edit {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trade-ledger-edit-grid.trade-ledger-basic-info-grid,
  .trade-ledger-manual-grid.trade-ledger-basic-info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trade-ledger-order-amount-grid {
    grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(180px, 0.8fr));
  }

  .trade-ledger-order-amount-grid .trade-ledger-money-row {
    grid-template-columns: minmax(180px, 1fr) minmax(92px, 108px) minmax(104px, 120px);
  }

  .trade-ledger-cost-grid,
  .trade-ledger-cost-readonly-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .trade-ledger-amount-confirm {
    grid-column: 1 / -1;
    grid-template-columns: auto auto;
    align-items: center;
    justify-content: end;
    gap: 10px;
    padding-top: 0;
  }

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

  .trade-ledger-document-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .trade-ledger-import-upload {
    grid-template-columns: 1fr;
  }

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

  .trade-ledger-import-backdrop {
    padding: 0;
  }

  .trade-ledger-import-panel,
  .trade-ledger-manual-panel {
    max-height: 100vh;
    border-radius: 0;
  }

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

  .permission-template-row {
    grid-template-columns: minmax(220px, 1fr) auto;
  }

  .permission-template-status {
    grid-column: 1 / -1;
  }

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

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

  .feedback-layout,
  .notifications-layout,
  .notification-detail-grid,
  .form-two {
    grid-template-columns: 1fr;
  }

  .feedback-layout.submit-collapsed {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .feedback-waiting-filter,
  .feedback-filter-bar .btn {
    justify-self: start;
  }

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

@media (max-width: 760px) {
  .permission-template-row,
  .permission-editor-head {
    grid-template-columns: 1fr;
  }

  .permission-template-row {
    display: grid;
  }

  .permission-template-row .btn {
    justify-self: start;
  }

  .permission-template-status {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .permission-editor-head {
    display: grid;
  }

  .permission-search {
    width: 100%;
  }

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

  .trade-ledger-cost-grid,
  .trade-ledger-cost-readonly-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .permission-step-strip {
    grid-template-columns: 1fr;
  }

  .permission-operation-grid,
  .permission-advanced-grid {
    grid-template-columns: 1fr;
  }

  .permission-module-copy small {
    display: none;
  }
}

@media (max-width: 600px) {
  .feedback-layout.submit-collapsed {
    grid-template-columns: 1fr;
  }

  .feedback-submit-rail {
    width: 100%;
    min-height: 44px;
    flex-direction: row;
    padding: 8px 12px;
  }

  .feedback-submit-rail span {
    writing-mode: horizontal-tb;
  }

  .feedback-list-head,
  .feedback-ticket-top,
  .feedback-ticket-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .feedback-status-tabs,
  .feedback-filter-bar {
    width: 100%;
  }

  .feedback-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .feedback-filter-bar .input,
  .feedback-filter-bar .select,
  .feedback-filter-bar .btn,
  .feedback-waiting-filter {
    flex: 0 0 auto;
    max-width: none;
  }

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

  .feedback-filter-bar .btn,
  .feedback-waiting-filter {
    width: 100%;
  }

  .feedback-message {
    width: 100%;
  }

  .trade-ledger-delete-confirm-backdrop {
    padding: 12px;
  }

  .modal-panel.trade-ledger-delete-confirm-panel {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }

  .trade-ledger-delete-confirm-head,
  .trade-ledger-delete-confirm-body {
    padding-left: 16px;
    padding-right: 16px;
  }

  .trade-ledger-delete-order-summary {
    grid-template-columns: 1fr;
  }

  .trade-ledger-edit-grid,
  .trade-ledger-note-grid,
  .trade-ledger-document-edit {
    grid-template-columns: 1fr;
  }

  .trade-ledger-edit-grid.trade-ledger-basic-info-grid,
  .trade-ledger-manual-grid.trade-ledger-basic-info-grid {
    grid-template-columns: 1fr;
  }

  .trade-ledger-document-summary-grid,
  .trade-ledger-document-readonly div {
    grid-template-columns: 1fr;
  }

  .trade-ledger-document-add-form {
    grid-template-columns: 1fr;
  }

  .trade-ledger-money-row {
    grid-template-columns: 1fr;
  }

  .trade-ledger-order-amount-grid,
  .trade-ledger-order-amount-grid .trade-ledger-money-row {
    grid-template-columns: 1fr;
  }

  .trade-ledger-cost-grid,
  .trade-ledger-cost-readonly-grid {
    grid-template-columns: 1fr;
  }

  .trade-ledger-amount-confirm {
    grid-column: auto;
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .notification-user-picker,
  .notification-summary-grid {
    grid-template-columns: 1fr;
  }

  .notification-popup-layer.inline {
    align-items: flex-start;
    justify-content: center;
    padding: 12px;
  }
}

/*
TRADE_LEDGER_DETAIL_WORK_DIALOG_RULE:
- View and edit modes share one centered 1280px working dialog
- Header and tabs stay fixed outside the single vertical scroll body
- Readonly basic information, core amounts and edit forms use 4/4/2/1 responsive columns
- Long values wrap inside their cards and wide tables scroll only in their own container
- Do not revert this dialog to a full-height side drawer or page-level scrolling
*/
.trade-ledger-detail-backdrop {
  place-items: center;
}

.trade-ledger-detail-header {
  display: flex;
}

.trade-ledger-detail-panel .ledger-readonly-grid,
.trade-ledger-detail-panel .trade-ledger-core-amount-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.trade-ledger-detail-panel .trade-ledger-cost-grid,
.trade-ledger-detail-panel .trade-ledger-profit-grid,
.trade-ledger-detail-panel .trade-ledger-edit-grid.trade-ledger-basic-info-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.trade-ledger-detail-panel .trade-ledger-cost-readonly-grid {
  grid-template-columns: repeat(9, minmax(0, 1fr));
}

.trade-ledger-detail-panel .trade-ledger-order-amount-grid {
  grid-template-columns: minmax(0, 1.7fr) repeat(2, minmax(160px, 0.8fr)) minmax(96px, auto);
}

.trade-ledger-detail-panel .trade-ledger-order-amount-grid .trade-ledger-money-row {
  grid-template-columns: minmax(0, 1fr) minmax(88px, 104px) minmax(92px, 112px);
}

.trade-ledger-detail-panel .ledger-readonly-value,
.trade-ledger-detail-panel .trade-ledger-detail-item,
.trade-ledger-detail-panel .trade-ledger-money-helper,
.trade-ledger-detail-panel .trade-ledger-document-name,
.trade-ledger-detail-panel .trade-ledger-note-content {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.trade-ledger-detail-panel .table-wrap,
.trade-ledger-detail-panel .trade-ledger-commission-table-wrap,
.trade-ledger-detail-panel .trade-ledger-document-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
}

@media (max-width: 1365px) {
  .trade-ledger-detail-backdrop {
    padding: 16px 24px;
  }

  .modal-panel.trade-ledger-detail-panel {
    width: calc(100vw - 48px);
  }

  .trade-ledger-detail-panel .ledger-readonly-grid,
  .trade-ledger-detail-panel .trade-ledger-core-amount-grid,
  .trade-ledger-detail-panel .trade-ledger-cost-grid,
  .trade-ledger-detail-panel .trade-ledger-profit-grid,
  .trade-ledger-detail-panel .trade-ledger-edit-grid,
  .trade-ledger-detail-panel .trade-ledger-edit-grid.trade-ledger-basic-info-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .trade-ledger-detail-panel .trade-ledger-cost-readonly-grid {
    grid-template-columns: repeat(9, minmax(0, 1fr));
  }
}

@media (max-width: 1023px) {
  .trade-ledger-detail-backdrop {
    padding: 12px;
  }

  .modal-panel.trade-ledger-detail-panel {
    width: calc(100vw - 24px);
    height: min(900px, calc(100vh - 24px));
    height: min(900px, calc(100dvh - 24px));
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
  }

  .trade-ledger-detail-header {
    align-items: flex-start;
  }

  .trade-ledger-detail-header > div:first-child {
    flex-basis: 100%;
  }

  .trade-ledger-detail-header > .form-actions {
    width: 100%;
  }

  .trade-ledger-detail-panel .ledger-readonly-grid,
  .trade-ledger-detail-panel .trade-ledger-core-amount-grid,
  .trade-ledger-detail-panel .trade-ledger-cost-grid,
  .trade-ledger-detail-panel .trade-ledger-profit-grid,
  .trade-ledger-detail-panel .trade-ledger-edit-grid,
  .trade-ledger-detail-panel .trade-ledger-edit-grid.trade-ledger-basic-info-grid,
  .trade-ledger-detail-panel .trade-ledger-note-grid,
  .trade-ledger-detail-panel .trade-ledger-document-edit {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trade-ledger-detail-panel .trade-ledger-cost-readonly-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .trade-ledger-detail-panel .trade-ledger-order-amount-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trade-ledger-detail-panel .trade-ledger-amount-confirm {
    grid-column: 1 / -1;
    grid-template-columns: auto auto;
    align-items: center;
    justify-content: end;
    gap: 10px;
    padding-top: 0;
  }
}

@media (max-width: 767px) {
  .order-commission-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-commission-month-controls,
  .order-commission-filter-grid {
    align-items: stretch;
  }

  .order-commission-month-stepper {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    width: 100%;
  }

  .order-commission-month-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

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

  .order-commission-filter-grid > .input {
    width: 100%;
  }

  .order-commission-column-settings {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-commission-table {
    min-width: 0;
    table-layout: auto;
  }

  .order-commission-table thead {
    display: none;
  }

  .order-commission-table tbody,
  .order-commission-table tr,
  .order-commission-table td {
    display: block;
    width: 100%;
  }

  .order-commission-table tr {
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
  }

  .order-commission-table td {
    min-height: 42px;
    height: auto;
    display: grid;
    grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    text-align: right;
    border-bottom: 1px solid var(--border);
  }

  .order-commission-table td::before {
    content: attr(data-label);
    color: var(--text-muted);
    text-align: left;
    font-size: 12px;
    font-weight: 600;
  }

  .order-commission-detail-row td {
    display: block;
  }

  .order-commission-detail-row td::before {
    content: none;
  }

  .trade-ledger-detail-backdrop {
    padding: 0;
  }

  .modal-panel.trade-ledger-detail-panel {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .trade-ledger-detail-header {
    align-items: stretch;
    padding: 14px;
  }

  .trade-ledger-detail-title-line {
    gap: 8px;
  }

  .trade-ledger-detail-title-line h2 {
    flex-basis: 100%;
    font-size: 21px;
  }

  .trade-ledger-detail-header > .form-actions {
    justify-content: stretch;
  }

  .trade-ledger-detail-header > .form-actions .btn {
    flex: 1 1 120px;
  }

  .trade-ledger-detail-tabs {
    padding: 8px 12px;
  }

  .trade-ledger-detail-body,
  .trade-ledger-detail-panel.is-readonly .trade-ledger-detail-body {
    padding: 12px 12px max(64px, calc(32px + env(safe-area-inset-bottom)));
  }

  .trade-ledger-detail-panel .ledger-readonly-grid,
  .trade-ledger-detail-panel .trade-ledger-core-amount-grid,
  .trade-ledger-detail-panel .trade-ledger-cost-grid,
  .trade-ledger-detail-panel .trade-ledger-cost-readonly-grid,
  .trade-ledger-detail-panel .trade-ledger-profit-grid,
  .trade-ledger-detail-panel .trade-ledger-edit-grid,
  .trade-ledger-detail-panel .trade-ledger-edit-grid.trade-ledger-basic-info-grid,
  .trade-ledger-detail-panel .trade-ledger-note-grid,
  .trade-ledger-detail-panel .trade-ledger-document-edit,
  .trade-ledger-detail-panel .trade-ledger-order-amount-grid,
  .trade-ledger-detail-panel .trade-ledger-order-amount-grid .trade-ledger-money-row {
    grid-template-columns: 1fr;
  }

  .trade-ledger-detail-panel .trade-ledger-amount-confirm {
    grid-column: auto;
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .trade-ledger-detail-panel .trade-ledger-amount-input-action {
    grid-template-columns: 1fr;
  }

  .trade-ledger-detail-panel .trade-ledger-no-tax-refund-btn.btn {
    width: 100%;
  }
}
/*
PAYROLL_ATTENDANCE_UI_RULE:
- Attendance and payroll are dense operational workspaces, not marketing pages
- Amounts align right, counts align center and source/status remain visible
- Desktop tables may scroll only when truly necessary; detail content stays within its modal
- Sensitive amounts must never be inferred visually when the API masks them
*/
.payroll-page {
  gap: 16px;
}

.payroll-hero,
.payroll-section-head,
.payroll-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.payroll-hero {
  padding: 20px 22px;
}

.payroll-hero h2,
.payroll-section-head h3 {
  margin: 2px 0 4px;
}

.payroll-hero-actions,
.payroll-toolbar > div,
.payroll-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.attendance-stat-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.payroll-stat-grid .stat {
  min-width: 0;
  min-height: 92px;
}

.payroll-workspace {
  min-width: 0;
  padding: 0;
  overflow: hidden;
}

.payroll-toolbar {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border, #ddd7cc);
  background: #f6f8f7;
}

.payroll-toolbar .field {
  width: 180px;
  margin: 0;
}

/*
ATTENDANCE_TOOLBAR_ALIGNMENT_RULE:
- Employee, action and month controls share one bottom-aligned control row
- Labels use a stable height and inputs/buttons remain the same height
- Mobile controls stack at full width without changing attendance behavior
*/
.payroll-toolbar .attendance-toolbar-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.payroll-toolbar .attendance-toolbar-actions .field {
  grid-template-rows: 18px 42px;
  align-content: end;
}

.payroll-toolbar .attendance-toolbar-actions .field > span:first-child {
  min-height: 18px;
  display: flex;
  align-items: center;
  line-height: 18px;
}

.payroll-toolbar .attendance-toolbar-actions .input,
.payroll-toolbar .attendance-toolbar-actions > .btn {
  height: 42px;
  min-height: 42px;
  box-sizing: border-box;
}

.payroll-toolbar .attendance-toolbar-actions > .btn {
  align-self: flex-end;
}

.attendance-leave-source-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid #dce8e3;
  background: #f2f8f5;
  color: #49625c;
  font-size: 12px;
}

.attendance-leave-source-note strong {
  color: #1e5f54;
}

.attendance-leave-table {
  min-width: 1080px;
}

.attendance-daily-table {
  min-width: 1900px;
}

.attendance-detail-daily-table {
  min-width: 1760px;
}

.attendance-leave-modal {
  width: min(980px, calc(100vw - 48px));
}

.attendance-daily-modal {
  width: min(1120px, calc(100vw - 48px));
}

.attendance-leave-form {
  display: grid;
  gap: 14px;
}

.attendance-daily-form {
  display: grid;
  gap: 14px;
}

.attendance-leave-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 20px 0;
}

.attendance-leave-form-grid .field {
  min-width: 0;
}

.attendance-leave-form-grid .input {
  width: 100%;
  box-sizing: border-box;
}

.attendance-daily-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 20px 0;
}

.attendance-daily-form-grid .field,
.attendance-daily-form-grid .input {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.attendance-daily-wide {
  grid-column: span 2;
}

.attendance-daily-wide textarea {
  min-height: 72px;
  resize: vertical;
}

.attendance-daily-flags {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.attendance-daily-flags label {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid #d8dedb;
  border-radius: 7px;
  background: #f8faf9;
  color: #40504d;
  font-size: 12px;
  font-weight: 700;
}

.attendance-daily-flags input {
  width: 16px;
  height: 16px;
}

.attendance-leave-reason {
  grid-column: 1 / -1;
}

.attendance-leave-reason textarea {
  min-height: 76px;
  resize: vertical;
}

.attendance-leave-paid-toggle {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 9px;
  align-self: end;
  padding: 8px 10px;
  border: 1px solid #d8dedb;
  border-radius: 7px;
  background: #f8faf9;
}

.attendance-leave-paid-toggle input {
  width: 17px;
  height: 17px;
}

.attendance-leave-paid-toggle strong,
.attendance-leave-paid-toggle small {
  display: block;
}

.attendance-leave-paid-toggle small {
  margin-top: 2px;
  color: #727d82;
  font-size: 11px;
}

.attendance-leave-rule-note {
  margin: 0 20px;
  padding: 9px 11px;
  border: 1px solid #eadfca;
  border-radius: 7px;
  background: #fffaf0;
  color: #755b2b;
  font-size: 12px;
}

.attendance-leave-form > .alert,
.attendance-leave-form > .form-actions,
.attendance-daily-form > .alert,
.attendance-daily-form > .form-actions {
  margin-right: 20px;
  margin-left: 20px;
}

.attendance-leave-form > .form-actions,
.attendance-daily-form > .form-actions {
  padding-bottom: 18px;
}

.attendance-leave-empty {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 26px 20px 30px;
}

.payroll-tabs,
.payroll-detail-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
}

.payroll-tabs button,
.payroll-detail-tabs button {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #4f5b60;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  padding: 10px 12px 8px;
  cursor: pointer;
}

.payroll-tabs button.active,
.payroll-detail-tabs button.active {
  color: #08786f;
  border-bottom-color: #08786f;
}

.payroll-loading {
  padding: 30px;
  color: #667278;
  text-align: center;
}

.payroll-table-wrap {
  width: 100%;
  min-width: 0;
  overflow: auto;
}

.payroll-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 13px;
}

.payroll-table th,
.payroll-table td {
  min-width: 0;
  padding: 10px 9px;
  border-bottom: 1px solid #e5e1d9;
  vertical-align: middle;
}

.payroll-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #59646a;
  background: #f7f5f1;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.attendance-status-cell .payroll-badge {
  margin-left: 0;
}

.payroll-table td small,
.payroll-table td > small {
  display: block;
  margin-top: 3px;
  color: #7a8489;
}

.payroll-table .numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.payroll-table .center {
  text-align: center;
}

.payroll-table.attendance-table th,
.payroll-table.attendance-table td,
.payroll-table.attendance-daily-table th,
.payroll-table.attendance-daily-table td,
.payroll-table.attendance-leave-table th,
.payroll-table.attendance-leave-table td,
.payroll-table.attendance-detail-daily-table th,
.payroll-table.attendance-detail-daily-table td {
  text-align: center;
}

.payroll-table.attendance-table .payroll-row-actions {
  justify-content: center;
}

.payroll-table .important {
  color: #08786f;
  font-weight: 800;
}

.payroll-table .deduction,
.warn-text {
  color: #a34f3f;
}

.payroll-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: #08786f;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.payroll-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  margin: 2px 0 2px 6px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.payroll-badge.pending {
  color: #8a5a11;
  background: #fff2d8;
}

.payroll-badge.success {
  color: #166a4e;
  background: #e4f4ec;
}

.payroll-badge.danger {
  color: #9b3f34;
  background: #fae8e5;
}

.payroll-change-list {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.payroll-change-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 16px;
  padding: 12px 14px;
  border: 1px solid #d9dfdc;
  border-left: 4px solid #35867f;
  border-radius: 6px;
  background: #f6faf8;
}

.payroll-change-card > div:first-child,
.payroll-change-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.payroll-change-card p,
.payroll-change-card small {
  grid-column: 1;
  margin: 0;
}

.payroll-change-meta {
  grid-column: 1;
  color: #6d777c;
  font-size: 12px;
}

.salary-rules-panel {
  padding: 16px;
}

.salary-rule-modal {
  width: min(920px, 94vw);
}

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

.payroll-sensitive-unlock-modal {
  width: min(480px, calc(100vw - 48px));
}

.payroll-sensitive-unlock-form {
  display: grid;
  gap: 14px;
  padding: 18px 20px 20px;
}

.payroll-sensitive-unlock-form .muted {
  margin: 0;
  line-height: 1.55;
}

.payroll-detail-modal {
  width: min(1380px, 96vw);
  height: min(900px, 94vh);
  max-height: 94vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.payroll-detail-modal .modal-head {
  flex: 0 0 auto;
}

.payroll-detail-tabs {
  flex: 0 0 auto;
  padding: 0 18px;
  border-bottom: 1px solid #ddd7cc;
  background: #faf9f7;
}

.payroll-detail-scroll {
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px;
  overflow: auto;
}

.payroll-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.payroll-calculation-card {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 16px;
  border: 1px solid #d6ded9;
  border-radius: 7px;
  background: #f7faf8;
}

.payroll-calculation-card h3 {
  margin: 0 0 12px;
}

.payroll-calculation-card > div {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 160px 120px;
  gap: 12px;
  align-items: center;
  padding: 9px 4px;
  border-bottom: 1px solid #e0e6e2;
}

.payroll-calculation-card strong {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.payroll-calculation-card small {
  color: #6d777c;
  text-align: right;
}

.payroll-calculation-card .payroll-calculation-total {
  margin-top: 6px;
  padding-top: 14px;
  border-bottom: 0;
  color: #08786f;
  font-size: 16px;
}

.payroll-calculation-total strong {
  font-size: 24px;
}

.payroll-adjustment-form {
  display: grid;
  grid-template-columns: 130px 90px 120px minmax(160px, 1fr) minmax(160px, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #d8dedb;
  border-radius: 6px;
  background: #f7f9f8;
}

@media (max-width: 1180px) {
  .payroll-stat-grid,
  .attendance-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .payroll-toolbar,
  .payroll-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .payroll-toolbar .attendance-toolbar-actions {
    width: 100%;
  }

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

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

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

  .payroll-adjustment-form .btn {
    justify-self: start;
  }
}

@media (max-width: 720px) {
  .payroll-stat-grid,
  .attendance-stat-grid,
  .payroll-summary-grid,
  .salary-rule-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .payroll-calculation-card > div {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .payroll-calculation-card small {
    grid-column: 1 / -1;
    text-align: left;
  }

  .payroll-change-card,
  .payroll-adjustment-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .payroll-toolbar .attendance-toolbar-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .payroll-toolbar .attendance-toolbar-actions .field,
  .payroll-toolbar .attendance-toolbar-actions > .btn {
    width: 100%;
  }

  .payroll-toolbar .attendance-toolbar-actions > .btn {
    align-self: stretch;
  }

  .attendance-leave-source-note {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

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

  .attendance-leave-reason,
  .attendance-daily-wide {
    grid-column: auto;
  }

  .attendance-daily-form-grid,
  .attendance-daily-flags {
    grid-template-columns: minmax(0, 1fr);
  }
}
