/* =====================================================================
   product-ui.css : faithful mini product UI kit (all classes .pui-*)
   ---------------------------------------------------------------------
   Always a DARK app, whatever the page theme. Self-contained: reads only
   the fixed --pui-* / --violet tokens from base.css. Inter, flat navy
   panels, 1px #26344F borders, radius 14 window / 12 panel / 8 inset /
   4 controls, pill badges 12px/600, table headers 11px/600 uppercase.
   Add a visible "Illustrative product preview. Sample data." label
   (.preview-label) to anything you build with this.

   CLASSES
   .pui-window            app window (grid: sidebar + main). radius 14.
     .pui-window--nosidebar   single column
   .pui-sidebar           left rail (200px)
     .pui-brand           <div class="pui-brand"><svg class="pui-brand__mark">..</svg>
                           <span class="pui-brand__name">Tredit</span></div>
     .pui-workspace       two-line label: <div class="pui-workspace">
                           <strong>Arranger workspace</strong>Alderquay Capital Partners</div>
     .pui-nav-item        <a|button class="pui-nav-item" aria-current="page">
                           <svg class="icon">..</svg>Deals</a>  (aria-current = active)
   .pui-main              right column (topbar + content)
   .pui-topbar            <div class="pui-topbar"><nav class="pui-breadcrumb"
                           aria-label="Breadcrumb"><span>Deals</span><span>Project Atlas</span></nav>
                           <div class="pui-topbar__end"><button class="pui-icon-btn"
                           aria-label="Notifications"><svg class="icon">bell</svg></button>
                           <span class="pui-avatar">ME</span></div></div>
   .pui-content           padded content area (grid, 12px gap)
   .pui-panel             radius 12 flat panel. .pui-panel__head (title bar,
                           #1C2843) and .pui-panel__body (padding 14px)
   .pui-inset             radius 8 inset well (page navy)
   .pui-tabs / .pui-tab   <div class="pui-tabs" role="tablist"><button class="pui-tab"
                           role="tab" aria-selected="true">Overview</button>...</div>
   .pui-table             <table class="pui-table"><thead><tr><th>Name</th>...
   .pui-badge             pill 12px/600. Variants: --live --granted --not-granted
                           --draft --published --in-development --planned
                           <span class="pui-badge pui-badge--live">Live</span>
   .pui-chip              party chip. Variants: --arranger (violet) --lender
                           (emerald) --borrower (blue)
                           <span class="pui-chip pui-chip--lender">Harbour Credit Partners</span>
   .pui-btn               violet primary, 4px radius, 32px high.
                           Variants: --ghost, --sm. <button class="pui-btn">Create deal</button>
   .pui-toggle            <button class="pui-toggle" role="switch" aria-checked="true"
                           aria-label="Corporate"></button>   (set aria-checked true/false;
                           toggle it in JS; [disabled] = locked)
   .pui-field/.pui-label/.pui-input
                          <div class="pui-field"><label class="pui-label" for="x">Deal name</label>
                           <input class="pui-input" id="x" value="Project Atlas"></div>
   .pui-tracker           stage tracker: <ol class="pui-tracker" aria-label="Stage">
                           <li class="pui-tracker__step is-done">Data room</li>
                           <li class="pui-tracker__step is-current" aria-current="step">Term sheets</li>
                           <li class="pui-tracker__step">Negotiation</li></ol>
                           Product stages: Prospecting, Deal inception, Information
                           preparation, Data room, Lender process, Lender review, Due diligence,
                           Term sheets, Negotiation, Lender selection, Documentation, Completion.
                           Add .pui-tracker--compact to show only the current label.
   .pui-folder            folder row: <div class="pui-folder"><svg class="icon pui-folder__icon">
                           folder</svg><span class="pui-folder__name">Corporate</span>
                           <span class="pui-folder__count">2</span><span class="pui-folder__end">
                           (badge or toggle)</span></div>. .is-selected highlights.
   .pui-toast             <div class="pui-toast" role="status" aria-live="polite">
                           <svg class="icon">check</svg>2 files merged...</div>
   .pui-row               generic list row with hairline divider (activity lines etc.)
   .pui-muted / .pui-h    muted text / heading text helpers
   .pui-nav-group         small group label in the sidebar (Origination)
   .pui-badge--outstanding amber outline badge (term sheet still to issue)
   .pui-file-chip         loose file chip (for the "mess"): icon + name, 8px radius

   ICON SNIPPETS (lucide style, copy-paste). Wrap in
   <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor"
        stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">...</svg>
   (.icon is defined in base.css and sets size 1em, stroke currentColor, width 1.75.)
   Inside the page you can also use <svg class="icon"><use href="#i-NAME"/></svg>.

   folder:
   <path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>
   file:
   <path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/>
   users:
   <path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/>
   lock:
   <rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>
   bell:
   <path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.94 1.94 0 0 0 3.4 0"/>
   home:
   <path d="m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/><polyline points="9 22 9 12 15 12 15 22"/>
   inbox:
   <polyline points="22 12 16 12 14 15 10 15 8 12 2 12"/><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/>
   message-square:
   <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>
   activity:
   <path d="M22 12h-4l-3 9L9 3l-3 9H2"/>
   check:
   <path d="M20 6 9 17l-5-5"/>
   x:
   <path d="M18 6 6 18"/><path d="m6 6 12 12"/>
   chevron-right:
   <path d="m9 18 6-6-6-6"/>
   upload:
   <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" x2="12" y1="3" y2="15"/>
   search:
   <circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>
   eye:
   <path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/>
   ===================================================================== */

