:root {
  color-scheme: light;
  --ink: #17233a;
  --muted: #627089;
  --line: #d7dfeb;
  --panel: #ffffff;
  --soft: #f4f7fb;
  --blue: #2364ad;
  --deep-blue: #123f73;
  --bright-blue: #2f86d6;
  --green: #188253;
  --gold: #d89a1f;
  --red: #b63737;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--soft);
}

.hidden {
  display: none !important;
}

h1,
h2,
p {
  margin: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  border-color: var(--blue);
}

button:disabled {
  border-color: #cbd3df;
  background: #e6ebf2;
  color: #8a95a5;
  cursor: not-allowed;
}

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

.success-button,
.tab-button.ready {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.danger-button {
  color: #9f1d20;
  border-color: #d8a4a6;
  background: #fff7f7;
}

.batch-retention-note {
  margin-top: 6px;
  padding: 7px 9px;
  border: 1px solid #e7c05c;
  background: #fff5bf;
  color: #694f00;
  font-size: 0.9rem;
  line-height: 1.35;
  font-weight: 800;
}

.login-shell,
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(18, 63, 115, 0.98), rgba(31, 95, 168, 0.96) 60%, rgba(47, 134, 214, 0.92)),
    radial-gradient(circle at 82% 18%, rgba(255, 255, 255, 0.24), transparent 34%);
}

.login-card,
.auth-card {
  width: min(480px, 100%);
  padding: 30px;
  background: #fff;
  border: 1px solid rgba(216, 222, 232, 0.85);
  box-shadow: 0 24px 54px rgba(13, 37, 68, 0.3);
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
}

.login-card h1,
.auth-card h1 {
  color: var(--deep-blue);
  font-size: 31px;
}

.login-card p,
.auth-card p {
  margin-top: 8px;
  margin-bottom: 18px;
  color: var(--muted);
  line-height: 1.42;
}

.release-label {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin-top: 10px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  background: #f7faff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.header-release {
  border-color: rgba(255, 255, 255, 0.36);
  background: rgba(255, 255, 255, 0.13);
  color: rgba(255, 255, 255, 0.92);
}

.login-card label,
.auth-card label {
  display: block;
  margin-top: 14px;
  color: var(--ink);
  font-weight: 800;
}

.login-card input,
.login-card textarea,
.auth-card input {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  padding: 0 10px;
}

.login-card input,
.auth-card input {
  height: 40px;
}

.login-card textarea {
  min-height: 72px;
  padding-top: 9px;
  resize: vertical;
}

.login-card .inline-check,
.auth-card .inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.login-card .inline-check input,
.auth-card .inline-check input {
  width: auto;
  height: auto;
  margin: 0;
}

.wide-auth-button {
  width: 100%;
  height: 40px;
  margin-top: 18px;
}

.wide-auth-button.secondary {
  margin-top: 10px;
}

.link-button {
  width: 100%;
  margin-top: 10px;
  border: 0;
  background: transparent;
  color: var(--blue);
}

.auth-link {
  display: block;
  text-align: center;
  text-decoration: none;
}

.auth-message {
  min-height: 22px;
  margin-top: 12px;
  color: var(--muted);
  font-weight: 800;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 138px;
  padding: 20px 26px 24px;
  background:
    linear-gradient(135deg, rgba(18, 63, 115, 0.98), rgba(31, 95, 168, 0.96) 58%, rgba(47, 134, 214, 0.92)),
    radial-gradient(circle at 84% 18%, rgba(255, 255, 255, 0.2), transparent 36%);
  border-bottom: 5px solid #f2b544;
  color: #fff;
  box-shadow: 0 10px 26px rgba(18, 63, 115, 0.18);
}

