@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --navy-dark: #09113B;
  --navy-mid: #303B5F;
  --navy-slate: #6B7A9E;
  --navy-muted: #A8B3CC;
  --navy-lighter: #E8ECF2;
  --navy-light: #F3F5F7;
  --white: #FFFFFF;
  --cream: #F8F6F2;
  --near-black: #1A1916;
  --accent: #FF6A3D;
  --good: #22c55e;
  --warn: #f59e0b;
}

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

html, body {
  height: 100%;
}

body {
  font-family: 'Manrope', -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--cream);
  color: var(--near-black);
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */

.sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--navy-dark);
  color: var(--white);
  display: flex;
  flex-direction: column;
  padding: 28px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.brand-sub {
  font-size: 12.5px;
  color: var(--navy-muted);
  margin-bottom: 28px;
  line-height: 1.5;
}

.nav-group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--navy-muted);
  margin: 18px 0 8px;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy-lighter);
  transition: background 0.12s ease;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
}

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

.nav-item .count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--navy-muted);
  background: rgba(255,255,255,0.08);
  padding: 2px 7px;
  border-radius: 999px;
}

.nav-item.active .count {
  color: var(--white);
  background: rgba(255,255,255,0.22);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
  font-size: 11px;
  color: var(--navy-slate);
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* ---------- Main ---------- */

.main {
  flex: 1;
  min-width: 0;
  padding: 36px 44px 60px;
}

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--navy-dark);
  letter-spacing: -0.02em;
}

.breadcrumb {
  font-size: 13px;
  color: var(--navy-slate);
  margin-bottom: 28px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.breadcrumb span.crumb {
  cursor: pointer;
  color: var(--navy-mid);
  font-weight: 600;
}

.breadcrumb span.crumb:hover {
  text-decoration: underline;
}

.blurb {
  max-width: 760px;
  color: var(--navy-mid);
  font-size: 14.5px;
  line-height: 1.6;
  margin-bottom: 28px;
}

/* ---------- Stat cards ---------- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--navy-lighter);
  border-radius: 12px;
  padding: 18px 20px;
}

.stat-card .n {
  font-size: 26px;
  font-weight: 800;
  color: var(--navy-dark);
  letter-spacing: -0.02em;
}

.stat-card .l {
  font-size: 12px;
  color: var(--navy-slate);
  font-weight: 600;
  margin-top: 4px;
}

/* ---------- Section cards (overview grid) ---------- */

.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.section-card {
  background: var(--white);
  border: 1px solid var(--navy-lighter);
  border-radius: 14px;
  padding: 22px;
  cursor: pointer;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.section-card:hover {
  box-shadow: 0 8px 24px rgba(9,17,59,0.10);
  transform: translateY(-2px);
}

.section-card h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--navy-dark);
  margin-bottom: 8px;
}

.section-card p {
  font-size: 13px;
  color: var(--navy-mid);
  line-height: 1.55;
  margin-bottom: 14px;
  min-height: 60px;
}

.section-card .meta {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--navy-slate);
  display: flex;
  gap: 10px;
}

/* ---------- File/folder listing ---------- */

.listing {
  background: var(--white);
  border: 1px solid var(--navy-lighter);
  border-radius: 12px;
  overflow: hidden;
}

.listing table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.listing th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--navy-slate);
  padding: 12px 18px;
  background: var(--navy-light);
  font-weight: 700;
}

.listing td {
  padding: 10px 18px;
  border-top: 1px solid var(--navy-light);
  color: var(--near-black);
  vertical-align: middle;
}

.listing tr.row-clickable {
  cursor: pointer;
}

.listing tr.row-clickable:hover td {
  background: var(--navy-light);
}

.file-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.icon {
  font-size: 15px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--navy-lighter);
  color: var(--navy-mid);
}

.muted {
  color: var(--navy-slate);
}

.right {
  text-align: right;
}

/* ---------- Preview panel ---------- */

.preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9,17,59,0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  z-index: 50;
  overflow-y: auto;
}

.preview-panel {
  background: var(--white);
  border-radius: 16px;
  width: min(1100px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 80px rgba(0,0,0,0.35);
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 26px;
  border-bottom: 1px solid var(--navy-lighter);
}

.preview-header h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--navy-dark);
}

.preview-header .path {
  font-size: 12px;
  color: var(--navy-slate);
  font-family: 'SFMono-Regular', Consolas, monospace;
  margin-top: 2px;
}

.close-btn {
  border: none;
  background: var(--navy-light);
  color: var(--navy-mid);
  font-weight: 700;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
}

.close-btn:hover { background: var(--navy-lighter); }

.preview-body {
  padding: 18px 26px 26px;
  overflow: auto;
}

.preview-body table {
  border-collapse: collapse;
  font-size: 12.5px;
  width: max-content;
  min-width: 100%;
}

