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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 700px at 88% -12%, rgba(224, 163, 62, 0.07), transparent 60%),
    radial-gradient(900px 620px at -8% 108%, rgba(226, 80, 63, 0.05), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgba(224, 163, 62, 0.32);
  color: var(--ink);
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.mono {
  font-family: var(--font-mono);
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  z-index: 40;
  display: flex;
  flex-direction: column;
  padding: 22px 14px 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(28, 25, 21, 0.55), rgba(12, 11, 9, 0.35));
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 10px 22px;
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  width: 32px;
  height: 32px;
  padding: 6px 5px;
  background: var(--accent);
  border-radius: 9px;
  flex: none;
}

.brand-mark i {
  display: block;
  width: 4px;
  border-radius: 1px;
  background: var(--accent-ink);
}

.brand-mark i:nth-child(1) {
  height: 8px;
}

.brand-mark i:nth-child(2) {
  height: 16px;
}

.brand-mark i:nth-child(3) {
  height: 11px;
}

.brand-name {
  display: block;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.015em;
}

.brand-sub {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}

.nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--ink-muted);
  font-size: 13.5px;
  text-decoration: none;
  transition: background var(--duration-fast), color var(--duration-fast);
}

.nav a .icon {
  width: 17px;
  height: 17px;
  opacity: 0.75;
}

.nav a:hover {
  background: rgba(239, 232, 220, 0.05);
  color: var(--ink);
}

.nav a.active {
  color: var(--ink);
  background: linear-gradient(90deg, rgba(224, 163, 62, 0.15), rgba(224, 163, 62, 0.02));
}

.nav a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scan-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.015);
}

.scan-line {
  display: flex;
  align-items: center;
  gap: 7px;
}

.scan-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 3px rgba(10, 172, 35, 0.15);
}

.scan-dot.is-busy {
  background: var(--warning);
  box-shadow: 0 0 0 3px rgba(251, 179, 21, 0.16);
  animation: pulse 1.1s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

.scan-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.scan-path {
  margin: 7px 0 9px;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.5;
  color: var(--ink-faint);
  overflow-wrap: anywhere;
}

.scan-btn {
  width: 100%;
  justify-content: center;
}

.sidebar-ver {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  text-align: center;
}

.main {
  grid-column: 2;
  min-width: 0;
  padding: 0 34px 72px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 0 15px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in oklab, var(--bg) 84%, transparent);
  backdrop-filter: blur(12px);
}

.topbar-title h1 {
  margin-top: 3px;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view {
  padding-top: 26px;
  animation: view-in var(--duration) var(--ease);
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.bottom-nav {
  display: none;
}

.global-tip {
  position: fixed;
  z-index: 120;
  pointer-events: none;
  padding: 7px 10px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  background: var(--surface-3);
  color: var(--ink);
  font-size: 12px;
  box-shadow: var(--shadow-float);
  transform: translate(-50%, -100%);
  white-space: nowrap;
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .main {
    grid-column: 1;
    padding: 0 18px calc(84px + env(safe-area-inset-bottom));
  }

  .topbar {
    padding: 14px 0 12px;
  }

  .topbar-title h1 {
    font-size: 23px;
  }

  .topbar-actions .btn span {
    display: none;
  }

  .bottom-nav {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    border-top: 1px solid var(--line);
    background: color-mix(in oklab, var(--bg) 92%, transparent);
    backdrop-filter: blur(16px);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 0 8px;
    color: var(--ink-faint);
    font-size: 9.5px;
    text-decoration: none;
    font-family: var(--font-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .bottom-nav a .icon {
    width: 19px;
    height: 19px;
  }

  .bottom-nav a.active {
    color: var(--accent);
  }
}

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

  .topbar-actions .btn {
    padding: 10px 11px;
  }
}
