/* Extracted from templates/base.html — site chrome, notes sidebar, floating viewer */

        html {
            height: 100%;
            /* Single document scroll root — nested html+body overflow causes stutter */
            overflow-x: hidden;
            overflow-y: auto;
        }

        body {
            min-height: 100%;
            display: flex;
            flex-direction: column;
            background-color: white;
            overflow-x: hidden;
            overflow-y: visible;
            margin: 0;
            -webkit-overflow-scrolling: touch;
        }


        main {
            flex: 1;
            position: relative;
            z-index: 1;
            overflow: visible;
            box-sizing: border-box;
        }

        /* Content width follows the centered navbar shell (brand → NOTES).
           Remove Bootstrap’s nested max-width so pages stay aligned with Architecture Styles. */
        main .container,
        main .container-fluid {
            max-width: none !important;
            width: 100%;
        }
        body[data-navbar-bounds-aligned="1"] main .container,
        body[data-navbar-bounds-aligned="1"] main .container-fluid {
            padding-left: 0 !important;
            padding-right: 0 !important;
            margin-left: 0;
            margin-right: 0;
        }

        footer,
        .site-footer {
            flex-shrink: 0;
            position: relative;
            z-index: 2;
            width: 100%;
        }

        .navbar,
        .site-navbar {
            position: relative;
            z-index: 600000; /* above notes (200k) and floating viewer (300k) */
            flex-shrink: 0;
            overflow: visible;
        }

/* —— Site navbar (unused; original navbar.html styles apply) —— */
:root {
  --site-navbar-offset: 4.25rem;
}

