/* ============================================================
   main.css — Intelligence Hub (index.html)
   D1 Refined Dark layout. Imports brand tokens.
   ============================================================ */

@import './tokens.css';

/* ---- Reset & Base ----------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  color: var(--color-text, #D4D4D4);
  background: var(--color-surface-alt, #111111);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

/* ============================================================
   HUB LAYOUT
   Two-column: fixed sidebar + scrollable main
   ============================================================ */

.hub-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.hub-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--color-sidebar-bg, #0A0A0A);
  border-right: 1px solid rgba(255,255,255,0.07);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  transition: width 220ms cubic-bezier(.4,0,.2,1);
}
.hub-sidebar::-webkit-scrollbar { display: none; }

/* ---- Sidebar Logo Row ---- */
.hsl-logo-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.hsl-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 8px 14px 16px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
}

.hsl-logo:hover { text-decoration: none; opacity: 0.9; }

.hsl-logo-img {
  height: 28px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  object-position: left center;
  border-radius: 4px;          /* softens white background on dark sidebar */
  flex-shrink: 0;
}

/* ---- Sidebar Collapse Button ---- */
.hsl-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.3);
  width: 28px;
  height: 28px;
  border-radius: 5px;
  flex-shrink: 0;
  margin-right: 10px;
  padding: 0;
  transition: color 150ms ease, background 150ms ease;
}
.hsl-collapse-btn:hover {
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.07);
}
.hsl-collapse-btn svg {
  transition: transform 220ms cubic-bezier(.4,0,.2,1);
}

/* ---- Sidebar Collapsed State ---- */
.hub-sidebar.sidebar--collapsed {
  width: 52px;
}

/* Nav items: icon-only, centered */
.hub-sidebar.sidebar--collapsed .hsl-nav-item {
  justify-content: center;
  padding: 9px 0;
  gap: 0;
}
.hub-sidebar.sidebar--collapsed .hsl-nav-item--active::before { display: none; }
.hub-sidebar.sidebar--collapsed .hsl-nav-item--active {
  background: rgba(197,33,39,0.2);
}
.hub-sidebar.sidebar--collapsed .hsl-nav-icon { opacity: 1; }

/* Hide text elements */
.hub-sidebar.sidebar--collapsed .hsl-nav-label,
.hub-sidebar.sidebar--collapsed .hsl-nav-count,
.hub-sidebar.sidebar--collapsed .hsl-library-head,
.hub-sidebar.sidebar--collapsed .hsl-library,
.hub-sidebar.sidebar--collapsed .hsl-user-info,
.hub-sidebar.sidebar--collapsed .hsl-user-settings {
  display: none;
}

/* Logo: center the collapse button, hide the logo image */
.hub-sidebar.sidebar--collapsed .hsl-logo {
  display: none;
}
.hub-sidebar.sidebar--collapsed .hsl-logo-row {
  justify-content: center;
}
.hub-sidebar.sidebar--collapsed .hsl-collapse-btn {
  margin: 9px auto;
}
.hub-sidebar.sidebar--collapsed .hsl-collapse-btn svg {
  transform: rotate(180deg);
}

/* User footer: avatar only, centered */
.hub-sidebar.sidebar--collapsed .hsl-user {
  justify-content: center;
  padding: 10px 0;
  gap: 0;
}

/* ---- Primary Nav ---- */
.hsl-nav {
  padding: 10px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hsl-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  background: transparent;
  border: none;
  color: var(--color-nav-text-muted, rgba(255,255,255,0.6));
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  width: 100%;
  transition: background 150ms ease, color 150ms ease;
  position: relative;
  text-decoration: none;
}

.hsl-nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--color-nav-text, #ffffff);
  text-decoration: none;
}

.hsl-nav-item--active {
  background: rgba(197,33,39,0.12);
  color: var(--color-nav-text, #ffffff);
  font-weight: 600;
}

.hsl-nav-item--active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: #C52127;
  border-radius: 0 3px 3px 0;
}

.hsl-nav-icon {
  flex-shrink: 0;
  color: currentColor;
  opacity: 0.7;
}

.hsl-nav-item--active .hsl-nav-icon { opacity: 1; }

.hsl-nav-label { flex: 1; }

.hsl-nav-count {
  font-size: 11px;
  color: var(--color-nav-text-muted, rgba(255,255,255,0.45));
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

/* ---- Library (categories) ---- */
.hsl-library-head {
  padding: 14px 18px 6px;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--color-nav-text-muted, rgba(255,255,255,0.45));
  font-weight: 700;
  text-transform: uppercase;
}

.hsl-library {
  padding: 0 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.hsl-lib-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  border: none;
  color: var(--color-nav-text-muted, rgba(255,255,255,0.6));
  font-size: 13px;
  font-weight: 400;
  text-align: left;
  width: 100%;
  transition: background 150ms ease, color 150ms ease;
}

.hsl-lib-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--color-nav-text, #ffffff);
}

.hsl-lib-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.hsl-lib-name { flex: 1; }

.hsl-lib-count {
  font-size: 11px;
  color: var(--color-nav-text-muted, rgba(255,255,255,0.45));
}

/* ---- User Footer ---- */
.hsl-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.hsl-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #C52127;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hsl-user-info {
  flex: 1;
  min-width: 0;
}

