:root {
  color-scheme: dark;
  --bg: #111316;
  --surface: #191d22;
  --surface-2: #20262d;
  --line: #323a44;
  --text: #f3f6f8;
  --muted: #9aa6b2;
  --green: #29c96f;
  --red: #ff5d5d;
  --blue: #64a8ff;
  --amber: #f2bb4d;
}

* {
  box-sizing: border-box;
}

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

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

button {
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #07110b;
  font-weight: 700;
  min-height: 42px;
  padding: 0 16px;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.08);
}

button.ghost {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
}

button.danger {
  background: var(--red);
  color: #210405;
}

button.small {
  min-height: 34px;
  padding: 0 12px;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0e1114;
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

input:focus {
  border-color: var(--blue);
}

select:focus {
  border-color: var(--blue);
}

textarea {
  width: 100%;
  min-height: 340px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0e1114;
  color: var(--text);
  padding: 12px;
  outline: none;
  line-height: 1.45;
}

textarea:focus {
  border-color: var(--blue);
}

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

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

.login-panel {
  width: min(420px, 100%);
  margin: 11vh auto 0;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: var(--green);
  color: #06100a;
  font-weight: 900;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.1;
}

h2 {
  font-size: 18px;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

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

.dashboard {
  display: grid;
  gap: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 8px;
}

.eyebrow {
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 8px;
}

.top-actions {
  display: flex;
  gap: 10px;
}

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

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

.metrics article {
  padding: 16px;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.metrics strong {
  font-size: 28px;
}

.panel {
  padding: 18px;
}

.create-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
  align-items: end;
}

.create-grid .wide {
  grid-column: span 2;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.panel-head input {
  max-width: 380px;
}

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

.license-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(260px, 1.4fr) minmax(230px, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.main-info {
  display: grid;
  gap: 5px;
}

.main-info strong {
  font-size: 16px;
}

.meta,
.machine {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  min-width: 0;
}

.mono {
  font-family: "Cascadia Mono", Consolas, monospace;
  word-break: break-all;
}

.badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 900;
}

.badge.active {
  background: rgba(41, 201, 111, 0.15);
  color: var(--green);
}

.badge.blocked {
  background: rgba(255, 93, 93, 0.15);
  color: var(--red);
}

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

.empty {
  color: var(--muted);
  padding: 18px 0 4px;
}

.modal {
  width: min(460px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
}

.prompt-modal {
  width: min(820px, calc(100% - 32px));
}

.prompt-text {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.modal-body {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.expiry-fields {
  display: grid;
  gap: 12px;
}

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

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

  .metrics,
  .create-grid,
  .license-row {
    grid-template-columns: 1fr;
  }

  .create-grid .wide {
    grid-column: auto;
  }

  .panel-head input {
    max-width: none;
  }

  .row-actions {
    justify-content: stretch;
  }

  .row-actions button {
    flex: 1;
  }
}
