/* ==========================================================================
   SOFT GLASS — shared house style for Life OS, SEO Desk and Studio Desk
   Version 1.0.1 · 8 Nov 2026 · owner: Ali (Pink Pastel Studio)

   One file, three tools, one family look. Plain CSS, no build step, ~19 KB (about 6 KB gzipped).
   Speed first: blur only on the top bar and pop-up sheets; everything else
   is near-solid white over one static, very soft background gradient.

   HOW A TOOL USES IT
   1. <link rel="stylesheet" href="/soft-glass.css"> before the tool's own CSS.
   2. Set the tool's DEFAULT theme on <html>, before first paint:
        Life OS     <html data-sg-default="lavender">
        Studio Desk <html data-sg-default="indigo">  (Indigo theme is added to
                    this shared file in the Studio Desk build, then copied to all tools)
        SEO Desk    <html data-sg-default="mint">
   3. Paste the 7-line theme loader (bottom of this file) into <head>.
      It applies the saved choice (per tool, stored on the device) or the
      tool's default, so the first screen opens in the right colours.
   4. Build screens from the classes below (.sg-card, .sg-pill, ...).
      Never type raw colours, sizes or radii in a tool's own CSS: use the
      --sg-* variables, so a theme switch changes everything at once.

   THEMES (data-sg-theme on <html>)
     lavender  Lavender Calm   (Life OS default)
     blush     Blush + Peach
     indigo    Indigo          (Studio Desk default; added in the Studio Desk build)
     mint      Mint + Sky      (SEO Desk default)
     night     Night (dark)
     auto      follows the phone: light uses the tool's default, dark uses night
   Each tool keeps its own theme (Ali's choice): switching one tool's theme
   never changes the others. A tool may offer fewer themes (SEO Desk: no Blush).

   CHANGES
   1.0.1  global [hidden] rule (flex/grid parts ignored "hidden"; found in SEO
          Desk 1.1.0); Studio Desk default is Indigo.

   RULES THIS FILE ENFORCES (app-build-standards 6a/6b)
   - spacing in 8px steps; type scale x1.25 with 16px body
   - colour about 60% base / 30% surfaces / 10% accent
   - text sits on near-solid surfaces; every theme checked to WCAG AA
   - shadows tinted from the theme, never grey-black
   - section colours (life areas, app tabs) show as pill + thin strip +
     icon chip, always with icon and name, never colour alone
   ========================================================================== */

/* ---------- 1. Fixed tokens (same in every theme) ---------- */
:root {
  /* spacing: 8px scale (4 only inside icons and badges) */
  --sg-s-half: 4px;
  --sg-s1: 8px;
  --sg-s2: 16px;
  --sg-s3: 24px;
  --sg-s4: 32px;
  --sg-s6: 48px;
  --sg-s8: 64px;

  /* type: x1.25 scale, 16px body; headings step down on phones */
  --sg-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sg-font-arabic: "Noto Naskh Arabic", "Amiri", serif;
  --sg-t-small: 0.8125rem;  /* 13px: meta lines, counts, badges only */
  --sg-t-body: 1rem;        /* 16px */
  --sg-t-sub: 1.25rem;      /* 20px */
  --sg-t-h3: 1.5625rem;     /* 25px */
  --sg-t-h2: 1.9375rem;     /* 31px */
  --sg-t-h1: 2.4375rem;     /* 39px */
  --sg-lh-body: 1.5;
  --sg-lh-head: 1.15;
  --sg-lh-arabic: 1.9;
  --sg-measure: 65ch;

  /* radii: one per element type */
  --sg-r-card: 20px;
  --sg-r-sheet: 24px;
  --sg-r-input: 12px;
  --sg-r-button: 999px;     /* buttons are pills, decided once */
  --sg-r-chip: 999px;
  --sg-r-icon: 10px;        /* icon chips */

  /* tap target */
  --sg-tap: 44px;

  /* motion: short fades only */
  --sg-fade: 160ms ease-out;

  /* section colours: fixed in every theme so Personal is always teal etc.
     -bg = pill / chip fill, -ink = text and icon on it (AA on -bg),
     -line = the thin strip on cards */
  --sg-personal-bg: #d6f2ee;  --sg-personal-ink: #0f5a52;  --sg-personal-line: #3fb3a5;
  --sg-work-bg:     #dce8fb;  --sg-work-ink:     #1d4a8c;  --sg-work-line:     #5b8fdc;
  --sg-business-bg: #fbe0e8;  --sg-business-ink: #8a2648;  --sg-business-line: #e0779a;
  --sg-growth-bg:   #dff3dc;  --sg-growth-ink:   #2f6129;  --sg-growth-line:   #6cbf62;
  /* extra section slots for other tools' tabs (Posts/Reels/Pinterest/Reddit...) */
  --sg-c5-bg: #efe3fb;  --sg-c5-ink: #5b2d8c;  --sg-c5-line: #a77bdb;
  --sg-c6-bg: #fde8d7;  --sg-c6-ink: #84400f;  --sg-c6-line: #e8975a;
}