.hsl-user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-nav-text, #ffffff);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hsl-user-email {
  font-size: 11px;
  color: var(--color-nav-text-muted, rgba(255,255,255,0.45));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hsl-user-settings {
  display: flex;
  align-items: center;
  color: var(--color-nav-text-muted, rgba(255,255,255,0.45));
  flex-shrink: 0;
  padding: 4px;
  border-radius: 4px;
  transition: color 150ms ease, background 150ms ease;
  text-decoration: none;
}

.hsl-user-settings:hover {
  color: var(--color-nav-text, #ffffff);
  background: rgba(255,255,255,0.05);
  text-decoration: none;
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */

.hub-main {
  flex: 1;
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-surface-alt, #111111);
  overflow: hidden;
}

/* ============================================================
   TOPBAR
   ============================================================ */

.hub-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 32px;
  height: 54px;
  background: var(--color-hero-bg, #0A0A0A);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}

/* Breadcrumb */
.hub-topbar-bc {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #706E6B;
  flex-shrink: 0;
}

/* Search */
.hub-topbar-search {
  flex: 1 1 240px;
  min-width: 180px;
  max-width: 520px;
  position: relative;
  margin: 0 16px;
}

.hub-topbar-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #585654;
  pointer-events: none;
}

.hub-topbar-search-input {
  width: 100%;
  background: #1A1816;
  border: 1px solid #2A2826;
  border-radius: 8px;
  padding: 8px 40px 8px 32px;
  color: #E8E5E0;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color 150ms ease;
}

.hub-topbar-search-input::placeholder { color: #585654; }

.hub-topbar-search-input:focus {
  border-color: #C52127;
  background: #1E1C1A;
}

/* Removes native search clear button in webkit */
.hub-topbar-search-input::-webkit-search-cancel-button { display: none; }

.hub-topbar-kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: #585654;
  border: 1px solid #2A2826;
  padding: 1px 5px;
  border-radius: 4px;
  background: #141210;
  pointer-events: none;
}

/* Right cluster */
.hub-topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  margin-left: auto;
}

.hub-status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #706E6B;
  white-space: nowrap;
}

.hub-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3D9463;
  flex-shrink: 0;
}

.hub-topbar-div {
  width: 1px;
  height: 16px;
  background: #2A2826;
}

.hub-topbar-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: #706E6B;
  padding: 4px;
  border-radius: 5px;
  transition: color 150ms ease, background 150ms ease;
}

.hub-topbar-icon-btn:hover {
  color: #E8E5E0;
  background: rgba(255,255,255,0.05);
}

.hub-topbar-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #C52127;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

/* ============================================================
   SCROLLABLE CONTENT
   ============================================================ */

.hub-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.hub-view {
  padding: 28px 36px 72px;
  max-width: 1440px;
  width: 100%;
}

/* ============================================================
   HERO
   ============================================================ */

.hub-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.hub-eyebrow {
  font-size: 10.5px;
  letter-spacing: 2.4px;
  color: #C52127;
  font-weight: 700;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.hub-greeting {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.8px;
  color: #F0EDE8;
  line-height: 1.15;
  margin: 0;
}

.hub-hero-sub {
  margin-top: 6px;
  color: #706E6B;
  font-size: 13.5px;
}

.hub-hero-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

/* Buttons */
.hub-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: none;
  font-family: 'Inter', sans-serif;
  transition: opacity 150ms ease;
}

.hub-btn:hover { opacity: 0.85; text-decoration: none; }

.hub-btn--primary {
  background: #C52127;
  color: #fff;
}

.hub-btn--secondary {
  background: #1E1C1A;
  color: #E8E5E0;
  border: 1px solid #2A2826;
}

/* ============================================================
   AI ASK BAR
   ============================================================ */

.hub-ask-bar {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #1A1916 0%, #1A1916 60%, #2B1013 100%);
  border: 1px solid #2A2826;
  border-radius: 14px;
  /* Padding tightens when collapsed (the inner content drives the height
     normally; with content hidden there'd be excess whitespace at the
     bottom). */
  padding: 14px 18px;
  margin-bottom: 36px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
  transition: padding 180ms ease;
}
/* Expanded state — restore the original generous padding so the input row
   has breathing room when visible. */
.hub-ask-bar.is-expanded { padding: 18px 20px; }

.hub-ask-bar-glow {
  position: absolute;
  right: -40px;
  top: -60px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(197,33,39,0.18) 0%, transparent 70%);
  pointer-events: none;
}

/* Header is now a button that toggles collapse/expand. Same visual look as
   the original div header, just clickable with a chevron at the right edge. */
.hub-ask-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  color: inherit;
  transition: opacity 150ms ease;
}
.hub-ask-header:hover { opacity: 0.9; }
.hub-ask-header:focus-visible {
  outline: 2px solid var(--color-primary, #C52127);
  outline-offset: 3px;
  border-radius: 6px;
}
/* Push the chevron to the right edge */
.hub-ask-chevron {
  margin-left: auto;
  color: rgba(255,255,255,0.45);
  transition: transform 180ms ease, color 150ms ease;
  flex-shrink: 0;
}
.hub-ask-header:hover .hub-ask-chevron { color: rgba(255,255,255,0.85); }
.hub-ask-bar.is-expanded .hub-ask-chevron { transform: rotate(180deg); }

/* Content wrapper — sits below the header. Top-margin appears only when
   expanded so the collapsed state is tight. */
.hub-ask-content { margin-top: 14px; }

.hub-ask-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #C52127;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}

.hub-ask-title {
  font-size: 13px;
  font-weight: 600;
  color: #F0EDE8;
}

.hub-ask-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #C52127;
  background: rgba(197,33,39,0.14);
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
}

