/* ============================================================
   VAULT — Private Intelligence Database
   Stylesheet v1.0
   Black & White minimalist design
   ============================================================ */

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

:root {
  --black:       #0a0a0a;
  --white:       #ffffff;
  --gray-100:    #f7f7f7;
  --gray-200:    #eeeeee;
  --gray-300:    #dddddd;
  --gray-400:    #aaaaaa;
  --gray-500:    #777777;
  --gray-700:    #333333;
  --sidebar-w:   220px;
  --font-main:   'Inter', sans-serif;
  --font-mono:   'JetBrains Mono', monospace;
  --radius:      6px;
  --shadow:      0 1px 4px rgba(0,0,0,0.08);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.12);
}

html, body { height: 100%; background: var(--gray-100); color: var(--black); font-family: var(--font-main); font-size: 15px; line-height: 1.6; }

/* ── SIDEBAR ── */
.sidebar {
  position: fixed; top: 0; left: 0; width: var(--sidebar-w); height: 100vh;
  background: var(--black); color: var(--white);
  display: flex; flex-direction: column;
  z-index: 200; transition: transform .25s ease;
}
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 24px 20px 20px; border-bottom: 1px solid #1e1e1e; }
.logo { font-family: var(--font-mono); font-size: 18px; font-weight: 500; letter-spacing: 0.2em; }
.sidebar-close { display: none; background: none; border: none; color: var(--gray-400); font-size: 18px; cursor: pointer; }
.nav-links { list-style: none; padding: 16px 0; flex: 1; overflow-y: auto; }
.nav-links li { }
.nav-links a { display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: var(--gray-400); text-decoration: none; font-size: 14px; font-weight: 400; transition: all .15s; }
.nav-links a:hover { color: var(--white); background: #111; }
.nav-links a.active { color: var(--white); background: #1a1a1a; border-left: 2px solid var(--white); }
.nav-icon { font-size: 13px; opacity: .6; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid #1e1e1e; }
.logout-btn { color: var(--gray-500); font-size: 13px; text-decoration: none; font-family: var(--font-mono); transition: color .15s; }
.logout-btn:hover { color: var(--white); }

/* ── MAIN WRAP ── */
.main-wrap { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: none; }
.content { flex: 1; padding: 32px 36px; max-width: 1200px; }
.site-footer { padding: 16px 36px; font-family: var(--font-mono); font-size: 11px; color: var(--gray-400); border-top: 1px solid var(--gray-200); text-align: center; margin-left: 0; }

/* ── NAV OVERLAY (mobile) ── */
.nav-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 199; }

/* ── PAGE HEADER ── */
.page-header { margin-bottom: 28px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 600; font-family: var(--font-mono); letter-spacing: -.01em; }
.page-subtitle { font-size: 13px; color: var(--gray-500); margin-top: 2px; }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: var(--radius); font-size: 14px; font-weight: 500; cursor: pointer; border: none; transition: all .15s; text-decoration: none; }
.btn-primary { background: var(--black); color: var(--white); }
.btn-primary:hover { background: var(--gray-700); }
.btn-secondary { background: var(--white); color: var(--black); border: 1px solid var(--gray-300); }
.btn-secondary:hover { background: var(--gray-100); }
.btn-danger { background: #fff; color: #c00; border: 1px solid #fcc; }
.btn-danger:hover { background: #fee; }
.btn-sm { padding: 5px 12px; font-size: 13px; }

/* ── CARDS ── */
.card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card-sm { padding: 16px; }

/* ── STAT GRID ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 20px; }
.stat-number { font-family: var(--font-mono); font-size: 28px; font-weight: 600; line-height: 1; }
.stat-label { font-size: 12px; color: var(--gray-500); margin-top: 6px; text-transform: uppercase; letter-spacing: .05em; }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-500); border-bottom: 2px solid var(--gray-200); }
td { padding: 12px 14px; border-bottom: 1px solid var(--gray-200); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-100); }
.table-link { color: var(--black); text-decoration: none; font-weight: 500; }
.table-link:hover { text-decoration: underline; }

/* ── PERSON AVATAR ── */
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--gray-200); border: 1px solid var(--gray-300); }
.avatar-lg { width: 80px; height: 80px; }
.avatar-xl { width: 120px; height: 120px; }
.avatar-placeholder { width: 36px; height: 36px; border-radius: 50%; background: var(--black); color: var(--white); display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 13px; font-weight: 600; flex-shrink: 0; }
.avatar-placeholder.lg { width: 80px; height: 80px; font-size: 26px; }
.avatar-placeholder.xl { width: 120px; height: 120px; font-size: 36px; }

/* ── FORMS ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-700); }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius);
  font-family: var(--font-main); font-size: 14px; color: var(--black);
  background: var(--white); transition: border-color .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--black); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-section { margin-bottom: 28px; }
.form-section-title { font-family: var(--font-mono); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--gray-400); border-bottom: 1px solid var(--gray-200); padding-bottom: 8px; margin-bottom: 16px; }
.form-actions { display: flex; gap: 10px; align-items: center; padding-top: 8px; }
.form-hint { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

/* ── ALERTS ── */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 14px; margin-bottom: 16px; }
.alert-success { background: #f0fff4; border: 1px solid #9ae6b4; color: #276749; }
.alert-error   { background: #fff5f5; border: 1px solid #feb2b2; color: #9b2c2c; }
.alert-info    { background: #f7f7f7; border: 1px solid var(--gray-300); color: var(--gray-700); }

/* ── SEARCH BAR ── */
.search-bar { position: relative; }
.search-input { width: 100%; padding: 11px 16px 11px 40px; border: 1px solid var(--gray-300); border-radius: var(--radius); font-size: 15px; font-family: var(--font-main); }
.search-input:focus { outline: none; border-color: var(--black); }
.search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--gray-400); font-size: 16px; pointer-events: none; }

/* ── PROFILE PAGE ── */
.profile-hero { display: flex; gap: 24px; align-items: flex-start; margin-bottom: 28px; padding: 28px; background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); }
.profile-info { flex: 1; }
.profile-name { font-family: var(--font-mono); font-size: 26px; font-weight: 600; }
.profile-sub  { font-size: 14px; color: var(--gray-500); margin-top: 4px; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 16px; }
.meta-item { display: flex; flex-direction: column; gap: 2px; }
.meta-label { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--gray-400); font-weight: 600; }
.meta-value { font-size: 14px; }