.pui-window, .pui-window *, .pui-window *::before, .pui-window *::after { box-sizing: border-box; }
.pui-window {
  /* document-type colours: the product is always dark, so always the dark values */
  --doc-pdf: #E5534B; --doc-xlsx: #1FA968; --doc-mail: #F2C230; --doc-docx: #4C8DF6;
  --doc-paper: #1A2540; --doc-edge: rgba(163, 178, 207, .6); --doc-mail-ink: #5C4300;
  display: grid; grid-template-columns: 200px minmax(0, 1fr);
  background: var(--pui-page); color: var(--pui-text);
  border: 1px solid var(--pui-border); border-radius: 14px; overflow: hidden;
  font-family: var(--font-body); font-size: 13px; line-height: 1.45; text-align: left;
  letter-spacing: 0; color-scheme: dark;
}
.pui-window--nosidebar { grid-template-columns: minmax(0, 1fr); }
.pui-window h1, .pui-window h2, .pui-window h3, .pui-window h4 { font-family: var(--font-body); color: var(--pui-heading); letter-spacing: 0; text-wrap: initial; }
.pui-window p { max-width: none; margin: 0; }
.pui-window a { color: var(--tredit-blue-bright); }
.pui-window .icon { width: 16px; height: 16px; }
.pui-window :focus-visible { outline: 2px solid var(--tredit-blue-bright); outline-offset: 2px; }

.pui-h { color: var(--pui-heading); }
.pui-muted { color: var(--pui-muted); }

/* sidebar */
.pui-sidebar { background: var(--pui-chrome); border-right: 1px solid var(--pui-border); padding: 14px 10px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pui-brand { display: flex; align-items: center; gap: 8px; padding: 2px 8px 10px; }
.pui-brand__mark { width: 22px; height: 22px; }
.pui-brand__name { font-family: var(--font-display); font-weight: 600; font-size: 16px; color: #fff; }
.pui-workspace { padding: 8px 10px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--pui-border); font-size: 11px; color: var(--pui-muted); line-height: 1.4; }
.pui-workspace strong { display: block; font-weight: 600; font-size: 12px; color: var(--pui-heading); }
.pui-nav-item {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; width: 100%;
  border: 0; border-radius: 8px; background: transparent; color: var(--pui-muted);
  font: 500 13px/1 var(--font-body); text-decoration: none; text-align: left;
}
.pui-nav-group { padding: 12px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--pui-muted); }
.pui-nav-item:hover { background: rgba(255, 255, 255, .04); color: var(--pui-heading); }
.pui-nav-item[aria-current="page"] { background: rgba(124, 58, 237, .2); color: #fff; }
.pui-nav-item[aria-current="page"] .icon { color: var(--violet-soft); }

/* main + topbar */
.pui-main { display: flex; flex-direction: column; min-width: 0; }
.pui-topbar { height: 48px; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; background: var(--pui-chrome); border-bottom: 1px solid var(--pui-border); }
.pui-breadcrumb { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--pui-muted); font-size: 13px; white-space: nowrap; }
.pui-breadcrumb > * + *::before { content: "/"; margin-right: 8px; color: var(--pui-border); }
.pui-breadcrumb > :last-child { color: var(--pui-heading); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.pui-topbar__end { display: flex; align-items: center; gap: 10px; }
.pui-icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border: 0; background: transparent; color: var(--pui-muted); border-radius: 4px; }
.pui-icon-btn:hover { color: var(--pui-heading); background: rgba(255, 255, 255, .05); }
.pui-avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--violet); color: #fff; font-size: 11px; font-weight: 600; }
.pui-content { padding: 16px; display: grid; gap: 12px; align-content: start; min-width: 0; }

