/* iOES | WEB — iOS 27 look, step 1: the home screen (owner, Nov 21: "the mobile mode looks like Android; every app on
   ioesapp.com must look like iOS 27"). Loaded last, so it wins over the older hub rules without editing them.
   Phone and iPad: no Android bar (◁ ○ ▢) — a home indicator instead (tap or swipe up: Home; hold or swipe up and pause:
   open apps); a widget with the greeting, time and date that is part of the layout (never over the icons); rounded icons
   with sentence-case names in the system font, no cards; an iOS dock with four apps; a clean background.
   Mac (desktop): the same icons and names in the tiles view; the desktop keeps its menu bar and dock.
   Colors: IOES Themes tokens only (--text, --text-muted, --surface, --surface-raised, --border, --accent…). */

:root{
  --ios-font:-apple-system,BlinkMacSystemFont,"SF Pro Text","SF Pro",system-ui,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  --ios-dock-h:84px;
  --ios-icon:60px;
  --ios-glass:color-mix(in srgb,var(--surface-raised,var(--surface)) 62%,transparent);
  --ios-glass-line:color-mix(in srgb,var(--text) 10%,transparent);
}

/* ---------- clean background: no floating bubbles and no big "E" watermark unless the person chose a background ---------- */
body.hub-on #hubWall:not(.custom) .wm{display:none}
body.hub-on:has(#hubWall:not(.custom)) #bg{opacity:0!important}

/* ---------- the header: no stencil clock, no wordmark on the home screen; the two round buttons stay, top right ---------- */
#hub > .top .brand{visibility:hidden}
#hub #clock{display:none!important}
/* Donate and Admin stay in the header row (on phones they used to float at the bottom, now the dock's place) */
#hub > .top #btnDonate,#hub > .top #btnAdmin{position:static!important;inset:auto!important;transform:none!important}
#hub > .top .ap-btn,#hub > .top #btnLogout{width:40px;height:40px;min-width:40px;padding:0;border-radius:50%;border:1px solid var(--ios-glass-line);
  background:var(--ios-glass);-webkit-backdrop-filter:saturate(1.6) blur(18px);backdrop-filter:saturate(1.6) blur(18px);color:var(--text)}

/* ---------- the widget: greeting, time and date; it takes its own place above the icons ---------- */
#hub{display:flow-root}   /* the widget's top margin stays inside the hub (it collapsed through it) */
.ios-widget{position:relative;z-index:3;margin:0 auto 18px;width:min(calc(100vw - 32px),560px);box-sizing:border-box;padding:16px 18px;border-radius:26px;
  display:flex;align-items:center;gap:16px;cursor:pointer;color:var(--text);font-family:var(--ios-font);text-align:left;border:1px solid var(--ios-glass-line);
  background:var(--ios-glass);-webkit-backdrop-filter:saturate(1.6) blur(24px);backdrop-filter:saturate(1.6) blur(24px);box-shadow:var(--shadow-sm)}
.ios-widget[hidden]{display:none}
.ios-widget:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
.ios-widget .w-time{font:600 44px/1 var(--ios-font);letter-spacing:-.02em;font-variant-numeric:tabular-nums;white-space:nowrap}
.ios-widget .w-time small{font-size:17px;font-weight:600;margin-left:4px;color:var(--text-muted)}
.ios-widget .w-text{min-width:0;display:flex;flex-direction:column;gap:3px}
.ios-widget .w-hello{font:600 17px/1.25 var(--ios-font);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ios-widget .w-date{font:400 14px/1.3 var(--ios-font);color:var(--text-muted)}

/* ---------- icons and names (every layout of the hub) ---------- */
#hub .menu > .item,#hub .menu > .hub-folder-tile{background:transparent!important;border:0!important;box-shadow:none!important;border-radius:0!important;gap:7px!important}
#hub .menu > .item:hover,#hub .menu > .item:focus-visible{box-shadow:none!important}
#hub .menu .round.ioes-tile{border-radius:22.5%!important;box-shadow:var(--shadow-md)!important}
#hub .menu .item.sel .round.ioes-tile,#hub .menu .round.ioes-tile:hover{transform:none;box-shadow:var(--shadow-md)!important}
#hub .menu .round.ioes-tile:focus-visible{box-shadow:0 0 0 3px var(--accent),var(--shadow-md)!important}
#hub .menu .round.ioes-tile:active{transform:scale(.94);transition:transform .12s ease}
#hub .menu .cap{font:500 12px/1.2 var(--ios-font)!important;letter-spacing:normal!important;text-transform:none!important;color:var(--text)!important;text-align:center}
#hub .menu .bar{display:none!important}

/* ---------- phone (the hub scrolls): four columns of 60 px icons under the widget, clear of the dock ---------- */
@media (max-width:680px){
  #hub .menu{grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:22px 6px!important;width:min(calc(100vw - 32px),380px)!important;
    padding-bottom:calc(var(--ios-dock-h) + var(--os-nav,22px) + env(safe-area-inset-bottom,0px) + 36px)!important}
  #hub .menu .round{width:var(--ios-icon)!important;height:var(--ios-icon)!important}
  #hub .menu .cap{font-size:11.5px!important;max-width:76px}
  #hub > .top{padding-top:max(12px,env(safe-area-inset-top))}
  .ios-widget{padding:14px 16px}
  .ios-widget .w-time{font-size:40px}
}

