:root {
  --bg: #060b19;
  --card: rgba(15, 23, 42, 0.65);
  --card-hover: rgba(22, 32, 58, 0.75);
  --card-border: rgba(255, 255, 255, 0.06);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --line: rgba(255, 255, 255, 0.08);
  --primary: #4f46e5;
  --primary-hover: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.25);
  --danger: #ef4444;
  --danger-hover: #f87171;
  --danger-glow: rgba(239, 68, 68, 0.2);
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.12) 0%, transparent 45%),
              radial-gradient(circle at 90% 80%, rgba(239, 68, 68, 0.07) 0%, transparent 45%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 96%;
  margin: 0 auto;
  padding: 24px;
}

/* Topbar Styling */
.topbar {
  border-bottom: 1px solid var(--card-border);
  background: rgba(6, 11, 25, 0.75);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.topbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
}

.brand__title {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #a5b4fc, #818cf8, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand__subtitle {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 2px;
}

.topbar__right {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Cards & Layout */
.card {
  border: 1px solid var(--card-border);
  background: var(--card);
  backdrop-filter: blur(16px);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.card:hover {
  background: var(--card-hover);
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4);
}

.card--subtle {
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.04);
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 14px;
}

h2 {
  margin: 0;
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

h3 {
  margin: 0;
  font-family: 'Outfit', sans-serif;
  font-size: 17px;
  font-weight: 600;
}

.statsGrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.statsGrid--6 {
  grid-template-columns: repeat(6, 1fr);
}

.statCard {
  position: relative;
  overflow: hidden;
  padding: 20px 24px;
  border-left: 4px solid var(--primary);
}

.statCard::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 70px;
  height: 70px;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(8px);
}

.statCard:nth-child(2) { border-left-color: #8b5cf6; }
.statCard:nth-child(2)::before { background: radial-gradient(circle, rgba(139, 92, 246, 0.2) 0%, transparent 70%); }
.statCard:nth-child(3) { border-left-color: #10b981; }
.statCard:nth-child(3)::before { background: radial-gradient(circle, rgba(16, 185, 129, 0.2) 0%, transparent 70%); }
.statCard:nth-child(4) { border-left-color: #f59e0b; }
.statCard:nth-child(4)::before { background: radial-gradient(circle, rgba(245, 158, 11, 0.2) 0%, transparent 70%); }

.statCard__label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.statCard__value {
  font-size: 32px;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
}

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

.span-2 {
  grid-column: span 2;
}

/* Inputs & Labels */
label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

input, select {
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  outline: none;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s ease;
  width: 100%;
}

input::placeholder {
  color: rgba(241, 245, 249, 0.3);
}

input:focus, select:focus {
  border-color: var(--primary-hover);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: rgba(0, 0, 0, 0.45);
}

.row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 16px;
  flex-wrap: wrap;
}

.search {
  min-width: 280px;
}

/* Buttons */
.btn {
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn--primary {
  background: var(--primary);
  border-color: transparent;
  color: #ffffff;
}

.btn--primary:hover {
  background: var(--primary-hover);
  border-color: transparent;
  box-shadow: 0 0 14px var(--primary-glow);
}

.btn--danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.2);
  color: var(--danger-hover);
}

.btn--danger:hover {
  background: var(--danger);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 0 14px var(--danger-glow);
}

/* Compact Icon Buttons for Table Actions */
.btn--icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 8px;
}

.btn--icon .material-symbols-outlined {
  font-size: 18px;
}

/* Pills & Badges */
.pill {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.pill--muted {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.pill--ok {
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
  background: var(--success-glow);
}

.pill--bad {
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
  background: var(--danger-glow);
}

/* Tabs Navigation */
.tabs {
  display: flex;
  gap: 4px;
  margin: 10px 0 24px 0;
  background: rgba(0, 0, 0, 0.25);
  padding: 5px;
  border-radius: 999px;
  width: fit-content;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.tab {
  padding: 8px 20px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.tab:hover {
  color: var(--text);
}

.tab.is-active {
  color: #ffffff;
  background: var(--primary);
  box-shadow: 0 4px 14px var(--primary-glow);
}

.tabpane {
  display: none;
}

.tabpane.is-active {
  display: block;
}

[hidden] {
  display: none !important;
}

/* Tables and Sizing */
.tableWrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.15);
  margin-top: 20px;
}

/* Sleek custom scrollbars for horizontal scroll */
.tableWrap::-webkit-scrollbar {
  height: 8px;
}

.tableWrap::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
}

.tableWrap::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 99px;
}

.tableWrap::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

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

thead th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 14px 16px;
  border-bottom: 2px solid var(--card-border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
  font-size: 14px;
  white-space: normal;
  word-break: break-word;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.015);
}

/* Pagination Styling */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  flex-wrap: wrap;
  gap: 12px;
}

.pagination__info {
  font-size: 13px;
  color: var(--muted);
}

.pagination__controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

.pagination__btn {
  padding: 6px 12px;
  font-size: 13px;
  min-width: 32px;
  height: 32px;
}

