:root {
  --sidebar-bg: #0f1723;
  --sidebar-surface: #162235;
  --sidebar-line: rgba(255, 255, 255, 0.08);
  --sidebar-text: #eef4ff;
  --sidebar-muted: #95a3ba;
  --app-bg: #f3f6fb;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --line: #dbe4f0;
  --text: #122033;
  --muted: #64748b;
  --brand: #0f766e;
  --brand-strong: #0b5d58;
  --brand-soft: rgba(15, 118, 110, 0.12);
  --success: #15803d;
  --success-soft: rgba(21, 128, 61, 0.12);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.12);
  --warning: #b45309;
  --warning-soft: rgba(180, 83, 9, 0.14);
  --info: #1d4ed8;
  --info-soft: rgba(29, 78, 216, 0.12);
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --font: "Plus Jakarta Sans", "Aptos", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.08), transparent 20%),
    radial-gradient(circle at top right, rgba(29, 78, 216, 0.08), transparent 20%),
    linear-gradient(180deg, #f8fbff 0%, #f1f5f9 100%);
}

body.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  height: 100vh;
  overflow: hidden;
  display: flex;
  background: var(--app-bg);
}

.sidebar {
  width: 272px;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  scrollbar-gutter: stable;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 24%),
    linear-gradient(180deg, #0c1521 0%, #111b2b 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--sidebar-text);
  padding: 16px 12px 22px;
}

.sidebar::-webkit-scrollbar,
.main-content::-webkit-scrollbar,
.modal-scroll::-webkit-scrollbar {
  width: 10px;
}

.sidebar::-webkit-scrollbar-track,
.main-content::-webkit-scrollbar-track,
.modal-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb,
.main-content::-webkit-scrollbar-thumb,
.modal-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.36);
  border: 2px solid transparent;
  background-clip: padding-box;
}

.brand-box {
  border-radius: 22px;
  padding: 16px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--sidebar-line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.brand-box h1 {
  margin: 0 0 6px;
  font-size: 19px;
  line-height: 1.14;
}

.brand-box p {
  margin: 0;
  font-size: 12px;
  color: var(--sidebar-muted);
  line-height: 1.45;
}

.sidebar-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-section h2 {
  margin: 0 0 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(238, 244, 255, 0.48);
  padding: 0 4px;
}

.nav-list {
  display: grid;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  min-height: 42px;
  border-radius: 14px;
  color: rgba(238, 244, 255, 0.88);
  transition: background 0.18s ease, transform 0.18s ease;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(1px);
}

.nav-link-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.nav-icon {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  background: transparent;
  color: rgba(232, 240, 255, 0.82);
  flex-shrink: 0;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.nav-icon-fallback {
  font-size: 10px;
  font-weight: 800;
}

.nav-label {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  color: rgba(245, 248, 255, 0.96);
}

.nav-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.nav-badge,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  white-space: nowrap;
}

.nav-badge.beta,
.badge.beta,
.badge.processing,
.badge.retrying,
.badge.warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.nav-badge.coming,
.badge.coming {
  background: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
}

.main-content {
  height: 100vh;
  overflow-y: auto;
  flex: 1;
  min-width: 0;
  padding: 24px;
}

.main-content-inner {
  max-width: 1440px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.topbar-left,
.topbar-right,
.toolbar,
.toolbar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mobile-menu {
  display: none;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--success);
}

.panel,
.hero,
.table-card,
.empty-state,
.loading-state {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.hero {
  padding: 24px;
  margin-bottom: 20px;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.24), transparent 18%),
    linear-gradient(135deg, #0f766e 0%, #155e75 56%, #1d4ed8 100%);
  color: white;
  border: none;
}

.hero h2 {
  margin: 0 0 8px;
  font-size: 30px;
}

.hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.86);
}