.eyebrow {
  margin-bottom: 4px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.app-header h1 {
  font-size: 32px;
  letter-spacing: 0;
}

.app-header p {
  max-width: 790px;
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 14px;
  line-height: 1.25;
}

.header-actions {
  display: grid;
  align-items: center;
  justify-items: stretch;
  gap: 12px;
  min-width: 360px;
}

.header-actions button {
  border-color: rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.worker-status,
.selected-job {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.app-header .worker-status {
  display: grid;
  gap: 4px;
  min-width: 300px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
}

.current-batch-summary {
  min-width: 300px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.94);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
}

.worker-status-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.worker-status-meta {
  color: rgba(255, 255, 255, 0.86);
  font-size: 11px;
  line-height: 1.25;
  text-align: center;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--gold);
}

.status-dot.complete {
  background: var(--green);
}

.status-dot.error {
  background: var(--red);
}

.portal-main {
  padding: 14px 18px 18px;
}

.portal-tabs {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  margin-bottom: 0;
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.tab-button {
  position: relative;
  min-width: 158px;
  height: 36px;
  margin-bottom: -1px;
  border-color: #c8d4e4;
  border-bottom-color: var(--line);
  border-radius: 8px 8px 0 0;
  background: #edf3fb;
  color: var(--deep-blue);
  font-size: 13px;
}

.tab-button.active {
  border-color: var(--blue);
  border-bottom-color: #fff;
  background: #fff;
  color: var(--deep-blue);
  box-shadow: inset 0 3px 0 var(--blue);
}

.tab-button.ready:not(.active)::after {
  content: " Ready";
  font-size: 11px;
  opacity: 0.9;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
}

.upload-panel {
  display: flex;
  flex-direction: column;
  min-height: 650px;
}

.results-panel {
  min-height: 650px;
}

.erd-panel {
  min-height: 650px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 50px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: #f9fbfe;
}

.panel-title h2 {
  font-size: 16px;
}

.panel-title p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.panel-title input:not([type="radio"]) {
  width: min(640px, 58%);
  height: 36px;
  border: 1px solid var(--line);
  padding: 0 11px;
}

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

.result-title {
  align-items: flex-start;
  min-height: 0;
  padding: 6px 8px;
}

.result-title .panel-actions {
  width: 100%;
  justify-content: flex-start;
  gap: 5px;
}

.panel-actions input:not([type="radio"]) {
  width: min(480px, 46vw);
}

.panel-actions button {
  height: 30px;
  font-size: 12px;
  white-space: nowrap;
}

.erd-actions {
  max-width: 760px;
}

.scope-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.scope-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dictionary-search-bar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 3px;
  width: min(1120px, 100%);
  padding: 5px 6px;
  border: 1px solid var(--line);
  background: #fff;
}

.dictionary-search-bar label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 900;
}

.dictionary-search-bar .search-input-label {
  color: var(--deep-blue);
}

.dictionary-search-bar input[type="search"] {
  width: min(760px, 62vw);
  height: 26px;
  border: 1px solid var(--line);
  padding: 0 10px;
}

.dictionary-search-bar button {
  height: 24px;
  min-height: 24px;
  padding: 0 9px;
  font-size: 11px;
}

.parameter-search-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  width: min(860px, 100%);
  padding: 5px 6px;
  border: 1px solid var(--line);
  background: #fff;
}

.parameter-search-bar label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 1 1 auto;
  color: var(--deep-blue);
  font-size: 10.5px;
  font-weight: 900;
}

.parameter-search-bar input[type="search"] {
  width: 100%;
  height: 26px;
  border: 1px solid var(--line);
  padding: 0 10px;
}

.parameter-search-bar .formula-type-filter {
  flex: 0 0 auto;
}

.parameter-search-bar select {
  width: 190px;
  height: 26px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.parameter-search-bar button {
  height: 24px;
  min-height: 24px;
  padding: 0 9px;
  font-size: 11px;
}

.search-input-row,
.search-option-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.search-input-row {
  width: 100%;
}

.search-option-row {
  line-height: 1;
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow-x: auto;
  width: 100%;
}

.drop-zone {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 140px;
  margin: 14px 16px;
  border: 2px dashed #a8b7cb;
  background: #fbfdff;
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}

.drop-zone span {
  color: var(--deep-blue);
  font-size: 18px;
}

.drop-zone small {
  color: #7b8798;
  font-weight: 700;
}

.drop-zone.dragging {
  border-color: var(--blue);
  color: var(--blue);
  background: #f0f6ff;
}

.drop-zone input {
  display: none;
}

.wide-button {
  width: calc(100% - 32px);
  margin: 0 16px 12px;
}

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

.upload-button-row .wide-button {
  width: 100%;
  margin: 0;
}

.stop-upload-button {
  min-width: 190px;
  min-height: 38px;
  border-color: #c44f4f;
  color: #a72f2f;
  background: #fff7f7;
}

.selected-files-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  margin: 0 16px 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
}

.selected-files-toolbar button {
  height: 30px;
  color: var(--blue);
}

.selected-files {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 38px;
  max-height: 190px;
  margin: 0 16px 10px;
  overflow-y: auto;
  color: var(--muted);
  font-size: 13px;
}

