body {
  font-family: 'Roboto', sans-serif;
  background-color: #080808;
  color: #f8fafc;
}

h1, h2, h3, h4, h5, h6, .font-heading {
  font-family: 'Montserrat', sans-serif;
}

p, span, label, input, select, .font-body {
  font-family: 'Roboto', sans-serif;
}

.font-mono {
  font-family: 'JetBrains Mono', monospace;
}

.glow-yellow {
  box-shadow: 0 0 25px -4px rgba(255, 204, 0, 0.35);
}

.glass-panel {
  background: rgba(18, 18, 18, 0.90);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #080808;
}
::-webkit-scrollbar-thumb {
  background: #2a2a2a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #ffcc00;
}

.audit-table {
  border-collapse: separate;
  border-spacing: 0;
}

.serial-column.is-hidden {
  display: none !important;
}

.serial-select-column {
  display: none;
}

.serial-select-column.is-visible {
  display: table-cell;
}

.device-serial-list {
  display: flex;
  min-width: 12rem;
  flex-direction: column;
  gap: 0.35rem;
  white-space: normal;
  line-height: 1.5;
}

.device-serial-entry {
  display: block;
  overflow-wrap: anywhere;
}

.device-serial-entry b {
  color: #ffcc00;
  font-weight: 600;
}

.mobile-header-content,
.mobile-header-left,
.mobile-header-right,
.mobile-number,
.mobile-status,
.mobile-chevron {
  display: none;
}

.desktop-number {
  display: block;
}

.desktop-serial-number {
  display: inline;
}

.audit-table th,
.audit-table td {
  vertical-align: top;
}

.audit-row {
  transition: background 0.2s ease;
}

.audit-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

.serial-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.mobile-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  background: rgba(255, 204, 0, 0.08);
  border: 1px solid rgba(255, 204, 0, 0.15);
  color: #ffcc00;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mobile-toggle:hover {
  background: rgba(255, 204, 0, 0.16);
  transform: translateY(-1px);
}

.mobile-toggle.is-open {
  background: rgba(255, 204, 0, 0.18);
  border-color: rgba(255, 204, 0, 0.35);
  box-shadow: 0 0 12px rgba(255, 204, 0, 0.14);
}

.mobile-toggle i {
  transition: transform 0.2s ease;
  transform-origin: center;
  transform: rotate(0deg);
}

.mobile-toggle.is-open i {
  transform: rotate(180deg);
}

.audit-detail-row {
  display: none;
}

.audit-row.expanded + .audit-detail-row {
  display: table-row;
}

.audit-detail-row.hidden {
  display: none !important;
}

.audit-detail-row td {
  padding-top: 0;
}

.audit-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 0.75rem 0 0.35rem;
}

.detail-box {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 0.85rem;
  padding: 0.7rem 0.8rem;
}

.detail-box .label {
  color: #6b7280;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: 'Montserrat', sans-serif;
}

.detail-box .value {
  color: #f8fafc;
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  word-break: break-word;
}

.generation-table {
  border-collapse: separate;
  border-spacing: 0;
}

.generation-detail-row.hidden {
  display: none;
}

.generation-detail-row pre {
  font-family: 'JetBrains Mono', monospace;
}

