/* ============================================================
   DocHub — main.css
   Design system: Midnight Indigo, DM Sans + DM Mono
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Mono:wght@300;400;500&display=swap');

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
img, svg { display: block; }
button, input, select, textarea { font-family: inherit; }
a { text-decoration: none; color: inherit; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; }

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  /* Base palette */
  --bg-0:        #080910;
  --bg-1:        #0d0f1c;
  --bg-2:        #111425;
  --bg-3:        #161929;
  --surface-1:   #1c2035;
  --surface-2:   #212540;
  --surface-3:   #2a2f50;

  /* Brand */
  --indigo:      #7c6af7;
  --indigo-hi:   #9f90ff;
  --indigo-lo:   rgba(124,106,247,0.14);
  --indigo-glow: rgba(124,106,247,0.32);
  --grad:        linear-gradient(135deg, #6757e8 0%, #9f90ff 100%);
  --grad-hero:   radial-gradient(ellipse 70% 50% at 50% -10%, rgba(107,87,232,0.28) 0%, transparent 70%);

  /* Semantic */
  --text-1:      #eef0f8;
  --text-2:      #9ca1bf;
  --text-3:      #565c80;
  --border-1:    rgba(255,255,255,0.07);
  --border-2:    rgba(255,255,255,0.12);

  /* Status */
  --green:       #3ecf8e;
  --red:         #f26479;
  --yellow:      #f5c84a;
  --blue:        #5ba6f7;

  /* Shape */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  20px;
  --r-2xl: 26px;

  /* Sidebar */
  --sidebar-w: 238px;

  /* Shadow */
  --shadow-glow: 0 0 32px rgba(124,106,247,0.35);
  --shadow-card: 0 4px 24px rgba(0,0,0,0.35);
  --shadow-modal: 0 24px 80px rgba(0,0,0,0.6);

  /* Transition */
  --t: 150ms ease;
  --t-md: 220ms ease;
}

/* ============================================================
   BODY / APP SHELL
   ============================================================ */
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-0);
  color: var(--text-1);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ── Login wrapper (active when logged out) ── */
body.auth-screen #app { display: none; }
body.auth-screen #auth-screen { display: flex; }
#auth-screen { display: none; }

/* ============================================================
   AUTH SCREEN
   ============================================================ */
#auth-screen {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
#auth-screen::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--grad-hero);
  pointer-events: none;
}
/* subtle grid texture */
#auth-screen::after {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--border-1) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-1) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse 60% 60% at 50% 30%, black 0%, transparent 80%);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-2xl);
  padding: 40px 36px;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-modal);
  animation: fadeUp .35s ease both;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  justify-content: center;
  margin-bottom: 28px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.4px;
}
.auth-brand-icon {
  width: 40px; height: 40px;
  background: var(--grad);
  border-radius: 12px;
  display: grid; place-items: center;
  box-shadow: var(--shadow-glow);
}

.auth-card h2 { font-size: 21px; font-weight: 700; letter-spacing: -.4px; }
.auth-card > p { color: var(--text-2); font-size: 13.5px; margin-top: 4px; }

.auth-footer-text {
  text-align: center;
  font-size: 13px;
  color: var(--text-2);
  margin-top: 22px;
}
.auth-footer-text a { color: var(--indigo-hi); font-weight: 600; cursor: pointer; }
.auth-footer-text a:hover { text-decoration: underline; }

/* ============================================================
   APP LAYOUT
   ============================================================ */
#app {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-0);
  border-right: 1px solid var(--border-1);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 14px 16px;
  border-bottom: 1px solid var(--border-1);
  cursor: pointer;
}
.sidebar-brand-icon {
  width: 34px; height: 34px;
  background: var(--grad);
  border-radius: 10px;
  display: grid; place-items: center;
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}
.sidebar-brand-name {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -.3px;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 12px 10px 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: var(--r-md);
  color: var(--text-2);
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  transition: background var(--t), color var(--t);
  user-select: none;
}
.nav-item:hover { background: var(--surface-1); color: var(--text-1); }
.nav-item.active { background: var(--indigo-lo); color: var(--indigo-hi); }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-footer {
  border-top: 1px solid var(--border-1);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--indigo-lo);
  border: 1.5px solid var(--indigo);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--indigo-hi);
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-email {
  font-size: 11.5px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-role { font-size: 11px; color: var(--text-3); text-transform: capitalize; }

/* ── MAIN ── */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: 52px;
  border-bottom: 1px solid var(--border-1);
  display: flex;
  align-items: center;
  padding: 0 28px;
  background: rgba(8,9,16,0.85);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 10px;
}
.topbar-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
}
.topbar-spacer { flex: 1; }