.selected-files.empty {
  justify-content: center;
  padding: 0 2px;
}

.selected-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 78px;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  background: #f7faff;
  color: var(--ink);
}

.selected-file-row:nth-child(even) {
  background: #eef6ff;
}

.selected-file-row:nth-child(odd) {
  background: #f9fcff;
}

.selected-file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.selected-file-row small {
  color: var(--muted);
  font-weight: 800;
  text-align: right;
}

.selected-file-row button {
  height: 28px;
  padding: 0 9px;
  border-color: #c9d4e3;
  color: var(--blue);
}

.upload-message {
  min-height: 24px;
  margin: 0 16px 13px;
  color: var(--muted);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.upload-mode-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 16px 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #f9fbfe;
}

.upload-mode-row label {
  color: var(--deep-blue);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.upload-mode-row select {
  min-width: 320px;
  max-width: 100%;
  height: 34px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.queue-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #f9fbfe;
}

.queue-tools strong {
  min-width: 0;
  color: var(--deep-blue);
  font-size: 13px;
}

.queue-tools select {
  width: 148px;
  height: 32px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.batch-browser {
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.batch-browser .list-title-row {
  align-items: flex-start;
}

.batch-browser p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.batch-search-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(520px, 48vw);
}

.batch-search-actions input {
  flex: 1 1 auto;
  min-width: 210px;
  height: 30px;
  border: 1px solid var(--line);
  padding: 0 8px;
}

.batch-wrap {
  max-height: 176px;
}

.batch-wrap button {
  min-height: 25px;
  height: 25px;
  padding: 0 8px;
  font-size: 11px;
}

.queue {
  flex: 1 1 auto;
  min-height: 220px;
  max-height: 520px;
  overflow: auto;
  padding: 0 16px 14px;
}

.queue-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.queue-row:nth-child(even) {
  background: #f1f7ff;
}

.queue-row:nth-child(odd) {
  background: #fff;
}

.queue-row:hover {
  color: var(--blue);
}

.queue-row.selected {
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
  background: #eef5ff;
}

.queue-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-row small,
.queue-row em {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  align-self: start;
  padding: 4px 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 900;
}

.badge.complete {
  color: var(--green);
}

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

.badge.scanning {
  color: var(--blue);
}

.table-wrap {
  overflow: auto;
}

.dictionary-wrap {
  max-height: 198px;
}

.join-wrap {
  max-height: 190px;
}

.formula-wrap td:last-child,
#parameterListWrap td:nth-child(4),
#parameterListWrap td:nth-child(7) {
  max-width: 740px;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-overflow: ellipsis;
  white-space: normal;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
  white-space: nowrap;
}

tbody tr:nth-child(even) td {
  background: #f1f7ff;
}

tbody tr:nth-child(odd) td {
  background: #fff;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef3fa;
  color: var(--deep-blue);
}

th.sortable-header {
  cursor: pointer;
  user-select: none;
}

th.sortable-header::after {
  content: "  <>";
  font-size: 10px;
  opacity: 0.45;
}

th.sortable-header[data-sort-dir="asc"]::after {
  content: "  ^";
  font-size: 10px;
  opacity: 1;
}

th.sortable-header[data-sort-dir="desc"]::after {
  content: "  v";
  font-size: 10px;
  opacity: 1;
}

.help-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  margin-left: 6px;
  border: 1px solid #97afd0;
  border-radius: 50%;
  background: #e9f3ff;
  color: var(--deep-blue);
  font-size: 11px;
  font-weight: 900;
  vertical-align: middle;
}

.group-row td {
  background: #e7eef8;
  color: var(--deep-blue);
  font-weight: 900;
}

.selected-data-row td {
  background: #e9f3ff;
  color: var(--deep-blue);
  font-weight: 800;
}

.dictionary-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 10px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: #f8fbff;
}

.detail-panel {
  min-width: 0;
  border: 1px solid var(--line);
  background: #fff;
}

.list-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  background: #f9fbfe;
}

.list-title-row h3 {
  margin: 0;
  color: var(--deep-blue);
  font-size: 13px;
}

.list-title-row button {
  min-height: 26px;
  height: 26px;
  padding: 0 9px;
  color: var(--blue);
  font-size: 11px;
}

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

.list-actions .success-button {
  color: #fff;
}

.detail-wrap {
  max-height: calc(34px + (var(--visible-rows, 5) * 35px));
}

