/* ============================================================
   Vestinit — Dashboard Shell  (ITP-03B Visual Refresh)
   Sidebar / header / layout / welcome banner / side panels.
   Requires design-tokens.css + components.css.
   Selectors match portal.css v13 — no markup changes.
   ============================================================ */

/* ── Layout ── */
.portal-layout { display: flex; min-height: 100vh; }
.portal-main { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; min-width: 0; }
.portal-content { padding: 30px; flex: 1; max-width: 1260px; width: 100%; margin: 0 auto; }

/* ── Sidebar — burgundy ground + pinstripe (constant both themes) ── */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--ground);
  background-image: var(--pinstripe);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100; overflow-y: auto;
}
.sidebar-logo {
  padding: 20px 22px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo .logo-word { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; letter-spacing: 0.01em; color: #fff; line-height: 1; }
.sidebar-logo .logo-sub { font-size: 0.563rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(255,255,255,0.5); display: block; margin-top: 5px; }
.sidebar-section { padding: 12px 0 4px; }
.sidebar-section-label { font-size: 0.625rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(255,255,255,0.4); padding: 0 22px 7px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 22px; font-size: 0.813rem; font-weight: 500;
  color: rgba(255,255,255,0.66);
  border-left: 2px solid transparent;
  transition: all var(--transition);
}
.sidebar-nav a:hover { color: #fff; background: rgba(255,255,255,0.05); }
.sidebar-nav a.active {
  color: #fff !important;
  border-left-color: var(--rose);
  background: rgba(255,255,255,0.07);
  font-weight: 600;
}
.sidebar-nav a svg { opacity: 0.7; flex-shrink: 0; width: 15px; height: 15px; }
.sidebar-nav a.active svg { opacity: 1; color: var(--rose); }
.sidebar-badge { margin-left: auto; background: var(--rose); color: var(--ground-deep); font-size: 0.625rem; font-weight: 600; padding: 1px 7px; border-radius: 999px; }
.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,0.10); }
.sidebar-user { display: flex; align-items: center; gap: 11px; padding: 14px 20px; }
.sidebar-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.08); border: 1.5px solid var(--rose);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 0.875rem; font-weight: 600; color: var(--rose); flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 0.813rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 0.594rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255,255,255,0.5); margin-top: 2px; }
.sidebar-logout { background: none; border: none; color: rgba(255,255,255,0.55); padding: 4px; border-radius: 4px; transition: color var(--transition); }
.sidebar-logout:hover { color: var(--rose); }

/* Profile dropdown */
.profile-menu { background: rgba(0,0,0,0.15); border-top: 1px solid rgba(255,255,255,0.10); overflow: hidden; }
.profile-menu-item { display: block; padding: 10px 22px; font-size: 0.813rem; color: rgba(255,255,255,0.75); transition: background var(--transition); }
.profile-menu-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.profile-menu-divider { height: 1px; background: rgba(255,255,255,0.10); margin: 4px 0; }
.profile-menu-signout { color: var(--rose); }
.profile-menu-signout:hover { color: var(--rose); background: rgba(255,255,255,0.06); }
#sidebar-user-area { cursor: pointer; }
#sidebar-user-area:hover { background: rgba(255,255,255,0.05); }
#sidebar-user-area svg { transition: transform 0.2s ease; margin-left: auto; opacity: 0.5; flex-shrink: 0; }

/* ── Top header ── */
.portal-header {
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; padding: 0 30px; gap: 14px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow);
  transition: background 0.25s, border-color 0.25s;
}
.portal-header h2 { flex: 1; font-family: var(--font-display); font-size: 1.13rem; font-weight: 600; }
.header-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-raised); border: 1px solid var(--border-default);
  border-radius: 999px; padding: 7px 15px; width: 220px;
  transition: background 0.25s, border-color 0.25s;
}
.header-search input { background: none; border: none; outline: none; color: var(--text-primary); font-size: 0.813rem; width: 100%; font-family: var(--font-body); }
.header-search input::placeholder { color: var(--text-tertiary); }
.header-search svg { color: var(--text-tertiary); flex-shrink: 0; }
.header-search:focus-within { border-color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 6px; }
.header-icon-btn { background: none; border: none; color: var(--text-secondary); padding: 6px; border-radius: 8px; position: relative; transition: all var(--transition); }
.header-icon-btn:hover { background: var(--bg-raised); color: var(--text-primary); }
.header-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent-bg); border: 1px solid var(--accent-border);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 0.813rem; font-weight: 600; color: var(--accent); flex-shrink: 0;
}
.notif-dot { position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; background: var(--accent); border-radius: 50%; border: 2px solid var(--bg-surface); }

/* ── Theme toggle ── */
.theme-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 999px;
  background: var(--bg-raised); border: 1px solid var(--border-default);
  color: var(--text-secondary); cursor: pointer; transition: all var(--transition);
}
.theme-toggle:hover { background: var(--bg-elevated); color: var(--accent); border-color: var(--accent-border); }

/* ── Page header ── */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-family: var(--font-display); font-size: 1.63rem; font-weight: 600; margin-bottom: 6px; }
.page-header p { font-size: 0.875rem; }

