/* =====================================================================
   UniHub app design system ("ab-")
   iOS-style look for every page: system fonts, grouped lists, sheets,
   translucent bars, tab bar, smooth page transitions, dark mode.
   Pages opt in to the full look with <body class="ab">; other pages only
   get the tab bar and transitions (see .ab-shell rules at the bottom).
   ===================================================================== */

@view-transition { navigation: auto; }

:root {
    --ab-accent: #8C1D40;
    --ab-accent-2: #a8264f;
    --ab-accent-soft: rgba(140, 29, 64, .1);
    --ab-gold: #FFC627;
    --ab-bg: #f2f2f7;
    --ab-surface: #ffffff;
    --ab-surface-2: #f2f2f7;
    --ab-fill: rgba(118, 118, 128, .12);
    --ab-fill-2: rgba(118, 118, 128, .2);
    --ab-label: #000000;
    --ab-label-2: rgba(60, 60, 67, .72);
    --ab-label-3: rgba(60, 60, 67, .45);
    --ab-sep: rgba(60, 60, 67, .2);
    --ab-bar: rgba(249, 249, 251, .82);
    --ab-green: #1f8a3e;
    --ab-red: #d70015;
    --ab-blue: #0a66d6;
    --ab-radius: 14px;
    --ab-radius-lg: 20px;
    --ab-shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
    --ab-shadow-lg: 0 20px 60px rgba(0,0,0,.25);
    --ab-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Arabic", "Segoe UI Arabic", Tahoma, sans-serif;
    --ab-ease: cubic-bezier(.32, .72, 0, 1);
    --ab-tabbar-h: 58px;
    --ab-safe-b: env(safe-area-inset-bottom, 0px);
    --ab-safe-t: env(safe-area-inset-top, 0px);
    color-scheme: light;
}
html.dark {
    --ab-accent: #ff6f9a;
    --ab-accent-2: #ff8fb1;
    --ab-accent-soft: rgba(255, 111, 154, .16);
    --ab-bg: #000000;
    --ab-surface: #1c1c1e;
    --ab-surface-2: #2c2c2e;
    --ab-fill: rgba(118, 118, 128, .24);
    --ab-fill-2: rgba(118, 118, 128, .36);
    --ab-label: #ffffff;
    --ab-label-2: rgba(235, 235, 245, .7);
    --ab-label-3: rgba(235, 235, 245, .4);
    --ab-sep: rgba(84, 84, 88, .55);
    --ab-bar: rgba(22, 22, 24, .8);
    --ab-green: #30d158;
    --ab-red: #ff453a;
    --ab-blue: #4da3ff;
    --ab-shadow: 0 1px 2px rgba(0,0,0,.5);
    color-scheme: dark;
}

/* ---------- Guard: older pages style bare elements (nav a, button, h2, ul...).
   These resets beat element-only rules but lose to the component rules below. ---------- */
.ab-tabbar, .ab-sheet, .ab-toast, .ab-backdrop { box-sizing: border-box; text-align: left; letter-spacing: normal; text-transform: none; text-shadow: none; line-height: 1.4; }
.ab-tabbar :where(*), .ab-sheet :where(*) { box-sizing: border-box; }
.ab-tabbar :where(ul, li, a, button, span), .ab-sheet :where(ul, li, a, button, span, div, h2, p, label, strong) {
    margin: 0; padding: 0; border: 0; background: none; box-shadow: none; float: none; position: static;
    min-width: 0; max-width: none; width: auto; height: auto; text-transform: none; letter-spacing: normal; text-shadow: none;
    text-decoration: none; text-align: inherit; font: inherit; color: inherit; opacity: 1; transform: none; animation: none; list-style: none;
}
.ab-sheet :where(a) { color: var(--ab-accent); }

