:root {
  color-scheme: light;
  --ink: #20242b;
  --muted: #667085;
  --line: #d9dee7;
  --panel: #ffffff;
  --bg: #f4f6f8;
  --accent: #0f766e;
  --accent-2: #9a3412;
  --danger: #b42318;
  --ok: #166534;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

h2 {
  margin: 0 0 12px;
  font-size: 16px;
}

main {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  padding: 16px;
}

main.app-main {
  grid-template-columns: 1fr;
}

main.user-main {
  grid-template-columns: 280px minmax(0, 1fr);
  align-items: start;
}

main.login-main {
  display: flex;
  min-height: calc(100vh - 56px);
  align-items: center;
  justify-content: center;
}

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

.login-tabs {
  margin-bottom: 0;
}

.login-tabs button {
  flex: 1;
}

.captcha-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 10px;
  align-items: stretch;
}

.captcha-image {
  min-height: 40px;
  border-color: var(--line);
  padding: 0;
  background: #fff;
  overflow: hidden;
}

.captcha-image svg {
  display: block;
  width: 100%;
  height: 40px;
}

section,
aside {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.stack {
  display: grid;
  gap: 12px;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.table-toolbar {
  margin-top: 8px;
}

.action-panel {
  margin: 10px 0 14px;
  padding: 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.side-panel {
  align-self: start;
}

.side-block + .side-block {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.info-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.info-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.info-list dt {
  color: var(--muted);
  font-size: 12px;
}

.info-list dd {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  overflow-wrap: anywhere;
}

.profile-summary {
  display: grid;
  gap: 11px;
  margin: 0;
}

.profile-account,
.profile-pair {
  min-width: 0;
}

.profile-account {
  align-items: baseline;
}

.profile-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 16px;
}

.profile-account span,
.profile-labels {
  color: var(--muted);
  font-size: 13px;
}

.profile-account strong,
.profile-values {
  font-size: 14px;
  font-weight: 700;
}

.profile-account strong,
.profile-pair span,
.profile-pair strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.profile-account strong {
  text-align: left;
}

.profile-values {
  margin-top: -6px;
}

.compact-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.compact-item {
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.compact-title {
  font-size: 13px;
  font-weight: 700;
}

.compact-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.inline-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

label {
  display: grid;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

#shareInput {
  min-height: 180px;
}

#licenseCardInput {
  min-height: 120px;
}

input[type="checkbox"] {
  width: auto;
  min-height: auto;
  cursor: pointer;
}

.dispatch-panel input[type="number"] {
  min-width: 0;
}

button {
  min-height: 34px;
  border: 1px solid #0b5f59;
  border-radius: 6px;
  padding: 0 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

button.secondary {
  background: #fff;
  color: var(--accent);
}

button.warn {
  border-color: #7c2d12;
  background: var(--accent-2);
}

button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.device-table {
  table-layout: fixed;
}

.device-table .select-col {
  width: 44px;
}

.device-table .device-col {
  width: 108px;
}

.device-table .status-col {
  width: 82px;
}

.device-table .license-col {
  width: 250px;
}

.device-table .expires-col {
  width: 170px;
}

.device-table .auto-col {
  width: 96px;
}

.device-table .task-col {
  width: 150px;
}

.device-table .heartbeat-col {
  width: 180px;
}

.device-table .error-col {
  width: auto;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 8px;
  vertical-align: top;
  cursor: default;
}

input,
select,
textarea {
  caret-color: auto;
}

th {
  color: var(--muted);
  font-weight: 700;
  background: #fafbfc;
}

.sort-header {
  display: inline-flex;
  min-height: 0;
  align-items: center;
  gap: 4px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.sort-header.active {
  color: var(--ink);
}

.sort-mark {
  display: inline-flex;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.sort-mark.is-stacked {
  flex-direction: column;
  gap: 0;
  font-size: 8px;
}

.history-title-link {
  color: var(--primary);
  text-decoration: none;
}

.history-title-link:hover {
  text-decoration: underline;
}

code {
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
}

.status {
  min-height: 22px;
  color: var(--muted);
  font-size: 13px;
  white-space: pre-line;
}

.status.ok {
  color: var(--ok);
}

.status.error {
  color: var(--danger);
}

.hidden {
  display: none !important;
}

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

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.tabs button {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.tabs button.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

@media (max-width: 1200px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  main {
    grid-template-columns: 1fr;
  }

  .grid-2,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}
