/* AtlasShare — shared styles */

:root {
  --bg: #0f1115;
  --surface: #181a20;
  --surface-2: #1f2229;
  --border: #25282f;
  --border-strong: #353945;
  --text: #e6e8eb;
  --text-muted: #8a8f98;
  --text-dim: #5c616b;
  --accent: #4d8eff;
  --accent-hover: #6aa0ff;
  --accent-press: #3d7be6;
  --danger: #ff6b6b;
  --success: #4ade80;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
button, input { font-family: inherit; font-size: inherit; }

/* --- Login page ----------------------------------------------------- */

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(77, 142, 255, 0.08), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}
.login-brand .mark {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
}
.login-brand .name {
  font-weight: 600;
  letter-spacing: 0.2px;
}
.login-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px;
}
.login-sub {
  color: var(--text-muted);
  margin: 0 0 22px;
  font-size: 13px;
}
.field {
  display: block;
  margin-bottom: 14px;
}
.field label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.field input {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
  transition: border-color 0.12s, background 0.12s;
}
.field input:focus {
  border-color: var(--accent);
  background: #1d2027;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  transition: background 0.12s;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { background: var(--accent-press); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.alert {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
}
.alert-error {
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  color: var(--danger);
}
.login-foot {
  margin-top: 18px;
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
}

/* ===================================================================
 * F1 shell: sidebar + content layout
 * =================================================================== */

.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.layout.sidebar-collapsed { grid-template-columns: 60px 1fr; }

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .mark {
  width: 24px; height: 24px;
  border-radius: 5px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  flex-shrink: 0;
}
.sidebar-brand .title {
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-collapse {
  width: 28px; height: 28px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  display: grid; place-items: center;
}
.sidebar-collapse:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }

.sidebar-search {
  margin: 8px 10px 4px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
}
.sidebar-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  min-width: 0;
}
.sidebar-search input::placeholder { color: var(--text-dim); }
.layout.sidebar-collapsed .sidebar-search { display: none; }

.search-meta {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--text-muted);
  padding-bottom: 6px;
}

.sidebar-nav {
  flex: 1;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  text-decoration: none;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item span:not(.badge) { flex: 1; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: rgba(77, 142, 255, 0.14); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav-item.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.nav-item.disabled:hover { background: transparent; color: var(--text-muted); }
.badge.soon {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-foot .user-chip {
  width: 100%;
  background: var(--surface-2);
}

.layout.sidebar-collapsed .sidebar-brand .title,
.layout.sidebar-collapsed .sidebar-brand .mark,
.layout.sidebar-collapsed .nav-item span,
.layout.sidebar-collapsed .sidebar-foot .user-chip span:not(.avatar),
.layout.sidebar-collapsed .sidebar-foot .btn { display: none; }
.layout.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 14px 0; }
.layout.sidebar-collapsed .nav-item { justify-content: center; }

/* ---------- Content area ---------- */
.content {
  padding: 24px 28px;
  min-width: 0;
  overflow-x: hidden;
}
.content-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.content-head h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
}
.content-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.content-sub {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}
.content-head .link, .link {
  color: var(--accent);
  font-size: 13px;
  text-decoration: none;
}
.content-head .link:hover { color: var(--accent-hover); }
.muted { color: var(--text-muted); font-size: 12px; font-weight: 400; }

/* ---------- Placeholder ---------- */
.placeholder {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}
.placeholder-icon { font-size: 32px; margin-bottom: 8px; }
.placeholder-body { font-size: 13px; max-width: 480px; margin: 0 auto; }

/* ---------- Dashboard cards ---------- */
.dash-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.dash-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.dash-card.stretch { grid-column: 1 / -1; }
.dash-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.dash-card-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text);
}
.dash-card-body {
  font-size: 13px;
  line-height: 1.6;
}

/* ---------- Project grid ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.proj-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  transition: transform 0.12s, border-color 0.12s, background 0.12s;
}
.proj-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.proj-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--surface-2);
  display: block;
}
.proj-thumb.fallback {
  display: grid;
  place-items: center;
  color: var(--text-muted);
}
.proj-meta {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.proj-name {
  font-weight: 500;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.proj-sub {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------- Status pills (F4 — Approvals) ---------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  white-space: nowrap;
}
.status-pill.loading  { color: var(--text-dim); }
.status-pill.unset    { color: var(--text-dim); border-style: dashed; }
.status-pill.pending  { background: rgba(77, 142, 255, 0.18); border-color: rgba(77, 142, 255, 0.45); color: #a8c5ff; }
.status-pill.approved { background: rgba(74, 222, 128, 0.18); border-color: rgba(74, 222, 128, 0.45); color: #86efac; }
.status-pill.needs_changes { background: rgba(245, 158, 11, 0.18); border-color: rgba(245, 158, 11, 0.45); color: #fbbf24; }
.status-pill.on-thumb {
  position: absolute;
  bottom: 6px;
  right: 6px;
  border: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.status-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.status-select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  outline: none;
}
.status-select:focus, .status-select:hover { border-color: var(--accent); }

/* Make asset overlay accommodate the new bottom-right pill */
.asset-card { position: relative; }

