:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #eef3f0;
  --line: #d8dfda;
  --text: #17211c;
  --muted: #65736b;
  --green: #0d7b66;
  --green-2: #e4f3ee;
  --amber: #ad6a00;
  --amber-2: #fff3d8;
  --red: #b3261e;
  --red-2: #fde7e5;
  --ink: #26312b;
  --blue: #6279e8;
  --purple: #7046a3;
  --purple-2: #6b66d6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 0;
  background: #f5f6fb;
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

body.authenticated {
  min-width: 1040px;
}

body.auth-pending .app-header,
body.auth-pending .layout,
body.unauthenticated .app-header,
body.unauthenticated .layout,
body.authenticated .login-screen {
  display: none;
}

body.auth-pending .login-screen,
body.unauthenticated .login-screen {
  display: grid;
}

button,
input,
select {
  font: inherit;
}

.login-screen {
  min-height: 100vh;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(rgba(21, 36, 53, 0.68), rgba(21, 36, 53, 0.68)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1600' height='1000' viewBox='0 0 1600 1000'%3E%3Crect width='1600' height='1000' fill='%23e6ece9'/%3E%3Cg fill='none' stroke='%239caeaa' stroke-width='8' opacity='.55'%3E%3Cpath d='M0 690h1600M0 746h1600M0 802h1600'/%3E%3Cpath d='M130 0v1000M325 0v1000M520 0v1000M715 0v1000M910 0v1000M1105 0v1000M1300 0v1000M1495 0v1000'/%3E%3C/g%3E%3Cg fill='%23708284' opacity='.45'%3E%3Crect x='0' y='612' width='1600' height='26'/%3E%3Crect x='0' y='846' width='1600' height='22'/%3E%3C/g%3E%3C/svg%3E") center / cover;
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 22px 60px rgba(18, 31, 44, 0.22);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 4px;
}

.login-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
}

.login-brand h1 {
  margin: 0 0 5px;
  font-size: 22px;
  line-height: 1.25;
}

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

.login-message {
  min-height: 20px;
}

.login-message.error {
  color: var(--red);
}

.app-header {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: linear-gradient(135deg, #312166, #1e2b54);
  color: #f7fbf8;
  border-bottom: 4px solid var(--blue);
}

.app-header h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 700;
}

.app-header p {
  margin: 0;
  color: #c9d4ce;
}

.header-actions,
.control-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-badge {
  max-width: 220px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  padding: 5px 10px;
  color: #e8f2ec;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.control-row {
  flex-wrap: wrap;
}

.button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 14px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.button:hover {
  border-color: #9bb3a6;
}

.button.primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.button.ghost {
  background: transparent;
  border-color: #74847b;
  color: #fff;
}

.button.small {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
}

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

.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 88px);
}

.side-panel {
  background: linear-gradient(180deg, #6b6ed6 0%, #704bb6 100%);
  border-right: 4px solid #6b85ff;
  padding: 18px 12px;
}

.nav-tabs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  position: sticky;
  top: 18px;
}

.nav-tab {
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  cursor: pointer;
  padding: 0 14px;
  text-align: left;
}

.nav-tab.active {
  background: #ffffff;
  border-color: #ffffff;
  color: #4f63d8;
  font-weight: 700;
}

.manual-form {
  display: grid;
  gap: 10px;
}

.entry-form {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  align-items: end;
}

.form-actions-wide {
  grid-column: 1 / -1;
}

.point-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.field-note {
  color: var(--muted);
  font-size: 11px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
}

.checkbox-label input {
  width: auto;
  min-height: auto;
}

input,
select {
  width: 100%;
  min-height: 34px;
  border: 1px solid #cbd7cf;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 7px 9px;
}

.hidden {
  display: none !important;
}

input:focus,
select:focus {
  outline: 2px solid #b7dfd1;
  border-color: var(--green);
}

.content {
  padding: 22px 26px 32px;
  background: #f5f6fb;
  overflow: auto;
}

.page-section {
  display: none;
}

.page-section.active {
  display: grid;
  gap: 16px;
}

.module-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 4px;
  border-bottom: none;
}

.sub-tab {
  position: relative;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #dedede;
  color: #111827;
  padding: 8px 18px;
  cursor: pointer;
  font-weight: 800;
}

.sub-tab.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
  font-weight: 700;
}

.tab-badge {
  position: absolute;
  top: -8px;
  right: -6px;
  display: inline-flex;
  min-width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #e5374d;
  color: #fff;
  font-size: 11px;
  line-height: 1;
}

.sub-section {
  display: none;
}

.sub-section.active {
  display: grid;
  gap: 16px;
}

#workbenchSection {
  max-width: 1320px;
}

