:root {
  --bg: #f2f4f7;
  --topbar: #000000;
  --text: #121826;
  --muted: #6b7280;
  --card: #ffffff;
  --stroke: rgba(17, 24, 39, 0.12);
  --stroke-strong: rgba(17, 24, 39, 0.18);
  --shadow: 0 10px 25px rgba(17, 24, 39, 0.12);
  --blue: #2246d2;
  --red: #ff0000;
  --radius: 18px;
  --content-max: 620px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Reduce font sizes across all pages */
body {
  font-size: 8px;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-weight: 300;
  background: var(--bg);
  color: var(--text);
}

.page {
  font-weight: 300;
}

.topbar {
  background: var(--topbar);
  color: #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 8px 0;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}

.topbar__inner {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 8px clamp(44px, 8vw, 52px) 8px clamp(8px, 3vw, 18px);
  position: relative;
}

.theme-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  background: #111217;
  color: #9ca3af;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.theme-toggle:active {
  transform: translateY(calc(-50% + 1px));
}

.nav {
  display: flex;
  width: 100%;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 0;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  padding-right: 6px;
}
.nav::-webkit-scrollbar {
  display: none;
}

.nav__link {
  text-decoration: none;
  color: #9ca3af;
  font-weight: 500;
  font-size: 5px;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.nav__link:hover {
  color: #d1d5db;
}

.nav__link--active {
  color: #10b981;
  background: #374151;
  font-weight: 600;
  text-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 4px;
  margin-right: 1px;
}

.nav--minimal {
  justify-content: flex-start;
  gap: 8px;
}

.topbar__accent {
  display: none;
}

.ticker {
  display: none;
  margin-bottom: 4px;
  width: 100%;
  overflow: hidden;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 4px;
}

.ticker.ticker--show {
  display: block;
}

.ticker__track {
  display: inline-flex;
  flex-wrap: nowrap;
  width: max-content;
  gap: 34px;
  color: #ff0000;
  white-space: nowrap;
  line-height: 1.35;
  text-align: left;
  animation: ticker-marquee 18s linear infinite;
  will-change: transform;
}

.ticker__segment {
  flex: 0 0 auto;
  padding-right: 3rem;
}

.ticker__track > [aria-hidden="true"] {
  display: none;
}

@keyframes ticker-marquee {
  0% {
    transform: translateX(100%);
  }
  100% {
    transform: translateX(-100%);
  }
}

.page {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 12px 14px 28px;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin: 6px 0 12px;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 10px 12px;
  box-shadow: 0 1px 0 rgba(17, 24, 39, 0.04);
  min-width: 0;
}

.search__icon {
  color: rgba(17, 24, 39, 0.55);
  flex: 0 0 auto;
}

.search__input {
  border: 0;
  outline: none;
  width: 100%;
  font-size: 14px;
  background: transparent;
  min-width: 0;
}

.actions {
  position: relative;
  justify-self: end;
  overflow: visible;
}

.actions .select {
  position: relative;
  z-index: 1;
}

/* Ensure dropdown stays within viewport */
.actions .select:focus {
  z-index: 10;
}

.btn {
  appearance: none;
  border: 1px solid var(--stroke);
  background: #fff;
  color: rgba(17, 24, 39, 0.9);
  border-radius: 999px;
  padding: 3px 6px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 6px;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(17, 24, 39, 0.04);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: all 0.12s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn__caret {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid rgba(17, 24, 39, 0.6);
}

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 6px;
}

.menu__item {
  width: 100%;
  text-align: left;
  padding: 10px 10px;
  border: 0;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: rgba(17, 24, 39, 0.88);
}

.menu__item:hover {
  background: rgba(17, 24, 39, 0.06);
}

.cards {
  display: grid;
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(17, 24, 39, 0.10);
  padding: 14px 14px 10px;
}

.card__row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
}

.meta {
  color: var(--muted);
  font-size: 12px;
  padding-top: 22px;
  white-space: nowrap;
}

.field {
  padding: 6px 0;
}

.field__label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--blue);
  font-weight: 800;
  letter-spacing: 0.01em;
}

.field__label span {
  font-size: 9px;
}

.field__value {
  margin-top: 6px;
  font-size: 7px;
  color: rgba(17, 24, 39, 0.92);
  line-height: 1.35;
  word-break: break-word;
}

.field__value--msg {
  color: var(--red);
  font-weight: 500;
}

.field__value--id {
  text-decoration: underline;
  font-weight: 600;
  color: #008000;
  cursor: pointer;
  transition: color 0.2s ease;
}

.field__value--id:hover {
  color: #006600;
}

.field--empty .field__value {
  color: rgba(17, 24, 39, 0.55);
}