/* ---------- Donate (same button, same link) as an iOS glass pill in sentence case ---------- */
#hub > .top #btnDonate{height:40px;padding:0 14px;border-radius:20px;border:1px solid var(--ios-glass-line);background:var(--ios-glass);
  -webkit-backdrop-filter:saturate(1.6) blur(18px);backdrop-filter:saturate(1.6) blur(18px);color:var(--text);font:600 14px/1 var(--ios-font)!important;letter-spacing:normal!important;text-transform:none!important}
#hub > .top #btnDonate svg{color:var(--danger,var(--accent))}

/* ---------- folders (Calculators, PDF, +Fit and the person's own folders): an iOS folder ---------- */
.calc-folder{border-radius:36px!important;padding:18px 20px 22px!important;border:1px solid var(--ios-glass-line)!important;background:var(--ios-glass)!important;
  -webkit-backdrop-filter:saturate(1.8) blur(30px);backdrop-filter:saturate(1.8) blur(30px);box-shadow:var(--shadow-lg)!important;width:min(360px,88vw)!important}
.calc-folder .cf-head{font:600 22px/1.2 var(--ios-font)!important;letter-spacing:normal!important;text-transform:none!important;color:var(--text)!important;margin-bottom:14px}
.calc-folder .cf-head > span,.calc-folder .cf-head > :first-child{display:inline-block}
.calc-folder .cf-head .x,.calc-folder .cf-head button{width:30px;height:30px;border-radius:50%;border:0!important;background:color-mix(in srgb,var(--text) 10%,transparent)!important;color:var(--text-muted);font:400 18px/1 var(--ios-font)}
.calc-folder .cf-grid{gap:16px 10px}
.calc-folder .cf-app{background:transparent!important;border:0!important;box-shadow:none!important;padding:0!important;gap:7px}
.calc-folder .cf-ico{width:64px!important;height:64px!important;border-radius:22.5%!important;border:0!important;box-shadow:var(--shadow-md)!important}
.calc-folder .cf-name,.calc-folder .cf-lbl{font:500 12px/1.2 var(--ios-font)!important;letter-spacing:normal!important;text-transform:none!important;color:var(--text)!important;text-align:center}

/* ---------- the dock (phone and iPad) ---------- */
.ios-dock{position:fixed;z-index:20;left:50%;transform:translateX(-50%);bottom:calc(var(--os-nav,22px) + env(safe-area-inset-bottom,0px) + 4px);
  width:min(calc(100vw - 20px),420px);height:var(--ios-dock-h);box-sizing:border-box;padding:0 14px;border-radius:32px;display:flex;align-items:center;justify-content:space-around;
  border:1px solid var(--ios-glass-line);background:var(--ios-glass);-webkit-backdrop-filter:saturate(1.8) blur(28px);backdrop-filter:saturate(1.8) blur(28px);
  box-shadow:var(--shadow-lg)}