.profile-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--gray-200); margin-bottom: 24px; }
.tab-btn { padding: 10px 18px; background: none; border: none; font-size: 14px; font-weight: 500; color: var(--gray-500); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .15s; }
.tab-btn.active { color: var(--black); border-bottom-color: var(--black); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── RELATIONSHIP BADGE ── */
.rel-badge { display: inline-block; padding: 2px 10px; border: 1px solid var(--gray-300); border-radius: 20px; font-size: 12px; color: var(--gray-700); }

/* ── GALLERY ── */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.gallery-item { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: var(--radius); border: 1px solid var(--gray-200); cursor: pointer; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.gallery-item:hover img { transform: scale(1.04); }
.gallery-caption { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; padding: 4px 8px; opacity: 0; transition: opacity .2s; }
.gallery-item:hover .gallery-caption { opacity: 1; }

/* ── LINK ITEMS ── */
.link-item { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--gray-200); }
.link-item:last-child { border-bottom: none; }
.link-icon { width: 32px; height: 32px; background: var(--gray-100); border: 1px solid var(--gray-200); border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.link-info { flex: 1; }
.link-title { font-weight: 500; font-size: 14px; }
.link-url { font-size: 12px; color: var(--gray-400); font-family: var(--font-mono); }
.link-desc { font-size: 13px; color: var(--gray-500); margin-top: 2px; }

/* ── ACTIVITY LOG ── */
.activity-item { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--gray-200); }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--black); margin-top: 7px; flex-shrink: 0; }
.activity-content { flex: 1; }
.activity-action { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.activity-desc { font-size: 14px; color: var(--gray-700); }
.activity-time { font-size: 11px; color: var(--gray-400); font-family: var(--font-mono); margin-top: 2px; }

/* ── GRAPH VIEW ── */
#cy { width: 100%; height: 520px; border: 1px solid var(--gray-200); border-radius: var(--radius); background: var(--white); }

/* ── PEOPLE GRID ── */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.person-card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 20px; text-align: center; text-decoration: none; color: var(--black); transition: all .15s; display: block; }
.person-card:hover { border-color: var(--black); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.person-card-name { font-weight: 600; margin-top: 10px; font-size: 15px; }
.person-card-sub { font-size: 12px; color: var(--gray-500); margin-top: 3px; }

/* ── MENTIONS ── */
.mention-wrap { position: relative; }
.mention-dropdown { position: absolute; top: 100%; left: 0; width: 260px; background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow-md); z-index: 100; display: none; max-height: 200px; overflow-y: auto; }
.mention-item { padding: 9px 14px; font-size: 14px; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.mention-item:hover { background: var(--gray-100); }
.mention-name { font-weight: 500; }
.mention-link { color: var(--black); font-weight: 600; text-decoration: underline; cursor: pointer; }

/* ── MODAL ── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 500; align-items: center; justify-content: center; padding: 16px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--white); border-radius: var(--radius); padding: 28px; max-width: 500px; width: 100%; max-height: 90vh; overflow-y: auto; }
.modal-title { font-family: var(--font-mono); font-size: 16px; font-weight: 600; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ── FULLSCREEN IMAGE ── */
.fullscreen-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 600; align-items: center; justify-content: center; }
.fullscreen-overlay.open { display: flex; }
.fullscreen-overlay img { max-width: 92vw; max-height: 92vh; object-fit: contain; }
.fullscreen-close { position: absolute; top: 20px; right: 24px; color: #fff; font-size: 28px; cursor: pointer; background: none; border: none; }

/* ── LOGIN PAGE ── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--black); }
.login-box { background: var(--white); border-radius: var(--radius); padding: 40px 36px; width: 100%; max-width: 360px; }
.login-logo { font-family: var(--font-mono); font-size: 26px; font-weight: 600; letter-spacing: .2em; text-align: center; margin-bottom: 4px; }
.login-tagline { font-size: 11px; color: var(--gray-400); text-align: center; font-family: var(--font-mono); margin-bottom: 32px; }
.login-footer { text-align: center; margin-top: 24px; font-size: 11px; color: var(--gray-400); font-family: var(--font-mono); }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-icon { font-size: 40px; opacity: .2; margin-bottom: 12px; }
.empty-title { font-size: 16px; font-weight: 600; }
.empty-sub { font-size: 13px; color: var(--gray-500); margin-top: 4px; }

/* ── BADGE ── */
.badge { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; background: var(--gray-200); color: var(--gray-700); }

/* ── MISC ── */
.divider { height: 1px; background: var(--gray-200); margin: 24px 0; }
.text-mono { font-family: var(--font-mono); }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 13px; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .nav-overlay.open { display: block; }
  .main-wrap { margin-left: 0; }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 0 16px; height: 54px; background: var(--black); color: var(--white); position: sticky; top: 0; z-index: 100; }
  .topbar-title { font-family: var(--font-mono); font-size: 16px; letter-spacing: .2em; }
  .topbar-add { color: var(--white); font-size: 22px; text-decoration: none; }
  .hamburger { background: none; border: none; cursor: pointer; display: flex; flex-direction: column; gap: 5px; padding: 4px; }
  .hamburger span { display: block; width: 22px; height: 2px; background: var(--white); border-radius: 2px; }
  .content { padding: 20px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
  .profile-hero { flex-direction: column; align-items: center; text-align: center; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .people-grid { grid-template-columns: repeat(2, 1fr); }
  .page-header { flex-direction: column; }
}