.list-wrap-5 {
  max-height: calc(34px + (var(--visible-rows, 5) * 35px));
}

.row-stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 26px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.row-stepper button {
  width: 26px;
  min-height: 24px;
  height: 24px;
  padding: 0;
  color: var(--blue);
  font-size: 15px;
  line-height: 1;
}

.row-stepper button:disabled {
  color: #98a4b4;
  background: #eef2f7;
}

.row-stepper b {
  min-width: 20px;
  text-align: center;
  color: var(--deep-blue);
}

.join-list-panel {
  border-top: 1px solid var(--line);
  background: #fff;
}

.modern-erd {
  border-top: 1px solid var(--line);
  background: #fbfdff;
}

.modern-erd-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.modern-erd-title h2 {
  color: var(--deep-blue);
  font-size: 18px;
}

.modern-erd-title p {
  color: var(--muted);
  font-size: 13px;
}

.erd-view-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.segmented-buttons {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0;
  border: 1px solid #b9c7d8;
}

.segmented-buttons button {
  min-height: 30px;
  border: 0;
  border-right: 1px solid #b9c7d8;
  background: #fff;
  color: var(--deep-blue);
}

.segmented-buttons button:last-child {
  border-right: 0;
}

.segmented-buttons button.active {
  background: var(--blue);
  color: #fff;
}

.erd-view-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.erd-view-toolbar select {
  min-width: 260px;
  height: 32px;
  border: 1px solid var(--line);
  background: #fff;
}

.modern-erd-canvas {
  min-height: 380px;
  overflow: auto;
  padding: 18px;
  color: var(--muted);
  font-weight: 800;
}

.relationship-erd {
  min-width: 960px;
}

.erd-entity-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 14px;
}

.erd-entity-card {
  min-width: 0;
  border: 1px solid #93a5bd;
  background: #fff;
}

.erd-entity-card header {
  padding: 10px 12px;
  border-bottom: 1px solid #93a5bd;
  background: #e7eef8;
  color: var(--deep-blue);
  font-weight: 900;
  overflow-wrap: anywhere;
  white-space: normal;
}

.erd-card-fields {
  padding: 8px 10px 10px;
}

.erd-card-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.erd-card-field span,
.erd-table-card header {
  min-width: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-overflow: ellipsis;
  white-space: normal;
}

.erd-card-field em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.erd-card-field strong {
  padding: 2px 5px;
  background: #e8f5ee;
  color: var(--green);
  font-size: 10px;
}

.erd-card-field.join-field {
  color: var(--deep-blue);
}

.erd-more-line,
.erd-empty-note {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.erd-relationship-strip {
  margin-top: 18px;
  border: 1px solid var(--line);
  background: #fff;
}

.erd-relationship-strip h3 {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--deep-blue);
  font-size: 15px;
}

.erd-relation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 10px;
  padding: 12px;
}

.erd-relation-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  align-items: stretch;
  border: 1px solid #c8d4e4;
  background: #fbfdff;
}

.erd-report-badge {
  grid-column: 1 / -1;
  padding: 5px 9px;
  border-bottom: 1px solid var(--line);
  background: #f6f9fd;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.erd-relation-endpoint {
  min-width: 0;
  padding: 9px 10px;
}

.erd-relation-endpoint strong,
.erd-relation-endpoint span {
  display: block;
  overflow: hidden;
  overflow-wrap: anywhere;
  white-space: normal;
}

.erd-relation-endpoint strong {
  color: var(--deep-blue);
  font-size: 12px;
}

.erd-relation-endpoint span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.erd-relation-mid {
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 8px;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: #eef5ff;
  text-align: center;
}

.erd-relation-mid em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.erd-relation-mid b {
  color: var(--blue);
  font-size: 12px;
}

.erd-report-section {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  background: #fff;
}

.erd-report-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #f9fbfe;
}

.erd-report-heading h3 {
  margin: 0;
  color: var(--deep-blue);
  font-size: 15px;
}

.erd-report-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.erd-legend {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 8px;
  padding: 10px 12px 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.erd-legend span {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  background: #f8fbff;
  overflow-wrap: anywhere;
}

.erd-legend b {
  color: var(--deep-blue);
}

.report-table-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(250px, 1fr));
  gap: 12px;
  padding: 12px;
}

.erd-table-card {
  border: 1px solid #9bacbf;
  background: #fff;
}

