:root {
  color: #edf4f0;
  background: #07100d;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(53, 213, 134, 0.16), transparent 30%),
    radial-gradient(circle at 90% 75%, rgba(26, 128, 255, 0.12), transparent 32%),
    #07100d;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  color: #04100b;
  background: #51e59c;
  font-weight: 800;
  cursor: pointer;
}

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

button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.shell {
  width: min(1400px, calc(100% - 36px));
  margin: 0 auto;
  padding: 40px 0 64px;
}

.login-card {
  width: min(460px, 100%);
  margin: 10vh auto 0;
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  background: rgba(13, 28, 22, 0.92);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(18px);
}

.brand-mark {
  display: grid;
  width: 52px;
  height: 52px;
  margin-bottom: 28px;
  place-items: center;
  border-radius: 16px;
  color: #06120d;
  background: #51e59c;
  font-weight: 900;
}

.eyebrow {
  margin: 0 0 8px;
  color: #51e59c;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(32px, 5vw, 56px);
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 0;
  font-size: 24px;
}

.muted {
  color: #8fa59a;
  line-height: 1.65;
}

.login-card form {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

label {
  display: grid;
  gap: 8px;
  color: #b9c9c1;
  font-size: 13px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  outline: 0;
  padding: 12px 14px;
  color: #edf4f0;
  background: #091510;
}

input:focus,
textarea:focus {
  border-color: #51e59c;
  box-shadow: 0 0 0 3px rgba(81, 229, 156, 0.1);
}

small {
  color: #748b80;
  font-weight: 500;
}

.error {
  min-height: 22px;
  margin: 14px 0 0;
  color: #ff8585;
}

.back-link {
  display: inline-block;
  margin-top: 14px;
  color: #90ad9f;
}

.topbar,
.section-title,
.topbar-actions,
.dialog-head,
.dialog-actions,
.row-actions {
  display: flex;
  align-items: center;
}

.topbar,
.section-title,
.dialog-head {
  justify-content: space-between;
}

.topbar {
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 30px;
}

.topbar-actions,
.dialog-actions,
.row-actions {
  gap: 10px;
}

.secondary,
.ghost,
.mini,
.icon-button {
  color: #dce9e2;
  background: rgba(255, 255, 255, 0.08);
}

.ghost {
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: transparent;
}

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

.stats article,
.panel {
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(12, 26, 20, 0.82);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.18);
}

.stats article {
  padding: 22px;
  border-radius: 18px;
}

.stats span {
  display: block;
  margin-bottom: 10px;
  color: #84998f;
  font-size: 13px;
}

.stats strong {
  font-size: 32px;
}

.panel {
  margin-top: 18px;
  padding: 24px;
  border-radius: 22px;
}

.create-form {
  display: grid;
  grid-template-columns:
    minmax(150px, 0.8fr)
    minmax(220px, 1.15fr)
    minmax(140px, 0.5fr)
    minmax(190px, 1fr)
    auto;
  gap: 14px;
  align-items: start;
  margin-top: 22px;
}

.create-form > button {
  min-height: 44px;
  margin-top: 25px;
  white-space: nowrap;
}

.create-form input {
  min-height: 44px;
}

.table-wrap {
  margin-top: 20px;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
}

th,
td {
  padding: 15px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  text-align: left;
  vertical-align: middle;
}

th {
  color: #7f948a;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td {
  color: #c9d7d0;
  font-size: 13px;
}

td strong,
td small {
  display: block;
}

td small {
  max-width: 210px;
  margin-top: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prefix {
  color: #9ae8bf;
  font-size: 12px;
}

.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 800;
}

.badge.active {
  color: #69e8a7;
  background: rgba(55, 209, 130, 0.12);
}

.badge.disabled {
  color: #a7b1ac;
  background: rgba(255, 255, 255, 0.07);
}

.mini {
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 11px;
  white-space: nowrap;
}

.mini.danger {
  color: #ff9999;
  background: rgba(255, 91, 91, 0.11);
}

.mini.delete {
  color: #ff7d7d;
  border: 1px solid rgba(255, 88, 88, 0.2);
  background: rgba(255, 66, 66, 0.08);
}

.mini.delete:hover {
  color: #fff;
  background: #d94141;
}

.mini.success {
  color: #7becb1;
  background: rgba(55, 209, 130, 0.11);
}

.empty {
  padding: 44px;
  color: #81968c;
  text-align: center;
}

dialog {
  width: min(520px, calc(100% - 28px));
  border: 0;
  padding: 0;
  color: #edf4f0;
  border-radius: 22px;
  background: #0d1d16;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.6);
}

dialog::backdrop {
  background: rgba(0, 6, 4, 0.78);
  backdrop-filter: blur(8px);
}

.dialog-card {
  display: grid;
  gap: 18px;
  padding: 26px;
}

.dialog-head {
  align-items: flex-start;
}

.icon-button {
  padding: 2px 10px 7px;
  border-radius: 10px;
  font-size: 28px;
  line-height: 1;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 6px;
}

.warning {
  margin-bottom: 0;
  border: 1px solid rgba(255, 187, 72, 0.24);
  border-radius: 12px;
  padding: 12px;
  color: #ffd28a;
  background: rgba(255, 166, 34, 0.08);
  line-height: 1.55;
}

#generatedKey {
  display: block;
  overflow-wrap: anywhere;
  border: 1px solid rgba(81, 229, 156, 0.24);
  border-radius: 14px;
  padding: 18px;
  color: #aaf0ca;
  background: #07110d;
  font-size: 14px;
  line-height: 1.7;
  user-select: all;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(380px, calc(100% - 48px));
  border: 1px solid rgba(81, 229, 156, 0.25);
  border-radius: 12px;
  padding: 13px 16px;
  color: #c9f7df;
  background: #10251b;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.4);
}

.toast.error-toast {
  border-color: rgba(255, 107, 107, 0.3);
  color: #ffb2b2;
  background: #291313;
}

[hidden] {
  display: none !important;
}

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

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

@media (max-width: 640px) {
  .shell {
    width: min(100% - 22px, 1400px);
    padding-top: 22px;
  }

  .login-card,
  .panel {
    padding: 20px;
  }

  .topbar,
  .section-title {
    display: grid;
    gap: 14px;
  }

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

  .create-form > button {
    margin-top: 0;
  }

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