/* ═══════════════════════════════════════════════════════════════════
   VISUVATE · DASHBOARD SHELL

   Two apps, one rail. Ported from visuvate-toolkit's AppShell so the two
   sites are recognisably one product: a flat rail on --bg with a single
   right border, 248px expanded / 72px collapsed, and a 56px topbar with
   a slide-in drawer below the desktop breakpoint.

   Deliberately NOT here any more: the glass, the page-background
   controls, the app switcher and the second rail. The invoice pages
   never had any of it, so now nothing does.
   ═══════════════════════════════════════════════════════════════════ */

:root{
  --rail-w:248px;
  --rail-w-collapsed:72px;
  --shell-max:1180px;
  --shell-gutter:72px;
}

/* ═══ RAIL ════════════════════════════════════════════════════════ */

.rail{
  position:fixed;inset:0 auto 0 0;width:var(--rail-w);z-index:40;
  display:flex;flex-direction:column;overflow-y:auto;
  padding:22px 18px;
  background:var(--bg);
  border-right:1px solid var(--border);
}
/* No width transition: the Toolkit's rail resizes instantly and only its
   mobile drawer animates. Matching that keeps the two sites in step. */
body.rail-collapsed .rail{width:var(--rail-w-collapsed);padding:22px 14px}

/* ─── Brand ─── */
.rail-head{display:flex;align-items:center;justify-content:space-between;
  gap:8px;min-height:32px;margin-bottom:32px}
body.rail-collapsed .rail .rail-head{flex-direction:column;gap:18px}

.rail-brand{display:flex;align-items:center;gap:10px;min-height:32px;overflow:hidden;text-align:left}
body.rail-collapsed .rail .rail-brand{gap:0;justify-content:center;width:100%}
.rail-brand .mark{width:22px;height:22px;flex-shrink:0;color:var(--blue-500)}
body.rail-collapsed .rail .rail-brand .mark{width:28px;height:28px}
.rail-brand .mark svg{width:100%;height:100%}
.rail-brand .mark svg path{fill:currentColor}
.rail-brand b{font-family:var(--display);font-weight:600;font-size:15px;
  letter-spacing:-.02em;white-space:nowrap;color:var(--text-primary)}
.rail-brand b span{color:var(--text-muted);font-weight:400}
.rail-brand{min-width:0}
.rail-brand b{min-width:0;overflow:hidden;text-overflow:ellipsis}
body.rail-collapsed .rail .rail-brand b{display:none}

.rail-collapse{
  display:grid;place-items:center;width:28px;height:28px;flex-shrink:0;
  border:1px solid var(--border);border-radius:var(--r-sm);
  background:transparent;color:var(--text-subtle);
  transition:color var(--dur-fast) var(--ease),background var(--dur-fast) var(--ease),
             border-color var(--dur-fast) var(--ease);
}
.rail-collapse:hover{color:var(--text-primary);background:var(--surface);border-color:var(--border-2)}
.rail-collapse .ic{width:15px;height:15px;transition:transform var(--dur) var(--ease)}
body.rail-collapsed .rail .rail-collapse .ic{transform:rotate(180deg)}

/* ─── Rows ─── */
.rail-nav{display:flex;flex-direction:column;gap:2px}
.rail-group{margin-top:28px}
.rail-group > .eyebrow{display:inline;align-items:normal;padding:0 12px;font-size:11px}
.rail-group .rail-nav{margin-top:10px}
body.rail-collapsed .rail .rail-group > .eyebrow{display:none}
/* With the eyebrow hidden there is nothing in the gap to justify its
   height, so the groups close up rather than drifting apart. */
body.rail-collapsed .rail .rail-group{margin-top:16px}

.rail-link{
  display:flex;align-items:center;gap:12px;width:100%;
  padding:10px 12px;border-radius:var(--r-sm);
  font-size:13px;font-weight:500;text-align:left;color:var(--text-muted);
  transition:color var(--dur-fast) var(--ease),background var(--dur-fast) var(--ease);
}
.rail-link:hover{color:var(--text-primary);background:var(--surface)}
.rail-link[aria-current="page"]{background:var(--surface);color:var(--text-primary)}
.rail-link .ic{width:17px;height:17px;flex-shrink:0;opacity:.9}
.rail-link .label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.rail-link .count{font-size:11px;font-variant-numeric:tabular-nums;flex-shrink:0;color:var(--text-subtle)}
body.rail-collapsed .rail .rail-link{justify-content:center;padding:11px 0}
body.rail-collapsed .rail .rail-link .label,
body.rail-collapsed .rail .rail-link .count{display:none}