@media (max-width: 639px) {
  .audit-table thead,
  .user-table thead {
    display: none;
  }

  .audit-table,
  .audit-table tbody,
  .audit-table tr,
  .audit-table td,
  .user-table,
  .user-table tbody,
  .user-table tr,
  .user-table td {
    display: block;
    width: 100%;
  }

  .audit-table tbody,
  .user-table tbody {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .audit-table tr,
  .user-table tr {
    background: rgba(16, 16, 16, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    overflow: hidden;
  }

  .audit-table td {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-width: 0;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    overflow-wrap: anywhere;
    text-align: right;
  }

  .audit-table td.serial-select-column.is-visible {
    display: flex;
    justify-content: center;
    text-align: center;
  }

  .user-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-width: 0;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    overflow-wrap: anywhere;
    text-align: right;
  }

  .audit-row td[data-label="No"],
  .audit-row td[data-label="Serial Number"],
  .audit-row td[data-label="Generation"],
  .audit-row td[data-label="Product"] {
    display: flex;
  }

  .audit-row td.serial-column.is-hidden {
    display: none !important;
  }

  .audit-row td.mobile-header {
    cursor: pointer;
    padding: 0.75rem 1rem;
    background: rgba(255, 204, 0, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .audit-row td.mobile-header:hover {
    background: rgba(255, 204, 0, 0.06);
  }

  .desktop-number {
    display: none;
  }

  .desktop-serial-number {
    display: none;
  }

  .mobile-header-content {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.75rem;
  }

  .mobile-header-left {
    display: flex !important;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
  }

  .mobile-number {
    display: block !important;
    font-weight: 600;
    color: #9ca3af;
    font-size: 0.75rem;
    flex-shrink: 0;
  }

  .mobile-header-right {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
  }

  .mobile-chevron {
    display: block !important;
    color: #ffcc00;
    transition: transform 0.2s ease;
    font-size: 0.75rem;
  }

  .mobile-chevron.is-open {
    transform: rotate(180deg);
  }

  .audit-row.expanded td {
    display: flex;
  }

  .audit-table td:last-child,
  .user-table td:last-child {
    border-bottom: none;
  }

  .audit-table td::before,
  .user-table td::before {
    flex-shrink: 0;
    color: #6b7280;
    content: attr(data-label);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-align: left;
    text-transform: uppercase;
  }

  .audit-table .serial-summary {
    width: 100%;
    align-items: center;
    justify-content: space-between;
  }

  .mobile-toggle {
    display: inline-flex;
  }

  .audit-row {
    margin: 0;
  }

  .audit-row + .audit-detail-row {
    display: none !important;
  }

  .audit-detail-row {
    display: none !important;
  }
}

.login-exit {
  animation: login-card-exit 0.55s ease forwards;
}

.login-enter {
  animation: login-screen-enter 0.45s ease forwards;
  pointer-events: auto;
}

.login-progress {
  animation: login-progress 0.8s ease forwards;
  transform-origin: left;
  transform: scaleX(0);
}

.logout-exit {
  animation: logout-exit 0.35s ease forwards;
}

@keyframes login-card-exit {
  to {
    opacity: 0;
    transform: scale(0.96) translateY(-12px);
  }
}

@keyframes login-screen-enter {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes login-progress {
  to {
    transform: scaleX(1);
  }
}

@keyframes logout-exit {
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

.serial-filter-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.75fr) minmax(0, 2fr) auto;
  align-items: start;
  gap: 1.25rem;
}

.serial-filter-control {
  height: 2.75rem;
  min-height: 2.75rem;
  border-radius: 9999px;
  padding: 0.5rem 1rem;
  box-sizing: border-box;
  width: 100%;
}

input[type="date"].serial-filter-control {
  padding-right: 0.75rem;
}

input[type="date"].serial-filter-control::-webkit-calendar-picker-indicator {
  cursor: pointer;
  filter: invert(0.8);
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

input[type="date"].serial-filter-control::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

.serial-filter-submit {
  display: flex;
  flex-direction: column;
}

@media (max-width: 1023px) {
  .serial-filter-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  .serial-filter-submit button {
    width: 100%;
  }
}

:root { color-scheme: dark; }
html.dark select,
html.dark option {
  color: #f8fafc;
  background-color: #080808;
}

html.light { color-scheme: light; }

html.light body,
html.light #authPage,
html.light #loginTransition,
html.light .h-screen {
  background-color: #f5f5f5 !important;
  color: #171717;
}

.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 70;
  display: inline-flex;
  width: 2.5rem;
  height: 2.5rem;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 204, 0, 0.45);
  border-radius: 9999px;
  background: #ffcc00;
  color: #111;
  cursor: pointer;
  transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

.theme-toggle:hover {
  transform: rotate(18deg) scale(1.08);
  background: #e6b800;
  box-shadow: 0 0 22px rgba(255, 204, 0, 0.35);
}

.theme-toggle:active { transform: rotate(18deg) scale(0.94); }

body:has(#dashboardShell) .theme-toggle { top: 0.35rem; }

html.light .glass-panel,
html.light .bg-octagon-900 {
  background: #fff !important;
  border-color: rgba(23, 23, 23, 0.12) !important;
}

html.light .bg-octagon-950 { background-color: #f5f5f5 !important; }
html.light .bg-octagon-800,
html.light .bg-octagon-700 { background-color: #fff !important; }

html.light .text-white,
html.light .text-gray-100,
html.light .text-gray-200,
html.light .text-gray-300 { color: #171717 !important; }

html.light .text-gray-400,
html.light .text-gray-500 { color: #626262 !important; }

html.light .border-white\/10,
html.light .border-white\/15,
html.light .border-white\/20,
html.light .border-white\/25 { border-color: rgba(23, 23, 23, 0.14) !important; }

html.light input,
html.light select,
html.light textarea {
  color: #171717 !important;
  background-color: #fff !important;
}

html.light input::placeholder,
html.light textarea::placeholder { color: #8a8a8a; }

html.light .audit-row:hover { background: rgba(23, 23, 23, 0.035); }

html.light .generation-detail-row > td { background-color: #f5f5f5 !important; }
html.light .generation-detail-panel {
  background-color: #fff !important;
  border-color: rgba(23, 23, 23, 0.12) !important;
}
html.light .generation-detail-panel .text-gray-500,
html.light .generation-detail-panel .text-gray-400 { color: #626262 !important; }

html.light .audit-table thead,
html.light .user-table thead { background: #f5f5f5 !important; }

html.light .generation-table {
  color: #343434 !important;
}

html.light .generation-table thead {
  background: #f1f3f5 !important;
  color: #4b5563 !important;
  border-color: rgba(23, 23, 23, 0.16) !important;
}

html.light .generation-table tbody tr.generation-row {
  background: #fff;
  border-color: rgba(23, 23, 23, 0.1) !important;
}

html.light .generation-table tbody tr.generation-row:hover {
  background: #fffbea !important;
}

html.light .generation-table tbody td {
  border-color: rgba(23, 23, 23, 0.1) !important;
}

html.light .generation-table .text-gray-300,
html.light .generation-table .text-gray-400 {
  color: #343434 !important;
}

html.light .generation-table .text-gray-500 {
  color: #626262 !important;
}

html.light .generation-table .text-gray-600 {
  color: #6b7280 !important;
}

html.light .generation-table .text-emerald-300 {
  color: #047857 !important;
}

html.light .generation-table .text-red-300 {
  color: #b42318 !important;
}

html.light .generation-table .text-octagon-yellow {
  color: #8a6500 !important;
}

html.light .generation-table .border-white\/5,
html.light .generation-table .border-white\/10,
html.light .generation-table .border-white\/15,
html.light .generation-table .border-white\/30 {
  border-color: rgba(23, 23, 23, 0.16) !important;
}

html.light .generation-table .generation-detail-row > td {
  background-color: #f1f3f5 !important;
}

html.light .generation-table .generation-detail-panel {
  background-color: #fff !important;
  border-color: rgba(23, 23, 23, 0.16) !important;
}

html.light .generation-table .generation-detail-panel .bg-black\/30,
html.light .generation-table .generation-detail-panel .bg-black\/40 {
  background-color: #f8fafc !important;
}

html.light .generation-table .generation-detail-panel .text-gray-300,
html.light .generation-table .generation-detail-panel .serial-item {
  color: #343434 !important;
}

html.light .generation-table .bg-octagon-950 {
  background-color: #e5e7eb !important;
}

.generation-progress-bar {
  background-color: #ffcc00;
}

.generation-progress-bar.is-wiping {
  background-color: #ef4444;
}

html.light .generation-progress-bar {
  background-color: #d19f00;
}

html.light .generation-progress-bar.is-wiping {
  background-color: #dc2626;
}

html.light .generation-table .bg-octagon-yellow\/10 {
  background-color: #fff4bf !important;
  border-color: #d19f00 !important;
  color: #765700 !important;
}

html.light .generation-table button:not(:disabled):hover {
  color: #765700 !important;
}

html.light #generatorView .bg-black\/20,
html.light #generatorView .bg-black\/30,
html.light #generatorView .bg-black\/40 {
  background-color: #f5f5f5 !important;
}

html.light #generatorView details {
  background-color: #f5f5f5 !important;
}

html.light #generatorView .border-white\/5,
html.light #generatorView .border-white\/10,
html.light #generatorView .border-white\/15,
html.light #generatorView .border-white\/20,
html.light #generatorView .border-white\/25,
html.light #generatorView .border-white\/30 {
  border-color: rgba(23, 23, 23, 0.16) !important;
}

html.light #generatorView .text-gray-400,
html.light #generatorView .text-gray-300 {
  color: #343434 !important;
}

html.light #generatorView .text-gray-500 {
  color: #626262 !important;
}

html.light #generatorView button:not(.bg-octagon-yellow):hover {
  color: #765700 !important;
}

html.light .audit-table tbody td.serial-column-serial .text-octagon-yellow {
  color: #171717 !important;
}

html.light #setupSecret {
  color: #171717 !important;
}

html.light #authModal {
  background-color: #f5f5f5 !important;
}

html.light .auth-mode-pill {
  background-color: #f5f5f5 !important;
  border-color: rgba(23, 23, 23, 0.16) !important;
}

html.light .sidebar-nav-item:hover,
html.light .sidebar-nav-item:hover i,
html.light .sidebar-nav-item:hover span {
  color: #e6b800 !important;
}

html.light .sidebar-nav-item.bg-octagon-yellow\/10 {
  background-color: #ffcc00 !important;
  border: 1px solid #d19f00;
  box-shadow: 0 3px 10px rgba(173, 129, 0, 0.24);
  color: #171717 !important;
}

html.light .sidebar-nav-item.bg-octagon-yellow\/10 i,
html.light .sidebar-nav-item.bg-octagon-yellow\/10 span {
  background-color: transparent !important;
  color: #171717 !important;
}

html.light #serialSelectionToggle.bg-octagon-yellow\/10,
html.light #serialEditLimit.bg-octagon-yellow\/10,
html.light #serialResetSerials.bg-octagon-yellow\/10 {
  background-color: #ffcc00 !important;
  border-color: #d19f00 !important;
  color: #171717 !important;
  box-shadow: 0 0 0 2px rgba(255, 204, 0, 0.24), 0 4px 12px rgba(173, 129, 0, 0.2);
}

html.light #serialSelectionToggle.bg-octagon-yellow\/10 i,
html.light #serialSelectionToggle.bg-octagon-yellow\/10 span,
html.light #serialEditLimit.bg-octagon-yellow\/10 i,
html.light #serialEditLimit.bg-octagon-yellow\/10 span,
html.light #serialResetSerials.bg-octagon-yellow\/10 i,
html.light #serialResetSerials.bg-octagon-yellow\/10 span {
  color: #171717 !important;
}

.serial-item {
  white-space: nowrap;
  letter-spacing: 0.025em;
  color: #d1d5db; /* gray-300 */
}