.hero .toolbar {
  margin-top: 16px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.cards {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-card {
  padding: 18px;
}

.metric-card small {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric-card strong {
  font-size: 28px;
  line-height: 1;
}

.metric-sub {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-title {
  margin: 0;
  font-size: 20px;
}

.section-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.panel {
  padding: 20px;
}

.table-card {
  padding: 18px;
}

.filter-card {
  margin-bottom: 16px;
}

.filter-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
}

.filter-body {
  display: none;
  margin-top: 14px;
}

.filter-card.open .filter-body {
  display: block;
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 11px 15px;
  background: #e2e8f0;
  color: var(--text);
  font-weight: 600;
  transition: transform 0.16s ease, opacity 0.16s ease, background 0.16s ease;
}

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

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  background: linear-gradient(135deg, var(--brand), #0f766e);
  color: white;
}

.btn.secondary {
  background: var(--info-soft);
  color: var(--info);
}

.btn.success {
  background: var(--success-soft);
  color: var(--success);
}

.btn.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
}

.btn.small {
  padding: 8px 11px;
  border-radius: 12px;
  font-size: 12px;
}

.btn.linky {
  padding: 0;
  background: transparent;
  color: var(--info);
}

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

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.field label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.section-inline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 12px 13px;
  background: var(--surface);
  color: var(--text);
}

.field input[readonly],
.field textarea[readonly] {
  background: var(--surface-alt);
}

.field textarea {
  min-height: 120px;
  resize: vertical;
}

.field.inline {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
}

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

.warning-box,
.success-box,
.info-box {
  border-radius: 16px;
  padding: 14px 15px;
  font-size: 13px;
}

.warning-box {
  background: var(--warning-soft);
  color: var(--warning);
}

.success-box {
  background: var(--success-soft);
  color: var(--success);
}

.info-box {
  background: var(--info-soft);
  color: var(--info);
}

.badge.success,
.badge.connected,
.badge.sent,
.badge.delivered {
  background: var(--success-soft);
  color: var(--success);
}

.badge.failed,
.badge.disconnected,
.badge.cancelled,
.badge.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.queued,
.badge.pending,
.badge.info {
  background: var(--info-soft);
  color: var(--info);
}

.badge.default {
  background: rgba(148, 163, 184, 0.18);
  color: #475569;
}

.data-table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
}

.data-table {
  width: 100%;
  min-width: 940px;
  border-collapse: collapse;
  background: white;
}

.data-table th,
.data-table td {
  padding: 14px 12px;
  border-bottom: 1px solid #ebf0f6;
  vertical-align: top;
  text-align: left;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fbff;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.table-cell-title {
  font-weight: 700;
}

.table-cell-sub {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.table-cell-status {
  margin-top: 6px;
}

.table-cell-status .status-chip {
  font-size: 12px;
  text-transform: capitalize;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.status-chip::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: currentColor;
}

.pill-list,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.device-actions {
  flex-wrap: nowrap;
  gap: 6px;
  white-space: nowrap;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab {
  border: 1px solid var(--line);
  background: white;
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
}

.tab.active {
  border-color: transparent;
  background: var(--brand);
  color: white;
}

.empty-state,
.loading-state {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

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

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 460px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 30px;
  box-shadow: var(--shadow);
  padding: 32px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 34px;
}

.login-card p {
  margin: 0 0 22px;
  color: var(--muted);
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
}

.modal-root.active {
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  width: min(1120px, calc(100vw - 24px));
  margin: 4vh auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}

.modal-card.narrow {
  width: min(760px, calc(100vw - 24px));
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
  font-size: 20px;
}

.modal-scroll {
  overflow-y: auto;
  padding: 20px 22px;
}

.modal-footer {
  position: sticky;
  bottom: 0;
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid var(--line);
  padding: 16px 22px;
}

.modal-grid-section {
  display: grid;
  gap: 14px;
  margin-bottom: 20px;
}

.modal-grid-section h4 {
  margin: 0;
  font-size: 16px;
}

.code-box,
pre {
  margin: 0;
  padding: 14px;
  border-radius: 16px;
  background: #0f1723;
  color: #f8fafc;
  overflow: auto;
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.code-stack {
  display: grid;
  gap: 12px;
}

.code-item {
  display: grid;
  gap: 8px;
}

.code-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.code-wrap {
  max-width: 100%;
}

.device-token-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(255, 255, 255, 0.96));
}

.device-token-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
}

.token-toolbar {
  justify-content: flex-end;
}

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

.mini-stat {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
}

.mini-stat-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.mini-stat strong {
  font-size: 13px;
  color: var(--text);
  overflow-wrap: anywhere;
}

.compact-curl-field {
  gap: 10px;
}

.compact-code-card {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #f8fbff;
  overflow: hidden;
}

.compact-code-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 12px 0;
  flex-wrap: wrap;
}