/* Version badge on asset cards */
.asset-version {
  font-size: 9px;
  background: rgba(168, 85, 247, 0.85);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}
/* Auto-tags in modal */
.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: rgba(20, 184, 166, 0.15);
  border: 1px solid rgba(20, 184, 166, 0.35);
  border-radius: 999px;
  color: #5eead4;
  font-size: 11px;
  text-decoration: none;
  cursor: pointer;
}
.tag-chip:hover { background: rgba(20, 184, 166, 0.25); }

/* Version chips in modal */
.version-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.version-bar-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-right: 2px;
}
.version-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-family: var(--mono);
  cursor: pointer;
}
.version-chip:hover { color: var(--text); border-color: var(--border-strong); }
.version-chip.active {
  background: rgba(168, 85, 247, 0.2);
  border-color: rgba(168, 85, 247, 0.5);
  color: #c4b5fd;
}

/* Documents list */
.docs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.doc-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
}
.doc-row:hover { background: var(--surface-2); border-color: var(--border-strong); }
.doc-icon {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--mono);
}
.doc-icon.kind-pdf { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.doc-icon.kind-doc { background: rgba(77, 142, 255, 0.15); color: #a8c5ff; }
.doc-meta { min-width: 0; }
.doc-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-folder { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-side { text-align: right; }
.doc-size { font-size: 13px; color: var(--text); }
.doc-date { font-size: 11px; color: var(--text-dim); }

/* Pending review chips on Home */
.pending-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.pending-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
}
.pending-chip:hover { border-color: var(--border-strong); }
.pending-more {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
}

/* Duplicate clusters (AI-3) */
.dup-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-muted);
}
.dup-controls input[type=range] { width: 200px; vertical-align: middle; }
#dup-threshold-val { font-family: var(--mono); color: var(--text); }
.dup-cluster {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 10px;
}
.dup-cluster-head {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.dup-cluster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.dup-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
}
.dup-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #0a0c10; }
.dup-card-name {
  padding: 4px 6px;
  font-size: 10px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Activity feed */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.activity-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  transition: background 0.12s, border-color 0.12s;
}
.activity-row:hover { background: var(--surface-2); border-color: var(--border-strong); }
.activity-icon {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  background: var(--surface-2);
  border-radius: 50%;
  font-size: 12px;
}
.activity-icon[data-action="approval"] { background: rgba(74, 222, 128, 0.15); color: #86efac; }
.activity-icon[data-action="comment"]  { background: rgba(168, 85, 247, 0.15); color: #c4b5fd; }
.activity-icon[data-action="download"] { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.activity-icon[data-action="view"]     { background: var(--surface-2); color: var(--text-muted); }
.activity-line { min-width: 0; }
.activity-user { font-weight: 500; }
.activity-verb { color: var(--text-muted); margin: 0 4px; }
.activity-asset { color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.activity-folder { font-size: 11px; color: var(--text-dim); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-time { color: var(--text-dim); font-size: 12px; white-space: nowrap; }

/* Inbox list */
.inbox-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.inbox-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  transition: background 0.12s, border-color 0.12s;
}
.inbox-row:hover { background: var(--surface-2); border-color: var(--border-strong); }
.inbox-meta { min-width: 0; }
.inbox-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-path { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-time { font-size: 12px; color: var(--text-dim); }

/* ---------- Project Detail (F2) ---------- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: 6px;
  margin-left: -8px;
  transition: background 0.12s, color 0.12s;
}
.back-link:hover { background: var(--surface-2); color: var(--text); }
.back-link svg { flex-shrink: 0; }

.proj-detail-head { align-items: flex-start; }
.proj-detail-actions { display: flex; gap: 10px; align-items: center; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.chip:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.chip.active {
  background: rgba(77, 142, 255, 0.18);
  border-color: rgba(77, 142, 255, 0.5);
  color: var(--text);
}
.chip-count {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 7px;
  font-size: 10px;
  color: var(--text-muted);
}
.chip.active .chip-count {
  background: rgba(77, 142, 255, 0.25);
  border-color: transparent;
  color: var(--text);
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.asset-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: transform 0.12s, border-color 0.12s;
}
.asset-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.asset-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #0a0c10;
  overflow: hidden;
}
.asset-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* Video thumb gets a subtle play overlay so user knows it's a video */
.asset-thumb.video::after { content: ''; }
.thumb-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
}
.thumb-fallback[data-kind="image"] { background: linear-gradient(135deg, #1a2030 0%, #0e1117 100%); }
.thumb-fallback[data-kind="video"] { background: linear-gradient(135deg, #2a1a3a 0%, #0e1117 100%); color: #c4b5fd; }
.thumb-fallback[data-kind="audio"] { background: linear-gradient(135deg, #3a2a1a 0%, #0e1117 100%); color: #fbbf24; }
.thumb-fallback[data-kind="pdf"]   { background: linear-gradient(135deg, #3a1a1a 0%, #0e1117 100%); color: #fca5a5; }
.thumb-fallback[data-kind="doc"]   { background: linear-gradient(135deg, #1a2a3a 0%, #0e1117 100%); color: #a8c5ff; }
.thumb-fallback[data-kind="raw"]   { background: linear-gradient(135deg, #0e2c2a 0%, #0e1117 100%); color: #5eead4; }
.thumb-fallback[data-kind="other"] { background: linear-gradient(135deg, #1f2229 0%, #0e1117 100%); }
.thumb-ext-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  font-family: var(--mono);
  padding: 2px 8px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  text-transform: uppercase;
}
.asset-overlay {
  position: absolute;
  top: 6px;
  left: 6px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  max-width: calc(100% - 12px);
}
.asset-kind {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  background: rgba(0,0,0,0.6);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}
.asset-kind.kind-image { background: rgba(77, 142, 255, 0.85); }
.asset-kind.kind-video { background: rgba(168, 85, 247, 0.85); }
.asset-kind.kind-audio { background: rgba(245, 158, 11, 0.85); }
.asset-kind.kind-pdf   { background: rgba(239, 68, 68, 0.85); }
.asset-kind.kind-raw   { background: rgba(20, 184, 166, 0.85); }
.asset-section {
  font-size: 9px;
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 500;
}
.asset-name {
  padding: 6px 8px;
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-top: 1px solid var(--border);
}
.asset-more {
  grid-column: 1 / -1;
  text-align: center;
  padding: 16px;
}

/* ---------- Files header tweaks (no separate topbar anymore) ---------- */
.files-head { display: block; }
.files-head .crumbs { padding: 0 0 12px; }
.files-head .toolbar { padding: 0 0 12px; }
.files-head .filelist { margin: 0; }

/* ===================================================================
 * Legacy portal-shell / topbar (no longer used; keep for safety)
 * =================================================================== */
.btn-block { width: 100%; }

/* --- Portal layout -------------------------------------------------- */

.portal-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar-left .mark {
  width: 24px; height: 24px;
  border-radius: 5px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
}
.topbar-left .title {
  font-weight: 600;
  font-size: 15px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
}
.user-chip .avatar {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6aa0ff, #c084fc);
  display: grid; place-items: center;
  color: white; font-size: 11px; font-weight: 600;
}

.crumbs {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-muted);
}
.crumbs a {
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 5px;
  transition: background 0.12s, color 0.12s;
}
.crumbs a:hover { background: var(--surface-2); color: var(--text); }
.crumbs .sep { color: var(--text-dim); }
.crumbs .current { color: var(--text); font-weight: 500; padding: 4px 8px; }

.toolbar {
  padding: 0 20px 12px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.search {
  flex: 1;
  max-width: 320px;
  position: relative;
}
.search input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
}
.search input:focus { border-color: var(--accent); }
.search .icon {
  position: absolute;
  left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

/* File list */

.filelist {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.filelist-head {
  display: grid;
  grid-template-columns: 1fr 110px 170px 120px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.filelist-row {
  display: grid;
  grid-template-columns: 1fr 110px 170px 120px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  cursor: pointer;
  transition: background 0.08s;
}
.filelist-row:last-child { border-bottom: none; }
.filelist-row:hover { background: var(--surface-2); }
.filelist-row.selected {
  background: rgba(77, 142, 255, 0.12);
  box-shadow: inset 2px 0 0 var(--accent);
}
.filelist-row.selected:hover { background: rgba(77, 142, 255, 0.18); }
.filelist-row.multi-selected {
  background: rgba(168, 85, 247, 0.18);
  box-shadow: inset 2px 0 0 #a855f7;
}
.filelist-row.multi-selected:hover { background: rgba(168, 85, 247, 0.26); }
.filelist-row.selected.multi-selected { box-shadow: inset 2px 0 0 #a855f7; }

/* Selection toolbar (Files view) */
.selection-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  padding: 6px 10px;
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.4);
  border-radius: var(--radius-sm);
}
.sel-count {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  margin-right: 4px;
}

/* Project Detail — raw folder name secondary subtitle */
.proj-raw-name { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }
.filelist-row .name {
  display: flex; align-items: center; gap: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.filelist-row .icon {
  width: 20px; height: 20px;
  flex-shrink: 0;
  color: var(--text-muted);
}
.filelist-row.folder .icon { color: var(--accent); }
.filelist-row .size,
.filelist-row .date {
  color: var(--text-muted);
  font-size: 13px;
}
.filelist-row .actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.icon-btn:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
}
.empty .icon { font-size: 32px; margin-bottom: 8px; opacity: 0.5; }

.loading {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* Preview modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(2px);
  display: grid;
  grid-template-columns: 60px 1fr 60px;
  align-items: center;
  justify-items: center;
  z-index: 100;
  padding: 24px 12px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: min(1100px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
  grid-column: 2;
}
.modal-nav {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 50%;
  cursor: pointer;
  color: var(--text);
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
}
.modal-nav:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.18); }
.modal-nav:disabled { opacity: 0.3; cursor: not-allowed; }
.modal-nav.prev { grid-column: 1; }
.modal-nav.next { grid-column: 3; }
.modal-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60ch;
  display: inline-block;
  vertical-align: middle;
}
.modal-counter {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 8px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  vertical-align: middle;
}
.modal-foot {
  display: flex;
  gap: 14px;
  justify-content: center;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.kbd-hint {
  font-size: 11px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.kbd-hint kbd {
  display: inline-block;
  padding: 1px 5px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title {
  font-weight: 500;
  display: flex; align-items: center; gap: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modal-actions { display: flex; gap: 8px; }
.modal-main {
  flex: 1;
  display: flex;
  min-height: 0;     /* allow inner scrolling */
}
.modal-body {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0c10;
  min-height: 300px;
}

/* --- Comments panel (B2 wireframe) ------------------------------------ */
.comments-panel {
  width: 320px;
  flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.comments-panel.hidden { display: none; }
.comments-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.comments-count {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}
.comments-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.empty-small {
  padding: 24px 16px;
  color: var(--text-dim);
  text-align: center;
  font-size: 12px;
}
.comment {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
}
.comment.resolved { opacity: 0.55; }
.comment-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.comment-avatar {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: grid; place-items: center;
  color: white;
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
}
.comment-user { font-weight: 500; color: var(--text); }
.comment-time {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 11px;
}
.comment-text {
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.comment-acts {
  display: flex;
  gap: 4px;
  margin-left: 6px;
}
.comment-act {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 1px 6px;
  font-size: 10px;
  border-radius: 4px;
  cursor: pointer;
}
.comment-act:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.tc-jump {
  background: rgba(77,142,255,0.15);
  border: 1px solid rgba(77,142,255,0.4);
  color: var(--accent-hover);
  font-family: var(--mono);
  font-size: 11px;
  padding: 0 6px;
  border-radius: 4px;
  cursor: pointer;
  margin-left: 4px;
}
.tc-jump:hover { background: rgba(77,142,255,0.25); }
.comments-compose {
  border-top: 1px solid var(--border);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
}
.comments-compose textarea {
  width: 100%;
  resize: vertical;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
}
.comments-compose textarea:focus { border-color: var(--accent); }
.comments-compose-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.comments-tc {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
}
.modal-body img,
.modal-body video {
  max-width: 100%;
  max-height: 80vh;
  display: block;
}
.modal-body iframe {
  width: 100%;
  height: 80vh;
  border: none;
  background: white;
}
.modal-body .unsupported {
  padding: 48px;
  color: var(--text-muted);
  text-align: center;
}

/* Responsive */
@media (max-width: 800px) {
  .layout { grid-template-columns: 56px 1fr; }
  .sidebar-brand .title,
  .nav-item span:not(.badge),
  .sidebar-foot .user-chip span:not(.avatar),
  .sidebar-foot .btn { display: none; }
  .nav-item { justify-content: center; padding: 8px; }
  .badge.soon { display: none; }
  .content { padding: 16px 14px; }
}
@media (max-width: 700px) {
  .filelist-head,
  .filelist-row {
    grid-template-columns: 1fr 80px 80px;
  }
  .filelist-head .date,
  .filelist-row .date { display: none; }
  .modal-backdrop { grid-template-columns: 40px 1fr 40px; padding: 12px 6px; }
  .modal-nav { width: 36px; height: 36px; }
  .modal-main { flex-direction: column; }
  .comments-panel { width: 100%; max-height: 260px; border-left: none; border-top: 1px solid var(--border); }
  .projects-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
}