.ios-dock[hidden],body:not(.os-mobile) .ios-dock,body:not(.hub-on) .ios-dock{display:none}
body.os-mobile:has(section[data-os="app"].open:not(.min)) .ios-dock{display:none}
.ios-dock button{width:var(--ios-icon);height:var(--ios-icon);padding:0;border:0;border-radius:22.5%;background:none;cursor:pointer;-webkit-tap-highlight-color:transparent;
  box-shadow:var(--shadow-md);overflow:hidden}
.ios-dock button svg{width:100%;height:100%;display:block}
.ios-dock button:active{transform:scale(.94)}
.ios-dock button:focus-visible{outline:3px solid var(--accent);outline-offset:2px}

/* ---------- the home indicator replaces the Android bar (◁ ○ ▢) ---------- */
body.os-mobile{--os-nav:22px}
.os-nav.ios-nav{height:calc(var(--os-nav) + env(safe-area-inset-bottom,0px));padding:0 0 env(safe-area-inset-bottom,0px);background:transparent!important;
  -webkit-backdrop-filter:none!important;backdrop-filter:none!important;border:0!important;justify-content:center;pointer-events:none}
.os-nav.ios-nav > .os-nb{display:none!important}
.ios-hi{pointer-events:auto;position:relative;width:180px;height:var(--os-nav);margin:0;padding:0;border:0;background:none;cursor:pointer;touch-action:none;-webkit-tap-highlight-color:transparent}
.ios-hi::before{content:"";position:absolute;left:50%;top:50%;width:134px;height:5px;margin:-2.5px 0 0 -67px;border-radius:3px;background:var(--text);opacity:.55;transition:opacity .15s,transform .15s}
.ios-hi:hover::before,.ios-hi:focus-visible::before{opacity:.85}
.ios-hi:focus-visible{outline:2px solid var(--accent);outline-offset:-2px;border-radius:8px}
.ios-hi.pull::before{transform:translateY(-4px)}
/* an open app fills the screen and the indicator floats over its bottom edge, as on iOS (the old bar took 60 px) */
body.os-mobile section[data-os="app"].open{height:100dvh!important}
/* a phone on its side: the bar was on the right; the indicator stays at the bottom */
@media (orientation:landscape) and (max-height:500px){
  body.os-mobile{--os-nav:18px}
  .os-nav.ios-nav{top:auto;left:0;right:0;bottom:0;width:auto;flex-direction:row;padding:0;border:0}
  body.os-mobile #hub{right:0}
  body.os-mobile section[data-os="app"].open{width:100vw!important}
}

/* ---------- iPad (the hub's pages): dots above the dock; the greeting overlay is replaced by the widget ---------- */
body.os-mobile .hub-pager{bottom:calc(var(--os-nav,22px) + var(--ios-dock-h) + env(safe-area-inset-bottom,0px) + 14px)}
#welcome{display:none!important}

