:root {
  --bg: #f7f9fc;
  --card: rgba(255, 255, 255, 0.92);
  --border: rgba(15, 35, 78, 0.1);
  --text: #1c2340;
  --muted: #5d6680;
  --accent: #3a7bd5;
  --accent-2: #00c6ae;
  --shadow: 0 24px 60px rgba(21, 48, 90, 0.08);
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Space Grotesk', 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

.bg-gradient {
  position: fixed;
  inset: -40% -20%;
  background: radial-gradient(circle at 20% 20%, rgba(58, 123, 213, 0.16), transparent 38%),
              radial-gradient(circle at 70% 10%, rgba(0, 198, 174, 0.18), transparent 32%),
              radial-gradient(circle at 60% 70%, rgba(255, 196, 112, 0.14), transparent 36%);
  filter: blur(60px);
  z-index: -2;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 48px 10px;
}

.topbar h1 {
  margin: 4px 0 0;
  font-size: 21px;
  letter-spacing: -0.02em;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

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

.status {
  font-size: 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  padding: 6px 10px;
  border: 1px solid var(--border);
}

.ghost {
  background: linear-gradient(120deg, rgba(58, 123, 213, 0.15), rgba(0, 198, 174, 0.18));
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border 0.12s ease;
}

.ghost:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: var(--shadow);
}

.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  padding: 0 48px 48px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
}

.panel h2 {
  margin: 4px 0 0;
}

.legend {
  display: flex;
  gap: 6px;
}

.badge {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.badge.text { background: rgba(0, 198, 174, 0.12); color: #067d6d; }
.badge.file { background: rgba(58, 123, 213, 0.12); color: #3a7bd5; }

.list {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  padding: 8px 12px 16px;
}

.list::-webkit-scrollbar {
  width: 8px;
}
.list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
}

.item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  padding: 12px 14px;
  margin: 6px 0;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: border 0.12s ease, background 0.12s ease, transform 0.12s ease;
}

.item:hover {
  border-color: var(--border);
  transform: translateY(-1px);
}

.item.active {
  border-color: rgba(109, 240, 194, 0.45);
  background: linear-gradient(120deg, rgba(109, 240, 194, 0.09), rgba(122, 162, 255, 0.08));
}

.item .title {
  margin: 0 0 4px;
  font-weight: 600;
}

.item .summary {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.meta {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.pill {
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  font-size: 12px;
}

.detail-body {
  padding: 0 20px 20px;
  min-height: 240px;
}

.detail-card {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.detail-body.empty {
  color: var(--muted);
}

.mono {
  font-family: 'JetBrains Mono', 'SFMono-Regular', Menlo, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
}

.hint {
  padding: 12px 16px;
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;
}
.modal.hidden {
  display: none;
}
.modal-card {
  width: min(760px, 90vw);
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 18px 20px 20px;
  border: 1px solid var(--border);
}
.modal-card.wide {
  width: min(900px, 95vw);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.modal-list {
  max-height: 60vh;
}
.input-label {
  font-size: 13px;
  color: var(--muted);
  margin: 6px 0 4px;
  display: block;
}
.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.editor {
  width: 100%;
  margin: 0 0 10px;
  min-height: 180px;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 12px;
  font-family: 'JetBrains Mono', 'SFMono-Regular', Menlo, monospace;
  font-size: 12px;
  background: #fff;
  color: var(--text);
}

.obsidian-panel .list {
  max-height: calc(100vh - 220px);
}
.obsidian-breadcrumb {
  padding: 8px 12px;
  font-size: 13px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.obsidian-entry {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  margin: 4px 0;
  display: flex;
  justify-content: space-between;
  cursor: pointer;
}
.obsidian-entry:hover {
  border-color: var(--border);
  background: rgba(58, 123, 213, 0.06);
}

.links {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: linear-gradient(120deg, rgba(122, 162, 255, 0.18), rgba(109, 240, 194, 0.16));
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 0 16px 24px;
  }
  .list {
    max-height: 260px;
  }
  .panel {
    backdrop-filter: blur(2px);
  }
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .actions {
    flex-wrap: wrap;
  }
  .layout {
    grid-template-columns: 1fr;
  }
}