/* ── PAGE ── */
.page {
  padding: 32px 28px;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 28px;
}
.page-header-left h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.5px;
}
.page-header-left p {
  color: var(--text-2);
  font-size: 13.5px;
  margin-top: 4px;
}

/* ── VIEW TRANSITIONS ── */
.view { display: none; animation: fadeUp .2s ease both; }
.view.active { display: block; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ============================================================
   FORM CONTROLS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

label.field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
  letter-spacing: .01em;
}

.input {
  width: 100%;
  padding: 10px 13px;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  color: var(--text-1);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
}
.input:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px var(--indigo-lo);
}
.input::placeholder { color: var(--text-3); }
.input:disabled { opacity: .5; cursor: not-allowed; }

textarea.input { resize: vertical; min-height: 92px; }

input[type="file"].input { padding: 8px 13px; cursor: pointer; }
input[type="file"].input::file-selector-button {
  background: var(--indigo-lo);
  color: var(--indigo-hi);
  border: 1px solid rgba(124,106,247,0.28);
  border-radius: var(--r-sm);
  padding: 4px 11px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  margin-right: 10px;
  transition: background var(--t);
}
input[type="file"].input::file-selector-button:hover { background: rgba(124,106,247,0.24); }

.select-wrap { position: relative; }
.select-wrap .chevron-icon {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  width: 14px; height: 14px;
  color: var(--text-3);
}
select.select {
  appearance: none;
  padding: 10px 34px 10px 13px;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  color: var(--text-1);
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: border-color var(--t);
  width: 100%;
}
select.select:focus { border-color: var(--indigo); }

.input-search-wrap { position: relative; }
.input-search-wrap .search-icon {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  color: var(--text-3);
  pointer-events: none;
}
.input-search-wrap .input { padding-left: 34px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all var(--t);
  user-select: none;
  white-space: nowrap;
  text-decoration: none;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 2px 12px var(--indigo-glow);
}
.btn-primary:hover { opacity: .88; transform: translateY(-1px); box-shadow: var(--shadow-glow); }

.btn-outline {
  background: transparent;
  color: var(--text-1);
  border: 1px solid var(--border-2);
}
.btn-outline:hover { background: var(--surface-1); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
}
.btn-ghost:hover { background: var(--surface-1); color: var(--text-1); }

.btn-danger {
  background: rgba(242,100,121,0.12);
  color: var(--red);
  border: 1px solid rgba(242,100,121,0.2);
}
.btn-danger:hover { background: rgba(242,100,121,0.22); }

.btn-sm  { padding: 6px 12px; font-size: 12.5px; }
.btn-lg  { padding: 12px 22px; font-size: 15px; }
.btn-icon { width: 32px; height: 32px; padding: 0; }
.btn-icon.btn-sm { width: 28px; height: 28px; }
.btn-full { width: 100%; }

.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; }

/* ============================================================
   BADGES & TAGS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface-1);
  color: var(--text-2);
  border: 1px solid var(--border-1);
}
.badge-primary { background: var(--indigo-lo); color: var(--indigo-hi); border-color: rgba(124,106,247,0.2); }
.badge-green   { background: rgba(62,207,142,0.1); color: var(--green); border-color: rgba(62,207,142,0.2); }

.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 500;
  background: var(--indigo-lo);
  color: var(--indigo-hi);
}
.tag-muted {
  background: var(--surface-1);
  color: var(--text-2);
}

/* ============================================================
   DIVIDER
   ============================================================ */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .04em;
  margin: 20px 0;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-2);
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-xl);
  padding: 22px;
  transition: border-color var(--t-md), box-shadow var(--t-md), transform var(--t-md);
}
.card-interactive {
  cursor: pointer;
  display: block;
  color: inherit;
}
.card-interactive:hover {
  border-color: var(--indigo);
  box-shadow: var(--shadow-card), 0 0 0 1px var(--indigo-lo);
  transform: translateY(-2px);
}