/* panels */
.pui-panel { background: var(--pui-panel); border: 1px solid var(--pui-border); border-radius: 12px; overflow: hidden; min-width: 0; }
.pui-panel__head { padding: 10px 14px; background: var(--pui-panel-head); border-bottom: 1px solid var(--pui-border); font-weight: 600; font-size: 13px; color: var(--pui-heading); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pui-panel__body { padding: 14px; }
.pui-inset { background: var(--pui-page); border: 1px solid var(--pui-border); border-radius: 8px; padding: 10px 12px; }
.pui-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--pui-border); }
.pui-row:last-child { border-bottom: 0; }

/* tabs */
.pui-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--pui-border); overflow-x: auto; scrollbar-width: none; }
.pui-tab { flex: none; padding: 10px 12px; background: transparent; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--pui-muted); font: 500 13px/1.2 var(--font-body); border-radius: 0; }
.pui-tab:hover { color: var(--pui-heading); }
.pui-tab[aria-selected="true"] { color: #fff; font-weight: 600; background: rgba(124, 58, 237, .28); border-bottom: 3px solid var(--violet-soft); border-radius: 8px 8px 0 0; }

/* table */
.pui-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pui-table th { text-align: left; padding: 8px 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--pui-muted); border-bottom: 1px solid var(--pui-border); white-space: nowrap; }
.pui-table td { padding: 10px 12px; border-bottom: 1px solid rgba(38, 52, 79, .6); color: var(--pui-text); vertical-align: middle; }
.pui-table tr:last-child td { border-bottom: 0; }
.pui-table td:first-child { color: var(--pui-heading); font-weight: 500; }

