/* Genuine Invoice glass: the frosted side menu, and the same glass on the tiles, cards and controls, so the
   whole signed-in app reads as one piece. Everything is scoped to body.has-gsb, which layout.php sets on the
   app's own pages; the behaviour is in assets/js/glass.js. Loaded after app.css. */

/* ================================================================ the side menu */

@media (min-width: 821px) {
  /* the page behind gets a soft wash of the brand colours, so the frosted glass has something to frost */
  body.has-gsb {
    background:
      radial-gradient(700px 520px at 6% 18%, rgba(195, 156, 76, 0.16), transparent 70%),
      radial-gradient(640px 520px at 2% 92%, rgba(75, 84, 98, 0.13), transparent 70%),
      var(--bg);
    background-attachment: fixed;
  }
  body.has-gsb .appshell { --gsb-w: 268px; grid-template-columns: var(--gsb-w) minmax(0, 1fr);
    transition: grid-template-columns .5s cubic-bezier(.2, .8, .2, 1); }
  body.has-gsb.gsb-collapsed .appshell { --gsb-w: 72px; }

  .gsb { display: block; position: sticky; top: 76px; padding: 0.9rem 0 1rem; z-index: 15; }
  .gsb-glass { position: relative; display: flex; flex-direction: column; height: calc(100vh - 100px); min-height: 520px;
    width: var(--gsb-w); border-radius: 26px; padding: 12px 10px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.58));
    -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5);
    border: 1px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 24px 60px rgba(38, 43, 51, 0.13), 0 2px 6px rgba(38, 43, 51, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.95);
    transition: width .5s cubic-bezier(.2, .8, .2, 1); }
  .gsb-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; margin: 0 -4px; padding: 0 4px; }
  .gsb-scroll::-webkit-scrollbar { display: none; }

  /* head: the mark, the business, and the round button that opens and closes the menu */
  .gsb-head { display: flex; align-items: center; gap: 10px; padding: 2px 4px 10px; }
  .gsb-mark { width: 36px; height: 36px; border-radius: 11px; flex: none; box-shadow: 0 6px 14px rgba(38, 43, 51, 0.25); }
  .gsb-id { min-width: 0; line-height: 1.2; }
  .gsb-id b { display: block; font-size: 0.9rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .gsb-id small { display: block; font-size: 0.72rem; color: var(--muted); white-space: nowrap; }
  .gsb-toggle { position: absolute; top: 18px; right: -13px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
    background: var(--surface); color: var(--text); border: 1px solid var(--line); cursor: pointer; z-index: 3;
    box-shadow: 0 4px 12px rgba(38, 43, 51, 0.15); transition: transform .5s cubic-bezier(.2, .8, .2, 1), background .2s; }
  .gsb-toggle:hover { background: var(--brand-tint); }
  .gsb-toggle svg { width: 14px; height: 14px; }
  .gsb-collapsed .gsb-toggle { transform: rotate(180deg); }
  /* the open/close button is gold, in the brand gradient with a dark arrow; the focus ring follows in gold */
  .gsb-toggle, .gsb-toggle:hover { background: linear-gradient(135deg, #9a7630, #d9b862 60%, #f0da92); border-color: transparent; color: #1d1606; box-shadow: 0 4px 12px rgba(154, 118, 48, 0.4); }
  .gsb-toggle:hover { background: linear-gradient(135deg, #8a6a2a, #c9a24f 60%, #e6c97a); }
  .gsb-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(195, 156, 76, 0.4), 0 4px 12px rgba(154, 118, 48, 0.4); }
  .gsb-toggle svg { stroke-width: 2.4; }

  /* search, with its shortcut */
  .gsb-search { display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 10px; margin: 0 0 6px;
    border-radius: 12px; border: 1px solid rgba(38, 43, 51, 0.07); background: rgba(38, 43, 51, 0.04); color: var(--muted);
    font: inherit; font-size: 0.86rem; cursor: pointer; text-align: left; transition: background .2s, border-color .2s; }
  .gsb-search:hover { background: rgba(38, 43, 51, 0.07); }
  .gsb-search svg { width: 17px; height: 17px; flex: none; }
  .gsb-search .gsb-label { flex: 1; white-space: nowrap; }
  /* the app styles every <label> as a stacked form field; this one is a row */
  .gsb label.gsb-night { display: flex; flex-direction: row; margin: 0; position: relative; }
  .gsb .gsb-night input { width: 1px; height: 1px; margin: 0; }
  .gsb-search kbd { font: 600 0.68rem/1 inherit; padding: 4px 6px; border-radius: 6px; background: rgba(38, 43, 51, 0.07); color: var(--muted); }

  /* sections */
  .gsb-nav { position: relative; display: flex; flex-direction: column; gap: 2px; }
  .gsb-sec { position: relative; margin: 12px 0 4px; padding: 0 10px; height: 14px; font-size: 0.66rem; font-weight: 700;
    letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
  .gsb-sec::before { content: ""; position: absolute; left: 50%; top: 50%; width: 16px; height: 2px; margin-left: -8px; border-radius: 2px;
    background: var(--line-strong); opacity: 0; transition: opacity .25s; }

  /* items */
  .gsb-item { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 6px;
    border-radius: 13px; color: var(--label); text-decoration: none; font-weight: 600; font-size: 0.88rem;
    transition: color .2s; white-space: nowrap; }
  .gsb-item:hover, .gsb-item:focus-visible { color: var(--text); outline: none; }
  .gsb-item .appnav-icon { width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center;
    color: var(--ic, var(--muted)); background: var(--ic-bg, transparent); transition: transform .25s cubic-bezier(.3, 1.5, .5, 1), background .2s, color .2s; }
  .gsb-item .appnav-icon svg { width: 18px; height: 18px; }
  .gsb-item:hover .appnav-icon { transform: scale(1.08); }
  .gsb-item.is-active { color: var(--text); }
  .gsb-item.is-active .appnav-icon { background: var(--ic, var(--brand)); color: #fff; }
  .gsb-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; transition: opacity .3s ease, transform .4s cubic-bezier(.2, .8, .2, 1);
    transition-delay: calc(var(--i, 0) * 22ms + 120ms); }
  .gsb-item > .gsb-label { flex: 1; }
  .gsb-count { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center;
    font-size: 0.7rem; font-weight: 700; background: rgba(38, 43, 51, 0.07); color: var(--label); }
  .gsb-count.is-alert { background: #d8452f; color: #fff; }
  .gsb-dot { position: absolute; left: 30px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: #d8452f;
    box-shadow: 0 0 0 2px var(--surface); opacity: 0; transform: scale(.4); transition: opacity .25s, transform .3s cubic-bezier(.3, 1.6, .5, 1); }
  .gsb-dot.is-alert { animation: gsb-pulse 2.4s ease-in-out infinite; }
  @keyframes gsb-pulse { 0%, 100% { box-shadow: 0 0 0 2px var(--surface), 0 0 0 2px rgba(216, 69, 47, 0.35); }
    50% { box-shadow: 0 0 0 2px var(--surface), 0 0 0 6px rgba(216, 69, 47, 0); } }

  /* the glass highlight that slides to whichever item the pointer is on; the gold one marks this page */
  .gsb-hl, .gsb-on { position: absolute; left: 0; right: 0; top: 0; height: 42px; border-radius: 13px; pointer-events: none;
    transition: transform .45s cubic-bezier(.3, 1.25, .45, 1), height .3s, opacity .25s; }
  .gsb-on { background: linear-gradient(180deg, rgba(245, 236, 214, 0.95), rgba(245, 236, 214, 0.7));
    box-shadow: inset 0 0 0 1px rgba(195, 156, 76, 0.45), 0 4px 14px rgba(154, 118, 48, 0.12); }
  .gsb-hl { background: rgba(255, 255, 255, 0.85); opacity: 0;
    box-shadow: inset 0 0 0 1px rgba(38, 43, 51, 0.08), 0 6px 16px rgba(38, 43, 51, 0.10); }
  .gsb-hl.is-on { opacity: 1; }

  /* Projects folds open to its projects */
  .gsb-group { position: relative; z-index: 1; }
  .gsb-caret { margin-left: auto; width: 24px; height: 24px; border: 0; background: none; color: var(--muted); border-radius: 7px;
    display: grid; place-items: center; cursor: pointer; transition: transform .35s cubic-bezier(.2, .8, .2, 1), background .2s; }
  .gsb-caret:hover { background: rgba(38, 43, 51, 0.07); }
  .gsb-caret svg { width: 14px; height: 14px; }
  .gsb-group.is-open .gsb-caret { transform: rotate(180deg); }
  .gsb-sub { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .4s cubic-bezier(.2, .8, .2, 1); }
  .gsb-group.is-open .gsb-sub { grid-template-rows: 1fr; }
  .gsb-sub > div { overflow: hidden; }
  .gsb-sub a { position: relative; display: flex; align-items: center; gap: 10px; height: 32px; margin-left: 20px; padding: 0 10px 0 18px;
    border-radius: 10px; color: var(--muted); text-decoration: none; font-size: 0.83rem; font-weight: 600; white-space: nowrap;
    transition: background .2s, color .2s, transform .3s; }
  .gsb-sub a::before { content: ""; position: absolute; left: 0; top: -6px; bottom: 50%; width: 10px; border-left: 1.5px solid var(--line-strong);
    border-bottom: 1.5px solid var(--line-strong); border-bottom-left-radius: 8px; }
  .gsb-sub a:hover { background: rgba(38, 43, 51, 0.05); color: var(--text); transform: translateX(2px); }
  .gsb-sub i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
  .gsb-sub .gsb-more { color: var(--brand); }

  /* foot: night mode and the person signed in */
  .gsb-foot { border-top: 1px solid rgba(38, 43, 51, 0.08); margin-top: 8px; padding-top: 8px; display: flex; flex-direction: column; gap: 4px; }
  .gsb-night { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 6px 0 12px; border-radius: 12px; color: var(--label);
    font-weight: 600; font-size: 0.86rem; cursor: pointer; white-space: nowrap; }
  .gsb-night > svg { width: 18px; height: 18px; flex: none; }
  .gsb-night .gsb-label { flex: 1; }
  .gsb-switch { position: relative; width: 36px; height: 21px; flex: none; border-radius: 999px; background: rgba(38, 43, 51, 0.16);
    transition: background .3s; }
  .gsb-switch::after { content: ""; position: absolute; left: 2px; top: 2px; width: 17px; height: 17px; border-radius: 50%; background: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25); transition: transform .35s cubic-bezier(.3, 1.5, .5, 1); }
  .gsb-night input { position: absolute; opacity: 0; pointer-events: none; }
  .gsb-night input:checked + .gsb-switch { background: linear-gradient(100deg, #9a7630, #d9b862); }
  .gsb-night input:checked + .gsb-switch::after { transform: translateX(15px); }
  .gsb-night input:focus-visible + .gsb-switch { box-shadow: var(--focus); }
  .gsb-user { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 14px; text-decoration: none; color: var(--text);
    transition: background .2s; }
  .gsb-user:hover { background: rgba(38, 43, 51, 0.05); }
  .gsb-avatar { position: relative; width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
    font-weight: 800; color: #2a2110; background: linear-gradient(135deg, #f0da92, #c39c4c); }
  .gsb-avatar::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%;
    background: #2f9a5f; box-shadow: 0 0 0 2px var(--surface); }
  .gsb-user .gsb-label { line-height: 1.25; }
  .gsb-user b { display: block; font-size: 0.85rem; }
  .gsb-user small { display: block; font-size: 0.72rem; color: var(--muted); }

  /* ---------- collapsed: a slim rail of icons ---------- */
  .gsb-collapsed .gsb-label, .gsb-collapsed .gsb-id, .gsb-collapsed .gsb-count, .gsb-collapsed .gsb-caret {
    opacity: 0; transform: translateX(-8px); pointer-events: none; transition-delay: 0s; }
  .gsb-collapsed .gsb-id, .gsb-collapsed .gsb-count, .gsb-collapsed .gsb-caret { transition: opacity .15s; }
  .gsb-collapsed .gsb-sec { color: transparent; }
  .gsb-collapsed .gsb-sec::before { opacity: 1; }
  .gsb-collapsed .gsb-dot { opacity: 1; transform: none; }
  .gsb-collapsed .gsb-sub { grid-template-rows: 0fr; }
  /* the icon lines up with the menu icons below: their 7px inset plus half of (30px tile − 17px icon), less this box’s 1px border */
  .gsb-collapsed .gsb-search { justify-content: flex-start; gap: 0; padding: 0 0 0 12.5px; background: transparent; border-color: transparent; }
  .gsb-collapsed .gsb-search .gsb-label { position: absolute; }
  .gsb-collapsed .gsb-search kbd { display: none; }
  .gsb-collapsed .gsb-head { justify-content: center; padding-left: 0; padding-right: 0; }
  .gsb-collapsed .gsb-night { padding: 0; justify-content: center; }
  .gsb-collapsed .gsb-night .gsb-switch { display: none; }
  .gsb-collapsed .gsb-user { justify-content: center; }
  .gsb-collapsed .gsb-item { padding: 0 0 0 7px; }

  /* the label that pops out beside the rail: one floating element, placed by the script, so the menu's
     own scrolling cannot clip it */
  .gsb-tip { position: fixed; z-index: 60; padding: 6px 10px; border-radius: 9px; background: rgba(38, 43, 51, 0.92); color: #fff;
    font-size: 0.78rem; font-weight: 600; white-space: nowrap; pointer-events: none; opacity: 0; transform: translate(-6px, -50%) scale(.92);
    transform-origin: left center; box-shadow: 0 8px 20px rgba(38, 43, 51, 0.25); transition: opacity .18s, transform .25s cubic-bezier(.3, 1.4, .5, 1); }
  .gsb-tip::before { content: ""; position: absolute; left: -4px; top: 50%; width: 8px; height: 8px; margin-top: -4px; background: inherit; transform: rotate(45deg); border-radius: 2px; }
  .gsb-tip.is-on { opacity: 1; transform: translate(0, -50%) scale(1); }
  .gsb-collapsed .gsb-group.is-open .gsb-sub { grid-template-rows: 0fr; }

  /* the first visit: items glide in one after another */
  .gsb-enter .gsb-item, .gsb-enter .gsb-sec, .gsb-enter .gsb-search { opacity: 0; transform: translateX(-14px); }
  .gsb-ready .gsb-item, .gsb-ready .gsb-sec, .gsb-ready .gsb-search { transition: opacity .45s, transform .55s cubic-bezier(.2, .8, .2, 1), color .2s;
    transition-delay: calc(var(--i, 0) * 35ms); }
}

/* Between 821 and 1180 the open menu floats over the page instead of pushing it aside. */
@media (min-width: 821px) and (max-width: 1180px) {
  body.has-gsb .appshell { grid-template-columns: 72px minmax(0, 1fr); }
  body.has-gsb .gsb-glass { position: absolute; left: 0; }
}

/* dark: chosen with the switch, or set on the device */
@media (min-width: 821px) {
  :root[data-theme="dark"] body.has-gsb { background:
      radial-gradient(700px 520px at 6% 18%, rgba(217, 184, 98, 0.10), transparent 70%),
      radial-gradient(640px 520px at 2% 92%, rgba(120, 130, 145, 0.10), transparent 70%), var(--bg); }
  :root[data-theme="dark"] .gsb-glass { background: linear-gradient(180deg, rgba(36, 41, 48, 0.78), rgba(28, 32, 38, 0.62));
    border-color: rgba(255, 255, 255, 0.08); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.07); }
  :root[data-theme="dark"] .gsb-on { background: linear-gradient(180deg, rgba(217, 184, 98, 0.20), rgba(217, 184, 98, 0.10));
    box-shadow: inset 0 0 0 1px rgba(217, 184, 98, 0.35); }
  :root[data-theme="dark"] .gsb-hl { background: rgba(255, 255, 255, 0.07); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
  :root[data-theme="dark"] .gsb-search, :root[data-theme="dark"] .gsb-count, :root[data-theme="dark"] .gsb-search kbd { background: rgba(255, 255, 255, 0.06); }
  :root[data-theme="dark"] .gsb-foot { border-color: rgba(255, 255, 255, 0.08); }
  :root[data-theme="dark"] .gsb-tip { background: rgba(236, 238, 241, 0.95); color: #14171c; }
}
@media (min-width: 821px) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.has-gsb { background:
      radial-gradient(700px 520px at 6% 18%, rgba(217, 184, 98, 0.10), transparent 70%),
      radial-gradient(640px 520px at 2% 92%, rgba(120, 130, 145, 0.10), transparent 70%), var(--bg); }
  :root:not([data-theme="light"]) .gsb-glass { background: linear-gradient(180deg, rgba(36, 41, 48, 0.78), rgba(28, 32, 38, 0.62));
    border-color: rgba(255, 255, 255, 0.08); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.07); }
  :root:not([data-theme="light"]) .gsb-on { background: linear-gradient(180deg, rgba(217, 184, 98, 0.20), rgba(217, 184, 98, 0.10));
    box-shadow: inset 0 0 0 1px rgba(217, 184, 98, 0.35); }
  :root:not([data-theme="light"]) .gsb-hl { background: rgba(255, 255, 255, 0.07); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
  :root:not([data-theme="light"]) .gsb-search, :root:not([data-theme="light"]) .gsb-count, :root:not([data-theme="light"]) .gsb-search kbd { background: rgba(255, 255, 255, 0.06); }
  :root:not([data-theme="light"]) .gsb-foot { border-color: rgba(255, 255, 255, 0.08); }
  :root:not([data-theme="light"]) .gsb-tip { background: rgba(236, 238, 241, 0.95); color: #14171c; }
}
@media (prefers-reduced-motion: reduce) {
  .gsb *, .gsb *::before, .gsb *::after, body.has-gsb .appshell { transition: none !important; animation: none !important; }
}

/* the overdue badge stays red in every theme */
.gsb .gsb-nav .gsb-count.is-alert { background: #d8452f; color: #fff; }

/* the coloured dots beside each project in the menu */
.gsb-sub .gsb-pc-0 { background: #c39c4c; } .gsb-sub .gsb-pc-1 { background: #2f9a5f; } .gsb-sub .gsb-pc-2 { background: #7556d4; }
.gsb-sub .gsb-pc-3 { background: #2d6be0; } .gsb-sub .gsb-pc-4 { background: #e2731b; } .gsb-sub .gsb-pc-5 { background: #d8447f; }
.gsb-sub .gsb-more i { background: transparent; border: 1.5px solid currentColor; }

/* ================================================================ tiles, cards and controls */

body.has-gsb {
  --glass: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.62));
  --glass-solid: rgba(255, 255, 255, 0.86);
  --glass-edge: rgba(255, 255, 255, 0.9);
  --glass-line: rgba(38, 43, 51, 0.08);
  --glass-shadow: 0 18px 44px rgba(38, 43, 51, 0.10), 0 2px 6px rgba(38, 43, 51, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.95);
  --glass-lift: 0 26px 60px rgba(38, 43, 51, 0.16), 0 4px 10px rgba(38, 43, 51, 0.06), inset 0 1px 0 rgba(255, 255, 255, 1);
  --glass-blur: blur(18px) saturate(1.5);
  --glass-hover: rgba(195, 156, 76, 0.10);
  --glass-r: 20px;
  /* the soft wash the glass sits on, on every screen size */
  background:
    radial-gradient(760px 560px at 6% 16%, rgba(195, 156, 76, 0.17), transparent 70%),
    radial-gradient(700px 560px at 96% 4%, rgba(75, 84, 98, 0.10), transparent 70%),
    radial-gradient(640px 520px at 2% 94%, rgba(75, 84, 98, 0.12), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

/* ---------- the shared glass surface ---------- */
body.has-gsb :is(.stat, .card, .panel, .kpi, .chip-stats, .action-bar, .usermenu-panel, .modal, .install-card) {
  background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
body.has-gsb :is(.card, .panel) { border-radius: var(--glass-r); }
body.has-gsb .modal { border-radius: 24px; }
body.has-gsb .modal::backdrop { background: rgba(20, 23, 28, 0.35); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
body.has-gsb .usermenu-panel { border-radius: 16px; }
body.has-gsb .topbar { background: rgba(255, 255, 255, 0.62); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border-bottom-color: var(--glass-line); }
body.has-gsb .tabbar { background: rgba(255, 255, 255, 0.72); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border-top-color: var(--glass-line); }
body.has-gsb .toast { -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-radius: 14px; }

/* ---------- the summary tiles ---------- */
body.has-gsb .stats { gap: 1.1rem; }
body.has-gsb .stat { position: relative; overflow: hidden; border-radius: var(--glass-r); padding: 1.05rem 1.15rem 1.1rem;
  border-top: 1px solid var(--glass-edge); --tone: var(--line-strong);
  transition: transform .45s cubic-bezier(.2, .8, .2, 1), box-shadow .45s; }
body.has-gsb .stat.tone-success { --tone: var(--success); }
body.has-gsb .stat.tone-warning { --tone: var(--warning); }
body.has-gsb .stat.tone-danger  { --tone: var(--danger); }
body.has-gsb .stat.tone-info    { --tone: var(--info); }
body.has-gsb .stat.tone-plum    { --tone: var(--plum); }
body.has-gsb .stat[class*="tone-"] { padding-top: 1.05rem; border-top: 1px solid var(--glass-edge); }
/* the colour bar becomes a short glowing pill at the top, with a faint glow of the same colour behind */
body.has-gsb .stat::before { content: ""; position: absolute; left: 1.15rem; top: 0; width: 38px; height: 4px; border-radius: 0 0 4px 4px;
  background: var(--tone); box-shadow: 0 0 14px var(--tone); transition: width .45s cubic-bezier(.2, .8, .2, 1); }
body.has-gsb .stat::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(240px 120px at 0% 0%, color-mix(in srgb, var(--tone) 14%, transparent), transparent 70%),
              linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.55) 50%, transparent 65%);
  background-size: 100% 100%, 250% 100%; background-position: 0 0, 160% 0; transition: background-position .9s ease; }
body.has-gsb .stat:hover { transform: translateY(-4px); box-shadow: var(--glass-lift); }
body.has-gsb .stat:hover::before { width: 64px; }
body.has-gsb .stat:hover::after { background-position: 0 0, -60% 0; }
body.has-gsb .stat > * { position: relative; z-index: 1; }
body.has-gsb .stat-value { font-size: 1.45rem; }
body.has-gsb .stat select, body.has-gsb .year-select { border-radius: 9px; background: rgba(255, 255, 255, 0.7); }

/* ---------- filter tabs: a glass track with a pill that slides ---------- */
body.has-gsb .segmented { position: relative; background: rgba(38, 43, 51, 0.05); border: 1px solid var(--glass-line); border-radius: 13px; padding: 4px; }
body.has-gsb .segmented button { position: relative; z-index: 1; border-radius: 10px; transition: color .25s; }
body.has-gsb .segmented button[aria-selected="true"] { background: transparent; box-shadow: none; color: var(--text); }
body.has-gsb .segmented.no-pill button[aria-selected="true"] { background: var(--glass-solid); box-shadow: 0 2px 8px rgba(38, 43, 51, 0.12); }
body.has-gsb .seg-pill { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0; border-radius: 10px; background: var(--glass-solid);
  box-shadow: 0 4px 12px rgba(38, 43, 51, 0.12), inset 0 0 0 1px rgba(255, 255, 255, 0.9); pointer-events: none;
  transition: transform .45s cubic-bezier(.3, 1.25, .45, 1), width .45s cubic-bezier(.3, 1.25, .45, 1); }

/* ---------- status chips ---------- */
body.has-gsb .money-chip { background: var(--glass-solid); border: 1px solid var(--glass-line); border-radius: 999px;
  box-shadow: 0 2px 8px rgba(38, 43, 51, 0.06); transition: transform .3s cubic-bezier(.3, 1.4, .5, 1), box-shadow .3s, background .3s; }
body.has-gsb .money-chip:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(38, 43, 51, 0.12); }
body.has-gsb .money-chip.is-on { background: linear-gradient(100deg, #9a7630, #c9a24f 50%, #a98336); border-color: transparent; color: #fff;
  box-shadow: 0 6px 16px rgba(154, 118, 48, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.35); }

/* ---------- the table ---------- */
body.has-gsb .card .table th { background: transparent; }
body.has-gsb .docs-table tbody tr td { transition: background .2s; }
body.has-gsb .docs-table tbody tr { position: relative; }
body.has-gsb .docs-table tbody tr:hover td { background: var(--glass-hover); }
body.has-gsb .docs-table tbody tr td:first-child { box-shadow: inset 0 0 0 transparent; transition: box-shadow .25s; }
body.has-gsb .docs-table tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 #c39c4c; }
body.has-gsb .docs-table tbody tr.is-selected td { background: rgba(195, 156, 76, 0.16); }
body.has-gsb .action-bar { border-radius: 14px; border-style: solid; }
body.has-gsb .action-bar.is-active { background: linear-gradient(180deg, rgba(245, 236, 214, 0.95), rgba(245, 236, 214, 0.75)); border-color: rgba(195, 156, 76, 0.45); }

/* ---------- buttons and fields ---------- */
body.has-gsb .btn:not(.btn-primary):not(.btn-danger):not(.btn-save):not(.review-send):not(.btn-whatsapp):not(.btn-act) { background: var(--glass-solid); border-color: var(--glass-line);
  box-shadow: 0 2px 8px rgba(38, 43, 51, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.9); }
body.has-gsb .btn { border-radius: 11px; transition: transform .3s cubic-bezier(.3, 1.4, .5, 1), box-shadow .3s, background .2s; }
body.has-gsb .btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(38, 43, 51, 0.13); }
body.has-gsb .btn-primary { position: relative; overflow: hidden; }
body.has-gsb .btn-primary::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.22) 50%, transparent 65%); background-size: 250% 100%;
  background-position: 160% 0; transition: background-position .8s ease; }
body.has-gsb .btn-primary:hover::after { background-position: -60% 0; }
body.has-gsb .btn:disabled { box-shadow: none; opacity: .55; }
body.has-gsb :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) { border-radius: 11px; }
body.has-gsb #workspace :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea):focus { border-color: #c39c4c; box-shadow: 0 0 0 4px rgba(195, 156, 76, 0.18); }

/* ---------- the page opens: tiles rise in one after another ---------- */
body.has-gsb.tiles-enter :is(.stat, #workspace > .card, #workspace > section) { opacity: 0; transform: translateY(16px); }
body.has-gsb.tiles-ready :is(.stat, #workspace > .card, #workspace > section) { transition: opacity .6s ease, transform .7s cubic-bezier(.2, .8, .2, 1), box-shadow .45s;
  transition-delay: calc(var(--t, 0) * 70ms); }
body.has-gsb.tiles-done :is(.stat, #workspace > .card, #workspace > section) { transition-delay: 0s; }

/* ---------- dark: the same glass, smoked ---------- */
:root[data-theme="dark"] body.has-gsb {
  --glass: linear-gradient(180deg, rgba(38, 43, 51, 0.72), rgba(28, 32, 38, 0.58));
  --glass-solid: rgba(255, 255, 255, 0.08); --glass-edge: rgba(255, 255, 255, 0.08); --glass-line: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 18px 44px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --glass-lift: 0 26px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --glass-hover: rgba(217, 184, 98, 0.08);
  background: radial-gradient(760px 560px at 6% 16%, rgba(217, 184, 98, 0.09), transparent 70%),
              radial-gradient(700px 560px at 96% 4%, rgba(120, 130, 145, 0.08), transparent 70%), var(--bg);
}
:root[data-theme="dark"] body.has-gsb .topbar, :root[data-theme="dark"] body.has-gsb .tabbar { background: rgba(20, 23, 28, 0.6); }
:root[data-theme="dark"] body.has-gsb .stat::after { background: radial-gradient(240px 120px at 0% 0%, color-mix(in srgb, var(--tone) 18%, transparent), transparent 70%),
  linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.07) 50%, transparent 65%); background-size: 100% 100%, 250% 100%; }
:root[data-theme="dark"] body.has-gsb .seg-pill { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
:root[data-theme="dark"] body.has-gsb .segmented { background: rgba(255, 255, 255, 0.04); }
:root[data-theme="dark"] body.has-gsb .money-chip.is-on { color: #1d1606; }
:root[data-theme="dark"] body.has-gsb .action-bar.is-active { background: rgba(217, 184, 98, 0.12); }
:root[data-theme="dark"] body.has-gsb .stat select, :root[data-theme="dark"] body.has-gsb .year-select { background: rgba(255, 255, 255, 0.06); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.has-gsb {
    --glass: linear-gradient(180deg, rgba(38, 43, 51, 0.72), rgba(28, 32, 38, 0.58));
    --glass-solid: rgba(255, 255, 255, 0.08); --glass-edge: rgba(255, 255, 255, 0.08); --glass-line: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 18px 44px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    --glass-lift: 0 26px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    --glass-hover: rgba(217, 184, 98, 0.08);
    background: radial-gradient(760px 560px at 6% 16%, rgba(217, 184, 98, 0.09), transparent 70%),
                radial-gradient(700px 560px at 96% 4%, rgba(120, 130, 145, 0.08), transparent 70%), var(--bg);
  }
  :root:not([data-theme="light"]) body.has-gsb .topbar, :root:not([data-theme="light"]) body.has-gsb .tabbar { background: rgba(20, 23, 28, 0.6); }
  :root:not([data-theme="light"]) body.has-gsb .stat::after { background: radial-gradient(240px 120px at 0% 0%, color-mix(in srgb, var(--tone) 18%, transparent), transparent 70%),
    linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.07) 50%, transparent 65%); background-size: 100% 100%, 250% 100%; }
  :root:not([data-theme="light"]) body.has-gsb .seg-pill { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
  :root:not([data-theme="light"]) body.has-gsb .segmented { background: rgba(255, 255, 255, 0.04); }
  :root:not([data-theme="light"]) body.has-gsb .money-chip.is-on { color: #1d1606; }
  :root:not([data-theme="light"]) body.has-gsb .action-bar.is-active { background: rgba(217, 184, 98, 0.12); }
  :root:not([data-theme="light"]) body.has-gsb .stat select, :root:not([data-theme="light"]) body.has-gsb .year-select { background: rgba(255, 255, 255, 0.06); }
}
@media (prefers-reduced-motion: reduce) {
  body.has-gsb :is(.stat, .stat::before, .stat::after, .seg-pill, .money-chip, .btn, .card) { transition: none !important; }
  body.has-gsb.tiles-enter :is(.stat, #workspace > .card, #workspace > section) { opacity: 1; transform: none; }
}

/* ---------- colour on the filter tabs and the status chips ----------
   Each one takes the colour of what it stands for, the same colours as the summary tiles and the status
   labels in the table: invoices green like Annual sales, quotes blue like Open quotes, overdue red, and so on. */
body.has-gsb {
  --c-all: #a8842f; --c-invoice: var(--success); --c-quote: var(--info); --c-proforma: var(--plum); --c-credit: #d8447f;
  --c-overdue: var(--danger); --c-part: #c48a0e; --c-sent: var(--info); --c-paid: var(--success); --c-draft: #e2731b; --c-bin: #6b7482;
}
:root[data-theme="dark"] body.has-gsb { --c-all: #d9b862; --c-credit: #f08ab3; --c-part: #f0c45a; --c-draft: #f2a35e; --c-bin: #a0a8b4; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.has-gsb { --c-all: #d9b862; --c-credit: #f08ab3; --c-part: #f0c45a; --c-draft: #f2a35e; --c-bin: #a0a8b4; }
}

/* the tabs: a short glowing strip under each, in its colour; the chosen one's strip widens, and the
   sliding glass pill takes a tint of the same colour */
body.has-gsb .segmented button[data-filter="all"]      { --c: var(--c-all); }
body.has-gsb .segmented button[data-filter="invoice"]  { --c: var(--c-invoice); }
body.has-gsb .segmented button[data-filter="quote"]    { --c: var(--c-quote); }
body.has-gsb .segmented button[data-filter="proforma"] { --c: var(--c-proforma); }
body.has-gsb .segmented button[data-filter="credit"]   { --c: var(--c-credit); }
body.has-gsb .segmented button[data-filter] { padding-bottom: 0.55rem; }
body.has-gsb .segmented button[data-filter]::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 14px; height: 3px; margin-left: -7px;
  border-radius: 3px; background: var(--c); opacity: .55; box-shadow: 0 0 8px var(--c);
  transition: width .4s cubic-bezier(.3, 1.3, .45, 1), margin-left .4s cubic-bezier(.3, 1.3, .45, 1), opacity .3s; }
body.has-gsb .segmented button[data-filter]:hover::after { opacity: .9; }
body.has-gsb .segmented button[data-filter][aria-selected="true"]::after { width: 30px; margin-left: -15px; opacity: 1; }
body.has-gsb .segmented button[data-filter][aria-selected="true"] { color: color-mix(in srgb, var(--c) 70%, var(--text)); }
body.has-gsb .seg-pill { background: linear-gradient(180deg, color-mix(in srgb, var(--pill-c, #fff) 12%, var(--glass-solid)), var(--glass-solid));
  transition: transform .45s cubic-bezier(.3, 1.25, .45, 1), width .45s cubic-bezier(.3, 1.25, .45, 1), height .45s cubic-bezier(.3, 1.25, .45, 1), background .4s; }

/* the chips: tinted glass in their own colour; the chosen one fills with it */
body.has-gsb .money-chip.chip-all     { --c: var(--c-all); }
body.has-gsb .money-chip.chip-overdue { --c: var(--c-overdue); }
body.has-gsb .money-chip.chip-part    { --c: var(--c-part); }
body.has-gsb .money-chip.chip-sent    { --c: var(--c-sent); }
body.has-gsb .money-chip.chip-paid    { --c: var(--c-paid); }
body.has-gsb .money-chip.chip-draft   { --c: var(--c-draft); }
body.has-gsb .money-chip.chip-bin     { --c: var(--c-bin); }
body.has-gsb .money-chip[class*="chip-"] {
  color: color-mix(in srgb, var(--c) 78%, var(--text));
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 9%, var(--glass-solid)), color-mix(in srgb, var(--c) 4%, var(--glass-solid)));
  border-color: color-mix(in srgb, var(--c) 28%, transparent); }
body.has-gsb .money-chip[class*="chip-"] .chip-count { background: color-mix(in srgb, var(--c) 16%, transparent); color: inherit; }
body.has-gsb .money-chip[class*="chip-"]:hover { box-shadow: 0 8px 18px color-mix(in srgb, var(--c) 22%, transparent); }
body.has-gsb .money-chip[class*="chip-"].is-on { color: #fff; border-color: transparent;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 82%, #fff), var(--c));
  box-shadow: 0 6px 16px color-mix(in srgb, var(--c) 35%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.35); }
body.has-gsb .money-chip[class*="chip-"].is-on .chip-count { background: rgba(255, 255, 255, 0.24); color: #fff; }
:root[data-theme="dark"] body.has-gsb .money-chip[class*="chip-"].is-on,
:root[data-theme="dark"] body.has-gsb .money-chip[class*="chip-"].is-on .chip-count { color: #14171c; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.has-gsb .money-chip[class*="chip-"].is-on,
  :root:not([data-theme="light"]) body.has-gsb .money-chip[class*="chip-"].is-on .chip-count { color: #14171c; }
}

/* ---------- every other tab menu: the same glass track, sliding pill and colour strip ----------
   Projects / Purchases / Expenses…, Marketing, My account, Business details and the layout editor's tabs
   look and move like the document filter tabs. Each tab's colour comes from what it says (Overdue red,
   Paid green, Draft orange…) or, for plain section names, from the platform's palette in turn (glass.js). */
body.has-gsb :is(.subnav, .le-tabs) { position: relative; background: rgba(38, 43, 51, 0.05); border: 1px solid var(--glass-line); border-radius: 13px; padding: 4px; box-shadow: none; }
body.has-gsb .subnav a, body.has-gsb .le-tabs button { position: relative; z-index: 1; border-radius: 10px; transition: color .25s; padding-bottom: 0.7rem; }
body.has-gsb .subnav a:hover, body.has-gsb .le-tabs button:hover { background: transparent; color: var(--text); }
body.has-gsb .subnav a.is-active, body.has-gsb .subnav a.is-active:hover, body.has-gsb .le-tabs button[aria-selected="true"] {
  background: transparent; box-shadow: none; color: color-mix(in srgb, var(--c, var(--text)) 70%, var(--text)); }
:root[data-theme="dark"] body.has-gsb .subnav a.is-active { color: color-mix(in srgb, var(--c, var(--text)) 70%, var(--text)); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.has-gsb .subnav a.is-active { color: color-mix(in srgb, var(--c, var(--text)) 70%, var(--text)); }
}
body.has-gsb .segmented button:not([data-filter]) { padding-bottom: 0.55rem; }
body.has-gsb .segmented button:not([data-filter])[aria-selected="true"] { color: color-mix(in srgb, var(--c, var(--text)) 70%, var(--text)); }
body.has-gsb :is(.subnav a, .le-tabs button, .segmented button:not([data-filter]))::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 14px; height: 3px; margin-left: -7px;
  border-radius: 3px; background: var(--c, var(--c-all)); opacity: .55; box-shadow: 0 0 8px var(--c, var(--c-all));
  transition: width .4s cubic-bezier(.3, 1.3, .45, 1), margin-left .4s cubic-bezier(.3, 1.3, .45, 1), opacity .3s; }
body.has-gsb :is(.subnav a, .le-tabs button, .segmented button:not([data-filter])):hover::after { opacity: .9; }
body.has-gsb :is(.subnav a.is-active, .le-tabs button[aria-selected="true"], .segmented button:not([data-filter])[aria-selected="true"], .segmented button:not([data-filter]).is-active)::after { width: 30px; margin-left: -15px; opacity: 1; }
:root[data-theme="dark"] body.has-gsb :is(.subnav, .le-tabs) { background: rgba(255, 255, 255, 0.04); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body.has-gsb :is(.subnav, .le-tabs) { background: rgba(255, 255, 255, 0.04); } }
@media (prefers-reduced-motion: reduce) { body.has-gsb :is(.subnav a, .le-tabs button, .segmented button)::after { transition: none; } }