/* ─── Foot ─── */
.rail-foot{margin-top:auto;padding-top:16px;border-top:1px solid var(--border)}

.theme-row{
  display:flex;align-items:center;gap:10px;width:100%;
  padding:10px 12px;border-radius:var(--r-sm);
  font-size:13px;font-weight:500;color:var(--text-muted);
  transition:color var(--dur-fast) var(--ease),background var(--dur-fast) var(--ease);
}
.theme-row:hover{color:var(--text-primary);background:var(--surface)}
.theme-row .rail-ic,.m-btn .rail-ic{display:grid;place-items:center;flex-shrink:0}
.theme-row .rail-ic{width:17px;height:17px}
.theme-row .ic{width:17px;height:17px;flex-shrink:0}
.m-btn .rail-ic{width:16px;height:16px}
.m-btn .rail-ic .ic{width:16px;height:16px}
.theme-row .label{flex:1;text-align:left}
body.rail-collapsed .rail .theme-row{justify-content:center;padding:11px 0}
body.rail-collapsed .rail .theme-row .label,
body.rail-collapsed .rail .theme-row .ts-track{display:none}

.rail-user{display:flex;align-items:center;gap:10px;padding:10px 12px;margin-top:2px;overflow:hidden}
.rail-user .avatar{
  width:28px;height:28px;flex-shrink:0;border-radius:var(--r-sm);
  background:var(--blue-500);color:#fff;display:grid;place-items:center;
  font-family:var(--display);font-weight:600;font-size:12px;
}
.rail-user .who{display:flex;flex-direction:column;min-width:0}
.rail-user .who b{font-size:12.5px;font-weight:600;color:var(--text-primary);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.rail-user .who small{font-size:11px;color:var(--text-subtle);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.rail-user .signout{margin-left:auto;width:24px;height:24px;flex-shrink:0;
  display:grid;place-items:center;border-radius:var(--r-sm);color:var(--text-subtle);
  transition:color var(--dur-fast) var(--ease),background var(--dur-fast) var(--ease)}
.rail-user .signout:hover{color:var(--text-primary);background:var(--surface)}
.rail-user .signout .ic{width:14px;height:14px}
body.rail-collapsed .rail .rail-user{justify-content:center;padding:10px 0}
body.rail-collapsed .rail .rail-user .who,
body.rail-collapsed .rail .rail-user .signout{display:none}

.rail-legal{display:flex;align-items:center;gap:12px;padding:0 12px;margin-top:10px}
.rail-legal a{font-size:11px;color:var(--text-subtle);padding:4px 0;
  transition:color .15s var(--ease)}
.rail-legal a:hover{color:var(--text-primary)}
.rail-legal span{font-size:11px;color:var(--text-subtle);opacity:.5}
body.rail-collapsed .rail .rail-legal{display:none}

/* ═══ CONTENT ═════════════════════════════════════════════════════ */

.main{margin-left:var(--rail-w);min-width:0;display:flex;flex-direction:column;min-height:100vh;
  /* Full-bleed rules inside the column are drawn at 100vw, which was true
     before a rail offset this. `clip` confines them to the column without
     making it a scroll container, so sticky children still work. */
  overflow-x:clip}
body.rail-collapsed .main{margin-left:var(--rail-w-collapsed)}

/* The branding site's shell: 1180 capped, 72px gutter. */
.wrap{width:100%;max-width:var(--shell-max);margin:0 auto;padding:0 var(--shell-gutter)}

/* ═══ MOBILE ══════════════════════════════════════════════════════ */

.m-top,.m-drawer,.m-scrim{display:none}

@media (max-width:1023px){
  .rail{display:none}
  /* `body.rail-collapsed .main` outranks a bare `.main`, so the collapsed
     case has to be named here or the phone layout keeps the rail's offset
     and pushes the page off the right edge. */
  .main,
  body.rail-collapsed .main{margin-left:0;padding-top:56px}

  .m-top{
    position:fixed;top:0;left:0;right:0;height:56px;z-index:40;
    display:flex;align-items:center;justify-content:space-between;gap:12px;
    padding:0 18px;border-bottom:1px solid var(--border);
    background:var(--nav-bg);
    -webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);
  }
  .m-btn{display:grid;place-items:center;width:34px;height:34px;border-radius:var(--r-sm);
    color:var(--text-muted);
    transition:color var(--dur-fast) var(--ease),background var(--dur-fast) var(--ease)}
  .m-btn:hover{color:var(--text-primary);background:var(--surface)}
  .m-btn .ic{width:16px;height:16px}
  .m-top-actions{display:flex;align-items:center;gap:8px}

  .m-scrim{display:block;position:fixed;inset:0;z-index:40;background:rgba(0,0,0,.5);
    opacity:0;pointer-events:none;transition:opacity var(--dur) var(--ease)}
  body.nav-open .m-scrim{opacity:1;pointer-events:auto}

  .m-drawer{
    display:flex;position:fixed;inset:0 auto 0 0;z-index:50;width:280px;
    flex-direction:column;overflow-y:auto;
    padding:22px 18px;background:var(--bg);border-right:1px solid var(--border);
    box-shadow:0 0 60px rgba(0,0,0,.4);
    transform:translateX(-100%);
    transition:transform var(--dur) cubic-bezier(.22,.61,.36,1);
  }
  body.nav-open .m-drawer{transform:translateX(0)}

  .wrap{padding:0 20px}
}

/* ═══ HOME ════════════════════════════════════════════════════════
   The branding site's home shape: eyebrow, a large heading, a lead, and
   one card per destination. Two apps, so two cards. */

.home{padding-top:56px;padding-bottom:80px}
.home-hero{margin-bottom:64px}
.home-hero .eyebrow{display:block;margin-bottom:24px}
.home-hero h1{
  font-family:var(--display);font-weight:600;
  font-size:clamp(40px,5.6vw,68px);letter-spacing:-.045em;line-height:1.02;
  color:var(--text-primary);max-width:15ch;
}
.home-hero p{margin-top:20px;font-size:18px;line-height:1.55;
  color:var(--text-muted);max-width:52ch}

.home-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}

