:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f7f8fb;
  color: #17202a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 22px;
}

h2 {
  margin-bottom: 12px;
  font-size: 15px;
}

nav {
  display: flex;
  gap: 8px;
}

button,
.tab,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid #b8c1ce;
  border-radius: 6px;
  padding: 8px 13px;
  background: #ffffff;
  color: #17202a;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.tab.active,
.button-link:hover {
  border-color: #2563eb;
  background: #eef4ff;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 24px;
}

.main-form,
.side,
.connection-form,
table,
.output,
.history-item {
  border: 1px solid #d7dce5;
  border-radius: 8px;
  background: #ffffff;
}

.connection-help {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  color: #405166;
  font-size: 14px;
}

code {
  border: 1px solid #d7dce5;
  border-radius: 4px;
  padding: 2px 5px;
  background: #f2f4f7;
}

.main-form,
.side,
.connection-form {
  padding: 18px;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: #405166;
  font-size: 13px;
  font-weight: 650;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #bac3cf;
  border-radius: 6px;
  padding: 10px 11px;
  color: #17202a;
  font: inherit;
  font-weight: 400;
}

textarea {
  resize: vertical;
}

.grid {
  display: grid;
  gap: 14px;
}

.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three {
  grid-template-columns: 180px minmax(0, 1fr) minmax(0, 1fr);
}

.checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 9px;
  border: 1px solid #d7dce5;
  border-radius: 6px;
  color: #17202a;
}

.check input {
  width: auto;
}

.overrides textarea {
  min-height: 74px;
}

#publish-button {
  width: 100%;
  border-color: #136f63;
  background: #136f63;
  color: white;
}

.output {
  min-height: 120px;
  margin-top: 18px;
  padding: 14px;
  overflow: auto;
  white-space: pre-wrap;
}

table {
  width: 100%;
  margin-top: 18px;
  border-collapse: collapse;
  overflow: hidden;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid #e4e7ed;
  text-align: left;
  font-size: 14px;
}

th {
  color: #405166;
}

.history {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.history-item {
  padding: 14px;
}

.notice {
  margin-bottom: 14px;
  border: 1px solid #d7dce5;
  border-radius: 6px;
  padding: 10px 12px;
  background: #f8fafc;
  color: #405166;
  font-size: 14px;
}

.notice.warning {
  border-color: #f5c26b;
  background: #fff8e6;
  color: #7a4b00;
}

.status-ok {
  color: #136f63;
  font-weight: 700;
}

.status-fail {
  color: #b42318;
  font-weight: 700;
}

.batch-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 20px;
}

.batch-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border: 1px solid #d7dce5;
  border-radius: 6px;
  font-weight: 400;
  cursor: pointer;
}

.batch-row input {
  width: auto;
  margin-top: 3px;
}

#caption-table-wrap textarea,
#caption-table-wrap input {
  min-width: 220px;
}

#approve-button {
  width: 100%;
  margin-top: 14px;
  border-color: #136f63;
  background: #136f63;
  color: white;
}

#approve-button:disabled {
  border-color: #b8c1ce;
  background: #eef1f5;
  color: #8592a3;
  cursor: not-allowed;
}

.danger {
  width: 100%;
  margin-top: 10px;
  border-color: #b42318;
  background: #b42318;
  color: white;
}

.danger:disabled {
  border-color: #b8c1ce;
  background: #eef1f5;
  color: #8592a3;
  cursor: not-allowed;
}

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

  .layout,
  .two,
  .three {
    grid-template-columns: 1fr;
  }
}