/* ---------- 2. Themes ---------- */
/* Lavender Calm (also the fallback when nothing is set) */
:root,
[data-sg-theme="lavender"] {
  color-scheme: light;
  --sg-bg: #f6f3fb;
  --sg-bg-a: #efe8fa;            /* gradient stop 1 */
  --sg-bg-b: #f8f1f6;            /* gradient stop 2 */
  --sg-surface: rgba(255, 255, 255, 0.82);
  --sg-surface-solid: #ffffff;
  --sg-surface-2: #f1ecf9;       /* inset areas, hover rows */
  --sg-border: rgba(120, 96, 170, 0.16);
  --sg-ink: #241d33;
  --sg-ink-2: #5a5070;           /* secondary text */
  --sg-accent: #6a4fb8;          /* main button, active tab, focus */
  --sg-accent-ink: #ffffff;
  --sg-accent-soft: #e9e1f8;
  --sg-shadow: 0 8px 16px rgba(76, 52, 130, 0.08);
  --sg-shadow-lift: 0 16px 32px rgba(76, 52, 130, 0.14);
  --sg-glass: rgba(250, 248, 255, 0.72);
  --sg-urgent: #b4233c;  --sg-urgent-bg: #fbe3e7;
  --sg-warn: #8a4a12;    --sg-warn-bg: #fde9d6;   /* peach = highlights, warnings */
  --sg-ok: #2c6b3a;      --sg-ok-bg: #e0f2e3;
}

[data-sg-theme="blush"] {
  color-scheme: light;
  --sg-bg: #fbf3f4;
  --sg-bg-a: #fbe6ea;
  --sg-bg-b: #fdf0e6;
  --sg-surface: rgba(255, 255, 255, 0.82);
  --sg-surface-solid: #ffffff;
  --sg-surface-2: #fbecef;
  --sg-border: rgba(170, 90, 110, 0.16);
  --sg-ink: #33202a;
  --sg-ink-2: #6e4f5b;
  --sg-accent: #a63a58;
  --sg-accent-ink: #ffffff;
  --sg-accent-soft: #f9dfe6;
  --sg-shadow: 0 8px 16px rgba(140, 60, 85, 0.08);
  --sg-shadow-lift: 0 16px 32px rgba(140, 60, 85, 0.14);
  --sg-glass: rgba(255, 248, 248, 0.72);
  --sg-urgent: #a8213a;  --sg-urgent-bg: #fbe1e5;
  --sg-warn: #8a4a12;    --sg-warn-bg: #fde9d6;
  --sg-ok: #2c6b3a;      --sg-ok-bg: #e0f2e3;
}

[data-sg-theme="mint"] {
  color-scheme: light;
  --sg-bg: #f1f8f6;
  --sg-bg-a: #e2f4ee;
  --sg-bg-b: #e6f1fb;
  --sg-surface: rgba(255, 255, 255, 0.82);
  --sg-surface-solid: #ffffff;
  --sg-surface-2: #e8f4f0;
  --sg-border: rgba(50, 120, 110, 0.16);
  --sg-ink: #172a27;
  --sg-ink-2: #4a615c;
  --sg-accent: #1a6f60;
  --sg-accent-ink: #ffffff;
  --sg-accent-soft: #d8f0e9;
  --sg-shadow: 0 8px 16px rgba(30, 100, 90, 0.08);
  --sg-shadow-lift: 0 16px 32px rgba(30, 100, 90, 0.14);
  --sg-glass: rgba(246, 252, 250, 0.72);
  --sg-urgent: #a8213a;  --sg-urgent-bg: #fbe1e5;
  --sg-warn: #8a4a12;    --sg-warn-bg: #fde9d6;
  --sg-ok: #2c6b3a;      --sg-ok-bg: #dcf1e2;
}