/* ---------- Base (full-app pages) ---------- */
body.ab {
    margin: 0;
    font-family: var(--ab-font);
    font-size: 17px;
    line-height: 1.45;
    background: var(--ab-bg);
    color: var(--ab-label);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: calc(var(--ab-tabbar-h) + var(--ab-safe-b) + 16px);
    overflow-x: hidden;
}
body.ab *, body.ab *::before, body.ab *::after { box-sizing: border-box; }
body.ab a { color: var(--ab-accent); text-decoration: none; }
body.ab img { max-width: 100%; height: auto; }
body.ab h1, body.ab h2, body.ab h3, body.ab p { margin: 0; }
body.ab :focus-visible { outline: 3px solid var(--ab-blue); outline-offset: 2px; border-radius: 8px; }
body.ab [lang="ar"] { font-family: var(--ab-font); }
.ab-vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ab-skip { position: absolute; left: 12px; top: -60px; z-index: 300; background: var(--ab-gold); color: #000 !important; padding: 10px 16px; border-radius: 10px; font-weight: 600; }
.ab-skip:focus { top: calc(12px + var(--ab-safe-t)); }

.ab-wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 700px) { .ab-wrap { padding: 0 24px; } }

/* ---------- Navigation bar ---------- */
.ab-nav {
    position: sticky; top: 0; z-index: 60;
    padding-top: var(--ab-safe-t);
    background: var(--ab-bar);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: .5px solid transparent;
    transition: border-color .2s;
    view-transition-name: ab-nav;
}
.ab-nav.scrolled { border-bottom-color: var(--ab-sep); }
.ab-nav-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 52px; gap: 8px; }
.ab-nav-l, .ab-nav-r { display: flex; align-items: center; gap: 4px; min-width: 0; }
.ab-nav-r { justify-content: flex-end; }
.ab-nav-title {
    font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw;
    opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s;
}
.ab-nav.scrolled .ab-nav-title, .ab-nav.always .ab-nav-title { opacity: 1; transform: none; }
.ab-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ab-label) !important; font-weight: 700; font-size: 17px; }
.ab-brand img { width: 30px; height: 30px; border-radius: 8px; background: #fff; padding: 2px; object-fit: contain; }
.ab-back {
    display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 8px 0 0;
    color: var(--ab-accent) !important; font-size: 17px; background: none; border: 0; cursor: pointer; font-family: inherit;
}
.ab-back svg { width: 24px; height: 24px; }
.ab-icon-btn {
    display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
    border: 0; background: transparent; color: var(--ab-accent); cursor: pointer; font: inherit;
    transition: background .15s, transform .15s var(--ab-ease);
}
.ab-icon-btn:hover { background: var(--ab-fill); }
.ab-icon-btn:active { transform: scale(.9); }
.ab-icon-btn svg { width: 22px; height: 22px; }
.ab-desk-links { display: none; gap: 2px; }
.ab-desk-links a { padding: 8px 12px; border-radius: 10px; color: var(--ab-label) !important; font-size: 15px; font-weight: 500; }
.ab-desk-links a:hover { background: var(--ab-fill); }
.ab-desk-links a[aria-current="page"] { color: var(--ab-accent) !important; background: var(--ab-accent-soft); }
@media (min-width: 900px) { .ab-desk-links { display: flex; } }

/* ---------- Large title header ---------- */
.ab-head { padding: 8px 0 12px; }
.ab-eyebrow { font-size: 13px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--ab-label-2); }
.ab-large { font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin-top: 2px; }
@media (min-width: 700px) { .ab-large { font-size: 40px; } }
.ab-sub { color: var(--ab-label-2); margin-top: 6px; font-size: 16px; }
.ab-sub-ar { color: var(--ab-label-2); margin-top: 2px; font-size: 16px; }

/* ---------- Search field ---------- */
.ab-search { position: relative; margin: 8px 0 4px; }
.ab-search input {
    width: 100%; height: 44px; padding: 0 40px 0 38px; border: 0; border-radius: 12px;
    background: var(--ab-fill); color: var(--ab-label); font: inherit; font-size: 17px;
    -webkit-appearance: none; appearance: none; outline: none; transition: background .2s, box-shadow .2s;
}
.ab-search input::placeholder { color: var(--ab-label-3); }
.ab-search input:focus { background: var(--ab-surface); box-shadow: 0 0 0 3px var(--ab-accent-soft), inset 0 0 0 1px var(--ab-accent); }
.ab-search input::-webkit-search-cancel-button { display: none; }
.ab-search .ab-s-ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ab-label-3); pointer-events: none; }
.ab-search .ab-s-clear {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; border-radius: 50%;
    background: transparent; color: var(--ab-label-3); cursor: pointer; display: none; place-items: center;
}
.ab-search .ab-s-clear svg { width: 18px; height: 18px; }
.ab-search.has-text .ab-s-clear { display: grid; }
.ab-search.big input { height: 52px; font-size: 18px; border-radius: 14px; padding-left: 44px; }
.ab-search.big .ab-s-ico { left: 14px; width: 20px; height: 20px; }