/* ── Project card specific ── */
.project-card-title { font-weight: 700; font-size: 15px; line-height: 1.3; }
.project-card-desc {
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 8px 0 12px;
}
.project-card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 14px; }
.project-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: var(--text-3);
}
.project-card-meta span { display: flex; align-items: center; gap: 4px; }
.project-card-meta svg { width: 12px; height: 12px; }

/* ============================================================
   GRID
   ============================================================ */
.projects-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  border: 1.5px dashed var(--border-2);
  border-radius: var(--r-xl);
  padding: 60px 32px;
  text-align: center;
}
.empty-state-icon {
  width: 48px; height: 48px;
  background: var(--surface-1);
  border-radius: 14px;
  display: grid; place-items: center;
  margin: 0 auto 16px;
  color: var(--text-3);
}
.empty-state-icon svg { width: 22px; height: 22px; }
.empty-state h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.empty-state p { color: var(--text-2); font-size: 13.5px; max-width: 320px; margin: 0 auto; }

/* ============================================================
   FILTERS BAR
   ============================================================ */
.filters-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.filters-bar .input-search-wrap { flex: 1; min-width: 220px; }
.filters-bar select.select { min-width: 158px; }

/* ============================================================
   DOCUMENT LIST
   ============================================================ */
.docs-list {
  border: 1px solid var(--border-1);
  border-radius: var(--r-xl);
  overflow: hidden;
}
.doc-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-1);
  transition: background var(--t);
}
.doc-row:last-child { border-bottom: none; }
.doc-row:hover { background: var(--surface-1); }
.doc-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--indigo-lo);
  display: grid; place-items: center;
  color: var(--indigo-hi);
  flex-shrink: 0;
}
.doc-icon svg { width: 18px; height: 18px; }
.doc-info { flex: 1; min-width: 0; }
.doc-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.doc-name {
  font-weight: 600;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}
.doc-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 3px;
}
.doc-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* ============================================================
   SECTION HEADER
   ============================================================ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.section-header h2 { font-size: 17px; font-weight: 700; }

/* ============================================================
   PROJECT DETAIL HEADER
   ============================================================ */
.project-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.project-detail-header h1 { font-size: 28px; font-weight: 700; letter-spacing: -.5px; }
.project-detail-badges { display: flex; align-items: center; gap: 7px; margin-top: 8px; flex-wrap: wrap; }
.project-detail-desc { color: var(--text-2); margin-top: 10px; font-size: 13.5px; max-width: 600px; line-height: 1.6; }
.project-detail-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }

/* ============================================================
   BACK LINK
   ============================================================ */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 22px;
  transition: color var(--t);
}
.back-link:hover { color: var(--text-1); }
.back-link svg { width: 14px; height: 14px; }

/* ============================================================
   FORM CARD
   ============================================================ */
.form-card {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-xl);
  padding: 30px 32px;
  max-width: 660px;
}
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 540px) { .form-row-2 { grid-template-columns: 1fr; } }

/* ============================================================
   ACTIVITY
   ============================================================ */
.activity-list {
  border: 1px solid var(--border-1);
  border-radius: var(--r-xl);
  overflow: hidden;
}
.activity-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-1);
}
.activity-row:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--indigo);
  margin-top: 6px;
  flex-shrink: 0;
  box-shadow: 0 0 8px var(--indigo-glow);
}
.activity-text { font-size: 13.5px; }
.activity-text strong { font-weight: 600; }
.activity-text .muted { color: var(--text-2); }
.activity-timestamp { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }

/* ============================================================
   ADMIN TABLE
   ============================================================ */
