:root {
  --bg: #eef5f1;
  --panel: #ffffff;
  --border: #d9e3dc;
  --text: #14221c;
  --muted: #66746d;
  --primary: #0f8b5f;
  --dark: #12372a;
  --danger: #a43f3f;
  --focus: rgba(15, 139, 95, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  background: #f5f7f6;
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
  margin: 0;
}

button,
input,
select {
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease, background 160ms ease;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  box-shadow: 0 0 0 4px var(--focus);
  outline: none;
}

.login-shell {
  align-items: center;
  background: linear-gradient(135deg, #f5f7f6 0%, #e7f1eb 100%);
  display: grid;
  min-height: 100vh;
  padding: 20px;
  place-items: center;
}

.login-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 18px 46px rgba(25, 49, 37, 0.12);
  display: grid;
  gap: 16px;
  max-width: 430px;
  padding: 28px;
  width: min(100%, 430px);
}

.login-panel h1 {
  margin: 0;
}

.login-form {
  display: grid;
  gap: 14px;
}

.brand.dark span {
  color: var(--muted);
}

.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.side {
  background: var(--dark);
  color: #fff;
  position: sticky;
  top: 0;
  min-height: 100vh;
  padding: 22px 16px;
}

.brand {
  display: grid;
  gap: 4px;
  margin-bottom: 28px;
}

.brand span,
.muted {
  color: var(--muted);
}

.brand span {
  color: rgba(255, 255, 255, 0.62);
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.74);
  cursor: pointer;
  font: inherit;
  padding: 11px 12px;
  text-align: left;
}

.nav button.active,
.nav button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.main {
  align-content: start;
  display: grid;
  gap: 16px;
  padding: 28px;
}

.heading,
.panel,
.card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(25, 49, 37, 0.07);
}

.heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  padding: 18px 20px;
}

.heading h1,
.card strong {
  margin: 0;
}

.heading h1 {
  font-size: clamp(1.55rem, 3vw, 2rem);
}

.eyebrow {
  color: var(--primary);
  display: block;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.card,
.panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.card span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.card strong {
  color: var(--primary);
  font-size: 1.8rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toolbar.align-center {
  align-items: center;
}

.admin-chip {
  background: #eef6f2;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: #31463d;
  font-size: 0.84rem;
  font-weight: 800;
  padding: 8px 10px;
}

.alert {
  border-radius: 8px;
  font-weight: 700;
  padding: 12px 14px;
}

.alert.success {
  background: #eaf8ef;
  border: 1px solid #b8e2c7;
  color: #17603a;
}

.alert.error {
  background: #fff1f1;
  border: 1px solid #f0b5b5;
  color: #8a1d1d;
}

.panel-title {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.panel-title > div:first-child {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.panel-title span {
  background: #f1f6f3;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 5px 9px;
}

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

label {
  color: #31463d;
  display: grid;
  font-size: 0.86rem;
  font-weight: 800;
  gap: 6px;
}

.table-wrap {
  overflow-x: auto;
}

input,
select,
button {
  border-radius: 8px;
  font: inherit;
  min-height: 40px;
}

input,
select {
  border: 1px solid var(--border);
  padding: 8px 10px;
}

.button {
  background: var(--primary);
  border: 1px solid var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  padding: 8px 12px;
}

.button:not(:disabled):active {
  transform: translateY(1px);
}

.button.compact {
  min-height: 34px;
  padding: 5px 9px;
}

.button.secondary {
  background: #24577a;
  border-color: #24577a;
}

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

.button.ghost-danger {
  background: #fff;
  color: var(--danger);
}

.button.ghost {
  background: #ffffff;
  border-color: var(--border);
  color: var(--text);
}

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

.helper {
  color: var(--muted);
  font-size: 0.86rem;
  margin: -2px 0 0;
}

.row-actions,
.table-tools,
.modal-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.row-actions {
  flex-wrap: nowrap;
}

.table-tools {
  justify-content: flex-end;
}

.search-input {
  min-width: min(280px, 100%);
}

.module-checks {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.module-checks label {
  align-items: center;
  background: #f8fbf9;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  gap: 8px;
  padding: 10px;
}

.module-checks input {
  min-height: auto;
}

.status-badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  padding: 6px 8px;
  text-transform: uppercase;
}

.status-active {
  background: #e7f7ee;
  color: #17603a;
}

.status-expired,
.status-suspended,
.status-inactive {
  background: #fff1f1;
  color: #8a1d1d;
}

.status-limited,
.status-trial,
.status-pending,
.status-approved,
.status-paid {
  background: #fff8e6;
  color: #5f4600;
}

.status-activated {
  background: #e7f7ee;
  color: #17603a;
}

.status-rejected {
  background: #fff1f1;
  color: #8a1d1d;
}

.modal-backdrop {
  align-items: center;
  background: rgba(10, 28, 20, 0.62);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 18px;
  position: fixed;
  z-index: 100;
}

.modal-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(4, 24, 15, 0.3);
  display: grid;
  gap: 18px;
  max-height: calc(100vh - 36px);
  max-width: 720px;
  overflow-y: auto;
  padding: 22px;
  width: 100%;
}

.modal-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 1.3rem;
  margin: 0;
}

.icon-button {
  align-items: center;
  background: #f3f7f5;
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font-size: 1.4rem;
  justify-content: center;
  min-height: 38px;
  width: 38px;
}

.danger-callout {
  background: #fff4f4;
  border: 1px solid #efc5c5;
  border-radius: 8px;
  color: #771d1d;
  padding: 14px;
}

.danger-callout p {
  line-height: 1.5;
  margin: 6px 0 0;
}

.modal-actions {
  border-top: 1px solid var(--border);
  justify-content: flex-end;
  padding-top: 16px;
}

.key-panel {
  background: #10251c;
  border-color: #10251c;
  color: #fff;
}

.key-panel code {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #c6ffe0;
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: 0;
  padding: 14px;
}

.key-panel .muted {
  color: rgba(255, 255, 255, 0.66);
}

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

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

td:last-child {
  min-width: 150px;
}

th {
  background: #f3f8f5;
  color: #385147;
  font-size: 0.78rem;
  text-transform: uppercase;
}

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

  .side {
    min-height: auto;
    position: static;
  }

  .brand {
    margin-bottom: 14px;
  }

  .nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav button {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .main {
    padding: 16px;
  }

  .heading {
    align-items: flex-start;
    display: grid;
    gap: 12px;
  }

  .table-tools,
  .table-tools .search-input,
  .table-tools .button {
    width: 100%;
  }

  .panel-title {
    align-items: stretch;
    display: grid;
    gap: 12px;
  }
}

@media (max-width: 520px) {
  .main {
    padding: 10px;
  }

  .heading,
  .panel,
  .card {
    padding: 14px;
  }

  .heading .toolbar,
  .heading .toolbar .button {
    width: 100%;
  }

  .admin-chip {
    text-align: center;
    width: 100%;
  }

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

  .modal-card {
    border-radius: 8px;
    padding: 16px;
  }

  .modal-actions .button {
    flex: 1 1 100%;
  }
}