/* badges + chips */
.pui-badge, .pui-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap; border: 1px solid transparent;
}
.pui-badge--live { color: var(--emerald); background: rgba(52, 211, 153, .12); border-color: rgba(52, 211, 153, .35); }
.pui-badge--live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pui-badge--granted { color: var(--emerald); background: rgba(52, 211, 153, .12); border-color: rgba(52, 211, 153, .35); }
.pui-badge--not-granted { color: var(--pui-muted); background: rgba(163, 178, 207, .1); border-color: rgba(163, 178, 207, .28); }
.pui-badge--draft { color: var(--pui-muted); background: rgba(163, 178, 207, .1); border-color: rgba(163, 178, 207, .28); }
.pui-badge--published { color: var(--tredit-blue-bright); background: rgba(120, 176, 248, .12); border-color: rgba(120, 176, 248, .35); }
.pui-badge--in-development { color: #FBBF24; background: rgba(245, 158, 11, .12); border-color: rgba(245, 158, 11, .35); }
.pui-badge--planned { color: var(--pui-muted); background: transparent; border: 1px dashed rgba(163, 178, 207, .45); }
.pui-badge--outstanding { color: #FBBF24; background: transparent; border-color: rgba(245, 158, 11, .6); }
.pui-chip--arranger { color: var(--violet-soft); background: rgba(124, 58, 237, .18); border-color: rgba(178, 155, 251, .35); }
.pui-chip--lender { color: var(--emerald); background: rgba(52, 211, 153, .12); border-color: rgba(52, 211, 153, .35); }
.pui-chip--borrower { color: var(--tredit-blue-bright); background: rgba(120, 176, 248, .12); border-color: rgba(120, 176, 248, .35); }

/* buttons */
.pui-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 14px;
  background: var(--violet); color: #fff; border: 1px solid var(--violet); border-radius: 4px;
  font: 600 13px/1 var(--font-body); text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s;
}
.pui-btn:hover { background: #8B4FF0; border-color: #8B4FF0; }
.pui-btn--ghost { background: transparent; color: var(--pui-text); border-color: var(--pui-border); }
.pui-btn--ghost:hover { background: rgba(255, 255, 255, .05); border-color: var(--pui-muted); }
.pui-btn--sm { height: 28px; padding: 0 10px; font-size: 12px; }
.pui-btn[disabled] { opacity: .5; cursor: not-allowed; }

/* toggle (real button, role=switch) */
.pui-toggle { position: relative; flex: none; width: 36px; height: 20px; padding: 0; border-radius: 999px; border: 1px solid var(--pui-border); background: #1C2843; transition: background-color .15s, border-color .15s; }
.pui-toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--pui-muted); transition: transform .18s cubic-bezier(.2, 0, 0, 1), background-color .15s; }
.pui-toggle[aria-checked="true"] { background: var(--violet); border-color: var(--violet); }
.pui-toggle[aria-checked="true"]::after { transform: translateX(16px); background: #fff; }
.pui-toggle[disabled] { opacity: .5; cursor: not-allowed; }

/* fields */
.pui-field { display: grid; gap: 6px; }
.pui-label { font-size: 12px; font-weight: 600; color: var(--pui-muted); }
.pui-input { width: 100%; height: 36px; padding: 0 10px; background: var(--pui-page); border: 1px solid var(--pui-border); border-radius: 4px; color: var(--pui-heading); font: 400 13px/1 var(--font-body); }
.pui-input:focus { border-color: var(--violet-soft); outline: 2px solid var(--tredit-blue-bright); outline-offset: 2px; }
.pui-input::placeholder { color: var(--pui-muted); opacity: .8; }

/* stage tracker */
.pui-tracker { display: flex; align-items: center; gap: 0; overflow: hidden; }
.pui-tracker__step { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 8px; padding-right: 8px; color: var(--pui-muted); font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pui-tracker__step::before { content: ""; flex: none; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--pui-border); background: transparent; }
.pui-tracker__step.is-done { color: var(--pui-text); }
.pui-tracker__step.is-done::before { background: var(--emerald) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230A0F1E' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 10px no-repeat; border-color: var(--emerald); }
.pui-tracker__step.is-current { color: var(--pui-heading); font-weight: 600; }
.pui-tracker__step.is-current::before { border-color: var(--violet-soft); background: var(--violet); box-shadow: 0 0 0 3px rgba(124, 58, 237, .25); }
.pui-tracker--compact .pui-tracker__step:not(.is-current) { flex: 0 0 auto; font-size: 0; padding-right: 4px; }

/* folder row */
.pui-folder { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 10px; border-radius: 8px; color: var(--pui-text); font-weight: 500; }
.pui-folder:hover { background: rgba(255, 255, 255, .03); }
.pui-folder.is-selected { background: rgba(124, 58, 237, .14); }
.pui-folder__icon { width: 18px; height: 18px; color: var(--amber-deep); fill: rgba(157, 108, 25, .35); }
.pui-folder__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pui-folder__count { color: var(--pui-muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.pui-folder__end { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }

/* loose file chip */
.pui-file-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--pui-panel); border: 1px solid var(--pui-border); border-radius: 8px; color: var(--pui-text); font: 500 12px/1.2 var(--font-body); white-space: nowrap; box-shadow: 0 6px 16px rgba(5, 10, 25, .35); }

/* toast */
.pui-toast { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--pui-panel-head); border: 1px solid var(--pui-border); border-left: 3px solid var(--emerald); border-radius: 8px; color: var(--pui-heading); font-size: 13px; font-weight: 500; box-shadow: 0 10px 24px rgba(5, 10, 25, .45); }
.pui-toast .icon { color: var(--emerald); }

@media (max-width: 560px) {
  .pui-window { grid-template-columns: minmax(0, 1fr); }
  .pui-sidebar { display: none; }
}
