:root {
  --navy-950: #07162c;
  --navy-900: #0c1f3f;
  --navy-800: #12315e;
  --navy-700: #184475;
  --blue-600: #2563eb;
  --blue-100: #dbeafe;
  --slate-900: #111827;
  --slate-700: #334155;
  --slate-500: #64748b;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --white: #ffffff;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --violet: #6d28d9;
  --violet-soft: #ede9fe;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  --border: 1px solid rgba(148, 163, 184, 0.22);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #eef3f8;
  color: var(--slate-900);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: 286px;
  flex-direction: column;
  background: var(--navy-950);
  color: var(--white);
  transition: transform 0.24s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 88px;
  padding: 22px 22px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: #eff6ff;
  color: var(--navy-900);
}

.brand-mark svg {
  width: 24px;
  height: 24px;
}

.brand-kicker,
.brand h1,
.page-title span,
.page-title h2,
.panel h3,
.hero-strip h3 {
  margin: 0;
}

.brand-kicker {
  color: #a9bdd7;
  font-size: 12px;
  font-weight: 600;
}

.brand h1 {
  margin-top: 2px;
  color: var(--white);
  font-size: 19px;
  font-weight: 800;
}

.sidebar-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  padding: 16px 14px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #c8d6ea;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
}

.nav-item.active {
  box-shadow: inset 3px 0 0 #60a5fa;
}

.nav-item svg {
  width: 19px;
  height: 19px;
}

.sidebar-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.summary-icon {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: rgba(147, 197, 253, 0.18);
}

.sidebar-summary span,
.sidebar-summary strong {
  display: block;
}

.sidebar-summary span {
  color: #a9bdd7;
  font-size: 12px;
}

.sidebar-summary strong {
  margin-top: 2px;
  font-size: 13px;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  background: rgba(15, 23, 42, 0.46);
}

.main-content {
  width: calc(100% - 286px);
  margin-left: 286px;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
  padding: 14px 18px;
  border: var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.menu-toggle {
  display: none;
}

.page-title span,
.section-label,
.eyebrow {
  color: var(--blue-600);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.page-title h2 {
  margin-top: 3px;
  font-size: 22px;
  line-height: 1.2;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(340px, 28vw);
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  background: var(--slate-50);
  color: var(--slate-500);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--slate-900);
}

.search-box input::placeholder {
  color: var(--slate-500);
}

.icon-button,
.mini-button {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  background: var(--white);
  color: var(--slate-700);
}

.icon-button {
  position: relative;
  width: 44px;
  height: 44px;
}

.icon-button.small,
.mini-button {
  width: 36px;
  height: 36px;
}

.icon-button:hover,
.mini-button:hover {
  border-color: #bfdbfe;
  color: var(--blue-600);
}

.has-badge::after {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--white);
  border-radius: 999px;
  background: var(--red);
  content: "";
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 5px 10px 5px 5px;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  background: var(--white);
}

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--navy-900);
  color: var(--white);
  font-size: 12px;
  font-weight: 800;
}

.user-chip span,
.user-chip strong {
  display: block;
  white-space: nowrap;
}

.user-chip span {
  color: var(--slate-500);
  font-size: 12px;
}

.user-chip strong {
  color: var(--slate-900);
  font-size: 13px;
}

.hero-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 22px;
  padding: 22px;
  border: var(--border);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--navy-900), var(--navy-800));
  color: var(--white);
  box-shadow: var(--shadow);
}

.hero-strip h3 {
  max-width: 760px;
  margin-top: 8px;
  font-size: clamp(20px, 2.4vw, 30px);
  line-height: 1.28;
}

.eyebrow {
  color: #bfdbfe;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 246px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.sync-status svg {
  color: #93c5fd;
}

.sync-status span,
.sync-status strong {
  display: block;
}

.sync-status span {
  color: #c7d7ee;
  font-size: 12px;
}

