#mha-info {
  padding: 5px 12px !important;
  min-height: 28px;
  font-size: 13px !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#mha-adjust-panel {
  padding: 6px 12px !important;
}

.mha-toolbar,
.mha-toolbar select,
.mha-toolbar button,
.mha-toolbar label,
.mha-toolbar > span,
.mha-toolbar input[type="month"],
.mha-toolbar input[type="text"] {
  font-size: 12px !important;
}

#mha-grid-scroll {
  position: relative;
  isolation: isolate;
  background: var(--bg);
  overscroll-behavior: contain;
}

#mha-table {
  position: relative;
  isolation: isolate;
  border-collapse: separate !important;
  border-spacing: 0;
  background: var(--card);
  font-size: 13px !important;
}

#mha-table th,
#mha-table td {
  border-width: 0 1px 1px 0 !important;
  background-clip: border-box;
}

#mha-table thead tr:first-child > * { border-top-width: 1px !important; }
#mha-table tr > *:first-child { border-left-width: 1px !important; }

.mha-grid-sticky-type,
.mha-grid-sticky-total {
  position: sticky;
  box-sizing: border-box;
  overflow: hidden;
  opacity: 1;
  transform: translateZ(0);
  background-clip: border-box;
}

.mha-grid-sticky-type {
  left: 0;
  width: 130px;
  min-width: 130px;
  max-width: 130px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mha-grid-sticky-total {
  left: 130px;
  width: 132px;
  min-width: 132px;
  max-width: 132px;
  border-right-color: var(--b2) !important;
  box-shadow: 7px 0 8px -7px rgba(15, 23, 42, .82);
}

.mha-grid-sticky-head {
  top: 0;
  z-index: 40;
  background: var(--card2) !important;
}

.mha-grid-month-head {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--card2) !important;
}

.mha-grid-sticky-body { z-index: 20; background: var(--card) !important; }
.mha-grid-sticky-footer { z-index: 25; background: var(--card2) !important; }
.mha-grid-total-cell { background: var(--card2) !important; }

.mha-summary-primary {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 5px;
  min-width: 0;
  white-space: nowrap;
}

.mha-summary-primary-label {
  flex: 0 0 auto;
  color: var(--t3);
  font-size: 11px;
  font-weight: 700;
}

.mha-summary-primary-value {
  min-width: 0;
  overflow: hidden;
  color: #818cf8;
  font: 700 14px JetBrains Mono, monospace;
  text-overflow: ellipsis;
}

.mha-compact-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  flex-wrap: wrap;
}

.mha-mode-block,
.mha-display-tools,
.mha-inline-metrics {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mha-compact-label {
  color: var(--t3);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.mha-mode-group {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--b2);
  border-radius: 5px;
  overflow: hidden;
  background: var(--card);
}

.mha-mode-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 4px 9px;
  color: var(--t2);
  border-right: 1px solid var(--b2);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.mha-mode-option:last-child { border-right: 0; }
.mha-mode-option input { position: absolute; opacity: 0; pointer-events: none; }
.mha-mode-option.active { color: var(--fg); background: var(--a1); }

.mha-inline-metrics {
  min-width: 360px;
  flex: 1;
  gap: 0;
  border: 1px solid var(--b1);
  border-radius: 5px;
  overflow: hidden;
  background: var(--card);
}

.mha-inline-metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 7px;
  min-width: 90px;
  padding: 5px 8px;
  border-right: 1px solid var(--b1);
  white-space: nowrap;
}

.mha-inline-metric:last-child { border-right: 0; }
.mha-inline-metric span { color: var(--t3); font-size: 11px; font-weight: 700; }
.mha-inline-metric strong { font-family: JetBrains Mono, monospace; font-size: 14px; color: var(--t1); }

.mha-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 27px;
  padding: 4px 8px;
  border: 1px solid var(--b2);
  border-radius: 5px;
  background: var(--card);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.mha-display-tools { margin-left: auto; }
.mha-type-count { color: var(--t3); font-size: 12px; white-space: nowrap; }

.mha-type-picker,
.mha-compact-button {
  height: 30px;
  border: 1px solid var(--b2);
  border-radius: 5px;
  background: var(--card);
  color: var(--t2);
  padding: 3px 8px;
  font: 700 12px Noto Sans KR, sans-serif;
}

