/* === Design System: investors.silo.co === */

:root {
  --color-bg:            #F5F6F8;
  --color-surface:       #FFFFFF;
  --color-surface-hover: #F0F1F4;
  --color-border:        #E2E4EA;

  --color-text-primary:   #1A1D26;
  --color-text-secondary: #5F6478;
  --color-text-muted:     #9398AB;

  --color-accent:        #0D9488;
  --color-accent-dim:    #14B8A6;
  --color-accent-glow:   rgba(13, 148, 136, 0.1);

  --color-positive:      #059669;
  --color-warning:       #D97706;
  --color-negative:      #DC2626;

  --color-tier-1:        #0D9488;
  --color-tier-2:        #3B82F6;
  --color-tier-3:        #9398AB;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --font-display: 'Clash Display', sans-serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

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

html, body {
  background: var(--color-bg);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* === Layout === */

.layout {
  display: grid;
  grid-template-columns: 160px 1fr;
  grid-template-rows: 56px 1fr;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  grid-column: 1 / -1;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 100;
  position: sticky;
  top: 0;
}

.topbar-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--color-accent);
  white-space: nowrap;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-logo-img {
  height: 18px;
  width: auto;
}

.topbar-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.topbar-search input {
  width: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 8px 12px 8px 36px;
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease;
}

.topbar-search input:focus {
  border-color: var(--color-accent-dim);
  box-shadow: 0 0 0 2px var(--color-accent-glow);
}

.topbar-search::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border: 2px solid var(--color-text-muted);
  border-radius: 50%;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-user {
  font-size: 12px;
  color: var(--color-text-secondary);
}

/* === Nav Rail === */

.nav-rail {
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 16px 8px;
  gap: 4px;
  width: 160px;
  transition: width 0.2s var(--ease);
  overflow: hidden;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
}

.nav-item {
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: all 0.15s ease;
  border: none;
  background: none;
  font-size: 18px;
}

.nav-label {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.nav-item:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-secondary);
}

.nav-item.active {
  background: var(--color-accent-glow);
  color: var(--color-accent);
}

.nav-divider {
  width: 24px;
  height: 1px;
  background: var(--color-border);
  margin: 8px 0;
}

/* === Content === */

.content {
  padding: 32px;
  max-width: 1280px;
  overflow-y: auto;
  height: calc(100vh - 56px);
}

.page-header {
  margin-bottom: 24px;
}

.content-sticky-header {
  position: sticky;
  top: -32px;
  z-index: 10;
  background: var(--color-bg);
  padding-top: 32px;
  margin-top: -32px;
  padding-bottom: 0;
}

.page-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  line-height: 1.1;
  margin-bottom: 4px;
}

.page-subtitle {
  color: var(--color-text-secondary);
  font-size: 13px;
}

/* === Cards === */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 20px 24px;
  transition: border-color 0.15s ease;
  animation: fadeUp 0.4s var(--ease) both;
}

.card:hover {
  border-color: var(--color-accent-dim);
}

.card-clickable { cursor: pointer; }

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

.card:nth-child(1)  { animation-delay: 0.02s; }
.card:nth-child(2)  { animation-delay: 0.04s; }
.card:nth-child(3)  { animation-delay: 0.06s; }
.card:nth-child(4)  { animation-delay: 0.08s; }
.card:nth-child(5)  { animation-delay: 0.10s; }
.card:nth-child(6)  { animation-delay: 0.12s; }
.card:nth-child(7)  { animation-delay: 0.14s; }
.card:nth-child(8)  { animation-delay: 0.16s; }
.card:nth-child(9)  { animation-delay: 0.18s; }
.card:nth-child(10) { animation-delay: 0.20s; }

/* === List === */

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

.list-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
}

.list-item-main {
  min-width: 0;
}

.list-item-name {
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-meta {
  font-size: 12px;
  color: var(--color-text-secondary);
  display: flex;
  gap: 12px;
  margin-top: 2px;
  flex-wrap: wrap;
}

.list-item-actions {
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.card:hover .list-item-actions {
  opacity: 1;
}

.list-item-actions .btn-star {
  opacity: 1;
}

/* === Badges === */

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.badge-vc     { background: rgba(13, 148, 136, 0.1); color: var(--color-tier-1); }
.badge-pe     { background: rgba(59, 130, 246, 0.1); color: var(--color-tier-2); }
.badge-other  { background: rgba(147, 152, 171, 0.12); color: var(--color-tier-3); }

.badge-acquired { background: rgba(217, 119, 6, 0.1); color: var(--color-warning); }
.badge-public   { background: rgba(5, 150, 105, 0.1); color: var(--color-positive); }
.badge-private  { background: rgba(147, 152, 171, 0.12); color: var(--color-tier-3); }
.badge-open_source { background: rgba(59, 130, 246, 0.1); color: var(--color-tier-2); }
.badge-competitor { background: rgba(220, 38, 38, 0.1); color: #DC2626; font-weight: 600; }
.badge-competitive-warn { background: rgba(234, 88, 12, 0.1); color: #EA580C; font-weight: 600; }


/* === Buttons === */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  outline: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-accent);
  color: #FFFFFF;
}
.btn-primary:hover { background: #0F766E; }

.btn-secondary {
  background: transparent;
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover {
  border-color: var(--color-text-muted);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
}
.btn-ghost:hover { color: var(--color-text-primary); }

.btn-danger {
  background: transparent;
  color: var(--color-negative);
  border: 1px solid rgba(220, 38, 38, 0.25);
}
.btn-danger:hover {
  background: rgba(220, 38, 38, 0.06);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-icon {
  padding: 6px;
  width: 32px;
  height: 32px;
  justify-content: center;
}

/* === Toolbar === */

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar-spacer { flex: 1; }

.filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill {
  padding: 4px 12px;
  font-size: 12px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.15s ease;
}

.filter-pill:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text-primary);
}

.filter-pill.active {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-glow);
}

/* === Detail View === */

.detail {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
}

.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-secondary);
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 16px;
  background: none;
  border: none;
  font-family: var(--font-body);
}
.detail-back:hover { color: var(--color-accent); }

