* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    Arial,
    Helvetica,
    sans-serif;
  background: #f5f7fb;
  color: #182033;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  background: #111827;
  color: white;
  padding: 16px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar h2 {
  margin: 0;
  font-size: 20px;
}

.container {
  width: min(1150px, 94%);
  margin: 28px auto;
}

.card {
  background: white;
  border-radius: 14px;
  padding: 20px;
  box-shadow:
    0 4px 20px
    rgba(0,0,0,.06);
  margin-bottom: 20px;
}

.stats {
  display: grid;
  grid-template-columns:
    repeat(4, 1fr);
  gap: 14px;
}

.stat {
  background: white;
  padding: 20px;
  border-radius: 14px;
  box-shadow:
    0 4px 20px
    rgba(0,0,0,.05);
}

.stat b {
  font-size: 25px;
  display: block;
  margin-top: 8px;
}

.btn {
  display: inline-block;
  border: 0;
  border-radius: 9px;
  padding: 11px 16px;
  background: #2563eb;
  color: white;
  cursor: pointer;
  font-size: 14px;
}

.btn-danger {
  background: #dc2626;
}

.btn-dark {
  background: #111827;
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border:
    1px solid #d8deea;
  border-radius: 8px;
  margin-top: 6px;
  margin-bottom: 14px;
  font-size: 14px;
}

label {
  font-weight: 600;
  font-size: 14px;
}

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

th,
td {
  padding: 12px 10px;
  border-bottom:
    1px solid #e7eaf0;
  text-align: left;
  font-size: 14px;
}

.code {
  background: #f0f3f8;
  padding: 8px 10px;
  border-radius: 7px;
  word-break: break-all;
  font-family: monospace;
}

.badge {
  padding: 5px 9px;
  border-radius: 99px;
  background: #eef2ff;
  font-size: 12px;
  font-weight: bold;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: min(420px, 92%);
}

.error {
  background: #fee2e2;
  color: #991b1b;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 15px;
}

@media(max-width:700px) {
  .stats {
    grid-template-columns:
      repeat(2, 1fr);
  }

  table {
    display: block;
    overflow-x: auto;
  }
}

body {
  min-height: 100vh;
}

.topbar small {
  color: #aeb8cc;
}

.hero-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 4px 22px rgba(0,0,0,.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.hero-card h1 {
  margin: 0 0 8px;
  font-size: 27px;
}

.hero-card p {
  margin: 0;
  color: #6b7280;
}

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

.section-head h3 {
  margin: 0 0 5px;
}

.muted {
  color: #6b7280;
  font-size: 13px;
}

.copy-row {
  display: flex;
  gap: 9px;
  align-items: stretch;
  margin-bottom: 16px;
}

.copy-row .code {
  flex: 1;
}

.copy-btn {
  flex-shrink: 0;
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}

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

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

.search-box {
  width: min(330px, 100%);
  margin: 0;
}

.mini-btn {
  border: 0;
  padding: 7px 10px;
  border-radius: 7px;
  cursor: pointer;
  background: #2563eb;
  color: white;
  font-size: 12px;
}

.danger-btn {
  background: #dc2626;
}

.warning-btn,
.btn-warning {
  background: #d97706;
}

.success-btn {
  background: #059669;
}

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

.status-unused {
  background: #e5e7eb;
  color: #374151;
}

.status-active {
  background: #dcfce7;
  color: #166534;
}

.status-expired {
  background: #fef3c7;
  color: #92400e;
}

.status-disabled {
  background: #fee2e2;
  color: #991b1b;
}

.license-key-cell {
  min-width: 180px;
  margin-bottom: 5px;
}

.empty-state {
  text-align: center;
  padding: 35px 15px;
  color: #6b7280;
}

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

@media(max-width: 760px) {
  .hero-card,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

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

  .stats {
    grid-template-columns: repeat(2,1fr);
  }

  .copy-row {
    flex-direction: column;
  }

  .copy-row .btn {
    width: 100%;
  }
}

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

  .container {
    width: 94%;
    margin-top: 18px;
  }

  .card,
  .hero-card {
    padding: 16px;
  }
}

.success-box {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
  font-weight: 600;
}

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

.integration-export {
  margin-top: 24px;
  padding: 18px;
  border: 1px solid #e3e8f2;
  border-radius: 12px;
  background: #f8fafc;
}

.integration-title h3 {
  margin: 0 0 6px;
}

.integration-output {
  width: 100%;
  min-height: 430px;
  margin-top: 12px;
  margin-bottom: 12px;
  padding: 15px;
  border: 1px solid #d8deea;
  border-radius: 10px;
  background: #111827;
  color: #e5e7eb;
  font-family: monospace;
  font-size: 12px;
  line-height: 1.55;
  resize: vertical;
  white-space: pre;
  overflow: auto;
}

.copy-status {
  display: inline-block;
  margin-left: 10px;
  color: #15803d;
  font-size: 13px;
  font-weight: 600;
}

@media(max-width:700px) {
  .integration-output {
    min-height: 360px;
    font-size: 11px;
  }

  .integration-export .btn {
    width: 100%;
  }

  .copy-status {
    display: block;
    margin: 8px 0 0;
    text-align: center;
  }
}

.guide-editor {
  min-height: 360px;
  font-family: monospace;
  font-size: 13px;
  line-height: 1.55;
  background: #f8fafc;
}

@media(max-width:700px) {
  .guide-editor {
    min-height: 300px;
    font-size: 12px;
  }
}

.license-copy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

@media(max-width:700px) {
  .license-key-cell {
    min-width: 155px;
  }

  .mini-btn {
    margin-top: 3px;
  }
}

input[type="file"] {
  background: #f8fafc;
  cursor: pointer;
}

hr {
  border-color: #e5e7eb;
}