.hub-ask-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.hub-ask-input {
  flex: 1;
  background: #141210;
  border: 1px solid #2A2826;
  border-radius: 10px;
  padding: 12px 14px;
  color: #E8E5E0;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  outline: none;
}

.hub-ask-input::placeholder { color: #585654; }
.hub-ask-input:disabled { cursor: not-allowed; opacity: 0.6; }

.hub-ask-btn {
  background: #C52127;
  color: #fff;
  border: none;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
  transition: opacity 150ms ease;
}

.hub-ask-btn:hover:not(:disabled) { opacity: 0.85; }
.hub-ask-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.hub-ask-chips {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.hub-ask-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #141210;
  border: 1px solid #2A2826;
  font-size: 11.5px;
  color: #706E6B;
  cursor: default;
}

/* ============================================================
   SECTIONS
   ============================================================ */

.hub-section {
  margin-top: 40px;
}

.hub-section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}

.hub-section-title {
  font-size: 17px;
  font-weight: 600;
  color: #F0EDE8;
  letter-spacing: -0.2px;
  line-height: 1;
}

.hub-section-sub {
  font-size: 13px;
  color: #706E6B;
}

/* ============================================================
   PINNED CARDS GRID
   ============================================================ */

.hub-pinned-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.hub-pinned-empty {
  font-size: 13px;
  color: #706E6B;
  padding: 20px 0;
}

/* Individual pinned card */
.hub-pin-card {
  background: #1A1916;
  border: 1px solid #2A2826;
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
  outline: none;
}

.hub-pin-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(197,33,39,0.1), 0 2px 8px rgba(0,0,0,0.4);
  border-color: rgba(197,33,39,0.4);
}

.hub-pin-card:focus-visible {
  outline: 2px solid #C52127;
  outline-offset: 2px;
}

.hub-pin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hub-pin-card-cat {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hub-pin-cat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.hub-pin-cat-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.hub-pin-star {
  font-size: 13px;
  color: #f5c518;
  line-height: 1;
}

.hub-pin-card-title {
  font-size: 16px;
  font-weight: 600;
  color: #F0EDE8;
  letter-spacing: -0.2px;
  line-height: 1.3;
}

.hub-pin-card-desc {
  font-size: 12.5px;
  color: #706E6B;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.hub-pin-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid #2A2826;
  font-size: 11.5px;
  color: #706E6B;
}

.hub-pin-card-meta {
  display: flex;
  align-items: center;
  gap: 4px;
}

.hub-pin-open {
  font-size: 16px;
  color: #585654;
  line-height: 1;
  transform: rotate(-45deg);
  display: inline-block;
}

/* ============================================================
   TWO COLUMN LAYOUT
   ============================================================ */

.hub-two-col {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  margin-top: 40px;
  align-items: start;
}

/* ============================================================
   RECENT LIST (all dashboards in home view)
   ============================================================ */

.hub-recent-list {
  background: #1A1916;
  border: 1px solid #2A2826;
  border-radius: 10px;
  overflow: hidden;
}

.hub-recent-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid #222120;
  cursor: pointer;
  transition: background 150ms ease;
}

.hub-recent-row:last-child { border-bottom: none; }

.hub-recent-row:hover {
  background: rgba(255,255,255,0.03);
}

.hub-recent-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

.hub-recent-info {
  flex: 1;
  min-width: 0;
}

.hub-recent-title {
  font-size: 13px;
  font-weight: 600;
  color: #E8E5E0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hub-recent-meta {
  font-size: 11.5px;
  color: #706E6B;
  margin-top: 1px;
}

.hub-recent-chev {
  color: #585654;
  flex-shrink: 0;
}

/* ============================================================
   QUICK LINKS
   ============================================================ */

.hub-quick-links {
  background: #1A1916;
  border: 1px solid #2A2826;
  border-radius: 10px;
  overflow: hidden;
}

.hub-quick-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #222120;
  cursor: pointer;
  transition: background 150ms ease;
  text-decoration: none;
}

.hub-quick-link:last-child { border-bottom: none; }

.hub-quick-link:hover {
  background: rgba(255,255,255,0.03);
  text-decoration: none;
}

.hub-quick-link-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(197,33,39,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #C52127;
  flex-shrink: 0;
}

.hub-quick-link-title {
  font-size: 13px;
  font-weight: 600;
  color: #E8E5E0;
}

.hub-quick-link-sub {
  font-size: 11.5px;
  color: #706E6B;
  margin-top: 1px;
}

.hub-quick-link > div:nth-child(2) {
  flex: 1;
  min-width: 0;
}

.hub-quick-link-arrow {
  color: #585654;
  flex-shrink: 0;
}

/* ============================================================
   CATEGORY GRID
   ============================================================ */

.hub-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

/* Individual category card */
.hub-cat-card {
  background: #1A1916;
  border: 1px solid #2A2826;
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
  outline: none;
}

.hub-cat-card:hover {
  background: #1E1C1A;
  border-color: #3A3836;
}

.hub-cat-card:focus-visible {
  outline: 2px solid #C52127;
  outline-offset: 2px;
}

/* "My Sandbox" folder card on the home page browse view — amber left
   border that matches the sandbox pill on cards / list rows / Manage. */