[data-sg-theme="night"] {
  color-scheme: dark;
  --sg-bg: #16131f;
  --sg-bg-a: #1b1628;
  --sg-bg-b: #15182a;
  --sg-surface: rgba(36, 31, 50, 0.92);
  --sg-surface-solid: #241f32;
  --sg-surface-2: #2c263c;
  --sg-border: rgba(200, 185, 240, 0.14);
  --sg-ink: #efeaf8;
  --sg-ink-2: #b8afcc;
  --sg-accent: #b9a3f0;
  --sg-accent-ink: #1c1530;
  --sg-accent-soft: #352c4d;
  --sg-shadow: 0 8px 16px rgba(0, 0, 0, 0.28);
  --sg-shadow-lift: 0 16px 32px rgba(0, 0, 0, 0.36);
  --sg-glass: rgba(30, 26, 42, 0.78);
  --sg-urgent: #ff9aa9;  --sg-urgent-bg: #47212b;
  --sg-warn: #f7c08a;    --sg-warn-bg: #43301f;
  --sg-ok: #96dca4;      --sg-ok-bg: #1f3a27;
  /* section colours dim for night */
  --sg-personal-bg: #173a37;  --sg-personal-ink: #9fe3d9;
  --sg-work-bg:     #1b2c48;  --sg-work-ink:     #a9c6f5;
  --sg-business-bg: #46202f;  --sg-business-ink: #f5b3c8;
  --sg-growth-bg:   #1e3a1c;  --sg-growth-ink:   #b1e3a9;
  --sg-c5-bg: #33244a;  --sg-c5-ink: #d4bdf4;
  --sg-c6-bg: #43301f;  --sg-c6-ink: #f7c08a;
}

/* ---------- 3. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  font-family: var(--sg-font);
  font-size: 100%;
  line-height: var(--sg-lh-body);
  color: var(--sg-ink);
  background: var(--sg-bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-size: var(--sg-t-body);
  color: var(--sg-ink);
  /* one static, very soft gradient: CSS only, no images, no animation */
  background: var(--sg-bg) linear-gradient(160deg, var(--sg-bg-a) 0%, var(--sg-bg) 45%, var(--sg-bg-b) 100%);
  font-variant-numeric: tabular-nums;
}

h1, h2, h3, h4 { line-height: var(--sg-lh-head); margin: 0 0 var(--sg-s1); font-weight: 650; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: var(--sg-t-h2); }   /* phone first: H1 is 31px */
h2 { font-size: var(--sg-t-h3); }
h3 { font-size: var(--sg-t-sub); }
h4 { font-size: var(--sg-t-body); }
@media (min-width: 900px) {
  h1 { font-size: var(--sg-t-h1); }
  h2 { font-size: var(--sg-t-h2); }
  h3 { font-size: var(--sg-t-h3); }
}
p { margin: 0 0 var(--sg-s2); max-width: var(--sg-measure); }
a { color: var(--sg-accent); text-underline-offset: 3px; }
::selection { background: var(--sg-accent-soft); color: var(--sg-ink); }
:focus-visible { outline: 2px solid var(--sg-accent); outline-offset: 2px; border-radius: 6px; }

.sg-arabic, [lang="ar"], [lang="ur"] {
  font-family: var(--sg-font-arabic);
  font-size: 1.25em;
  line-height: var(--sg-lh-arabic);
}

.sg-muted { color: var(--sg-ink-2); }
.sg-small { font-size: var(--sg-t-small); color: var(--sg-ink-2); }
.sg-wrap { max-width: 1120px; margin: 0 auto; padding: 0 var(--sg-s2); }
@media (min-width: 900px) { .sg-wrap { padding: 0 var(--sg-s4); } }
.sg-stack > * + * { margin-top: var(--sg-s2); }
.sg-row { display: flex; gap: var(--sg-s1); align-items: center; flex-wrap: wrap; }

