:root, [data-theme="dark"]{
/* grouped-background hierarchy (systemGroupedBackground / secondarySystemGroupedBackground) */
--bg:#0A1710;
--bg-soft:#0E1D14;
--card:#17301F;
--card-elevated:#1B3824;
/* labels */
--label:#F4F1E6;
--secondary-label:#9FB0A2;
--tertiary-label:#6C8073;
/* separators & fills (systemFill) */
--separator:rgba(244,241,230,0.10);
--fill:rgba(244,241,230,0.07);
--fill-strong:rgba(244,241,230,0.12);
/* tint (brand accent used for interactive/tappable elements) */
--tint:#34C97A;
--tint-gold:#EDBD1D;
--icon-plate:#FFFFFF;
--shadow:0 10px 24px -14px rgba(0,0,0,0.5);
color-scheme:dark;
}

[data-theme="light"]{
--bg:#F2F1E9;
--bg-soft:#ECE9DC;
--card:#FFFFFF;
--card-elevated:#FFFFFF;
--label:#1C2420;
--secondary-label:#5B6B5E;
--tertiary-label:#8D9C90;
--separator:rgba(24,34,25,0.09);
--fill:rgba(23,87,46,0.05);
--fill-strong:rgba(23,87,46,0.09);
--tint:#0B7A38;
--tint-gold:#A97909;
--icon-plate:#FFFFFF;
--shadow:0 10px 20px -14px rgba(23,60,35,0.22);
color-scheme:light;
}

*{ box-sizing:border-box; margin:0; padding:0; -webkit-tap-highlight-color:transparent; }
html{ scroll-behavior:smooth; }

body{
background:var(--bg);
color:var(--label);
font-family:-apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
min-height:100vh;
-webkit-font-smoothing:antialiased;
transition:background 0.35s ease, color 0.35s ease;
}

a{ color:inherit; }
button{ font-family:inherit; }

.app-shell{
max-width:440px;
margin:0 auto;
min-height:100vh;
display:flex;
flex-direction:column;
position:relative;
}

/* ---------- top bar (iOS nav bar) ---------- */
.topbar{
display:flex; align-items:center; justify-content:space-between;
padding:12px 16px;
position:sticky; top:0; z-index:10;
background:var(--bg);
border-bottom:0.5px solid transparent;
transition:border-color 0.3s ease, background 0.35s ease;
}
.topbar.is-scrolled{ border-bottom-color:var(--separator); backdrop-filter:blur(20px) saturate(1.6); -webkit-backdrop-filter:blur(20px) saturate(1.6); background:color-mix(in srgb, var(--bg) 78%, transparent); }

.brand{ display:flex; align-items:center; gap:8px; }
.brand-logo{ width:30px; height:30px; flex:none; }
.brand-logo svg{ width:100%; height:100%; display:block; }
.brand-name{ font-weight:600; font-size:17px; letter-spacing:-0.01em; } /* Headline */

.topbar-actions{ display:flex; align-items:center; gap:4px; }

/* Circular material button — 44x44pt minimum touch target (HIG) */
.icon-btn{
position:relative; width:44px; height:44px; border-radius:50%;
border:none; background:var(--fill);
backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px);
display:flex; align-items:center; justify-content:center;
cursor:pointer; color:var(--tint);
transition:background 0.2s ease, transform 0.15s ease;
}
.icon-btn:hover{ background:var(--fill-strong); }
.icon-btn:active{ transform:scale(0.92); }
.icon-btn:focus-visible{ outline:2px solid var(--tint); outline-offset:2px; }
.icon-btn svg{ width:19px; height:19px; }

.share-btn{ color:var(--tint); }
.theme-toggle{ color:var(--tint-gold); }

.share-toast{
position:fixed; left:50%; bottom:28px; transform:translateX(-50%) translateY(12px);
background:var(--card-elevated); border:0.5px solid var(--separator);
color:var(--label); font-size:15px; font-weight:500; padding:12px 20px; border-radius:14px;
box-shadow:var(--shadow); opacity:0; pointer-events:none; z-index:50;
backdrop-filter:blur(20px); -webkit-backdrop-filter:blur(20px);
transition:opacity 0.25s ease, transform 0.25s ease;
}
.share-toast.is-visible{ opacity:1; transform:translateX(-50%) translateY(0); }
.theme-toggle .icon-moon{ display:none; }
[data-theme="light"] .theme-toggle .icon-sun{ display:none; }
[data-theme="light"] .theme-toggle .icon-moon{ display:block; }

/* ---------- hero (large title area) ---------- */
.hero{ padding:8px 16px 16px; }

