
:root{
  --bg:#f6f7fb; --card:#ffffff; --text:#0e1116; --muted:#6b7280; --line:#e7e9f0;
  --brand:#2e6df6; --brand-ghost:#e9f0ff; --radius:16px; --shadow:0 6px 18px rgba(13,20,33,.06);
}
*{box-sizing:border-box} html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--text);font-family:system-ui,-apple-system,Segoe UI,Roboto,Inter,Arial,sans-serif}
#app{max-width:980px;margin:0 auto;padding:16px 16px 24px}
.topbar{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-bottom:10px}
.brand{display:flex;align-items:center;gap:10px}
.logo{width:32px;height:32px;border-radius:10px;background:var(--brand);color:#fff;display:grid;place-items:center;font-weight:700}
.title{font-weight:700;font-size:18px}
#search{flex:1;min-width:260px;margin-left:auto;background:#fff;border:1px solid var(--line);border-radius:12px;padding:12px 14px;color:var(--text);outline:none;box-shadow:var(--shadow)}
#search:focus{border-color:var(--brand);box-shadow:0 0 0 3px rgba(46,109,246,.12)}
.chips{display:flex;gap:8px;flex-wrap:wrap;margin:6px 0 10px}
.chip{background:var(--brand-ghost);color:var(--brand);border:1px solid rgba(46,109,246,.15);padding:8px 12px;border-radius:999px;font-size:13px;cursor:pointer;user-select:none}
.chip.active{background:var(--brand);color:#fff;border-color:var(--brand)}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:14px;margin-top:6px}
.tile{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);padding:16px;cursor:pointer;transition:transform .12s ease, box-shadow .12s ease, border-color .12s ease;box-shadow:var(--shadow)}
.tile:hover{transform:translateY(-2px);box-shadow:0 10px 24px rgba(13,20,33,.08)}
.tile:active{transform:scale(.99)}
.cat{font-size:12px;color:var(--muted);margin-bottom:6px}
.tile h3{margin:0 0 8px;font-size:16px}
.tile p{margin:0;color:#334155;font-size:14px;line-height:1.35;max-height:4.05em;overflow:hidden}
.foot{margin-top:16px;color:var(--muted);text-align:center}
.toast{position:fixed;left:50%;bottom:18px;transform:translateX(-50%) translateY(20px);background:#111827;color:#fff;padding:10px 14px;border-radius:999px;font-size:13px;opacity:0;pointer-events:none;transition:all .2s ease;box-shadow:0 6px 14px rgba(0,0,0,.25);z-index:60}
.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}

/* Bottom sheet with proper stacking to avoid iOS blur of content */
.sheet.hidden{display:none}
.sheet{position:fixed;inset:0;z-index:50}
.sheet .backdrop{position:absolute;inset:0;background:rgba(0,0,0,.35); /* remove blur for crispness */ -webkit-backdrop-filter:none; backdrop-filter:none; z-index:1;}
.sheet-card{position:absolute;left:50%;bottom:0;transform:translateX(-50%);width:min(960px,96%);background:var(--card);border:1px solid var(--line);border-bottom-left-radius:0;border-bottom-right-radius:0;border-top-left-radius:18px;border-top-right-radius:18px;box-shadow:0 -12px 32px rgba(13,20,33,.18);padding:16px;max-height:80vh;display:flex;flex-direction:column;gap:12px;z-index:2}
.sheet-head{display:flex;justify-content:space-between;align-items:flex-start;gap:8px}
.sheet-title{font-weight:700;font-size:18px}
.sheet-cat{font-size:12px;color:var(--muted);margin-bottom:4px}
.sheet .x{border:none;background:#edf0f6;border-radius:10px;padding:8px 10px;cursor:pointer}
.sheet textarea{width:100%;height:40vh;resize:vertical;background:#fafbff;border:1px solid var(--line);border-radius:12px;padding:12px 12px;color:var(--text);line-height:1.35}
.actions{display:flex;gap:10px;justify-content:flex-end;flex-wrap:wrap}
.actions button{border:1px solid var(--line);background:#fff;border-radius:12px;padding:10px 14px;cursor:pointer}
.actions .primary{background:var(--brand);color:#fff;border-color:var(--brand)}
@media (prefers-color-scheme: dark){
  :root{--bg:#0e1116;--card:#141821;--text:#e8ecf1;--muted:#98a1b3;--line:#262c37;--brand-ghost:#142860}
  #search{background:#0f1420;color:var(--text);border-color:#262c37}
  .tile p{color:#c9d2e1}
  .sheet .x{background:#1d2431;color:#e8ecf1}
  .sheet textarea{background:#0f1420;color:#e8ecf1;border-color:#262c37}
  .actions button{background:#0f1420;color:#e8ecf1;border-color:#262c37}
}