.table-wrap {
  border: 1px solid var(--border-1);
  border-radius: var(--r-xl);
  overflow: hidden;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table thead tr { background: var(--surface-1); }
.data-table thead th {
  padding: 11px 20px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
}
.data-table tbody tr { border-top: 1px solid var(--border-1); transition: background var(--t); }
.data-table tbody tr:hover { background: var(--surface-1); }
.data-table tbody td { padding: 13px 20px; }

/* ============================================================
   MODAL / OVERLAY
   ============================================================ */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.overlay.open { display: flex; }

.modal {
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-2xl);
  width: 100%;
  max-width: 480px;
  padding: 30px;
  position: relative;
  box-shadow: var(--shadow-modal);
  animation: modalIn .22s ease both;
}
.modal-lg { max-width: 860px; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(.96) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.modal-header h3 { font-size: 17px; font-weight: 700; letter-spacing: -.3px; }
.modal-close {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  background: var(--surface-1);
  border: none;
  cursor: pointer;
  color: var(--text-2);
  display: grid; place-items: center;
  transition: all var(--t);
}
.modal-close:hover { background: var(--surface-2); color: var(--text-1); }
.modal-close svg { width: 14px; height: 14px; }

/* Preview body */
.preview-body {
  height: 66vh;
  background: var(--bg-3);
  border-radius: var(--r-lg);
  overflow: auto;
  display: flex;
  flex-direction: column;
}
.preview-body iframe { width: 100%; height: 100%; border: none; flex: 1; }
.preview-body pre {
  padding: 24px;
  font-family: 'DM Mono', monospace;
  font-size: 12.5px;
  color: var(--text-1);
  white-space: pre-wrap;
  flex: 1;
}
.preview-unsupported {
  display: grid;
  place-items: center;
  height: 100%;
  text-align: center;
  color: var(--text-2);
  padding: 32px;
  flex: 1;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast-stack {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  pointer-events: none;
}
.toast {
  pointer-events: all;
  position: relative;
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  padding: 13px 16px 13px 14px;
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.12);
  animation: toastIn .3s cubic-bezier(.34,1.56,.64,1) both;
  min-width: 260px;
  max-width: 380px;
  backdrop-filter: blur(8px);
}
.toast.toast-exit {
  animation: toastOut .3s ease forwards;
}
.toast-success { border-left: 3px solid var(--green); }
.toast-error   { border-left: 3px solid var(--red);   }
.toast-info    { border-left: 3px solid var(--blue);  }
.toast-warning { border-left: 3px solid #f59e0b;      }

.toast-icon         { flex-shrink: 0; display:flex; align-items:center; }
.toast-icon-success { color: #22c55e; }
.toast-icon-error   { color: #ef4444; }
.toast-icon-info    { color: #3b82f6; }
.toast-icon-warning { color: #f59e0b; }

.toast-msg   { flex: 1; color: var(--text-1); line-height: 1.4; }
.toast-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-3); padding: 2px; border-radius: 4px;
  display: flex; align-items: center; opacity: 0.6;
  transition: opacity .15s, background .15s;
  flex-shrink: 0;
}
.toast-close:hover { opacity: 1; background: var(--surface-2); }

.toast-progress {
  position: absolute;
  bottom: 0; left: 0;
  height: 2px;
  width: 100%;
  transform-origin: left;
  animation: toastProgress linear forwards;
}
.toast-progress-success { background: var(--green); }
.toast-progress-error   { background: var(--red);   }
.toast-progress-info    { background: var(--blue);  }
.toast-progress-warning { background: #f59e0b;      }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px) scale(0.96); }
  to   { opacity: 1; transform: translateX(0)    scale(1);    }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0);     max-height: 80px; margin-bottom: 0; }
  to   { opacity: 0; transform: translateX(20px);  max-height: 0;    margin-bottom: -10px; }
}
@keyframes toastProgress {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.ml-auto { margin-left: auto; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.hidden { display: none !important; }
.text-muted { color: var(--text-2); }
.text-dim   { color: var(--text-3); }
.font-mono  { font-family: 'DM Mono', monospace; }

.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border-2);
  border-top-color: var(--indigo);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-100%); transition: transform var(--t-md); }
  .sidebar.open { transform: translateX(0); width: 240px; }
  .main { margin-left: 0; }
}
/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--r-xl);
  padding: 20px 22px;
  transition: border-color var(--t-md), box-shadow var(--t-md);
}
.stat-card:hover { border-color: var(--border-2); box-shadow: var(--shadow-card); }
.stat-card-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
  margin-bottom: 6px;
}
.stat-card-value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--text-1);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card-sub { font-size: 12px; color: var(--text-2); }

/* ============================================================
   ROLE BADGES
   ============================================================ */
.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: capitalize;
  white-space: nowrap;
}
.role-admin       { background: var(--indigo-lo);      color: var(--indigo-hi); border: 1px solid rgba(124,106,247,0.25); }
.role-contributor { background: rgba(62,207,142,0.12); color: var(--green);     border: 1px solid rgba(62,207,142,0.25); }
.role-viewer      { background: rgba(91,166,247,0.12); color: var(--blue);      border: 1px solid rgba(91,166,247,0.25); }