.erd-table-card header {
  padding: 8px 10px;
  border-bottom: 1px solid #9bacbf;
  background: #e7eef8;
  color: var(--deep-blue);
  font-weight: 900;
}

.erd-table-card > div {
  padding: 8px 10px;
}

.erd-join-table-wrap {
  padding: 0 12px 12px;
}

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

.erd-join-table th {
  background: #eaf1fa;
}

.erd-join-table td,
.erd-join-table th {
  border: 1px solid var(--line);
  padding: 8px 9px;
  color: var(--deep-blue);
  font-size: 12px;
  text-align: left;
}

.erd-report-joins {
  margin: 0;
  padding: 0 12px 12px 28px;
  color: var(--ink);
  font-size: 12px;
}

.erd-report-joins li {
  margin: 6px 0;
  overflow-wrap: anywhere;
}

.erd-report-joins span {
  margin: 0 8px;
  color: var(--blue);
  font-weight: 900;
}

.erd-detail-table td,
.erd-detail-table th {
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 1000px) {
  .app-header,
  .header-actions,
  .panel-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .dictionary-detail-grid {
    grid-template-columns: 1fr;
  }

  .panel-title input:not([type="radio"]) {
    width: 100%;
  }

  .panel-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .erd-legend,
  .report-table-grid,
  .erd-entity-grid,
  .erd-relation-grid {
    grid-template-columns: 1fr;
  }

  .panel-actions input:not([type="radio"]) {
    width: 100%;
  }
}

.password-rule {
  margin: 10px 0 12px;
  padding: 10px 12px;
  border: 1px solid #b7c8e0;
  background: #e9f3ff;
  color: var(--deep-blue);
  font-weight: 800;
}

.attention-row td,
tbody tr.attention-row:nth-child(even) td,
tbody tr.attention-row:nth-child(odd) td {
  background: #f6f8fb;
  color: var(--muted);
  font-weight: 500;
  white-space: normal;
}

.attention-message {
  display: inline-block;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.35;
}

.attention-message::before {
  content: "";
}

.attention-block {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: #f6f8fb;
}

.processing-row td,
tbody tr.processing-row:nth-child(even) td,
tbody tr.processing-row:nth-child(odd) td {
  background: #edf9f1;
  color: #08703d;
  font-weight: 900;
  white-space: normal;
}

.processing-message {
  display: inline-block;
  color: #08703d;
  font-weight: 900;
  line-height: 1.35;
}

.processing-block {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid #9bd8b1;
  background: #edf9f1;
}

.erd-empty-note.attention-message {
  display: inline-block;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.35;
}
.global-upload-mode {
  margin: 0 8px 10px;
}

.erd-legend-once {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #f9fbfe;
}

.key-badge {
  display: inline-block;
  min-width: 34px;
  padding: 2px 6px;
  border: 1px solid #b9c9dc;
  text-align: center;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.3;
}

.key-badge.pk {
  border-color: #1f6fbd;
  background: #d9ecff;
  color: #064f91;
}

.key-badge.fk {
  border-color: #11824a;
  background: #dff6ea;
  color: #08703d;
}

.key-badge.confirmed,
.key-badge.join-type {
  min-width: auto;
  border-color: #d7c187;
  background: #fff7df;
  color: #7a5600;
}

.erd-card-field .key-badge {
  justify-self: end;
}

.erd-relationship-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0 12px 12px;
  list-style: none;
}

.erd-relationship-list li {
  display: grid;
  grid-template-columns: 42px minmax(180px, 1fr) minmax(120px, auto) minmax(180px, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #f8fbff;
  color: var(--deep-blue);
  font-size: 12px;
  font-weight: 800;
}

.erd-relationship-list li strong {
  color: var(--blue);
}

.erd-link-from,
.erd-link-to {
  min-width: 0;
  overflow-wrap: anywhere;
}

.erd-link-type {
  padding: 4px 8px;
  border: 1px solid #b7c8e0;
  background: #eaf3ff;
  color: #155fa8;
  text-align: center;
  font-weight: 900;
}

@media (max-width: 1000px) {
  .erd-relationship-list li {
    grid-template-columns: 1fr;
  }
}




.dictionary-sort-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 14px;
  color: var(--muted);
  font-weight: 900;
}

.dictionary-sort-label select {
  min-width: 230px;
  height: 34px;
}
.erd-card-note,
.erd-total-fields {
  color: var(--muted);
  font-weight: 900;
}