#workbenchSection .section-title {
  margin-bottom: 2px;
}

.report-view {
  gap: 18px;
}

.report-block-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--blue);
  color: #111827;
  font-size: 20px;
  font-weight: 900;
}

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

.report-kpi {
  min-height: 136px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 5px;
  border-radius: 10px;
  background: #fff;
  border-left: 4px solid var(--blue);
  box-shadow: 0 8px 22px rgba(31, 41, 55, 0.08);
}

.report-kpi strong {
  font-size: 38px;
  line-height: 1;
  color: #149cb0;
}

.report-kpi span {
  color: #344054;
  font-weight: 700;
}

.report-kpi small {
  color: #7b8494;
}

.report-kpi.green {
  border-left-color: #28a947;
}

.report-kpi.green strong {
  color: #28a947;
}

.report-kpi.amber,
.report-kpi.orange {
  border-left-color: #ffba08;
}

.report-kpi.amber strong,
.report-kpi.orange strong {
  color: #ffb000;
}

.report-analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.report-card,
.chart-card {
  border-radius: 10px;
  background: #fff;
  padding: 20px;
  box-shadow: 0 8px 22px rgba(31, 41, 55, 0.06);
}

.report-card h3,
.chart-card h3 {
  margin: 0 0 16px;
  color: #111827;
  font-size: 17px;
}

.quality-row {
  display: grid;
  gap: 9px;
  margin-bottom: 20px;
}

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

.quality-row strong {
  font-size: 16px;
}

.quality-row span {
  color: #5d73ff;
  font-weight: 800;
}

.quality-bar,
.stacked-bar {
  height: 24px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e9ef;
}

.quality-bar span,
.stacked-bar span {
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  vertical-align: top;
  min-width: 24px;
}

.bar-ok {
  background: linear-gradient(90deg, #28a947, #2cc985);
}

.donut-layout {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) 150px;
  align-items: center;
  gap: 18px;
}

.donut-chart {
  width: min(260px, 100%);
  aspect-ratio: 1;
  justify-self: center;
  border-radius: 50%;
  background: conic-gradient(#28a947 0% 100%);
  position: relative;
}

.donut-chart::after {
  content: "";
  position: absolute;
  inset: 32%;
  border-radius: 50%;
  background: #fff;
}

.donut-legend,
.abnormal-legend {
  display: grid;
  gap: 10px;
  color: #5c6575;
  font-size: 13px;
}

.legend-dot {
  width: 14px;
  height: 14px;
  display: inline-block;
  margin-right: 7px;
  border-radius: 50%;
  vertical-align: -2px;
}

.legend-dot.ok {
  background: #28a947;
}

.legend-dot.level-1 {
  background: #f8b400;
}

.legend-dot.level-2 {
  background: #ff7a45;
}

.legend-dot.level-3 {
  background: #e63b58;
}

.legend-dot.level-4 {
  background: #6d55d8;
}

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

.anomaly-metric-grid article {
  min-height: 86px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  border-radius: 8px;
  background: #fff;
}

.anomaly-metric-grid strong {
  color: #f8b400;
  font-size: 30px;
}

.anomaly-metric-grid article:nth-child(2) strong {
  color: #ff7a45;
}

.anomaly-metric-grid article:nth-child(3) strong {
  color: #e63b58;
}

.anomaly-metric-grid article:nth-child(4) strong {
  color: #6d55d8;
}

.chart-view {
  gap: 20px;
}

.chart-card canvas {
  display: block;
  width: 100%;
  min-height: 320px;
  border-radius: 8px;
  background: #fff;
}

.type-pill,
.exceedance-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin: 0 5px 3px 0;
  border-radius: 5px;
  padding: 2px 8px;
  background: #6f82e8;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.exceedance-pill.level-1 {
  background: #f8b400;
}

.exceedance-pill.level-2 {
  background: #ff7a45;
}

.exceedance-pill.level-3 {
  background: #e63b58;
}

.exceedance-pill.level-4 {
  background: #6d55d8;
}

.status-mark {
  font-size: 24px;
  line-height: 1;
  font-weight: 900;
}

.status-mark.ok {
  color: #18a83a;
}

.status-mark.bad {
  color: #e6334f;
}

.abnormal-view {
  gap: 18px;
}