/* ============================================================
   BADGE VARIANTS (missing)
   ============================================================ */
.badge-violet { background: var(--indigo-lo); color: var(--indigo-hi); border-color: rgba(124,106,247,0.2); }

/* ============================================================
   TOPBAR BREADCRUMB & CONTROLS
   ============================================================ */
.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}
.crumb-sep     { color: var(--text-3); font-size: 14px; }
.crumb-current { color: var(--text-1); font-weight: 600; }
.hover-text:hover { color: var(--text-1) !important; }

.sidebar-toggle {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--text-2);
  transition: background var(--t), color var(--t);
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--surface-1); color: var(--text-1); }
.sidebar-toggle svg { width: 16px; height: 16px; }

.icon-btn {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--text-3);
  transition: background var(--t), color var(--t);
  flex-shrink: 0;
  margin-left: auto;
}
.icon-btn:hover { background: var(--surface-2); color: var(--red); }
.icon-btn svg { width: 15px; height: 15px; }

/* ============================================================
   EMPTY STATE — fix oversized SVG icon
   ============================================================ */
.empty-icon {
  width: 52px; height: 52px;
  background: var(--surface-1);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  color: var(--text-3);
}
.empty-icon svg { width: 22px; height: 22px; }

/* ============================================================
   ADDITIONS — landing + auth mode corrections
   ============================================================ */

/* Show-landing body state */
body.show-landing #app,
body.show-landing #auth-screen { display: none !important; }

/* Auth screen visible only when .auth-screen on body */
body:not(.auth-screen) #auth-screen { display: none !important; }
body.auth-screen #auth-screen { display: flex !important; }
body.auth-screen #app { display: none !important; }

/* App: only show when neither landing nor auth */
body:not(.show-landing):not(.auth-screen) #app { display: flex; }
body.show-landing #app,
body.auth-screen  #app { display: none !important; }

/* Filters bar search uses .input not .search-input */
.filters-bar .input { background: var(--surface-1); }

/* Project card uses .card class — ensure no double padding */
.card.card-interactive { padding: 20px 20px 18px; }

/* Section header filter icon alignment */
.section-header .select-wrap {
  display: flex; align-items: center;
}
/* ============================================================
   LANDING PAGE STYLES
   ============================================================ */

/* #landing is shown when body has .show-landing */
body.show-landing #landing { display: block; }
#landing { display: none; }

/* ── Landing Nav ── */
.land-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 48px;
  border-bottom: 1px solid var(--border-1);
  position: sticky;
  top: 0;
  background: rgba(8,9,16,0.85);
  backdrop-filter: blur(16px);
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--text-1);
  letter-spacing: -0.3px;
}
.brand-icon {
  width: 34px; height: 34px;
  background: var(--grad);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-glow);
}

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