.pagination__btn--active {
  background: var(--primary) !important;
  color: #ffffff !important;
  border-color: transparent !important;
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* Beautiful License badge tag style */
.licenseKeyBadge {
  font-family: 'Courier New', Courier, monospace;
  font-weight: 700;
  color: #818cf8;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.25);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 13px;
  letter-spacing: 0.5px;
  display: inline-block;
}

/* Modals / Dialog */
dialog {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(10, 15, 30, 0.98);
  backdrop-filter: blur(20px);
  color: var(--text);
  width: min(850px, 94vw);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
  padding: 0;
  outline: none;
}

dialog::backdrop {
  background: rgba(3, 7, 18, 0.75);
  backdrop-filter: blur(8px);
}

.dialog {
  padding: 24px;
}

.dialog__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 14px;
  margin-bottom: 16px;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(0, 0, 0, 0.35);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  font-family: monospace;
  font-size: 13px;
  color: #a5b4fc;
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

/* Toasts and Notifications */
.toastHost {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 12px;
  z-index: 1000;
}

.toast {
  min-width: 300px;
  max-width: min(480px, calc(100vw - 40px));
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 15, 30, 0.95);
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  padding: 14px 18px;
  display: grid;
  gap: 4px;
  animation: toastIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast__title {
  font-weight: 700;
  font-size: 14px;
}

.toast__msg {
  color: var(--muted);
  font-size: 12px;
}

.toast--ok {
  border-left: 4px solid var(--success);
}

.toast--ok .toast__title {
  color: #34d399;
}

.toast--err {
  border-left: 4px solid var(--danger);
}

.toast--err .toast__title {
  color: #f87171;
}

@keyframes toastIn {
  from { transform: translateY(12px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Responsive Overrides */
@media (max-width: 1200px) {
  .statsGrid--6 {
    grid-template-columns: repeat(3, 1fr);
  }
}

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

@media (max-width: 680px) {
  .grid, .statsGrid, .statsGrid--6 {
    grid-template-columns: 1fr;
  }
  .span-2 {
    grid-column: span 1;
  }
  .topbar .container {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
}

/* Pulse animation for expiry alerts */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Loading Progress Bar */
.loadingBar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  width: 100%;
  background: linear-gradient(90deg, #4f46e5, #818cf8, #ef4444, #4f46e5);
  background-size: 200% 100%;
  animation: loadingBarAnim 1.2s linear infinite;
  z-index: 101;
}
@keyframes loadingBarAnim {
  0% { background-position: 100% 0; }
  100% { background-position: 0% 0; }
}

/* Recent Licenses Dashboard Widget */
.recent-list {
  display: grid;
  gap: 10px;
}
.recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 10px 14px;
  transition: all 0.2s ease;
}
.recent-item:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}
.recent-item__left {
  display: grid;
  gap: 3px;
}
.recent-item__key {
  font-family: monospace;
  font-weight: 700;
  color: #818cf8;
  font-size: 13px;
}
.recent-item__email {
  font-size: 11px;
  color: var(--muted);
}
.recent-item__right {
  display: grid;
  text-align: right;
  gap: 3px;
}
.recent-item__pkg {
  font-size: 12px;
  font-weight: 600;
}
.recent-item__date {
  font-size: 10px;
  color: var(--muted);
}

/* Empty States for Tables */
.emptyState {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
  display: grid;
  justify-items: center;
  gap: 8px;
}
.emptyState__icon {
  font-size: 40px;
  color: rgba(255, 255, 255, 0.12);
  margin-bottom: 4px;
}
.emptyState__text {
  font-size: 14px;
  font-weight: 500;
}

/* Workspace Split Layout (2 Columns) */
.workspace-split-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

@media (max-width: 960px) {
  .workspace-split-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* Device Usage Progress Bar Styles */
.device-usage {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 90px;
}
.device-usage__label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
}
.device-progress {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
}
.device-progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.3s ease, background-color 0.3s ease;
}
.device-progress-fill--normal {
  background: var(--success);
}
.device-progress-fill--warning {
  background: #f59e0b;
}
.device-progress-fill--danger {
  background: var(--danger);
}

/* Accordion/Tabbed panel on Left column */
.accordion-tabs {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px;
  border-radius: 8px;
  margin-bottom: 12px;
  border: 1px solid rgba(255,255,255,0.04);
}
.accordion-tab {
  flex: 1;
  padding: 6px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  text-align: center;
  transition: all 0.2s ease;
}
.accordion-tab.is-active {
  background: var(--primary);
  color: #fff;
}

.licenseKeyBadge {
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.licenseKeyBadge:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
}

/* Invoices Status Pills */
.pill--paid {
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
  background: var(--success-glow);
}
.pill--unpaid {
  border-color: rgba(245, 158, 11, 0.5);
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.15);
}
.pill--refunded {
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
  background: var(--danger-glow);
}

/* Modal Inputs & Select Layout for Dialog */
.dialog-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 16px;
}
@media (max-width: 600px) {
  .dialog-row {
    grid-template-columns: 1fr;
  }
}


