:root {
  color-scheme: light;
  --bg: #f5f7f9;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #687483;
  --line: #dbe2ea;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --danger: #b42318;
  --ok-bg: #e7f6ef;
  --err-bg: #fff0ed;
  --shadow: 0 18px 50px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

button,
textarea {
  font: inherit;
}

.app {
  min-height: 100vh;
  padding: 28px;
}

.workspace {
  max-width: 1320px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.1;
  letter-spacing: 0;
}

.topbar p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
}

.counter {
  min-width: 108px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  text-align: right;
}

.counter span {
  display: block;
  font-size: 28px;
  font-weight: 760;
}

.counter small {
  color: var(--muted);
}

.panels {
  display: grid;
  grid-template-columns: minmax(360px, 0.85fr) minmax(520px, 1.15fr);
  gap: 18px;
}

.panel {
  min-height: 650px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head,
.panel-foot {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-foot {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

h2 {
  font-size: 16px;
}

.actions {
  display: flex;
  gap: 8px;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

button:hover {
  border-color: #b8c3cf;
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.icon-btn {
  min-width: 68px;
  padding: 0 12px;
}

#convertBtn {
  min-width: 116px;
  padding: 0 18px;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

#convertBtn:hover {
  background: var(--accent-strong);
}

#sourceText {
  width: 100%;
  min-height: 520px;
  flex: 1;
  resize: none;
  border: 0;
  outline: 0;
  padding: 18px;
  color: var(--ink);
  line-height: 1.65;
}

#statusText {
  color: var(--muted);
  font-size: 14px;
}

.table-wrap {
  flex: 1;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f9fbfc;
  color: #4f5f6f;
  font-size: 13px;
}

th:first-child,
td:first-child {
  width: 96px;
}

td {
  word-break: break-all;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.badge.ok {
  background: var(--ok-bg);
  color: #116149;
}

.badge.error {
  background: var(--err-bg);
  color: var(--danger);
}

a {
  color: var(--accent-strong);
}

.empty-row td {
  height: 160px;
  color: var(--muted);
  text-align: center;
  vertical-align: middle;
}

@media (max-width: 980px) {
  .app {
    padding: 18px;
  }

  .topbar,
  .panels {
    display: block;
  }

  .counter {
    margin-top: 16px;
    text-align: left;
  }

  .panel {
    min-height: 460px;
    margin-bottom: 18px;
  }

  #sourceText {
    min-height: 330px;
  }
}