.preview-body th, .preview-body td {
  border: 1px solid var(--navy-lighter);
  padding: 6px 10px;
  white-space: nowrap;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-body th {
  background: var(--navy-light);
  position: sticky;
  top: 0;
  font-weight: 700;
  color: var(--navy-mid);
}

.preview-body pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12.5px;
  font-family: 'SFMono-Regular', Consolas, monospace;
  color: var(--near-black);
  line-height: 1.55;
}

.preview-note {
  font-size: 12.5px;
  color: var(--navy-slate);
  margin-bottom: 14px;
}

.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--navy-slate);
  font-size: 14px;
}

.search-box {
  width: 100%;
  max-width: 320px;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--navy-lighter);
  font-size: 13px;
  font-family: inherit;
  margin-bottom: 18px;
}

.search-box:focus {
  outline: none;
  border-color: var(--accent);
}

.nav-item:focus-visible,
.section-card:focus-visible,
tr.row-clickable:focus-visible,
.breadcrumb span.crumb:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Recovery metadata ──────────────────────────────────────────────────────
   Added for the D: Drive Recovery section. Uses the --good / --warn tokens
   that were already defined above but previously unused. */

.badge.st-complete {
  background: color-mix(in srgb, var(--good) 16%, white);
  color: color-mix(in srgb, var(--good) 78%, black);
}

.badge.st-partial {
  background: color-mix(in srgb, var(--warn) 18%, white);
  color: color-mix(in srgb, var(--warn) 82%, black);
}

.badge.st-lost {
  background: var(--navy-lighter);
  color: var(--navy-slate);
}

.recovery-panel {
  margin: 4px 0 18px;
}

.recovery-note {
  background: var(--white);
  border: 1px solid var(--navy-lighter);
  border-left: 3px solid var(--navy-muted);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--navy-mid);
  margin-bottom: 8px;
}

.recovery-note.ok {
  border-left-color: var(--good);
}

.recovery-note strong {
  color: var(--navy-dark);
}

.lost-list {
  background: var(--white);
  border: 1px solid var(--navy-lighter);
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 4px;
}

.lost-list summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy-mid);
}

.lost-list summary:hover {
  color: var(--accent);
}

.lost-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.lost-grid code {
  font-size: 11.5px;
  background: var(--navy-light);
  color: var(--navy-slate);
  border-radius: 5px;
  padding: 3px 7px;
  text-decoration: line-through;
  text-decoration-color: var(--navy-muted);
}

/* Per-file explanation shown at the top of the preview modal */
.file-meta {
  padding: 14px 22px;
  border-bottom: 1px solid var(--navy-lighter);
  background: var(--navy-light);
  flex-shrink: 0;
}

.file-meta .badge {
  margin-right: 6px;
}

.file-meta p {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--navy-mid);
}

.file-meta .fm-what {
  color: var(--navy-dark);
  font-weight: 500;
}

.file-meta .fm-prov,
.file-meta .fm-note {
  font-size: 12px;
  color: var(--navy-slate);
}

.file-meta strong {
  color: var(--navy-dark);
}

/* ── Featured tool links on the Overview ───────────────────────────────────── */

.featured-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.section-card.featured {
  border-left: 3px solid var(--accent);
}

.section-card.featured p {
  min-height: auto;
}

.section-card.featured .go {
  color: var(--accent);
  font-weight: 700;
}

/* ── Project / Data grouping ───────────────────────────────────────────────── */

.group-head { margin-top: 6px; }

.group-sub {
  font-size: 12.5px;
  color: var(--navy-slate);
  margin: 2px 0 0 2px;
}

.section-card.data-card {
  border-left: 3px solid var(--navy-muted);
}

.related {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}

.section-related {
  margin: 0 0 8px 2px;
}

/* ── Previews & downloads ──────────────────────────────────────────────────── */

.shot-wrap {
  margin: -18px -20px 14px;
  border-bottom: 1px solid var(--navy-lighter);
  background: var(--navy-light);
  border-radius: 12px 12px 0 0;
  overflow: hidden;
  height: 130px;
}

.shot {
  width: 100%;
  display: block;
  object-fit: cover;
  object-position: top center;
  height: 130px;
}

.dl-btn {
  display: inline-block;
  margin-top: 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--white);
  background: var(--navy-dark);
  border-radius: 7px;
  padding: 7px 12px;
  text-decoration: none;
}

.dl-btn:hover { background: var(--accent); }

.dl-btn.big {
  font-size: 13px;
  padding: 9px 16px;
}

.entry-header { margin: 2px 0 18px; }

.shot-big-link { display: block; }

.shot-big {
  width: 100%;
  max-width: 820px;
  border: 1px solid var(--navy-lighter);
  border-radius: 10px;
  display: block;
  margin-bottom: 12px;
}

/* ── Persistent back arrow ─────────────────────────────────────────────────── */

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

.back-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--navy-lighter);
  background: var(--white);
  color: var(--navy-dark);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.back-btn:hover:not(.disabled) {
  background: var(--navy-dark);
  border-color: var(--navy-dark);
  color: var(--white);
}

.back-btn.disabled {
  opacity: 0.3;
  cursor: default;
}

.section-card.subproject-card {
  border-left: 3px solid var(--navy-slate);
}