.sync-status strong {
  margin-top: 2px;
  font-size: 13px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.stat-card,
.panel {
  border: var(--border);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

.stat-card {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  min-width: 0;
  padding: 18px;
}

.stat-icon,
.notification-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
}

.stat-icon {
  width: 44px;
  height: 44px;
}

.stat-icon.navy {
  background: var(--blue-100);
  color: var(--blue-600);
}

.stat-icon.red,
.notification-icon.red {
  background: var(--red-soft);
  color: var(--red);
}

.stat-icon.amber,
.notification-icon.amber {
  background: var(--amber-soft);
  color: var(--amber);
}

.stat-icon.violet {
  background: var(--violet-soft);
  color: var(--violet);
}

.stat-icon.green {
  background: var(--green-soft);
  color: var(--green);
}

.notification-icon.blue {
  background: var(--blue-100);
  color: var(--blue-600);
}

.stat-card span {
  display: block;
  color: var(--slate-500);
  font-size: 13px;
  font-weight: 700;
}

.stat-card strong {
  display: block;
  margin-top: 7px;
  font-size: 28px;
  line-height: 1;
}

.stat-card p {
  margin: 8px 0 0;
  color: var(--slate-500);
  font-size: 12px;
  line-height: 1.4;
}

.dashboard-grid,
.analytics-grid {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.analytics-grid {
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 0.65fr);
  margin-bottom: 20px;
}

.panel {
  min-width: 0;
  padding: 18px;
}

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

.panel-header.compact {
  margin-bottom: 12px;
}

.panel h3 {
  margin-top: 4px;
  font-size: 18px;
}

.primary-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: 800;
  text-decoration: none;
}

.primary-button {
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--navy-800);
  background: var(--navy-900);
  color: var(--white);
}

.primary-button:hover {
  background: var(--navy-800);
}

.text-button {
  min-height: 36px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--blue-600);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--slate-200);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--slate-500);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  color: var(--slate-700);
  font-size: 14px;
}

td strong,
td span {
  display: block;
}

td strong {
  color: var(--slate-900);
  font-weight: 800;
}

td > span:not(.status) {
  margin-top: 4px;
  color: var(--slate-500);
  font-size: 12px;
}

.status {
  display: inline-flex;
  width: max-content;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status.ok {
  background: var(--green-soft);
  color: var(--green);
}

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

.status.replace {
  background: var(--violet-soft);
  color: var(--violet);
}

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

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

.row-actions form {
  display: inline-flex;
}

.mini-button.danger {
  color: var(--red);
}

.mini-button.danger:hover {
  border-color: #fecaca;
  color: var(--red);
}

.notification-list,
.scan-list,
.condition-chart {
  display: grid;
  gap: 12px;
}

.notification-item {
  display: flex;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  background: var(--slate-50);
}

.notification-icon {
  width: 38px;
  height: 38px;
}

.notification-item strong,
.notification-item p,
.notification-item span {
  display: block;
}

.notification-item strong {
  font-size: 14px;
}

.notification-item p {
  margin: 5px 0;
  color: var(--slate-500);
  font-size: 13px;
  line-height: 1.45;
}

.notification-item span {
  color: var(--slate-500);
  font-size: 12px;
  font-weight: 700;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.scan-content {
  display: grid;
  grid-template-columns: 174px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.qr-visual {
  display: grid;
  width: 174px;
  aspect-ratio: 1;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
  padding: 16px;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  background: var(--white);
  box-shadow: inset 0 0 0 8px var(--slate-50);
}

.qr-visual span {
  border-radius: 3px;
  background: var(--slate-200);
}

.qr-visual span:nth-child(1),
.qr-visual span:nth-child(2),
.qr-visual span:nth-child(5),
.qr-visual span:nth-child(6),
.qr-visual span:nth-child(7),
.qr-visual span:nth-child(10),
.qr-visual span:nth-child(13),
.qr-visual span:nth-child(15),
.qr-visual span:nth-child(17),
.qr-visual span:nth-child(20),
.qr-visual span:nth-child(22),
.qr-visual span:nth-child(25),
.qr-visual span:nth-child(27),
.qr-visual span:nth-child(28),
.qr-visual span:nth-child(31),
.qr-visual span:nth-child(33),
.qr-visual span:nth-child(35),
.qr-visual span:nth-child(36) {
  background: var(--navy-900);
}

.scan-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 8px;
  background: var(--slate-50);
}

.scan-item svg {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  margin-top: 1px;
  color: var(--green);
}

.scan-item strong,
.scan-item span {
  display: block;
}

.scan-item strong {
  font-size: 14px;
}

.scan-item span {
  margin-top: 3px;
  color: var(--slate-500);
  font-size: 13px;
  line-height: 1.4;
}

.bar-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 42px;
  gap: 12px;
  align-items: center;
}

.bar-row span,
.bar-row strong {
  font-size: 13px;
  font-weight: 800;
}

.bar-row span {
  color: var(--slate-700);
}

.bar-row strong {
  text-align: right;
}

.bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--slate-100);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
}