.copy {
  margin-left: 2px;
  border: 0;
  background: transparent;
  color: rgba(17, 24, 39, 0.7);
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.copy:hover {
  background: rgba(17, 24, 39, 0.10);
}

.copy:active {
  transform: translateY(1px);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  padding: 10px 12px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

.dash-popup {
  position: fixed;
  left: 50%;
  top: 50%;
  bottom: auto;
  transform: translate(-50%, -50%);
  z-index: 1100;
  max-width: min(92vw, 420px);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.dash-popup--error {
  color: #fff;
  background: #ff0000;
  border: 1px solid #991b1b;
  box-shadow: 0 10px 24px rgba(153, 27, 27, 0.35);
}

.dash-popup--wait {
  width: min(92vw, 360px);
  max-width: min(92vw, 360px);
  padding: clamp(10px, 3vw, 16px);
  color: #111827;
  background: #fff;
  border: 3px solid #ff0000;
  border-radius: 18px;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.2);
  text-align: left;
}

.dash-popup--wait.dash-popup--show {
  pointer-events: auto;
}

.dash-popup-wait__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: clamp(8px, 2vw, 12px);
}

.dash-popup-wait__title {
  color: #ff0000;
  font-size: clamp(18px, 5.4vw, 26px);
  font-weight: 800;
  line-height: 1;
}

.dash-popup-wait__close {
  appearance: none;
  border: 2px solid #111827;
  border-radius: 12px;
  background: #fff;
  color: #111827;
  width: clamp(42px, 13vw, 56px);
  height: clamp(34px, 10vw, 44px);
  font-size: clamp(18px, 5vw, 24px);
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dash-popup-wait__msg {
  margin: 0;
  color: #111827;
  text-align: center;
  font-size: clamp(12px, 3.8vw, 16px);
  font-weight: 500;
  line-height: 1.4;
}

.dash-popup--success {
  color: #fff;
  background: #15803d;
  border: 1px solid #166534;
  box-shadow: 0 10px 24px rgba(22, 101, 52, 0.35);
}

.dash-popup--info {
  color: #0f172a;
  background: #e0f2fe;
  border: 1px solid #7dd3fc;
  box-shadow: 0 10px 24px rgba(14, 116, 144, 0.2);
}

.dash-popup--show {
  opacity: 1;
  transform: translate(-50%, calc(-50% - 2px));
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.select {
  appearance: none;
  border: 1px solid var(--stroke-strong);
  background: #fff;
  color: rgba(17, 24, 39, 0.9);
  border-radius: 3px;
  padding: 3px 18px 3px 6px;
  font-weight: 500;
  letter-spacing: 0.01em;
  font-size: 10px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.08);
  background-image: linear-gradient(45deg, transparent 50%, rgba(17, 24, 39, 0.65) 50%),
    linear-gradient(135deg, rgba(17, 24, 39, 0.65) 50%, transparent 50%);
  background-position: calc(100% - 7px) calc(50% + 1px), calc(100% - 4px) calc(50% + 1px);
  background-size: 3px 3px, 3px 3px;
  background-repeat: no-repeat;
  width: auto;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  display: inline-block;
}

.device-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
  justify-content: center;
}

.device-page .toolbar,
.device-page .list {
  width: min(100%, 540px);
  margin-left: auto;
  margin-right: auto;
}

.device {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(17, 24, 39, 0.10);
  padding: 6px;
  max-width: 260px;
  width: 100%;
  justify-self: center;
}

.device__head {
  padding: 1px 4px 3px;
}

.device__title {
  margin: 0;
  text-align: center;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.15;
  color: rgba(17, 24, 39, 0.92);
}

.device__title-link {
  color: inherit;
  text-decoration: none;
}

.device__title-link:active {
  opacity: 0.85;
}

.device__table {
  background: #fff;
  border: 1.2px solid rgba(17, 24, 39, 0.75);
  border-radius: 3px;
  overflow: hidden;
  margin: 0 7px;
  box-shadow: inset 0 0 0 1px #fff;
}

.drow {
  display: block;
  text-align: center;
  padding: 8px 8px;
  border-top: 1px solid rgba(17, 24, 39, 0.75);
  background: #fff;
}

.drow:first-child {
  border-top: 0;
}

.drow__cell {
  padding: 0;
  font-size: 7px;
  line-height: 1.18;
  vertical-align: top;
  display: inline;
}

.drow__cell--label {
  color: rgba(17, 24, 39, 0.9);
  font-weight: 500;
  margin-right: 4px;
}

.drow__cell--value {
  color: rgba(17, 24, 39, 0.92);
  font-weight: 600;
  text-align: center;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}

.drow__cell--online {
  color: var(--red);
  font-weight: 700;
}

.device__footer {
  display: grid;
  place-items: center;
  padding: 5px 4px 0;
}

.btn-outline {
  appearance: none;
  border: 1.5px solid rgba(17, 24, 39, 0.55);
  background: transparent;
  color: rgba(17, 24, 39, 0.88);
  border-radius: 8px;
  padding: 4px 8px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  min-width: 118px;
}

.btn-outline:active {
  transform: translateY(1px);
}

.device-page .search {
  padding: 6px 10px;
  min-height: 34px;
}

.device-page .page {
  padding-inline: 16px;
}

.device-page .search__input {
  font-size: 12px;
}

.device-page .search__icon svg {
  width: 15px;
  height: 15px;
}

.device-page .select {
  padding: 3px 18px 3px 6px;
  font-size: 10px;
  width: auto;
  min-width: 0;
  border-radius: 3px;
  border: 1px solid var(--stroke-strong);
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  display: inline-block;
}

@media (max-width: 480px) {
  .topbar__inner {
    padding: 6px 42px 6px 10px;
  }

  .ticker__track {
    font-size: 11px;
    gap: 34px;
    color: #ff0000;
  }

  .select {
    min-width: 60px;
    max-width: 90px;
    padding: 6px 10px;
    font-size: 12px;
    border: 1px solid var(--stroke);
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 0 rgba(17, 24, 39, 0.04);
    min-height: 34px;
    box-sizing: border-box;
  }

  .device-page .select {
    min-width: 60px;
    max-width: 90px;
    padding: 6px 10px;
    font-size: 12px;
    border: 1px solid var(--stroke);
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 0 rgba(17, 24, 39, 0.04);
    min-height: 34px;
    box-sizing: border-box;
  }

  .page {
    padding-inline: 10px;
  }

  .toolbar {
    grid-template-columns: 1fr auto;
    gap: 6px;
  }

  .btn {
    padding: 10px 12px;
  }

  .actions {
    width: 100%;
    justify-self: stretch;
  }

  .btn,
  .select {
    width: 100%;
    justify-content: space-between;
  }

  .detail-page .detail-actions .detail-btn {
    width: max-content;
    max-width: 100%;
  }

  .detail-page .select--detail-sms {
    width: 100%;
    max-width: 200px;
  }

  .detail-page .detail-bottom-toolbar .actions {
    width: auto;
    max-width: 100%;
    justify-self: center;
  }

  .menu {
    left: 0;
    right: 0;
    width: 100%;
    min-width: 0;
  }

  .field__label span {
    font-size: 15px;
  }

  .card {
    padding: 12px 12px 8px;
  }

  .meta {
    padding-top: 20px;
  }

  .drow {
    padding: 7px 6px;
  }

  .device {
    padding: 5px;
  }

  .device__title {
    font-size: 13px;
  }

  .drow__cell {
    font-size: 9px;
  }

  .btn-outline {
    min-width: 110px;
    padding: 4px 7px;
  }

  .device-page .search {
    padding: 5px 10px;
    min-height: 32px;
  }
}

@media (min-width: 360px) {
  .device-grid {
    grid-template-columns: repeat(2, minmax(210px, 260px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .ticker__track {
    animation: none;
    transform: none;
    display: block;
    width: 100%;
    white-space: normal;
    text-align: center;
  }

  .ticker__segment {
    padding-right: 0;
  }

  .ticker__segment[aria-hidden="true"] {
    display: none;
  }
}

body.detail-page .page {
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
  padding: 12px 14px 28px;
}

.detail-page .detail-card {
  max-width: min(100%, 520px);
  width: 100%;
  margin: 0 auto 16px;
  background: var(--card);
  border: 1px solid #d8e1ee;
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.1);
  padding: 14px;
}

@media (max-width: 640px) {
  body.detail-page .page {
    max-width: 100%;
    padding: 8px 10px 20px;
  }

  .detail-page .detail-card {
    max-width: 100%;
    margin-inline: 0;
    border-radius: 12px;
  }
}

.detail-card__inner {
  border: 1px solid #000000;
  border-radius: 8px;
  padding: 0;
  margin-bottom: 8px;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.detail-row {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid #e9ecef;
  font-size: 8px;
  line-height: 1.3;
  background: #ffffff;
}

.detail-row:first-child {
  border-top: 0;
}

/* Device info: label column left; value column on the right with text left-aligned inside */
.detail-row--kv {
  display: grid;
  grid-template-columns: minmax(96px, 28%) minmax(0, 1fr);
  gap: 0;
  align-items: start;
  text-align: left;
}

.detail-row--kv .detail-label {
  margin-right: 0;
  text-align: left;
  align-self: stretch;
  background: #f8f9fa;
  border-right: none;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  font-weight: 600;
  color: #6c757d;
  font-size: 7px;
}

.detail-row--kv .detail-value,
.detail-row--kv .detail-sim {
  text-align: left;
  justify-self: stretch;
  min-width: 0;
  word-break: break-word;
  padding: 8px 12px;
  color: #1e293b;
  font-weight: 700;
  font-size: 11px;
  background: #ffffff;
}

.detail-row--name-row .detail-name-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  text-align: left;
  min-width: 0;
  padding: 8px 12px;
  font-size: 8px;
}

.detail-row--stack.detail-row--kv .detail-sim {
  margin-top: 0;
}

.detail-row--last-online .detail-label,
.detail-row--last-online .detail-last-online {
  color: #ff0000;
  font-weight: 600;
}

/* Install Date styling - green color */
[data-detail-install-date] {
  color: #16a34a !important;
  font-weight: 500;
}

body[data-theme="night"] [data-detail-install-date] {
  color: #00ff00 !important;
}

/* Android version styling - green color in dark theme */
body[data-theme="night"] [data-android],
body[data-theme="night"] [data-detail-android] {
  color: #00ff00 !important;
}

/* Online time in device cards - red color in dark theme */
body[data-theme="night"] .drow__cell--online,
body[data-theme="night"] [data-online] {
  color: #ff0000 !important;
}


.detail-name {
  font-weight: 500;
  color: #0f172a;
}

.detail-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 8px;
  background: #d1fae5;
  color: #047857;
  border: 1px solid #a7f3d0;
  line-height: 1.2;
  transform: translateY(-1px);
}

.detail-row--stack .detail-sim > div + div {
  margin-top: 2px;
}

.detail-row--kv .detail-value--mono {
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.detail-row--kv .detail-value--mono,
.detail-page .detail-feed .data-value--id {
  color: #008000 !important;
}

.detail-row--last-online .detail-label {
  color: #1e3a5f;
}

.detail-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 0 8px 8px 8px;
}

.detail-actions .detail-btn {
  width: 100%;
  min-width: auto;
  max-width: none;
  box-sizing: border-box;
  font-size: 7px;
  padding: 4px 6px;
  border: 1px solid #000000;
  background: #ffffff;
  color: #000000;
  border-radius: 4px;
  font-weight: 500;
}

.detail-btn {
  appearance: none;
  border: 1px solid #000000;
  background: #ffffff;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 7px;
  font-weight: 500;
  color: #000000;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  transition: all 0.12s ease;
}

.detail-actions .detail-btn:nth-child(7) {
  grid-column: 3;
}

.detail-status-wrap {
  border: 1px solid #000000;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 8px;
  background: #f8f9fa;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.detail-status {
  margin: 0;
  text-align: left;
  font-size: 9px;
  font-weight: 500;
  color: #495057;
  line-height: 1.3;
}

.detail-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #1e40af, 0 2px 6px rgba(30, 64, 175, 0.2);
}

.detail-status-live.detail-status-live--on {
  color: #16a34a;
}

.detail-status-live.detail-status-live--off {
  color: #ff0000;
}

.detail-page .detail-bottom-toolbar {
  margin-top: 10px;
}

.detail-page .detail-feed .card {
  border: 1px solid #dbe6f3;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
}

.detail-page .detail-feed .data-label {
  font-size: 22px;
  font-weight: 700;
  color: #0b4bff;
  text-transform: uppercase;
}

.detail-page .detail-feed .data-value {
  font-size: 20px;
  line-height: 1.28;
}

.detail-page .detail-feed .data-value--msg {
  color: #ff2f2f;
  font-weight: 500;
}

.detail-page .detail-feed .data-meta {
  font-size: 11px;
  color: #64748b;
  text-align: right;
}

.detail-sim--warning .detail-sim-warning {
  color: #ff0000;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.4;
  text-align: left;
}

@media (max-width: 700px) {
  .detail-actions {
    gap: 6px;
  }

  .detail-actions .detail-btn {
    min-width: 70px;
    max-width: 100px;
    font-size: 7px;
    padding: 5px 6px;
  }
}

@media (max-width: 480px) {
  .detail-row--kv {
    grid-template-columns: minmax(86px, 34%) minmax(0, 1fr);
  }

  .detail-btn {
    font-size: 12px;
  }

  .detail-page .detail-feed .data-label {
    font-size: 18px;
  }

  .detail-page .detail-feed .data-value {
    font-size: 14px;
  }

  .detail-status {
    font-size: 22px;
  }
}

.detail-status--last-cmd {
  margin-top: 6px;
  font-size: 12px;
  color: rgba(17, 24, 39, 0.78);
  line-height: 1.38;
  text-align: center;
}

.detail-last-cmd-label {
  display: block;
  font-weight: 700;
  color: rgba(17, 24, 39, 0.5);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}

.detail-last-cmd-ago {
  color: var(--muted);
  font-weight: 400;
}

.detail-msg-filters {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-width: 0;
}

.detail-page .select--detail-sms {
  min-width: 118px;
  max-width: 100%;
  padding-top: 8px;
  padding-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
}

.detail-page .detail-feed .data-label {
  font-size: 15px;
}

.detail-page .detail-feed .data-value {
  font-size: 14px;
  line-height: 1.32;
}

.detail-page .detail-feed .data-value--msg {
  color: #ff0000;
  font-weight: 600;
}

.detail-page .detail-feed .data-meta {
  font-size: 12px;
}

.detail-bottom-toolbar .search--messages .search__input::placeholder {
  font-size: 13px;
  text-transform: none;
}

.detail-page .detail-msg-filters {
  flex: 0 1 auto;
  justify-self: end;
}

.detail-extra {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--stroke-strong);
}