.compact-code-tab {
  border: 1px solid var(--line);
  background: white;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
}

.compact-code-tab.active {
  background: var(--brand);
  border-color: transparent;
  color: white;
}

.compact-code-pane {
  display: none;
  padding: 12px;
}

.compact-code-pane.active {
  display: block;
}

.compact-code-pre {
  max-height: 220px;
  min-height: 140px;
}

.compact-code-empty {
  padding: 16px;
  color: var(--muted);
  font-size: 13px;
}

.qr-shell {
  display: grid;
  gap: 16px;
}

.qr-summary {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.07), rgba(15, 23, 42, 0.02));
}

.qr-summary.connected {
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.1), rgba(255, 255, 255, 0.95));
}

.qr-summary.ready {
  background: linear-gradient(135deg, rgba(29, 78, 216, 0.08), rgba(255, 255, 255, 0.95));
}

.qr-summary.waiting {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(255, 255, 255, 0.95));
}

.qr-summary-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.qr-summary p {
  margin: 0;
  color: var(--text);
}

.qr-preview {
  display: grid;
  place-items: center;
  padding: 22px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: radial-gradient(circle at top, rgba(37, 99, 235, 0.08), rgba(255, 255, 255, 0.98) 56%);
}

.qr-image {
  width: min(100%, 320px);
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 20px;
  background: white;
  padding: 14px;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12);
}

.qr-panel {
  display: grid;
  gap: 12px;
}

.qr-inline-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.qr-inline-code {
  min-width: 220px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.qr-details {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fbff;
  padding: 14px;
}

.qr-details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
  list-style: none;
}

.qr-details summary::-webkit-details-marker {
  display: none;
}

.qr-details summary::after {
  content: "Lihat";
  margin-left: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.qr-details[open] summary::after {
  content: "Sembunyikan";
}

.qr-details pre {
  margin-top: 12px;
}

.toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 110;
  display: grid;
  gap: 10px;
}

.toast {
  min-width: 280px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 16px;
  color: white;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
}

.toast.success {
  background: linear-gradient(135deg, #15803d, #166534);
}

.toast.error {
  background: linear-gradient(135deg, #dc2626, #991b1b);
}

.toast.info {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
}

.select-all-cell {
  width: 38px;
}

.toggle {
  position: relative;
  width: 50px;
  height: 28px;
  border-radius: 999px;
  background: #cbd5e1;
  border: 0;
}

.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: white;
  transition: transform 0.18s ease;
}

.toggle.active {
  background: var(--brand);
}

.toggle.active::after {
  transform: translateX(20px);
}

.sidebar-overlay {
  display: none;
}

@media (max-width: 1100px) {
  .grid.two,
  .grid.three,
  .form-grid.two,
  .form-grid.three {
    grid-template-columns: 1fr;
  }

  .device-token-main,
  .device-token-meta {
    grid-template-columns: 1fr;
  }

  .token-toolbar {
    justify-content: flex-start;
  }
}

@media (max-width: 980px) {
  .mobile-menu {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 95;
    background: rgba(15, 23, 42, 0.4);
  }

  .sidebar-overlay.active {
    display: block;
  }

  .main-content {
    padding: 18px;
  }

  .topbar {
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  .hero h2 {
    font-size: 24px;
  }

  .data-table {
    min-width: 760px;
  }

  .modal-card,
  .modal-card.narrow {
    width: calc(100vw - 12px);
    margin: 2vh auto;
    max-height: 96vh;
  }

  .main-content {
    padding: 14px;
  }
}