.hub-cat-card--sandbox {
  border-left: 3px solid #F5C518;
  background: linear-gradient(90deg, rgba(245,197,24,0.05) 0%, #1A1916 60%);
}
.hub-cat-card--sandbox:hover {
  background: linear-gradient(90deg, rgba(245,197,24,0.10) 0%, #1E1C1A 60%);
  border-color: #F5C518;
}
body.theme-light .hub-cat-card--sandbox,
[data-theme="light"] .hub-cat-card--sandbox {
  background: linear-gradient(90deg, rgba(245,197,24,0.10) 0%, #FFFFFF 60%);
}

.hub-cat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.hub-cat-card-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hub-cat-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.hub-cat-card-name {
  font-size: 14px;
  font-weight: 600;
  color: #E8E5E0;
}

.hub-cat-card-count {
  font-size: 11.5px;
  color: #706E6B;
  margin-top: 1px;
}

.hub-cat-chev {
  color: #585654;
}

.hub-cat-card-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hub-cat-card-item {
  font-size: 12px;
  color: #706E6B;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hub-cat-card-item-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #585654;
  flex-shrink: 0;
}

.hub-cat-more {
  font-size: 11.5px;
  color: #585654;
  margin-top: 3px;
}

/* ============================================================
   BROWSE VIEW — Breadcrumb
   ============================================================ */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.breadcrumb-back {
  background: none;
  border: none;
  cursor: pointer;
  color: #C52127;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  padding: 0;
  transition: opacity 150ms ease;
}

.breadcrumb-back:hover { opacity: 0.75; }

.breadcrumb-sep {
  color: #706E6B;
  font-size: 13px;
}

.breadcrumb-current {
  font-size: 13px;
  font-weight: 600;
  color: #E8E5E0;
}

/* ============================================================
   CARD GRID (browse view)
   ============================================================ */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-min-width, 280px), 1fr));
  gap: 20px;
}

/* ============================================================
   SPINNER & EMPTY STATE
   ============================================================ */

.spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 48px;
}

.spinner-ring {
  width: 36px;
  height: 36px;
  border: 3px solid #2A2826;
  border-top-color: #C52127;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: #706E6B;
  font-size: 15px;
}

/* ============================================================
   DASHBOARD CARD (used in browse view / card-grid)
   ============================================================ */

.dashboard-card {
  background: #1A1916;
  border-radius: 12px;
  border: 1px solid #2A2826;
  overflow: hidden;
  cursor: pointer;
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
  display: flex;
  flex-direction: column;
  outline: none;
  position: relative;
}

.dashboard-card:hover,
.dashboard-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(197,33,39,0.12), 0 2px 8px rgba(0,0,0,0.4);
  border-color: rgba(197,33,39,0.4);
}

/* Thin accent strip */
.card-accent {
  position: relative;
  height: 3px;
  width: 100%;
  flex-shrink: 0;
  background: #C52127;
}

.card-accent.cat-default    { background: var(--cat-default); }
.card-accent.cat-sales      { background: var(--cat-sales); }
.card-accent.cat-operations { background: var(--cat-operations); }
.card-accent.cat-finance    { background: var(--cat-finance); }
.card-accent.cat-marketing  { background: var(--cat-marketing); }
.card-accent.cat-hr         { background: var(--cat-hr); }