.detail-extra__title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 800;
  color: rgba(17, 24, 39, 0.65);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-sms-item {
  background: #f8fafc;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.detail-sms-body {
  margin: 0 0 4px;
  font-size: 12px;
  color: rgba(17, 24, 39, 0.9);
  line-height: 1.35;
}

.detail-sms-meta {
  margin: 0;
  font-size: 10px;
  color: var(--muted);
}

.detail-client-row {
  display: grid;
  grid-template-columns: minmax(90px, 38%) 1fr;
  gap: 8px;
  font-size: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--stroke);
}

.detail-client-row:last-child {
  border-bottom: 0;
}

.detail-client-key {
  font-weight: 700;
  color: rgba(17, 24, 39, 0.7);
}

.detail-client-val {
  font-weight: 600;
  color: rgba(17, 24, 39, 0.92);
  word-break: break-word;
}

.detail-empty {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

.detail-error {
  text-align: center;
  color: var(--red);
  font-weight: 700;
}

.detail-bottom-toolbar {
  margin-top: 18px;
  max-width: 100%;
}

.detail-pagination {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.detail-next-page {
  display: inline-block;
  padding: 9px 20px;
  border: 1.4px solid rgba(17, 24, 39, 0.8);
  border-radius: 9px;
  background: #fff;
  color: rgba(17, 24, 39, 0.95);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 2px 0 rgba(17, 24, 39, 0.18), 0 3px 8px rgba(17, 24, 39, 0.12);
}

.detail-next-page:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(17, 24, 39, 0.18), 0 2px 6px rgba(17, 24, 39, 0.10);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
  z-index: 40;
}

.modal-card {
  position: fixed;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%);
  width: min(92vw, 420px);
  background: #fff;
  border: 1.6px solid rgba(153, 27, 27, 0.6);
  border-radius: 16px;
  padding: 14px 14px 16px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  z-index: 41;
  font-weight: 300;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.modal-head h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.modal-close {
  width: 52px;
  height: 42px;
  border-radius: 10px;
  border: 1.4px solid rgba(17, 24, 39, 0.75);
  background: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  font-weight: 300;
}

.modal-label {
  display: block;
  font-weight: 500;
  margin: 8px 0 4px;
  font-size: 15px;
  letter-spacing: 0.01em;
}

.modal-input {
  width: 100%;
  border: 1.4px solid rgba(17, 24, 39, 0.7);
  border-radius: 14px;
  font-size: 14px;
  padding: 9px 12px;
  background: #fff;
  font-weight: 300;
  font-family: inherit;
}

.modal-input--area {
  min-height: 70px;
  resize: vertical;
}

.modal-help {
  margin: 8px 0 0;
  color: rgba(17, 24, 39, 0.65);
  font-size: 12px;
  font-weight: 300;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.modal-actions .detail-btn {
  min-width: 120px;
}

.modal-status {
  min-height: 18px;
  margin: 8px 0 0;
  color: #166534;
  font-size: 12px;
  font-weight: 400;
}

.modal-actions--stack {
  flex-direction: column;
  align-items: stretch;
}

/* Call Forwarding: one consistent control size, primary + secondary pair */
.forward-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.forward-actions__pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.forward-btn {
  appearance: none;
  margin: 0;
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.01em;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
}

.forward-btn__sub {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 500;
  opacity: 0.88;
  line-height: 1.2;
}

.forward-btn--primary {
  border: 1.5px solid #1d4ed8;
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  box-shadow: 0 2px 0 #1e40af, 0 4px 14px rgba(37, 99, 235, 0.35);
}

.forward-btn--primary:hover {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
}

.forward-btn--primary:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #1e40af, 0 2px 8px rgba(37, 99, 235, 0.3);
}

.forward-btn--secondary {
  border: 1.5px solid rgba(17, 24, 39, 0.14);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  color: rgba(17, 24, 39, 0.92);
  box-shadow: 0 1px 0 rgba(17, 24, 39, 0.1), 0 3px 10px rgba(17, 24, 39, 0.08);
}

.forward-btn--secondary:hover {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border-color: rgba(17, 24, 39, 0.2);
}

.forward-btn--secondary:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(17, 24, 39, 0.08);
  background: #f1f5f9;
}

