:root {
  color-scheme: dark;

  --background: #070a11;
  --background-soft: #0b101b;
  --surface: rgba(15, 21, 34, 0.94);
  --surface-solid: #101725;
  --surface-raised: #151e30;
  --surface-hover: #1a253a;

  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text: #f5f7ff;
  --text-soft: #b7c0d5;
  --text-muted: #7f8ba5;

  --primary: #7c9cff;
  --primary-bright: #a2b8ff;
  --primary-dark: #5375e6;
  --primary-soft: rgba(124, 156, 255, 0.14);

  --success: #5dd6a5;
  --success-soft: rgba(93, 214, 165, 0.14);

  --warning: #f4c667;
  --warning-soft: rgba(244, 198, 103, 0.14);

  --danger: #ff7587;
  --danger-soft: rgba(255, 117, 135, 0.14);

  --shadow:
    0 28px 80px rgba(0, 0, 0, 0.46);

  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  background: var(--background);
  color: var(--text);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;

  background:
    radial-gradient(
      circle at 15% 0%,
      rgba(77, 106, 199, 0.24),
      transparent 35%
    ),
    radial-gradient(
      circle at 100% 15%,
      rgba(100, 76, 188, 0.16),
      transparent 30%
    ),
    var(--background);

  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

button,
input[type="radio"] {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

[hidden] {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.login-view {
  min-height: 100vh;

  display: grid;
  place-items: center;

  padding: 28px;
}

.login-card {
  width: min(100%, 480px);

  padding: 38px;

  border: 1px solid var(--border);
  border-radius: 26px;

  background:
    linear-gradient(
      145deg,
      rgba(21, 30, 48, 0.98),
      rgba(10, 15, 26, 0.98)
    );

  box-shadow: var(--shadow);

  backdrop-filter: blur(18px);
}

.brand-mark {
  width: 62px;
  height: 62px;

  display: grid;
  place-items: center;

  margin-bottom: 24px;

  border: 1px solid
    rgba(157, 181, 255, 0.3);

  border-radius: 18px;

  background:
    linear-gradient(
      145deg,
      #8aa6ff,
      #536fd2
    );

  color: #07101f;

  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.04em;

  box-shadow:
    0 16px 35px
    rgba(77, 108, 213, 0.3);
}

.brand-mark-small {
  width: 48px;
  height: 48px;

  margin: 0;

  border-radius: 14px;

  font-size: 16px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;

  color: var(--primary-bright);

  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  color: var(--text);
}

h1 {
  margin: 0;

  font-size:
    clamp(30px, 5vw, 46px);

  line-height: 1.05;
  letter-spacing: -0.045em;
}

h2 {
  margin: 0;

  font-size:
    clamp(25px, 4vw, 34px);

  line-height: 1.1;
  letter-spacing: -0.035em;
}

h3 {
  margin: 0;

  font-size: 20px;
}

.login-description {
  margin: 18px 0 28px;

  color: var(--text-soft);
  line-height: 1.65;
}

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

label,
legend {
  color: var(--text-soft);

  font-size: 14px;
  font-weight: 650;
}

.secret-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input[type="text"],
input[type="password"],
input[type="search"] {
  width: 100%;
  min-width: 0;
  height: 48px;

  padding: 0 15px;

  border: 1px solid var(--border);
  border-radius: 13px;

  outline: none;

  background: rgba(5, 9, 17, 0.68);
  color: var(--text);

  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

input::placeholder {
  color: #66728a;
}

input:hover {
  border-color: var(--border-strong);
}

input:focus-visible {
  border-color: var(--primary);

  background: rgba(8, 13, 24, 0.94);

  box-shadow:
    0 0 0 4px
    rgba(124, 156, 255, 0.13);
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.icon-button,
.nav-button,
.table-action {
  min-height: 42px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  padding: 0 16px;

  border: 1px solid transparent;
  border-radius: 12px;

  font-size: 14px;
  font-weight: 750;

  transition:
    transform 150ms ease,
    background 150ms ease,
    border-color 150ms ease,
    color 150ms ease;
}

.primary-button {
  background:
    linear-gradient(
      135deg,
      var(--primary),
      var(--primary-dark)
    );

  color: #07101f;

  box-shadow:
    0 12px 28px
    rgba(83, 117, 230, 0.25);
}

.primary-button:hover:not(:disabled) {
  transform: translateY(-1px);

  background:
    linear-gradient(
      135deg,
      var(--primary-bright),
      var(--primary)
    );
}

.secondary-button,
.icon-button {
  border-color: var(--border);

  background: var(--surface-raised);
  color: var(--text);
}

.secondary-button:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.ghost-button {
  background: transparent;
  color: var(--text-soft);
}

.ghost-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.danger-button {
  background: var(--danger);
  color: #26070d;
}

.danger-button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #ff94a2;
}

.icon-button {
  min-width: 84px;
}

.login-form .primary-button {
  width: 100%;
  margin-top: 6px;
}

.compact-button {
  min-height: 42px;
  white-space: nowrap;
}

.form-error {
  margin: 0;
  padding: 11px 13px;

  border: 1px solid
    rgba(255, 117, 135, 0.25);

  border-radius: 11px;

  background: var(--danger-soft);
  color: #ffacb7;

  font-size: 13px;
  line-height: 1.5;
}

.security-note {
  margin: 22px 0 0;

  color: var(--text-muted);

  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.notification {
  position: fixed;
  z-index: 1000;

  top: 20px;
  right: 20px;

  width: min(
    calc(100vw - 40px),
    390px
  );

  padding: 14px 16px;

  border: 1px solid var(--border-strong);
  border-radius: 14px;

  background: rgba(18, 27, 43, 0.98);
  color: var(--text);

  box-shadow:
    0 20px 50px
    rgba(0, 0, 0, 0.4);

  line-height: 1.45;
}

.notification.success {
  border-color:
    rgba(93, 214, 165, 0.35);

  background:
    rgba(18, 54, 45, 0.98);
}

.notification.error {
  border-color:
    rgba(255, 117, 135, 0.35);

  background:
    rgba(60, 22, 31, 0.98);
}

.dashboard-view {
  min-height: 100vh;
}

.topbar {
  min-height: 82px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;

  padding: 16px 28px;

  border-bottom: 1px solid var(--border);

  background:
    rgba(8, 12, 21, 0.88);

  backdrop-filter: blur(18px);
}

.topbar-brand,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar h1 {
  font-size: 22px;
}

.topbar .eyebrow {
  margin-bottom: 3px;
}

.status-badge,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 28px;

  padding: 4px 10px;

  border: 1px solid var(--border);
  border-radius: 999px;

  background: var(--surface-raised);
  color: var(--text-soft);

  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.status-badge {
  border-color:
    rgba(93, 214, 165, 0.24);

  background: var(--success-soft);
  color: #8beac4;
}

.badge.success,
.badge.active {
  border-color:
    rgba(93, 214, 165, 0.25);

  background: var(--success-soft);
  color: #8beac4;
}

.badge.warning,
.badge.pending {
  border-color:
    rgba(244, 198, 103, 0.25);

  background: var(--warning-soft);
  color: #f7d88f;
}

.badge.danger,
.badge.revoked,
.badge.deleted {
  border-color:
    rgba(255, 117, 135, 0.25);

  background: var(--danger-soft);
  color: #ffabb6;
}

.dashboard-grid {
  min-height:
    calc(100vh - 82px);

  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;

  padding: 22px 16px;

  border-right: 1px solid var(--border);

  background:
    rgba(9, 14, 24, 0.72);
}

.nav-button {
  justify-content: flex-start;

  width: 100%;

  background: transparent;
  color: var(--text-soft);
}

.nav-button:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.nav-button.active {
  border-color:
    rgba(124, 156, 255, 0.18);

  background: var(--primary-soft);
  color: var(--primary-bright);
}

.content-area {
  min-width: 0;
  padding: 30px;
}

.content-section {
  width: min(100%, 1260px);
  margin: 0 auto;
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;

  margin-bottom: 24px;
}

.section-header p:not(.section-kicker) {
  max-width: 660px;
  margin: 10px 0 0;

  color: var(--text-soft);
  line-height: 1.55;
}

.search-form {
  display: grid;
  grid-template-columns:
    minmax(220px, 1fr)
    auto
    auto;

  gap: 10px;

  margin-bottom: 18px;
}

.loading-state,
.empty-state {
  padding: 42px 20px;

  border: 1px dashed var(--border-strong);
  border-radius: 16px;

  background: rgba(14, 20, 32, 0.55);
  color: var(--text-muted);

  text-align: center;
}

.table-wrapper {
  overflow-x: auto;

  border: 1px solid var(--border);
  border-radius: 17px;

  background: var(--surface);
  box-shadow:
    0 18px 50px
    rgba(0, 0, 0, 0.18);
}

.licenses-table {
  width: 100%;
  min-width: 940px;

  border-collapse: collapse;
}

.licenses-table th,
.licenses-table td {
  padding: 16px;

  border-bottom: 1px solid var(--border);

  text-align: left;
  vertical-align: middle;
}

.licenses-table th {
  color: var(--text-muted);

  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.licenses-table td {
  color: var(--text-soft);
  font-size: 14px;
}

.licenses-table tbody tr {
  transition: background 140ms ease;
}

.licenses-table tbody tr:hover {
  background:
    rgba(255, 255, 255, 0.025);
}

.licenses-table tbody tr:last-child td {
  border-bottom: 0;
}

.license-client {
  display: grid;
  gap: 4px;
}

.license-client strong {
  color: var(--text);
}

.license-id {
  color: var(--text-muted);

  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    monospace;

  font-size: 11px;
}

.device-state {
  display: grid;
  gap: 3px;
}

.device-state small {
  color: var(--text-muted);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.table-action {
  min-height: 34px;

  padding: 0 10px;

  border-color: var(--border);

  background: var(--surface-raised);
  color: var(--text-soft);

  font-size: 12px;
}

.table-action:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  color: var(--text);
}

.table-action.danger {
  color: #ff9ba8;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;

  margin-top: 18px;
}

#pagination-status {
  color: var(--text-muted);
  font-size: 13px;
}

.management-form {
  width: min(100%, 680px);

  display: grid;
  gap: 24px;

  padding: 26px;

  border: 1px solid var(--border);
  border-radius: 18px;

  background: var(--surface);
}

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

fieldset.form-group {
  min-width: 0;
  margin: 0;
  padding: 0;

  border: 0;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 13px;

  padding: 15px;

  border: 1px solid var(--border);
  border-radius: 14px;

  background: rgba(7, 11, 20, 0.44);

  transition:
    border-color 150ms ease,
    background 150ms ease;
}

.radio-option:hover {
  border-color: var(--border-strong);
  background: rgba(16, 24, 39, 0.8);
}

.radio-option:has(input:checked) {
  border-color:
    rgba(124, 156, 255, 0.42);

  background: var(--primary-soft);
}

.radio-option input {
  width: 18px;
  height: 18px;

  accent-color: var(--primary);
}

.radio-option span {
  display: grid;
  gap: 3px;
}

.radio-option strong {
  color: var(--text);
}

.radio-option small {
  color: var(--text-muted);
}

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

.license-result {
  width: min(100%, 680px);

  margin-top: 22px;
  padding: 24px;

  border: 1px solid
    rgba(93, 214, 165, 0.25);

  border-radius: 18px;

  background:
    rgba(25, 60, 50, 0.42);
}

.license-result h3 {
  margin-bottom: 16px;
}

.license-code-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.license-code-row code {
  min-width: 0;

  display: flex;
  align-items: center;

  padding: 14px 16px;

  border: 1px solid var(--border);
  border-radius: 12px;

  background: rgba(4, 9, 14, 0.68);
  color: #a9f1d5;

  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    monospace;

  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.08em;

  overflow-wrap: anywhere;
}

dialog {
  width: min(
    calc(100vw - 32px),
    510px
  );

  padding: 0;

  border: 1px solid var(--border-strong);
  border-radius: 20px;

  background: transparent;
  color: var(--text);

  box-shadow: var(--shadow);
}

dialog::backdrop {
  background:
    rgba(2, 5, 10, 0.78);

  backdrop-filter: blur(6px);
}

.dialog-card {
  padding: 26px;

  background:
    linear-gradient(
      145deg,
      #172033,
      #0d1422
    );
}

.dialog-card p:not(.section-kicker) {
  margin: 14px 0 0;

  color: var(--text-soft);
  line-height: 1.6;
}

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

  margin-top: 24px;
}

.spinner {
  width: 18px;
  height: 18px;

  border: 2px solid
    rgba(255, 255, 255, 0.25);

  border-top-color: currentColor;
  border-radius: 50%;

  animation:
    spinner-rotation 700ms linear infinite;
}

.visually-hidden {
  position: absolute;

  width: 1px;
  height: 1px;

  padding: 0;
  margin: -1px;

  overflow: hidden;
  clip: rect(0 0 0 0);

  white-space: nowrap;
  border: 0;
}

@keyframes spinner-rotation {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;

    padding:
      16px 18px;
  }

  .topbar-actions {
    align-items: flex-end;
    flex-direction: column;
  }

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

  .sidebar {
    position: sticky;
    z-index: 20;
    top: 0;

    flex-direction: row;

    padding: 10px 14px;

    overflow-x: auto;

    border-right: 0;
    border-bottom: 1px solid var(--border);

    background:
      rgba(8, 13, 22, 0.96);

    backdrop-filter: blur(16px);
  }

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

  .content-area {
    padding: 24px 18px;
  }
}

@media (max-width: 640px) {
  .login-view {
    padding: 16px;
  }

  .login-card {
    padding: 26px 20px;
    border-radius: 21px;
  }

  .secret-field {
    grid-template-columns: 1fr;
  }

  .icon-button {
    width: 100%;
  }

  .topbar {
    flex-direction: column;
    gap: 15px;
  }

  .topbar-actions {
    width: 100%;

    align-items: center;
    flex-direction: row;
    justify-content: space-between;
  }

  .section-header {
    align-items: stretch;
    flex-direction: column;
  }

  .compact-button {
    width: 100%;
  }

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

  .search-form input {
    grid-column: 1 / -1;
  }

  .pagination {
    justify-content: space-between;
  }

  .management-form {
    padding: 20px 16px;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .form-actions button {
    width: 100%;
  }

  .license-code-row {
    grid-template-columns: 1fr;
  }

  .license-code-row button {
    width: 100%;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions button {
    width: 100%;
  }

  .notification {
    top: 12px;
    right: 12px;

    width:
      calc(100vw - 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;

    animation-duration:
      0.01ms !important;

    animation-iteration-count:
      1 !important;

    transition-duration:
      0.01ms !important;
  }
}
