/* Kategorien-Fenster fürs Handy (öffnet von unten) */
.msheet{position:fixed;inset:0;z-index:120;display:flex;align-items:flex-end;justify-content:center}
.msheet[hidden]{display:none}
.msheet-bg{position:absolute;inset:0;background:rgba(15,23,42,.45);opacity:0;transition:opacity .25s}
.msheet-box{position:relative;width:100%;max-width:560px;height:86vh;height:86dvh;display:flex;flex-direction:column;background:var(--card,#fff);border-radius:22px 22px 0 0;box-shadow:0 -10px 40px rgba(15,23,42,.18);transform:translateY(100%);transition:transform .26s cubic-bezier(.2,.8,.2,1);padding-bottom:env(safe-area-inset-bottom)}
.msheet.on .msheet-bg{opacity:1}
.msheet.on .msheet-box{transform:translateY(0)}
body.msheet-open{overflow:hidden}

.msheet-grip{display:flex;justify-content:center;padding:10px 0 2px;touch-action:none}
.msheet-grip i{width:42px;height:5px;border-radius:99px;background:#D7DBE3}
.msheet-head{display:flex;align-items:center;gap:8px;padding:4px 14px 10px 18px;touch-action:none}
.msheet-head b{flex:1;font-size:1.15rem;font-weight:800;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.msheet-back,.msheet-x{flex:none;width:36px;height:36px;border:0;border-radius:50%;display:grid;place-items:center;background:#F1F3F7;color:var(--ink);cursor:pointer}
.msheet-back{margin-left:-6px}
.msheet-back[hidden]{display:none}

.msheet-search{display:flex;align-items:center;gap:8px;margin:0 16px 12px;padding:0 14px;height:46px;border:1px solid var(--line);border-radius:14px;background:#F8FAFC;color:var(--muted)}
.msheet-search:focus-within{border-color:var(--accent);background:#fff;box-shadow:0 0 0 4px var(--accent-soft)}
.msheet-search input{flex:1;min-width:0;border:0;background:transparent;font:inherit;font-size:16px;color:var(--ink);outline:none}

.msheet-body{overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:0 16px 20px;flex:1}

/* Raster der Hauptkategorien */
.mc-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.mc-grid[hidden]{display:none}
.mc-tile{display:flex;flex-direction:column;align-items:center;gap:6px;padding:14px 3px 12px;border:1px solid var(--line);border-radius:16px;background:var(--card,#fff);color:var(--ink);text-decoration:none;font:inherit;cursor:pointer;text-align:center;min-width:0;transition:transform .12s,border-color .15s}
.mc-tile:active{transform:scale(.97)}
.mc-tile i{width:48px;height:48px;border-radius:50%;display:grid;place-items:center;background:var(--accent-soft);color:var(--accent)}
.mc-tile i svg{width:24px;height:24px}
.mc-tile span{font-size:.76rem;font-weight:700;line-height:1.2;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;width:100%}
.mc-tile small{font-size:.72rem;color:var(--muted)}
.mc-tile.mc-empty{opacity:.55}

/* Listen: Unterkategorien und Suchergebnisse */
.mc-list{display:flex;flex-direction:column;gap:2px}
.mc-list[hidden],.mc-row[hidden],.mc-none[hidden]{display:none}
.mc-row{display:flex;align-items:center;gap:12px;padding:11px 10px;border-radius:12px;color:var(--ink);text-decoration:none}
.mc-row:active{background:var(--accent-soft)}
.mc-row i{width:38px;height:38px;flex:none;border-radius:50%;display:grid;place-items:center;background:var(--accent-soft);color:var(--accent)}
.mc-row i svg{width:20px;height:20px}
.mc-row span{flex:1;min-width:0;font-weight:600;font-size:.95rem;display:flex;flex-direction:column}
.mc-row span em{font-style:normal;font-weight:500;font-size:.78rem;color:var(--muted)}
.mc-row small{color:var(--muted);font-size:.82rem}
.mc-row>svg{color:#B4BAC6;flex:none}
.mc-row.mc-empty{opacity:.55}
.mc-all{background:var(--accent-soft);margin-bottom:6px}
.mc-all span{color:var(--accent)}
.mc-all i{background:var(--accent);color:#fff}
.mc-none{color:var(--muted);text-align:center;padding:24px 0}

/* Farben der Vorlagen */
.theme-portal .mc-tile i,.theme-portal .mc-row i{background:#E3F1FB;color:#0B7BC4}
.theme-portal .mc-all{background:#E3F1FB}.theme-portal .mc-all span{color:#0B7BC4}.theme-portal .mc-all i{background:#0B7BC4;color:#fff}
body.theme-moderno .mc-tile{box-shadow:0 1px 2px rgba(15,23,42,.04)}

@media (prefers-color-scheme:dark){
  .msheet-grip i{background:#3A3F4E}
  .msheet-back,.msheet-x{background:#22252F}
  .msheet-search{background:#14161D}
}
@media (min-width:600px){.mc-grid{grid-template-columns:repeat(4,minmax(0,1fr))}}
@media (max-width:380px){.mc-grid{gap:8px}.mc-tile{padding:12px 2px 10px}.mc-tile span{font-size:.69rem;letter-spacing:-.01em}}