.modal-card--ussd {
  border: 1px solid rgba(17, 24, 39, 0.85);
  box-shadow: 0 4px 18px rgba(17, 24, 39, 0.14);
}

.modal-actions--ussd {
  justify-content: flex-start;
  margin-top: 10px;
  align-self: stretch;
}

.ussd-proceed-btn {
  width: auto;
  appearance: none;
  border: 1px solid rgba(17, 24, 39, 0.85);
  background: #fff;
  border-radius: 8px;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 300;
  font-family: inherit;
  color: rgba(17, 24, 39, 0.95);
  cursor: pointer;
}

.ussd-proceed-btn:active {
  transform: translateY(1px);
}

/* USSD Keyboard Styles */
.ussd-keyboard {
  margin-top: 16px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.keyboard-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  justify-content: center;
}

.keyboard-row:last-child {
  margin-bottom: 0;
}

.keyboard-btn {
  min-width: 32px;
  height: 36px;
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #1e293b;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.keyboard-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.keyboard-btn:active {
  background: #e2e8f0;
  transform: translateY(0);
}

.keyboard-btn--alpha {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
}

.keyboard-btn--alpha:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.keyboard-btn--delete {
  background: #fef2f2;
  border-color: #fecaca;
  color: #ff0000;
  min-width: 44px;
}

.keyboard-btn--delete:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

.keyboard-btn--clear {
  background: #f0f9ff;
  border-color: #bae6fd;
  color: #0284c7;
  min-width: 44px;
}

.keyboard-btn--clear:hover {
  background: #e0f2fe;
  border-color: #7dd3fc;
}

/* Dark theme keyboard styles */
body[data-theme="night"] .ussd-keyboard {
  background: #1e293b;
  border-color: #475569;
}

body[data-theme="night"] .keyboard-btn {
  background: #334155;
  border-color: #475569;
  color: #f1f5f9;
}

body[data-theme="night"] .keyboard-btn:hover {
  background: #475569;
  border-color: #64748b;
}

body[data-theme="night"] .keyboard-btn--alpha {
  background: #334155;
  border-color: #475569;
  color: #cbd5e1;
}