@media (prefers-reduced-motion:reduce){#hub .menu .round.ioes-tile:active,.ios-dock button:active{transform:none}}

/* ---------- iOS 27 step 2: the window frame every app shares (owner: "every app on ioesapp.com must look like iOS 27") ----------
   Mac (desktop): a translucent title bar, the title in its own case and the system font, round traffic lights with no glyph
   (macOS shows nothing in them until you point at them), no drawn resize grip (the window edges still resize it).
   Phone and tablet: the title bar becomes an iOS navigation bar: translucent, a 17 pt title in the middle, and round
   44 pt buttons (close as an x; minimize, maximize and full screen are not used on a phone). */
.sheet .sh-head{letter-spacing:normal!important;font-family:var(--ios-font)!important;
  background:var(--glass-fill,var(--surface))!important;   /* Themes glass: solid when the person asks for less transparency */
  -webkit-backdrop-filter:var(--glass-blur);backdrop-filter:var(--glass-blur);
  border-bottom:1px solid var(--glass-edge,var(--border))!important}
.sheet .sh-head > span,.sheet .sh-head > span:first-child{letter-spacing:normal!important;text-transform:none!important;font:600 13px/1.2 var(--ios-font)!important}
.sheet .sh-ctl .sh-close .lo-o,.sheet .sh-ctl .sh-min .lo-o,.sheet .sh-ctl .sh-max .lo-o{display:none}
/* as on a Mac: x, - and + show in the lights only while the pointer is over them */
.sheet .sh-ctl .sh-close,.sheet .sh-ctl .sh-min,.sheet .sh-ctl .sh-max{position:relative}
body:not(.os-mobile) .sheet .sh-ctl:hover .sh-close::before,body:not(.os-mobile) .sheet .sh-ctl:hover .sh-min::before,body:not(.os-mobile) .sheet .sh-ctl:hover .sh-max::before{
  position:absolute;inset:0;display:grid;place-items:center;font:700 10px/1 var(--ios-font);color:color-mix(in srgb,var(--text) 70%,transparent)}
body:not(.os-mobile) .sheet .sh-ctl:hover .sh-close::before{content:"\00D7"}
body:not(.os-mobile) .sheet .sh-ctl:hover .sh-min::before{content:"\2212"}
body:not(.os-mobile) .sheet .sh-ctl:hover .sh-max::before{content:"+"}
/* the resize corner keeps working; nothing is drawn in it (macOS resizes from the edges and corners) */
.sheet .sh-grip,.win-grip,.grip{background:none!important}
.win-grip::before,.grip::before,.sh-grip::before{content:none!important;display:none!important}
.sheet .sh-ctl .sh-fs,.sheet .sh-ctl .sh-newtab,.sheet .sh-ctl .sh-file{border-radius:50%!important;width:22px!important;height:22px!important}
body.os-mobile .sheet .sh-head{height:52px!important;min-height:52px!important}
body.os-mobile .sheet .sh-head > span:first-child{font:600 17px/1.2 var(--ios-font)!important;padding:0 104px!important}
body.os-mobile .sheet .sh-ctl .sh-min,body.os-mobile .sheet .sh-ctl .sh-max,body.os-mobile .sheet .sh-ctl .sh-fs{display:none!important}
body.os-mobile .sheet .sh-ctl .sh-close,body.os-mobile .sheet .sh-ctl .sh-newtab,body.os-mobile .sheet .sh-ctl .sh-file,
body.os-mobile .sheet .sh-head > .sh-close,body.os-mobile .sheet .sh-head > .x{width:32px!important;height:32px!important;border-radius:50%!important;
  background:color-mix(in srgb,var(--text) 9%,transparent)!important;box-shadow:none!important;color:var(--text)!important;position:relative}
/* the 32 pt circle sits in a 44 pt touch target */
body.os-mobile .sheet .sh-ctl .sh-close::after,body.os-mobile .sheet .sh-ctl .sh-newtab::after,body.os-mobile .sheet .sh-ctl .sh-file::after{content:"";position:absolute;inset:-6px}
body.os-mobile .sheet .sh-ctl .sh-close::before{content:"";position:absolute;inset:0;margin:auto;width:12px;height:12px;
  background:currentColor;-webkit-mask:linear-gradient(45deg,transparent 45%,currentColor 45% 55%,transparent 55%),linear-gradient(-45deg,transparent 45%,currentColor 45% 55%,transparent 55%);
  mask:linear-gradient(45deg,transparent 45%,currentColor 45% 55%,transparent 55%),linear-gradient(-45deg,transparent 45%,currentColor 45% 55%,transparent 55%)}
body.os-mobile .sheet .sh-ctl{gap:10px}
body.os-mobile .sheet .sh-ctl .sh-newtab svg,body.os-mobile .sheet .sh-ctl .sh-file svg{width:15px;height:15px}
/* an open app on a phone or tablet is a full screen of its own: an opaque page, never the blurred home screen behind it
   (Docs and Garage showed the icons through their window) */
body.os-mobile section[data-os="app"].open:not(.min){background-color:var(--background)!important}
/* iOES Sheet's own window buttons carry ids (#shClose...), which beat the class rules above */
body.os-mobile .sheet .sh-ctl #shMin,body.os-mobile .sheet .sh-ctl #shMax{display:none!important}
body.os-mobile .sheet .sh-ctl #shClose{width:32px!important;height:32px!important;border-radius:50%!important;background:color-mix(in srgb,var(--text) 9%,transparent)!important;box-shadow:none!important;color:var(--text)!important}
body.os-mobile .sheet .sh-ctl #shClose .lo-o{display:none}
/* iOES Sheet: the save status and the status line in the system font, not monospace */
.sh-savestate,.sheet .sh-status{font-family:var(--ios-font)!important}
/* iOS 27 step 2b, part 3: Project to Forecast and AutoExpreso read in the system font (they were monospace); numbers in
   tables keep their columns with tabular figures; the cost type code stays monospace (it is data) */
.fc-note,.fc-sort,.fc-table,.fc-link,.fc-unlink,.fc-empty,.fc-drop-s,.ae-lede,.ae-sub,.ae-table,.ae-legend{font-family:var(--ios-font)!important}
.fc-table,.ae-table{font-variant-numeric:tabular-nums}
.fc-sort{border-radius:8px;min-height:32px;padding:0 8px;font-size:14px}
/* a long window title never runs under the buttons on its left (Project to Forecast) */
body.os-mobile .sheet .sh-head > span:first-child{padding:0 120px!important}
@media (max-width:680px){ #aeScope{max-width:46vw;min-width:0;text-overflow:ellipsis} }
/* on a phone a window's tool row wraps instead of hiding buttons off the right edge (AutoExpreso's Export) */
body.os-mobile .sheet .sh-bar{flex-wrap:wrap;row-gap:8px}
/* iOES Sheet on a phone: one menu row (File, Edit, Insert, ...); ... shows the other menus in a second row (ios27.js);
   the save status sits in the bottom bar beside the sheet tabs */
.shm-more{display:none}
body.os-mobile .sheet .shm-bar{flex-wrap:wrap}
body.os-mobile .sheet .shm-more{display:inline-flex;align-items:center;justify-content:center;min-width:44px;min-height:40px;padding:0 14px;border-radius:12px;border:1px solid var(--line,var(--border));background:var(--panel,var(--surface));color:var(--text);font:600 18px/1 var(--ios-font);cursor:pointer}
body.os-mobile .sheet .shm-bar > .shm-extra:not(.shm-pick){display:none}
/* a menu chosen from More: only its list shows, placed under More (ios27.js); its own button stays out of sight */
body.os-mobile .sheet .shm-bar > .shm-extra.shm-pick{position:absolute;z-index:41;width:1px;height:1px}
body.os-mobile .sheet .shm-bar > .shm-extra.shm-pick > .shm-btn{position:absolute;opacity:0;pointer-events:none;width:1px;height:1px;padding:0;border:0;min-height:0}
body.os-mobile .sheet .shm-bar > .shm-extra.shm-pick > .shm-drop{top:0;left:0}
body.os-mobile .sheet .shm-more[aria-expanded="true"]{background:color-mix(in srgb,var(--accent) 14%,transparent)}
.shm-more-list{position:absolute;min-width:200px;z-index:42}
.shm-more-list .shm-item{display:flex;justify-content:space-between;align-items:center;width:100%;min-height:44px;font:500 16px/1.2 var(--ios-font)}
.shm-more-list .shm-chev{color:var(--text-muted);font-size:20px}
body.os-mobile .sheet{position:relative}
body.os-mobile .sheet .shm-bar > .sh-savestate{position:absolute;right:16px;bottom:calc(14px + env(safe-area-inset-bottom,0px));flex:none;max-width:45%;font-size:12px;color:var(--text-muted);z-index:2}
body.os-mobile .sheet .sh-bar.shm-bar{position:static}
/* iOS 27 step 2e: folders (Calculators, ToolBox, +Fit, PDF tools, the person's own) open like an iOS folder: the home
   screen behind blurs, so the icons under the panel no longer show through with a hard edge; a folder is not a window,
   so it has no resize corner or edges */
body.os-mobile:has(.calc-folder.open) #hub > nav.menu,
body.os-mobile:has(.calc-folder.open) #hub > .ios-widget,
body.os-mobile:has(.calc-folder.open) .ios-dock{filter:blur(18px) saturate(1.2);opacity:.75;transition:filter .2s ease,opacity .2s ease}
.calc-folder .win-grip,.calc-folder .sh-grip,.calc-folder > .os-rz{display:none!important}
@media (prefers-reduced-motion:reduce){body.os-mobile:has(.calc-folder.open) #hub > nav.menu,body.os-mobile:has(.calc-folder.open) #hub > .ios-widget,body.os-mobile:has(.calc-folder.open) .ios-dock{transition:none}}