/* ---------- 4. Glass layers (the ONLY places with real blur) ---------- */
.sg-topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--sg-s2);
  min-height: 56px; padding: var(--sg-s1) var(--sg-s2);
  background: var(--sg-surface-solid);
  border-bottom: 1px solid var(--sg-border);
}
.sg-sheet {
  background: var(--sg-surface-solid);
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-r-sheet);
  box-shadow: var(--sg-shadow-lift);
  padding: var(--sg-s3);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .sg-topbar, .sg-sheet {
    background: var(--sg-glass);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    backdrop-filter: blur(14px) saturate(140%);
  }
}
/* solid fallback when the phone asks for less transparency */
@media (prefers-reduced-transparency: reduce) {
  .sg-topbar, .sg-sheet { background: var(--sg-surface-solid) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
}
/* weak phones / data saver: a tool can add class sg-lite to <html> */
.sg-lite .sg-topbar, .sg-lite .sg-sheet { background: var(--sg-surface-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }

/* ---------- 5. Cards ---------- */
.sg-card {
  position: relative;
  background: var(--sg-surface);
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-r-card);
  box-shadow: var(--sg-shadow);
  padding: var(--sg-s2);
}
@media (min-width: 900px) { .sg-card { padding: var(--sg-s3); } }
.sg-card--flat { box-shadow: none; }
.sg-card--inset { background: var(--sg-surface-2); box-shadow: none; }
/* thin colour strip for a section: add data-sg-area="personal|work|business|growth|c5|c6" */
.sg-card[data-sg-area]::before {
  content: ""; position: absolute; left: 16px; right: 16px; top: 0; height: 3px;
  border-radius: 0 0 3px 3px; background: var(--sg-area-line, var(--sg-accent));
}

/* ---------- 6. Section colours (life areas / app tabs) ---------- */
[data-sg-area="personal"] { --sg-area-bg: var(--sg-personal-bg); --sg-area-ink: var(--sg-personal-ink); --sg-area-line: var(--sg-personal-line); }
[data-sg-area="work"]     { --sg-area-bg: var(--sg-work-bg);     --sg-area-ink: var(--sg-work-ink);     --sg-area-line: var(--sg-work-line); }
[data-sg-area="business"] { --sg-area-bg: var(--sg-business-bg); --sg-area-ink: var(--sg-business-ink); --sg-area-line: var(--sg-business-line); }
[data-sg-area="growth"]   { --sg-area-bg: var(--sg-growth-bg);   --sg-area-ink: var(--sg-growth-ink);   --sg-area-line: var(--sg-growth-line); }
[data-sg-area="c5"]       { --sg-area-bg: var(--sg-c5-bg);       --sg-area-ink: var(--sg-c5-ink);       --sg-area-line: var(--sg-c5-line); }
[data-sg-area="c6"]       { --sg-area-bg: var(--sg-c6-bg);       --sg-area-ink: var(--sg-c6-ink);       --sg-area-line: var(--sg-c6-line); }

/* pill: icon + name, always both */
.sg-pill {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; padding: var(--sg-s-half) 12px;
  border-radius: var(--sg-r-chip);
  background: var(--sg-area-bg, var(--sg-surface-2));
  color: var(--sg-area-ink, var(--sg-ink));
  font-size: var(--sg-t-small); font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
}
/* icon chip: small rounded square holding a line icon */
.sg-chip-icon {
  display: inline-grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: var(--sg-r-icon);
  background: var(--sg-area-bg, var(--sg-accent-soft));
  color: var(--sg-area-ink, var(--sg-accent));
}

/* tabs: a row of section pills; the active one gets a ring, not a new colour */
.sg-tabs { display: flex; gap: var(--sg-s1); overflow-x: auto; padding: var(--sg-s-half) 0; scrollbar-width: none; }
.sg-tabs::-webkit-scrollbar { display: none; }
.sg-tab {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: var(--sg-tap); padding: 0 var(--sg-s2);
  border-radius: var(--sg-r-chip);
  background: var(--sg-area-bg, var(--sg-surface));
  color: var(--sg-area-ink, var(--sg-ink-2));
  border: 1px solid var(--sg-border);
  font: inherit; font-size: 0.9375rem; font-weight: 600; cursor: pointer;
  transition: box-shadow var(--sg-fade), border-color var(--sg-fade);
}
.sg-tab[aria-selected="true"], .sg-tab.is-active {
  border-color: var(--sg-area-line, var(--sg-accent));
  box-shadow: 0 0 0 2px var(--sg-area-line, var(--sg-accent)) inset;
  color: var(--sg-area-ink, var(--sg-ink));
}

/* ---------- 7. Buttons and inputs ---------- */
.sg-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sg-s1);
  min-height: var(--sg-tap); padding: 0 20px;
  border-radius: var(--sg-r-button); border: 1px solid var(--sg-border);
  background: var(--sg-surface-solid); color: var(--sg-ink);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background var(--sg-fade), box-shadow var(--sg-fade);
}
.sg-btn:hover { background: var(--sg-surface-2); }
.sg-btn--primary { background: var(--sg-accent); color: var(--sg-accent-ink); border-color: transparent; }
.sg-btn--primary:hover { background: var(--sg-accent); box-shadow: var(--sg-shadow); filter: brightness(1.05); }
.sg-btn--quiet { background: transparent; border-color: transparent; color: var(--sg-ink-2); }
.sg-btn--icon { width: var(--sg-tap); padding: 0; }
.sg-btn:disabled, .sg-btn[aria-busy="true"] { opacity: 0.55; cursor: not-allowed; }

