html {
  font-size: 15px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  background: #f6f7f9;
  color: #1f2933;
  margin: 0;
  overflow-x: hidden;
}

a {
  color: #1662a8;
}

code {
  background: #eef2f6;
  border-radius: 4px;
  padding: 2px 5px;
}

table {
  background: #fff;
  border-collapse: collapse;
  border: 1px solid #d9e0e8;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid #e3e8ef;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #eef2f6;
  font-weight: 700;
}

input,
select {
  border: 1px solid #c8d2de;
  border-radius: 6px;
  padding: 9px 10px;
  width: 100%;
}

button,
.button {
  background: #1d4f7a;
  border: 0;
  border-radius: 6px;
  color: #fff;
  display: inline-block;
  font-weight: 700;
  padding: 9px 14px;
  text-decoration: none;
}

.btn {
  align-items: center;
  border: 0;
  border-radius: 6px;
  color: #fff;
  display: inline-flex;
  font-size: 0.9rem;
  font-weight: 700;
  justify-content: center;
  line-height: 1.1;
  min-height: 34px;
  padding: 8px 12px;
  text-decoration: none;
  white-space: nowrap;
}

.btn-sm {
  min-height: 30px;
  padding: 6px 10px;
}

.btn-primary,
.button:not(.secondary):not(.danger),
.admin-btn-primary {
  background: #176b4d;
}

.btn-secondary,
.button.secondary,
button.secondary,
.admin-btn-secondary {
  background: #52606d;
}

.btn-success {
  background: #176b4d;
}

.btn-warning,
.admin-btn-warning {
  background: #9a5b13;
}

.btn-danger,
.button.danger,
button.danger,
.admin-btn-danger {
  background: #9b2c2c;
}

.btn:disabled,
.btn.disabled,
.admin-btn-disabled,
.admin-btn:disabled {
  background: #d9e0e8;
  color: #6b7785;
  cursor: not-allowed;
}

.button.secondary,
button.secondary,
.admin-btn-secondary {
  background: #52606d;
}

.button.danger,
button.danger,
.admin-btn-danger {
  background: #9b2c2c;
}

.admin-btn-primary {
  background: #176b4d;
}

.admin-btn-warning {
  background: #9a5b13;
}

.admin-btn-disabled,
.admin-btn:disabled {
  background: #d9e0e8;
  color: #6b7785;
  cursor: not-allowed;
}

.admin-btn {
  align-items: center;
  border: 0;
  border-radius: 6px;
  color: #fff;
  display: inline-flex;
  font-size: 0.88rem;
  font-weight: 700;
  justify-content: center;
  line-height: 1.1;
  min-height: 34px;
  padding: 8px 10px;
  text-align: center;
  text-decoration: none;
  width: 100%;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.table-actions > .btn,
.table-actions > .actions-menu {
  flex: 0 0 auto;
}

.actions-menu {
  position: relative;
}

.actions-menu summary {
  list-style: none;
}

.actions-menu summary::-webkit-details-marker {
  display: none;
}

.actions-menu-panel {
  background: #fff;
  border: 1px solid #c8d2de;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(31, 41, 51, 0.12);
  display: grid;
  gap: 6px;
  min-width: 210px;
  padding: 8px;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
}

.actions-menu[open] .actions-menu-panel {
  display: grid;
}

.actions-menu .btn,
.actions-menu form,
.actions-menu a {
  width: 100%;
}

.actions-menu form {
  margin: 0;
}

.actions-menu .btn-danger {
  justify-content: flex-start;
}

.admin-table {
  font-size: 0.95rem;
  min-width: 100%;
  width: max-content;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

.admin-table th,
.admin-table td {
  overflow-wrap: anywhere;
  padding: 12px 14px;
  vertical-align: middle;
}

.admin-table tbody tr:hover {
  background: #fafbfc;
}

.licenses-table {
  table-layout: auto;
}

.date-cell,
.compact-cell {
  white-space: nowrap;
}

.compact-cell {
  text-align: center;
}

.actions-column {
  min-width: 240px;
  width: 240px;
}

.actions-cell {
  vertical-align: top;
}

.license-actions {
  display: grid;
  gap: 8px;
}

.license-actions-row,
.action-row {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.page-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.form-card {
  max-width: 720px;
}

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

.metric strong {
  display: block;
  font-size: 1.8rem;
  margin-top: 6px;
}

.status-pill {
  border-radius: 999px;
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  padding: 6px 9px;
}

.status-active {
  background: #e7f5ee;
  color: #14613f;
}

.status-blocked {
  background: #fdecec;
  color: #9b2c2c;
}

.status-expired {
  background: #f1f3f5;
  color: #52606d;
}

.status-trial {
  background: #eaf3ff;
  color: #195a9b;
}

.empty-state {
  color: #52606d;
  font-weight: 700;
}

.created-license-panel h2 {
  font-size: 1.15rem;
  margin: 0 0 10px;
}

.created-license-field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.created-license-key {
  display: block;
  overflow-x: auto;
  padding: 9px 10px;
  white-space: nowrap;
}

.created-license-summary {
  display: grid;
  gap: 8px 18px;
  grid-template-columns: max-content minmax(0, 1fr);
  margin: 14px 0 0;
}

.created-license-summary dt {
  color: #52606d;
  font-weight: 700;
}

.created-license-summary dd {
  margin: 0;
}

.admin-shell {
  margin: 0 auto;
  max-width: 1200px;
  padding: 24px;
  width: 100%;
}

.admin-shell.narrow {
  max-width: 1200px;
}

.admin-nav {
  align-items: center;
  background: #fff;
  border: 1px solid #d9e0e8;
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 24px;
  padding: 12px 14px;
}

.site-topbar {
  background: #fff;
  border-bottom: 1px solid #d9e0e8;
}

.site-topbar-inner {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 54px;
  padding-bottom: 8px;
  padding-top: 8px;
}

.site-brand {
  color: #1f2933;
  font-weight: 800;
  text-decoration: none;
}

.site-topbar-meta {
  align-items: center;
  color: #52606d;
  display: flex;
  gap: 12px;
  white-space: nowrap;
}

.site-topbar-meta a {
  color: #52606d;
  font-size: 0.92rem;
}

.page-content {
  padding-bottom: 40px;
  padding-top: 28px;
}

.panel {
  background: #fff;
  border: 1px solid #d9e0e8;
  border-radius: 8px;
  margin-bottom: 22px;
  padding: 18px;
}

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

.stacked-form {
  display: grid;
  gap: 10px;
}

.title-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
}

.error {
  color: #a12727;
  font-weight: 700;
}

.success {
  border-color: #8abf9a;
}

@media (max-width: 820px) {
  .admin-shell {
    padding: 16px;
  }

  .page-content {
    padding-top: 18px;
  }

  .site-topbar-inner,
  .site-topbar-meta {
    flex-wrap: wrap;
  }

  .site-topbar-meta {
    justify-content: flex-end;
    white-space: normal;
  }

  .admin-nav {
    gap: 8px 12px;
    margin-bottom: 18px;
  }

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

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

  .license-actions-row,
  .action-row {
    grid-template-columns: 1fr;
  }

  .title-row > h1 {
    flex: 1 1 100%;
  }

  .page-toolbar {
    justify-content: flex-start;
  }

  .panel {
    padding: 14px;
  }

  .created-license-summary {
    grid-template-columns: 1fr;
  }
}