/* ── Welcome banner — burgundy ground + pinstripe ── */
.welcome-banner {
  background-color: var(--ground);
  background-image: var(--pinstripe);
  border-radius: var(--radius-lg); padding: 28px 32px;
  display: flex; align-items: center; justify-content: space-between; gap: 22px; flex-wrap: wrap;
  margin-bottom: 24px; color: #fff; box-shadow: var(--shadow-md);
}
[data-theme="dark"] .welcome-banner { background-color: var(--ground); }
.welcome-banner h1, .welcome-banner h2, .welcome-banner h3 {
  font-family: var(--font-display); font-weight: 600; color: #fff !important;
}
.welcome-banner p, .welcome-banner div, .welcome-banner span { color: #fff; }
.welcome-eyebrow { font-size: 0.656rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(255,255,255,0.55) !important; }
.welcome-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em;
  padding: 5px 13px; border-radius: 999px;
  background: rgba(255,255,255,0.13); color: var(--rose) !important;
}
.welcome-banner .btn-outline { color: #fff; border-color: rgba(255,255,255,0.45); background: none; }
.welcome-banner .btn-outline:hover { background: rgba(255,255,255,0.12); }

/* ── Grid helpers ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 22px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px,1fr)); gap: 18px; }

/* ── Live-raise tile (founder) — burgundy ground ── */
.raise-tile {
  background-color: var(--ground); background-image: var(--pinstripe);
  border-radius: var(--radius-lg); padding: 24px; color: #fff; box-shadow: var(--shadow-md);
}
.raise-tile .raise-label { font-size: 0.656rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(255,255,255,0.55); }
.raise-tile .raise-value { font-family: var(--font-display); font-size: 2rem; font-weight: 600; margin: 10px 0 4px; }
.raise-tile .raise-sub { font-size: 0.78rem; color: var(--rose); margin-bottom: 16px; }
.raise-tile .raise-bar { height: 5px; background: rgba(255,255,255,0.16); border-radius: 3px; overflow: hidden; margin-bottom: 16px; }
.raise-tile .raise-bar > span { display: block; height: 100%; background: var(--rose); border-radius: 3px; }
.raise-tile .raise-foot { display: flex; justify-content: space-between; font-size: 0.78rem; color: rgba(255,255,255,0.8); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ── Mobile hamburger + overlay ── */
.sidebar-toggle-btn { display: none; align-items: center; justify-content: center; width: 36px; height: 36px; background: none; border: none; cursor: pointer; color: var(--text-primary); border-radius: var(--radius); flex-shrink: 0; margin-right: 4px; }
.sidebar-toggle-btn:hover { background: var(--bg-elevated); }
.sidebar-toggle-btn svg { display: block; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 99; }
.sidebar-overlay.active { display: block; }

/* ── Side panels (notifications / help) ── */
.side-panel-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 200; }
.side-panel-overlay.active { display: block; }
.side-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 380px; max-width: 100vw;
  background: var(--bg-surface); border-left: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg); z-index: 201; display: flex; flex-direction: column;
  overflow: hidden; transform: translateX(100%); transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}
.side-panel.open { transform: translateX(0); }
.side-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 16px; border-bottom: 1px solid var(--border-subtle); flex-shrink: 0; }
.side-panel-title { font-family: var(--font-display); font-size: 1.06rem; font-weight: 600; color: var(--text-primary); }
.side-panel-close { width: 32px; height: 32px; background: none; border: none; cursor: pointer; color: var(--text-secondary); font-size: 1.25rem; line-height: 1; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; }
.side-panel-close:hover { background: var(--bg-elevated); color: var(--text-primary); }
.side-panel-body { flex: 1; overflow-y: auto; padding: 16px 20px 24px; }
.panel-section-header { display: flex; align-items: center; justify-content: space-between; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-tertiary); margin: 16px 0 8px; }
.panel-link-btn { background: none; border: none; cursor: pointer; color: var(--accent); font-size: 0.8rem; font-weight: 600; padding: 0; }
.panel-link-btn:hover { text-decoration: underline; }
.notif-list { display: flex; flex-direction: column; gap: 4px; }
.notif-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 10px; border-radius: var(--radius); background: var(--bg-raised); transition: background 0.15s; }
.notif-item:hover { background: var(--bg-elevated); }
.notif-item.read { opacity: 0.6; }
.notif-dot-sm { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; margin-top: 5px; }
.notif-dot-sm.read { background: transparent; border: 1.5px solid var(--border-default); }
.notif-content { flex: 1; min-width: 0; }
.notif-title { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.notif-desc { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-time { font-size: 0.73rem; color: var(--text-tertiary); }

/* ── Responsive ── */
@media (max-width: 1024px) { :root, [data-theme] { --sidebar-width: 232px; } }
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
  .sidebar.open { transform: translateX(0); }
  .portal-main { margin-left: 0; }
  .portal-content { padding: 18px 14px; }
  .form-row { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .header-search { display: none; }
  .sidebar-toggle-btn { display: flex; }
}
@media (max-width: 480px) { .side-panel { width: 100vw; } }