/* ---------- Chips / segmented ---------- */
.ab-chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px; margin: 0 -16px; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
.ab-chips::-webkit-scrollbar { display: none; }
@media (min-width: 700px) { .ab-chips { margin: 0 -24px; padding: 10px 24px; flex-wrap: wrap; } }
.ab-chip {
    flex-shrink: 0; scroll-snap-align: start; display: inline-flex; align-items: center; gap: 6px;
    min-height: 34px; padding: 0 14px; border-radius: 999px; border: 0; cursor: pointer;
    background: var(--ab-surface); color: var(--ab-label); font: inherit; font-size: 15px; font-weight: 500;
    box-shadow: inset 0 0 0 .5px var(--ab-sep); transition: background .15s, color .15s, transform .15s var(--ab-ease);
}
.ab-chip:active { transform: scale(.95); }
.ab-chip[aria-pressed="true"], .ab-chip.on { background: var(--ab-accent); color: #fff; box-shadow: none; }
html.dark .ab-chip[aria-pressed="true"], html.dark .ab-chip.on { color: #000; }
.ab-chip .n { font-size: 12px; opacity: .7; }
.ab-select {
    min-height: 34px; padding: 0 30px 0 12px; border-radius: 999px; border: 0; font: inherit; font-size: 15px;
    background: var(--ab-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 14px;
    color: var(--ab-label); box-shadow: inset 0 0 0 .5px var(--ab-sep); -webkit-appearance: none; appearance: none; flex-shrink: 0;
}
.ab-seg { display: inline-flex; padding: 2px; border-radius: 10px; background: var(--ab-fill); }
.ab-seg button { border: 0; background: transparent; color: var(--ab-label); font: inherit; font-size: 14px; font-weight: 500; padding: 6px 14px; border-radius: 8px; cursor: pointer; transition: background .2s; }
.ab-seg button[aria-pressed="true"] { background: var(--ab-surface); box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; }

/* ---------- Sections & grouped lists ---------- */
.ab-section { margin-top: 26px; }
.ab-section-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 4px 8px; }
.ab-section-h h2 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.ab-section-h .ar { color: var(--ab-label-2); font-size: 15px; }
.ab-section-h a, .ab-section-h button.ab-link { font-size: 15px; background: none; border: 0; color: var(--ab-accent); cursor: pointer; font-family: inherit; padding: 6px 0; }
.ab-foot { color: var(--ab-label-2); font-size: 13px; padding: 8px 16px 0; }

.ab-list { list-style: none; margin: 0; padding: 0; background: var(--ab-surface); border-radius: var(--ab-radius); overflow: hidden; box-shadow: var(--ab-shadow); }
.ab-row {
    position: relative; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 8px 8px 14px;
    color: var(--ab-label) !important; background: var(--ab-surface); transition: background .15s;
    content-visibility: auto; contain-intrinsic-size: auto 60px;
}
.ab-row + .ab-row::before, .ab-list > li + li > .ab-row::before { content: ""; position: absolute; top: 0; right: 0; left: 62px; border-top: .5px solid var(--ab-sep); }
.ab-row:hover { background: var(--ab-fill); background: color-mix(in srgb, var(--ab-surface) 94%, var(--ab-label)); }
.ab-row:active { background: var(--ab-fill); }
.ab-row-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; color: inherit !important; min-height: 44px; }
.ab-row-text { flex: 1; min-width: 0; }
.ab-row-title { font-size: 16px; font-weight: 500; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ab-row-meta { font-size: 13px; color: var(--ab-label-2); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: center; }
.ab-row-meta > span { white-space: nowrap; }
.ab-row-actions { display: flex; align-items: center; flex-shrink: 0; }
.ab-row-actions .ab-icon-btn { width: 40px; height: 40px; color: var(--ab-label-3); }
.ab-row-actions .ab-icon-btn svg { width: 20px; height: 20px; }
.ab-row-actions .ab-icon-btn.on { color: var(--ab-gold); }
.ab-chev { width: 16px; height: 16px; color: var(--ab-label-3); flex-shrink: 0; margin-right: 6px; }
.ab-tile {
    flex-shrink: 0; width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; color: #fff;
    background: #8e8e93; font-size: 18px;
}
.ab-tile svg { width: 20px; height: 20px; }
.ab-tile.folder { background: #2f7be5; }
.ab-tile.pdf { background: #e5383b; }
.ab-tile.doc { background: #2b6fd6; }
.ab-tile.ppt { background: #e8702a; }
.ab-tile.sheet { background: #1e8e4e; }
.ab-tile.img { background: #8a4fd6; }
.ab-tile.video { background: #c2185b; }
.ab-tile.zip { background: #9a7b12; }
.ab-tile.link { background: #5b6575; }
.ab-tile.page { background: var(--ab-accent); }
html.dark .ab-tile.page { background: #a8264f; }
.ab-tile.emoji { background: var(--ab-fill); font-size: 20px; }
.ab-badge { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .03em; background: var(--ab-fill); color: var(--ab-label-2); vertical-align: 1px; }
.ab-badge.new { background: rgba(31,138,62,.14); color: var(--ab-green); }
.ab-badge.warn { background: rgba(215,0,21,.1); color: var(--ab-red); }
.ab-badge.accent { background: var(--ab-accent-soft); color: var(--ab-accent); }

/* Hand-written lists before app.js upgrades them (and without JavaScript) */
ul.ab-items { list-style: none; margin: 0; padding: 0; background: var(--ab-surface); border-radius: var(--ab-radius); overflow: hidden; box-shadow: var(--ab-shadow); }
ul.ab-items a.ab-item { display: flex; align-items: center; min-height: 56px; padding: 10px 16px; color: var(--ab-label); font-size: 16px; font-weight: 500; border-top: .5px solid var(--ab-sep); }
ul.ab-items > li:first-child a.ab-item { border-top: 0; }

/* ---------- Tiles grid ---------- */
.ab-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 600px) { .ab-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .ab-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.ab-grid.wide { grid-template-columns: 1fr; }
@media (min-width: 600px) { .ab-grid.wide { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .ab-grid.wide { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.ab-card {
    position: relative; display: flex; flex-direction: column; gap: 8px; padding: 14px; min-height: 96px;
    background: var(--ab-surface); border-radius: var(--ab-radius); box-shadow: var(--ab-shadow);
    color: var(--ab-label) !important; transition: transform .2s var(--ab-ease), box-shadow .2s;
}
.ab-card:hover { box-shadow: 0 2px 4px rgba(0,0,0,.05), 0 12px 32px rgba(0,0,0,.09); }
.ab-card:active { transform: scale(.97); }
.ab-card .ab-tile { width: 40px; height: 40px; border-radius: 11px; font-size: 21px; }
.ab-card h3 { font-size: 16px; font-weight: 600; line-height: 1.25; }
.ab-card p { font-size: 13px; color: var(--ab-label-2); line-height: 1.35; }
.ab-card .ar { font-size: 13px; color: var(--ab-label-2); }
.ab-card.row { flex-direction: row; align-items: flex-start; min-height: 0; }
.ab-card.row > div { min-width: 0; }

/* Horizontal shelf (recents, saved) */
.ab-shelf { display: flex; gap: 10px; overflow-x: auto; padding: 2px 16px 10px; margin: 0 -16px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.ab-shelf::-webkit-scrollbar { display: none; }
@media (min-width: 700px) { .ab-shelf { margin: 0 -24px; padding: 2px 24px 10px; } }
.ab-shelf .ab-card { flex: 0 0 min(220px, 62vw); scroll-snap-align: start; min-height: 108px; }
.ab-shelf .ab-card h3 { font-size: 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Buttons ---------- */
.ab-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 20px;
    border: 0; border-radius: 14px; font: inherit; font-size: 17px; font-weight: 600; cursor: pointer;
    background: var(--ab-accent); color: #fff !important; transition: transform .15s var(--ab-ease), filter .15s, opacity .15s;
}
html.dark .ab-btn { color: #000 !important; }
.ab-btn:hover { filter: brightness(1.06); }
.ab-btn:active { transform: scale(.97); }
.ab-btn[disabled] { opacity: .45; cursor: not-allowed; }
.ab-btn.tinted, html.dark .ab-btn.tinted { background: var(--ab-accent-soft); color: var(--ab-accent) !important; }
.ab-btn.gray, html.dark .ab-btn.gray { background: var(--ab-fill); color: var(--ab-label) !important; }
.ab-btn.gold, html.dark .ab-btn.gold { background: var(--ab-gold); color: #1b1b1f !important; }
.ab-btn.green, html.dark .ab-btn.green { background: #1f9e4f; color: #fff !important; }
html.dark .ab-hero .ab-btn.glass { color: #fff !important; }
.ab-btn.sm { min-height: 36px; padding: 0 14px; font-size: 15px; border-radius: 10px; }
.ab-btn svg { width: 20px; height: 20px; }
.ab-btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Hero (home) ---------- */
.ab-hero {
    position: relative; margin-top: 4px; padding: 22px 18px 20px; border-radius: var(--ab-radius-lg); color: #fff;
    background: radial-gradient(120% 140% at 100% 0%, #b8305a 0%, #8C1D40 45%, #5a1129 100%);
    box-shadow: 0 10px 30px rgba(140, 29, 64, .28);
}
html.dark .ab-hero { box-shadow: none; }
.ab-hero::after { content: ""; position: absolute; right: 0; top: 0; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,198,39,.1); filter: blur(24px); pointer-events: none; }
.ab-hero h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; position: relative; }
@media (min-width: 700px) { .ab-hero { padding: 32px 32px 28px; } .ab-hero h1 { font-size: 38px; max-width: 760px; } }
.ab-hero p { opacity: .9; margin-top: 6px; position: relative; }
.ab-hero .ab-search { margin-top: 16px; position: relative; z-index: 2; max-width: 720px; }
.ab-hero .ab-search input { background: rgba(255,255,255,.96); color: #111; }
.ab-hero .ab-search input:focus { background: #fff; box-shadow: 0 0 0 4px rgba(255,198,39,.5); }
.ab-hero .ab-search .ab-s-ico, .ab-hero .ab-search .ab-s-clear { color: #777; }
.ab-hero .ab-search input::placeholder { color: #86868b; }
.ab-hero .ab-suggest { text-align: left; }
.ab-hero .ab-btn-row { margin-top: 14px; position: relative; }
.ab-hero .ab-btn.glass { background: rgba(255,255,255,.16); color: #fff !important; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }

/* Suggest dropdown */
.ab-suggest {
    position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 70; max-height: min(60vh, 460px); overflow-y: auto;
    background: var(--ab-surface); color: var(--ab-label); border-radius: 14px; box-shadow: var(--ab-shadow-lg);
    padding: 6px 0; display: none; overscroll-behavior: contain;
}
.ab-suggest.open { display: block; animation: ab-pop .18s var(--ab-ease); }
.ab-suggest .ab-row { min-height: 50px; }
.ab-suggest-h { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ab-label-2); padding: 8px 14px 4px; }
.ab-suggest .ab-row[aria-selected="true"] { background: var(--ab-fill); }
.ab-suggest-more { display: block; padding: 12px 14px; font-weight: 600; border-top: .5px solid var(--ab-sep); }

/* ---------- Notice ---------- */
.ab-notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 8px 12px 14px; border-radius: var(--ab-radius); background: #fff6d6; color: #3d3100; font-size: 15px; }
html.dark .ab-notice { background: #2a2410; color: #f3e3a2; }
.ab-notice p + p { margin-top: 4px; }
.ab-notice .ab-icon-btn { color: inherit; width: 36px; height: 36px; flex-shrink: 0; margin-left: auto; }
.ab-notice[hidden] { display: none; }

/* ---------- Empty / loading states ---------- */
.ab-empty { text-align: center; padding: 40px 20px; color: var(--ab-label-2); }
.ab-empty .ab-empty-ico { width: 56px; height: 56px; margin: 0 auto 12px; color: var(--ab-label-3); }
.ab-empty h3 { color: var(--ab-label); font-size: 20px; margin-bottom: 6px; }
.ab-skel { height: 56px; background: linear-gradient(90deg, var(--ab-fill) 25%, var(--ab-fill-2) 50%, var(--ab-fill) 75%); background-size: 200% 100%; animation: ab-shimmer 1.2s infinite; }
.ab-skel + .ab-skel { border-top: .5px solid var(--ab-sep); }
.ab-spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--ab-fill-2); border-top-color: var(--ab-accent); animation: ab-spin .8s linear infinite; display: inline-block; vertical-align: middle; }

/* ---------- Tab bar ---------- */
.ab-tabbar {
    position: fixed; z-index: 2147483000; left: 0; right: 0; bottom: 0;
    padding-bottom: var(--ab-safe-b);
    background: var(--ab-bar);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: .5px solid var(--ab-sep);
    font-family: var(--ab-font);
    view-transition-name: ab-tabbar;
}
.ab-tabbar ul { list-style: none; margin: 0 auto; padding: 0; max-width: 560px; display: grid; grid-template-columns: repeat(5, 1fr); }
.ab-tabbar a, .ab-tabbar button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 100%;
    height: var(--ab-tabbar-h); color: #8e8e93 !important; font-size: 10.5px; font-weight: 500; letter-spacing: .01em;
    text-decoration: none !important; background: none; border: 0; cursor: pointer; font-family: inherit;
    transition: color .15s, transform .15s var(--ab-ease); -webkit-tap-highlight-color: transparent;
}
.ab-tabbar a:active, .ab-tabbar button:active { transform: scale(.9); }
.ab-tabbar svg { width: 26px; height: 26px; }
.ab-tabbar [aria-current="page"] { color: var(--ab-accent) !important; }
html.dark .ab-tabbar a, html.dark .ab-tabbar button { color: #98989f !important; }
html.dark .ab-tabbar [aria-current="page"] { color: var(--ab-accent) !important; }
/* Desktop: floating pill dock */
@media (min-width: 900px) {
    .ab-tabbar { left: 50%; right: auto; bottom: 16px; transform: translateX(-50%); border-radius: 22px; border: .5px solid var(--ab-sep); box-shadow: 0 10px 30px rgba(0,0,0,.14); padding: 0 8px; }
    .ab-tabbar ul { grid-template-columns: repeat(5, 84px); }
    .ab-tabbar a, .ab-tabbar button { height: 56px; font-size: 11px; }
    .ab-tabbar svg { width: 24px; height: 24px; }
}
@media print { .ab-tabbar, .ab-nav { display: none !important; } }

/* ---------- Sheets ---------- */
.ab-backdrop { position: fixed; inset: 0; z-index: 2147483001; background: rgba(0,0,0,.4); opacity: 0; transition: opacity .3s var(--ab-ease); }
.ab-backdrop.open { opacity: 1; }
.ab-sheet {
    position: fixed; z-index: 2147483002; left: 0; right: 0; bottom: 0; max-height: 92vh; max-height: 92dvh;
    display: flex; flex-direction: column; background: var(--ab-bg); color: var(--ab-label); font-family: var(--ab-font);
    border-radius: 14px 14px 0 0; box-shadow: var(--ab-shadow-lg); transform: translateY(100%); transition: transform .42s var(--ab-ease);
    padding-bottom: var(--ab-safe-b); outline: none;
}
.ab-sheet.open { transform: translateY(0); }
.ab-sheet.full { height: 92vh; height: 92dvh; }
@media (min-width: 760px) {
    .ab-sheet { left: 50%; right: auto; bottom: 50%; width: min(680px, 92vw); border-radius: 18px; transform: translate(-50%, 60%) scale(.96); opacity: 0; transition: transform .35s var(--ab-ease), opacity .25s; }
    .ab-sheet.open { transform: translate(-50%, 50%) scale(1); opacity: 1; }
    .ab-sheet.full { height: 86vh; width: min(1000px, 94vw); }
}
.ab-grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--ab-fill-2); margin: 6px auto 0; flex-shrink: 0; }
@media (min-width: 760px) { .ab-grabber { display: none; } }
.ab-sheet-h { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 8px 8px 8px 18px; flex-shrink: 0; }
.ab-sheet-h h2 { font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ab-sheet-b { flex: 1; overflow-y: auto; padding: 0 16px 16px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.ab-sheet-b.flush { padding: 0; display: flex; flex-direction: column; }
.ab-sheet iframe { flex: 1; width: 100%; border: 0; background: #fff; min-height: 300px; }
.ab-sheet-actions { display: flex; gap: 8px; padding: 10px 16px; flex-shrink: 0; border-top: .5px solid var(--ab-sep); background: var(--ab-bar); overflow-x: auto; }
.ab-sheet-actions .ab-btn { flex: 1; min-height: 44px; font-size: 15px; white-space: nowrap; }

/* ---------- Toast ---------- */
.ab-toast {
    position: fixed; z-index: 2147483003; left: 50%; bottom: calc(var(--ab-tabbar-h) + var(--ab-safe-b) + 18px);
    transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
    padding: 10px 18px; border-radius: 999px; background: rgba(30,30,32,.92); color: #fff; font: 500 15px var(--ab-font);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); transition: transform .35s var(--ab-ease), opacity .25s; max-width: 90vw; text-align: center;
}
.ab-toast.show { transform: translate(-50%, 0); opacity: 1; }
@media (min-width: 900px) { .ab-toast { bottom: 96px; } }

/* ---------- Footer ---------- */
.ab-footer { margin-top: 40px; padding: 24px 0 8px; color: var(--ab-label-2); font-size: 14px; }
.ab-footer-cols { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.ab-footer h2 { font-size: 15px; color: var(--ab-label); margin-bottom: 6px; }
.ab-footer ul { list-style: none; margin: 0; padding: 0; }
.ab-footer li { padding: 3px 0; }
.ab-copy { margin-top: 18px; padding-top: 14px; border-top: .5px solid var(--ab-sep); font-size: 13px; }

/* ---------- Upload ---------- */
.ab-drop {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center;
    min-height: 200px; padding: 28px 18px; border-radius: var(--ab-radius-lg); cursor: pointer;
    background: var(--ab-surface); border: 2px dashed var(--ab-fill-2); color: var(--ab-label-2);
    transition: border-color .2s, background .2s, transform .2s var(--ab-ease);
}
.ab-drop:hover, .ab-drop:focus-within { border-color: var(--ab-accent); }
.ab-drop.over { border-color: var(--ab-accent); background: var(--ab-accent-soft); transform: scale(1.01); }
.ab-drop .ab-drop-ico { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--ab-accent-soft); color: var(--ab-accent); }
.ab-drop .ab-drop-ico svg { width: 28px; height: 28px; }
.ab-drop strong { color: var(--ab-label); font-size: 18px; }
.ab-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.ab-progress { height: 6px; border-radius: 3px; background: var(--ab-fill); overflow: hidden; margin-top: 6px; }
.ab-progress > i { display: block; height: 100%; width: 0; background: var(--ab-accent); border-radius: 3px; transition: width .2s; }
.ab-progress.done > i { background: var(--ab-green); }
.ab-progress.err > i { background: var(--ab-red); }

/* ---------- Form fields ---------- */
.ab-field { display: block; padding: 10px 14px; background: var(--ab-surface); }
.ab-field + .ab-field { border-top: .5px solid var(--ab-sep); }
.ab-field span { display: block; font-size: 13px; color: var(--ab-label-2); }
/* Windows draws the open dropdown list itself (often white), and options inherit the select's
   white dark-mode text, so give them explicit colors */
body.ab select option, body.ab select optgroup, .ab-sheet select option { background-color: var(--ab-surface); color: var(--ab-label); }
.ab-field input, .ab-field select, .ab-field textarea { width: 100%; border: 0; background: transparent; color: var(--ab-label); font: inherit; font-size: 17px; padding: 4px 0; outline: none; }

/* ---------- Content pages (legal / guides text) ---------- */
.ab-prose { background: var(--ab-surface); border-radius: var(--ab-radius); padding: 18px; box-shadow: var(--ab-shadow); line-height: 1.6; }
.ab-prose h2 { font-size: 20px; margin: 18px 0 6px; }
.ab-prose p + p { margin-top: 10px; }

/* ---------- Animations ---------- */
@keyframes ab-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes ab-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes ab-shimmer { to { background-position: -200% 0; } }
@keyframes ab-spin { to { transform: rotate(360deg); } }
.ab-in { animation: ab-in .45s var(--ab-ease) both; }
::view-transition-old(root) { animation: ab-vt-out .22s var(--ab-ease) both; }
::view-transition-new(root) { animation: ab-vt-in .32s var(--ab-ease) both; }
@keyframes ab-vt-out { to { opacity: 0; transform: translateX(-24px); } }
@keyframes ab-vt-in { from { opacity: 0; transform: translateX(32px); } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
    ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; }
}
[data-ab-hidden], body.ab [hidden], .ab-sheet [hidden] { display: none !important; }

/* =====================================================================
   Shell-only mode: pages that keep their own design (forms, calendars,
   tools) get the tab bar + transitions without changing their layout.
   ===================================================================== */
body.ab-shell { padding-bottom: calc(var(--ab-tabbar-h) + var(--ab-safe-b) + 8px) !important; -webkit-tap-highlight-color: transparent; }
@media (min-width: 900px) { body.ab-shell { padding-bottom: 90px !important; } }
body.ab-shell .ab-tabbar { font-size: 10.5px; line-height: 1.2; }
/* Shell pages keep their own theme switch, so the tab bar and sheets follow the system setting */
@media (prefers-color-scheme: dark) {
    body.ab-shell {
        --ab-accent: #ff6f9a; --ab-accent-soft: rgba(255, 111, 154, .16); --ab-bg: #000; --ab-surface: #1c1c1e; --ab-surface-2: #2c2c2e;
        --ab-fill: rgba(118, 118, 128, .24); --ab-fill-2: rgba(118, 118, 128, .36); --ab-label: #fff; --ab-label-2: rgba(235, 235, 245, .7);
        --ab-label-3: rgba(235, 235, 245, .4); --ab-sep: rgba(84, 84, 88, .55); --ab-bar: rgba(22, 22, 24, .8); --ab-green: #30d158;
    }
    body.ab-shell .ab-tabbar a, body.ab-shell .ab-tabbar button { color: #98989f !important; }
    body.ab-shell .ab-tabbar [aria-current="page"] { color: var(--ab-accent) !important; }
}

.ab-row.static { cursor: default; }

/* ---------- first visit splash (1.14.0) ---------- */
.ab-splash { position: fixed; inset: 0; z-index: 100000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: var(--ab-bg,#f2f2f7); color: inherit; transition: opacity .35s ease, transform .35s ease; }
html.dark .ab-splash { background: #000; color: #fff; }
.ab-splash.out { opacity: 0; transform: scale(1.04); pointer-events: none; }
.ab-splash img { width: 104px; height: 104px; border-radius: 24px; box-shadow: 0 10px 30px rgba(0,0,0,.25); animation: ab-splash-in .55s cubic-bezier(.2,1.3,.4,1); }
.ab-splash b { font: 700 28px -apple-system, 'Segoe UI', Roboto, sans-serif; animation: ab-splash-up .5s ease; }
.ab-splash-dots { display: inline-flex; gap: 6px; margin-top: 4px; }
.ab-splash-dots i { width: 8px; height: 8px; border-radius: 50%; background: #5b48d9; animation: ab-splash-dot 1.05s ease-in-out infinite; }
.ab-splash-dots i:nth-child(2) { animation-delay: .16s; }
.ab-splash-dots i:nth-child(3) { animation-delay: .32s; }
@keyframes ab-splash-in { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes ab-splash-up { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ab-splash-dot { 0%, 100% { transform: scale(.45); opacity: .35; } 50% { transform: scale(1); opacity: 1; } }

/* every spinner on the site becomes the three dots */
.ab-spinner { width: 8px !important; height: 8px !important; border: 0 !important; border-radius: 50%; background: var(--ab-accent,#8c1d40) !important; color: var(--ab-accent,#8c1d40); box-shadow: -14px 0 0 currentColor, 14px 0 0 currentColor; animation: ab-splash-dot 1.05s ease-in-out infinite !important; margin-left: 14px; margin-right: 14px; }
@media (prefers-reduced-motion: reduce) { .ab-splash img, .ab-splash b, .ab-splash-dots i, .ab-spinner { animation: none !important; } }

/* look like an app on phones: inputs of 16px stop Safari zooming in when typing, and taps don't double-tap zoom */
@media (hover: none) and (pointer: coarse) {
    input, textarea, select { font-size: 16px !important; }
}
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
