/* ── APP LAYOUT ────────────────────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; font-family: var(--font-body); }

/* ── SIDEBAR ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
}
.logo {
  /* Sidebar logo container — holds the inline docman SVG. The SVG uses CSS
     variables (--accent, --text, --text2, --surface, ...) so it recolors
     with the active theme. */
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border);
}
.logo-mark {
  /* The sidebar brand logo is an inline THEME-AWARE <svg> (index.html #appName)
     that recolors via the palette variables, so it stays legible on the
     sidebar --surface in every scheme with a TRANSPARENT background — no chip.
     The old fixed light chip was only needed back when the logo was a
     fixed-navy raster that went dark-on-dark on the dark scheme.
     width:90% keeps a clear sidebar margin. */
  display: block;
  line-height: 0;
  width: 90%;
  margin: 0 auto;
}
.logo-mark img { display: block; width: 100%; height: auto; }
.logo-mark svg { display: block; width: 100%; height: auto; }
.logo-sub { display: none; } /* tagline lives inside the SVG now */
.nav { padding: 16px 12px; flex: 1; overflow-y: auto; overflow-x: hidden; }
.nav-section { font-family: var(--font-mono); font-size: 9px; color: var(--text3); letter-spacing: 1.5px; text-transform: uppercase; padding: 0 8px; margin: 16px 0 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--text2); cursor: pointer;
  transition: all .15s; font-size: 13.5px; margin-bottom: 2px; position: relative;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: rgba(59,130,246,.12); color: var(--accent2); }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 2px; background: var(--accent); border-radius: 2px;
}
.nav-icon { font-size: 15px; width: 18px; text-align: center; }
.nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-family: var(--font-mono); font-size: 10px; padding: 1px 6px; border-radius: 10px; }
.sidebar-footer { padding: 12px 14px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; min-width: 0; }
/* Avatar shrunk from 32 → 26 so a long email + connection-status line fit
 * inside the sidebar's text column without truncation. 26 still feels like
 * a "user chip" rather than a header avatar. */
.avatar { width: 26px; height: 26px; background: linear-gradient(135deg, var(--accent), #8b5cf6); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: #fff; flex-shrink: 0; }
/* The .user-info wrapper sits next to the avatar in a flex row. Without
 * min-width:0 it expands to fit the longest single line (e.g. a long email),
 * pushing the footer past the sidebar's right edge. min-width:0 caps the
 * wrapper at its flex share and lets the text inside truncate via ellipsis.
 *
 * IMPORTANT: target .user-info specifically, NOT `.sidebar-footer > div` —
 * the latter also matches .avatar, and `flex:1` on the avatar overrides its
 * fixed width:26px (flex-basis:0 + flex-grow:1 lets it consume half the
 * footer, making the avatar look huge). That was a self-inflicted bug
 * from the first sidebar overflow fix. */
.sidebar-footer .user-info { min-width: 0; flex: 1; }
.user-name { font-size: 12.5px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-family: var(--font-mono); font-size: 10px; color: var(--text3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── DRIVE STATUS BADGE ────────────────────────────────────────────────────── */
.drive-status {
  margin: 0 12px 12px;
  padding: 8px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface2);
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; transition: all .15s;
}
.drive-status:hover { border-color: var(--border2); }
.drive-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text3); flex-shrink: 0; transition: background .3s; }
.drive-dot.connected { background: var(--success); box-shadow: 0 0 6px var(--success); }
.drive-dot.error { background: var(--danger); }
/* min-width:0 + overflow-hidden so a long Drive folder name truncates with
 * ellipsis instead of stretching the badge past the sidebar's right edge. */
.drive-label { font-family: var(--font-mono); font-size: 10px; color: var(--text3); flex: 1; min-width: 0; line-height: 1.3; overflow: hidden; }
.drive-label strong { display: block; color: var(--text2); margin-bottom: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

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

/* ── TOPBAR ──────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11,14,20,.88); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px; height: 56px;
  display: flex; align-items: center; gap: 14px;
}
.topbar-title { font-family: var(--font-head); font-size: 16px; font-weight: 700; flex: 1; }
.search-box {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 6px 12px;
  display: flex; align-items: center; gap: 8px;
  color: var(--text2); width: 220px; transition: border-color .15s;
}
.search-box:hover { border-color: var(--border2); }
.search-box input { background: none; border: none; outline: none; color: var(--text); font-size: 13px; font-family: var(--font-body); width: 100%; }
.search-box input::placeholder { color: var(--text3); }

/* ── CONTENT ─────────────────────────────────────────────────────────────── */
.content { padding: 28px; flex: 1; }

/* ── PAGE VIEWS ──────────────────────────────────────────────────────────── */
.page-view { display: none; flex-direction: column; gap: 0; animation: fadeUp .3s ease both; }
.page-view.active { display: flex; }