.bar-fill.good {
  background: var(--green);
}

.bar-fill.maintenance {
  background: var(--amber);
}

.bar-fill.broken {
  background: var(--red);
}

.bar-fill.replace {
  background: var(--violet);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.category-grid div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  background: var(--slate-50);
}

.category-grid span,
.category-grid strong {
  display: block;
}

.category-grid span {
  color: var(--slate-500);
  font-size: 12px;
  font-weight: 700;
}

.category-grid strong {
  margin-top: 5px;
  font-size: 18px;
}

svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

@media (max-width: 1540px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-grid,
  .analytics-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

  .sidebar-backdrop.is-visible {
    display: block;
  }

  .main-content {
    width: 100%;
    margin-left: 0;
  }

  .menu-toggle {
    display: inline-grid;
  }

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

  .topbar-actions {
    width: 100%;
  }

  .search-box {
    flex: 1;
    width: auto;
  }
}

@media (max-width: 760px) {
  .main-content {
    padding: 14px;
  }

  .topbar {
    gap: 12px;
    padding: 12px;
  }

  .page-title {
    flex: 1;
    min-width: 0;
  }

  .page-title h2 {
    font-size: 18px;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
  }

  .user-chip {
    grid-column: 1 / -1;
    width: 100%;
  }

  .hero-strip {
    align-items: stretch;
    flex-direction: column;
    padding: 18px;
  }

  .sync-status {
    min-width: 0;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-header .primary-button {
    width: 100%;
  }

  .scan-content {
    grid-template-columns: 1fr;
  }

  .qr-visual {
    width: min(100%, 220px);
    margin: 0 auto;
  }

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

  .bar-row {
    grid-template-columns: 86px minmax(0, 1fr) 38px;
  }
}

@media (max-width: 520px) {
  .sidebar {
    width: min(86vw, 286px);
  }

  .topbar-actions {
    grid-template-columns: 1fr auto;
  }

  .topbar-actions .icon-button.has-badge {
    display: none;
  }

  .search-box {
    padding: 0 10px;
  }

  .search-box input::placeholder {
    color: transparent;
  }

  .stat-card {
    padding: 15px;
  }

  .panel {
    padding: 15px;
  }

  .hero-strip h3 {
    font-size: 20px;
  }

  .category-grid {
    grid-template-columns: 1fr;
  }
}

.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding: 13px 15px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 800;
}

.alert.success {
  border: 1px solid #bbf7d0;
  background: var(--green-soft);
  color: #166534;
}

.alert.danger {
  border: 1px solid #fecaca;
  background: var(--red-soft);
  color: #991b1b;
}

.page-grid,
.notification-dashboard {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.form-panel {
  margin-top: 22px;
}

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

.form-grid label,
.filter-actions {
  min-width: 0;
}

.form-grid label span,
.checkbox-line span {
  display: block;
  margin-bottom: 7px;
  color: var(--slate-700);
  font-size: 13px;
  font-weight: 800;
}

.form-grid input,
.form-grid select,
.form-grid textarea,
.filter-actions input,
.filter-actions select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  background: var(--white);
  color: var(--slate-900);
  outline: 0;
  padding: 10px 12px;
}

.form-grid textarea {
  resize: vertical;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.filter-actions input:focus,
.filter-actions select:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

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

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
}

.checkbox-line input {
  width: 18px;
  min-height: 18px;
}

.checkbox-line span {
  margin: 0;
}

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

.filter-actions input {
  width: 180px;
}

.filter-actions select {
  width: 150px;
}

.empty-state {
  margin: 0;
  color: var(--slate-500);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 14px;
}

.qr-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  background: var(--slate-50);
}

.qr-card img {
  width: 150px;
  height: 150px;
  border: 8px solid var(--white);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.qr-card h3,
.qr-card p {
  margin: 0;
}

.qr-card h3 {
  margin-top: 5px;
  font-size: 18px;
}

.qr-card p {
  margin: 7px 0 13px;
  color: var(--slate-500);
  font-size: 13px;
  font-weight: 700;
}

@media (max-width: 760px) {
  .form-grid,
  .qr-card {
    grid-template-columns: 1fr;
  }

  .filter-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .filter-actions input,
  .filter-actions select {
    width: min(100%, 220px);
  }

  .qr-card img {
    justify-self: center;
  }
}