.hero-eyebrow{
font-family:'Amiri', serif; font-style:italic; font-size:16px; /* Callout */
color:var(--tint-gold); direction:rtl; margin-bottom:12px;
}
.hero h1{
font-weight:700; font-size:34px; line-height:1.1; letter-spacing:0.015em; /* Large Title */
color:var(--label);
margin-bottom:4px;
}
.hero-org{ font-weight:600; font-size:17px; color:var(--tint); margin-bottom:4px; } /* Headline */
.hero-desc{ color:var(--secondary-label); font-size:15px; line-height:1.35; max-width:34ch; } /* Subheadline */

/* ---------- search (UISearchBar) ---------- */
.search-wrap{ padding:16px 16px 8px; }
.search-box{
display:flex; align-items:center; gap:8px;
background:var(--fill); border-radius:10px;
padding:9px 12px; transition:background 0.2s ease;
}
.search-box:focus-within{ background:var(--fill-strong); }
.search-box svg{ width:17px; height:17px; color:var(--tertiary-label); flex:none; }
.search-box input{
border:none; outline:none; background:transparent; width:100%;
font-size:17px; color:var(--label); /* Body */
}
.search-box input::placeholder{ color:var(--tertiary-label); }

/* ---------- apps (insetGrouped list) ---------- */
.apps{ padding:24px 16px 8px; flex:1; }
.apps-head{ display:flex; align-items:baseline; justify-content:space-between; margin-bottom:8px; padding:0 4px; }
.apps-label{ font-weight:600; font-size:13px; letter-spacing:0.02em; text-transform:uppercase; color:var(--secondary-label); } /* Footnote */
.apps-count{ font-size:13px; color:var(--tertiary-label); } /* Footnote */

.app-grid{
display:flex; flex-direction:column;
background:var(--card); border-radius:14px; overflow:hidden;
box-shadow:var(--shadow);
}

.app-tile{
display:flex; align-items:center; gap:12px;
padding:12px 16px; min-height:64px;
text-decoration:none; color:inherit;
background:transparent;
border-bottom:0.5px solid var(--separator);
transition:background 0.15s ease;
}
.app-grid .app-tile:last-child{ border-bottom:none; }
.app-tile:hover{ background:var(--fill); }
.app-tile:active{ background:var(--fill-strong); }
.app-tile:focus-visible{ outline:2px solid var(--tint); outline-offset:-2px; }

/* Icon plate: solid white card (like a real app icon) so the full-color
   crest logo stays legible — a translucent brand tint behind it muddied
   contrast in dark mode and made the mark unreadable at 44px. */
.app-icon{
width:48px; height:48px; border-radius:12px;
background:var(--icon-plate);
border:0.5px solid var(--separator);
box-shadow:0 1px 2px rgba(0,0,0,0.06);
display:flex; align-items:center; justify-content:center;
overflow:hidden; flex:none;
}
.app-icon img{ width:82%; height:82%; object-fit:contain; }

.app-text{ display:flex; flex-direction:column; gap:1px; min-width:0; flex:1; }
.app-name{ font-weight:600; font-size:17px; } /* Headline */
.app-desc{
font-size:15px; line-height:1.3; color:var(--secondary-label); /* Subheadline */
overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}

.app-chevron{ width:18px; height:18px; color:var(--accent, var(--tertiary-label)); opacity:0.75; flex:none; }

.app-tile--soon{ opacity:0.5; }
.app-icon--soon{
font-size:20px; font-weight:600;
color:var(--tertiary-label); background:var(--fill); border-style:dashed;
}
.app-tile--soon .app-name{ color:var(--secondary-label); }
.app-badge{
font-size:13px; font-weight:600; color:var(--tertiary-label);
background:var(--fill); padding:4px 10px; border-radius:8px; flex:none;
}

.apps-empty{ color:var(--tertiary-label); font-size:15px; text-align:center; padding:28px 0; }

/* ---------- footer ---------- */
footer{ margin-top:auto; padding:24px 16px 20px; text-align:center; }
footer p{ font-size:13px; color:var(--tertiary-label); } /* Footnote */
footer strong{ color:var(--secondary-label); font-weight:600; }

@media (prefers-reduced-motion: reduce){
*{ animation-duration:0.001ms !important; transition-duration:0.001ms !important; }
}

@media (min-width:480px){
.app-shell{ margin:24px auto; min-height:calc(100vh - 48px); border-radius:20px; border:0.5px solid var(--separator); overflow:hidden; box-shadow:0 30px 60px -30px rgba(0,0,0,0.35); }
body{ background:var(--bg-soft); }
}
