@import url("https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700&display=swap");

:root {
  --bg: #0f172a;
  --bg-soft: #111827;
  --card: #0b1220;
  --card-border: #1f2937;
  --accent: #22d3ee;
  --accent-strong: #0ea5e9;
  --accent-warm: #f97316;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --success: #22c55e;
  --danger: #ef4444;
  --font-body: "Sora", "Segoe UI", sans-serif;
  --font-display: "Sora", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: radial-gradient(1200px 500px at 80% -20%, rgba(14, 165, 233, 0.25), transparent),
    radial-gradient(900px 450px at 10% 0%, rgba(249, 115, 22, 0.2), transparent),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.auth-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

.card {
  background: rgba(11, 18, 32, 0.92);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  animation: riseIn 0.35s ease both;
  min-width: 0;
}

.card--wide {
  max-width: 520px;
  width: 100%;
}

.brand {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.subtitle {
  color: var(--text-muted);
  margin-top: 6px;
  font-size: 14px;
}

.input {
  width: 100%;
  padding: 12px 14px;
  margin-top: 10px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: #0f172a;
  color: var(--text);
}

.input:focus {
  outline: 2px solid rgba(34, 211, 238, 0.4);
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #0b1220;
  box-shadow: 0 12px 24px rgba(14, 165, 233, 0.3);
}

.btn-secondary {
  background: #111827;
  border-color: var(--card-border);
  color: var(--text);
}

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

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

.btn-sm {
  padding: 8px 12px;
  font-size: 12px;
  border-radius: 10px;
}

.grid {
  display: grid;
  gap: 24px;
  margin-top: 24px;
  align-items: start;
}

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

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

.charts-grid {
  align-items: start;
}

.kpi {
  background: rgba(15, 23, 42, 0.8);
  border-radius: 18px;
  padding: 18px;
  border: 1px solid var(--card-border);
  animation: riseIn 0.35s ease both;
  min-width: 0;
}

.kpi h3 {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

.kpi p {
  margin: 10px 0 0;
  font-size: 26px;
  font-weight: 700;
}

.table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  margin-top: 16px;
}

.table th,
.table td {
  text-align: left;
  padding: 12px 10px;
  font-size: 14px;
  vertical-align: middle;
}

.table th {
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.table thead tr {
  box-shadow: inset 0 -1px 0 rgba(148, 163, 184, 0.15);
}

.table tbody tr {
  box-shadow: inset 0 -1px 0 rgba(148, 163, 184, 0.15);
}

.table-fixed {
  table-layout: fixed;
}

.table-fixed th,
.table-fixed td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card .section-title {
  margin-top: 0;
}

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

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.15);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.section-title {
  margin-top: 32px;
  font-size: 18px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.list-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
}

.col-num {
  text-align: right;
}

.col-actions {
  text-align: right;
}

.table td.table-actions {
  display: table-cell;
  margin-top: 0;
  overflow: visible;
  text-align: right;
}

.inline-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.flash {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.3);
  color: var(--text);
}

.checklist {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  margin-bottom: 16px;
}

.checklist-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--card-border);
}

.checklist-title {
  font-weight: 600;
}

.checklist-note {
  color: var(--text-muted);
  font-size: 12px;
}

.note {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.footer-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.sidebar {
  width: 240px;
  background: rgba(11, 18, 32, 0.96);
  border-right: 1px solid var(--card-border);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex-shrink: 0;
  animation: slideIn 0.35s ease both;
}

.sidebar-brand {
  font-size: 20px;
  font-weight: 700;
}

.sidebar-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  color: var(--text-muted);
  font-size: 12px;
}

.sidebar-footer__meta {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

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

.nav-link {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: transform 0.2s ease, color 0.2s ease, background 0.2s ease, border-color 0.2s ease,
    box-shadow 0.2s ease;
  position: relative;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text);
  border-color: var(--card-border);
  background: rgba(15, 23, 42, 0.8);
  transform: translateX(2px);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.18);
}

.nav-link.is-active {
  color: var(--text);
  border-color: rgba(34, 211, 238, 0.4);
  background: rgba(34, 211, 238, 0.12);
  box-shadow: 0 10px 18px rgba(14, 165, 233, 0.2);
}

.nav-link.is-active::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  position: absolute;
  left: 10px;
}

.main {
  flex: 1;
  padding: 32px 28px 64px;
  min-width: 0;
  width: 100%;
}