.home-card{
  display:flex;flex-direction:column;min-height:340px;padding:36px 32px 32px;
  background:var(--surface);border:1px solid var(--border);border-radius:var(--r-lg);
  /* The card never moves on hover — only its surface and border shift,
     matching the Toolkit's .tool-card. */
  transition:background var(--dur-fast) var(--ease),border-color var(--dur-fast) var(--ease);
}
.home-card:hover{background:var(--surface-2);border-color:var(--border-2)}
.home-card .ic-lg{width:28px;height:28px;color:var(--blue-400);margin-bottom:56px}
.home-card h2{font-family:var(--display);font-size:26px;font-weight:600;
  letter-spacing:-.03em;color:var(--text-primary);margin-bottom:14px}
.home-card p{font-size:14px;line-height:1.55;color:var(--text-muted);max-width:34ch;flex-grow:1}
.home-card .more{display:inline-flex;align-items:center;gap:8px;margin-top:26px;
  font-size:13px;font-weight:500;color:var(--text-primary)}
.home-card .more .ic{width:14px;height:14px;transition:transform var(--dur-fast) var(--ease)}
.home-card:hover .more .ic{transform:translateX(4px)}

/* A figure or two per card — what is actually in there. */
.home-stats{display:flex;gap:22px;margin-top:22px;padding-top:20px;border-top:1px solid var(--border)}
.home-stats div{display:flex;flex-direction:column;gap:3px}
.home-stats b{font-family:var(--display);font-size:20px;font-weight:600;
  letter-spacing:-.03em;color:var(--text-primary);line-height:1}
.home-stats small{font-size:11.5px;color:var(--text-subtle)}

@media (max-width:860px){
  .home{padding-top:36px;padding-bottom:56px}
  .home-hero{margin-bottom:40px}
  .home-grid{grid-template-columns:minmax(0,1fr)}
  .home-card{min-height:0;padding:28px 24px 24px}
  .home-card .ic-lg{margin-bottom:32px}
}

/* ═══ SETTINGS TABS ═══════════════════════════════════════════════ */

.set-tabs{display:inline-flex;gap:2px;padding:3px;margin-bottom:var(--gap);
  max-width:100%;overflow-x:auto;scrollbar-width:none;
  border:1px solid var(--border);border-radius:var(--r-sm);background:var(--surface)}
.set-tabs::-webkit-scrollbar{display:none}
.set-tab{flex:0 0 auto;height:32px;padding:0 14px;display:inline-flex;align-items:center;
  border-radius:3px;font-size:12.5px;font-weight:500;color:var(--text-muted);white-space:nowrap;
  transition:color var(--dur-fast) var(--ease),background var(--dur-fast) var(--ease)}
