/*
 * Tennessee CMI Calculator — scoped styles.
 * Every rule is namespaced under .tncmi-wrap so it cannot leak into the
 * surrounding WordPress theme.
 */
.tncmi-wrap, .tncmi-wrap * { box-sizing: border-box; }
.tncmi-wrap {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1a2332;
  line-height: 1.5;
}
.tncmi-wrap .container {
  max-width: 960px;
  margin: 0 auto;
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  overflow: hidden;
}
.tncmi-wrap header {
  background: #2c3e68;
  color: white;
  padding: 24px 32px;
}
.tncmi-wrap header h1 { margin: 0 0 4px; font-size: 22px; color: white; }
.tncmi-wrap header p { margin: 0; opacity: 0.85; font-size: 14px; color: white; }
.tncmi-wrap .content { padding: 28px 32px; }
.tncmi-wrap h2 {
  font-size: 16px;
  margin: 24px 0 12px;
  color: #2c3e68;
  border-bottom: 2px solid #e0e5ed;
  padding-bottom: 6px;
}
.tncmi-wrap h2:first-child { margin-top: 0; }
.tncmi-wrap label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #3a4a63; }
.tncmi-wrap input[type=number], .tncmi-wrap input[type=date], .tncmi-wrap input[type=text], .tncmi-wrap select {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid #c9d2e0;
  border-radius: 6px;
  background: white;
  color: #1a2332;
}
.tncmi-wrap input[type=number]:focus, .tncmi-wrap input[type=date]:focus, .tncmi-wrap input[type=text]:focus, .tncmi-wrap select:focus {
  outline: none;
  border-color: #2c3e68;
  box-shadow: 0 0 0 3px rgba(44, 62, 104, 0.15);
}
.tncmi-wrap .grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.tncmi-wrap .field { margin-bottom: 12px; }
.tncmi-wrap .helper { font-size: 12px; color: #7a8699; margin-top: 4px; }

.tncmi-wrap .upload-zone {
  border: 2px dashed #c9d2e0;
  border-radius: 8px;
  padding: 30px 20px;
  text-align: center;
  background: #fafbfd;
  cursor: pointer;
  transition: all 0.2s;
}
.tncmi-wrap .upload-zone:hover, .tncmi-wrap .upload-zone.dragover {
  border-color: #2c3e68;
  background: #eef2f8;
}
.tncmi-wrap .upload-zone svg { width: 40px; height: 40px; color: #7a8699; margin-bottom: 8px; }
.tncmi-wrap .upload-zone .primary { font-size: 15px; font-weight: 600; color: #2c3e68; }
.tncmi-wrap .upload-zone .secondary { font-size: 13px; color: #7a8699; margin-top: 4px; }
.tncmi-wrap #fileInput { display: none; }

.tncmi-wrap .extraction-status {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 13px;
  display: none;
}
.tncmi-wrap .extraction-status.show { display: block; }
.tncmi-wrap .extraction-status.info { background: #e3f2fd; color: #0d47a1; border: 1px solid #90caf9; }
.tncmi-wrap .extraction-status.success { background: #d4edda; color: #155724; border: 1px solid #8fc99c; }
.tncmi-wrap .extraction-status.error { background: #f8d7da; color: #721c24; border: 1px solid #e8999f; }
.tncmi-wrap .extraction-status.warn { background: #fff8e1; color: #5d4b1f; border: 1px solid #ffb300; }
.tncmi-wrap .extraction-status pre {
  margin: 8px 0 0;
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow: auto;
  background: rgba(0,0,0,0.05);
  padding: 8px;
  border-radius: 4px;
}
.tncmi-wrap .progress-bar {
  margin-top: 8px;
  height: 8px;
  background: rgba(0,0,0,0.1);
  border-radius: 4px;
  overflow: hidden;
}
.tncmi-wrap .progress-bar-fill {
  height: 100%;
  background: #2c3e68;
  width: 0%;
  transition: width 0.3s;
}

.tncmi-wrap .stubs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 10px;
}
.tncmi-wrap .stubs-table th {
  background: #eef2f8;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #4a5b7a;
  border-bottom: 1px solid #c9d2e0;
}
.tncmi-wrap .stubs-table td { padding: 6px 10px; border-bottom: 1px solid #eef2f8; }
.tncmi-wrap .stubs-table tr.excluded { opacity: 0.4; }
.tncmi-wrap .stubs-table tr.excluded td { text-decoration: line-through; }
.tncmi-wrap .stubs-table .amount { font-family: "SF Mono", Consolas, monospace; text-align: right; }
.tncmi-wrap .stubs-table .editable {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  padding: 2px 4px;
  font-size: 13px;
  font-family: inherit;
}
.tncmi-wrap .stubs-table .editable:hover { border-color: #c9d2e0; background: white; }
.tncmi-wrap .stubs-table .editable:focus { border-color: #2c3e68; background: white; outline: none; }
.tncmi-wrap .stubs-table tfoot td {
  font-weight: 600;
  background: #eef2f8;
  border-top: 2px solid #2c3e68;
  padding: 8px 10px;
}
.tncmi-wrap .stubs-table input[type=checkbox] { cursor: pointer; width: auto; }

.tncmi-wrap .file-section {
  background: #fafbfd;
  border: 1px solid #e0e5ed;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.tncmi-wrap .file-section .file-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e0e5ed;
}
.tncmi-wrap .file-section .file-name {
  font-weight: 600;
  color: #2c3e68;
  font-size: 14px;
  word-break: break-all;
}
.tncmi-wrap .file-section .file-meta {
  font-size: 12px;
  color: #7a8699;
  margin-top: 2px;
}
.tncmi-wrap .file-section .file-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}
.tncmi-wrap .file-section .file-summary {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  padding: 10px 12px;
  background: #eef2f8;
  border-radius: 6px;
  font-size: 13px;
}
.tncmi-wrap .file-section .file-summary .label { color: #4a5b7a; }
.tncmi-wrap .file-section .file-summary .value {
  font-weight: 600;
  font-family: "SF Mono", Consolas, monospace;
  color: #2c3e68;
}
.tncmi-wrap .file-section .file-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
}

.tncmi-wrap .income-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-top: 8px;
}
.tncmi-wrap .income-table th {
  background: #eef2f8;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #4a5b7a;
  border-bottom: 1px solid #c9d2e0;
}
.tncmi-wrap .income-table td { padding: 6px 10px; border-bottom: 1px solid #eef2f8; }
.tncmi-wrap .income-table input { padding: 6px 8px; font-size: 14px; }
.tncmi-wrap .income-table td:first-child { font-weight: 500; color: #4a5b7a; }

.tncmi-wrap button {
  background: #2c3e68;
  color: white;
  border: none;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 18px;
  margin-right: 8px;
  width: auto;
  text-transform: none;
  line-height: normal;
}
.tncmi-wrap button:hover:not(:disabled) { background: #1f2d4e; }
.tncmi-wrap button:disabled { opacity: 0.5; cursor: not-allowed; }
.tncmi-wrap button.secondary { background: #e0e5ed; color: #3a4a63; }
.tncmi-wrap button.secondary:hover:not(:disabled) { background: #c9d2e0; }
.tncmi-wrap button.small {
  padding: 6px 12px;
  font-size: 13px;
  margin-top: 8px;
}

.tncmi-wrap .results {
  margin-top: 24px;
  padding: 20px;
  border-radius: 8px;
  background: #f9fafc;
  border: 1px solid #e0e5ed;
  display: none;
}
.tncmi-wrap .results.show { display: block; }
.tncmi-wrap .result-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #e0e5ed;
  font-size: 14px;
}
.tncmi-wrap .result-row:last-child { border-bottom: none; }
.tncmi-wrap .result-row .label { color: #4a5b7a; }
.tncmi-wrap .result-row .value { font-weight: 600; font-family: "SF Mono", Consolas, monospace; }
.tncmi-wrap .verdict {
  margin-top: 16px;
  padding: 16px;
  border-radius: 6px;
  font-weight: 600;
  text-align: center;
}
.tncmi-wrap .verdict.below { background: #d4edda; color: #155724; border: 1px solid #8fc99c; }
.tncmi-wrap .verdict.above { background: #f8d7da; color: #721c24; border: 1px solid #e8999f; }
.tncmi-wrap .verdict-sub { font-weight: 400; font-size: 13px; margin-top: 6px; }
.tncmi-wrap .note {
  background: #fff8e1;
  border-left: 3px solid #ffb300;
  padding: 10px 14px;
  font-size: 13px;
  color: #5d4b1f;
  margin: 16px 0;
  border-radius: 4px;
}
.tncmi-wrap .disclaimer {
  font-size: 11px;
  color: #7a8699;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e0e5ed;
  line-height: 1.5;
}
.tncmi-wrap .median-display {
  background: #eef2f8;
  padding: 12px 14px;
  border-radius: 6px;
  margin: 12px 0;
  font-size: 14px;
  display: none;
}
.tncmi-wrap .median-display.show { display: block; }
.tncmi-wrap .median-display strong { color: #2c3e68; }

.tncmi-wrap .tabs { display: flex; border-bottom: 2px solid #e0e5ed; margin-top: 10px; }
.tncmi-wrap .tab {
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 600;
  color: #7a8699;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-size: 14px;
}
.tncmi-wrap .tab.active { color: #2c3e68; border-bottom-color: #2c3e68; }
.tncmi-wrap .tab-content { display: none; padding-top: 16px; }
.tncmi-wrap .tab-content.active { display: block; }

.tncmi-wrap summary { cursor: pointer; font-weight: 600; font-size: 14px; color: #2c3e68; padding: 8px 0; }
.tncmi-wrap details { margin-top: 10px; }

.tncmi-wrap .badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
}
.tncmi-wrap .badge.in { background: #d4edda; color: #155724; }
.tncmi-wrap .badge.out { background: #f8d7da; color: #721c24; }
.tncmi-wrap .badge.ocr { background: #e1bee7; color: #4a148c; }

.tncmi-wrap .loader {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(44, 62, 104, 0.2);
  border-top-color: #2c3e68;
  border-radius: 50%;
  animation: tncmi-spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes tncmi-spin { to { transform: rotate(360deg); } }