.detail-header {
  margin-bottom: 24px;
}

.detail-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 32px;
  line-height: 1.1;
}

.detail-subtitle {
  color: var(--color-text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

.detail-section {
  margin-bottom: 24px;
}

.detail-section-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

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

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

.detail-field-value {
  font-size: 14px;
  font-weight: 500;
}

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

/* === Fit Score Bar === */

.fit-score {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fit-bar {
  flex: 1;
  max-width: 120px;
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
}

.fit-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s var(--ease);
}

.fit-bar-fill.tier-1 { background: var(--color-tier-1); }
.fit-bar-fill.tier-2 { background: var(--color-tier-2); }
.fit-bar-fill.tier-3 { background: var(--color-tier-3); }

.fit-label {
  font-family: var(--font-mono);
  font-size: 13px;
  min-width: 32px;
}

/* === Data Table === */

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: var(--color-surface);
}

.data-table td {
  padding: 10px 12px;
  font-size: 13px;
  border-bottom: 1px solid rgba(226, 228, 234, 0.6);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: var(--color-surface-hover);
}

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

.data-table .link {
  color: var(--color-accent);
  cursor: pointer;
}
.data-table .link:hover { text-decoration: underline; }

/* === Portfolio Cards === */

.portfolio-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.portfolio-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  display: flex;
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.portfolio-card:hover {
  border-color: var(--color-accent-dim);
}

.portfolio-card-partner,
.portfolio-card-company {
  flex: 1;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.portfolio-card-partner {
  background: var(--color-bg);
}

.portfolio-card-divider {
  width: 1px;
  background: var(--color-border);
  flex-shrink: 0;
}

.portfolio-card-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}

.portfolio-card-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-primary);
  line-height: 1.3;
}

.portfolio-card-meta {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

@media (max-width: 480px) {
  .portfolio-card {
    flex-direction: column;
  }
  .portfolio-card-divider {
    width: 100%;
    height: 1px;
  }
}

.link { color: var(--color-accent); cursor: pointer; }
.link:hover { text-decoration: underline; }

.link-subtle { color: var(--color-accent); cursor: pointer; opacity: 0.85; }
.link-subtle:hover { text-decoration: underline; opacity: 1; }

/* === Modal === */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  animation: modalIn 0.2s var(--ease);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--color-border);
}

.modal-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 20px;
  padding: 4px;
  line-height: 1;
}
.modal-close:hover { color: var(--color-text-primary); }

.modal-body {
  padding: 20px 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--color-border);
}

/* === Form === */

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 8px 12px;
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-accent-dim);
  box-shadow: 0 0 0 2px var(--color-accent-glow);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238B8FA3' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.form-textarea { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* === Skeleton === */

.skeleton {
  background: linear-gradient(90deg, var(--color-surface) 25%, var(--color-surface-hover) 50%, var(--color-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-line {
  height: 14px;
  margin-bottom: 8px;
}

.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-80 { width: 80%; }

/* === Activity Log === */

.activity-panel {
  position: fixed;
  right: 0;
  top: 56px;
  bottom: 0;
  width: 340px;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  transform: translateX(100%);
  transition: transform 0.3s var(--ease);
  z-index: 90;
  display: flex;
  flex-direction: column;
}

.activity-panel.open { transform: translateX(0); }

.activity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}

.activity-header h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
}

.activity-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.activity-item {
  padding: 10px 20px;
  border-bottom: 1px solid rgba(226, 228, 234, 0.5);
}

.activity-item-action {
  font-size: 13px;
}

.activity-item-action .act-create { color: var(--color-positive); }
.activity-item-action .act-update { color: var(--color-tier-2); }
.activity-item-action .act-delete { color: var(--color-negative); }

.activity-item-time {
  font-size: 11px;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  margin-top: 2px;
}

/* === Login === */

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  flex-direction: column;
  gap: 24px;
}

.login-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 36px;
  color: var(--color-accent);
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-sub {
  color: var(--color-text-secondary);
  font-size: 14px;
  margin-top: -16px;
}

/* === Responsive === */

@media (max-width: 1024px) {
  .detail { grid-template-columns: 1fr; }
  .activity-panel { width: 100%; }
}

@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: 56px 1fr 52px;
  }
  .nav-rail {
    grid-row: 3;
    flex-direction: row;
    width: 100%;
    height: 52px;
    border-right: none;
    border-top: 1px solid var(--color-border);
    justify-content: center;
    padding: 0 16px;
    position: fixed;
    bottom: 0;
    top: auto;
    align-items: center;
  }
  .nav-item { width: auto; justify-content: center; padding: 0; }
  .nav-label { display: none; }
  .content { padding: 16px; padding-bottom: 68px; height: calc(100vh - 56px - 52px); }
  .topbar-search { display: none; }
}

/* === Toast === */

.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.toast {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 10px 20px;
  font-size: 13px;
  animation: fadeUp 0.3s var(--ease);
  max-width: 400px;
}