/* Notes sidebar / shared chrome buttons (used outside navbar) */
.notes-sidebar .menu-button {
  background: none;
  border: 2px solid var(--blue-500, #7CAADC);
  color: var(--blue-700, #2F6FB7);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.notes-sidebar .menu-button:hover {
  background-color: var(--blue-500, #7CAADC);
  color: #fff;
}

/* —— Site footer —— */
.site-footer {
  background: linear-gradient(180deg, #f4f7fb 0%, #e8eef6 100%);
  border-top: 1px solid rgba(124, 170, 220, 0.35);
  color: #3a4a5c;
  margin-top: auto;
  padding: 2.5rem 0 1.25rem;
}
.site-footer__brand {
  display: inline-block;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--blue-700, #2F6FB7);
  text-decoration: none;
  margin-bottom: 0.5rem;
}
.site-footer__brand:hover { color: var(--blue-500, #7CAADC); }
.site-footer__tagline {
  font-size: 0.92rem;
  line-height: 1.45;
  color: #5a6b7d;
  max-width: 22rem;
  margin-bottom: 0.85rem;
}
.site-footer__meta { display: flex; align-items: center; gap: 0.75rem; }
.site-footer__online {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: #5a6b7d;
}
.site-footer__online-badge {
  background: #3d9a6a;
  font-weight: 600;
}
.site-footer__heading {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue-700, #2F6FB7);
  margin: 0 0 0.75rem;
}
.site-footer__links {
  list-style: none;
  padding: 0;
  margin: 0;
}
.site-footer__links li { margin-bottom: 0.4rem; }
.site-footer__links a {
  color: #4a5b6c;
  text-decoration: none;
  font-size: 0.9rem;
}
.site-footer__links a:hover {
  color: var(--blue-700, #2F6FB7);
  text-decoration: underline;
}
.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(124, 170, 220, 0.28);
}
.site-footer__copy {
  margin: 0;
  font-size: 0.85rem;
  color: #6a7a8c;
}
.site-footer__bottom-links {
  display: flex;
  gap: 1rem;
}
.site-footer__bottom-links a {
  font-size: 0.85rem;
  color: #5a6b7d;
  text-decoration: none;
}
.site-footer__bottom-links a:hover {
  color: var(--blue-700, #2F6FB7);
  text-decoration: underline;
}
        .video-container {
            position: fixed;
            /* Center in the viewport below the site navbar */
            top: var(--site-navbar-offset, 4.25rem);
            left: 0;
            right: 0;
            bottom: 0;
            width: auto;
            height: auto;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: -1;
            overflow: hidden;
            pointer-events: none;
            /* Own compositor layer so page scroll doesn't re-rasterize the video each frame */
            will-change: contents;
            contain: paint;
            transform: none;
        }
        .video-container video {
            width: min(60vw, 720px);
            height: min(60vh, 720px);
            max-width: 100%;
            max-height: 100%;
            object-fit: contain;
            position: static;
            top: auto;
            left: auto;
            transform: none;
        }
        @media (prefers-reduced-motion: reduce) {
            .video-container video {
                display: none;
            }
        }

    :root {
      /* Core brand */
      --navbar-blue: #7CAADC;
      /* Blue family palette (derived from navbar blue) */
      --blue-700: #2F6FB7;   /* darker nuance */
      --blue-500: #7CAADC;   /* navbar */
      --blue-300: #A9C6E7;   /* lighter */
      --blue-200: #CFE0F3;   /* lightest for subtle outlines */
      --blue-tint-08: rgba(124,170,220,0.08);
      --blue-tint-12: rgba(124,170,220,0.12);
      --blue-tint-15: rgba(124,170,220,0.15);

      /* Architecture Styles panel language */
      --panel-bg: #E6F2FF;
      --panel-bg-soft: #FAFCFF;
      --panel-bg-tint: #F2F6FF;
      --panel-border: #D0E5FF;
      --panel-border-subtle: rgba(0, 0, 0, 0.06);
      --panel-radius: 10px;
      --panel-radius-sm: 8px;
      --panel-inner-bg: #ffffff;
      --panel-shadow: 0 10px 28px rgba(45, 55, 72, 0.08);

      /* Like (pink) — less saturated and semi‑transparent */
      --like-pink: #F594B8;           /* softer pink */
      --like-pink-strong: #E678A1;    /* border/hover reference */
      --like-pink-alpha: rgba(245,148,184,0.26); /* tinted background */
      --like-pink-alpha-hover: rgba(245,148,184,0.36);
      --like-pink-text: #7A2F4E;      /* readable text on light pink */
    }

    /* Make all primary (Post) buttons the navbar blue */
    .btn-primary,
    .btn-primary:focus,
    .btn-primary:active {
      background-color: var(--blue-500) !important;
      border-color: var(--blue-500) !important;
      color: #fff !important;
    }
    .btn-primary:hover {
      background-color: var(--blue-500) !important;
      border-color: var(--blue-500) !important;
      filter: brightness(0.95);
      color: #fff !important;
    }

    /* Tag buttons use navbar blue */
    .aspect-tag,
    .btn.act-tag, .btn.ex-act-tag, .btn.sv-tag, .btn.vid-tag, .btn.c-tag {
      background-color: var(--blue-500) !important;
      border-color: var(--blue-500) !important;
      color: #fff !important;
    }
    .aspect-tag:hover,
    .btn.act-tag:hover, .btn.ex-act-tag:hover, .btn.sv-tag:hover, .btn.vid-tag:hover, .btn.c-tag:hover {
      filter: brightness(0.95);
      color: #fff !important;
    }

    /* Other outline buttons — keep nuance but stay in the blue family */
    .btn-outline-secondary {
      color: var(--blue-300) !important;
      border-color: var(--blue-300) !important;
      background-color: transparent !important;
    }
    .btn-outline-secondary:hover, .btn-outline-secondary:focus {
      color: var(--blue-700) !important;
      border-color: var(--blue-500) !important;
      background-color: var(--blue-tint-08) !important;
    }

    .btn-outline-info {
      color: var(--blue-500) !important;
      border-color: var(--blue-500) !important;
      background-color: transparent !important;
    }
    .btn-outline-info:hover, .btn-outline-info:focus {
      color: var(--blue-700) !important;
      border-color: var(--blue-500) !important;
      background-color: var(--blue-tint-12) !important;
    }

    .btn-outline-dark {
      color: var(--blue-700) !important;
      border-color: var(--blue-700) !important;
      background-color: transparent !important;
    }
    .btn-outline-dark:hover, .btn-outline-dark:focus {
      color: var(--blue-700) !important;
      border-color: var(--blue-700) !important;
      background-color: var(--blue-tint-15) !important;
    }

    /* Global: hide all Tag labels/UI across the project per requirement */
    /* Specific known tag elements on various pages */
    #style-tags,                 /* container of style page tags */
    #style-tags .badge,          /* style page badges */
    #ex-tags,                    /* example tags container */
    #ex-tags .as-tag,
    #pa-tags,                    /* painting/article tags container */
    #pa-tags .as-tag,
    #sc-tags,                    /* section/category tags container */
    #sc-tags .as-tag,
    /* Project cards and case-study tag containers across pages */
    .as-tags,                    /* generic tags wrapper used in many cards */
    #as-overview-tags,
    #as-ref-tags,
    #ar-tags,
    #ar-case-tags,
    #sc-case-tags,
    #td-overview-tags,
    #td-case-tags,
    #ev-tags,
    #ev-case-tags,
    .as-tag,                     /* generic app-specific tag badge */
    .tag-badge,                  /* explicit tag badge class */
    .tag-list,                   /* lists of tags */
    .tags-list,
    .ns-taglist,                 /* notes sidebar inline tags list */
    .mn-hover,                   /* tag hover card on My Notes */
    /* Sketchpad toolbar tag controls */
    #ac-tag-select,
    #ac-add-tag-btn {
      display: none !important;
    }

    /* Also hide dashboard "My Tags" navigation link defensively */
    .list-group a[href*="dashboard/tags/"] { display: none !important; }

    /* Like buttons — softer, less saturated, and more transparent (towards white) */
    .btn.act-like, .btn.ex-act-like, .btn.sv-like, .btn.vid-like, .btn.c-like {
      background-color: var(--like-pink-alpha) !important;
      border-color: var(--like-pink-strong) !important;
      color: var(--like-pink-text) !important;
    }
    .btn.act-like:hover, .btn.ex-act-like:hover, .btn.sv-like:hover, .btn.vid-like:hover, .btn.c-like:hover {
      background-color: var(--like-pink-alpha-hover) !important;
      border-color: var(--like-pink-strong) !important;
      color: var(--like-pink-text) !important;
    }

                /* Scoped styles for inline Notes/Tags sections inside the left card of the sidebar */
                .notes-sidebar .ref-card .ns-inline { margin-top: 0 !important; width: 100%; }
                /* Ensure the whole reference card and its content can use the full width (remove any leftover constraints) */
                .notes-sidebar .ref-card { width: 100% !important; max-width: 100% !important; box-sizing: border-box; }
                /* Remove hero image so text spans full width of the card */
                .notes-sidebar .ref-card .ref-hero { display: none !important; }
                /* Strong override: legacy grid (with hero column) must not reserve space in sidebar */
                .notes-sidebar #ac-ref-card .ref-content { display: block !important; width: 100% !important; max-width: 100% !important; grid-template-columns: 1fr !important; }
                /* Ensure descriptive text occupies full available width up to Sketchpad */
                .notes-sidebar #ac-ref-card .ref-text { width: 100% !important; max-width: 100% !important; margin-right: 0 !important; float: none !important; display: block; box-sizing: border-box; }
                /* Stretch the left reference card within its own column only (not over the sketchpad row) */
                .notes-body .notes-col-left { height: auto; align-self: start; position: relative; z-index: 6; }
                .notes-sidebar #ac-ref-card { display: flex; flex-direction: column; height: auto; min-height: 0; }
                .notes-sidebar #ac-ref-card .ref-content { display: flex !important; flex-direction: column; flex: 1 1 auto; min-height: 0; }
                .notes-sidebar #ac-ref-card .ref-text { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
                .notes-sidebar #ac-ref-card .ref-summary { flex: 1 1 auto; min-height: 0; overflow: auto; }
                /* Guarantee inline Notes card stretches like the text */
                .notes-sidebar #ac-ref-card .ns-inline,
                .notes-sidebar #ac-ref-card .ns-card { width: 100% !important; max-width: 100% !important; box-sizing: border-box; }
                /* Keep Create Project with the left-column content — do not pin it over the sketchpad */
                .notes-sidebar #ac-ref-card .ns-inline { margin-top: 0.75rem !important; }
                /* Grid for the inline Notes section. Use full-width single column so it matches the descriptive text width. */
                .notes-sidebar .ref-card .ns-grid {
                  display: grid;
                  grid-template-columns: 1fr;
                  column-gap: 12px;
                  row-gap: 12px;
                  align-items: stretch;
                  justify-items: stretch;
                  width: 100%;
                }
                @media (max-width: 992px){ .notes-sidebar .ref-card .ns-grid { grid-template-columns: 1fr; } }
                .notes-sidebar .ref-card .ns-card { background: rgba(255,255,255,0.85); border: 1px solid rgba(0,0,0,0.08); border-radius: 8px; padding: 8px; width: 100%; max-width: 100%; box-sizing: border-box; }
                .notes-sidebar .ref-card .ns-card h4 { font-size: 0.95rem; font-weight: 700; margin: 0 0 6px 0; }
                .notes-sidebar .ref-card .ns-body { font-size: 0.9rem; }
                /* If additional cards appear in the future, keep Notes full-width */
                #ns-notes-card { grid-column: 1 / -1; }
                .notes-sidebar .ref-card .ns-taglist { display:flex; flex-wrap: wrap; gap:6px; }
                /* Full-width helper in case we ever place the working pad inside the grid */
                .notes-sidebar .ref-card .ns-card-full { grid-column: 1 / -1; width: 100%; }
                /* Sidebar mini-forms styling (white inputs, blue buttons) */
                .notes-sidebar .ref-card .ns-form .form-control,
                .notes-sidebar .ref-card .ns-form .form-select { background:#fff !important; height: 28px; padding: 2px 6px; font-size: .85rem; }
                .notes-sidebar .ref-card .ns-form .btn { height: 28px; padding: 2px 8px; font-size: .85rem; }
                .notes-sidebar .ref-card .ns-form .btn.btn-primary { background-color:#2F80ED; border-color:#2F80ED; color:#fff; }
                .notes-sidebar .ref-card .ns-form .btn.btn-primary:hover { background-color:#276fd1; border-color:#276fd1; color:#fff; }
                /* Align action buttons to the right of inputs */
                .notes-sidebar .ref-card .ns-form .ns-inline-row { display:flex; flex-wrap:nowrap; align-items:center; gap:8px; }
                /* Slightly reduce the input's flex-basis so buttons fit on the same row */
                .notes-sidebar .ref-card .ns-form .ns-grow { flex:1 1 280px; min-width:140px; }
                .notes-sidebar .ref-card .ns-form .ns-actions { margin-left:auto; display:inline-flex; gap:8px; justify-content:flex-end; }
                @media (max-width: 576px){
                  /* Allow wrapping on very small screens */
                  .notes-sidebar .ref-card .ns-form .ns-inline-row { flex-wrap: wrap; }
                  .notes-sidebar .ref-card .ns-form .ns-actions { width:100%; margin-left:0; justify-content:flex-end; }
                }

  .notes-sidebar {
    position: fixed;
    top: var(--notes-top, 0);
    right: 0;
    height: calc(100vh - var(--notes-top, 0px));
    width: 36vw;
    max-width: 560px;
    min-width: 360px;
    background: rgba(255,255,255,0.7);
    box-shadow: -8px 0 24px rgba(0,0,0,0.15);
    backdrop-filter: saturate(110%) blur(2px);
    transform: translateX(100%);
    transition: transform 300ms ease, visibility 0s linear 300ms;
    z-index: 200000; /* above navbar content */
    display: flex;
    flex-direction: column;
    pointer-events: none;
    visibility: hidden;
  }
  /* On medium screens keep a usable width without dominating the page */
  @media (max-width: 1400px){ .notes-sidebar { width: 42vw; max-width: 520px; } }
  /* Equal-width utility: make items in these rows share width */
  .ac-eq-row{ display:flex; gap:.5rem; align-items:end; flex-wrap:wrap; }
  /* Ensure equal visual width aligned with the six bottom buttons */
  .ac-eq-row .ac-eq-item{ flex:1 1 0; min-width:130px; }
  .ac-bottom-eq .ac-bottom-btn{ min-width:130px; }
  /* Notes inline rows: 3-column alignment for buttons/inputs/right controls */
  .notes-sidebar .ref-card .ns-form .ns-row3 { display:grid; grid-template-columns:auto 1fr auto; gap:8px; align-items:center; }
  .notes-sidebar .ref-card .ns-form .ns-row3 .ns-left { justify-self:start; }
  .notes-sidebar .ref-card .ns-form .ns-row3 .ns-center { width:100%; }
  .notes-sidebar .ref-card .ns-form .ns-row3 .ns-right { justify-self:end; }
  @media (max-width: 576px){
    .notes-sidebar .ref-card .ns-form .ns-row3 { grid-template-columns: 1fr; }
    .notes-sidebar .ref-card .ns-form .ns-row3 .ns-right { justify-self: stretch; }
  }
  .notes-sidebar.transparent-50 { background: rgba(255,255,255,0.5); }
  .notes-sidebar.transparent-50 .ref-card { background: rgba(255,255,255,0.5); }
  .notes-sidebar.open {
    transform: translateX(0);
    pointer-events: auto;
    visibility: visible;
    transition: transform 300ms ease, visibility 0s linear 0s;
  }
  .notes-sidebar.expanded {
    max-width: none !important;
    min-width: 0 !important;
  }
  .notes-sidebar.maximized {
    top: 0 !important;
    right: 0 !important;
    left: 0 !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    height: 100vh !important;
    z-index: 300000;
  }
  .notes-sidebar.maximized .notes-header-bar,
  .notes-sidebar.maximized .notes-body {
    padding-right: 0.75rem;
  }
  #notes-maximize-btn .fas { margin-right: 0.35rem; }
  .notes-header-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.5rem calc(0.75rem + var(--notes-edge-width, 28px)) 0.5rem 0.75rem; /* leave space for blue arrow */
    border-bottom: 1px solid rgba(0,0,0,0.1);
    background: #ffffff;
  }
  .notes-header-bar .menu-button {
    background-color: #7CAADC;
    border: 2px solid #7CAADC;
    color: #fff;
    opacity: 1;
  }
  .notes-header-bar .menu-button:hover,
  .notes-header-bar .menu-button[aria-pressed="true"] {
    background-color: #5f96cb;
    border-color: #5f96cb;
    color: #fff;
  }
  .notes-body { padding: 0.75rem calc(0.75rem + var(--notes-edge-width, 28px)) 0.75rem 0.75rem; overflow: auto; flex: 1 1 auto; }
  .notes-sidebar .ref-card { background: rgba(255,255,255,0.8); border: 1px solid rgba(0,0,0,0.06); border-radius: 8px; padding: 0.6rem 0.75rem; margin-bottom: 0.75rem; }
  /* Ensure the Insert tag dropdown is always visible above right-side menus */
  #ac-toolbar { position: relative; z-index: 710010; overflow: visible; }
  #ac-toolbar-typography, #ac-tag-select, #ac-add-tag-btn { position: relative; z-index: 710011; }
  /* Improve readability of Insert Tag dropdown (Select2 and native) */
  /* Native select background in toolbar */
  #ac-tag-select.form-select { background-color: rgba(255,255,255,0.95); color: #111; }
  /* Select2 container bound to #ac-tag-select */
  .select2-container--default .select2-selection--single { background-color: rgba(255,255,255,0.95); border-color: rgba(0,0,0,0.2); }
  .select2-container--default .select2-selection--single .select2-selection__rendered { color: #111; }
  .select2-container--default .select2-dropdown { background-color: rgba(255,255,255,0.96); border-color: rgba(0,0,0,0.2); box-shadow: 0 8px 24px rgba(0,0,0,0.18); }
  .select2-results__options { background-color: transparent; }
  .select2-container--default .select2-results__option--highlighted[aria-selected] { background-color: #E8F0FE; color: #111; }
  .notes-sidebar .ref-title { margin: 0; font-size: 1rem; font-weight: 700; }
  .notes-sidebar .ref-author { color: #333; }
  .notes-sidebar .ref-summary p { margin: 0.25rem 0; font-size: 0.9rem; }
  .notes-sidebar .notes-list .note-item { border: 1px solid rgba(0,0,0,0.08); border-radius: 6px; padding: 0.4rem 0.5rem; margin-bottom: 0.4rem; background: rgba(255,255,255,0.8); }
  .notes-sidebar .conn-item { font-size: 0.9rem; padding: 0.2rem 0; }
  /* Notes breadcrumb path (small, to the right of title) */
  .notes-header-bar .notes-path { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 0.2rem; margin-left: 8px; font-size: 0.85rem; color: #000; }
  .notes-header-bar .notes-path .crumb-home a,
  .notes-header-bar .notes-path .ac-crumb-btn { text-decoration: none; color: inherit; background: transparent; border: 0; padding: 0; font-weight: 600; }
  .notes-header-bar .notes-path .crumb-sep { opacity: 0.6; padding: 0 0.15rem; }
  .notes-header-bar .notes-path .crumb-current .ac-crumb-btn { font-weight: 700; }
  @media (max-width: 992px){ .notes-sidebar { width: 100vw; } }
  /* Source viewer minor styles */
  .notes-sidebar .source-viewer { margin-bottom: 0.75rem; }
  .notes-sidebar .source-viewer .sv-header { margin-bottom: 0.5rem; }
  .notes-sidebar .source-viewer .sv-body { width: 100%; }
  /* Notes stacked layout: project options, then sketchpad options, then drawing area */
  .notes-body .notes-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    align-items: stretch;
    height: 100%;
  }
  .notes-body .notes-grid.notes-fullwidth { grid-template-columns: 1fr; }
  .notes-body .notes-grid.height-expanded { height: auto; }
  .notes-body .notes-col-left,
  .notes-body .notes-col-right {
    min-width: 0;
    width: 100% !important;
    max-width: 100%;
  }
  .notes-body .notes-col-left {
    display: flex;
    flex-direction: column;
    align-self: stretch;
    height: auto;
    position: relative;
    z-index: 6;
  }
  .notes-body .notes-tools { margin-top: auto; }
  .notes-body .notes-col-right {
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 4;
  }
  .notes-body .notes-col-right .ac-tip { margin: 0 0 0.5rem 0; }
  .notes-body .notes-col-right .sketchpad-header {
    margin-top: 0.15rem;
  }
  .notes-body .ac-canvas-wrap {
    /* Graph paper background */
    --grid-size: 16px;
    --grid-line: rgba(0,0,0,0.06);
    --grid-dot: rgba(0,0,0,0.12);
    background-color: #ffffff; /* base white */
    background-image:
      linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
      linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px),
      radial-gradient(circle at 1px 1px, var(--grid-dot) 1px, rgba(0,0,0,0) 1px);
    background-size:
      var(--grid-size) var(--grid-size),
      var(--grid-size) var(--grid-size),
      var(--grid-size) var(--grid-size);
    background-position: 0 0, 0 0, 0 0;
    flex: 1 1 auto;
    min-height: 280px;
    /* Ensure sketchpad stays behind popup menus / left-column forms */
    position: relative;
    z-index: 1;
    /* Ensure a visually continuous surface (no seams) */
    border: 0 !important;
    border-radius: 0 !important;
    box-sizing: border-box;
    overflow: hidden;
  }
  /* Keep drawing surface inside its grid cell — do not let it spill over Create Project */
  .notes-body .ac-canvas-wrap { overflow: hidden; }
  /* Keep any popup/dropdown/tooltips in front of the Fabric canvas while drawing */
  .notes-sidebar .canvas-container { position: relative; z-index: 0; }
  .notes-sidebar .canvas-container .upper-canvas { z-index: 0 !important; }
  .notes-sidebar .ref-card, .notes-sidebar .source-viewer, .notes-sidebar .dropdown-menu,
  .notes-sidebar .tooltip, .notes-sidebar .popover, .notes-sidebar .notes-tools,
  .notes-sidebar .sketchpad-header { position: relative; z-index: 5; }
  .notes-body .ac-canvas-wrap.expanded { min-height: 120vh; }
  .ac-canvas-wrap.drag-over { outline: 2px dashed var(--navbar-bg-color, #7CAADC); outline-offset: -2px; }

  /* Stretch toolbar to the exact computed width (no extra right padding so it can align to the NOTES button precisely) */
  #ac-toolbar { padding-right: 0; }
  /* Allow toolbar and rows to be width-constrained dynamically (align to NOTES button) */
  #ac-toolbar, #ac-toolbar .toolbar-controls, #ac-toolbar .toolbar-bottom { max-width: none; }

  /* Regroup toolbar controls to occupy available space safely */
  #ac-toolbar .toolbar-controls {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px; /* tighter gaps for compact view */
    justify-content: flex-start;
  }
  #ac-toolbar .btn-group { flex-wrap: wrap; }
  /* Make first-row buttons expand to occupy all available space equally */
  #ac-toolbar .btn-group.w-100 .btn { flex: 1 1 0; }
  #ac-toolbar .btn-group .btn {
    flex: 1 1 0;
    padding: .18rem .4rem;           /* compact buttons */
    font-size: .8rem;                 /* smaller label text */
    line-height: 1.1;
  }
  /* Equal-width rows to perfectly align controls across lines */
  #ac-toolbar .ac-eq-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    align-items: end;
  }
  #ac-toolbar .ac-eq-row .ac-eq-item { width: 100%; }
  /* Responsive fallback: reduce number of columns on narrow widths */
  @media (max-width: 1200px) {
    #ac-toolbar .ac-eq-row { grid-template-columns: repeat(3, 1fr); }
  }
  @media (max-width: 576px) {
    #ac-toolbar .ac-eq-row { grid-template-columns: repeat(2, 1fr); }
  }
  /* Compact equal-width row controls */
  #ac-toolbar .ac-eq-row .btn { padding: .18rem .4rem; font-size: .8rem; }
  #ac-toolbar .form-select.form-select-sm,
  #ac-toolbar .form-control.form-control-sm { padding: .15rem .35rem; font-size: .8rem; }
  #ac-toolbar label.form-label.small { margin-bottom: .15rem !important; }
  #ac-toolbar .notes-typography-row { flex-wrap: wrap; gap: 6px; }
  #ac-toolbar .notes-typography-row label { white-space: nowrap; }
  #ac-toolbar .form-label { white-space: nowrap; }
  /* Reduce visual clutter at smaller widths */
  @media (max-width: 1200px) {
    #ac-toolbar .vr { display: none !important; }
  }

  /* Keep the "Name the group" button on a single line */
  #ac-rename-group { white-space: nowrap; }
  @media (max-width: 576px) {
    #ac-rename-group { font-size: 0.85rem; padding: .15rem .4rem; }
  }

  /* Enforce black text + contour for all toolbar buttons; active uses solid black */
  #ac-toolbar .btn { color: #000 !important; border-color: #000 !important; background-color: #fff !important; }
  #ac-toolbar .btn[aria-pressed="true"],
  #ac-toolbar .btn.active { color: #fff !important; background-color: #000 !important; border-color: #000 !important; }
  /* Bottom toolbar: hide Tips text and compact utility buttons */
  .toolbar-bottom .ac-tip { display: none !important; }
  .toolbar-bottom .ac-bottom-btn { padding: .18rem .45rem; font-size: .8rem; }

  /* Right-edge hover sensor and toggle strip */
  :root{ --notes-edge-width: 28px; }
  #notes-edge-hover {
    position: fixed;
    right: 0;
    top: var(--notes-top, 0);
    height: calc(100vh - var(--notes-top, 0px));
    width: 12px;
    z-index: 210000; /* above content, below modal */
    background: transparent;
    pointer-events: auto;
  }
  #notes-edge-toggle.edge-toggle {
    position: fixed;
    right: 0;
    top: var(--notes-top, 0);
    height: calc(100vh - var(--notes-top, 0px));
    width: var(--notes-edge-width, 28px);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(124, 170, 220, 0.45);
    color: #fff;
    z-index: 210001;
    cursor: pointer;
    transition: transform 180ms ease, opacity 150ms ease, background-color 150ms ease;
    transform: translateX(100%);
    opacity: 0;
  }
  #notes-edge-toggle.edge-toggle.visible { transform: translateX(0); opacity: 1; }
  #notes-edge-toggle.edge-toggle.pinned { transform: translateX(0); opacity: 1; }
  #notes-edge-toggle.edge-toggle:hover,
  #notes-edge-toggle.edge-toggle:focus,
  #notes-edge-toggle.edge-toggle.pinned {
    background-color: var(--blue-500, #7CAADC);
  }
  #notes-edge-toggle .fas { font-size: 16px; color: #fff; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.25)); }
  @media (max-width: 992px){
    #notes-edge-hover{ width: 10px; }
    #notes-edge-toggle.edge-toggle { width: 36px; }
    :root{ --notes-edge-width: 36px; }
  }
  /* Right-edge hover sensor and toggle strip for Notifications (same style as Notes) */
  
  /* Left-edge hover sensor and toggle strip (mirrors right) */
  #left-notes-edge-hover {
    position: fixed;
    left: 0;
    top: var(--notes-top, 0);
    height: calc(100vh - var(--notes-top, 0px));
    width: 12px;
    z-index: 210002; /* above content, below left toggle */
    background: transparent;
    pointer-events: auto;
  }
  #left-notes-edge-toggle.edge-toggle-left {
    position: fixed;
    left: 0;
    top: var(--notes-top, 0);
    height: calc(100vh - var(--notes-top, 0px));
    width: var(--notes-edge-width, 28px);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(124, 170, 220, 0.45);
    color: #fff;
    z-index: 210003;
    cursor: pointer;
    transition: transform 180ms ease, opacity 150ms ease, background-color 150ms ease;
    transform: translateX(-100%);
    opacity: 0;
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
    border-right: 2px solid #fff;
  }
  #left-notes-edge-toggle.edge-toggle-left.visible { transform: translateX(0); opacity: 1; }
  #left-notes-edge-toggle.edge-toggle-left.pinned { transform: translateX(0); opacity: 1; }
  #left-notes-edge-toggle.edge-toggle-left:hover,
  #left-notes-edge-toggle.edge-toggle-left:focus,
  #left-notes-edge-toggle.edge-toggle-left.pinned {
    background-color: var(--blue-500, #7CAADC);
  }
  #left-notes-edge-toggle .fas { font-size: 16px; color: #fff; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.25)); }
  @media (max-width: 992px){
    #left-notes-edge-hover{ width: 10px; }
    #left-notes-edge-toggle.edge-toggle-left { width: 36px; }
  }
  /* Align Sketchpad header with left column ref title inside .ref-card padding */
  .notes-body .notes-col-right .sketchpad-header { padding: 0.6rem 0.75rem 0.25rem 0.75rem; }
  /* Make the summary card fill the left column down to the notepad tools */
  #ac-ref-card { flex: 1 1 auto; display: flex; flex-direction: column; margin-bottom: 0; }
  #ac-ref-card .ref-content { display: grid; grid-template-columns: 2fr 1fr; gap: 0.6rem; align-items: stretch; min-height: 0; }
  #ac-ref-card .ref-text { display: flex; flex-direction: column; min-width: 0; }
  #ac-ref-card .ref-summary { flex: 1 1 auto; overflow: hidden; }
  #ac-ref-card .ref-footer { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
  #ac-ref-card .ref-hero { min-height: 140px; border-radius: 6px; overflow: hidden; background: #f8f9fa; }
  #ac-ref-card .ref-hero-credit a { color: inherit; text-decoration: underline; }
  /* View Source button styling to match navbar blue */
  .notes-source-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    background-color: var(--navbar-bg-color, #7CAADC);
    color: #fff !important;
    border: 1px solid rgba(255,255,255,0.8);
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    line-height: 1.2;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: filter 0.2s ease;
    white-space: nowrap;
  }
  .notes-source-btn:hover, .notes-source-btn:focus {
    text-decoration: none;
    filter: brightness(0.95);
    color: #fff !important;
    outline: none;
  }
  /* Notes Back/Next navigation buttons between title and path */
  .notes-nav-btn {
    background-color: var(--navbar-bg-color, #7CAADC);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.8);
    border-radius: 6px;
    padding: 0.3rem 0.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: filter 0.2s ease;
  }
  .notes-nav-btn:hover, .notes-nav-btn:focus { filter: brightness(0.95); color: #fff; outline: none; }
  /* Match Create, Add, Link buttons to navbar blue/white */
  #btn-add-notepad,
  #btn-add-note,
  #btn-add-conn {
    background-color: var(--navbar-bg-color, #7CAADC) !important;
    border-color: var(--navbar-bg-color, #7CAADC) !important;
    color: #fff !important;
    font-weight: 600;
  }
  #btn-add-notepad:hover,
  #btn-add-note:hover,
  #btn-add-conn:hover,
  #btn-add-notepad:focus,
  #btn-add-note:focus,
  #btn-add-conn:focus {
    filter: brightness(0.95);
    color: #fff !important;
    outline: none;
  }
  @media (max-width: 992px){
    .notes-body .notes-grid { grid-template-columns: 1fr; height: auto; }
    #ac-ref-card .ref-content { grid-template-columns: 1fr; }
  }

  .fv-window {
    position: fixed;
    top: 80px;
    left: 60px;
    width: min(800px, 40vw);
    height: min(85vh, 60vh);
    background: rgba(255,255,255,0.95);
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.25);
    z-index: 300000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: saturate(110%) blur(2px);
  }
  .fv-window[hidden]{ display: none !important; }
  .fv-header { cursor: move; padding: 0.4rem 0.6rem; border-bottom: 1px solid rgba(0,0,0,0.1); background: rgba(255,255,255,0.85); display:flex; align-items:center; justify-content:space-between; }
  .fv-body { flex: 1; min-height: 140px; }
  .fv-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
  .fv-resize { position: absolute; right: 6px; bottom: 6px; width: 14px; height: 14px; border-right: 2px solid rgba(0,0,0,0.25); border-bottom: 2px solid rgba(0,0,0,0.25); cursor: se-resize; opacity: 0.8; }
  @media (max-width: 992px){ .fv-window { width: 95vw; left: 2.5vw; height: 60vh; } }

/* Elevate Bootstrap modals above high-z-index UI (navbar, notes sidebar) */
.modal-backdrop { z-index: 700000 !important; }
.modal { z-index: 710000 !important; }