/* ── Hero Section ── */
.land-hero {
  max-width: 760px;
  margin: 0 auto;
  padding: 100px 24px 60px;
  text-align: center;
  background: var(--grad-hero);
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--indigo-hi);
  background: var(--indigo-lo);
  border: 1px solid rgba(124,106,247,0.25);
  border-radius: var(--r-full, 999px);
  padding: 5px 14px;
  margin-bottom: 28px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.hero-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--indigo-hi);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.land-hero h1 {
  font-family: 'DM Sans', sans-serif;
  font-size: clamp(40px, 6vw, 68px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -2px;
  color: var(--text-1);
  margin-bottom: 20px;
}
.land-hero h1 .accent {
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.land-hero > p {
  font-size: 16px;
  color: var(--text-2);
  max-width: 560px;
  margin: 0 auto 36px;
  line-height: 1.65;
}

.hero-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Stats Bar ── */
.land-stats {
  display: flex;
  justify-content: center;
  gap: 0;
  border-top: 1px solid var(--border-1);
  border-bottom: 1px solid var(--border-1);
  margin: 0 auto;
  max-width: 900px;
  overflow: hidden;
}
.stat-item {
  flex: 1;
  padding: 28px 24px;
  text-align: center;
  border-right: 1px solid var(--border-1);
}
.stat-item:last-child { border-right: none; }
.stat-num {
  font-family: 'DM Sans', sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -1px;
}
.stat-label {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Features Grid ── */
.land-features {
  max-width: 1000px;
  margin: 0 auto;
  padding: 72px 24px 96px;
}
.features-heading {
  text-align: center;
  margin-bottom: 48px;
}
.features-heading h2 {
  font-family: 'DM Sans', sans-serif;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.8px;
  color: var(--text-1);
  margin-bottom: 10px;
}
.features-heading p {
  color: var(--text-2);
  font-size: 15px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.feature-card {
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--r-xl);
  padding: 28px;
  transition: border-color var(--t), transform var(--t);
}
.feature-card:hover {
  border-color: var(--border-2);
  transform: translateY(-2px);
}
.feature-icon {
  width: 44px; height: 44px;
  background: var(--indigo-lo);
  border: 1px solid rgba(124,106,247,0.2);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
  color: var(--indigo-hi);
}
.feature-icon svg { width: 20px; height: 20px; }
.feature-card h3 {
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 8px;
}
.feature-card p {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
}

/* ── Button additions ── */
.btn-lg {
  padding: 13px 28px;
  font-size: 15px;
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-1);
  color: var(--text-2);
}
.btn-ghost:hover {
  background: var(--surface-1);
  border-color: var(--border-2);
  color: var(--text-1);
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--text-1);
}
.btn-outline:hover {
  background: var(--surface-1);
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .land-nav { padding: 14px 20px; }
  .land-hero { padding: 64px 20px 48px; }
  .land-stats { flex-wrap: wrap; }
  .stat-item { min-width: 50%; border-bottom: 1px solid var(--border-1); }
  .features-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   WORKSPACE NAVIGATION & CHATBOT ADDITIONS
   ============================================================ */
.tabs-nav {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin: 20px 0 24px 0;
  padding-bottom: 2px;
}
.tab-btn {
  background: none;
  border: none;
  color: var(--text-3);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  padding: 8px 4px 12px 4px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  outline: none;
}
.tab-btn:hover {
  color: var(--violet);
}
.tab-btn.active {
  color: var(--violet);
}
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--violet);
  border-radius: var(--r-full);
}
.hover-violet:hover {
  background: var(--violet) !important;
  color: white !important;
}
.hover-text:hover {
  color: var(--violet) !important;
}
.badge-violet {
  background: rgba(124, 106, 247, 0.12) !important;
  color: var(--violet) !important;
  border: 1px solid rgba(124, 106, 247, 0.2) !important;
}
.badge-amber {
  background: rgba(245, 158, 11, 0.12) !important;
  color: #f59e0b !important;
  border: 1px solid rgba(245, 158, 11, 0.2) !important;
}
.badge-red {
  background: rgba(239, 68, 68, 0.12) !important;
  color: #ef4444 !important;
  border: 1px solid rgba(239, 68, 68, 0.2) !important;
}
.chat-msg-user {
  margin-left: auto;
  background: var(--violet);
  color: white;
  border-bottom-right-radius: 4px !important;
}
.chat-msg-assistant {
  background: rgba(255,255,255,0.03);
  color: var(--text-1);
  border-bottom-left-radius: 4px !important;
  border: 1px solid rgba(255,255,255,0.04);
}
.spinner-small {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--violet);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.recommendation-item:hover {
  background: rgba(124, 106, 247, 0.08) !important;
  border-color: rgba(124, 106, 247, 0.3) !important;
  transform: translateY(-1px);
}

/* Approval badge dynamic classes */
.approval-badge.status-approved { background: rgba(72,199,142,0.15); color: #22c55e; border-color: rgba(72,199,142,0.3); }
.approval-badge.status-pending  { background: rgba(251,191,36,0.15);  color: #f59e0b; border-color: rgba(251,191,36,0.3); }
.approval-badge.status-rejected { background: rgba(239,68,68,0.15);   color: #ef4444; border-color: rgba(239,68,68,0.3); }

/* Shake animation for wrong password */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

/* ── Professional Auth Error Box ── */
.auth-error-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 10px 13px;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 8px;
  color: #ef4444;
  font-size: 13px;
  font-weight: 500;
  animation: errorSlideIn .2s ease;
}
.auth-error-box svg { flex-shrink: 0; }

@keyframes errorSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Input error state */
.input-error {
  border-color: rgba(239,68,68,0.6) !important;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.1) !important;
}