.mha-type-picker { min-width: 118px; max-width: 170px; }
.mha-compact-button { cursor: pointer; white-space: nowrap; }
.mha-compact-button.active { color: var(--fg); border-color: var(--a1); background: color-mix(in srgb, var(--a1) 18%, var(--card)); }

.mha-validation-details {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(500px, 760px);
  align-items: start;
  gap: 10px;
  max-width: 1060px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--b1);
}

.mha-validation-copy {
  padding: 8px 10px;
  border: 1px solid var(--b1);
  border-radius: 5px;
  background: var(--card);
}

.mha-validation-copy > b { color: var(--t1); font-size: 12px; }
.mha-validation-copy > span { display: block; margin-top: 5px; color: var(--t3); font-size: 11px; }
.mha-validation-message { margin-top: 4px; font-size: 12px; font-weight: 700; line-height: 1.5; }

.mha-delta-block { min-width: 0; }
.mha-delta-overview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
  color: var(--t3);
  font-size: 11px;
}

.mha-delta-overview b { color: var(--t1); font-family: JetBrains Mono, monospace; font-size: 12px; }
.mha-delta-overview .has-change,
.mha-delta-overview .has-change b { color: #ef4444; }
.mha-delta-overview .no-change,
.mha-delta-overview .no-change b { color: #10b981; }

.mha-delta-filter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  margin-left: auto;
  padding: 2px 7px;
  border: 1px solid var(--b2);
  border-radius: 5px;
  background: var(--card);
  color: var(--t2);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.mha-delta-filter.active { color: var(--fg); border-color: var(--a1); }
.mha-delta-empty {
  padding: 18px 12px;
  border: 1px dashed var(--b2);
  border-radius: 5px;
  color: var(--t3);
  text-align: center;
  font-size: 12px;
}

.mha-delta-scroll {
  max-height: min(42vh, 340px);
  overflow: auto;
  border: 1px solid var(--b1);
  border-radius: 5px;
  background: var(--card);
}

.mha-delta-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 12px;
}

.mha-delta-table thead { position: sticky; top: 0; z-index: 2; background: var(--card2); }
.mha-delta-table th,
.mha-delta-table td {
  height: 27px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--b1);
}

.mha-delta-table th:first-child,
.mha-delta-table td:first-child { text-align: left; }
.mha-delta-table th:not(:first-child),
.mha-delta-table td:not(:first-child) { text-align: right; }
.mha-delta-table td:first-child { color: var(--t1); font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mha-delta-table td:not(:first-child) { font-family: JetBrains Mono, monospace; }
.mha-delta-table tr:last-child td { border-bottom: 0; }
.mha-delta-changed { background: rgba(239, 68, 68, .055); }
.mha-delta-changed td:first-child { color: #f87171; }
.mha-delta-steady { color: var(--t3); }

.mha-locked-value {
  min-height: 29px;
  padding: 5px 6px;
  border: 1px solid var(--b1);
  border-radius: 4px;
  background: var(--card2);
  color: var(--t2);
  text-align: right;
  font: 700 14px JetBrains Mono, monospace;
}

.mha-cell-meta {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 3px;
  color: var(--t3);
  font-size: 11px;
  white-space: nowrap;
}

.mha-md-input,
.mha-memo-input {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid var(--b2);
  border-radius: 4px;
  background: var(--card);
  color: var(--t1);
}

.mha-md-input {
  min-height: 29px;
  padding: 4px 7px;
  text-align: right;
  font: 700 14px JetBrains Mono, monospace;
}

.mha-md-input:focus,
.mha-memo-input:focus,
.mha-type-picker:focus-visible,
.mha-compact-button:focus-visible {
  outline: 2px solid var(--a1);
  outline-offset: 1px;
  border-color: var(--a1);
}

.mha-memo-input {
  margin-top: 4px;
  padding: 3px 5px;
  font-size: 12px;
}

.mha-lock-label { color: #f59e0b; font-weight: 800; }
.mha-locked-memo {
  max-width: 145px;
  margin-top: 3px;
  color: var(--t3);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .mha-inline-metrics { order: 3; flex-basis: 100%; }
  .mha-display-tools { margin-left: 0; }
  .mha-validation-details { grid-template-columns: minmax(190px, 240px) minmax(460px, 1fr); }
}

@media (max-width: 820px) {
  .mha-validation-details { grid-template-columns: 1fr; }
}