.main-inner {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

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

.page-title {
  font-size: 24px;
  font-weight: 700;
  font-family: var(--font-display);
  overflow-wrap: anywhere;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-left: auto;
  justify-content: flex-end;
}

.kpi-grid {
  margin-top: 0;
}

.charts-grid .card {
  min-height: 280px;
}

.chart {
  width: 100%;
  height: 220px;
  margin-top: 12px;
  display: block;
  max-height: 240px;
}

.chart-legend {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot--primary {
  background: var(--accent);
}

.legend-dot--danger {
  background: var(--danger);
}

.legend-dot--muted {
  background: var(--text-muted);
}

.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 12px 22px rgba(2, 6, 23, 0.35);
}

.filter-bar .input,
.inline-form .input {
  margin-top: 0;
}

.filter-bar .input {
  flex: 1 1 200px;
  min-width: 180px;
}

.filter-bar input[type="text"] {
  flex: 2 1 320px;
}

.filter-bar .select {
  min-width: 160px;
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
  flex-wrap: wrap;
}

.filter-actions .btn {
  margin-top: 0;
}

.filter-bar .btn {
  margin-top: 0;
}

.inline-form .input {
  flex: 1 1 240px;
  min-width: 200px;
}
.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% - 3px), calc(100% - 11px) calc(50% - 3px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

.pagination {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
  flex-wrap: wrap;
}

.page-link {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  color: var(--text-muted);
}

.page-link.is-active {
  background: rgba(34, 211, 238, 0.15);
  color: var(--text);
  border-color: rgba(34, 211, 238, 0.5);
}

.page-link.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.pill--danger {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.pill--success {
  background: rgba(34, 197, 94, 0.2);
  color: var(--success);
}

.truncate {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-fixed .truncate {
  display: block;
}

.table td .link {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.menu {
  position: relative;
  display: inline-flex;
  justify-content: flex-end;
}

.menu-trigger {
  list-style: none;
  border: 1px solid var(--card-border);
  background: rgba(15, 23, 42, 0.7);
  color: var(--text);
  border-radius: 10px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 18px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.menu-trigger:hover {
  border-color: rgba(34, 211, 238, 0.4);
  background: rgba(34, 211, 238, 0.12);
  transform: translateY(-1px);
}

.menu-trigger:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.6);
  outline-offset: 2px;
}

.menu-trigger::-webkit-details-marker {
  display: none;
}

.menu-trigger::marker {
  content: "";
}

.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: rgba(11, 18, 32, 0.98);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 8px;
  min-width: 160px;
  z-index: 30;
  box-shadow: 0 16px 30px rgba(2, 6, 23, 0.4);
  white-space: nowrap;
}

.menu[open] .menu-panel {
  animation: riseIn 0.2s ease both;
}

.menu-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}

.menu-item:hover {
  background: rgba(148, 163, 184, 0.12);
}

.menu-item--danger {
  color: #fecaca;
}

.menu-item--danger:hover {
  background: rgba(239, 68, 68, 0.18);
}

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 24px 0;
}

.link {
  color: var(--accent);
}

.qr-shell {
  display: flex;
  gap: 24px;
  align-items: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

.qr-code {
  width: 240px;
  height: 240px;
  padding: 16px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-code canvas,
.qr-code img {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

.qr-meta {
  color: var(--text-muted);
  font-size: 13px;
}

.qr-meta code {
  display: inline-block;
  margin-top: 6px;
}

code {
  background: rgba(15, 23, 42, 0.8);
  color: var(--text);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12px;
}

.visit-row {
  cursor: pointer;
  transition: background 0.2s ease;
}

.visit-row:hover,
.visit-row:focus {
  background: rgba(148, 163, 184, 0.12);
  outline: none;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.65);
  backdrop-filter: blur(4px);
}

.modal__dialog {
  position: relative;
  z-index: 1;
  width: min(640px, 92vw);
  max-height: 80vh;
  overflow: auto;
  background: rgba(11, 18, 32, 0.98);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 24px 40px rgba(2, 6, 23, 0.45);
  animation: riseIn 0.2s ease both;
}

.modal__title {
  margin: 0 0 18px;
  font-size: 18px;
}

.modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(15, 23, 42, 0.6);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
}

.detail-list {
  display: grid;
  gap: 14px;
}

.detail-row {
  display: grid;
  gap: 8px;
}

.detail-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.detail-value {
  font-size: 14px;
  word-break: break-word;
  overflow-wrap: anywhere;
}

@media (max-width: 1200px) {
  .grid--three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--card-border);
  }

  .main {
    padding: 28px 20px 56px;
  }

  .grid--two,
  .grid--three {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .nav {
    flex-direction: row;
    flex-wrap: wrap;
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .table {
    display: block;
    overflow-x: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