/* Card Body */
.card-body {
  padding: 16px 18px 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.card-category-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #C52127;
  background: rgba(197,33,39,0.12);
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.card-newtab-badge {
  font-size: 11.5px;
  color: #706E6B;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Sandbox pill — only the owner ever sees this since /api/registry filters
   other users' sandboxes out. Yellow/amber chip distinguishes "draft" from
   the red category badge. */
.card-sandbox-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #B45309;
  background: rgba(245,158,11,0.18);
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}
[data-theme="dark"] .card-sandbox-badge,
.card-sandbox-badge { /* keep readable in dark mode too */
  color: #F5C518;
  background: rgba(245,197,24,0.14);
}

/* Inline pill on list rows. Same visual identity, but tighter so it sits
   nicely next to the title text. */
.list-row__sandbox {
  display: inline-block;
  margin-left: 8px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #F5C518;
  background: rgba(245,197,24,0.14);
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
  vertical-align: middle;
}

/* Favorite star */
.card-fav-btn {
  background: none;
  border: none;
  padding: 2px 4px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  color: #706E6B;
  border-radius: 4px;
  transition: color 150ms ease, transform 150ms ease;
  flex-shrink: 0;
}

.card-fav-btn:hover { color: #C52127; transform: scale(1.15); }
.card-fav-btn--active { color: #f5c518; }
.card-fav-btn--active:hover { color: #706E6B; }

/* Favorites folder card */
.card-accent--favorites {
  background: linear-gradient(90deg, #C52127 0%, #F14F4D 100%);
}

.card-category-badge--favorites {
  background: rgba(197,33,39,0.18);
  color: #C52127;
}

.card-title--favorites {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fav-folder-star {
  color: #f5c518;
  font-size: 1.1em;
  line-height: 1;
}

/* Live data connection badge */
.card-live-badge {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.9);
  background: rgba(0,0,0,0.4);
  border-radius: 3px;
  padding: 1px 5px;
  white-space: nowrap;
  pointer-events: none;
  line-height: 1.6;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: #F0EDE8;
  line-height: 1.25;
}

.card-description {
  font-size: 13px;
  color: #706E6B;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.card-tag {
  font-size: 11.5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #1E1C1A;
  color: #706E6B;
  border: 1px solid #2A2826;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid #242220;
  margin-top: auto;
}

.card-author,
.card-date {
  font-size: 11.5px;
  color: #706E6B;
}

/* Owner badge in the card footer — shows "You" for the current user, or the
   email's name part for everyone else. Highlight when "You" so the user can
   spot their own dashboards at a glance. */
.card-author-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.card-owner {
  font-size: 11.5px;
  font-weight: 600;
  color: #9CA3AF;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.card-owner--me {
  color: #C52127;
  background: rgba(197,33,39,.08);
  padding: 1px 7px;
  border-radius: 9px;
  font-weight: 700;
}

/* Export-HTML button — same visual treatment as the edit/info buttons.
   Always visible on hover (no permission gate — anyone can download). */
.card-export-btn {
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  color: #706E6B;
  padding: 4px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 150ms ease, color 150ms ease, background 150ms ease;
  flex-shrink: 0;
}
.dashboard-card:hover .card-export-btn,
.dashboard-card:focus-within .card-export-btn {
  opacity: 1;
}
.card-export-btn:hover {
  color: #E8E5E0;
  background: #242220;
}

/* ============================================================
   CARD EDIT BUTTON
   ============================================================ */

.card-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: #706E6B;
  padding: 0 4px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 150ms ease, color 150ms ease, background 150ms ease;
  flex-shrink: 0;
}

.dashboard-card:hover .card-edit-btn,
.dashboard-card:focus-within .card-edit-btn,
.dashboard-card.card--editing .card-edit-btn {
  opacity: 1;
}

.card-edit-btn:hover {
  color: #E8E5E0;
  background: #242220;
}

/* ============================================================
   CARD INFO BUTTON
   ============================================================ */

.card-info-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: #706E6B;
  padding: 0 4px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color 150ms ease;
}

.card-info-btn:hover { color: #E8E5E0; }
.dashboard-card .card-info-btn { opacity: 1; }

/* ============================================================
   CARD MODALS
   ============================================================ */

.card-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.card-modal {
  background: #1A1916;
  border: 1px solid #2A2826;
  border-radius: 12px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.7);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 88vh;
}

.card-modal--wide { max-width: 480px; }

.card-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid #2A2826;
}

.card-modal-heading { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.card-modal-title {
  font-size: 14px;
  font-weight: 700;
  color: #F0EDE8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-modal-subtitle {
  font-size: 11.5px;
  color: #706E6B;
}

.card-modal-close {
  background: none;
  border: none;
  color: #706E6B;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 4px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: color 150ms ease, background 150ms ease;
}

.card-modal-close:hover { color: #E8E5E0; background: #242220; }

.card-modal-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.card-modal-footer {
  display: flex;
  gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid #2A2826;
}

/* Card Edit Panel */
.card-edit-panel {
  border-top: 1px solid #2A2826;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #1A1916;
}

.card-edit-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
/* The visibility row uses tall cards instead of a single-line input, so
   align the label to the top of the row instead of centering it. */
.card-edit-row:has(.card-edit-visibility) {
  align-items: flex-start;
}

.card-edit-label {
  font-size: 11.5px;
  font-weight: 500;
  color: #706E6B;
  white-space: nowrap;
  width: 80px;
  flex-shrink: 0;
}

/* Visibility radio cards — two side-by-side options with a title + hint. */
.card-edit-visibility {
  display: flex;
  flex: 1;
  gap: 8px;
}
.card-vis-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid #2A2826;
  border-radius: 6px;
  background: #141210;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.card-vis-option:hover { border-color: #6B6B6B; }
.card-vis-option.is-selected {
  border-color: #C52127;
  background: rgba(197,33,39,0.10);
}
.card-vis-option input[type="radio"] {
  /* keep accessible but hide visually; selection is communicated by the
     is-selected class on the wrapping label */
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}
.card-vis-option__title {
  font-size: 12px;
  font-weight: 600;
  color: #E8E5E0;
}
.card-vis-option__hint {
  font-size: 10.5px;
  line-height: 1.35;
  color: #8A8783;
}
.card-vis-option.is-selected .card-vis-option__title { color: #FFFFFF; }
[data-theme="light"] .card-vis-option,
body.theme-light .card-vis-option {
  background: #FFFFFF;
  border-color: #E5E5E5;
}
[data-theme="light"] .card-vis-option__title,
body.theme-light .card-vis-option__title { color: #2E2E2E; }
[data-theme="light"] .card-vis-option__hint,
body.theme-light .card-vis-option__hint { color: #6B6B6B; }

.card-edit-category {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid #2A2826;
  border-radius: 4px;
  background: #141210;
  color: #E8E5E0;
  font-family: 'Inter', sans-serif;
  font-size: 11.5px;
}

.card-edit-category:focus {
  outline: none;
  border-color: #C52127;
}

.card-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card-color-picker {
  width: 34px;
  height: 26px;
  padding: 1px 2px;
  border: 1.5px solid #2A2826;
  border-radius: 4px;
  background: none;
  cursor: pointer;
  flex-shrink: 0;
}

.color-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
  flex-shrink: 0;
}

.color-swatch:hover { transform: scale(1.15); }

.color-swatch.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px #C52127;
}

.card-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.btn-card-save {
  padding: 4px 12px;
  background: #C52127;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: opacity 150ms ease;
}
.btn-card-save:hover { opacity: 0.85; }

.btn-card-delete {
  padding: 4px 12px;
  background: none;
  color: #C52127;
  border: 1px solid #C52127;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}
.btn-card-delete:hover { background: #C52127; color: #fff; }

.btn-card-reset {
  padding: 4px 12px;
  background: none;
  border: 1px solid #2A2826;
  border-radius: 4px;
  color: #706E6B;
  font-family: 'Inter', sans-serif;
  font-size: 11.5px;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease;
}
.btn-card-reset:hover { color: #E8E5E0; border-color: #706E6B; }

.btn-card-cancel {
  padding: 4px 12px;
  background: none;
  color: #706E6B;
  border: 1px solid #2A2826;
  border-radius: 4px;
  font-size: 11.5px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease;
}
.btn-card-cancel:hover { color: #E8E5E0; border-color: #706E6B; }

/* ============================================================
   SIDEBAR RIGHT-CLICK CONTEXT MENU
   ============================================================ */

.sidebar-context-menu {
  position: fixed;
  z-index: 10000;
  background: #1A1916;
  border: 1px solid #2A2826;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  padding: 4px 0;
  min-width: 176px;
}

.sidebar-context-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: #D4D4D4;
  padding: 8px 14px;
  text-align: left;
  transition: background 150ms ease;
}

.sidebar-context-item:hover {
  background: rgba(255,255,255,0.05);
  color: #E8E5E0;
}

/* ============================================================
   DATA CONNECTION STATUS (in card modal)
   ============================================================ */

.conn-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  flex-wrap: wrap;
}

.conn-dot { font-size: 12px; flex-shrink: 0; }
.conn-label { font-weight: 500; color: #E8E5E0; }
.conn-detail { color: #706E6B; }

.conn-detail code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 10px;
  background: #141210;
  padding: 1px 4px;
  border-radius: 3px;
}

/* Description tooltip */
.card-desc-tooltip {
  position: fixed;
  z-index: 9999;
  max-width: 260px;
  background: #1E1C1A;
  color: #E8E5E0;
  font-size: 11.5px;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  pointer-events: none;
  white-space: normal;
  word-break: break-word;
  border: 1px solid #2A2826;
}

/* ============================================================
   CATEGORY FOLDER CARD (legacy — used in renderCategoryCards)
   ============================================================ */

.category-card .card-description {
  font-size: 13px;
  font-weight: 500;
  color: #C52127;
}

.category-card-arrow {
  color: #706E6B;
  flex-shrink: 0;
  transition: transform 150ms ease, color 150ms ease;
}

.category-card:hover .category-card-arrow,
.category-card:focus-visible .category-card-arrow {
  transform: translateX(4px);
  color: #C52127;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 900px) {
  .hub-two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .hub-sidebar {
    display: none; /* Hidden on mobile — could add hamburger later */
  }

  .hub-view {
    padding: 20px 16px 48px;
  }

  .hub-topbar {
    padding: 0 16px;
  }

  .hub-status-pill { display: none; }
  .hub-topbar-div { display: none; }

  .hub-greeting { font-size: 26px; }

  .hub-pinned-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   LIGHT MODE OVERRIDES (body.theme-light)
   The topbar and sidebar keep the user's nav color (dark by
   default) — light mode only affects the main content area.
   ============================================================ */

body.theme-light .hub-greeting { color: #111111; }
body.theme-light .hub-hero-sub { color: #6B6B6B; }
body.theme-light .hub-section-title { color: #111111; }
body.theme-light .hub-section-sub { color: #6B6B6B; }
body.theme-light .hub-pinned-empty { color: #9CA3AF; }

/* Sidebar border adapts to light content area */
body.theme-light .hub-sidebar { border-right-color: rgba(0,0,0,0.08); }

/* AI Ask Bar */
body.theme-light .hub-ask-bar {
  background: #FFFFFF;
  border-color: #E0E0E0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
body.theme-light .hub-ask-title { color: #111111; }
body.theme-light .hub-ask-input {
  background: #F5F5F5;
  border-color: #E0E0E0;
  color: #2E2E2E;
}
body.theme-light .hub-ask-input::placeholder { color: #9CA3AF; }
body.theme-light .hub-ask-chip {
  background: #F5F5F5;
  border-color: #E0E0E0;
  color: #6B6B6B;
}

/* Secondary button (hero) */
body.theme-light .hub-btn--secondary {
  background: #FFFFFF;
  color: #2E2E2E;
  border-color: #E0E0E0;
}

/* Pinned cards */
body.theme-light .hub-pin-card {
  background: #FFFFFF;
  border-color: #E0E0E0;
}
body.theme-light .hub-pin-card:hover {
  box-shadow: 0 8px 28px rgba(197,33,39,0.08), 0 2px 8px rgba(0,0,0,0.10);
  border-color: rgba(197,33,39,0.35);
}
body.theme-light .hub-pin-card-title { color: #111111; }
body.theme-light .hub-pin-card-desc { color: #6B6B6B; }
body.theme-light .hub-pin-card-footer {
  border-top-color: #EFEFEF;
  color: #9CA3AF;
}
body.theme-light .hub-pin-open { color: #9CA3AF; }

/* Recent dashboards list */
body.theme-light .hub-recent-list {
  background: #FFFFFF;
  border-color: #E0E0E0;
}
body.theme-light .hub-recent-row { border-bottom-color: #F0F0F0; }
body.theme-light .hub-recent-row:hover { background: rgba(0,0,0,0.02); }
body.theme-light .hub-recent-title { color: #2E2E2E; }
body.theme-light .hub-recent-meta { color: #6B6B6B; }
body.theme-light .hub-recent-chev { color: #9CA3AF; }

/* Quick links */
body.theme-light .hub-quick-links {
  background: #FFFFFF;
  border-color: #E0E0E0;
}
body.theme-light .hub-quick-link { border-bottom-color: #F0F0F0; }
body.theme-light .hub-quick-link:hover { background: rgba(0,0,0,0.02); }
body.theme-light .hub-quick-link-title { color: #2E2E2E; }
body.theme-light .hub-quick-link-sub { color: #6B6B6B; }
body.theme-light .hub-quick-link-arrow { color: #9CA3AF; }

/* Category cards */
body.theme-light .hub-cat-card {
  background: #FFFFFF;
  border-color: #E0E0E0;
}
body.theme-light .hub-cat-card:hover {
  background: #F5F5F5;
  border-color: #D0D0D0;
}
body.theme-light .hub-cat-card-name { color: #2E2E2E; }
body.theme-light .hub-cat-card-count { color: #6B6B6B; }
body.theme-light .hub-cat-chev { color: #9CA3AF; }
body.theme-light .hub-cat-card-item { color: #6B6B6B; }
body.theme-light .hub-cat-card-item-dot { background: #9CA3AF; }
body.theme-light .hub-cat-more { color: #9CA3AF; }

/* Browse view breadcrumb */
body.theme-light .breadcrumb-current { color: #2E2E2E; }
body.theme-light .breadcrumb-sep { color: #9CA3AF; }
body.theme-light .spinner-ring { border-color: #E0E0E0; }
body.theme-light .empty-state { color: #6B6B6B; }

/* Dashboard cards (browse view) */
body.theme-light .dashboard-card {
  background: #FFFFFF;
  border-color: #E0E0E0;
}
body.theme-light .dashboard-card:hover,
body.theme-light .dashboard-card:focus-visible {
  box-shadow: 0 8px 28px rgba(197,33,39,0.10), 0 2px 8px rgba(0,0,0,0.12);
}
body.theme-light .card-title { color: #111111; }
body.theme-light .card-description { color: #6B6B6B; }
body.theme-light .card-newtab-badge { color: #9CA3AF; }
body.theme-light .card-fav-btn { color: #9CA3AF; }
body.theme-light .card-tag {
  background: #F5F5F5;
  border-color: #E0E0E0;
  color: #6B6B6B;
}
body.theme-light .card-footer { border-top-color: #EFEFEF; }
body.theme-light .card-author,
body.theme-light .card-date { color: #6B6B6B; }

/* Card modals */
body.theme-light .card-modal-overlay { background: rgba(0,0,0,0.4); }
body.theme-light .card-modal {
  background: #FFFFFF;
  border-color: #E0E0E0;
  box-shadow: 0 24px 64px rgba(0,0,0,0.20);
}
body.theme-light .card-modal-header { border-bottom-color: #E0E0E0; }
body.theme-light .card-modal-title { color: #111111; }
body.theme-light .card-modal-subtitle { color: #6B6B6B; }
body.theme-light .card-modal-footer { border-top-color: #E0E0E0; }
body.theme-light .card-modal-close { color: #9CA3AF; }
body.theme-light .card-modal-close:hover { color: #2E2E2E; background: #F5F5F5; }

/* Card edit panel */
body.theme-light .card-edit-panel {
  background: #FFFFFF;
  border-top-color: #E0E0E0;
}
body.theme-light .card-edit-label { color: #6B6B6B; }
body.theme-light .card-edit-category {
  background: #F5F5F5;
  border-color: #E0E0E0;
  color: #2E2E2E;
}
body.theme-light .btn-card-cancel,
body.theme-light .btn-card-reset {
  border-color: #E0E0E0;
  color: #6B6B6B;
}
body.theme-light .btn-card-cancel:hover,
body.theme-light .btn-card-reset:hover { color: #2E2E2E; border-color: #9CA3AF; }

/* Context menu */
body.theme-light .sidebar-context-menu {
  background: #FFFFFF;
  border-color: #E0E0E0;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
body.theme-light .sidebar-context-item { color: #2E2E2E; }
body.theme-light .sidebar-context-item:hover {
  background: rgba(0,0,0,0.04);
  color: #111111;
}

/* Tooltip */
body.theme-light .card-desc-tooltip {
  background: #FFFFFF;
  color: #2E2E2E;
  border-color: #E0E0E0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* Connection status */
body.theme-light .conn-label { color: #2E2E2E; }
body.theme-light .conn-detail code {
  background: #F5F5F5;
  color: #2E2E2E;
}

/* ============================================================
   CARD PREVIEW TOOLTIP
   Floating scaled-iframe preview that appears on card hover (see
   src/modules/card-preview.js). Single instance across the grid.
   ============================================================ */
.card-preview {
  position: fixed;
  z-index: 10000;
  /* Width covers the scaled iframe + caption strip. */
  width: 480px;
  pointer-events: auto;
  border-radius: 10px;
  background: #18160F;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.55),
    0 4px 12px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.10);
  overflow: hidden;
  animation: cardPreviewIn .18s ease-out;
}
@keyframes cardPreviewIn {
  from { opacity: 0; transform: scale(.97) translateY(4px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

.card-preview__frame {
  position: relative;
  width: 480px;
  height: 300px;
  background: #0d0c0a;
  overflow: hidden;
}
.card-preview__frame iframe {
  /* Render at 2x the visible size, then scale 50% so the preview is sharp
     on retina AND fits the visible area. Mouse interaction is disabled via
     the shade overlay below so the iframe is read-only. */
  width: 960px;
  height: 600px;
  border: 0;
  transform: scale(0.5);
  transform-origin: top left;
  pointer-events: none;
  background: #FFFFFF;
}
[data-theme="dark"] .card-preview__frame iframe { background: #18160F; }
.card-preview__shade {
  /* Subtle gradient at the bottom of the iframe so the caption strip below
     blends in without a hard seam. */
  position: absolute;
  inset: auto 0 0 0;
  height: 32px;
  background: linear-gradient(to bottom, rgba(24,22,15,0), rgba(24,22,15,0.85));
  pointer-events: none;
}

.card-preview__caption {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #18160F;
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.card-preview__title {
  font-weight: 700;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-preview__hint {
  color: rgba(255, 255, 255, 0.45);
  font-size: 11px;
  white-space: nowrap;
}

/* On narrow screens (e.g. mobile), don't show the floating preview at all —
   it would cover too much of the viewport. Cards still open on tap. */
@media (max-width: 720px) {
  .card-preview { display: none !important; }
}

/* ============================================================
   BROWSE TOOLBAR — sits above the card grid / list, holds the
   view-mode toggle (grid / list).
   ============================================================ */
.browse-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 14px;
  gap: 10px;
}

.view-toggle {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 2px;
  background: rgba(255,255,255,0.03);
}
.view-toggle__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  color: rgba(255,255,255,0.55);
  transition: background 150ms ease, color 150ms ease;
}
.view-toggle__btn:hover { color: rgba(255,255,255,0.9); background: rgba(255,255,255,0.06); }
.view-toggle__btn.is-active {
  background: rgba(197,33,39,0.18);
  color: #FFFFFF;
}
.view-toggle__btn:focus-visible {
  outline: 2px solid #C52127;
  outline-offset: 2px;
}

/* ============================================================
   LIST VIEW — rows of dashboards, denser than card grid
   ============================================================ */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.list-row {
  display: grid;
  grid-template-columns: 6px 110px 1fr 64px 110px 100px auto;
  align-items: center;
  gap: 14px;
  padding: 10px 14px 10px 0;
  background: var(--color-card-bg, #1A1916);
  border: 1px solid var(--color-card-border, #242220);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
  position: relative;
  overflow: hidden;
}
.list-row:hover {
  border-color: rgba(197,33,39,0.35);
  background: var(--color-card-bg-hover, #1F1D1A);
  transform: translateY(-1px);
}
.list-row:focus-visible {
  outline: 2px solid #C52127;
  outline-offset: 2px;
}

.list-row__accent {
  background: #6B6B6B;
  height: 100%;
  width: 6px;
  position: absolute;
  inset: 0 auto 0 0;
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}
/* Category accents — match the card accent palette */
.list-row__accent.cat-sales      { background: #C52127; }
.list-row__accent.cat-operations { background: #2E2E2E; }
.list-row__accent.cat-finance    { background: #980000; }
.list-row__accent.cat-marketing  { background: #F14F4D; }
.list-row__accent.cat-hr         { background: #6B6B6B; }

.list-row__category {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 14px;
}

.list-row__title-block {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.list-row__title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-text, #E8E5E0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-row__desc {
  font-size: 11.5px;
  color: rgba(255,255,255,0.50);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-row__type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.list-row__type--live {
  background: rgba(74, 222, 128, 0.12);
  color: rgba(134, 239, 172, 0.95);
  border: 1px solid rgba(74, 222, 128, 0.25);
}
.list-row__type--static {
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.list-row__owner {
  font-size: 11.5px;
  font-weight: 600;
  color: rgba(255,255,255,0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-row__owner--me {
  color: #F14F4D;
  background: rgba(197,33,39,0.08);
  padding: 1px 7px;
  border-radius: 9px;
}
.list-row__owner--empty { color: rgba(255,255,255,0.30); }

.list-row__date {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.list-row__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.list-row__fav-btn,
.list-row__edit-btn,
.list-row__export-btn {
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  color: rgba(255,255,255,0.45);
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 14px;
  transition: opacity 150ms ease, color 150ms ease, background 150ms ease;
}
.list-row__edit-btn,
.list-row__export-btn { opacity: 0; }
.list-row:hover .list-row__edit-btn,
.list-row:hover .list-row__export-btn,
.list-row:focus-within .list-row__edit-btn,
.list-row:focus-within .list-row__export-btn { opacity: 1; }

.list-row__fav-btn:hover,
.list-row__edit-btn:hover,
.list-row__export-btn:hover {
  color: rgba(255,255,255,0.95);
  background: rgba(255,255,255,0.06);
}
.list-row__fav-btn--active { color: #f5c518; }

/* Narrow screens — collapse less critical columns */
@media (max-width: 900px) {
  .list-row {
    grid-template-columns: 6px 1fr 64px auto;
  }
  .list-row__category,
  .list-row__owner,
  .list-row__date { display: none; }
}
