:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #18202a;
  --muted: #657184;
  --line: #dfe4eb;
  --accent: #146c5f;
  --accent-strong: #0e5148;
  --warn: #9d4b1b;
  --bad: #9b2434;
  --ok: #146c5f;
  --shadow: 0 12px 30px rgba(22, 32, 42, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.hidden {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

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

.auth-panel h1 {
  margin-bottom: 6px;
}

.message {
  color: var(--bad);
  min-height: 20px;
  font-size: 13px;
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.05;
}

h2 {
  font-size: 17px;
  margin-bottom: 16px;
}

.topbar p {
  color: var(--muted);
  margin-top: 6px;
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button,
button {
  border: 0;
  background: var(--accent);
  color: #fff;
  height: 40px;
  padding: 0 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

.icon-button {
  width: 40px;
  padding: 0;
  font-size: 20px;
}

button:hover {
  background: var(--accent-strong);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metrics div,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metrics div {
  padding: 16px;
}

.metrics span {
  display: block;
  font-size: 28px;
  font-weight: 800;
}

.metrics small {
  color: var(--muted);
}

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

.tab {
  background: transparent;
  color: var(--muted);
  border-radius: 6px 6px 0 0;
  border-bottom: 3px solid transparent;
}

.tab:hover,
.tab.active {
  background: #e9f1ef;
  color: var(--accent-strong);
  border-bottom-color: var(--accent);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.split {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.split.full-width {
  grid-template-columns: 1fr;
}

.panel {
  padding: 18px;
}

form {
  display: grid;
  gap: 13px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-check input {
  width: auto;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--text);
  background: #fff;
}

textarea {
  resize: vertical;
}

.feature-picker {
  position: relative;
}

.feature-picker-button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text);
  display: flex;
  font-weight: 600;
  justify-content: space-between;
  padding: 0 34px 0 11px;
  position: relative;
  text-align: left;
  width: 100%;
}

.feature-picker-button::after {
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--muted);
  content: "";
  position: absolute;
  right: 12px;
  top: 17px;
}

.feature-picker-button:hover {
  background: #f8fafb;
  color: var(--text);
}

.feature-menu {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  display: grid;
  left: 0;
  max-height: 220px;
  overflow: auto;
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 5;
}

.feature-option {
  align-items: center;
  border-radius: 5px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  font-weight: 600;
  gap: 8px;
  padding: 8px;
}

.feature-option:hover {
  background: #f5f7f9;
}

.feature-option input {
  width: auto;
}

.feature-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 8px;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.list {
  display: grid;
  gap: 10px;
}

.item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.item-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.item-title {
  font-weight: 800;
}

.meta {
  color: var(--muted);
  font-size: 13px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.license-key-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.license-key-row.compact {
  min-width: 280px;
}

.license-key-row code {
  min-width: 0;
  background: #f5f7f9;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #243040;
  display: block;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  overflow-wrap: anywhere;
  padding: 10px;
}

.activation-list {
  display: grid;
  gap: 8px;
}

.activation-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.activation-row .meta {
  display: block;
  margin-top: 2px;
}

.table-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.table-filters input[type="search"] {
  flex: 1 1 220px;
}

.table-filters select {
  flex: 0 1 180px;
}

.data-table-wrap {
  overflow-x: auto;
  width: 100%;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  table-layout: fixed;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-size: 12px;
  position: relative;
  text-transform: uppercase;
  user-select: none;
}

.data-table tbody > tr:not(.table-detail-row) > td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table td > .meta {
  display: block;
  margin-top: 2px;
}

.table-detail-row td {
  background: #f8fafb;
  overflow-wrap: anywhere;
  padding-top: 8px;
  padding-bottom: 12px;
  white-space: normal;
}

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

.changes-table {
  width: 100%;
  border-collapse: collapse;
}

.changes-table th,
.changes-table td {
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  overflow-wrap: anywhere;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.changes-table th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.detail-grid h3 {
  font-size: 13px;
  margin: 0 0 8px;
}

.row-toggle {
  align-items: start;
  background: transparent;
  color: var(--text);
  display: inline-flex;
  gap: 8px;
  height: auto;
  justify-content: flex-start;
  padding: 0;
  text-align: left;
  width: 100%;
}

.row-toggle:hover {
  background: transparent;
  color: var(--accent-strong);
}

.row-toggle > span:first-child {
  color: var(--accent);
  font-size: 15px;
  line-height: 1.2;
  width: 16px;
}

.secondary-button {
  background: #eef2f5;
  color: #3d4856;
  height: 34px;
  padding: 0 10px;
}

.secondary-button:hover {
  background: #dfe7ee;
  color: #243040;
}

.danger-button {
  background: var(--bad);
}

.danger-button:hover {
  background: #7f1d2a;
}

.table-sort {
  background: transparent;
  border-radius: 4px;
  color: inherit;
  display: inline-flex;
  gap: 6px;
  height: auto;
  justify-content: flex-start;
  padding: 2px 18px 2px 0;
  text-align: left;
  text-transform: inherit;
  width: 100%;
}

.table-sort:hover {
  background: transparent;
  color: var(--accent-strong);
}

.table-sort span {
  min-width: 12px;
}

.column-resizer {
  bottom: 0;
  cursor: col-resize;
  position: absolute;
  right: -4px;
  top: 0;
  width: 8px;
  z-index: 1;
}

.column-resizer::after {
  background: var(--line);
  bottom: 8px;
  content: "";
  position: absolute;
  right: 3px;
  top: 8px;
  width: 1px;
}

.column-resizer:hover::after,
.resizing-column .column-resizer::after {
  background: var(--accent);
}

.resizing-column {
  cursor: col-resize;
  user-select: none;
}

.chip {
  background: #eef2f5;
  color: #3d4856;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}

.chip.ok {
  background: #dff4ef;
  color: var(--ok);
}

.chip.bad {
  background: #f8dfe4;
  color: var(--bad);
}

.chip.warn {
  background: #f7eadf;
  color: var(--warn);
}

.empty {
  color: var(--muted);
}

.result {
  margin: 18px 0 0;
  background: #101820;
  color: #dff4ef;
  border-radius: 8px;
  padding: 16px;
  min-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
}

.audit-panel {
  margin-top: 18px;
}

.audit-list {
  display: grid;
  gap: 8px;
}

.audit-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

dialog {
  width: min(680px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(22, 32, 42, 0.25);
}

dialog form {
  padding: 20px;
}

dialog p {
  color: var(--muted);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 900px) {
  .shell {
    width: min(100vw - 20px, 760px);
    padding-top: 18px;
  }

  .metrics,
  .split {
    grid-template-columns: 1fr;
  }

  .tabs {
    overflow-x: auto;
    padding-bottom: 2px;
  }

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

  .topbar,
  .account-actions,
  .activation-row {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }
}