.sg-input, .sg-select, .sg-textarea {
  width: 100%; min-height: var(--sg-tap); padding: 10px 14px;
  border-radius: var(--sg-r-input); border: 1px solid var(--sg-border);
  background: var(--sg-surface-solid); color: var(--sg-ink); font: inherit;
}
.sg-input::placeholder, .sg-textarea::placeholder { color: var(--sg-ink-2); }

/* ---------- 8. Status: level badges and banners ---------- */
.sg-level {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: var(--sg-r-chip);
  font-size: var(--sg-t-small); font-weight: 650;
}
.sg-level--urgent { background: var(--sg-urgent-bg); color: var(--sg-urgent); }
.sg-level--normal { background: var(--sg-accent-soft); color: var(--sg-accent); }
[data-sg-theme="night"] .sg-level--normal { color: var(--sg-ink); }
.sg-level--fyi    { background: var(--sg-surface-2); color: var(--sg-ink-2); }
.sg-level--ok     { background: var(--sg-ok-bg); color: var(--sg-ok); }
.sg-level--warn   { background: var(--sg-warn-bg); color: var(--sg-warn); }

/* outage / status banner (standards 5c) */
.sg-banner {
  display: flex; gap: var(--sg-s1); align-items: center;
  padding: var(--sg-s1) var(--sg-s2);
  background: var(--sg-warn-bg); color: var(--sg-warn);
  font-size: 0.9375rem; font-weight: 600;
}
.sg-banner--urgent { background: var(--sg-urgent-bg); color: var(--sg-urgent); }

/* bell with count */
.sg-bell { position: relative; }
.sg-bell__count {
  position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--sg-urgent); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
[data-sg-theme="night"] .sg-bell__count { color: #2a1016; }

/* ---------- 9. Dashboard bits (light: no chart library) ---------- */
.sg-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sg-s1); }
@media (min-width: 700px) { .sg-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sg-s2); } }
.sg-tile {
  display: flex; flex-direction: column; gap: 2px;
  padding: var(--sg-s2); border-radius: var(--sg-r-card);
  background: var(--sg-surface); border: 1px solid var(--sg-border);
  color: inherit; text-decoration: none;
}
.sg-tile__num { font-size: var(--sg-t-h3); font-weight: 700; line-height: 1.1; }
.sg-tile__label { font-size: 0.9375rem; color: var(--sg-ink-2); }
.sg-tile--alert .sg-tile__num { color: var(--sg-urgent); }

.sg-bar { height: 8px; border-radius: 4px; background: var(--sg-surface-2); overflow: hidden; }
.sg-bar > span { display: block; height: 100%; border-radius: 4px; background: var(--sg-accent); }

/* list rows inside a card */
.sg-list { list-style: none; margin: 0; padding: 0; }
.sg-list > li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--sg-border); }
.sg-list > li:first-child { border-top: 0; padding-top: 0; }

/* group headings: "Needs you / This week / All good" */
.sg-group-title { font-size: var(--sg-t-sub); font-weight: 650; margin: var(--sg-s4) 0 var(--sg-s2); }

/* ---------- 10. Motion and print ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
@media print {
  body { background: #fff; }
  .sg-topbar, .sg-sheet { position: static; background: #fff; backdrop-filter: none; box-shadow: none; }
}

/* ==========================================================================
   THEME LOADER — paste into <head>, after setting data-sg-default on <html>.
   Replace "lifeos" with the tool's key (lifeos / studiodesk / seodesk).

   <script>
   (function(){var h=document.documentElement,k='sg-theme-lifeos',t;
   try{t=localStorage.getItem(k)}catch(e){}
   t=t||h.getAttribute('data-sg-default')||'lavender';
   function a(){var d=t==='auto'?(matchMedia('(prefers-color-scheme: dark)').matches?'night':h.getAttribute('data-sg-default')):t;h.setAttribute('data-sg-theme',d)}
   a();matchMedia('(prefers-color-scheme: dark)').addEventListener('change',function(){if(t==='auto')a()});
   window.sgSetTheme=function(n){t=n;try{localStorage.setItem(k,n)}catch(e){}a()};})();
   </script>
   ========================================================================== */