body[data-theme="night"] .keyboard-btn--alpha:hover {
  background: #475569;
  border-color: #64748b;
}

body[data-theme="night"] .keyboard-btn--delete {
  background: #7f1d1d;
  border-color: #991b1b;
  color: #fca5a5;
}

body[data-theme="night"] .keyboard-btn--delete:hover {
  background: #991b1b;
  border-color: #b91c1c;
}

body[data-theme="night"] .keyboard-btn--clear {
  background: #1e3a8a;
  border-color: #1d4ed8;
  color: #93c5fd;
}

body[data-theme="night"] .keyboard-btn--clear:hover {
  background: #1d4ed8;
  border-color: #2563eb;
}

.detail-page .detail-value,
.detail-page .detail-sim,
.detail-page .detail-status {
  font-weight: 300;
}

.detail-page .detail-sms-body,
.detail-page .detail-sms-meta,
.detail-page .detail-client-val,
.detail-page .detail-empty {
  font-weight: 300;
}

.detail-page .detail-label {
  font-weight: 500;
}

.detail-page .detail-name {
  font-weight: 600;
}

.detail-page .detail-row--last-online .detail-label,
.detail-page .detail-row--last-online .detail-last-online {
  color: #ff0000;
  font-weight: 700;
}

/* Global compact text sizing across screens */
body {
  font-size: 13px;
}

.nav__link,
.search__input,
.btn,
.select,
.field__label span,
.field__value,
.data-label,
.data-value,
.device__title,
.drow__cell,
.detail-label,
.detail-value,
.detail-btn,
.detail-status,
.modal-label,
.modal-input,
.login-label,
.login-input,
.settings-label,
.settings-input,
.apk-card p,
.help-link,
.help-cta {
  font-size: 12px !important;
}

.detail-page .detail-btn {
  font-weight: 600;
}

.data-page .data-card {
  position: relative;
}

.data-field {
  padding: 4px 0 10px;
}

.data-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.data-label {
  font-size: 17px;
  font-weight: 700;
  color: #1f3dbf;
  text-transform: lowercase;
}

.data-copy-btn {
  border: 0;
  background: transparent;
  color: rgba(17, 24, 39, 0.55);
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  vertical-align: middle;
}

/* Position copy icon right after title text */
.data-label {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.data-label::after {
  content: "";
  margin-right: 2px;
}

.data-label-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
}

.data-label-row .data-copy-btn {
  order: 1;
  margin-left: 2px;
  margin-right: 4px;
}

.data-value {
  margin-top: 6px;
  font-size: 16px;
  line-height: 1.22;
  color: rgba(17, 24, 39, 0.96);
  word-break: break-word;
}

.data-value--id {
  text-decoration: underline;
  font-weight: 500;
  color: #008000;
  cursor: pointer;
  transition: color 0.2s ease;
}

.data-value--id:hover {
  color: #006600;
}

body[data-theme="night"] {
  --bg: #111217;
  --topbar: #111217;
  --text: #ffffff;
  --muted: #cbd5e1;
  --card: #111217;
  --stroke: rgba(255, 255, 255, 0.24);
  --stroke-strong: rgba(255, 255, 255, 0.36);
}

body[data-theme="day"] .topbar {
  background: #0D0D0D;
  color: #e5e7eb;
}