.abnormal-hero {
  min-height: 148px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 20px 26px;
  border-radius: 12px;
  background: linear-gradient(120deg, #ff6263, #f15a24);
  color: #fff;
}

.abnormal-hero strong {
  font-size: 46px;
  line-height: 1;
}

.abnormal-hero span {
  display: inline-block;
  margin-left: 10px;
  font-size: 17px;
  font-weight: 800;
}

.abnormal-hero small {
  display: block;
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 12px;
}

.abnormal-legend {
  min-width: 180px;
  gap: 6px;
  color: #ffeeca;
  font-weight: 800;
}

.abnormal-legend span {
  margin-left: 0;
  font-size: 13px;
}

.abnormal-legend strong {
  font-size: 30px;
}

.abnormal-group {
  border-left: 4px solid var(--blue);
  border-radius: 9px;
  background: #fff;
  overflow: hidden;
}

.abnormal-group h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 14px 18px;
  background: #f1effd;
  color: #6d55d8;
  font-size: 18px;
}

.abnormal-group h3 span {
  width: 16px;
  height: 16px;
  display: inline-block;
  border-radius: 50%;
  background: #6d55d8;
  box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.45);
}

.abnormal-group h3 small {
  margin-left: 18px;
  color: #475467;
  font-size: 14px;
  font-weight: 500;
}

.abnormal-group.level-3 {
  border-left-color: #e63b58;
}

.abnormal-group.level-3 h3 {
  background: #fdebed;
  color: #e12d4d;
}

.abnormal-group.level-3 h3 span {
  background: #e63b58;
}

.abnormal-group.level-2 {
  border-left-color: #ff7a45;
}

.abnormal-group.level-2 h3 {
  background: #fff1e9;
  color: #f05e22;
}

.abnormal-group.level-2 h3 span {
  background: #ff7a45;
}

.abnormal-group.level-1 {
  border-left-color: #f8b400;
}

.abnormal-group.level-1 h3 {
  background: #fff7e5;
  color: #f8a900;
}

.abnormal-group.level-1 h3 span {
  background: #2fc872;
}

#workbenchSection .table-wrap {
  border-color: #d9dfef;
}

#workbenchSection th {
  background: linear-gradient(90deg, #6575d9, #7548a4);
  color: #fff;
}

#workbenchSection td {
  border-color: #dfe4ef;
}

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

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

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

.filter-bar {
  display: grid;
  grid-template-columns: minmax(110px, 140px) minmax(150px, 190px) minmax(120px, 1fr) minmax(120px, 1fr) minmax(150px, 1.2fr) auto;
  gap: 8px;
  align-items: center;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line);
}

.filter-bar .button {
  min-height: 34px;
  white-space: nowrap;
}

.workbench-head {
  display: grid;
  grid-template-columns: minmax(620px, 1fr) minmax(300px, 430px);
  gap: 14px;
  align-items: start;
}

.level-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  padding-top: 1px;
}

.ledger-toolbar {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.legend-item {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.legend-item.normal,
.level-badge.normal {
  background: var(--green-2);
  border-color: #b8d8cd;
  color: var(--green);
}

.legend-item.level-1,
.level-badge.level_1 {
  background: var(--amber-2);
  border-color: #e8c986;
  color: var(--amber);
}

.legend-item.level-2,
.legend-item.level-3,
.legend-item.level-4,
.level-badge.level_2,
.level-badge.level_3,
.level-badge.level_4 {
  background: var(--red-2);
  border-color: #efb7b2;
  color: var(--red);
}

.flat-panel {
  padding: 0;
}

.ledger-table th,
.ledger-table td {
  white-space: normal;
}

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

.snapshot-card,
.empty-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 12px;
}

.snapshot-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.snapshot-title strong {
  font-size: 18px;
}

.snapshot-title span {
  color: var(--red);
  font-weight: 800;
}

.snapshot-stats,
.snapshot-sections {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.snapshot-stats span,
.snapshot-sections span {
  border-radius: 6px;
  background: #f3f6f4;
  padding: 4px 7px;
  color: var(--muted);
  font-size: 12px;
}

.snapshot-card p {
  margin: 10px 0;
  color: var(--ink);
  font-weight: 700;
}

.compact-title {
  margin-bottom: 12px;
}

.compact-title h3 {
  margin: 0 0 4px;
}

.status-pill,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--green-2);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.badge.alarm {
  background: var(--red-2);
  color: var(--red);
}

.badge.warning,
.badge.watch {
  background: var(--amber-2);
  color: var(--amber);
}

.badge.missing {
  background: #edf0f2;
  color: #5c6870;
}

.badge.workflow {
  background: #edf0f2;
  color: #405048;
}

.badge.workflow.open {
  background: var(--red-2);
  color: var(--red);
}

.badge.workflow.acknowledged {
  background: var(--amber-2);
  color: var(--amber);
}

.badge.workflow.closed {
  background: var(--green-2);
  color: var(--green);
}

.badge.workflow.tracking,
.badge.deadline.due_soon {
  background: var(--amber-2);
  color: var(--amber);
}

.badge.workflow.resolved,
.badge.deadline.on_track,
.badge.deadline.resolved {
  background: var(--green-2);
  color: var(--green);
}

.badge.deadline.overdue {
  background: var(--red-2);
  color: var(--red);
}

.badge.deadline.none {
  background: #edf0f2;
  color: #5c6870;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(25, 35, 30, 0.05);
}

.kpi {
  padding: 16px;
}

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

.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  line-height: 1;
}

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

