:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-soft: #f9fafb;
  --text: #17212b;
  --muted: #647080;
  --line: #dce3ea;
  --blue: #1d65d8;
  --green: #14865c;
  --amber: #ad6b00;
  --red: #bf3b3b;
  --shadow: 0 12px 30px rgba(23, 33, 43, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

button,
.link-button {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
}

button.secondary,
.link-button.secondary {
  background: #fff;
  color: var(--blue);
}

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

.shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
}

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

.login-box,
.service-card,
.table-panel,
.toolbar-panel,
.tool-panel,
.result-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-box {
  width: min(420px, 100%);
  padding: 24px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 25px;
  line-height: 1.2;
}

h2 {
  font-size: 17px;
  line-height: 1.25;
}

p,
span,
td,
th,
label,
input,
button,
a {
  font-size: 13px;
}

.brand-row p,
.topbar p,
.card-head p,
.toolbar-panel p,
.panel-head span {
  color: var(--muted);
  margin-top: 4px;
}

.login-form,
.inline-form {
  display: grid;
  gap: 10px;
}

.login-form input,
.inline-form input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fbfcfd;
}

.form-error {
  min-height: 18px;
  color: var(--red);
}

.topbar,
.card-head,
.panel-head,
.toolbar-panel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  margin-bottom: 14px;
}

.actions,
.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.row-actions button {
  min-height: 30px;
  padding: 0 8px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tab {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 6px 6px 0 0;
  min-width: 92px;
}

.tab.active {
  border-color: var(--line);
  border-bottom-color: var(--panel);
  background: var(--panel);
  color: var(--text);
}

.tab-panel {
  display: none;
}

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

.summary-grid,
.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.service-card,
.toolbar-panel,
.tool-panel {
  padding: 18px;
}

.toolbar-panel {
  margin-bottom: 14px;
}

.badge {
  min-width: 76px;
  text-align: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-weight: 800;
  background: #e8edf2;
  color: var(--muted);
}

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

.badge.warn {
  background: #fff0d7;
  color: var(--amber);
}

.badge.down {
  background: #f9dfdf;
  color: var(--red);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.metric-grid div {
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: var(--panel-soft);
}

.metric-grid span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric-grid strong {
  display: block;
  font-size: 22px;
  line-height: 1.1;
}

.table-panel,
.result-panel {
  overflow: hidden;
}

.panel-head {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.table-wrap {
  overflow: auto;
  max-height: 520px;
}

.table-wrap.large {
  max-height: 680px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

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

th {
  color: var(--muted);
  background: #f7f9fb;
  position: sticky;
  top: 0;
  z-index: 1;
}

.state-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 2px 8px;
  font-weight: 800;
  background: #e8edf2;
  color: var(--muted);
}

.state-pill.ok {
  background: #dcf4e8;
  color: var(--green);
}

.state-pill.warn {
  background: #fff0d7;
  color: var(--amber);
}

.state-pill.down {
  background: #f9dfdf;
  color: var(--red);
}

.inline-form {
  margin-top: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}

.inline-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.inline-form .check {
  grid-template-columns: auto 1fr;
  align-items: center;
  color: var(--text);
}

.inline-form .check input {
  width: auto;
  height: auto;
}

.result-panel {
  margin-top: 14px;
}

pre {
  margin: 0;
  padding: 16px;
  max-height: 520px;
  overflow: auto;
  background: #101820;
  color: #e7eef6;
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 980px) {
  .summary-grid,
  .tool-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 1440px);
    padding-top: 12px;
  }

  .topbar,
  .toolbar-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions,
  .actions button,
  .actions a {
    width: 100%;
  }

  .metric-grid,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .tabs {
    gap: 6px;
  }

  .tab {
    min-width: 78px;
  }
}
