    /* ---- Colour themes (chosen from the Home screen, saved on the device) ---- */
:root,
    html[data-theme="emerald"] {
  --e-50: 236 253 245;
  --e-100: 209 250 229;
  --e-200: 167 243 208;
  --e-300: 110 231 183;
  --e-400: 52 211 153;
  --e-500: 16 185 129;
  --e-600: 5 150 105;
  --e-700: 4 120 87;
  --e-800: 6 95 70;
  --e-900: 6 78 59;
  --e-950: 2 44 34;
  --t-50: 240 253 250;
  --t-100: 204 251 241;
  --t-200: 153 246 228;
  --t-300: 94 234 212;
  --t-400: 45 212 191;
  --t-500: 20 184 166;
  --t-600: 13 148 136;
  --t-700: 15 118 110;
  --t-800: 17 94 89;
  --t-900: 19 78 74;
  --t-950: 4 47 46;
  --bg-1: 232 238 240;
  --bg-2: 246 248 247;
}
html[data-theme="maroon"] {
  --e-50: 252 242 244;
  --e-100: 249 224 229;
  --e-200: 240 190 200;
  --e-300: 224 140 158;
  --e-400: 200 90 115;
  --e-500: 168 52 80;
  --e-600: 138 34 62;
  --e-700: 112 26 52;
  --e-800: 90 22 44;
  --e-900: 70 17 35;
  --e-950: 40 8 20;
  --t-50: 255 251 235;
  --t-100: 254 243 199;
  --t-200: 253 230 138;
  --t-300: 252 211 77;
  --t-400: 251 191 36;
  --t-500: 245 158 11;
  --t-600: 217 119 6;
  --t-700: 180 83 9;
  --t-800: 146 64 14;
  --t-900: 120 53 15;
  --t-950: 69 26 3;
  --bg-1: 244 232 235;
  --bg-2: 251 246 247;
}
html[data-theme="gold"] {
  --e-50: 255 251 235;
  --e-100: 254 243 199;
  --e-200: 253 230 138;
  --e-300: 252 211 77;
  --e-400: 251 191 36;
  --e-500: 245 158 11;
  --e-600: 217 119 6;
  --e-700: 180 83 9;
  --e-800: 146 64 14;
  --e-900: 120 53 15;
  --e-950: 69 26 3;
  --t-50: 250 250 249;
  --t-100: 245 245 244;
  --t-200: 231 229 228;
  --t-300: 214 211 209;
  --t-400: 168 162 158;
  --t-500: 120 113 108;
  --t-600: 87 83 78;
  --t-700: 68 64 60;
  --t-800: 41 37 36;
  --t-900: 28 25 23;
  --t-950: 12 10 9;
  --bg-1: 243 237 224;
  --bg-2: 251 248 240;
}
html[data-theme="graphite"] {
  --e-50: 248 250 252;
  --e-100: 241 245 249;
  --e-200: 226 232 240;
  --e-300: 203 213 225;
  --e-400: 148 163 184;
  --e-500: 100 116 139;
  --e-600: 71 85 105;
  --e-700: 51 65 85;
  --e-800: 30 41 59;
  --e-900: 15 23 42;
  --e-950: 2 6 23;
  --t-50: 240 249 255;
  --t-100: 224 242 254;
  --t-200: 186 230 253;
  --t-300: 125 211 252;
  --t-400: 56 189 248;
  --t-500: 14 165 233;
  --t-600: 2 132 199;
  --t-700: 3 105 161;
  --t-800: 7 89 133;
  --t-900: 12 74 110;
  --t-950: 8 47 73;
  --bg-1: 230 234 240;
  --bg-2: 246 248 250;
}
html[data-theme="amethyst"] {
  --e-50: 247 245 251;
  --e-100: 238 234 247;
  --e-200: 224 217 240;
  --e-300: 200 188 226;
  --e-400: 168 152 204;
  --e-500: 136 118 178;
  --e-600: 112 94 158;
  --e-700: 92 77 133;
  --e-800: 74 62 108;
  --e-900: 58 49 86;
  --e-950: 36 30 56;
  --t-50: 253 244 255;
  --t-100: 250 232 255;
  --t-200: 245 208 254;
  --t-300: 240 171 252;
  --t-400: 232 121 249;
  --t-500: 217 70 239;
  --t-600: 192 38 211;
  --t-700: 162 28 175;
  --t-800: 134 25 143;
  --t-900: 112 26 117;
  --t-950: 74 4 78;
  --bg-1: 238 234 248;
  --bg-2: 249 247 253;
}
    html { transition: background-color .25s ease; }

    :root {
      --emerald-950: rgb(var(--e-950));
      --emerald-900: rgb(var(--e-900));
      --emerald-800: rgb(var(--e-800));
      --emerald-700: rgb(var(--e-700));
      --teal-800: rgb(var(--t-800));
      --gold: #D97706;
      --ink: #0F172A;
      --hairline: rgba(15, 23, 42, 0.07);
      --ease: cubic-bezier(0.22, 0.8, 0.24, 1);
      --shadow-1: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 1px 2px rgba(15, 23, 42, 0.05), 0 10px 28px -12px rgb(var(--e-900)/0.20);
      --shadow-2: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 2px 4px rgba(15, 23, 42, 0.05), 0 26px 52px -22px rgb(var(--e-900)/0.34);
    }

    html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background-color: rgb(var(--bg-1)); }

    body {
      font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      text-rendering: optimizeLegibility;
      letter-spacing: -0.006em;
      min-height: 100vh;
      min-height: 100dvh;
      background:
        radial-gradient(1100px 520px at 8% -8%, rgb(var(--e-500)/0.10), transparent 62%),
        radial-gradient(900px 480px at 100% 0%, rgba(13, 148, 136, 0.08), transparent 58%),
        linear-gradient(180deg, rgb(var(--bg-2)) 0%, rgb(var(--bg-1)) 100%);
      background-attachment: fixed;
    }

    h1, h2, h3 { letter-spacing: -0.02em; }
    ::selection { background: rgb(var(--e-500)/0.25); }

    /* Lighter, more refined weights (templates use font-black / font-extrabold heavily) */
    body .font-black { font-weight: 800; }
    body .font-extrabold { font-weight: 700; }
    body .uppercase:not([class*="tracking-"]) { letter-spacing: 0.08em; }

    /* Soft layered shadows instead of heavy drop shadows */
    body .shadow-xl, body .shadow-2xl { box-shadow: var(--shadow-1) !important; }

    /* Slightly softer corners than the previous 2.5rem / 2rem custom radii */
    body [class*="rounded-[2.5rem]"] { border-radius: 26px !important; }
    body [class*="rounded-[2rem]"] { border-radius: 24px !important; }

    /* True continuous (Apple-style) corners where the browser supports them */
    @supports (corner-shape: squircle) {
      .glass-card, .rounded-3xl, [class*="rounded-[2"] { corner-shape: squircle; }
    }

    /* Arabic names: Kanz-al-Marjaan everywhere */
    @font-face { font-family: 'Kanz-al-Marjaan'; src: url("/static/fonts/Kanz-al-Marjaan.ttf") format('truetype'); font-weight: normal; font-style: normal; font-display: swap; }
    .arabic-name { font-family: 'Kanz-al-Marjaan', serif !important; font-weight: normal !important; font-size: 21px; line-height: 1.35; color: rgb(var(--e-800)); direction: rtl; unicode-bidi: plaintext; }
    /* Theme sweep (View Transitions): old UI stays put, new UI is revealed by the expanding circle */
    ::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
    ::view-transition-old(root) { z-index: 1; }
    ::view-transition-new(root) { z-index: 2; }
    /* Sleek motion: smooth theme cross-fade + reduced-motion respect */
    html.theme-fade *, html.theme-fade *::before, html.theme-fade *::after {
      transition: background-color .4s ease, color .4s ease, border-color .4s ease, fill .4s ease, stroke .4s ease, box-shadow .4s ease !important;
    }
    @keyframes riseIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; }
    }
    .glass-card {
      background: linear-gradient(180deg, rgba(255, 255, 255, 0.90), rgba(255, 255, 255, 0.76));
      backdrop-filter: blur(22px) saturate(160%);
      -webkit-backdrop-filter: blur(22px) saturate(160%);
      border: 1px solid var(--hairline);
      box-shadow: var(--shadow-1);
    }

    .glass-nav {
      padding-top: env(safe-area-inset-top, 0px);
      background: rgba(255, 255, 255, 0.72);
      backdrop-filter: saturate(180%) blur(20px);
      -webkit-backdrop-filter: saturate(180%) blur(20px);
      border-bottom: 1px solid var(--hairline);
    }

    .today-highlight-card {
      border: 2px solid rgb(var(--e-600)) !important;
      box-shadow: 0 10px 15px -3px rgb(var(--e-600)/0.15) !important;
    }

    /* Wordmark: wide-tracked uppercase, quiet and confident */
    .brand-title { font-size: 11.5px; font-weight: 800; letter-spacing: 0.17em; color: var(--ink); }
    .brand-sub { font-size: 8.5px; font-weight: 700; letter-spacing: 0.32em; color: var(--emerald-700); }

    .icon-btn {
      position: relative;
      width: 40px; height: 40px;
      display: inline-flex; align-items: center; justify-content: center;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.78);
      border: 1px solid var(--hairline);
      color: #334155;
      box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
      transition: transform 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
      cursor: pointer;
    }
    .icon-btn:hover { background: #fff; box-shadow: 0 6px 16px -8px rgb(var(--e-900)/0.4); }
    .icon-btn:active { transform: scale(0.94); }
    .icon-btn.accent { color: var(--emerald-800); background: rgb(var(--e-50)); border-color: rgb(var(--e-200)); }


    .lang-pill { padding:5px 11px; border-radius:999px; font-size:12px; font-weight:800; color:#475569; background:#fff; border:1.5px solid #cbd5e1; cursor:pointer; -webkit-tap-highlight-color:transparent; }
    .lang-pill.lang-on { background:rgb(var(--e-700)); border-color:rgb(var(--e-700)); color:#fff; }
    .look-pop { position:absolute; top:calc(100% + 10px); right:-52px; width:min(92vw,320px); background:#fff; border:1px solid rgb(var(--e-200)); border-radius:20px; padding:14px 14px 16px; z-index:60; box-shadow:0 18px 40px -16px rgba(15,23,42,.35); }
    .look-pop.hidden { display:none; }
    .look-h { font-size:12px; font-weight:800; color:#0f172a; margin:0 0 8px; display:flex; justify-content:space-between; align-items:baseline; }
    .look-h:not(:first-child) { margin-top:14px; }
    .look-cur { font-size:11px; font-weight:700; color:rgb(var(--e-700)); }
    .look-row { display:flex; gap:6px; flex-wrap:wrap; }
    .look-dot-btn { display:flex; flex-direction:column; align-items:center; gap:4px; width:52px; background:none; border:0; padding:2px 0; cursor:pointer; -webkit-tap-highlight-color:transparent; }
    .look-dot-btn .theme-dot { width:34px; height:34px; margin:0; }
    .look-dot-btn.theme-on .theme-dot { box-shadow:0 0 0 2.5px rgb(var(--e-700)); }
    .look-dot-btn.theme-on .theme-dot::after { content:'✓'; position:absolute; inset:0; display:flex; align-items:center; justify-content:center; color:#fff; font-weight:900; font-size:15px; }
    .look-nm { font-size:10px; font-weight:700; color:#475569; }
    @media (max-width:390px) { .brand-title { letter-spacing:0.1em; font-size:11px; } .brand-sub { letter-spacing:0.18em; } }
    .bn-card { position:relative; border-radius:22px; padding:16px 44px 16px 16px; color:#fff; overflow:hidden;
               background:linear-gradient(135deg, rgb(var(--e-800)), rgb(var(--e-950))); display:flex; gap:12px; align-items:flex-start; }
    .bn-card::after { content:''; position:absolute; right:-30px; top:-30px; width:120px; height:120px; border-radius:999px; background:rgb(var(--t-500)); opacity:.28; }
    .bn-ic { width:40px; height:40px; border-radius:14px; background:rgba(255,255,255,.16); display:flex; align-items:center; justify-content:center; font-size:20px; flex:none; position:relative; z-index:1; }
    .bn-t { font-size:15px; font-weight:800; line-height:1.25; position:relative; z-index:1; }
    .bn-b { font-size:12.5px; font-weight:500; opacity:.92; margin-top:4px; line-height:1.45; white-space:pre-line; position:relative; z-index:1; }
    .bn-x { position:absolute; top:8px; right:8px; width:30px; height:30px; border-radius:999px; background:rgba(255,255,255,.18); color:#fff; border:0; font-size:16px; line-height:1; cursor:pointer; z-index:2; }
    .theme-opt { width:30px; height:30px; padding:0; background:none; border:0; cursor:pointer; -webkit-tap-highlight-color:transparent; flex:none; }
    .theme-dot { display:block; width:26px; height:26px; margin:2px; border-radius:999px; border:2px solid #fff; box-shadow:0 0 0 1px #cbd5e1; transition: transform .15s; position:relative; }
    .theme-opt:active .theme-dot { transform:scale(.88); }
    .theme-opt.theme-on .theme-dot { box-shadow:0 0 0 2px rgb(var(--e-700)); }
    .theme-opt.theme-on .theme-dot::after { content:'✓'; position:absolute; inset:0; display:flex; align-items:center; justify-content:center; color:#fff; font-weight:900; font-size:12px; }

    /* ---- New navigation menu ---- */
    body.menu-open .dock, body.menu-open .dock-scrim { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(20px); transition: opacity .15s, transform .15s; }
    body.menu-open .dock-scrim { transform: none; }
    body.menu-open .menu-scrim { touch-action: none; }
    #nav-bar { position:fixed; top:env(safe-area-inset-top,0px); left:0; height:3px; width:0; background:rgb(var(--e-600)); z-index:100000; pointer-events:none; box-shadow:0 0 8px rgb(var(--e-500)/.6); }
    .nm-loading { opacity:.65; pointer-events:none; }
    .nm-loading .nm-go svg { display:none; }
    .nm-loading .nm-go::after { content:''; display:block; width:15px; height:15px; border:2px solid rgb(var(--e-700)); border-right-color:transparent; border-radius:50%; animation:nmspin .7s linear infinite; }
    [data-ui="type01"] #nav-bar { height:2px; box-shadow:none; background:rgb(var(--e-700)); }
    @keyframes nmspin { to { transform:rotate(360deg); } }
    .menu-scrim { position: fixed; inset: 0; z-index: 45; background: rgba(15,23,42,.28); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
    .menu-scrim.hidden { display: none; }
    body.menu-open header.glass-nav { z-index: 60; }
    .nm-panel {
      width: min(19rem, calc(100vw - 24px)); max-height: calc(100dvh - 110px - env(safe-area-inset-top, 0px)); overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
      background: #ffffff; border: 1px solid var(--hairline); border-radius: 26px; padding: 10px;
      box-shadow: 0 30px 70px -20px rgba(15, 23, 42, .35), 0 10px 24px -12px rgba(15, 23, 42, .18);
      animation: popIn .2s var(--ease) both; transform-origin: top right;
    }
    .nm-head { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 20px; background: linear-gradient(135deg, rgb(var(--e-50)), rgb(var(--t-50))); border: 1px solid rgb(var(--e-100)); }
    .nm-avatar { width: 46px; height: 46px; border-radius: 999px; object-fit: cover; border: 2px solid #fff; box-shadow: 0 2px 8px rgb(var(--e-900)/.2); flex-shrink: 0; background: rgb(var(--e-100)); }
    .nm-name { display: block; font-size: 14px; font-weight: 800; color: #0f172a; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .nm-meta { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: #64748b; margin-top: 3px; }
    .nm-role { font-size: 10px; font-weight: 800; color: rgb(var(--e-800)); background: #fff; border: 1px solid rgb(var(--e-200)); padding: 1px 8px; border-radius: 999px; }
    .nm-label { margin: 14px 10px 6px; font-size: 10px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: #94a3b8; }
    .nm-group { display: flex; flex-direction: column; }
    .nm-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 16px; width: 100%; text-align: left; transition: background .15s var(--ease), transform .15s; cursor: pointer; }
    .nm-row:hover { background: #F1F5F9; } .nm-row:active { transform: scale(.985); }
    .nm-ic { width: 36px; height: 36px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
    .nm-t { flex: 1; min-width: 0; font-size: 13px; font-weight: 700; color: #0f172a; line-height: 1.2; }
    .nm-t small { display: block; font-size: 11px; font-weight: 500; color: #94a3b8; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .nm-go { color: #cbd5e1; display: flex; } .nm-go svg { width: 14px; height: 14px; }
    .nm-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #f43f5e; color: #fff; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
    .nm-logout { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 12px; padding: 12px; border-radius: 16px; font-size: 13px; font-weight: 800; color: #e11d48; background: #FFF1F2; border: 1px solid #FECDD3; transition: background .15s, transform .15s; }
    .nm-logout:hover { background: #FFE4E6; } .nm-logout:active { transform: scale(.98); }

    .menu-panel {
      background: rgba(255, 255, 255, 0.94);
      backdrop-filter: blur(24px) saturate(180%);
      -webkit-backdrop-filter: blur(24px) saturate(180%);
      border: 1px solid var(--hairline);
      border-radius: 20px;
      box-shadow: var(--shadow-2);
      animation: popIn 0.18s var(--ease) both;
      transform-origin: top right;
    }
    .menu-item {
      display: flex; align-items: center; gap: 0.7rem;
      padding: 0.6rem 0.75rem;
      border-radius: 12px;
      font-size: 0.75rem; font-weight: 600; color: #334155;
      transition: background 0.15s var(--ease), color 0.15s var(--ease);
      width: 100%; text-align: left; cursor: pointer;
    }
    .menu-item:hover { background: #F1F5F9; color: var(--ink); }
    .menu-item.accent { background: rgb(var(--e-50)); color: var(--emerald-900); font-weight: 700; }
    .menu-item.accent:hover { background: rgb(var(--e-100)); }
    .menu-item.danger { color: #DC2626; }
    .menu-item.danger:hover { background: #FEF2F2; }
    .menu-item .mi { width: 1.25rem; text-align: center; }

    /* Floating role-aware bottom bar */
    /* Soft fade under the floating bar so scrolled content never shows through the gap (iPhone home indicator area) */
    .dock-scrim {
      position: fixed; left: 0; right: 0; bottom: 0; z-index: 39; pointer-events: none;
      height: calc(env(safe-area-inset-bottom, 0px) + 44px);
      background: linear-gradient(to bottom, rgb(var(--bg-1)/0), rgb(var(--bg-1)/.92) 55%, rgb(var(--bg-1)));
    }
    .dock {
      position: fixed; left: 50%; z-index: 40;
      transform: translateX(-50%);
      bottom: calc(12px + env(safe-area-inset-bottom, 0px));
      width: calc(100% - 24px); max-width: 460px;
      display: flex; align-items: stretch; justify-content: space-around; gap: 2px;
      padding: 6px;
      border-radius: 28px;
      border: 1px solid var(--hairline);
      background: rgba(255, 255, 255, 0.78);
      backdrop-filter: blur(22px) saturate(180%);
      -webkit-backdrop-filter: blur(22px) saturate(180%);
      box-shadow: 0 14px 40px -14px rgb(var(--e-900)/0.38), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    }
    @supports (corner-shape: squircle) { .dock { corner-shape: squircle; border-radius: 32px; } }
    .dock-item {
      position: relative; flex: 1 1 0; min-width: 0;
      display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
      padding: 8px 4px 7px;
      border-radius: 22px;
      color: #64748B; font-size: 10px; font-weight: 600; letter-spacing: 0.01em;
      transition: background 0.25s var(--ease), color 0.25s var(--ease), transform 0.15s var(--ease);
    }
    .dock-item svg { width: 22px; height: 22px; }
    .dock-item:hover { color: var(--emerald-800); }
    .dock-item:active { transform: scale(0.94); }
    .dock-item.active { color: var(--emerald-900); background: linear-gradient(180deg, rgb(var(--e-50)), rgb(var(--e-100))); font-weight: 800; box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 4px 12px -6px rgb(var(--e-900)/.35); }
    .dock-badge {
      position: absolute; top: 3px; left: 50%; margin-left: 6px;
      min-width: 17px; height: 17px; padding: 0 4px;
      display: inline-flex; align-items: center; justify-content: center;
      background: #F43F5E; color: #fff; border-radius: 999px;
      font-size: 10px; font-weight: 800; line-height: 1;
      box-shadow: 0 0 0 2px #fff;
    }

    /* Flash messages */
    .flash {
      display: flex; justify-content: space-between; align-items: center; gap: 1rem;
      padding: 0.85rem 1rem;
      border-radius: 14px;
      font-size: 0.75rem; font-weight: 600;
      color: #fff;
      box-shadow: 0 10px 24px -12px rgba(15, 23, 42, 0.45);
      animation: popIn 0.25s var(--ease) both;
      transition: opacity 0.4s ease, transform 0.4s ease;
    }
    .flash button { opacity: 0.7; font-weight: 800; }
    .flash button:hover { opacity: 1; }
    .flash-success { background: var(--emerald-800); }
    .flash-danger { background: #DC2626; }
    .flash-warning { background: var(--gold); }
    .flash-info { background: #1E293B; }

    /* Toast */
    .toast {
      position: fixed; left: 50%; z-index: 70;
      bottom: calc(96px + env(safe-area-inset-bottom, 0px));
      transform: translate(-50%, 16px);
      opacity: 0; pointer-events: none;
      transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
      max-width: calc(100vw - 32px);
    }
    .toast.show { opacity: 1; transform: translate(-50%, 0); }
    .toast-body {
      background: rgba(15, 23, 42, 0.94); color: #fff;
      font-size: 0.75rem; font-weight: 600;
      padding: 0.7rem 1.1rem; border-radius: 999px;
      box-shadow: 0 16px 36px -14px rgba(15, 23, 42, 0.6);
      backdrop-filter: blur(10px);
    }
    .toast-body.error { background: rgba(220, 38, 38, 0.96); }

    /* Announcement cards */
    .ann-card {
      padding: 1rem; border-radius: 16px;
      background: rgba(248, 250, 252, 0.8);
      border: 1px solid #E2E8F0;
      transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
    }
    .ann-card.clickable { cursor: pointer; }
    .ann-card.clickable:hover { border-color: rgb(var(--e-400)); background: rgb(var(--e-50)/0.55); box-shadow: 0 8px 20px -12px rgb(var(--e-900)/0.4); }

    /* Animations (some were referenced by templates but never defined) */
    @keyframes float3D { 0%, 100% { transform: translateY(0) rotateX(0) rotateY(0) scale(1); } 50% { transform: translateY(-8px) rotateX(4deg) rotateY(6deg) scale(1.03); } }
    @keyframes spinAura { to { transform: rotate(360deg); } }
    @keyframes pulseText { 0%, 100% { opacity: 0.4; letter-spacing: 0.15em; } 50% { opacity: 1; letter-spacing: 0.25em; } }
    @keyframes breath { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.025); } }
    @keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(0.97); } to { opacity: 1; transform: none; } }
    @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
    @keyframes softBounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

    .animate-3d-float { animation: float3D 3s ease-in-out infinite; transform-style: preserve-3d; perspective: 1000px; }
    .animate-spin-aura { animation: spinAura 6s linear infinite; }
    .animate-rotate-aura { animation: spinAura 9s linear infinite; }
    .animate-subtle-breath { animation: breath 5s ease-in-out infinite; }
    .animate-pulse-text { animation: pulseText 2s ease-in-out infinite; }
    .animate-in { animation: popIn 0.22s var(--ease) both; }
    .animate-bounce { animation: softBounce 2.6s ease-in-out infinite; }

    /* Fade only (a transform here would break the fixed bottom dock inside <main>) */
    main { animation: fadeIn 0.35s ease both; }

    /* Slim scrollbars */
    ::-webkit-scrollbar { width: 8px; height: 8px; }
    ::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, 0.18); border-radius: 999px; }
    ::-webkit-scrollbar-thumb:hover { background: rgba(15, 23, 42, 0.3); }

    :focus-visible { outline: 2px solid rgb(var(--e-500)/0.75); outline-offset: 2px; }

    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
    }

/* Text size option: zoom the page content only. Header, bottom dock and popups are left alone so nothing shifts. */
html[data-textsize="large"]  { --zm: 1.12; }
html[data-textsize="xlarge"] { --zm: 1.25; }
html[data-textsize] main { zoom: var(--zm); }
/* Pop-ups and sheets that live inside the page keep their normal size and position */
html[data-textsize] main :is(.fixed, .bd-back, .tk-sheet-back) { zoom: calc(1 / var(--zm)); }

/* Press feedback + undo toast */
button:active:not(:disabled), [role="button"]:active { transform: scale(.92); transition: transform .08s ease; }
.undo-toast { position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 16px); opacity: 0; pointer-events: none; z-index: 70; display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 16px; border-radius: 14px; background: #1f2937; color: #fff; font-size: 13px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.25); transition: opacity .2s ease, transform .2s ease; }
.undo-toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.undo-toast button { background: rgba(255,255,255,.16); color: #fff; border: 0; border-radius: 9px; padding: 6px 12px; font-weight: 800; font-size: 12px; }
@media (prefers-reduced-motion: reduce) { button:active:not(:disabled) { transform: none; } .undo-toast { transition: none; } }

/* Unread bell dot: always a clear red, in light and dark mode */
.unread-dot { position:absolute; top:5px; right:5px; width:11px; height:11px; border-radius:999px; background:#ff3b30 !important; box-shadow:0 0 0 2px #ffffff, 0 0 8px rgba(255,59,48,.7); animation:dotPulse 1.8s ease-in-out infinite; }
.unread-dot.hidden { display:none; }
html[data-mode="dark"] .unread-dot { box-shadow:0 0 0 2px #17181c, 0 0 8px rgba(255,59,48,.8); }
@keyframes dotPulse { 0%,100% { transform:scale(1); } 50% { transform:scale(1.2); } }
@media (prefers-reduced-motion: reduce) { .unread-dot { animation:none; } }

/* Readability: lift the smallest label sizes a little for older users */
.text-\[9px\] { font-size: 10.5px !important; }
.text-\[10px\] { font-size: 11.5px !important; }
.text-\[11px\] { font-size: 12.5px !important; }