.set-tab:hover{color:var(--text-primary)}
.set-tab.on{background:var(--blue-500);color:#fff}

/* Per-app access — two apps to govern, so it stays. */
.ap-row{display:flex;align-items:center;gap:16px;flex-wrap:wrap;padding:14px 0;
  border-top:1px solid var(--border)}
.ap-row:first-child{border-top:0;padding-top:0}
.ap-label{min-width:180px;font-size:13px;color:var(--text-primary);
  display:flex;flex-direction:column;gap:3px}
.ap-label small{font-size:11.5px;color:var(--text-subtle)}
.ap-seg{display:inline-flex;gap:2px;padding:3px;border:1px solid var(--border);
  border-radius:var(--r-sm);background:var(--surface)}
.ap-seg button{height:28px;padding:0 12px;border-radius:3px;background:transparent;
  color:var(--text-muted);font-family:inherit;font-size:12px;font-weight:500;white-space:nowrap;
  transition:color var(--dur-fast) var(--ease),background var(--dur-fast) var(--ease)}
.ap-seg button:hover{color:var(--text-primary)}
.ap-seg button.on{background:var(--blue-500);color:#fff}

@media (max-width:640px){
  .ap-label{min-width:0;width:100%}
  .ap-seg{width:100%}
  .ap-seg button{flex:1}
}

/* ═══ CAROUSEL GRID ═══════════════════════════════════════════════
   A carousel is a picture, so its list is a grid of them — the opposite
   of the invoice list, which is a table of numbers. */

.carousel-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:16px}
.c-card{position:relative;display:flex;flex-direction:column;overflow:hidden;
  background:var(--surface);border:1px solid var(--border);border-radius:var(--r-lg);
  transition:background var(--dur-fast) var(--ease),border-color var(--dur-fast) var(--ease)}
.c-card:hover{background:var(--surface-2);border-color:var(--border-2)}
.c-thumb{position:relative;display:grid;place-items:center;aspect-ratio:3/4;
  border-bottom:1px solid var(--border);
  background:var(--surface-2) center/cover no-repeat}
/* Until a design has a rendered thumbnail, a quiet mark stands in for one.
   The accent used to tint this, which reads as a smudge now that a design
   can legitimately be white. */
.c-thumb .ph{width:34px;height:34px;color:var(--text-subtle);opacity:.28}
.c-thumb .ph svg{width:100%;height:100%}
.c-thumb .ph svg path{fill:currentColor}
.c-thumb.has-img .ph{display:none}

.c-meta{display:flex;flex-direction:column;gap:6px;padding:14px 16px 16px}
.c-title{font-family:var(--display);font-size:14.5px;font-weight:500;letter-spacing:-.02em;
  color:var(--text-primary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  transition:color var(--dur-fast) var(--ease)}
.c-title:hover{color:var(--blue-400)}
/* One quiet line of facts, separated by dots — no pill floating over the
   picture and no badge competing with the title. */
.c-sub{display:flex;align-items:center;gap:7px;font-size:11.5px;color:var(--text-subtle)}
.c-sub .dot{width:3px;height:3px;border-radius:50%;background:currentColor;opacity:.5;flex:none}
.c-sub .st{color:var(--text-muted)}
.c-sub .st.ready{color:var(--mint)}
.c-sub .st.posted{color:var(--blue-400)}
/* blue-400 is tuned for a dark surface and goes weak on white. */
:root[data-theme="light"] .c-sub .st.posted{color:var(--blue-600)}

.c-actions{position:absolute;top:10px;right:10px;display:flex;gap:4px;opacity:0;
  transition:opacity var(--dur-fast) var(--ease)}
.c-card:hover .c-actions,.c-card:focus-within .c-actions{opacity:1}
.c-actions .icon-btn{width:28px;height:28px;background:rgba(10,10,10,.6);
  border-color:transparent;color:#fff}
.c-actions .icon-btn:hover{background:var(--blue-500)}

/* ═══ SCROLLBARS ══════════════════════════════════════════════════
   The browser default is a wide light bar that reads as a seam down the
   rail — and it was eating enough width to clip the wordmark. Thin,
   dark, and only visible against the surface it belongs to. */
*{scrollbar-width:thin;scrollbar-color:var(--border-2) transparent}
::-webkit-scrollbar{width:8px;height:8px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{
  background:var(--border-2);border-radius:8px;
  border:2px solid transparent;background-clip:content-box;
}
::-webkit-scrollbar-thumb:hover{background:var(--text-subtle);background-clip:content-box}
::-webkit-scrollbar-corner{background:transparent}