.split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.panel {
  padding: 15px;
}

.panel h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

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

.panel-title-row h3 {
  margin: 0;
}

.panel-help {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.ledger-master-head {
  align-items: flex-start;
}

.ledger-master-head > div:first-child {
  flex: 0 0 170px;
}

.ledger-master-filters {
  flex: 1 1 0;
  gap: 8px;
  justify-content: flex-start;
}

.ledger-master-filters input,
.ledger-master-filters select {
  width: auto;
  min-width: 110px;
  flex: 1 1 118px;
}

.ledger-master-filters #ledgerMasterSearch {
  flex-basis: 118px;
}

.ledger-master-filters #ledgerMasterAnchor {
  flex-basis: 170px;
}

.ledger-master-filters .button {
  flex: 0 0 auto;
}

.table-wrap {
  max-height: 360px;
  overflow: auto;
  border: 1px solid #e4e9e6;
  border-radius: 6px;
}

.table-wrap.tall {
  max-height: 570px;
}

.pagination-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 10px 11px;
  border-bottom: 1px solid #e7ece9;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4f7f5;
  color: #4d5b53;
  font-size: 12px;
}

td.wrap {
  white-space: normal;
  min-width: 220px;
}

.action-cell {
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

.control-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.control-table td {
  white-space: normal;
}

.analysis-table td {
  white-space: normal;
}

.control-table .compact-input {
  width: 130px;
  min-height: 30px;
  margin-bottom: 6px;
  padding: 5px 7px;
}

.compact-textarea {
  width: 210px;
  min-height: 66px;
  resize: vertical;
  border: 1px solid #cbd7cf;
  border-radius: 6px;
  padding: 7px 9px;
  font: inherit;
}

.control-table .action-cell {
  flex-wrap: wrap;
  min-width: 126px;
}

.risk-score {
  display: block;
  margin-bottom: 6px;
  font-size: 24px;
  line-height: 1;
}

.risk-score.high {
  color: var(--red);
}

.risk-score.medium {
  color: var(--amber);
}

.risk-score.low {
  color: var(--green);
}

.risk-level {
  display: block;
  margin-bottom: 5px;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 800;
}

.risk-level.level-1 {
  color: var(--amber);
}

.risk-level.level-2,
.risk-level.level-3,
.risk-level.level-4 {
  color: var(--red);
}

.risk-level.risk-generic {
  color: var(--ink);
}

.rules-table .compact-input {
  width: 86px;
  min-height: 30px;
  padding: 5px 7px;
}

.rules-table .description-input {
  width: 260px;
  min-height: 30px;
  padding: 5px 7px;
}

.subtle-code {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.search-input {
  width: 280px;
}

.import-panel {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto auto auto auto;
  gap: 12px;
  align-items: center;
}

.mapping-panel {
  display: none;
  margin-top: 16px;
}

.mapping-panel.active {
  display: block;
}

.mapping-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.mapping-field {
  display: grid;
  gap: 5px;
}

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

.mapping-field.required span::after {
  content: " *";
  color: var(--red);
}

.message {
  min-height: 20px;
  margin: 2px 0 0;
  color: var(--muted);
}

.message.error {
  color: var(--red);
}

.message.ok {
  color: var(--green);
}

.result-box {
  grid-column: 1 / -1;
  min-height: 150px;
  margin: 0;
  padding: 12px;
  border-radius: 6px;
  background: #17211c;
  color: #e8f5ee;
  overflow: auto;
}

.export-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.export-link {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cbd7cf;
  border-radius: 6px;
  background: #f7faf8;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.export-link:hover {
  border-color: var(--green);
  color: var(--green);
}

#trendCanvas {
  width: 100%;
  height: 360px;
  margin-top: 12px;
  border: 1px solid #e4e9e6;
  border-radius: 6px;
  background: #fff;
}

.empty-row {
  color: var(--muted);
}

@media (max-width: 1180px) {
  .split-grid,
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }

  .layout {
    grid-template-columns: 200px 1fr;
  }

  .entry-form,
  .point-form,
  .mapping-grid,
  .filter-bar {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .workbench-head {
    grid-template-columns: 1fr;
  }

  .level-legend {
    justify-content: flex-start;
  }

  .snapshot-grid {
    grid-template-columns: repeat(2, minmax(210px, 1fr));
  }

  .filter-bar .button {
    justify-content: center;
  }
}
