:root {
  --bg: #f3f5f4;
  --surface: #ffffff;
  --surface-muted: #f7f8f7;
  --line: #dbe2dd;
  --line-strong: #c6d1ca;
  --text: #17231d;
  --text-muted: #66736c;
  --green: #145b36;
  --green-hover: #104b2d;
  --green-soft: #e5f0e9;
  --red: #b02b20;
  --red-soft: #fbecea;
  --amber: #8d5a00;
  --amber-soft: #fff3dc;
  --shadow: 0 1px 2px rgba(16, 24, 20, 0.05), 0 10px 26px rgba(16, 24, 20, 0.06);
  font-family: "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.topbar {
  height: 72px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 28px;
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-mark {
  height: 42px;
  width: 42px;
  flex: none;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: var(--green);
  color: #fff;
  font-size: 25px;
  font-weight: 700;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 650;
}

.brand p {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.session-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.connected {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.connected::before {
  content: "";
  height: 8px;
  width: 8px;
  border-radius: 50%;
  background: #21a15c;
}

.quiet-button {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 0 16px;
}

.quiet-button:hover {
  background: var(--surface-muted);
}

.shell {
  width: min(1050px, calc(100% - 44px));
  margin: 32px auto;
  flex: 1;
}

.login-view {
  min-height: calc(100vh - 180px);
  display: grid;
  place-items: center;
}

.auth-panel {
  width: min(420px, 100%);
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-panel h2 {
  margin: 0 0 24px;
  font-size: 20px;
  font-weight: 650;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.field span {
  color: #39483f;
  font-size: 13px;
  font-weight: 600;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  min-height: 46px;
  padding: 0 13px;
  outline: none;
}

.field textarea {
  min-height: 142px;
  padding: 12px 13px;
  resize: vertical;
  line-height: 1.45;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(20, 91, 54, 0.13);
}

.primary-button {
  height: 47px;
  border: 0;
  border-radius: 7px;
  padding: 0 22px;
  background: var(--green);
  color: #fff;
  font-weight: 600;
}

.primary-button:hover {
  background: var(--green-hover);
}

.primary-button:disabled,
.quiet-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.auth-panel .primary-button {
  width: 100%;
  margin-top: 20px;
}

.message {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

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

.message.success {
  color: var(--green);
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.operation-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  background: #e7ebe8;
  border-radius: 8px;
}

.operation-tab,
.source-option {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #45544b;
  padding: 0 17px;
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
}

.operation-tab.active,
.source-option.active {
  background: var(--surface);
  color: var(--green);
  box-shadow: 0 1px 3px rgba(20, 28, 24, 0.1);
}

.editor {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}

.source-toggle {
  display: flex;
  width: max-content;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-muted);
  padding: 3px;
  margin-bottom: 23px;
}

.source-option {
  min-height: 38px;
  padding: 0 18px;
}

.account-fields,
.change-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(210px, 1fr));
  gap: 18px;
}

.change-fields {
  padding-top: 22px;
  margin-top: 22px;
  border-top: 1px solid var(--line);
}

.submit-row {
  display: flex;
  align-items: center;
  gap: 18px;
  border-top: 1px solid var(--line);
  margin-top: 25px;
  padding-top: 21px;
}

.submit-row .message {
  margin: 0;
}

.result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.result-panel header {
  padding: 17px 21px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.result-panel h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

#result-summary {
  color: var(--text-muted);
  font-size: 13px;
}

.result-head,
.result-row {
  display: grid;
  grid-template-columns: minmax(155px, 1fr) 125px minmax(190px, 1.5fr);
  gap: 12px;
  padding: 12px 21px;
  align-items: center;
}

.result-head {
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.result-row {
  border-top: 1px solid #edf0ee;
  font-size: 14px;
}

.badge {
  display: inline-flex;
  width: max-content;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 650;
}

.badge.ok {
  background: var(--green-soft);
  color: var(--green);
}

.badge.fail {
  background: var(--red-soft);
  color: var(--red);
}

.result-detail {
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 18px 22px 25px;
}

@media (max-width: 680px) {
  .topbar {
    height: auto;
    min-height: 68px;
    padding: 12px 16px;
    align-items: flex-start;
  }

  .brand h1 {
    font-size: 16px;
  }

  .connected {
    display: none;
  }

  .shell {
    width: calc(100% - 28px);
    margin: 20px auto;
  }

  .editor {
    padding: 17px;
  }

  .operation-nav {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    overflow: visible;
  }

  .operation-tab {
    width: 100%;
  }

  .account-fields,
  .change-fields {
    grid-template-columns: 1fr;
  }

  .submit-row {
    flex-direction: column;
    align-items: stretch;
  }

  .result-panel header {
    flex-direction: column;
    align-items: flex-start;
  }

  .result-head {
    display: none;
  }

  .result-row {
    grid-template-columns: 1fr;
    gap: 9px;
    padding: 15px 17px;
  }
}
