:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #6b7684;
  --line: #d7dde5;
  --accent: #0d7a73;
  --accent-strong: #09635d;
  --danger: #b42318;
  --warn: #9a6700;
  --ok: #067647;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

h1, h2, p {
  margin: 0;
}

h1 {
  font-size: 22px;
  font-weight: 700;
}

h2 {
  font-size: 16px;
  font-weight: 700;
}

p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.link-status {
  min-width: 132px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: #f8fafc;
}

.link-status.connected {
  border-color: rgba(6, 118, 71, 0.35);
  color: var(--ok);
  background: #ecfdf3;
}

.shell {
  display: grid;
  grid-template-columns: minmax(360px, 520px) minmax(360px, 1fr);
  gap: 18px;
  padding: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}

.toolbar,
.actions,
.log-head,
.progress-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar,
.actions {
  flex-wrap: wrap;
}

button,
.file-button {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 0 13px;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

button.primary:hover:not(:disabled) {
  background: var(--accent-strong);
}

.file-button {
  display: inline-flex;
  align-items: center;
}

.file-button input {
  display: none;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}

.info-grid div {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #f8fafc;
}

dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
}

.progress-wrap {
  margin-top: 16px;
}

.progress-bar {
  height: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #edf1f5;
}

#progressFill {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 120ms linear;
}

.progress-meta {
  justify-content: space-between;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.log-panel {
  min-height: calc(100vh - 116px);
  display: flex;
  flex-direction: column;
}

.log-head {
  justify-content: space-between;
  margin-bottom: 10px;
}

#logOutput {
  flex: 1;
  min-height: 360px;
  margin: 0;
  overflow: auto;
  border: 1px solid #18212f;
  border-radius: 6px;
  background: #101722;
  color: #d5e3f0;
  padding: 12px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .shell {
    grid-template-columns: 1fr;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }
}