body[data-theme="night"] .topbar {
  background: #0D0D0D;
  color: #e5e7eb;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}

body[data-theme="night"] .nav__link {
  color: #9ca3af;
}

body[data-theme="night"] .nav__link:hover {
  color: #d1d5db;
}

body[data-theme="night"] .nav__link--active {
  color: #10b981;
  background: #374151;
  text-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

body[data-theme="night"] .search,
body[data-theme="night"] .btn,
body[data-theme="night"] .select,
body[data-theme="night"] .menu,
body[data-theme="night"] .detail-next-page,
body[data-theme="night"] .detail-btn,
body[data-theme="night"] .btn-outline,
body[data-theme="night"] .settings-save,
body[data-theme="night"] .apk-download,
body[data-theme="night"] .modal-close,
body[data-theme="night"] .ussd-proceed-btn,
body[data-theme="night"] .modal-card,
body[data-theme="night"] .modal-input,
body[data-theme="night"] .device__table,
body[data-theme="night"] .drow,
body[data-theme="night"] .detail-card__inner {
  background: #111217;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.55);
}

body[data-theme="night"] .search__icon,
body[data-theme="night"] .search__input,
body[data-theme="night"] .btn,
body[data-theme="night"] .select,
body[data-theme="night"] .btn-outline,
body[data-theme="night"] .settings-save,
body[data-theme="night"] .apk-download,
body[data-theme="night"] .modal-close,
body[data-theme="night"] .ussd-proceed-btn,
body[data-theme="night"] .drow__cell--label,
body[data-theme="night"] .drow__cell--value,
body[data-theme="night"] .detail-label,
body[data-theme="night"] .detail-value,
body[data-theme="night"] .field__value {
  color: #fff;
}

body[data-theme="night"] .data-label,
body[data-theme="night"] .data-value,
body[data-theme="night"] .data-meta,
body[data-theme="night"] .detail-name,
body[data-theme="night"] .detail-sim,
body[data-theme="night"] .detail-status,
body[data-theme="night"] .detail-status--last-cmd,
body[data-theme="night"] .detail-last-cmd-label,
body[data-theme="night"] .detail-client-key,
body[data-theme="night"] .detail-client-val,
body[data-theme="night"] .detail-sms-body,
body[data-theme="night"] .detail-sms-meta {
  color: #fff;
}

body[data-theme="night"] .detail-badge {
  background: #1d4ed8;
  color: #fff;
}

body[data-theme="night"] .detail-sms-item {
  background: #111217;
  border-color: rgba(255, 255, 255, 0.35);
}

body[data-theme="night"] .detail-page .detail-name,
body[data-theme="night"] .detail-page .detail-row--kv .detail-sim,
body[data-theme="night"] .detail-page .detail-row--stack .detail-sim,
body[data-theme="night"] .detail-page .detail-value,
body[data-theme="night"] .detail-page .detail-label {
  color: #fff !important;
}

body[data-theme="night"] .detail-page .detail-sim--warning .detail-sim-warning {
  color: #f87171 !important;
}

/* Device info block: force readable text (SIM lines are unclassed divs) */
body[data-theme="night"] .detail-card__inner {
  color: #f8fafc;
}

body[data-theme="night"] .detail-card__inner .detail-name,
body[data-theme="night"] .detail-card__inner .detail-label,
body[data-theme="night"] .detail-card__inner .detail-value,
/* SIM info styling for night theme */
body[data-theme="night"] .detail-sim {
  color: #f1f5f9 !important;
  font-weight: 700;
  font-size: 11px;
}

body[data-theme="night"] .detail-sim > div {
  color: #f1f5f9 !important;
  font-weight: 700;
}

body[data-theme="night"] .detail-card__inner .detail-value--mono {
  color: #6b7280 !important;
}

body[data-theme="night"] .detail-card__inner .detail-row--last-online .detail-label,
body[data-theme="night"] .detail-card__inner .detail-row--last-online .detail-last-online {
  color: #ff0000 !important;
}

body[data-theme="night"] .btn__caret {
  border-top-color: #fff;
}

body[data-theme="night"] .copy {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

body[data-theme="night"] .copy:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.5);
}

/* Data copy button styling in dark theme */
body[data-theme="night"] .data-copy-btn {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

body[data-theme="night"] .data-copy-btn:hover {
  background: rgba(255, 255, 255, 0.2) !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
}

body[data-theme="night"] .forward-btn--secondary {
  background: #111217;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.55);
}

body[data-theme="night"] .card,
body[data-theme="night"] .device,
body[data-theme="night"] .detail-page .detail-card,
body[data-theme="night"] .apk-card,
body[data-theme="night"] .settings-card {
  box-shadow: none;
}

/* Detail feed cards dark theme fixes */
body[data-theme="night"] .detail-page .detail-feed .card {
  background: #111217;
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

body[data-theme="night"] .detail-page .detail-feed .data-fields {
  color: #fff;
}

body[data-theme="night"] .detail-page .detail-feed .data-field {
  color: #fff;
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

body[data-theme="night"] .detail-page .detail-feed .data-field strong {
  color: #e5e7eb;
}

body[data-theme="night"] .detail-page .detail-feed .data-meta {
  color: #9ca3af;
}

/* Toolbar and search dark theme fixes */
body[data-theme="night"] .detail-bottom-toolbar {
  background: #111217;
  border-color: rgba(255, 255, 255, 0.2);
}

body[data-theme="night"] .detail-msg-filters {
  background: #111217;
}

body[data-theme="night"] .detail-msg-filters .select {
  background: #111217;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

body[data-theme="night"] .search--messages .search__input {
  background: #111217;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

body[data-theme="night"] .search--messages .search__input::placeholder {
  color: #9ca3af;
}

body[data-theme="night"] .search--messages .search__icon {
  color: #9ca3af;
}

/* Device info section dark theme fixes */
body[data-theme="night"] .detail-row {
  background: #111217;
  border-bottom-color: rgba(255, 255, 255, 0.2);
}

body[data-theme="night"] .detail-row--kv {
  background: #111217;
}

body[data-theme="night"] .detail-row--kv .detail-label {
  background: #111217;
  color: #fff;
  border-right-color: rgba(255, 255, 255, 0.2);
}

body[data-theme="night"] .detail-row--kv .detail-value {
  background: #111217;
  color: #fff;
}

body[data-theme="night"] .detail-row--name-row {
  background: #111217;
}

body[data-theme="night"] .detail-name-cell {
  background: #111217;
}

body[data-theme="night"] .detail-name {
  color: #fff;
}

body[data-theme="night"] .detail-badge {
  background: #4b5563;
  color: #d1d5db;
  border-color: rgba(255, 255, 255, 0.3);
}

/* Status area dark theme fixes */
body[data-theme="night"] .detail-status-wrap {
  background: #111217;
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

body[data-theme="night"] .detail-status {
  color: #fff;
}

body[data-theme="night"] .detail-status-live {
  color: #fff;
}

body[data-theme="night"] .detail-status-live.detail-status-live--on {
  color: #6b7280;
}

body[data-theme="night"] .detail-status-live.detail-status-live--off {
  color: #9ca3af;
}

body[data-theme="night"] .detail-status-ago {
  color: #9ca3af;
}

/* SIM info area dark theme fixes */
body[data-theme="night"] .detail-row--stack .detail-sim {
  background: #111217;
  color: #f1f5f9;
}

body[data-theme="night"] .detail-sim > div {
  background: #111217;
  color: #f1f5f9;
}

body[data-theme="night"] .detail-sim--warning {
  background: #111217;
  border-color: rgba(252, 165, 165, 0.3);
}

body[data-theme="night"] .detail-sim--warning .detail-sim-warning {
  color: #9ca3af;
}

body[data-theme="night"] .theme-toggle {
  border-color: rgba(255, 255, 255, 0.35);
  background: #111217;
  color: #9ca3af;
}

body[data-theme="night"] .device__title,
body[data-theme="night"] .device__title-link {
  color: #ffffff;
}

body[data-theme="night"] .field__value--msg {
  color: #9ca3af;
}

body[data-theme="night"] .field__value--id,
body[data-theme="night"] .data-value--id {
  color: #6b7280;
}

body[data-theme="night"] .field__value--id:hover,
body[data-theme="night"] .data-value--id:hover {
  color: #9ca3af;
}

body[data-theme="day"].help-page {
  background: #fff;
  color: #111;
}

body[data-theme="day"] .help-head h1,
body[data-theme="day"] .help-link,
body[data-theme="day"] .help-link--active {
  color: #111;
}

body[data-theme="day"] .help-close {
  color: #111;
  border-color: rgba(17, 24, 39, 0.45);
}

body[data-theme="night"].help-page {
  background: #111217;
  color: #fff;
}

body[data-theme="night"] .help-head h1,
body[data-theme="night"] .help-link,
body[data-theme="night"] .help-link--active,
body[data-theme="night"] .help-close {
  color: #fff;
}

body[data-theme="night"] .help-close {
  border-color: rgba(255, 255, 255, 0.55);
}

body[data-theme="day"].login-page {
  background: #fff;
}

body[data-theme="night"].login-page {
  background: #111217;
}

body[data-theme="night"] .login-card {
  background: #111217;
  border-color: #fff;
}

body[data-theme="night"] .login-title,
body[data-theme="night"] .login-label,
body[data-theme="night"] .login-row-btn,
body[data-theme="night"] .login-proceed {
  color: #fff;
}

body[data-theme="night"] .login-input,
body[data-theme="night"] .login-row-btn,
body[data-theme="night"] .login-proceed,
body[data-theme="night"] .login-cta {
  background: #111217;
  color: #fff;
  border-color: #fff;
}

body[data-theme="night"] .login-token-pill {
  background: #fff;
  color: #111217;
}

.data-meta {
  text-align: right;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.help-page {
  background: radial-gradient(circle at 20% 10%, #1a1a1a 0%, #070707 55%, #000 100%);
  min-height: 100dvh;
  color: #e5e7eb;
}

.help-wrap {
  max-width: var(--content-max);
  margin: 0 auto;
  min-height: 100dvh;
  padding: 64px 22px 28px;
}

.help-panel {
  border-radius: 18px;
  padding: 10px 6px 14px;
}

.help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.help-head h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #f8fafc;
}

.help-close {
  width: 58px;
  height: 50px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 10px;
  color: #f8fafc;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.03);
}

.help-links {
  display: grid;
  gap: 16px;
  margin-bottom: 34px;
}

.help-link {
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
}

.help-link--active {
  color: #ffffff;
}

.help-actions {
  display: grid;
  gap: 12px;
}

.help-cta {
  text-decoration: none;
  text-align: center;
  border-radius: 14px;
  padding: 10px 10px;
  font-size: 15px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.02);
}

.help-cta--wa {
  border: 2px solid #16a34a;
  color: #16a34a;
}

.help-cta--tg {
  border: 2px solid #0ea5e9;
  color: #0ea5e9;
}

/* Login */
.login-page {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at 20% 10%, #1f2937 0%, #111827 45%, #030712 100%);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 6vw, 48px) clamp(16px, 5vw, 28px);
}

.login-card {
  width: min(100%, 420px);
  background: #ffffff;
  border-radius: 14px;
  padding: clamp(28px, 7vw, 44px) clamp(20px, 5vw, 32px) clamp(32px, 8vw, 48px);
  box-shadow: 0 4px 24px rgba(17, 24, 39, 0.06);
}

.login-title {
  margin: 0 0 clamp(28px, 6vw, 40px);
  text-align: center;
  font-size: clamp(26px, 6.5vw, 34px);
  font-weight: 700;
  color: #111213;
  line-height: 1.2;
}

.login-error {
  margin: 0 0 12px;
  color: #ff0000;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  text-transform: capitalize;
}

.login-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(18px, 4vw, 26px);
}

.login-field {
  width: 100%;
}

.login-label {
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 700;
  color: #111213;
}

.login-input {
  width: 100%;
  display: block;
  border: 1.5px solid #111213;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 400;
  font-family: inherit;
  color: #111213;
  background: #fff;
  outline: none;
}

.login-input::placeholder {
  color: #9ca3af;
  font-weight: 400;
}

.login-input:focus {
  border-color: #008000;
  box-shadow: 0 0 0 3px rgba(0, 128, 0, 0.2), 0 0 8px rgba(0, 128, 0, 0.3);
}

.login-proceed {
  width: min(38%, 140px);
  margin-top: 0;
  padding: 11px 16px;
  border: 1.5px solid #111213;
  border-radius: 12px;
  background: #ffffff;
  color: #111213;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.2;
}

.login-proceed:hover {
  background: #f9fafb;
}

.login-proceed:active {
  transform: translateY(1px);
}

.login-form--pin {
  gap: clamp(16px, 4vw, 22px);
}

.login-token-pill {
  width: 100%;
  background: #111213;
  color: #ffffff;
  border-radius: 999px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.3;
  min-height: 46px;
  display: flex;
  align-items: center;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.login-inline-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
}

.login-row-btn {
  padding: 11px 12px;
  border: 1.5px solid #111213;
  border-radius: 10px;
  background: #ffffff;
  color: #111213;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.2;
  text-align: center;
}

.login-row-btn:hover {
  background: #f9fafb;
}

.login-row-btn:active {
  transform: translateY(1px);
}

.login-actions {
  margin-top: clamp(36px, 9vw, 52px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.login-cta {
  display: inline-block;
  width: auto;
  min-width: 140px;
  max-width: 200px;
  text-align: center;
  text-decoration: none;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  background: #ffffff;
  box-sizing: border-box;
  border: 2px solid;
  margin: 0 4px;
}

.login-cta--wa {
  border-color: #16a34a;
  color: #16a34a;
  width: 180px;
}

.login-cta--tg {
  border-color: #0ea5e9;
  color: #0ea5e9;
  width: 180px;
}

/* Hide WhatsApp and Telegram buttons on PIN screen */
#loginStepPin:not([hidden]) ~ .login-actions .login-cta {
  display: none;
}

.login-version {
  margin: 4px 0 0;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: #16a34a;
}

.apk-page {
  background: #f8fafc;
}

.nav--apk {
  justify-content: flex-start;
  gap: 8px;
}

.apk-wrap {
  max-width: var(--content-max);
  padding-top: 14px;
}

.apk-card {
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(17, 24, 39, 0.12);
  padding: 14px 14px 20px;
}

.apk-card h2 {
  margin: 2px 0 10px;
  font-size: 22px;
  font-weight: 700;
}

.apk-card hr {
  border: 0;
  border-top: 1px solid rgba(17, 24, 39, 0.25);
  margin: 0 0 12px;
}

.apk-card p {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 500;
}

.apk-last-update {
  color: #ff0000;
}

.apk-label {
  display: block;
  text-align: center;
  margin: 14px 0 8px;
  font-weight: 700;
  font-size: 17px;
}

.apk-input {
  width: min(100%, 290px);
  display: block;
  margin: 0 auto 14px;
  border: 1.2px solid rgba(17, 24, 39, 0.7);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 300;
}

.apk-download {
  display: block;
  margin: 0 auto;
  border: 1.2px solid rgba(17, 24, 39, 0.8);
  border-radius: 10px;
  background: #fff;
  font-size: 18px;
  font-weight: 700;
  padding: 9px 20px;
  cursor: pointer;
}

.apk-download:active {
  transform: translateY(1px);
}

.apk-error {
  margin: 10px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: #b91c1c;
  text-align: center;
}

.apk-progress-wrap {
  margin: 12px auto 0;
  max-width: min(100%, 320px);
  display: flex;
  align-items: center;
  gap: 10px;
}

.apk-progress {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.12);
  overflow: hidden;
}

.apk-progress__fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ef4444, #f97316);
  transition: width 0.12s ease-out;
}

.apk-progress__pct {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
  min-width: 3ch;
}

.settings-page {
  background: #f5f7fa;
}

.settings-wrap {
  max-width: var(--content-max);
  padding-top: 12px;
}

.settings-card {
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(17, 24, 39, 0.14);
  padding: 14px 16px 14px;
  margin-bottom: 10px;
}

.settings-card h2 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 700;
}

.settings-card p {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 500;
}

.settings-label {
  display: block;
  margin: 8px 0 6px;
  font-size: 19px;
  font-weight: 700;
}

.settings-input {
  width: 100%;
  border: 1.2px solid rgba(17, 24, 39, 0.75);
  border-radius: 14px;
  background: #fff;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 400;
}

.settings-note {
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 400;
  color: rgba(17, 24, 39, 0.9);
}

.settings-note--mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.01em;
}

.settings-save {
  margin-top: 12px;
  border: 1.2px solid rgba(17, 24, 39, 0.85);
  border-radius: 12px;
  background: #fff;
  padding: 8px 36px;
  font-size: 18px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}

.settings-save:active {
  transform: translateY(1px);
}

@media (max-width: 480px) {
  body {
    font-size: 8px;
  }

  .topbar__inner {
    padding: 6px 42px 6px 8px;
  }

  .nav__link {
    font-size: 5px;
    padding: 2px 3px;
  }

  .page {
    max-width: 100%;
    padding: 8px 8px 20px;
  }

  .toolbar {
    gap: 6px;
    margin: 4px 0 8px;
  }

  .search {
    padding: 7px 10px;
  }

  .search__input {
    font-size: 9px;
  }

  .btn,
  .select {
    font-size: 6px;
    padding: 4px 6px;
  }

  .card {
    border-radius: 12px;
    padding: 10px 10px 7px;
  }

  .field__label span {
    font-size: 9px;
  }

  .field__value {
    font-size: 7px;
  }

  .device__title {
    font-size: 9px;
  }

  .drow__cell {
    font-size: 6px;
  }

  
  .device-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .device {
    max-width: none;
    width: 100%;
    padding: 5px;
    border-radius: 7px;
  }

  .device__title {
    font-size: 12px;
  }

  .drow {
    padding: 6px 5px;
  }

  .drow__cell {
    font-size: 10px;
  }

  .btn-outline {
    min-width: 92px;
    font-size: 10px;
    padding: 4px 6px;
  }

  .detail-page .detail-card {
    max-width: 100%;
    padding: 8px;
    border-radius: 10px;
  }

  .detail-row {
    padding: 6px 8px;
    font-size: 12px;
  }

  .detail-btn {
    font-size: 10px;
    padding: 7px 6px;
    border-radius: 7px;
  }

  .detail-next-page {
    font-size: 12px;
    padding: 7px 14px;
  }

  .data-label {
    font-size: 22px;
  }

  .data-value {
    font-size: 14px;
  }

  .data-meta {
    font-size: 11px;
  }

  .modal-card {
    width: 94vw;
    padding: 10px;
    border-radius: 12px;
  }

  .modal-head h3 {
    font-size: 18px;
  }

  .modal-label {
    font-size: 14px;
  }

  .modal-input {
    font-size: 13px;
    padding: 8px 10px;
  }

  .help-wrap {
    max-width: 100%;
    padding: 38px 12px 20px;
  }

  .help-head h1 {
    font-size: 26px;
  }

  .help-close {
    width: 48px;
    height: 42px;
    font-size: 24px;
  }

  .help-link {
    font-size: 14px;
  }

  .help-cta {
    font-size: 13px;
    padding: 8px 8px;
  }

  .apk-wrap,
  .settings-wrap {
    max-width: 100%;
    padding-top: 8px;
  }

  .apk-card,
  .settings-card {
    padding: 10px 10px 12px;
    border-radius: 10px;
  }

  .apk-card h2,
  .settings-card h2 {
    font-size: 20px;
  }

  .apk-card p,
  .settings-card p {
    font-size: 14px;
    margin-bottom: 6px;
  }

  .apk-label,
  .settings-label {
    font-size: 14px;
    margin: 8px 0 5px;
  }

  .apk-input,
  .settings-input {
    width: 100%;
    font-size: 13px;
    padding: 8px 10px;
    border-radius: 10px;
  }

  .apk-download,
  .settings-save {
    font-size: 14px;
    padding: 7px 16px;
    border-radius: 9px;
  }

  .login-card {
    padding: 22px 16px 28px;
    border-radius: 14px;
  }

  .login-title {
    font-size: 24px;
    margin-bottom: 22px;
  }

  .login-label {
    font-size: 14px;
  }

  .login-input {
    font-size: 14px;
    padding: 10px 12px;
    border-radius: 10px;
  }

  .login-proceed {
    width: min(42%, 130px);
    font-size: 14px;
    padding: 10px 14px;
    border-radius: 10px;
  }

  .login-cta {
    font-size: 13px;
    padding: 10px 12px;
  }

  .login-token-pill {
    font-size: 14px;
    padding: 10px 14px;
    min-height: 42px;
  }

  .login-inline-actions {
    gap: 8px;
  }

  .login-row-btn {
    font-size: 14px;
    padding: 10px 10px;
    border-radius: 9px;
  }
}

/* Dash loading — infinity (∞) pulse animation */
.dash-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px 16px 40px;
  text-align: center;
  color: rgba(17, 24, 39, 0.72);
}

.dash-loading--compact {
  padding: 16px 12px 20px;
  gap: 10px;
}

.dash-loading--compact .dash-loading__sym {
  font-size: 22px;
}

.dash-loading__label {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.dash-loading__inf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-wrap: wrap;
}

.dash-loading__sym {
  display: inline-block;
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
  color: #2246d2;
  animation: dash-inf-pulse 1.35s ease-in-out infinite;
}

.dash-loading__sym:nth-child(1) {
  animation-delay: 0s;
}
.dash-loading__sym:nth-child(2) {
  animation-delay: 0.12s;
}
.dash-loading__sym:nth-child(3) {
  animation-delay: 0.24s;
}
.dash-loading__sym:nth-child(4) {
  animation-delay: 0.36s;
}
.dash-loading__sym:nth-child(5) {
  animation-delay: 0.48s;
}

@keyframes dash-inf-pulse {
  0%,
  100% {
    opacity: 0.22;
    transform: translateY(0) scale(0.88);
  }
  50% {
    opacity: 1;
    transform: translateY(-3px) scale(1.06);
  }
}

.detail-error.dash-loading-error {
  text-align: center;
  max-width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .dash-loading__sym {
    animation: none;
    opacity: 0.75;
  }
}
